[arcmt] Make arcmt-test accept cc1 options to make it more portable and hopefully fix MSVC failures.

llvm-svn: 133119
This commit is contained in:
Argyrios Kyrtzidis 2011-06-16 00:53:46 +00:00
parent 5444a7b4cd
commit 6e4ef20baf
36 changed files with 50 additions and 69 deletions

View File

@ -1,5 +1,5 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -x objective-c %s.result
// RUN: arcmt-test --args -arch x86_64 %s > %t
// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -x objective-c %s > %t
// RUN: diff %t %s.result
#include "Common.h"

View File

@ -1,5 +1,5 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -x objective-c %s.result
// RUN: arcmt-test --args -arch x86_64 %s > %t
// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -x objective-c %s > %t
// RUN: diff %t %s.result
#include "Common.h"

View File

@ -1,9 +1,5 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -fobjc-no-arc-runtime -x objective-c %s.result
// RUN: arcmt-test --args -arch x86_64 %s -D__IPHONE_OS_VERSION_MIN_REQUIRED=40300 > %t
// RUN: diff %t %s.result
// RUN: arcmt-test --args -arch x86_64 %s -miphoneos-version-min=4.3 > %t
// RUN: diff %t %s.result
// RUN: arcmt-test --args -arch x86_64 %s -mmacosx-version-min=10.6 > %t
// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only %s > %t
// RUN: diff %t %s.result
#include "Common.h"

View File

@ -1,9 +1,5 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -fobjc-no-arc-runtime -x objective-c %s.result
// RUN: arcmt-test --args -arch x86_64 %s -D__IPHONE_OS_VERSION_MIN_REQUIRED=40300 > %t
// RUN: diff %t %s.result
// RUN: arcmt-test --args -arch x86_64 %s -miphoneos-version-min=4.3 > %t
// RUN: diff %t %s.result
// RUN: arcmt-test --args -arch x86_64 %s -mmacosx-version-min=10.6 > %t
// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only %s > %t
// RUN: diff %t %s.result
#include "Common.h"

View File

@ -1,9 +1,5 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -x objective-c %s.result
// RUN: arcmt-test --args -arch x86_64 %s -D__IPHONE_OS_VERSION_MIN_REQUIRED=50000 > %t
// RUN: diff %t %s.result
// RUN: arcmt-test --args -arch x86_64 %s -miphoneos-version-min=5.0 > %t
// RUN: diff %t %s.result
// RUN: arcmt-test --args -arch x86_64 %s -mmacosx-version-min=10.7 > %t
// RUN: arcmt-test --args -triple x86_64-apple-macosx10.8 -fobjc-nonfragile-abi -fsyntax-only %s > %t
// RUN: diff %t %s.result
#include "Common.h"

View File

@ -1,9 +1,5 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -x objective-c %s.result
// RUN: arcmt-test --args -arch x86_64 %s -D__IPHONE_OS_VERSION_MIN_REQUIRED=50000 > %t
// RUN: diff %t %s.result
// RUN: arcmt-test --args -arch x86_64 %s -miphoneos-version-min=5.0 > %t
// RUN: diff %t %s.result
// RUN: arcmt-test --args -arch x86_64 %s -mmacosx-version-min=10.7 > %t
// RUN: arcmt-test --args -triple x86_64-apple-macosx10.8 -fobjc-nonfragile-abi -fsyntax-only %s > %t
// RUN: diff %t %s.result
#include "Common.h"

View File

@ -1,5 +1,5 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -x objective-c %s.result
// RUN: arcmt-test --args -arch x86_64 %s > %t
// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -x objective-c %s > %t
// RUN: diff %t %s.result
@interface NSAutoreleasePool

View File

@ -1,5 +1,5 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -x objective-c %s.result
// RUN: arcmt-test --args -arch x86_64 %s > %t
// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -x objective-c %s > %t
// RUN: diff %t %s.result
@interface NSAutoreleasePool

View File

@ -1,5 +1,5 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -x objective-c %s.result
// RUN: arcmt-test --args -arch x86_64 %s > %t
// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -x objective-c %s > %t
// RUN: diff %t %s.result
@interface NSAutoreleasePool

View File

@ -1,5 +1,5 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -x objective-c %s.result
// RUN: arcmt-test --args -arch x86_64 %s > %t
// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -x objective-c %s > %t
// RUN: diff %t %s.result
@interface NSAutoreleasePool

View File

@ -1,5 +1,5 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -x objective-c %s.result
// RUN: arcmt-test --args -arch x86_64 %s > %t
// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -x objective-c %s > %t
// RUN: diff %t %s.result
#include "Common.h"

View File

