diff options
-rw-r--r-- | clang/lib/CodeGen/CGOpenMPRuntime.cpp | 3 | ||||
-rw-r--r-- | clang/test/OpenMP/declare_target_codegen.cpp | 6 |
2 files changed, 9 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp index 33dfe71dff0..0500f23b3d9 100644 --- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp +++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp @@ -898,6 +898,9 @@ static void EmitOMPAggregateInit(CodeGenFunction &CGF, Address DestAddr, static llvm::Optional<OMPDeclareTargetDeclAttr::MapTypeTy> isDeclareTargetDeclaration(const ValueDecl *VD) { + if (const auto *MD = dyn_cast<CXXMethodDecl>(VD)) + if (!MD->isStatic()) + return llvm::None; for (const Decl *D : VD->redecls()) { if (!D->hasAttrs()) continue; diff --git a/clang/test/OpenMP/declare_target_codegen.cpp b/clang/test/OpenMP/declare_target_codegen.cpp index 86c0c02bb21..a5a51bc26f0 100644 --- a/clang/test/OpenMP/declare_target_codegen.cpp +++ b/clang/test/OpenMP/declare_target_codegen.cpp @@ -32,6 +32,11 @@ int baz2(); int baz4() { return 5; } #pragma omp declare target +struct S { + int a; + S(int a) : a(a) {} +}; + int foo() { return 0; } int b = 15; int d; @@ -47,6 +52,7 @@ int maini1() { #pragma omp target map(tofrom \ : a, b) { + S s(a); static long aaa = 23; a = foo() + bar() + b + c + d + aa + aaa; } |