aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGen/cfstring.c
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2012-01-10 08:46:39 +0000
committerBill Wendling <isanbard@gmail.com>2012-01-10 08:46:39 +0000
commit1bf7a3fcc4e2ad30688f7b0db464ad1ccabe77e2 (patch)
treedd5cabf9dba41214b2dcc602b703c343c12b77ed /test/CodeGen/cfstring.c
parent7ead5c7b6fd48cf549e55b4db499c26ecf88ae75 (diff)
The `-fwritable-strings' flag doesn't make the backing store strings of all
CFStrings writable. The strings (both Unicode and ASCII) should reside in a read-only section. E.g., __TEXT,__cstring instead of __DATA,__data. This is done by making the global variable created for the strings constant despite the value of that flag. <rdar://problem/10657500> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147845 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/cfstring.c')
-rw-r--r--test/CodeGen/cfstring.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/CodeGen/cfstring.c b/test/CodeGen/cfstring.c
index 1f0977f039..9d98b56e6b 100644
--- a/test/CodeGen/cfstring.c
+++ b/test/CodeGen/cfstring.c
@@ -1,4 +1,14 @@
// RUN: %clang_cc1 -emit-llvm %s -o %t
+
+// <rdar://problem/10657500>: Check that the backing store of CFStrings are
+// constant with the -fwritable-strings flag.
+//
+// RUN: %clang_cc1 -fwritable-strings -emit-llvm %s -o - | FileCheck %s
+//
+// CHECK: @.str = linker_private unnamed_addr constant [14 x i8] c"Hello, World!\00", align 1
+// CHECK: @.str1 = linker_private unnamed_addr constant [7 x i8] c"yo joe\00", align 1
+// CHECK: @.str3 = linker_private unnamed_addr constant [16 x i8] c"Goodbye, World!\00", align 1
+
#define CFSTR __builtin___CFStringMakeConstantString
void f() {