summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2017-06-05 18:57:56 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2017-06-05 18:57:56 +0000
commit27e5aa08920da04e5f2798f7d4da9a5063da7be6 (patch)
treee6b0ddf9a454a71bc1d460e2d0cb06277d931405 /clang/lib/Frontend
parent6b1993491535d59799de3a3bef4dd5b496b14b54 (diff)
downloadbcm5719-llvm-27e5aa08920da04e5f2798f7d4da9a5063da7be6.tar.gz
bcm5719-llvm-27e5aa08920da04e5f2798f7d4da9a5063da7be6.zip
Factor out and unify emission of "module is unavailable" diagnostics.
Inspired by post-commit review of r304190. llvm-svn: 304728
Diffstat (limited to 'clang/lib/Frontend')
-rw-r--r--clang/lib/Frontend/CompilerInstance.cpp18
-rw-r--r--clang/lib/Frontend/FrontendAction.cpp16
2 files changed, 6 insertions, 28 deletions
diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp
index e92672a785d..3e390c96e11 100644
--- a/clang/lib/Frontend/CompilerInstance.cpp
+++ b/clang/lib/Frontend/CompilerInstance.cpp
@@ -1824,20 +1824,10 @@ CompilerInstance::loadModule(SourceLocation ImportLoc,
}
// Check whether this module is available.
- clang::Module::Requirement Requirement;
- clang::Module::UnresolvedHeaderDirective MissingHeader;
- if (!Module->isAvailable(getLangOpts(), getTarget(), Requirement,
- MissingHeader)) {
- if (MissingHeader.FileNameLoc.isValid()) {
- getDiagnostics().Report(MissingHeader.FileNameLoc,
- diag::err_module_header_missing)
- << MissingHeader.IsUmbrella << MissingHeader.FileName;
- } else {
- getDiagnostics().Report(ImportLoc, diag::err_module_unavailable)
- << Module->getFullModuleName()
- << Requirement.second << Requirement.first
- << SourceRange(Path.front().second, Path.back().second);
- }
+ if (Preprocessor::checkModuleIsAvailable(getLangOpts(), getTarget(),
+ getDiagnostics(), Module)) {
+ getDiagnostics().Report(ImportLoc, diag::note_module_import_here)
+ << SourceRange(Path.front().second, Path.back().second);
LastModuleImportLoc = ImportLoc;
LastModuleImportResult = ModuleLoadResult();
return ModuleLoadResult();
diff --git a/clang/lib/Frontend/FrontendAction.cpp b/clang/lib/Frontend/FrontendAction.cpp
index ef98172b55b..2de8f06e712 100644
--- a/clang/lib/Frontend/FrontendAction.cpp
+++ b/clang/lib/Frontend/FrontendAction.cpp
@@ -443,21 +443,9 @@ static Module *prepareToBuildModule(CompilerInstance &CI,
}
// Check whether we can build this module at all.
- clang::Module::Requirement Requirement;
- clang::Module::UnresolvedHeaderDirective MissingHeader;
- if (!M->isAvailable(CI.getLangOpts(), CI.getTarget(), Requirement,
- MissingHeader)) {
- if (MissingHeader.FileNameLoc.isValid()) {
- CI.getDiagnostics().Report(MissingHeader.FileNameLoc,
- diag::err_module_header_missing)
- << MissingHeader.IsUmbrella << MissingHeader.FileName;
- } else {
- CI.getDiagnostics().Report(diag::err_module_unavailable)
- << M->getFullModuleName() << Requirement.second << Requirement.first;
- }
-
+ if (Preprocessor::checkModuleIsAvailable(CI.getLangOpts(), CI.getTarget(),
+ CI.getDiagnostics(), M))
return nullptr;
- }
// Inform the preprocessor that includes from within the input buffer should
// be resolved relative to the build directory of the module map file.
OpenPOWER on IntegriCloud