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/Sema/SemaOpenMP.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/Sema/SemaOpenMP.cpp')
-rw-r--r-- | clang/lib/Sema/SemaOpenMP.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp index d27f92660d7..7fdd08d5e57 100644 --- a/clang/lib/Sema/SemaOpenMP.cpp +++ b/clang/lib/Sema/SemaOpenMP.cpp @@ -1382,13 +1382,17 @@ VarDecl *Sema::IsOpenMPCapturedDecl(ValueDecl *D) { // If we are attempting to capture a global variable in a directive with // 'target' we return true so that this global is also mapped to the device. // - // FIXME: If the declaration is enclosed in a 'declare target' directive, - // then it should not be captured. Therefore, an extra check has to be - // inserted here once support for 'declare target' is added. - // auto *VD = dyn_cast<VarDecl>(D); - if (VD && !VD->hasLocalStorage() && isInOpenMPTargetExecutionDirective()) + if (VD && !VD->hasLocalStorage() && isInOpenMPTargetExecutionDirective()) { + // If the declaration is enclosed in a 'declare target' directive, + // then it should not be captured. + // + for (const auto *Var = VD->getMostRecentDecl(); Var; + Var = Var->getPreviousDecl()) + if (Var->hasAttr<OMPDeclareTargetDeclAttr>()) + return nullptr; return VD; + } if (DSAStack->getCurrentDirective() != OMPD_unknown && (!DSAStack->isClauseParsingMode() || |