diff options
| author | Douglas Gregor <dgregor@apple.com> | 2011-09-29 00:52:27 +0000 |
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2011-09-29 00:52:27 +0000 |
| commit | 44e688d46a2d20fdb2cf83f8a81f57e8c85f5f2b (patch) | |
| tree | 6b88c5d39ecf599ec9dffca2691b9f0e402c2a24 | |
| parent | d299dccf9188b740e4e34a6e1d8f6a8345c796fe (diff) | |
| download | bcm5719-llvm-44e688d46a2d20fdb2cf83f8a81f57e8c85f5f2b.tar.gz bcm5719-llvm-44e688d46a2d20fdb2cf83f8a81f57e8c85f5f2b.zip | |
Introduce an opt-in warning when a module is being implicitly built
from sources.
llvm-svn: 140746
| -rw-r--r-- | clang/include/clang/Basic/DiagnosticCommonKinds.td | 2 | ||||
| -rw-r--r-- | clang/include/clang/Basic/DiagnosticGroups.td | 1 | ||||
| -rw-r--r-- | clang/lib/Frontend/CompilerInstance.cpp | 2 | ||||
| -rw-r--r-- | clang/test/Modules/on-demand-build-warnings.m | 5 |
4 files changed, 10 insertions, 0 deletions
diff --git a/clang/include/clang/Basic/DiagnosticCommonKinds.td b/clang/include/clang/Basic/DiagnosticCommonKinds.td index 7639b5b0514..1313174b167 100644 --- a/clang/include/clang/Basic/DiagnosticCommonKinds.td +++ b/clang/include/clang/Basic/DiagnosticCommonKinds.td @@ -63,6 +63,8 @@ def err_module_not_found : Error<"module '%0' not found">, DefaultFatal; def err_module_not_built : Error<"could not build module '%0'">, DefaultFatal; def err_module_cycle : Error<"cyclic dependency in module '%0': %1">, DefaultFatal; +def warn_module_build : Warning<"building module '%0' from source">, + InGroup<ModuleBuild>, DefaultIgnore; // Sema && Lex def ext_longlong : Extension< diff --git a/clang/include/clang/Basic/DiagnosticGroups.td b/clang/include/clang/Basic/DiagnosticGroups.td index a4dbf962435..9901b79bec2 100644 --- a/clang/include/clang/Basic/DiagnosticGroups.td +++ b/clang/include/clang/Basic/DiagnosticGroups.td @@ -85,6 +85,7 @@ def : DiagGroup<"newline-eof">; def LongLong : DiagGroup<"long-long">; def MismatchedTags : DiagGroup<"mismatched-tags">; def MissingFieldInitializers : DiagGroup<"missing-field-initializers">; +def ModuleBuild : DiagGroup<"module-build">; def NullDereference : DiagGroup<"null-dereference">; def InitializerOverrides : DiagGroup<"initializer-overrides">; def NonNull : DiagGroup<"nonnull">; diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp index 554ca352e1c..27fe3f15ffa 100644 --- a/clang/lib/Frontend/CompilerInstance.cpp +++ b/clang/lib/Frontend/CompilerInstance.cpp @@ -752,6 +752,8 @@ ModuleKey CompilerInstance::loadModule(SourceLocation ImportLoc, return 0; } + getDiagnostics().Report(ModuleNameLoc, diag::warn_module_build) + << ModuleName.getName(); BuildingModule = true; compileModule(*this, ModuleName.getName(), ModuleFileName, UmbrellaHeader); ModuleFile = PP->getHeaderSearchInfo().lookupModule(ModuleName.getName()); diff --git a/clang/test/Modules/on-demand-build-warnings.m b/clang/test/Modules/on-demand-build-warnings.m new file mode 100644 index 00000000000..ea531698cf5 --- /dev/null +++ b/clang/test/Modules/on-demand-build-warnings.m @@ -0,0 +1,5 @@ +// RUN: rm -rf %t +// RUN: %clang_cc1 -fno-objc-infer-related-result-type -Wmodule-build -fmodule-cache-path %t -F %S/Inputs -DFOO -verify %s + +__import_module__ Module; // expected-warning{{building module 'Module' from source}} + |

