aboutsummaryrefslogtreecommitdiff
path: root/test/ARCMT
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2012-05-14 22:01:53 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2012-05-14 22:01:53 +0000
commit055b395294d190a432e9d87bb665634636a1418a (patch)
tree774bfb5403aaab78b904e4455a9a05060c656a6a /test/ARCMT
parent13ec9100ca6bc03b5ce8832e4a0fcb724d47bcb1 (diff)
[objcmt] When rewriting to array/dictionary literals, add an explicit
cast to 'id' for any argument that requires it. Part of rdar://11438360. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156782 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/ARCMT')
-rw-r--r--test/ARCMT/objcmt-numeric-literals.m1
-rw-r--r--test/ARCMT/objcmt-numeric-literals.m.result1
-rw-r--r--test/ARCMT/objcmt-subscripting-literals.m17
-rw-r--r--test/ARCMT/objcmt-subscripting-literals.m.result17
4 files changed, 36 insertions, 0 deletions
diff --git a/test/ARCMT/objcmt-numeric-literals.m b/test/ARCMT/objcmt-numeric-literals.m
index b86af4d056..7f33dc2799 100644
--- a/test/ARCMT/objcmt-numeric-literals.m
+++ b/test/ARCMT/objcmt-numeric-literals.m
@@ -1,6 +1,7 @@
// RUN: rm -rf %t
// RUN: %clang_cc1 -objcmt-migrate-literals -objcmt-migrate-subscripting -mt-migrate-directory %t %s -x objective-c++
// RUN: c-arcmt-test -mt-migrate-directory %t | arcmt-test -verify-transformed-files %s.result
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c++ %s.result
#define YES __objc_yes
#define NO __objc_no
diff --git a/test/ARCMT/objcmt-numeric-literals.m.result b/test/ARCMT/objcmt-numeric-literals.m.result
index 1c4187aaef..8e343455fd 100644
--- a/test/ARCMT/objcmt-numeric-literals.m.result
+++ b/test/ARCMT/objcmt-numeric-literals.m.result
@@ -1,6 +1,7 @@
// RUN: rm -rf %t
// RUN: %clang_cc1 -objcmt-migrate-literals -objcmt-migrate-subscripting -mt-migrate-directory %t %s -x objective-c++
// RUN: c-arcmt-test -mt-migrate-directory %t | arcmt-test -verify-transformed-files %s.result
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c++ %s.result
#define YES __objc_yes
#define NO __objc_no
diff --git a/test/ARCMT/objcmt-subscripting-literals.m b/test/ARCMT/objcmt-subscripting-literals.m
index 3d26efefda..147595182d 100644
--- a/test/ARCMT/objcmt-subscripting-literals.m
+++ b/test/ARCMT/objcmt-subscripting-literals.m
@@ -1,10 +1,13 @@
// RUN: rm -rf %t
// RUN: %clang_cc1 -objcmt-migrate-literals -objcmt-migrate-subscripting -mt-migrate-directory %t %s -x objective-c -triple x86_64-apple-darwin11
// RUN: c-arcmt-test -mt-migrate-directory %t | arcmt-test -verify-transformed-files %s.result
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c %s.result
typedef signed char BOOL;
#define nil ((void*) 0)
+typedef const struct __CFString * CFStringRef;
+
@interface NSObject
+ (id)alloc;
@end
@@ -135,3 +138,17 @@ typedef signed char BOOL;
o = [*parr objectAtIndex:2];
}
@end
+
+extern const CFStringRef globStr;
+
+void test1(NSString *str) {
+ NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys: str, globStr, nil];
+ dict = [NSDictionary dictionaryWithObjectsAndKeys: globStr, str, nil];
+ dict = [NSDictionary dictionaryWithObject:str forKey:globStr];
+ dict = [NSDictionary dictionaryWithObject:globStr forKey:str];
+
+ NSArray *arr = [NSArray arrayWithObjects: globStr, globStr, nil];
+ arr = [NSArray arrayWithObjects: str, globStr, nil];
+ arr = [NSArray arrayWithObjects: globStr, str, nil];
+ arr = [NSArray arrayWithObject:globStr];
+}
diff --git a/test/ARCMT/objcmt-subscripting-literals.m.result b/test/ARCMT/objcmt-subscripting-literals.m.result
index 8ac6dcc207..5c8a4ecc40 100644
--- a/test/ARCMT/objcmt-subscripting-literals.m.result
+++ b/test/ARCMT/objcmt-subscripting-literals.m.result
@@ -1,10 +1,13 @@
// RUN: rm -rf %t
// RUN: %clang_cc1 -objcmt-migrate-literals -objcmt-migrate-subscripting -mt-migrate-directory %t %s -x objective-c -triple x86_64-apple-darwin11
// RUN: c-arcmt-test -mt-migrate-directory %t | arcmt-test -verify-transformed-files %s.result
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c %s.result
typedef signed char BOOL;
#define nil ((void*) 0)
+typedef const struct __CFString * CFStringRef;
+
@interface NSObject
+ (id)alloc;
@end
@@ -135,3 +138,17 @@ typedef signed char BOOL;
o = (*parr)[2];
}
@end
+
+extern const CFStringRef globStr;
+
+void test1(NSString *str) {
+ NSDictionary *dict = @{(id)globStr: str};
+ dict = @{str: (id)globStr};
+ dict = @{(id)globStr: str};
+ dict = @{str: (id)globStr};
+
+ NSArray *arr = @[(id)globStr, (id)globStr];
+ arr = @[str, (id)globStr];
+ arr = @[(id)globStr, str];
+ arr = @[(id)globStr];
+}