aboutsummaryrefslogtreecommitdiff
path: root/clang/test/Modules/merge-vtable-codegen.cpp
diff options
context:
space:
mode:
authorReid Kleckner <reid@kleckner.net>2015-02-25 19:17:48 +0000
committerReid Kleckner <reid@kleckner.net>2015-02-25 19:17:48 +0000
commit1cbd9aa96d36ca320b3faf88fad3319fddd17526 (patch)
tree7c5123d0d54ba729dca91b80726c190759b9d3d8 /clang/test/Modules/merge-vtable-codegen.cpp
parent8b6d034cab0c30bcd289126cae522933c5cb881d (diff)
downloadllvm-1cbd9aa96d36ca320b3faf88fad3319fddd17526.zip
llvm-1cbd9aa96d36ca320b3faf88fad3319fddd17526.tar.gz
llvm-1cbd9aa96d36ca320b3faf88fad3319fddd17526.tar.bz2
Reland (2x) r230314, "Fix codegen for virtual methods that are (re-) exported from multiple modules."
This reverts commits r230477 and r230478. llvm-svn: 230526
Diffstat (limited to 'clang/test/Modules/merge-vtable-codegen.cpp')
-rw-r--r--clang/test/Modules/merge-vtable-codegen.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/clang/test/Modules/merge-vtable-codegen.cpp b/clang/test/Modules/merge-vtable-codegen.cpp
new file mode 100644
index 0000000..7372073
--- /dev/null
+++ b/clang/test/Modules/merge-vtable-codegen.cpp
@@ -0,0 +1,24 @@
+// RUN: rm -rf %t
+
+// First, build two modules that both re-export the same header.
+// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fmodule-name=b -o %t/b.pcm -fmodule-maps \
+// RUN: -emit-module %S/Inputs/merge-vtable-codegen/merge-vtable-codegen.modulemap \
+// RUN: -I %S/Inputs/merge-vtable-codegen
+// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fmodule-name=c -o %t/c.pcm -fmodule-maps \
+// RUN: -emit-module %S/Inputs/merge-vtable-codegen/merge-vtable-codegen.modulemap \
+// RUN: -I %S/Inputs/merge-vtable-codegen
+
+// Use the two modules in a single compile.
+// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fmodule-file=%t/b.pcm -fmodule-file=%t/c.pcm \
+// RUN: -fmodule-map-file=%S/Inputs/merge-vtable-codegen/merge-vtable-codegen.modulemap \
+// RUN: -emit-llvm -o %t/test.o %s
+
+// Note that order is important:
+// Module 'c' just reexports A, while module 'b' defines a method that uses a
+// virtual method of A.
+#include "Inputs/merge-vtable-codegen/c.h"
+#include "Inputs/merge-vtable-codegen/b.h"
+
+void t() {
+ b(nullptr);
+}