summaryrefslogtreecommitdiff
path: root/test/CodeGen/ms-declspecs.cpp
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2015-04-15 21:50:06 +0000
committerNico Weber <nicolasweber@gmx.de>2015-04-15 21:50:06 +0000
commita39c64d044f8014a631ac802c8a20ddce9c57822 (patch)
treec7e09c441c45f36dce1a48acdf9525f77551fe52 /test/CodeGen/ms-declspecs.cpp
parentcd72ec433f4d039940a2b039a95378b6d02cfc76 (diff)
downloadclang-a39c64d044f8014a631ac802c8a20ddce9c57822.tar.gz
Make __declspec(selectany) turn variable declartions into definitions.
Fixes PR23242. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@235046 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/ms-declspecs.cpp')
-rw-r--r--test/CodeGen/ms-declspecs.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/CodeGen/ms-declspecs.cpp b/test/CodeGen/ms-declspecs.cpp
new file mode 100644
index 0000000000..f77c7cb891
--- /dev/null
+++ b/test/CodeGen/ms-declspecs.cpp
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -triple i386-pc-win32 %s -emit-llvm -fms-compatibility -o - | FileCheck %s
+
+// selectany turns extern "C" variable declarations into definitions.
+extern __declspec(selectany) int x1;
+extern "C" __declspec(selectany) int x2;
+extern "C++" __declspec(selectany) int x3;
+extern "C" {
+__declspec(selectany) int x4;
+}
+// CHECK: @"\01?x1@@3HA" = weak_odr global i32 0, comdat, align 4
+// CHECK: @x2 = weak_odr global i32 0, comdat, align 4
+// CHECK: @"\01?x3@@3HA" = weak_odr global i32 0, comdat, align 4
+// CHECK: @x4 = weak_odr global i32 0, comdat, align 4