Some "prep" work for handling ObjC @-string constants that contain UTF-8. No functionality change.

Changed GenerateConstantString() to take an ObjCStringLiteral (instead of a std::string). While this isn't strictly necessary, it seems cleaner and allows us to cache to "containsNonAscii" if necessary (to avoid checking in both Sema and CodeGen).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68114 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGExprConstant.cpp b/lib/CodeGen/CGExprConstant.cpp
index 3f52175..89b3319 100644
--- a/lib/CodeGen/CGExprConstant.cpp
+++ b/lib/CodeGen/CGExprConstant.cpp
@@ -417,9 +417,7 @@
       return CGM.GetAddrOfConstantStringFromObjCEncode(cast<ObjCEncodeExpr>(E));
     case Expr::ObjCStringLiteralClass: {
       ObjCStringLiteral* SL = cast<ObjCStringLiteral>(E);
-      std::string S(SL->getString()->getStrData(), 
-                    SL->getString()->getByteLength());
-      llvm::Constant *C = CGM.getObjCRuntime().GenerateConstantString(S);
+      llvm::Constant *C = CGM.getObjCRuntime().GenerateConstantString(SL);
       return llvm::ConstantExpr::getBitCast(C, ConvertType(E->getType()));
     }
     case Expr::PredefinedExprClass: {
@@ -445,6 +443,7 @@
       const Expr *Arg = CE->getArg(0)->IgnoreParenCasts();
       const StringLiteral *Literal = cast<StringLiteral>(Arg);
       std::string S(Literal->getStrData(), Literal->getByteLength());
+      // FIXME: need to deal with UCN conversion issues.
       return CGM.GetAddrOfConstantCFString(S);
     }
     case Expr::BlockExprClass: {