diff options
author | Chris Lattner <sabre@nondot.org> | 2009-03-26 05:00:52 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-03-26 05:00:52 +0000 |
commit | bd3606426d389370616126af969904ec493cb105 (patch) | |
tree | a3323b1dda81405be821f46ec5c41e420104c0da /lib/CodeGen/ModuleBuilder.cpp | |
parent | e062533e298f72d970b2aa99cd0e3818b20d73df (diff) |
most of this is plumbing to get CompileOptions down into
CodeGenModule. Once there, add a new NoCommon option to
it and implement -fno-common.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67735 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/ModuleBuilder.cpp')
-rw-r--r-- | lib/CodeGen/ModuleBuilder.cpp | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/lib/CodeGen/ModuleBuilder.cpp b/lib/CodeGen/ModuleBuilder.cpp index 3e3f5e463f..6c0b68b5dd 100644 --- a/lib/CodeGen/ModuleBuilder.cpp +++ b/lib/CodeGen/ModuleBuilder.cpp @@ -13,20 +13,17 @@ #include "clang/CodeGen/ModuleBuilder.h" #include "CodeGenModule.h" +#include "clang/Frontend/CompileOptions.h" #include "clang/AST/ASTContext.h" #include "clang/AST/DeclObjC.h" #include "clang/AST/Expr.h" -using namespace clang; - -//===----------------------------------------------------------------------===// -// LLVM Emitter - #include "clang/Basic/Diagnostic.h" #include "clang/Basic/TargetInfo.h" #include "llvm/Module.h" #include "llvm/Target/TargetData.h" #include "llvm/Support/Compiler.h" #include "llvm/ADT/OwningPtr.h" +using namespace clang; namespace { @@ -34,17 +31,14 @@ namespace { Diagnostic &Diags; llvm::OwningPtr<const llvm::TargetData> TD; ASTContext *Ctx; - const LangOptions &Features; - bool GenerateDebugInfo; + const CompileOptions CompileOpts; // Intentionally copied in. protected: llvm::OwningPtr<llvm::Module> M; llvm::OwningPtr<CodeGen::CodeGenModule> Builder; public: - CodeGeneratorImpl(Diagnostic &diags, const LangOptions &LO, - const std::string& ModuleName, - bool DebugInfoFlag) - : Diags(diags), Features(LO), GenerateDebugInfo(DebugInfoFlag), - M(new llvm::Module(ModuleName)) {} + CodeGeneratorImpl(Diagnostic &diags, const std::string& ModuleName, + const CompileOptions &CO) + : Diags(diags), CompileOpts(CO), M(new llvm::Module(ModuleName)) {} virtual ~CodeGeneratorImpl() {} @@ -62,8 +56,8 @@ namespace { M->setTargetTriple(Ctx->Target.getTargetTriple()); M->setDataLayout(Ctx->Target.getTargetDescription()); TD.reset(new llvm::TargetData(Ctx->Target.getTargetDescription())); - Builder.reset(new CodeGen::CodeGenModule(Context, Features, *M, *TD, - Diags, GenerateDebugInfo)); + Builder.reset(new CodeGen::CodeGenModule(Context, CompileOpts, + *M, *TD, Diags)); } virtual void HandleTopLevelDecl(Decl *D) { @@ -93,8 +87,7 @@ namespace { } CodeGenerator *clang::CreateLLVMCodeGen(Diagnostic &Diags, - const LangOptions &Features, const std::string& ModuleName, - bool GenerateDebugInfo) { - return new CodeGeneratorImpl(Diags, Features, ModuleName, GenerateDebugInfo); + const CompileOptions &CO) { + return new CodeGeneratorImpl(Diags, ModuleName, CO); } |