[arcmt] Don't try to handle files that are already ARC'ified, this is not possible currently.

rdar://14461559

llvm-svn: 190880
This commit is contained in:
Argyrios Kyrtzidis 2013-09-17 19:14:29 +00:00
parent 30c27d6ace
commit 85230d50f2
9 changed files with 26 additions and 59 deletions

View 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);
}
}

View 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)) {

View 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

View File

@ -3,3 +3,13 @@
void test1(id p) {
}
@interface Test2
@property (strong) id prop;
@end
@implementation Test2
-(id)init {
_prop = 0;
}
@end

View 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

View 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

View File

@ -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];
}

View File

@ -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];
}

View File

@ -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) {
}