summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX/vtable-key-function-win-comdat.cpp
diff options
context:
space:
mode:
authorYaron Keren <yaron.keren@gmail.com>2015-07-29 15:42:28 +0000
committerYaron Keren <yaron.keren@gmail.com>2015-07-29 15:42:28 +0000
commit04da2385cfbc91dbbb92e7594348287e11226bcf (patch)
tree21f4b7ae886aee1d880982d7a033907358d37f3f /clang/test/CodeGenCXX/vtable-key-function-win-comdat.cpp
parent63afb6799224399a723af8c67d0b1bbaa1a9a061 (diff)
downloadbcm5719-llvm-04da2385cfbc91dbbb92e7594348287e11226bcf.tar.gz
bcm5719-llvm-04da2385cfbc91dbbb92e7594348287e11226bcf.zip
In case of an existing GlobalVariable, the comdat is created using the name of the
new GV (usually NAME.1) instead of the correct NAME of the old GV. Moving comdat creation after GV replacement solves this. Patch + testcase. Reviewed by Reid Kleckner. http://reviews.llvm.org/D11594 llvm-svn: 243525
Diffstat (limited to 'clang/test/CodeGenCXX/vtable-key-function-win-comdat.cpp')
-rw-r--r--clang/test/CodeGenCXX/vtable-key-function-win-comdat.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/vtable-key-function-win-comdat.cpp b/clang/test/CodeGenCXX/vtable-key-function-win-comdat.cpp
new file mode 100644
index 00000000000..3dd1be7dc69
--- /dev/null
+++ b/clang/test/CodeGenCXX/vtable-key-function-win-comdat.cpp
@@ -0,0 +1,25 @@
+// RUN: %clang_cc1 %s -triple=x86_64-pc-windows-gnu -emit-llvm -o - | FileCheck %s
+
+namespace std { class type_info; }
+extern void use(const std::type_info &rtti);
+
+struct Test1a {
+ Test1a();
+ virtual void foo();
+ virtual void bar();
+};
+
+// V-table needs to be defined weakly.
+Test1a::Test1a() { use(typeid(Test1a)); }
+// This defines the key function.
+inline void Test1a::foo() {}
+
+// CHECK: $_ZTV6Test1a = comdat any
+// CHECK: $_ZTS6Test1a = comdat any
+// CHECK: $_ZTI6Test1a = comdat any
+// CHECK-NOT: $_ZTS6Test1a.1 = comdat any
+// CHECK-NOT: $_ZTI6Test1a.1 = comdat any
+
+// CHECK: @_ZTV6Test1a = linkonce_odr unnamed_addr constant {{.*}} ({ i8*, i8* }* @_ZTI6Test1a to i8*)
+// CHECK: @_ZTS6Test1a = linkonce_odr constant
+// CHECK: @_ZTI6Test1a = linkonce_odr constant {{.*}} [8 x i8]* @_ZTS6Test1a
OpenPOWER on IntegriCloud