summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend
diff options
context:
space:
mode:
authorBen Langmuir <blangmuir@apple.com>2014-03-12 00:06:17 +0000
committerBen Langmuir <blangmuir@apple.com>2014-03-12 00:06:17 +0000
commitdcf73861a56ed4ea334a88b71b2f0ffd8d8f10bd (patch)
tree83d43bd771ccd7cdeb76e86dbebf503a5c3f3bd2 /clang/lib/Frontend
parente8d69b7fc98d612afc74bab7eda457646fc06900 (diff)
downloadbcm5719-llvm-dcf73861a56ed4ea334a88b71b2f0ffd8d8f10bd.tar.gz
bcm5719-llvm-dcf73861a56ed4ea334a88b71b2f0ffd8d8f10bd.zip
Add an option -fmodules-validate-system-headers
When enabled, always validate the system headers when loading a module. The end result of this is that when these headers change, we will notice and rebuild the module. llvm-svn: 203630
Diffstat (limited to 'clang/lib/Frontend')
-rw-r--r--clang/lib/Frontend/CompilerInstance.cpp9
-rw-r--r--clang/lib/Frontend/CompilerInvocation.cpp3
2 files changed, 9 insertions, 3 deletions
diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp
index 11b5ba9f549..ce47674edbc 100644
--- a/clang/lib/Frontend/CompilerInstance.cpp
+++ b/clang/lib/Frontend/CompilerInstance.cpp
@@ -334,13 +334,15 @@ CompilerInstance::createPCHExternalASTSource(StringRef Path,
void *DeserializationListener,
bool Preamble,
bool UseGlobalModuleIndex) {
+ HeaderSearchOptions &HSOpts = PP.getHeaderSearchInfo().getHeaderSearchOpts();
+
std::unique_ptr<ASTReader> Reader;
Reader.reset(new ASTReader(PP, Context,
Sysroot.empty() ? "" : Sysroot.c_str(),
DisablePCHValidation,
AllowPCHWithCompilerErrors,
/*AllowConfigurationMismatch*/false,
- /*ValidateSystemInputs*/false,
+ HSOpts.ModulesValidateSystemHeaders,
UseGlobalModuleIndex));
Reader->setDeserializationListener(
@@ -1141,14 +1143,15 @@ CompilerInstance::loadModule(SourceLocation ImportLoc,
pruneModuleCache(getHeaderSearchOpts());
}
- std::string Sysroot = getHeaderSearchOpts().Sysroot;
+ HeaderSearchOptions &HSOpts = getHeaderSearchOpts();
+ std::string Sysroot = HSOpts.Sysroot;
const PreprocessorOptions &PPOpts = getPreprocessorOpts();
ModuleManager = new ASTReader(getPreprocessor(), *Context,
Sysroot.empty() ? "" : Sysroot.c_str(),
PPOpts.DisablePCHValidation,
/*AllowASTWithCompilerErrors=*/false,
/*AllowConfigurationMismatch=*/false,
- /*ValidateSystemInputs=*/false,
+ HSOpts.ModulesValidateSystemHeaders,
getFrontendOpts().UseGlobalModuleIndex);
if (hasASTConsumer()) {
ModuleManager->setDeserializationListener(
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index 20e59c2726c..f368837a5f0 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -930,6 +930,9 @@ static void ParseHeaderSearchArgs(HeaderSearchOptions &Opts, ArgList &Args) {
Args.hasArg(OPT_fmodules_validate_once_per_build_session);
Opts.BuildSessionTimestamp =
getLastArgUInt64Value(Args, OPT_fbuild_session_timestamp, 0);
+ Opts.ModulesValidateSystemHeaders =
+ Args.hasArg(OPT_fmodules_validate_system_headers);
+
for (arg_iterator it = Args.filtered_begin(OPT_fmodules_ignore_macro),
ie = Args.filtered_end();
it != ie; ++it) {
OpenPOWER on IntegriCloud