aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaDeclAttr.cpp
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2013-05-21 00:06:11 +0000
committerBill Wendling <isanbard@gmail.com>2013-05-21 00:06:11 +0000
commit1cac0481166dd383a5d685fd53154661fbac5896 (patch)
tree053bffe7753ef4be0649a497b87ea5cb863f1371 /lib/Sema/SemaDeclAttr.cpp
parent424aa2e72ee59d51914201ce184b585410e1a5fa (diff)
Merging r182266:
------------------------------------------------------------------------ r182266 | rnk | 2013-05-20 07:02:37 -0700 (Mon, 20 May 2013) | 13 lines Implement __declspec(selectany) under -fms-extensions selectany only applies to externally visible global variables. It has the effect of making the data weak_odr. The MSDN docs suggest that unused definitions can only be dropped at linktime, so Clang uses weak instead of linkonce. MSVC optimizes away references to constant selectany data, so it must assume that there is only one definition, hence weak_odr. Reviewers: espindola Differential Revision: http://llvm-reviews.chandlerc.com/D814 ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_33@182337 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDeclAttr.cpp')
-rw-r--r--lib/Sema/SemaDeclAttr.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp
index 7b3345a332..ddcbafc30a 100644
--- a/lib/Sema/SemaDeclAttr.cpp
+++ b/lib/Sema/SemaDeclAttr.cpp
@@ -4683,6 +4683,16 @@ static void handleForceInlineAttr(Sema &S, Decl *D, const AttributeList &Attr) {
S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << Attr.getName();
}
+static void handleSelectAnyAttr(Sema &S, Decl *D, const AttributeList &Attr) {
+ if (!checkMicrosoftExt(S, Attr))
+ return;
+ // Check linkage after possibly merging declaratinos. See
+ // checkAttributesAfterMerging().
+ D->addAttr(::new (S.Context)
+ SelectAnyAttr(Attr.getRange(), S.Context,
+ Attr.getAttributeSpellingListIndex()));
+}
+
//===----------------------------------------------------------------------===//
// Top Level Sema Entry Points
//===----------------------------------------------------------------------===//
@@ -4909,6 +4919,9 @@ static void ProcessInheritableDeclAttr(Sema &S, Scope *scope, Decl *D,
case AttributeList::AT_ForceInline:
handleForceInlineAttr(S, D, Attr);
break;
+ case AttributeList::AT_SelectAny:
+ handleSelectAnyAttr(S, D, Attr);
+ break;
// Thread safety attributes:
case AttributeList::AT_GuardedVar: