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/Driver/ASTConsumers.cpp b/Driver/ASTConsumers.cpp
index bcc176e..bcf54f9 100644
--- a/Driver/ASTConsumers.cpp
+++ b/Driver/ASTConsumers.cpp
@@ -550,15 +550,18 @@
llvm::Module *M;
const llvm::TargetData *TD;
ASTContext *Ctx;
+ const LangOptions &Features;
CodeGen::CodeGenModule *Builder;
public:
- LLVMEmitter(Diagnostic &diags) : Diags(diags) {}
+ LLVMEmitter(Diagnostic &diags, const LangOptions &LO)
+ : Diags(diags)
+ , Features(LO) {}
virtual void Initialize(ASTContext &Context, unsigned MainFileID) {
Ctx = &Context;
M = new llvm::Module("foo");
M->setTargetTriple(Ctx->Target.getTargetTriple());
TD = new llvm::TargetData(Ctx->Target.getTargetDescription());
- Builder = CodeGen::Init(Context, *M, *TD);
+ Builder = CodeGen::Init(Context, Features, *M, *TD);
}
virtual void HandleTopLevelDecl(Decl *D) {
@@ -588,7 +591,7 @@
};
} // end anonymous namespace
-ASTConsumer *clang::CreateLLVMEmitter(Diagnostic &Diags) {
- return new LLVMEmitter(Diags);
+ASTConsumer *clang::CreateLLVMEmitter(Diagnostic &Diags, const LangOptions &Features) {
+ return new LLVMEmitter(Diags, Features);
}