summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGen/utf16-cfstrings.c
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2012-03-30 00:26:17 +0000
committerBill Wendling <isanbard@gmail.com>2012-03-30 00:26:17 +0000
commit82b87f19e22a8bd53d3e1faa9cf3029daa0bac5b (patch)
treeb471424710c2b5f406072aff6fc5cd0fcf2c7ba4 /clang/test/CodeGen/utf16-cfstrings.c
parentab468b03815a8454b4bda1e5b4f20bc1ad7f1857 (diff)
downloadbcm5719-llvm-82b87f19e22a8bd53d3e1faa9cf3029daa0bac5b.tar.gz
bcm5719-llvm-82b87f19e22a8bd53d3e1faa9cf3029daa0bac5b.zip
The UTF16 string referenced by a CFString should go into the __TEXT,__ustring
section. A 'normal' string will go into the __TEXT,__const section, but this isn't good for UTF16 strings. The __ustring section allows for coalescing, among other niceties (such as allowing the linker to easily split up strings). Instead of outputting the UTF16 string as a series of bytes, output it as a series of shorts. The back-end will then nicely place the UTF16 string into the correct section, because it's a mensch. <rdar://problem/10655949> llvm-svn: 153710
Diffstat (limited to 'clang/test/CodeGen/utf16-cfstrings.c')
-rw-r--r--clang/test/CodeGen/utf16-cfstrings.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/test/CodeGen/utf16-cfstrings.c b/clang/test/CodeGen/utf16-cfstrings.c
new file mode 100644
index 00000000000..d4f214b0d64
--- /dev/null
+++ b/clang/test/CodeGen/utf16-cfstrings.c
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm %s -o - | FileCheck %s
+// <rdar://problem/10655949>
+
+// CHECK: @.str = internal unnamed_addr constant [9 x i16] [i16 252, i16 98, i16 101, i16 114, i16 104, i16 117, i16 110, i16 100, i16 0], align 2
+
+#define CFSTR __builtin___CFStringMakeConstantString
+
+void foo() {
+ CFSTR("überhund");
+}
OpenPOWER on IntegriCloud