diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-09-22 03:27:52 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-09-22 03:27:52 +0000 |
commit | 5de27daf93c167a0108d8549db3f89055656a0e7 (patch) | |
tree | d33f9ca8d702f84842db034254f5c69ba8166574 /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | 362178883c2eeb5da9e9a203f10cdd857c6f97fa (diff) | |
download | bcm5719-llvm-5de27daf93c167a0108d8549db3f89055656a0e7.tar.gz bcm5719-llvm-5de27daf93c167a0108d8549db3f89055656a0e7.zip |
Switch a few clients over to StringLiteral::getString.
- Switching all of them out-of-my-current-scope-of-interest, sorry.
llvm-svn: 82515
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index af9f7e91f3f..ac0c6c3faec 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -1310,14 +1310,11 @@ GetConstantCFStringEntry(llvm::StringMap<llvm::Constant*> &Map, bool TargetIsLSB, bool &IsUTF16, unsigned &StringLength) { - unsigned NumBytes = Literal->getByteLength(); - // Check for simple case. - if (!Literal->containsNonAsciiOrNull()) { - StringLength = NumBytes; - return Map.GetOrCreateValue(llvm::StringRef(Literal->getStrData(), - StringLength)); - } + if (!Literal->containsNonAsciiOrNull()) + return Map.GetOrCreateValue(Literal->getString()); + + unsigned NumBytes = Literal->getByteLength(); // Otherwise, convert the UTF8 literals into a byte string. llvm::SmallVector<UTF16, 128> ToBuf(NumBytes); @@ -1333,9 +1330,7 @@ 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"); - StringLength = NumBytes; - return Map.GetOrCreateValue(llvm::StringRef(Literal->getStrData(), - StringLength)); + return Map.GetOrCreateValue(Literal->getString()); } // ConvertUTF8toUTF16 returns the length in ToPtr. |