r219658 - Extend -Rmodule-build to also remark when module building finishes.

Richard Smith richard-llvm at metafoo.co.uk
Mon Oct 13 19:08:30 PDT 2014


Author: rsmith
Date: Mon Oct 13 21:08:30 2014
New Revision: 219658

URL: http://llvm.org/viewvc/llvm-project?rev=219658&view=rev
Log:
Extend -Rmodule-build to also remark when module building finishes.

In cases of nested module builds, or when you care how long module builds take,
this information was not previously easily available / obvious.

Modified:
    cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td
    cfe/trunk/include/clang/Basic/DiagnosticGroups.td
    cfe/trunk/lib/Frontend/CompilerInstance.cpp
    cfe/trunk/test/Modules/Rmodule-build.m

Modified: cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td?rev=219658&r1=219657&r2=219658&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td Mon Oct 13 21:08:30 2014
@@ -170,7 +170,9 @@ def warn_module_config_macro_undef : War
 def note_module_def_undef_here : Note<
   "macro was %select{defined|#undef'd}0 here">;
 def remark_module_build : Remark<"building module '%0' as '%1'">,
-  InGroup<DiagGroup<"module-build">>;
+  InGroup<ModuleBuild>;
+def remark_module_build_done : Remark<"finished building module '%0'">,
+  InGroup<ModuleBuild>;
 
 def err_conflicting_module_names : Error<
   "conflicting module names specified: '-fmodule-name=%0' and "

Modified: cfe/trunk/include/clang/Basic/DiagnosticGroups.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticGroups.td?rev=219658&r1=219657&r2=219658&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticGroups.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticGroups.td Mon Oct 13 21:08:30 2014
@@ -231,6 +231,7 @@ def MismatchedParameterTypes : DiagGroup
 def MismatchedReturnTypes : DiagGroup<"mismatched-return-types">;
 def MismatchedTags : DiagGroup<"mismatched-tags">;
 def MissingFieldInitializers : DiagGroup<"missing-field-initializers">;
+def ModuleBuild : DiagGroup<"module-build">;
 def ModuleConflict : DiagGroup<"module-conflict">;
 def NewlineEOF : DiagGroup<"newline-eof">;
 def NullArithmetic : DiagGroup<"null-arithmetic">;

Modified: cfe/trunk/lib/Frontend/CompilerInstance.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInstance.cpp?rev=219658&r1=219657&r2=219658&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInstance.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInstance.cpp Mon Oct 13 21:08:30 2014
@@ -963,7 +963,11 @@ static bool compileModuleImpl(CompilerIn
   // safe because the FileManager is shared between the compiler instances.
   GenerateModuleAction CreateModuleAction(
       ModMap.getModuleMapFileForUniquing(Module), Module->IsSystem);
-  
+
+  ImportingInstance.getDiagnostics().Report(ImportLoc,
+                                            diag::remark_module_build)
+    << Module->Name << ModuleFileName;
+
   // Execute the action to actually build the module in-place. Use a separate
   // thread so that we get a stack large enough.
   const unsigned ThreadStackSize = 8 << 20;
@@ -971,6 +975,10 @@ static bool compileModuleImpl(CompilerIn
   CRC.RunSafelyOnThread([&]() { Instance.ExecuteAction(CreateModuleAction); },
                         ThreadStackSize);
 
+  ImportingInstance.getDiagnostics().Report(ImportLoc,
+                                            diag::remark_module_build_done)
+    << Module->Name;
+
   // Delete the temporary module map file.
   // FIXME: Even though we're executing under crash protection, it would still
   // be nice to do this with RemoveFileOnSignal when we can. However, that
@@ -1352,9 +1360,6 @@ CompilerInstance::loadModule(SourceLocat
         return ModuleLoadResult();
       }
 
-      getDiagnostics().Report(ImportLoc, diag::remark_module_build)
-          << ModuleName << ModuleFileName;
-
       // Check whether we have already attempted to build this module (but
       // failed).
       if (getPreprocessorOpts().FailedModules &&

Modified: cfe/trunk/test/Modules/Rmodule-build.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Rmodule-build.m?rev=219658&r1=219657&r2=219658&view=diff
==============================================================================
--- cfe/trunk/test/Modules/Rmodule-build.m (original)
+++ cfe/trunk/test/Modules/Rmodule-build.m Mon Oct 13 21:08:30 2014
@@ -2,23 +2,25 @@
 // RUN: rm -rf %t
 // RUN: mkdir %t
 // RUN: echo '// A' > %t/A.h
-// RUN: echo '// B' > %t/B.h
+// RUN: echo '#include "C.h"' > %t/B.h
+// RUN: echo '// C' > %t/C.h
 // RUN: echo 'module A { header "A.h" }' > %t/module.modulemap
 // RUN: echo 'module B { header "B.h" }' >> %t/module.modulemap
+// RUN: echo 'module C { header "C.h" }' >> %t/module.modulemap
 
 // RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fsyntax-only %s -verify \
 // RUN:            -I %t -Rmodule-build
 
- at import A; // expected-remark{{building module 'A' as}}
- at import B; // expected-remark{{building module 'B' as}}
+ at import A; // expected-remark{{building module 'A' as}} expected-remark {{finished building module 'A'}}
+ at import B; // expected-remark{{building module 'B' as}} expected-remark {{finished building module 'B'}}
 @import A; // no diagnostic
 @import B; // no diagnostic
 
-// RUN: echo ' ' >> %t/B.h
+// RUN: echo ' ' >> %t/C.h
 // RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fsyntax-only %s -I %t \
 // RUN:            -Rmodule-build 2>&1 | FileCheck %s
 
-// RUN: echo ' ' >> %t/B.h
+// RUN: echo ' ' >> %t/C.h
 // RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fsyntax-only %s -I %t \
 // RUN:            -Reverything 2>&1 | FileCheck %s
 
@@ -33,5 +35,8 @@
 
 // CHECK-NOT: building module 'A'
 // CHECK: building module 'B'
+// CHECK: building module 'C'
+// CHECK: finished building module 'C'
+// CHECK: finished building module 'B'
 // NO-REMARKS-NOT: building module 'A'
 // NO-REMARKS-NOT: building module 'B'





More information about the cfe-commits mailing list