From 4d93a4f9d4b3994addbdc6aa3e3d5d81fef33710 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Mon, 3 Aug 2009 21:47:08 +0000 Subject: Make sure UTF-16 strings end with a 16-bit null (as opposed to 8-bit). llvm-svn: 78001 --- clang/lib/CodeGen/CodeGenModule.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'clang/lib/CodeGen/CodeGenModule.cpp') diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 51fa3302a238..08dc9930ba3d 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -1251,6 +1251,9 @@ GetConstantCFStringEntry(llvm::StringMap &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())); -- cgit v1.2.3