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/CGObjCGNU.cpp b/lib/CodeGen/CGObjCGNU.cpp
index e6ca536..bc713bd 100644
--- a/lib/CodeGen/CGObjCGNU.cpp
+++ b/lib/CodeGen/CGObjCGNU.cpp
@@ -94,7 +94,7 @@
       std::vector<llvm::Constant*> &V, const std::string &Name="");
 public:
   CGObjCGNU(CodeGen::CodeGenModule &cgm);
-  virtual llvm::Constant *GenerateConstantString(const std::string &String);
+  virtual llvm::Constant *GenerateConstantString(const ObjCStringLiteral *);
   virtual CodeGen::RValue 
   GenerateMessageSend(CodeGen::CodeGenFunction &CGF,
                       QualType ResultType,
@@ -252,7 +252,9 @@
 //TODO: In case there are any crazy people still using the GNU runtime without
 //an OpenStep implementation, this should let them select their own class for
 //constant strings.
-llvm::Constant *CGObjCGNU::GenerateConstantString(const std::string &Str) {
+llvm::Constant *CGObjCGNU::GenerateConstantString(const ObjCStringLiteral *SL) {
+  std::string Str(SL->getString()->getStrData(), 
+                  SL->getString()->getByteLength());
   std::vector<llvm::Constant*> Ivars;
   Ivars.push_back(NULLPtr);
   Ivars.push_back(MakeConstantString(Str));