@ -1,5 +1,5 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -x objective-c %s.result
// RUN: arcmt-test --args -arch x86_64 %s > %t
// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -x objective-c %s > %t
// RUN: diff %t %s.result
#include "Common.h"

View File

@ -1,5 +1,5 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -x objective-c %s.result
// RUN: arcmt-test --args -arch x86_64 %s > %t
// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -x objective-c %s > %t
// RUN: diff %t %s.result
typedef unsigned char BOOL;

View File

@ -1,5 +1,5 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -x objective-c %s.result
// RUN: arcmt-test --args -arch x86_64 %s > %t
// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -x objective-c %s > %t
// RUN: diff %t %s.result
typedef unsigned char BOOL;

View File

@ -1,4 +1,4 @@
// RUN: arcmt-test -check-only -verify --args -Warc-abi %s
// RUN: arcmt-test -check-only -verify --args -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -fblocks -Warc-abi %s
// Classes that have an Objective-C object pointer.
struct HasObjectMember0 { // expected-warning{{'HasObjectMember0' cannot be shared between ARC and non-ARC code; add a copy constructor, a copy assignment operator, and a destructor to make it ABI-compatible}}

View File

@ -1,5 +1,5 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -x objective-c %s.result
// RUN: arcmt-test --args -arch x86_64 %s > %t
// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -x objective-c %s > %t
// RUN: diff %t %s.result
@interface A

View File

@ -1,5 +1,5 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -x objective-c %s.result
// RUN: arcmt-test --args -arch x86_64 %s > %t
// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -x objective-c %s > %t
// RUN: diff %t %s.result
@interface A

View File

@ -1,5 +1,5 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -x objective-c %s.result
// RUN: arcmt-test --args -arch x86_64 %s > %t
// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -x objective-c %s > %t
// RUN: diff %t %s.result
@interface NSObject

View File

@ -1,5 +1,5 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -x objective-c %s.result
// RUN: arcmt-test --args -arch x86_64 %s > %t
// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -x objective-c %s > %t
// RUN: diff %t %s.result
@interface NSObject

View File

@ -1,5 +1,5 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -x objective-c %s.result
// RUN: arcmt-test --args -arch x86_64 %s > %t
// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -x objective-c %s > %t
// RUN: diff %t %s.result
#include "Common.h"

View File

@ -1,5 +1,5 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -x objective-c %s.result
// RUN: arcmt-test --args -arch x86_64 %s > %t
// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -x objective-c %s > %t
// RUN: diff %t %s.result
#include "Common.h"

View File

@ -1,5 +1,5 @@
// RUN: %clang_cc1 -fobjc-nonfragile-abi -fblocks -fsyntax-only -fobjc-arc -x objective-c %s.result
// RUN: arcmt-test --args -arch x86_64 %s > %t
// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fblocks -fobjc-nonfragile-abi -fsyntax-only -x objective-c %s > %t
// RUN: diff %t %s.result
typedef int BOOL;

View File

@ -1,5 +1,5 @@
// RUN: %clang_cc1 -fobjc-nonfragile-abi -fblocks -fsyntax-only -fobjc-arc -x objective-c %s.result
// RUN: arcmt-test --args -arch x86_64 %s > %t
// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fblocks -fobjc-nonfragile-abi -fsyntax-only -x objective-c %s > %t
// RUN: diff %t %s.result
typedef int BOOL;

View File

@ -1,5 +1,5 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -x objective-c %s.result
// RUN: arcmt-test --args -arch x86_64 %s > %t
// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -x objective-c %s > %t
// RUN: diff %t %s.result
#define nil ((void*) 0)

View File

@ -1,5 +1,5 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -x objective-c %s.result
// RUN: arcmt-test --args -arch x86_64 %s > %t
// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -x objective-c %s > %t
// RUN: diff %t %s.result
#define nil ((void*) 0)

View File

@ -1,5 +1,5 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -x objective-c %s.result
// RUN: arcmt-test --args -arch x86_64 %s > %t
// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -x objective-c %s > %t
// RUN: diff %t %s.result
@interface Foo

View File

@ -1,5 +1,5 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -x objective-c %s.result
// RUN: arcmt-test --args -arch x86_64 %s > %t
// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -x objective-c %s > %t
// RUN: diff %t %s.result
@interface Foo

View File

@ -1,5 +1,5 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -x objective-c %s.result
// RUN: arcmt-test --args -arch x86_64 %s > %t
// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -x objective-c %s > %t
// RUN: diff %t %s.result
#include "Common.h"

View File

@ -1,5 +1,5 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -x objective-c %s.result
// RUN: arcmt-test --args -arch x86_64 %s > %t
// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -x objective-c %s > %t
// RUN: diff %t %s.result
#include "Common.h"

View File

@ -1,5 +1,5 @@
// RUN: %clang_cc1 -fobjc-nonfragile-abi -fblocks -fsyntax-only -fobjc-arc -x objective-c %s.result
// RUN: arcmt-test --args -arch x86_64 %s > %t
// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fblocks -fobjc-nonfragile-abi -fsyntax-only -x objective-c %s > %t
// RUN: diff %t %s.result
#include "Common.h"

View File

@ -1,5 +1,5 @@
// RUN: %clang_cc1 -fobjc-nonfragile-abi -fblocks -fsyntax-only -fobjc-arc -x objective-c %s.result
// RUN: arcmt-test --args -arch x86_64 %s > %t
// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fblocks -fobjc-nonfragile-abi -fsyntax-only -x objective-c %s > %t
// RUN: diff %t %s.result
#include "Common.h"

View File

@ -1,5 +1,5 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fblocks -fsyntax-only -fobjc-arc -x objective-c %s.result -D__IPHONE_OS_VERSION_MIN_REQUIRED=50000
// RUN: arcmt-test --args -arch x86_64 %s -D__IPHONE_OS_VERSION_MIN_REQUIRED=50000 > %t
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fblocks -fsyntax-only -fobjc-arc -x objective-c %s.result
// RUN: arcmt-test --args -triple x86_64-apple-macosx10.8 -fobjc-nonfragile-abi -fblocks -fsyntax-only %s > %t
// RUN: diff %t %s.result
#include "Common.h"

View File

@ -1,5 +1,5 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fblocks -fsyntax-only -fobjc-arc -x objective-c %s.result -D__IPHONE_OS_VERSION_MIN_REQUIRED=50000
// RUN: arcmt-test --args -arch x86_64 %s -D__IPHONE_OS_VERSION_MIN_REQUIRED=50000 > %t
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fblocks -fsyntax-only -fobjc-arc -x objective-c %s.result
// RUN: arcmt-test --args -triple x86_64-apple-macosx10.8 -fobjc-nonfragile-abi -fblocks -fsyntax-only %s > %t
// RUN: diff %t %s.result
#include "Common.h"

View File

@ -1,5 +1,5 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -x objective-c %s.result
// RUN: arcmt-test --args -arch x86_64 %s > %t
// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -x objective-c %s > %t
// RUN: diff %t %s.result
void test12(id collection) {

View File

@ -1,5 +1,5 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -x objective-c %s.result
// RUN: arcmt-test --args -arch x86_64 %s > %t
// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -x objective-c %s > %t
// RUN: diff %t %s.result
void test12(id collection) {

View File

@ -100,22 +100,20 @@ static bool checkForMigration(llvm::StringRef resourcesPath,
Diags->setClient(verifyDiag);
}
llvm::OwningPtr<CompilerInvocation> CI;
CI.reset(clang::createInvocationFromCommandLine(Args, Diags));
if (!CI)
return true;
CompilerInvocation CI;
CompilerInvocation::CreateFromArgs(CI, Args.begin(), Args.end(), *Diags);
if (CI->getFrontendOpts().Inputs.empty()) {
if (CI.getFrontendOpts().Inputs.empty()) {
llvm::errs() << "error: no input files\n";
return true;
}
if (!CI->getLangOpts().ObjC1)
if (!CI.getLangOpts().ObjC1)
return false;
return arcmt::checkForManualIssues(*CI,
CI->getFrontendOpts().Inputs[0].second,
CI->getFrontendOpts().Inputs[0].first,
return arcmt::checkForManualIssues(CI,
CI.getFrontendOpts().Inputs[0].second,
CI.getFrontendOpts().Inputs[0].first,
Diags->getClient());
}
@ -141,20 +139,19 @@ static bool performTransformations(llvm::StringRef resourcesPath,
llvm::IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
llvm::IntrusiveRefCntPtr<Diagnostic> TopDiags(new Diagnostic(DiagID, DiagClient));
llvm::OwningPtr<CompilerInvocation> origCI;
origCI.reset(clang::createInvocationFromCommandLine(Args, TopDiags));
if (!origCI)
return true;
CompilerInvocation origCI;
CompilerInvocation::CreateFromArgs(origCI, Args.begin(), Args.end(),
*TopDiags);
if (origCI->getFrontendOpts().Inputs.empty()) {
if (origCI.getFrontendOpts().Inputs.empty()) {
llvm::errs() << "error: no input files\n";
return true;
}
if (!origCI->getLangOpts().ObjC1)
if (!origCI.getLangOpts().ObjC1)
return false;
MigrationProcess migration(*origCI, DiagClient);
MigrationProcess migration(origCI, DiagClient);
std::vector<TransformFn> transforms = arcmt::getAllTransformations();
assert(!transforms.empty());