aboutsummaryrefslogtreecommitdiff
path: root/tools/clang-cc
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-11-11 10:22:48 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-11-11 10:22:48 +0000
commit387ecbd1e60b28d0c3c072b6a8c42ab2a176e036 (patch)
tree34adfd3ed4d17b06a0b612c7311b37fac6345f7c /tools/clang-cc
parente26bd90e5f7c1e44dd2b74d84d2f158dc7b983fb (diff)
Simplify.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86830 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/clang-cc')
-rw-r--r--tools/clang-cc/clang-cc.cpp19
1 files changed, 6 insertions, 13 deletions
diff --git a/tools/clang-cc/clang-cc.cpp b/tools/clang-cc/clang-cc.cpp
index d8c9ddd220..e55deb51c9 100644
--- a/tools/clang-cc/clang-cc.cpp
+++ b/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;