r326023 - Make module use diagnostics refer to the top-level module
Daniel Jasper via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 23 22:54:09 PST 2018
Author: djasper
Date: Fri Feb 23 22:54:09 2018
New Revision: 326023
URL: http://llvm.org/viewvc/llvm-project?rev=326023&view=rev
Log:
Make module use diagnostics refer to the top-level module
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
Modified:
cfe/trunk/lib/Lex/ModuleMap.cpp
cfe/trunk/test/Modules/Inputs/declare-use/h.h
Modified: cfe/trunk/lib/Lex/ModuleMap.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/ModuleMap.cpp?rev=326023&r1=326022&r2=326023&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/ModuleMap.cpp (original)
+++ cfe/trunk/lib/Lex/ModuleMap.cpp Fri Feb 23 22:54:09 2018
@@ -475,7 +475,7 @@ void ModuleMap::diagnoseHeaderInclusion(
// 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(
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.
Modified: cfe/trunk/test/Modules/Inputs/declare-use/h.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/declare-use/h.h?rev=326023&r1=326022&r2=326023&view=diff
==============================================================================
--- cfe/trunk/test/Modules/Inputs/declare-use/h.h (original)
+++ cfe/trunk/test/Modules/Inputs/declare-use/h.h Fri Feb 23 22:54:09 2018
@@ -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
More information about the cfe-commits
mailing list