summaryrefslogtreecommitdiffstats
path: root/clang/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
commite2e40b4dc7e2a49d54740262e21d4b0bbb0d94f3 (patch)
tree4f9dc6b4acbc12d5a564921958589f2899022e4a /clang/lib
parentfa181f4fdb5f357e4cbc76b3dc9cbf0baa46491e (diff)
downloadbcm5719-llvm-e2e40b4dc7e2a49d54740262e21d4b0bbb0d94f3.tar.gz
bcm5719-llvm-e2e40b4dc7e2a49d54740262e21d4b0bbb0d94f3.zip
[arcmt] Make sure migrating to ARC works even if '-fobjc-arc' is included in command-line flags. rdar://9567824
llvm-svn: 135115
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/ARCMigrate/ARCMT.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/clang/lib/ARCMigrate/ARCMT.cpp b/clang/lib/ARCMigrate/ARCMT.cpp
index 73c8dbd6a4e..f1d947da677 100644
--- a/clang/lib/ARCMigrate/ARCMT.cpp
+++ b/clang/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,
OpenPOWER on IntegriCloud