diff options
| author | Daniel Dunbar <daniel@zuster.org> | 2009-11-11 10:22:48 +0000 |
|---|---|---|
| committer | Daniel Dunbar <daniel@zuster.org> | 2009-11-11 10:22:48 +0000 |
| commit | f580187aed19b5dbad747467c58746b6181ea697 (patch) | |
| tree | ea14b16e54069c54692ade3bcde15925f1691afc | |
| parent | 559f7a5c3cc59eae7880ffe016b1ae304b13ae91 (diff) | |
| download | bcm5719-llvm-f580187aed19b5dbad747467c58746b6181ea697.tar.gz bcm5719-llvm-f580187aed19b5dbad747467c58746b6181ea697.zip | |
Simplify.
llvm-svn: 86830
| -rw-r--r-- | clang/tools/clang-cc/clang-cc.cpp | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/clang/tools/clang-cc/clang-cc.cpp b/clang/tools/clang-cc/clang-cc.cpp index d8c9ddd220d..e55deb51c98 100644 --- a/clang/tools/clang-cc/clang-cc.cpp +++ b/clang/tools/clang-cc/clang-cc.cpp @@ -633,6 +633,7 @@ static ASTConsumer *CreateConsumerAction(const CompilerInvocation &CompOpts, return CreateBlockRewriter(InFile, PP.getDiagnostics(), PP.getLangOptions()); + case FixIt: // We add the rewriter later. case ParseSyntaxOnly: return new ASTConsumer(); @@ -766,23 +767,15 @@ static void ProcessInputFile(const CompilerInvocation &CompOpts, DoRewriteTest(PP, OS.get()); ClearSourceMgr = true; break; + } - case FixIt: - Consumer.reset(new ASTConsumer()); + // Check if we want a fix-it rewriter. + if (PA == FixIt || !FixItAtLocations.empty()) { FixItRewrite = new FixItRewriter(PP.getDiagnostics(), PP.getSourceManager(), PP.getLangOptions()); - break; - } - - if (FixItAtLocations.size() > 0) { - // Even without the "-fixit" flag, we may have some specific locations where - // the user has requested fixes. Process those locations now. - if (!FixItRewrite) - FixItRewrite = new FixItRewriter(PP.getDiagnostics(), - PP.getSourceManager(), - PP.getLangOptions()); - if (!AddFixItLocations(FixItRewrite, PP.getFileManager())) { + if (!FixItAtLocations.empty() && + !AddFixItLocations(FixItRewrite, PP.getFileManager())) { // All of the fix-it locations were bad. Don't fix anything. delete FixItRewrite; FixItRewrite = 0; |

