aboutsummaryrefslogtreecommitdiff
path: root/lib/Frontend
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Frontend')
-rw-r--r--lib/Frontend/ASTUnit.cpp11
-rw-r--r--lib/Frontend/FrontendAction.cpp6
2 files changed, 13 insertions, 4 deletions
diff --git a/lib/Frontend/ASTUnit.cpp b/lib/Frontend/ASTUnit.cpp
index d6bdae4aaf..1ef5ba864e 100644
--- a/lib/Frontend/ASTUnit.cpp
+++ b/lib/Frontend/ASTUnit.cpp
@@ -1133,7 +1133,8 @@ bool ASTUnit::Parse(llvm::MemoryBuffer *OverrideMainBuffer) {
StoredDiagnostics);
}
- Act->Execute();
+ if (!Act->Execute())
+ goto error;
transferASTDataFromCompilerInstance(*Clang);
@@ -1795,7 +1796,13 @@ ASTUnit *ASTUnit::LoadFromCompilerInvocationAction(CompilerInvocation *CI,
AST->getCurrentTopLevelHashValue()));
Clang->setASTConsumer(new MultiplexConsumer(Consumers));
}
- Act->Execute();
+ if (!Act->Execute()) {
+ AST->transferASTDataFromCompilerInstance(*Clang);
+ if (OwnAST && ErrAST)
+ ErrAST->swap(OwnAST);
+
+ return 0;
+ }
// Steal the created target, context, and preprocessor.
AST->transferASTDataFromCompilerInstance(*Clang);
diff --git a/lib/Frontend/FrontendAction.cpp b/lib/Frontend/FrontendAction.cpp
index 1ff32921d9..fb53c71fa9 100644
--- a/lib/Frontend/FrontendAction.cpp
+++ b/lib/Frontend/FrontendAction.cpp
@@ -315,7 +315,7 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI,
return false;
}
-void FrontendAction::Execute() {
+bool FrontendAction::Execute() {
CompilerInstance &CI = getCompilerInstance();
// Initialize the main file entry. This needs to be delayed until after PCH
@@ -325,7 +325,7 @@ void FrontendAction::Execute() {
getCurrentInput().IsSystem
? SrcMgr::C_System
: SrcMgr::C_User))
- return;
+ return false;
}
if (CI.hasFrontendTimer()) {
@@ -333,6 +333,8 @@ void FrontendAction::Execute() {
ExecuteAction();
}
else ExecuteAction();
+
+ return true;
}
void FrontendAction::EndSourceFile() {