diff options
author | Alexey Bataev <a.bataev@hotmail.com> | 2018-03-15 15:47:20 +0000 |
---|---|---|
committer | Alexey Bataev <a.bataev@hotmail.com> | 2018-03-15 15:47:20 +0000 |
commit | 4f4bf7c3482598c02bea7fbe9bbcca56ac720313 (patch) | |
tree | 9d22d71fca84678cbb814b489d172fb2d714b35d /clang/lib/AST/ASTContext.cpp | |
parent | 1110c4d33675f4351c080e621dbf8ee298ef13ae (diff) | |
download | bcm5719-llvm-4f4bf7c3482598c02bea7fbe9bbcca56ac720313.tar.gz bcm5719-llvm-4f4bf7c3482598c02bea7fbe9bbcca56ac720313.zip |
[OPENMP] Codegen for `omp declare target` construct.
Added initial codegen for device side of declarations inside `omp
declare target` construct + codegen for implicit `declare target`
functions, which are used in the target regions.
llvm-svn: 327636
Diffstat (limited to 'clang/lib/AST/ASTContext.cpp')
-rw-r--r-- | clang/lib/AST/ASTContext.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index 5039be3231b..49ac8c1423f 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -9402,8 +9402,7 @@ bool ASTContext::DeclMustBeEmitted(const Decl *D) { return false; } else if (isa<PragmaCommentDecl>(D)) return true; - else if (isa<OMPThreadPrivateDecl>(D) || - D->hasAttr<OMPDeclareTargetDeclAttr>()) + else if (isa<OMPThreadPrivateDecl>(D)) return true; else if (isa<PragmaDetectMismatchDecl>(D)) return true; @@ -9492,6 +9491,12 @@ bool ASTContext::DeclMustBeEmitted(const Decl *D) { if (DeclMustBeEmitted(BindingVD)) return true; + // If the decl is marked as `declare target`, it should be emitted. + for (const auto *Decl = D->getMostRecentDecl(); Decl; + Decl = Decl->getPreviousDecl()) + if (Decl->hasAttr<OMPDeclareTargetDeclAttr>()) + return true; + return false; } |