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

Ben Langmuir blangmuir at apple.com
Mon May 5 13:07:28 PDT 2014


On May 5, 2014, at 12:54 PM, Richard Smith <richard at metafoo.co.uk> wrote:

> On Mon, May 5, 2014 at 12:27 PM, Ben Langmuir <blangmuir at apple.com> wrote:
> Hi Richard,
> 
> I agree in principle, but I was under the impression remark wasn’t fully baked for clang diagnostics yet.  For example, the commit message says:
> 
>> This patch is by intention minimal in terms of parameter handling. More
>> experience and more discussions will most likely lead to further enhancements
>> in the parameter handling.
> 
> 
> And indeed, I gave it a spin and immediately noticed that it prints out [ -Rmodule-build ] in the diagnostics, which is actively misleading when -R is not a supported diagnostic option spelling.
> 
> Yeah, we don't support the command-line interface for it yet, but that should be straightforward. That burden has basically been deferred to the first "lucky" person who wants to add a remark. Looks like that might be you? :)

Adding Tobias who wrote the commit message I’m interpreting :)

I took “more experience and more discussions” to mean we didn’t know what we wanted yet.  If my interpretation is incorrect, and it really is just a matter of wiring up -R like a simplified* -W, then I agree that it should be straightforward to implement

Ben

* By simplified, I mean that I assume we don’t want all of the special case -W options like everything, error, system-headers ...

> 
> Ben
> 
> On May 5, 2014, at 11:39 AM, Richard Smith <richard at metafoo.co.uk> wrote:
> 
>> 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/8f21b3d3/attachment.html>


More information about the cfe-commits mailing list