aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/CompilerInstance.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2015-10-16 23:20:19 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2015-10-16 23:20:19 +0000
commit95dc57a611ad2571b61b0a2940132b43173432ac (patch)
treef04a19ea8addfceef48dacf6644e2d797ea8f9a8 /clang/lib/Frontend/CompilerInstance.cpp
parent128d4ab71f5d95021b7436cd34dd8261e4f1a184 (diff)
downloadllvm-95dc57a611ad2571b61b0a2940132b43173432ac.zip
llvm-95dc57a611ad2571b61b0a2940132b43173432ac.tar.gz
llvm-95dc57a611ad2571b61b0a2940132b43173432ac.tar.bz2
[modules] Allow the error when explicitly loading an incompatible module file
via -fmodule-file= to be turned off; in that case, just include the relevant files textually. This allows module files to be unconditionally passed to all compile actions via CXXFLAGS, and to be ignored for rules that specify custom incompatible flags. llvm-svn: 250577
Diffstat (limited to 'clang/lib/Frontend/CompilerInstance.cpp')
-rw-r--r--clang/lib/Frontend/CompilerInstance.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp
index 740524c..8220a6e 100644
--- a/clang/lib/Frontend/CompilerInstance.cpp
+++ b/clang/lib/Frontend/CompilerInstance.cpp
@@ -1335,15 +1335,24 @@ bool CompilerInstance::loadModuleFile(StringRef FileName) {
std::move(Listener));
// Try to load the module file.
- if (ModuleManager->ReadAST(FileName, serialization::MK_ExplicitModule,
- SourceLocation(), ASTReader::ARR_None)
- != ASTReader::Success)
- return false;
-
+ switch (ModuleManager->ReadAST(FileName, serialization::MK_ExplicitModule,
+ SourceLocation(),
+ ASTReader::ARR_ConfigurationMismatch)) {
+ case ASTReader::Success:
// We successfully loaded the module file; remember the set of provided
// modules so that we don't try to load implicit modules for them.
ListenerRef.registerAll();
return true;
+
+ case ASTReader::ConfigurationMismatch:
+ // Ignore unusable module files.
+ getDiagnostics().Report(SourceLocation(), diag::warn_module_config_mismatch)
+ << FileName;
+ return true;
+
+ default:
+ return false;
+ }
}
ModuleLoadResult