diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-09-22 10:03:52 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-09-22 10:03:52 +0000 |
commit | b879c3c125f9d2abd76b08d1e368f5ad77b77045 (patch) | |
tree | 7710ebcd57725c97abad91deaa7f94511ca15fd0 /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | 99e1174baf879889568a64eea17824c214c28b41 (diff) | |
download | bcm5719-llvm-b879c3c125f9d2abd76b08d1e368f5ad77b77045.tar.gz bcm5719-llvm-b879c3c125f9d2abd76b08d1e368f5ad77b77045.zip |
Revert "Switch a few clients over to StringLiteral::getString.", this is breaking some projects, but I don't have a test case yet.
llvm-svn: 82539
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index ac0c6c3faec..af9f7e91f3f 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -1310,12 +1310,15 @@ GetConstantCFStringEntry(llvm::StringMap<llvm::Constant*> &Map, bool TargetIsLSB, bool &IsUTF16, unsigned &StringLength) { - // Check for simple case. - if (!Literal->containsNonAsciiOrNull()) - return Map.GetOrCreateValue(Literal->getString()); - unsigned NumBytes = Literal->getByteLength(); + // Check for simple case. + if (!Literal->containsNonAsciiOrNull()) { + StringLength = NumBytes; + return Map.GetOrCreateValue(llvm::StringRef(Literal->getStrData(), + StringLength)); + } + // Otherwise, convert the UTF8 literals into a byte string. llvm::SmallVector<UTF16, 128> ToBuf(NumBytes); const UTF8 *FromPtr = (UTF8 *)Literal->getStrData(); @@ -1330,7 +1333,9 @@ GetConstantCFStringEntry(llvm::StringMap<llvm::Constant*> &Map, // FIXME: Have Sema::CheckObjCString() validate the UTF-8 string and remove // this duplicate code. assert(Result == sourceIllegal && "UTF-8 to UTF-16 conversion failed"); - return Map.GetOrCreateValue(Literal->getString()); + StringLength = NumBytes; + return Map.GetOrCreateValue(llvm::StringRef(Literal->getStrData(), + StringLength)); } // ConvertUTF8toUTF16 returns the length in ToPtr. |