]> granicus.if.org Git - clang/commitdiff
Put constant CFStrings in the __DATA,__cfstring section.
authorAnders Carlsson <andersca@mac.com>
Thu, 1 Nov 2007 00:41:52 +0000 (00:41 +0000)
committerAnders Carlsson <andersca@mac.com>
Thu, 1 Nov 2007 00:41:52 +0000 (00:41 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43593 91177308-0d34-0410-b5e6-96231b3b80d8

CodeGen/CodeGenModule.cpp

index a2023e441ff21e78d8192149de434264b18e8966..6faf3f88d75b13748b3c75b4ec92b416fddf8f77 100644 (file)
@@ -247,10 +247,11 @@ GetAddrOfConstantCFString(const std::string &str) {
   // The struct.
   Ty = getTypes().ConvertType(getContext().getCFConstantStringType());
   C = llvm::ConstantStruct::get(cast<llvm::StructType>(Ty), Fields);
-  C = new llvm::GlobalVariable(C->getType(), true, 
-                               llvm::GlobalVariable::InternalLinkage, 
-                               C, "", &getModule());
-  
-  Entry.setValue(C);
-  return C;
+  llvm::GlobalVariable *GV = 
+    new llvm::GlobalVariable(C->getType(), true, 
+                             llvm::GlobalVariable::InternalLinkage, 
+                             C, "", &getModule());
+  GV->setSection("__DATA,__cfstring");
+  Entry.setValue(GV);
+  return GV;
 }