summaryrefslogtreecommitdiff
path: root/lib/Frontend/CompilerInstance.cpp
diff options
context:
space:
mode:
authorBen Langmuir <blangmuir@apple.com>2014-02-05 22:21:15 +0000
committerBen Langmuir <blangmuir@apple.com>2014-02-05 22:21:15 +0000
commite9e34e28c5462932c859aa2c197fecefe37ec647 (patch)
tree7493dca718dd0e341cc78d4dd56f011059dae791 /lib/Frontend/CompilerInstance.cpp
parentf763bf2808439549b5a42cc60b86c0c0ac880a5b (diff)
downloadclang-e9e34e28c5462932c859aa2c197fecefe37ec647.tar.gz
clang-e9e34e28c5462932c859aa2c197fecefe37ec647.tar.bz2
clang-e9e34e28c5462932c859aa2c197fecefe37ec647.tar.xz
Add a CC1 option -verify-pch
This option will: - load the given pch file - verify it is not out of date by stat'ing dependencies, and - return 0 on success and non-zero on error git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@200884 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/CompilerInstance.cpp')
-rw-r--r--lib/Frontend/CompilerInstance.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/Frontend/CompilerInstance.cpp b/lib/Frontend/CompilerInstance.cpp
index 0d2af334d7..d8381a824c 100644
--- a/lib/Frontend/CompilerInstance.cpp
+++ b/lib/Frontend/CompilerInstance.cpp
@@ -292,12 +292,14 @@ void CompilerInstance::createASTContext() {
void CompilerInstance::createPCHExternalASTSource(StringRef Path,
bool DisablePCHValidation,
bool AllowPCHWithCompilerErrors,
+ bool AllowConfigurationMismatch,
void *DeserializationListener){
OwningPtr<ExternalASTSource> Source;
bool Preamble = getPreprocessorOpts().PrecompiledPreambleBytes.first != 0;
Source.reset(createPCHExternalASTSource(Path, getHeaderSearchOpts().Sysroot,
DisablePCHValidation,
AllowPCHWithCompilerErrors,
+ AllowConfigurationMismatch,
getPreprocessor(), getASTContext(),
DeserializationListener,
Preamble,
@@ -311,6 +313,7 @@ CompilerInstance::createPCHExternalASTSource(StringRef Path,
const std::string &Sysroot,
bool DisablePCHValidation,
bool AllowPCHWithCompilerErrors,
+ bool AllowConfigurationMismatch,
Preprocessor &PP,
ASTContext &Context,
void *DeserializationListener,
@@ -321,6 +324,7 @@ CompilerInstance::createPCHExternalASTSource(StringRef Path,
Sysroot.empty() ? "" : Sysroot.c_str(),
DisablePCHValidation,
AllowPCHWithCompilerErrors,
+ AllowConfigurationMismatch,
UseGlobalModuleIndex));
Reader->setDeserializationListener(
@@ -329,7 +333,9 @@ CompilerInstance::createPCHExternalASTSource(StringRef Path,
Preamble ? serialization::MK_Preamble
: serialization::MK_PCH,
SourceLocation(),
- ASTReader::ARR_None)) {
+ AllowConfigurationMismatch
+ ? ASTReader::ARR_ConfigurationMismatch
+ : ASTReader::ARR_None)) {
case ASTReader::Success:
// Set the predefines buffer as suggested by the PCH reader. Typically, the
// predefines buffer will be empty.
@@ -1158,6 +1164,7 @@ CompilerInstance::loadModule(SourceLocation ImportLoc,
Sysroot.empty() ? "" : Sysroot.c_str(),
PPOpts.DisablePCHValidation,
/*AllowASTWithCompilerErrors=*/false,
+ /*AllowConfigurationMismatch=*/false,
getFrontendOpts().UseGlobalModuleIndex);
if (hasASTConsumer()) {
ModuleManager->setDeserializationListener(