From: Daniel Dunbar Date: Mon, 30 Nov 2009 08:40:34 +0000 (+0000) Subject: Don't try to generate common globals for C++ files, instead of depending on the FE... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1bc5c03a7f08b04f4ac26abd705418aaf4109062;p=clang Don't try to generate common globals for C++ files, instead of depending on the FE to set NoCommon, and simplify CodeGenOptions initialization. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90119 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp index bbad876575..a14733aba0 100644 --- a/lib/CodeGen/CodeGenModule.cpp +++ b/lib/CodeGen/CodeGenModule.cpp @@ -973,7 +973,7 @@ void CodeGenModule::EmitGlobalVarDefinition(const VarDecl *D) { GV->setLinkage(llvm::GlobalVariable::WeakAnyLinkage); } else if (Linkage == GVA_TemplateInstantiation) GV->setLinkage(llvm::GlobalVariable::WeakAnyLinkage); - else if (!CodeGenOpts.NoCommon && + else if (!getLangOptions().CPlusPlus && !CodeGenOpts.NoCommon && !D->hasExternalStorage() && !D->getInit() && !D->getAttr()) { GV->setLinkage(llvm::GlobalVariable::CommonLinkage); diff --git a/lib/Driver/CC1Options.cpp b/lib/Driver/CC1Options.cpp index f2a8492f0a..9a2b5e6221 100644 --- a/lib/Driver/CC1Options.cpp +++ b/lib/Driver/CC1Options.cpp @@ -190,11 +190,6 @@ static void ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, Opts.MainFileName = getLastArgValue(Args, OPT_main_file_name); - // FIXME: Implement! - // FIXME: Eliminate this dependency? -// if (Lang.CPlusPlus) -// Opts.NoCommon = 1; - // FIXME: Put elsewhere? #ifdef NDEBUG Opts.VerifyModule = 0; diff --git a/tools/clang-cc/Options.cpp b/tools/clang-cc/Options.cpp index ed491d8e97..f1a90b7349 100644 --- a/tools/clang-cc/Options.cpp +++ b/tools/clang-cc/Options.cpp @@ -826,10 +826,6 @@ void clang::InitializeCodeGenOptions(CodeGenOptions &Opts, Opts.UnwindTables = MUnwindTables; Opts.RelocationModel = MRelocationModel; - // FIXME: Eliminate this dependency? - if (Lang.CPlusPlus) - Opts.NoCommon = 1; - #ifdef NDEBUG Opts.VerifyModule = 0; #endif