[cfe-commits] r149107 - /cfe/trunk/lib/Rewrite/FrontendActions.cpp
Argyrios Kyrtzidis
akyrtzi at gmail.com
Thu Jan 26 17:00:48 PST 2012
Author: akirtzidis
Date: Thu Jan 26 19:00:47 2012
New Revision: 149107
URL: http://llvm.org/viewvc/llvm-project?rev=149107&view=rev
Log:
In FixItRecompile::BeginInvocation(), check the return value of BeginSourceFile().
Modified:
cfe/trunk/lib/Rewrite/FrontendActions.cpp
Modified: cfe/trunk/lib/Rewrite/FrontendActions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Rewrite/FrontendActions.cpp?rev=149107&r1=149106&r2=149107&view=diff
==============================================================================
--- cfe/trunk/lib/Rewrite/FrontendActions.cpp (original)
+++ cfe/trunk/lib/Rewrite/FrontendActions.cpp Thu Jan 26 19:00:47 2012
@@ -113,25 +113,27 @@
{
const FrontendOptions &FEOpts = CI.getFrontendOpts();
llvm::OwningPtr<FrontendAction> FixAction(new SyntaxOnlyAction());
- FixAction->BeginSourceFile(CI, FEOpts.Inputs[0]);
-
- llvm::OwningPtr<FixItOptions> FixItOpts;
- if (FEOpts.FixToTemporaries)
- FixItOpts.reset(new FixItRewriteToTemp());
- else
- FixItOpts.reset(new FixItRewriteInPlace());
- FixItOpts->Silent = true;
- FixItOpts->FixWhatYouCan = FEOpts.FixWhatYouCan;
- FixItOpts->FixOnlyWarnings = FEOpts.FixOnlyWarnings;
- FixItRewriter Rewriter(CI.getDiagnostics(), CI.getSourceManager(),
- CI.getLangOpts(), FixItOpts.get());
- FixAction->Execute();
-
- err = Rewriter.WriteFixedFiles(&RewrittenFiles);
+ if (FixAction->BeginSourceFile(CI, FEOpts.Inputs[0])) {
+ llvm::OwningPtr<FixItOptions> FixItOpts;
+ if (FEOpts.FixToTemporaries)
+ FixItOpts.reset(new FixItRewriteToTemp());
+ else
+ FixItOpts.reset(new FixItRewriteInPlace());
+ FixItOpts->Silent = true;
+ FixItOpts->FixWhatYouCan = FEOpts.FixWhatYouCan;
+ FixItOpts->FixOnlyWarnings = FEOpts.FixOnlyWarnings;
+ FixItRewriter Rewriter(CI.getDiagnostics(), CI.getSourceManager(),
+ CI.getLangOpts(), FixItOpts.get());
+ FixAction->Execute();
- FixAction->EndSourceFile();
- CI.setSourceManager(0);
- CI.setFileManager(0);
+ err = Rewriter.WriteFixedFiles(&RewrittenFiles);
+
+ FixAction->EndSourceFile();
+ CI.setSourceManager(0);
+ CI.setFileManager(0);
+ } else {
+ err = true;
+ }
}
if (err)
return false;
More information about the cfe-commits
mailing list