diff options
author | Alexey Bataev <a.bataev@hotmail.com> | 2018-03-26 16:40:55 +0000 |
---|---|---|
committer | Alexey Bataev <a.bataev@hotmail.com> | 2018-03-26 16:40:55 +0000 |
commit | 92327c50d39586feeedd046eb73095dd9705cac6 (patch) | |
tree | 9b23b6db07b073ea408d41b1a0a872ed4f1ea884 /clang/lib/AST/ASTContext.cpp | |
parent | 3f72a6b7a1c616ae4f3c46b2c89a9da53fd24a51 (diff) | |
download | bcm5719-llvm-92327c50d39586feeedd046eb73095dd9705cac6.tar.gz bcm5719-llvm-92327c50d39586feeedd046eb73095dd9705cac6.zip |
[OPENMP] Codegen for declare target with link clause.
If the link clause is used on the declare target directive, the object
should be linked on target or target data directives, not during the
codegen. Patch adds support for this clause.
llvm-svn: 328544
Diffstat (limited to 'clang/lib/AST/ASTContext.cpp')
-rw-r--r-- | clang/lib/AST/ASTContext.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index 619af9af0af..1c3495af1fb 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -9494,10 +9494,13 @@ bool ASTContext::DeclMustBeEmitted(const Decl *D) { 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; + for (const auto *Decl : D->redecls()) { + if (!Decl->hasAttrs()) + continue; + if (const auto *Attr = Decl->getAttr<OMPDeclareTargetDeclAttr>()) + if (Attr->getMapType() != OMPDeclareTargetDeclAttr::MT_Link) + return true; + } return false; } |