[cfe-commits] r140746 - in /cfe/trunk: include/clang/Basic/DiagnosticCommonKinds.td include/clang/Basic/DiagnosticGroups.td lib/Frontend/CompilerInstance.cpp test/Modules/on-demand-build-warnings.m
Douglas Gregor
dgregor at apple.com
Wed Sep 28 17:52:27 PDT 2011
Author: dgregor
Date: Wed Sep 28 19:52:27 2011
New Revision: 140746
URL: http://llvm.org/viewvc/llvm-project?rev=140746&view=rev
Log:
Introduce an opt-in warning when a module is being implicitly built
from sources.
Added:
cfe/trunk/test/Modules/on-demand-build-warnings.m
Modified:
cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td
cfe/trunk/include/clang/Basic/DiagnosticGroups.td
cfe/trunk/lib/Frontend/CompilerInstance.cpp
Modified: cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td?rev=140746&r1=140745&r2=140746&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td Wed Sep 28 19:52:27 2011
@@ -63,6 +63,8 @@
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<
Modified: cfe/trunk/include/clang/Basic/DiagnosticGroups.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticGroups.td?rev=140746&r1=140745&r2=140746&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticGroups.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticGroups.td Wed Sep 28 19:52:27 2011
@@ -85,6 +85,7 @@
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">;
Modified: cfe/trunk/lib/Frontend/CompilerInstance.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInstance.cpp?rev=140746&r1=140745&r2=140746&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInstance.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInstance.cpp Wed Sep 28 19:52:27 2011
@@ -752,6 +752,8 @@
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());
Added: cfe/trunk/test/Modules/on-demand-build-warnings.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/on-demand-build-warnings.m?rev=140746&view=auto
==============================================================================
--- cfe/trunk/test/Modules/on-demand-build-warnings.m (added)
+++ cfe/trunk/test/Modules/on-demand-build-warnings.m Wed Sep 28 19:52:27 2011
@@ -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}}
+
More information about the cfe-commits
mailing list