forked from OSchip/llvm-project
Make sure UTF-16 strings end with a 16-bit null (as opposed to 8-bit).
llvm-svn: 78001
This commit is contained in:
parent
0bb32e3e5d
commit
4d93a4f9d4
|
@ -1251,6 +1251,9 @@ GetConstantCFStringEntry(llvm::StringMap<llvm::Constant*> &Map,
|
|||
AsBytes.push_back(Val & 0xFF);
|
||||
}
|
||||
}
|
||||
// Append one extra null character, the second is automatically added by our
|
||||
// caller.
|
||||
AsBytes.push_back(0);
|
||||
|
||||
IsUTF16 = true;
|
||||
return Map.GetOrCreateValue(llvm::StringRef(AsBytes.data(), AsBytes.size()));
|
||||
|
|
|
@ -2,14 +2,15 @@
|
|||
|
||||
// CHECK-LSB: @.str = private constant [8 x i8] c"string0\00"
|
||||
// CHECK-LSB: @.str1 = private constant [8 x i8] c"string1\00", section "__TEXT,__cstring,cstring_literals"
|
||||
// CHECK-LSB: @__utf16_string_ = internal global [35 x i8] c"h\00e\00l\00l\00o\00 \00\92! \00\03& \00\90! \00w\00o\00r\00l\00d\00\00", section "__TEXT,__ustring", align 2
|
||||
// CHECK-LSB: @__utf16_string_ = internal global [36 x i8] c"h\00e\00l\00l\00o\00 \00\92! \00\03& \00\90! \00w\00o\00r\00l\00d\00\00\00", section "__TEXT,__ustring", align 2
|
||||
|
||||
// RUN: clang-cc -triple powerpc-apple-darwin9 -emit-llvm %s -o - | FileCheck -check-prefix MSB %s
|
||||
|
||||
// CHECK-MSB: @.str = private constant [8 x i8] c"string0\00"
|
||||
// CHECK-MSB: @.str1 = private constant [8 x i8] c"string1\00", section "__TEXT,__cstring,cstring_literals"
|
||||
// CHECK-MSB: @__utf16_string_ = internal global [35 x i8] c"\00h\00e\00l\00l\00o\00 !\92\00 &\03\00 !\90\00 \00w\00o\00r\00l\00d\00", section "__TEXT,__ustring", align 2
|
||||
// CHECK-MSB: @__utf16_string_ = internal global [36 x i8] c"\00h\00e\00l\00l\00o\00 !\92\00 &\03\00 !\90\00 \00w\00o\00r\00l\00d\00\00", section "__TEXT,__ustring", align 2
|
||||
|
||||
const char *g0 = "string0";
|
||||
const void *g1 = __builtin___CFStringMakeConstantString("string1");
|
||||
const void *g2 = __builtin___CFStringMakeConstantString("hello \u2192 \u2603 \u2190 world");
|
||||
const void *g3 = __builtin___CFStringMakeConstantString("test™");
|
||||
|
|
Loading…
Reference in New Issue