xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenObjC/constant-string-class.m (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -triple i386-apple-darwin9 -fobjc-runtime=macosx-fragile-10.5 -fno-constant-cfstrings -fconstant-string-class Foo -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 -fconstant-string-class Foo -emit-llvm -o %t %s
5*f4a2713aSLionel Sambuc// RUN: FileCheck --check-prefix CHECK-NONFRAGILE < %t %s
6*f4a2713aSLionel Sambuc
7*f4a2713aSLionel Sambuc// rdar: // 8564463
8*f4a2713aSLionel Sambuc// PR6056
9*f4a2713aSLionel Sambuc
10*f4a2713aSLionel Sambuc@interface Object {
11*f4a2713aSLionel Sambuc  id isa;
12*f4a2713aSLionel Sambuc}
13*f4a2713aSLionel Sambuc@end
14*f4a2713aSLionel Sambuc
15*f4a2713aSLionel Sambuc@interface Foo : Object{
16*f4a2713aSLionel Sambuc  char *cString;
17*f4a2713aSLionel Sambuc  unsigned int len;
18*f4a2713aSLionel Sambuc}
19*f4a2713aSLionel Sambuc- (char *)customString;
20*f4a2713aSLionel Sambuc@end
21*f4a2713aSLionel Sambuc
22*f4a2713aSLionel Sambucid _FooClassReference[20];
23*f4a2713aSLionel Sambuc
24*f4a2713aSLionel Sambuc@implementation Foo
25*f4a2713aSLionel Sambuc- (char *)customString { return cString ; }
26*f4a2713aSLionel Sambuc@end
27*f4a2713aSLionel Sambuc
28*f4a2713aSLionel Sambucint main () {
29*f4a2713aSLionel Sambuc  Foo *string = @"bla";
30*f4a2713aSLionel Sambuc  return 0;
31*f4a2713aSLionel Sambuc}
32*f4a2713aSLionel Sambuc
33*f4a2713aSLionel Sambuc// CHECK-FRAGILE: @_FooClassReference = common global
34*f4a2713aSLionel Sambuc// CHECK-NONFRAGILE: @"OBJC_CLASS_$_Object" = external global
35*f4a2713aSLionel Sambuc// CHECK-NONFRAGILE: "OBJC_CLASS_$_Foo" = global
36