]> granicus.if.org Git - clang/commitdiff
Make module use diagnostics refer to the top-level module
authorDaniel Jasper <djasper@google.com>
Sat, 24 Feb 2018 06:54:09 +0000 (06:54 +0000)
committerDaniel Jasper <djasper@google.com>
Sat, 24 Feb 2018 06:54:09 +0000 (06:54 +0000)
All use declarations need to be directly placed in the top-level module
anyway, knowing the submodule doesn't really help. The header that has
the offending #include can easily be seen in the diagnostics source
location.

Review: https://reviews.llvm.org/D43673

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326023 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Lex/ModuleMap.cpp
test/Modules/Inputs/declare-use/h.h

index 657eef167a69a1866c163c741d8af4251c7f347b..2ff0a68cb5f91114d65dee989e3bd2e3f7c355e6 100644 (file)
@@ -475,7 +475,7 @@ void ModuleMap::diagnoseHeaderInclusion(Module *RequestingModule,
   // We have found a module, but we don't use it.
   if (NotUsed) {
     Diags.Report(FilenameLoc, diag::err_undeclared_use_of_module)
-        << RequestingModule->getFullModuleName() << Filename;
+        << RequestingModule->getTopLevelModule()->Name << Filename;
     return;
   }
 
@@ -486,7 +486,7 @@ void ModuleMap::diagnoseHeaderInclusion(Module *RequestingModule,
 
   if (LangOpts.ModulesStrictDeclUse) {
     Diags.Report(FilenameLoc, diag::err_undeclared_use_of_module)
-        << RequestingModule->getFullModuleName() << Filename;
+        << RequestingModule->getTopLevelModule()->Name << Filename;
   } else if (RequestingModule && RequestingModuleIsModuleInterface &&
              LangOpts.isCompilingModule()) {
     // Do not diagnose when we are not compiling a module. 
index 379e50180ca19964edb164de8d4c7ca3257ab543..8984727c565e7bd1e4f956c9aee547c327358e22 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef H_H
 #define H_H
 #include "c.h"
-#include "d.h" // expected-error {{does not depend on a module exporting}}
+#include "d.h" // expected-error {{module XH does not depend on a module exporting}}
 #include "h1.h"
 const int h1 = aux_h*c*7*d;
 #endif