summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2018-09-21 14:55:26 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2018-09-21 14:55:26 +0000
commitf898d1de4a256ad9f2702682bb28715d16503c7a (patch)
tree67b6e44cabc9130dab9c7afd976c326afe4f9878
parent72d627e5ec293611741ed46271afeebf55a23e55 (diff)
downloadbcm5719-llvm-f898d1de4a256ad9f2702682bb28715d16503c7a.tar.gz
bcm5719-llvm-f898d1de4a256ad9f2702682bb28715d16503c7a.zip
[OPENMP] Disable emission of the class with vptr if they are not used in
target constructs. Prevent compilation of the classes with the virtual tables when compiling for the device. llvm-svn: 342741
-rw-r--r--clang/lib/Sema/SemaDeclCXX.cpp3
-rw-r--r--clang/test/OpenMP/declare_target_codegen.cpp10
2 files changed, 12 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index fd0f4874592..95ad45d4954 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -14918,7 +14918,8 @@ void Sema::MarkVTableUsed(SourceLocation Loc, CXXRecordDecl *Class,
// Do not mark as used if compiling for the device outside of the target
// region.
if (LangOpts.OpenMP && LangOpts.OpenMPIsDevice &&
- !isInOpenMPDeclareTargetContext() && !getCurFunctionDecl())
+ !isInOpenMPDeclareTargetContext() &&
+ !isInOpenMPTargetExecutionDirective())
return;
// Try to insert this class into the map.
diff --git a/clang/test/OpenMP/declare_target_codegen.cpp b/clang/test/OpenMP/declare_target_codegen.cpp
index 2475c49d3de..87f534e8803 100644
--- a/clang/test/OpenMP/declare_target_codegen.cpp
+++ b/clang/test/OpenMP/declare_target_codegen.cpp
@@ -157,6 +157,16 @@ struct Bake {
template class Bake<int>;
#pragma omp end declare target
+struct BaseNonT {
+ virtual ~BaseNonT() {}
+};
+
+#pragma omp declare target
+struct BakeNonT {
+ virtual ~BakeNonT() {}
+};
+#pragma omp end declare target
+
// CHECK-DAG: declare extern_weak signext i32 @__create()
// CHECK-NOT: define {{.*}}{{baz1|baz4|maini1|Base}}
OpenPOWER on IntegriCloud