]> granicus.if.org Git - clang/commitdiff
[arcmt] Don't try to handle files that are already ARC'ified, this is not possible...
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Tue, 17 Sep 2013 19:14:29 +0000 (19:14 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Tue, 17 Sep 2013 19:14:29 +0000 (19:14 +0000)
rdar://14461559

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190880 91177308-0d34-0410-b5e6-96231b3b80d8

lib/ARCMigrate/ARCMT.cpp
lib/Driver/Tools.cpp
test/ARCMT/Inputs/test1.m.in
test/ARCMT/Inputs/test1.m.in.result
test/ARCMT/migrate-with-pch.m
test/ARCMT/migrate.m
test/ARCMT/with-arc-mode-check.m [deleted file]
test/ARCMT/with-arc-mode-migrate.m [deleted file]
test/ARCMT/with-arc-mode-migrate.m.result [deleted file]

index 477e327071a8dffc64083e17feb76f6534dbdbe0..3e429beded5db5f133e4463fc162dbf24f44d573 100644 (file)
@@ -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);
   }
 }
index c1bac556cd903acefdcdc6fb9c3001bd8c02b080..3dde81c5970dce641fe337071396dbcf2ab0e588 100644 (file)
@@ -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)) {
index 8416a8896569607107d6f0afc34142b04f72543e..44a3c4cf3d93fc6a5bf8f6f67670a1d5b8d9f3cc 100644 (file)
@@ -4,3 +4,13 @@
 void test1(id p) {
   [p release];
 }
+
+@interface Test2
+@property (strong) id prop;
+@end
+
+@implementation Test2
+-(id)init {
+  _prop = 0;
+}
+@end
index f351fe6c8355222b673ff72be24748242d8c0ef6..1db9bf7ad65c799e83440fad657b9bf444f733ff 100644 (file)
@@ -3,3 +3,13 @@
 
 void test1(id p) {
 }
+
+@interface Test2
+@property (strong) id prop;
+@end
+
+@implementation Test2
+-(id)init {
+  _prop = 0;
+}
+@end
index 7dca8be488447c1d579383c4ab19cb6b716cb897..73f7ae03b45fc9b704f7d92bb8d8a25a82b37daa 100644 (file)
@@ -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
index 6f41258e59d60104b8b4f909286960c450451d43..b965d97401aa79ec42b9055bd894e6da455840fd 100644 (file)
@@ -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 (file)
index 33f31f5..0000000
+++ /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 (file)
index 4688594..0000000
+++ /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 (file)
index dd34b99..0000000
+++ /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) {
-}