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
llvm-svn: 326023
This commit is contained in:
Daniel Jasper 2018-02-24 06:54:09 +00:00
parent 5dc6ca8e5b
commit 4ea330c8c3
2 changed files with 3 additions and 3 deletions

View 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.

View 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