summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2018-09-06 17:56:28 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2018-09-06 17:56:28 +0000
commitd2c1dd5902782fb773c64dbf4e0b529aa4044b05 (patch)
treeb0dc110d1ce62729ea56d1c1087bbfe6746b9d48 /clang/test
parentc23948220794b31060947e1b8a4a19543637e8ae (diff)
downloadbcm5719-llvm-d2c1dd5902782fb773c64dbf4e0b529aa4044b05.tar.gz
bcm5719-llvm-d2c1dd5902782fb773c64dbf4e0b529aa4044b05.zip
[OPENMP] Fix PR38823: Do not emit vtable if it is not used in target
context. If the explicit template instantiation definition defined outside of the target context, its vtable should not be marked as used. This is true for other situations where the compiler want to emit vtables unconditionally. llvm-svn: 341570
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/OpenMP/declare_target_codegen.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/clang/test/OpenMP/declare_target_codegen.cpp b/clang/test/OpenMP/declare_target_codegen.cpp
index 1694ec6072c..2475c49d3de 100644
--- a/clang/test/OpenMP/declare_target_codegen.cpp
+++ b/clang/test/OpenMP/declare_target_codegen.cpp
@@ -12,7 +12,8 @@
// SIMD-ONLY-NOT: {{__kmpc|__tgt}}
-// CHECK-NOT: define {{.*}}{{baz1|baz4|maini1}}
+// CHECK-NOT: define {{.*}}{{baz1|baz4|maini1|Base}}
+// CHECK-DAG: Bake
// CHECK-NOT: @{{hhh|ggg|fff|eee}} =
// CHECK-DAG: @aaa = external global i32,
// CHECK-DAG: @bbb = global i32 0,
@@ -140,9 +141,25 @@ int baz5() {
return a;
}
+template <typename T>
+struct Base {
+ virtual ~Base() {}
+};
+
+template class Base<int>;
+
+template <typename T>
+struct Bake {
+ virtual ~Bake() {}
+};
+
+#pragma omp declare target
+template class Bake<int>;
+#pragma omp end declare target
+
// CHECK-DAG: declare extern_weak signext i32 @__create()
-// CHECK-NOT: define {{.*}}{{baz1|baz4|maini1}}
+// CHECK-NOT: define {{.*}}{{baz1|baz4|maini1|Base}}
// CHECK-DAG: !{i32 1, !"aaa", i32 0, i32 {{[0-9]+}}}
// CHECK-DAG: !{i32 1, !"ccc", i32 0, i32 {{[0-9]+}}}
OpenPOWER on IntegriCloud