diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-07-14 00:17:54 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-07-14 00:17:54 +0000 |
commit | a944b123e49790e4cb0a8f4d6ee3a65e185127aa (patch) | |
tree | d199f350675b205e7c334ecd702a0436c45db8fb /lib | |
parent | 4f264950e51ef1e41ada0f6a3a25197cd141b571 (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.cpp | 10 |
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, |