aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-07-14 00:17:54 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-07-14 00:17:54 +0000
commita944b123e49790e4cb0a8f4d6ee3a65e185127aa (patch)
treed199f350675b205e7c334ecd702a0436c45db8fb /lib
parent4f264950e51ef1e41ada0f6a3a25197cd141b571 (diff)
[arcmt] Make sure migrating to ARC works even if '-fobjc-arc' is included in command-line flags. rdar://9567824
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135115 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/ARCMigrate/ARCMT.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/ARCMigrate/ARCMT.cpp b/lib/ARCMigrate/ARCMT.cpp
index 73c8dbd6a4..f1d947da67 100644
--- a/lib/ARCMigrate/ARCMT.cpp
+++ b/lib/ARCMigrate/ARCMT.cpp
@@ -262,6 +262,10 @@ bool arcmt::checkForManualIssues(CompilerInvocation &origCI,
DiagClient->EndSourceFile();
+ // If we are migrating code that gets the '-fobjc-arc' flag, make sure
+ // to remove it so that we don't get errors from normal compilation.
+ origCI.getLangOpts().ObjCAutoRefCount = false;
+
return capturedDiags.hasErrors();
}
@@ -302,8 +306,12 @@ static bool applyTransforms(CompilerInvocation &origCI,
if (outputDir.empty()) {
origCI.getLangOpts().ObjCAutoRefCount = true;
return migration.getRemapper().overwriteOriginal(*Diags);
- } else
+ } else {
+ // If we are migrating code that gets the '-fobjc-arc' flag, make sure
+ // to remove it so that we don't get errors from normal compilation.
+ origCI.getLangOpts().ObjCAutoRefCount = false;
return migration.getRemapper().flushToDisk(outputDir, *Diags);
+ }
}
bool arcmt::applyTransformations(CompilerInvocation &origCI,