summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Frontend')
-rw-r--r--clang/lib/Frontend/CompilerInstance.cpp9
-rw-r--r--clang/lib/Frontend/CompilerInvocation.cpp3
-rw-r--r--clang/lib/Frontend/FrontendAction.cpp1
-rw-r--r--clang/lib/Frontend/FrontendActions.cpp13
4 files changed, 25 insertions, 1 deletions
diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp
index 0d2af334d79..d8381a824c7 100644
--- a/clang/lib/Frontend/CompilerInstance.cpp
+++ b/clang/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(
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index 92202b7ee20..da58a0386e6 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -700,6 +700,8 @@ static InputKind ParseFrontendArgs(FrontendOptions &Opts, ArgList &Args,
Opts.ProgramAction = frontend::ParseSyntaxOnly; break;
case OPT_module_file_info:
Opts.ProgramAction = frontend::ModuleFileInfo; break;
+ case OPT_verify_pch:
+ Opts.ProgramAction = frontend::VerifyPCH; break;
case OPT_print_decl_contexts:
Opts.ProgramAction = frontend::PrintDeclContext; break;
case OPT_print_preamble:
@@ -1585,6 +1587,7 @@ static void ParsePreprocessorOutputArgs(PreprocessorOutputOptions &Opts,
case frontend::GeneratePTH:
case frontend::ParseSyntaxOnly:
case frontend::ModuleFileInfo:
+ case frontend::VerifyPCH:
case frontend::PluginAction:
case frontend::PrintDeclContext:
case frontend::RewriteObjC:
diff --git a/clang/lib/Frontend/FrontendAction.cpp b/clang/lib/Frontend/FrontendAction.cpp
index 0baf3e5e1fb..13a0787e427 100644
--- a/clang/lib/Frontend/FrontendAction.cpp
+++ b/clang/lib/Frontend/FrontendAction.cpp
@@ -314,6 +314,7 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI,
CI.getPreprocessorOpts().ImplicitPCHInclude,
CI.getPreprocessorOpts().DisablePCHValidation,
CI.getPreprocessorOpts().AllowPCHWithCompilerErrors,
+ /*AllowConfigurationMismatch*/false,
DeserialListener);
if (!CI.getASTContext().getExternalSource())
goto failure;
diff --git a/clang/lib/Frontend/FrontendActions.cpp b/clang/lib/Frontend/FrontendActions.cpp
index 0d78bf032e3..8b174605ffd 100644
--- a/clang/lib/Frontend/FrontendActions.cpp
+++ b/clang/lib/Frontend/FrontendActions.cpp
@@ -320,6 +320,19 @@ ASTConsumer *DumpModuleInfoAction::CreateASTConsumer(CompilerInstance &CI,
return new ASTConsumer();
}
+ASTConsumer *VerifyPCHAction::CreateASTConsumer(CompilerInstance &CI,
+ StringRef InFile) {
+ return new ASTConsumer();
+}
+
+void VerifyPCHAction::ExecuteAction() {
+ getCompilerInstance().
+ createPCHExternalASTSource(getCurrentFile(), /*DisablePCHValidation*/false,
+ /*AllowPCHWithCompilerErrors*/false,
+ /*AllowConfigurationMismatch*/true,
+ /*DeserializationListener*/0);
+}
+
namespace {
/// \brief AST reader listener that dumps module information for a module
/// file.
OpenPOWER on IntegriCloud