1*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -triple i386-apple-darwin9 -fobjc-runtime=macosx-fragile-10.5 -fno-constant-cfstrings -emit-llvm -o %t %s 2*f4a2713aSLionel Sambuc// RUN: FileCheck --check-prefix CHECK-FRAGILE < %t %s 3*f4a2713aSLionel Sambuc 4*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fno-constant-cfstrings -emit-llvm -o %t %s 5*f4a2713aSLionel Sambuc// RUN: FileCheck --check-prefix CHECK-NONFRAGILE < %t %s 6*f4a2713aSLionel Sambuc 7*f4a2713aSLionel Sambuc@interface NSString @end 8*f4a2713aSLionel Sambuc 9*f4a2713aSLionel Sambuc@interface NSSimpleCString : NSString { 10*f4a2713aSLionel Sambuc@protected 11*f4a2713aSLionel Sambuc char *bytes; 12*f4a2713aSLionel Sambuc unsigned int numBytes; 13*f4a2713aSLionel Sambuc} 14*f4a2713aSLionel Sambuc@end 15*f4a2713aSLionel Sambuc 16*f4a2713aSLionel Sambuc@interface NSConstantString : NSSimpleCString 17*f4a2713aSLionel Sambuc@end 18*f4a2713aSLionel Sambuc 19*f4a2713aSLionel Sambuc#if OBJC_API_VERSION >= 2 20*f4a2713aSLionel Sambucextern Class _NSConstantStringClassReference; 21*f4a2713aSLionel Sambuc#else 22*f4a2713aSLionel Sambucextern struct objc_class _NSConstantStringClassReference; 23*f4a2713aSLionel Sambuc#endif 24*f4a2713aSLionel Sambuc 25*f4a2713aSLionel Sambucconst NSConstantString *appKey = @"MyApp"; 26*f4a2713aSLionel Sambuc 27*f4a2713aSLionel Sambucint main() { 28*f4a2713aSLionel Sambuc const NSConstantString *appKey = @"MyApp"; 29*f4a2713aSLionel Sambuc const NSConstantString *appKey1 = @"MyApp1"; 30*f4a2713aSLionel Sambuc} 31*f4a2713aSLionel Sambuc 32*f4a2713aSLionel Sambuc// CHECK-FRAGILE: @_NSConstantStringClassReference = external global 33*f4a2713aSLionel Sambuc// CHECK-NONFRAGILE: @"OBJC_CLASS_$_NSConstantString" = external global 34*f4a2713aSLionel Sambuc 35*f4a2713aSLionel Sambuc// CHECK-FRAGILE: @.str = private unnamed_addr constant [6 x i8] c"MyApp\00" 36*f4a2713aSLionel Sambuc// CHECK-FRAGILE: @.str1 = private unnamed_addr constant [7 x i8] c"MyApp1\00" 37*f4a2713aSLionel Sambuc 38*f4a2713aSLionel Sambuc// CHECK-NONFRAGILE: @.str = private unnamed_addr constant [6 x i8] c"MyApp\00" 39*f4a2713aSLionel Sambuc// CHECK-NONFRAGILE: @.str1 = private unnamed_addr constant [7 x i8] c"MyApp1\00" 40