r207975 - Add -Wmodule-build to make it easy to see when modules are (re)built

Richard Smith richard at metafoo.co.uk
Mon May 5 11:39:10 PDT 2014


On Mon, May 5, 2014 at 9:58 AM, Ben Langmuir <blangmuir at apple.com> wrote:

> Author: benlangmuir
> Date: Mon May  5 11:58:47 2014
> New Revision: 207975
>
> URL: http://llvm.org/viewvc/llvm-project?rev=207975&view=rev
> Log:
> Add -Wmodule-build to make it easy to see when modules are (re)built
>
> Warning is default ignore, and not in -Wall.
>

This seems ideally suited to be a remark rather than a warning.


> Added:
>     cfe/trunk/test/Modules/Wmodule-build.m
> Modified:
>     cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td
>     cfe/trunk/lib/Frontend/CompilerInstance.cpp
>
> Modified: cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td?rev=207975&r1=207974&r2=207975&view=diff
>
> ==============================================================================
> --- cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td (original)
> +++ cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td Mon May  5
> 11:58:47 2014
> @@ -167,6 +167,8 @@ def warn_module_config_macro_undef : War
>    InGroup<ConfigMacros>;
>  def note_module_def_undef_here : Note<
>    "macro was %select{defined|#undef'd}0 here">;
> +def warn_module_build : Warning<"building module '%0' as '%1'">,
> +  InGroup<DiagGroup<"module-build">>, DefaultIgnore;
>
>  def err_missing_vfs_overlay_file : Error<
>    "virtual filesystem overlay file '%0' not found">, DefaultFatal;
>
> Modified: cfe/trunk/lib/Frontend/CompilerInstance.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInstance.cpp?rev=207975&r1=207974&r2=207975&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/Frontend/CompilerInstance.cpp (original)
> +++ cfe/trunk/lib/Frontend/CompilerInstance.cpp Mon May  5 11:58:47 2014
> @@ -1219,6 +1219,9 @@ CompilerInstance::loadModule(SourceLocat
>          return ModuleLoadResult();
>        }
>
> +      getDiagnostics().Report(ImportLoc, diag::warn_module_build)
> +          << ModuleName << ModuleFileName;
> +
>        // Check whether we have already attempted to build this module (but
>        // failed).
>        if (getPreprocessorOpts().FailedModules &&
>
> Added: cfe/trunk/test/Modules/Wmodule-build.m
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Wmodule-build.m?rev=207975&view=auto
>
> ==============================================================================
> --- cfe/trunk/test/Modules/Wmodule-build.m (added)
> +++ cfe/trunk/test/Modules/Wmodule-build.m Mon May  5 11:58:47 2014
> @@ -0,0 +1,22 @@
> +// REQUIRES: shell
> +// RUN: rm -rf %t
> +// RUN: mkdir %t
> +// RUN: echo '// A' > %t/A.h
> +// RUN: echo '// B' > %t/B.h
> +// RUN: echo 'module A { header "A.h" }' > %t/module.modulemap
> +// RUN: echo 'module B { header "B.h" }' >> %t/module.modulemap
> +
> +// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fsyntax-only %s
> -verify \
> +// RUN:            -I %t -Wmodule-build
> +
> + at import A; // expected-warning{{building module 'A' as}}
> + at import B; // expected-warning{{building module 'B' as}}
> + at import A; // no diagnostic
> + at import B; // no diagnostic
> +
> +// RUN: echo ' ' >> %t/B.h
> +// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fsyntax-only %s -I
> %t \
> +// RUN:            -Wmodule-build 2>&1 | FileCheck %s
> +
> +// CHECK-NOT: building module 'A'
> +// CHECK: building module 'B'
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140505/da91fb84/attachment.html>


More information about the cfe-commits mailing list