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 | df4eee9b035cc4b95b1ea72635e7429d06b0ecc8 (patch) | |
tree | c714b969d8deb3dae67652575a359f6bf24c46f1 /lib/CodeGen/CodeGenModule.cpp | |
parent | b648023da23e8b227cdda57a241db4c6f368726b (diff) |
Switch a few clients over to StringLiteral::getString.
- Switching all of them out-of-my-current-scope-of-interest, sorry.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82515 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | lib/CodeGen/CodeGenModule.cpp | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp index af9f7e91f3..ac0c6c3fae 100644 --- a/lib/CodeGen/CodeGenModule.cpp +++ b/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. |