]> granicus.if.org Git - clang/commitdiff
Simplify, NFC.
authorDaniel Dunbar <daniel@zuster.org>
Thu, 23 Jul 2009 20:38:28 +0000 (20:38 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Thu, 23 Jul 2009 20:38:28 +0000 (20:38 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76897 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CodeGenModule.cpp

index 4321765607683520e19aca91bb09cb33b6263eb9..c417cf8ec9325dc642831e2397be89b9a416f662 100644 (file)
@@ -1215,16 +1215,15 @@ GetAddrOfConstantCFString(const StringLiteral *Literal) {
       StringLength = ToPtr-&ToBuf[0];
       str.assign((char *)&ToBuf[0], StringLength*2);// Twice as many UTF8 chars.
       isUTF16 = true;
-    } else if (Result == sourceIllegal) {
+    } else {
+      assert(Result == sourceIllegal && "UTF-8 to UTF-16 conversion failed");
       // FIXME: Have Sema::CheckObjCString() validate the UTF-8 string.
-      str.assign(Literal->getStrData(), Literal->getByteLength());
-      StringLength = str.length();
-    } else
-      assert(Result == conversionOK && "UTF-8 to UTF-16 conversion failed");
-    
+      StringLength = Literal->getByteLength();
+      str.assign(Literal->getStrData(), StringLength);
+    }
   } else {
-    str.assign(Literal->getStrData(), Literal->getByteLength());
-    StringLength = str.length();
+    StringLength = Literal->getByteLength();
+    str.assign(Literal->getStrData(), StringLength);
   }
   llvm::Constant *&Entry = CFConstantStringMap[str];