From: Argyrios Kyrtzidis Date: Tue, 17 Sep 2013 19:14:29 +0000 (+0000) Subject: [arcmt] Don't try to handle files that are already ARC'ified, this is not possible... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=dce3ce3686eed399b465742b1e2388915b438e05;p=clang [arcmt] Don't try to handle files that are already ARC'ified, this is not possible currently. rdar://14461559 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190880 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/ARCMigrate/ARCMT.cpp b/lib/ARCMigrate/ARCMT.cpp index 477e327071..3e429beded 100644 --- a/lib/ARCMigrate/ARCMT.cpp +++ b/lib/ARCMigrate/ARCMT.cpp @@ -270,8 +270,6 @@ bool arcmt::checkForManualIssues(CompilerInvocation &origCI, return true; } - bool hadARCErrors = capturedDiags.hasErrors(); - // Don't filter diagnostics anymore. Diags->setClient(DiagClient, /*ShouldOwnClient=*/false); @@ -323,15 +321,6 @@ bool arcmt::checkForManualIssues(CompilerInvocation &origCI, DiagClient->EndSourceFile(); errRec.FinishCapture(); - if (hadARCErrors) { - // 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; - // Disable auto-synthesize to avoid "@synthesize of 'weak' property is only - // allowed in ARC" errors. - origCI.getLangOpts()->ObjCDefaultSynthProperties = false; - } - return capturedDiags.hasErrors() || testAct.hasReportedErrors(); } @@ -381,14 +370,6 @@ static bool applyTransforms(CompilerInvocation &origCI, origCI.getLangOpts()->ObjCAutoRefCount = true; return migration.getRemapper().overwriteOriginal(*Diags); } else { - if (migration.HadARCErrors) { - // 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; - // Disable auto-synthesize to avoid "@synthesize of 'weak' property is only - // allowed in ARC" errors. - origCI.getLangOpts()->ObjCDefaultSynthProperties = false; - } return migration.getRemapper().flushToDisk(outputDir, *Diags); } } diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index c1bac556cd..3dde81c597 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -2563,7 +2563,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, Args.AddLastArg(CmdArgs, options::OPT_working_directory); bool ARCMTEnabled = false; - if (!Args.hasArg(options::OPT_fno_objc_arc)) { + if (!Args.hasArg(options::OPT_fno_objc_arc, options::OPT_fobjc_arc)) { if (const Arg *A = Args.getLastArg(options::OPT_ccc_arcmt_check, options::OPT_ccc_arcmt_modify, options::OPT_ccc_arcmt_migrate)) { diff --git a/test/ARCMT/Inputs/test1.m.in b/test/ARCMT/Inputs/test1.m.in index 8416a88965..44a3c4cf3d 100644 --- a/test/ARCMT/Inputs/test1.m.in +++ b/test/ARCMT/Inputs/test1.m.in @@ -4,3 +4,13 @@ void test1(id p) { [p release]; } + +@interface Test2 +@property (strong) id prop; +@end + +@implementation Test2 +-(id)init { + _prop = 0; +} +@end diff --git a/test/ARCMT/Inputs/test1.m.in.result b/test/ARCMT/Inputs/test1.m.in.result index f351fe6c83..1db9bf7ad6 100644 --- a/test/ARCMT/Inputs/test1.m.in.result +++ b/test/ARCMT/Inputs/test1.m.in.result @@ -3,3 +3,13 @@ void test1(id p) { } + +@interface Test2 +@property (strong) id prop; +@end + +@implementation Test2 +-(id)init { + _prop = 0; +} +@end diff --git a/test/ARCMT/migrate-with-pch.m b/test/ARCMT/migrate-with-pch.m index 7dca8be488..73f7ae03b4 100644 --- a/test/ARCMT/migrate-with-pch.m +++ b/test/ARCMT/migrate-with-pch.m @@ -1,7 +1,7 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -x objective-c %S/Common.h -emit-pch -o %t.pch -// RUN: %clang_cc1 -arcmt-migrate -mt-migrate-directory %t %S/Inputs/test1.m.in -x objective-c -include-pch %t.pch -// RUN: %clang_cc1 -arcmt-migrate -mt-migrate-directory %t %S/Inputs/test2.m.in -x objective-c -include-pch %t.pch +// RUN: %clang_cc1 -x objective-c %S/Common.h -emit-pch -o %t.pch -fobjc-default-synthesize-properties +// RUN: %clang_cc1 -arcmt-migrate -mt-migrate-directory %t %S/Inputs/test1.m.in -x objective-c -include-pch %t.pch -fobjc-default-synthesize-properties +// RUN: %clang_cc1 -arcmt-migrate -mt-migrate-directory %t %S/Inputs/test2.m.in -x objective-c -include-pch %t.pch -fobjc-default-synthesize-properties // RUN: c-arcmt-test -mt-migrate-directory %t | arcmt-test -verify-transformed-files %S/Inputs/test1.m.in.result %S/Inputs/test2.m.in.result %S/Inputs/test.h.result // RUN: rm -rf %t // DISABLE: mingw32 diff --git a/test/ARCMT/migrate.m b/test/ARCMT/migrate.m index 6f41258e59..b965d97401 100644 --- a/test/ARCMT/migrate.m +++ b/test/ARCMT/migrate.m @@ -1,6 +1,6 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -arcmt-migrate -mt-migrate-directory %t %S/Inputs/test1.m.in -x objective-c -// RUN: %clang_cc1 -arcmt-migrate -mt-migrate-directory %t %S/Inputs/test2.m.in -x objective-c +// RUN: %clang_cc1 -arcmt-migrate -mt-migrate-directory %t %S/Inputs/test1.m.in -x objective-c -fobjc-default-synthesize-properties +// RUN: %clang_cc1 -arcmt-migrate -mt-migrate-directory %t %S/Inputs/test2.m.in -x objective-c -fobjc-default-synthesize-properties // RUN: c-arcmt-test -mt-migrate-directory %t | arcmt-test -verify-transformed-files %S/Inputs/test1.m.in.result %S/Inputs/test2.m.in.result %S/Inputs/test.h.result // RUN: rm -rf %t // DISABLE: mingw32 diff --git a/test/ARCMT/with-arc-mode-check.m b/test/ARCMT/with-arc-mode-check.m deleted file mode 100644 index 33f31f522a..0000000000 --- a/test/ARCMT/with-arc-mode-check.m +++ /dev/null @@ -1,9 +0,0 @@ -// RUN: %clang_cc1 -arcmt-check -fsyntax-only -fobjc-arc -x objective-c %s - -@protocol NSObject -- (oneway void)release; -@end - -void test1(id p) { - [p release]; -} diff --git a/test/ARCMT/with-arc-mode-migrate.m b/test/ARCMT/with-arc-mode-migrate.m deleted file mode 100644 index 468859478e..0000000000 --- a/test/ARCMT/with-arc-mode-migrate.m +++ /dev/null @@ -1,13 +0,0 @@ -// RUN: rm -rf %t -// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -x objective-c %s.result -// RUN: %clang_cc1 -arcmt-migrate -mt-migrate-directory %t -fsyntax-only -fobjc-arc %s -// RUN: c-arcmt-test -mt-migrate-directory %t | arcmt-test -verify-transformed-files %s.result -// RUN: rm -rf %t - -@protocol NSObject -- (oneway void)release; -@end - -void test1(id p) { - [p release]; -} diff --git a/test/ARCMT/with-arc-mode-migrate.m.result b/test/ARCMT/with-arc-mode-migrate.m.result deleted file mode 100644 index dd34b99908..0000000000 --- a/test/ARCMT/with-arc-mode-migrate.m.result +++ /dev/null @@ -1,12 +0,0 @@ -// RUN: rm -rf %t -// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -x objective-c %s.result -// RUN: %clang_cc1 -arcmt-migrate -mt-migrate-directory %t -fsyntax-only -fobjc-arc %s -// RUN: c-arcmt-test -mt-migrate-directory %t | arcmt-test -verify-transformed-files %s.result -// RUN: rm -rf %t - -@protocol NSObject -- (oneway void)release; -@end - -void test1(id p) { -}