John McCall | 260611a | 2012-06-20 06:18:46 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -triple i386-apple-darwin9 -fobjc-runtime=macosx-fragile-10.5 -fno-constant-cfstrings -emit-llvm -o %t %s |
Fariborz Jahanian | 36998f5 | 2010-04-26 17:59:24 +0000 | [diff] [blame] | 2 | // RUN: FileCheck --check-prefix CHECK-FRAGILE < %t %s |
| 3 | |
John McCall | d1e40d5 | 2011-10-02 01:16:38 +0000 | [diff] [blame] | 4 | // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fno-constant-cfstrings -emit-llvm -o %t %s |
Fariborz Jahanian | 36998f5 | 2010-04-26 17:59:24 +0000 | [diff] [blame] | 5 | // RUN: FileCheck --check-prefix CHECK-NONFRAGILE < %t %s |
| 6 | |
| 7 | @interface NSString @end |
| 8 | |
| 9 | @interface NSSimpleCString : NSString { |
| 10 | @protected |
| 11 | char *bytes; |
| 12 | unsigned int numBytes; |
| 13 | } |
| 14 | @end |
| 15 | |
| 16 | @interface NSConstantString : NSSimpleCString |
| 17 | @end |
| 18 | |
| 19 | #if OBJC_API_VERSION >= 2 |
| 20 | extern Class _NSConstantStringClassReference; |
| 21 | #else |
| 22 | extern struct objc_class _NSConstantStringClassReference; |
| 23 | #endif |
| 24 | |
| 25 | const NSConstantString *appKey = @"MyApp"; |
| 26 | |
| 27 | int main() { |
| 28 | const NSConstantString *appKey = @"MyApp"; |
| 29 | const NSConstantString *appKey1 = @"MyApp1"; |
| 30 | } |
| 31 | |
| 32 | // CHECK-FRAGILE: @_NSConstantStringClassReference = external global |
| 33 | // CHECK-NONFRAGILE: @"OBJC_CLASS_$_NSConstantString" = external global |
Rafael Espindola | 803d307 | 2011-01-17 22:11:21 +0000 | [diff] [blame] | 34 | |
| 35 | // CHECK-FRAGILE: @.str = private unnamed_addr constant [6 x i8] c"MyApp\00" |
| 36 | // CHECK-FRAGILE: @.str1 = private unnamed_addr constant [7 x i8] c"MyApp1\00" |
| 37 | |
| 38 | // CHECK-NONFRAGILE: @.str = private unnamed_addr constant [6 x i8] c"MyApp\00" |
| 39 | // CHECK-NONFRAGILE: @.str1 = private unnamed_addr constant [7 x i8] c"MyApp1\00" |