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
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index ac0c6c3..af9f7e9 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -1310,12 +1310,15 @@
                          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 @@
     // 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.