Implement support for -fwritable-strings and make the code generator
merge string literals when it is not provided.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44394 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/CodeGen/CodeGenModule.h b/CodeGen/CodeGenModule.h
index a044c0d..1d7c30e 100644
--- a/CodeGen/CodeGenModule.h
+++ b/CodeGen/CodeGenModule.h
@@ -32,6 +32,7 @@
   class Decl;
   class ValueDecl;
   class FileVarDecl;
+  struct LangOptions;
     
 namespace CodeGen {
 
@@ -39,21 +40,25 @@
 /// while generating LLVM code.
 class CodeGenModule {
   ASTContext &Context;
+  const LangOptions &Features;
   llvm::Module &TheModule;
   const llvm::TargetData &TheTargetData;
   CodeGenTypes Types;
 
   llvm::Function *MemCpyFn;
   llvm::DenseMap<const Decl*, llvm::Constant*> GlobalDeclMap;
-  
+    
   llvm::StringMap<llvm::Constant*> CFConstantStringMap;
+  llvm::StringMap<llvm::Constant*> ConstantStringMap;
   llvm::Constant *CFConstantStringClassRef;
   
   std::vector<llvm::Function *> BuiltinFunctions;
 public:
-  CodeGenModule(ASTContext &C, llvm::Module &M, const llvm::TargetData &TD);
+  CodeGenModule(ASTContext &C, const LangOptions &Features, llvm::Module &M, 
+                const llvm::TargetData &TD);
   
   ASTContext &getContext() const { return Context; }
+  const LangOptions &getLangOptions() const { return Features; }
   llvm::Module &getModule() const { return TheModule; }
   CodeGenTypes &getTypes() { return Types; }
   
@@ -64,6 +69,7 @@
   ///
   llvm::Function *getBuiltinLibFunction(unsigned BuiltinID);
   llvm::Constant *GetAddrOfConstantCFString(const std::string& str);
+  llvm::Constant *GetAddrOfConstantString(const std::string& str);
   llvm::Function *getMemCpyFn();