xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGen/cfstring.c (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1f4a2713aSLionel Sambuc // RUN: %clang_cc1 -emit-llvm %s -o %t
2f4a2713aSLionel Sambuc 
3f4a2713aSLionel Sambuc // <rdar://problem/10657500>: Check that the backing store of CFStrings are
4f4a2713aSLionel Sambuc // constant with the -fwritable-strings flag.
5f4a2713aSLionel Sambuc //
6f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fwritable-strings -emit-llvm %s -o - | FileCheck %s
7f4a2713aSLionel Sambuc //
8*0a6a1f1dSLionel Sambuc // CHECK: @.str = private unnamed_addr constant [14 x i8] c"Hello, World!\00", section "__TEXT,__cstring,cstring_literals", align 1
9*0a6a1f1dSLionel Sambuc // CHECK: @.str1 = private unnamed_addr constant [7 x i8] c"yo joe\00", section "__TEXT,__cstring,cstring_literals", align 1
10*0a6a1f1dSLionel Sambuc // CHECK: @.str3 = private unnamed_addr constant [16 x i8] c"Goodbye, World!\00", section "__TEXT,__cstring,cstring_literals", align 1
11f4a2713aSLionel Sambuc 
12f4a2713aSLionel Sambuc #define CFSTR __builtin___CFStringMakeConstantString
13f4a2713aSLionel Sambuc 
f()14f4a2713aSLionel Sambuc void f() {
15f4a2713aSLionel Sambuc   CFSTR("Hello, World!");
16f4a2713aSLionel Sambuc }
17f4a2713aSLionel Sambuc 
18f4a2713aSLionel Sambuc // rdar://6248329
19f4a2713aSLionel Sambuc void *G = CFSTR("yo joe");
20f4a2713aSLionel Sambuc 
h()21f4a2713aSLionel Sambuc void h() {
22f4a2713aSLionel Sambuc   static void* h = CFSTR("Goodbye, World!");
23f4a2713aSLionel Sambuc }
24