Make sure to call EndSourceFile even if we can't continue compiling.

Patch by Andy Gibbs!

llvm-svn: 161649
This commit is contained in:
Jordan Rose 2012-08-10 01:06:08 +00:00
parent f5697e5222
commit ea762b0460
1 changed files with 5 additions and 1 deletions

View File

@ -162,6 +162,7 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI,
setCurrentInput(Input);
setCompilerInstance(&CI);
bool HasBegunSourceFile = false;
if (!BeginInvocation(CI))
goto failure;
@ -214,6 +215,7 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI,
// Inform the diagnostic client we are processing a source file.
CI.getDiagnosticClient().BeginSourceFile(CI.getLangOpts(), 0);
HasBegunSourceFile = true;
// Initialize the action.
if (!BeginSourceFileAction(CI, Input.File))
@ -228,6 +230,7 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI,
// Inform the diagnostic client we are processing a source file.
CI.getDiagnosticClient().BeginSourceFile(CI.getLangOpts(),
&CI.getPreprocessor());
HasBegunSourceFile = true;
// Initialize the action.
if (!BeginSourceFileAction(CI, Input.File))
@ -309,7 +312,8 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI,
CI.setFileManager(0);
}
CI.getDiagnosticClient().EndSourceFile();
if (HasBegunSourceFile)
CI.getDiagnosticClient().EndSourceFile();
setCurrentInput(FrontendInputFile());
setCompilerInstance(0);
return false;