Add support for the common and nocommon attributes.
rdar://8560647
llvm-svn: 120650
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index a3cf69b..1dab0274 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -1214,7 +1214,9 @@
// FIXME: It seems like we can provide more specific linkage here
// (LinkOnceODR, WeakODR).
return llvm::GlobalVariable::WeakAnyLinkage;
- else if (!getLangOptions().CPlusPlus && !CodeGenOpts.NoCommon &&
+ else if (!getLangOptions().CPlusPlus &&
+ ((!CodeGenOpts.NoCommon && !D->getAttr<NoCommonAttr>()) ||
+ D->getAttr<CommonAttr>()) &&
!D->hasExternalStorage() && !D->getInit() &&
!D->getAttr<SectionAttr>() && !D->isThreadSpecified()) {
// Thread local vars aren't considered common linkage.