r284897 - Module: improve the diagnostic message for include of non-modular header.

Manman Ren via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 21 16:27:38 PDT 2016


Author: mren
Date: Fri Oct 21 18:27:37 2016
New Revision: 284897

URL: http://llvm.org/viewvc/llvm-project?rev=284897&view=rev
Log:
Module: improve the diagnostic message for include of non-modular header.

Emit the actual path to the non-modular include.

rdar://28897010

Modified:
    cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td
    cfe/trunk/lib/Lex/ModuleMap.cpp
    cfe/trunk/test/Modules/incomplete-module.m

Modified: cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td?rev=284897&r1=284896&r2=284897&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td Fri Oct 21 18:27:37 2016
@@ -659,10 +659,10 @@ def warn_use_of_private_header_outside_m
 def err_undeclared_use_of_module : Error<
   "module %0 does not depend on a module exporting '%1'">;
 def warn_non_modular_include_in_framework_module : Warning<
-  "include of non-modular header inside framework module '%0'">,
+  "include of non-modular header inside framework module '%0': '%1'">,
   InGroup<NonModularIncludeInFrameworkModule>, DefaultIgnore;
 def warn_non_modular_include_in_module : Warning<
-  "include of non-modular header inside module '%0'">,
+  "include of non-modular header inside module '%0': '%1'">,
   InGroup<NonModularIncludeInModule>, DefaultIgnore;
 def warn_module_conflict : Warning<
   "module '%0' conflicts with already-imported module '%1': %2">, 

Modified: cfe/trunk/lib/Lex/ModuleMap.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/ModuleMap.cpp?rev=284897&r1=284896&r2=284897&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/ModuleMap.cpp (original)
+++ cfe/trunk/lib/Lex/ModuleMap.cpp Fri Oct 21 18:27:37 2016
@@ -303,7 +303,8 @@ void ModuleMap::diagnoseHeaderInclusion(
     diag::kind DiagID = RequestingModule->getTopLevelModule()->IsFramework ?
         diag::warn_non_modular_include_in_framework_module :
         diag::warn_non_modular_include_in_module;
-    Diags.Report(FilenameLoc, DiagID) << RequestingModule->getFullModuleName();
+    Diags.Report(FilenameLoc, DiagID) << RequestingModule->getFullModuleName()
+        << File->getName();
   }
 }
 

Modified: cfe/trunk/test/Modules/incomplete-module.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/incomplete-module.m?rev=284897&r1=284896&r2=284897&view=diff
==============================================================================
--- cfe/trunk/test/Modules/incomplete-module.m (original)
+++ cfe/trunk/test/Modules/incomplete-module.m Fri Oct 21 18:27:37 2016
@@ -2,7 +2,7 @@
 
 // RUN: rm -rf %t
 // RUN: %clang_cc1 -fmodules-cache-path=%t -Wincomplete-module -fmodules -fimplicit-module-maps -I %S/Inputs %s 2>&1 | FileCheck %s
-// CHECK: warning: include of non-modular header inside module 'incomplete_mod'
+// CHECK: warning: include of non-modular header inside module 'incomplete_mod': {{'.*incomplete_mod_missing.h'}}
 
 // RUN: rm -rf %t
 // RUN: not %clang_cc1 -fmodules-cache-path=%t -fmodules-strict-decluse -fmodules -fimplicit-module-maps -I %S/Inputs %s 2>&1 | FileCheck %s -check-prefix=DECLUSE




More information about the cfe-commits mailing list