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/CGObjCMac.cpp b/lib/CodeGen/CGObjCMac.cpp
index 05d81ea..f688029 100644
--- a/lib/CodeGen/CGObjCMac.cpp
+++ b/lib/CodeGen/CGObjCMac.cpp
@@ -487,7 +487,7 @@
   CGObjCCommonMac(CodeGen::CodeGenModule &cgm) : CGM(cgm)
   { }
   
-  virtual llvm::Constant *GenerateConstantString(const std::string &String);
+  virtual llvm::Constant *GenerateConstantString(const ObjCStringLiteral *SL);
   
   virtual llvm::Function *GenerateMethod(const ObjCMethodDecl *OMD,
                                          const ObjCContainerDecl *CD=0);
@@ -899,8 +899,13 @@
 */
 
 llvm::Constant *CGObjCCommonMac::GenerateConstantString(
-                                                  const std::string &String) {
-  return CGM.GetAddrOfConstantCFString(String);
+  const ObjCStringLiteral *SL) {
+  std::string Str(SL->getString()->getStrData(), 
+                  SL->getString()->getByteLength());
+  if (SL->getString()->containsNonAscii()) {
+    // FIXME: Convert from UTF-8 to UTF-16.
+  }
+  return CGM.GetAddrOfConstantCFString(Str);
 }
 
 /// Generates a message send where the super is the receiver.  This is