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/CodeGenModule.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/CodeGenModule.cpp')
-rw-r--r-- | lib/CodeGen/CodeGenModule.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp index 92af03ea89..8a880516f6 100644 --- a/lib/CodeGen/CodeGenModule.cpp +++ b/lib/CodeGen/CodeGenModule.cpp @@ -11,12 +11,13 @@ // //===----------------------------------------------------------------------===// -#include "CGDebugInfo.h" #include "CodeGenModule.h" +#include "CGDebugInfo.h" #include "CodeGenFunction.h" #include "CGCall.h" #include "CGObjCRuntime.h" #include "Mangle.h" +#include "clang/Frontend/CompileOptions.h" #include "clang/AST/ASTContext.h" #include "clang/AST/DeclObjC.h" #include "clang/AST/DeclCXX.h" @@ -31,10 +32,11 @@ using namespace clang; using namespace CodeGen; -CodeGenModule::CodeGenModule(ASTContext &C, const LangOptions &LO, +CodeGenModule::CodeGenModule(ASTContext &C, const CompileOptions &compileOpts, llvm::Module &M, const llvm::TargetData &TD, - Diagnostic &diags, bool GenerateDebugInfo) - : BlockModule(C, M, TD, Types, *this), Context(C), Features(LO), TheModule(M), + Diagnostic &diags) + : BlockModule(C, M, TD, Types, *this), Context(C), + Features(C.getLangOptions()), CompileOpts(compileOpts), TheModule(M), TheTargetData(TD), Diags(diags), Types(C, M, TD), Runtime(0), MemCpyFn(0), MemMoveFn(0), MemSetFn(0), CFConstantStringClassRef(0) { @@ -48,7 +50,7 @@ CodeGenModule::CodeGenModule(ASTContext &C, const LangOptions &LO, Runtime = CreateMacObjCRuntime(*this); // If debug info generation is enabled, create the CGDebugInfo object. - DebugInfo = GenerateDebugInfo ? new CGDebugInfo(this) : 0; + DebugInfo = CompileOpts.DebugInfo ? new CGDebugInfo(this) : 0; } CodeGenModule::~CodeGenModule() { @@ -767,7 +769,7 @@ void CodeGenModule::EmitGlobalVarDefinition(const VarDecl *D) { case VarDecl::Register: assert(0 && "Can't have auto or register globals"); case VarDecl::None: - if (!D->getInit()) + if (!D->getInit() && !CompileOpts.NoCommon) GV->setLinkage(llvm::GlobalVariable::CommonLinkage); else GV->setLinkage(llvm::GlobalVariable::ExternalLinkage); |