summaryrefslogtreecommitdiffstats
path: root/clang/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
commitea7386d40c6026e36c8dd3a5ff911d7e921ae63d (patch)
treee54186260e6832254366ebd61ce25bf3bc44e2a8 /clang/test/CodeGen/ms-declspecs.cpp
parenta2ee3013e6c0c4f883a8dab6e3c8a529d2ca958d (diff)
downloadbcm5719-llvm-ea7386d40c6026e36c8dd3a5ff911d7e921ae63d.tar.gz
bcm5719-llvm-ea7386d40c6026e36c8dd3a5ff911d7e921ae63d.zip
Make __declspec(selectany) turn variable declartions into definitions.
Fixes PR23242. llvm-svn: 235046
Diffstat (limited to 'clang/test/CodeGen/ms-declspecs.cpp')
-rw-r--r--clang/test/CodeGen/ms-declspecs.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/clang/test/CodeGen/ms-declspecs.cpp b/clang/test/CodeGen/ms-declspecs.cpp
new file mode 100644
index 00000000000..f77c7cb8916
--- /dev/null
+++ b/clang/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
OpenPOWER on IntegriCloud