summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Langmuir <blangmuir@apple.com>2014-05-05 16:58:47 +0000
committerBen Langmuir <blangmuir@apple.com>2014-05-05 16:58:47 +0000
commit1ecf750ec83d16bb1e658068ae68d03ae9244158 (patch)
tree732f9d8c2c69e31957f24c53dc5776210c64693a
parent82ad91915e3163f0d4d24b9250e85812e263bc13 (diff)
downloadbcm5719-llvm-1ecf750ec83d16bb1e658068ae68d03ae9244158.tar.gz
bcm5719-llvm-1ecf750ec83d16bb1e658068ae68d03ae9244158.zip
Add -Wmodule-build to make it easy to see when modules are (re)built
Warning is default ignore, and not in -Wall. llvm-svn: 207975
-rw-r--r--clang/include/clang/Basic/DiagnosticFrontendKinds.td2
-rw-r--r--clang/lib/Frontend/CompilerInstance.cpp3
-rw-r--r--clang/test/Modules/Wmodule-build.m22
3 files changed, 27 insertions, 0 deletions
diff --git a/clang/include/clang/Basic/DiagnosticFrontendKinds.td b/clang/include/clang/Basic/DiagnosticFrontendKinds.td
index 7b500eed5c0..674d6d6c42f 100644
--- a/clang/include/clang/Basic/DiagnosticFrontendKinds.td
+++ b/clang/include/clang/Basic/DiagnosticFrontendKinds.td
@@ -167,6 +167,8 @@ def warn_module_config_macro_undef : Warning<
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;
diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp
index d7b526b2da2..4a75186d975 100644
--- a/clang/lib/Frontend/CompilerInstance.cpp
+++ b/clang/lib/Frontend/CompilerInstance.cpp
@@ -1219,6 +1219,9 @@ CompilerInstance::loadModule(SourceLocation ImportLoc,
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 &&
diff --git a/clang/test/Modules/Wmodule-build.m b/clang/test/Modules/Wmodule-build.m
new file mode 100644
index 00000000000..74e020965c4
--- /dev/null
+++ b/clang/test/Modules/Wmodule-build.m
@@ -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
+
+@import A; // expected-warning{{building module 'A' as}}
+@import B; // expected-warning{{building module 'B' as}}
+@import A; // no diagnostic
+@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'
OpenPOWER on IntegriCloud