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