diff options
author | Bill Wendling <isanbard@gmail.com> | 2013-05-21 00:06:11 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2013-05-21 00:06:11 +0000 |
commit | 1cac0481166dd383a5d685fd53154661fbac5896 (patch) | |
tree | 053bffe7753ef4be0649a497b87ea5cb863f1371 /include | |
parent | 424aa2e72ee59d51914201ce184b585410e1a5fa (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 'include')
-rw-r--r-- | include/clang/Basic/Attr.td | 4 | ||||
-rw-r--r-- | include/clang/Basic/DiagnosticSemaKinds.td | 2 |
2 files changed, 6 insertions, 0 deletions
diff --git a/include/clang/Basic/Attr.td b/include/clang/Basic/Attr.td index 441a79a23b..25c9fcb5af 100644 --- a/include/clang/Basic/Attr.td +++ b/include/clang/Basic/Attr.td @@ -948,6 +948,10 @@ def ForceInline : InheritableAttr { let Spellings = [Keyword<"__forceinline">]; } +def SelectAny : InheritableAttr { + let Spellings = [Declspec<"selectany">]; +} + def Win64 : InheritableAttr { let Spellings = [Keyword<"__w64">]; } diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index f5345eb8c3..b770c07339 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -1948,6 +1948,8 @@ def warn_weak_identifier_undeclared : Warning< "weak identifier %0 never declared">; def err_attribute_weak_static : Error< "weak declaration cannot have internal linkage">; +def err_attribute_selectany_non_extern_data : Error< + "'selectany' can only be applied to data items with external linkage">; def warn_attribute_weak_import_invalid_on_definition : Warning< "'weak_import' attribute cannot be specified on a definition">, InGroup<IgnoredAttributes>; |