[llvm-branch-commits] [cfe-branch] r318133 - Merging r313278:
Tom Stellard via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Nov 13 18:38:20 PST 2017
Author: tstellar
Date: Mon Nov 13 18:38:20 2017
New Revision: 318133
URL: http://llvm.org/viewvc/llvm-project?rev=318133&view=rev
Log:
Merging r313278:
------------------------------------------------------------------------
r313278 | prazek | 2017-09-14 10:33:08 -0700 (Thu, 14 Sep 2017) | 11 lines
Enable __declspec(selectany) on any platform
Summary:
This feature was disabled probably by mistake in rL300562
This fixes bug https://bugs.llvm.org/show_bug.cgi?id=33285
Reviewers: davide, rnk
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D33852
------------------------------------------------------------------------
Modified:
cfe/branches/release_50/include/clang/Basic/Attr.td
cfe/branches/release_50/include/clang/Basic/AttrDocs.td
cfe/branches/release_50/test/Sema/attr-selectany.c
cfe/branches/release_50/test/SemaCXX/attr-selectany.cpp
Modified: cfe/branches/release_50/include/clang/Basic/Attr.td
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_50/include/clang/Basic/Attr.td?rev=318133&r1=318132&r2=318133&view=diff
==============================================================================
--- cfe/branches/release_50/include/clang/Basic/Attr.td (original)
+++ cfe/branches/release_50/include/clang/Basic/Attr.td Mon Nov 13 18:38:20 2017
@@ -2459,9 +2459,9 @@ def DLLImport : InheritableAttr, TargetS
let Documentation = [DLLImportDocs];
}
-def SelectAny : InheritableAttr, TargetSpecificAttr<TargetWindows> {
+def SelectAny : InheritableAttr {
let Spellings = [Declspec<"selectany">, GCC<"selectany">];
- let Documentation = [Undocumented];
+ let Documentation = [SelectAnyDocs];
}
def Thread : Attr {
Modified: cfe/branches/release_50/include/clang/Basic/AttrDocs.td
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_50/include/clang/Basic/AttrDocs.td?rev=318133&r1=318132&r2=318133&view=diff
==============================================================================
--- cfe/branches/release_50/include/clang/Basic/AttrDocs.td (original)
+++ cfe/branches/release_50/include/clang/Basic/AttrDocs.td Mon Nov 13 18:38:20 2017
@@ -3106,3 +3106,18 @@ This attribute can be added to an Object
ensure that this class cannot be subclassed.
}];
}
+
+
+def SelectAnyDocs : Documentation {
+ let Category = DocCatType;
+ let Content = [{
+This attribute appertains to a global symbol, causing it to have a weak
+definition (
+`linkonce <https://llvm.org/docs/LangRef.html#linkage-types>`_
+), allowing the linker to select any definition.
+
+For more information see
+`gcc documentation <https://gcc.gnu.org/onlinedocs/gcc-7.2.0/gcc/Microsoft-Windows-Variable-Attributes.html>`_
+or `msvc documentation <https://docs.microsoft.com/pl-pl/cpp/cpp/selectany>`_.
+}];
+}
Modified: cfe/branches/release_50/test/Sema/attr-selectany.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_50/test/Sema/attr-selectany.c?rev=318133&r1=318132&r2=318133&view=diff
==============================================================================
--- cfe/branches/release_50/test/Sema/attr-selectany.c (original)
+++ cfe/branches/release_50/test/Sema/attr-selectany.c Mon Nov 13 18:38:20 2017
@@ -1,5 +1,7 @@
// RUN: %clang_cc1 -triple x86_64-win32 -fdeclspec -verify %s
// RUN: %clang_cc1 -triple x86_64-mingw32 -verify %s
+// RUN: %clang_cc1 -triple x86_64-unknown-linux -verify -fdeclspec %s
+// RUN: %clang_cc1 -triple x86_64-win32-macho -verify -fdeclspec %s
extern __declspec(selectany) const int x1 = 1; // no warning, const means we need extern in C++
Modified: cfe/branches/release_50/test/SemaCXX/attr-selectany.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_50/test/SemaCXX/attr-selectany.cpp?rev=318133&r1=318132&r2=318133&view=diff
==============================================================================
--- cfe/branches/release_50/test/SemaCXX/attr-selectany.cpp (original)
+++ cfe/branches/release_50/test/SemaCXX/attr-selectany.cpp Mon Nov 13 18:38:20 2017
@@ -1,4 +1,7 @@
// RUN: %clang_cc1 -triple x86_64-win32 -fms-compatibility -fms-extensions -fsyntax-only -verify -std=c++11 %s
+// RUN: %clang_cc1 -triple x86_64-unknown-linux -fms-compatibility -fms-extensions -fsyntax-only -verify -std=c++11 %s
+// RUN: %clang_cc1 -triple x86_64-win32-macho -fms-compatibility -fms-extensions -fsyntax-only -verify -std=c++11 %s
+
// MSVC produces similar diagnostics.
__declspec(selectany) void foo() { } // expected-error{{'selectany' can only be applied to data items with external linkage}}
More information about the llvm-branch-commits
mailing list