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