diff options
| author | Alexey Bataev <a.bataev@hotmail.com> | 2018-07-09 19:58:08 +0000 |
|---|---|---|
| committer | Alexey Bataev <a.bataev@hotmail.com> | 2018-07-09 19:58:08 +0000 |
| commit | c1943e75c729602ebf9f4a961dc7959e349fa582 (patch) | |
| tree | f475a4a56acbcee63e5ef4a2d676cdd0b8ad5081 /clang/lib | |
| parent | c4cf96e3c913e02be7eb7240d16c3276e29d95bc (diff) | |
| download | bcm5719-llvm-c1943e75c729602ebf9f4a961dc7959e349fa582.tar.gz bcm5719-llvm-c1943e75c729602ebf9f4a961dc7959e349fa582.zip | |
[OPENMP] Do not mark local variables as declare target.
When the parsing of the functions happens inside of the declare target
region, we may erroneously mark local variables as declare target
thought they are not. This attribute can be applied only to global
variables.
llvm-svn: 336592
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/Sema/SemaOpenMP.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp index 6fb0125e6eb..f5a1d0b222e 100644 --- a/clang/lib/Sema/SemaOpenMP.cpp +++ b/clang/lib/Sema/SemaOpenMP.cpp @@ -13012,8 +13012,12 @@ void Sema::checkDeclIsAllowedInOpenMPTarget(Expr *E, Decl *D, return; SourceRange SR = E ? E->getSourceRange() : D->getSourceRange(); SourceLocation SL = E ? E->getLocStart() : D->getLocation(); - // 2.10.6: threadprivate variable cannot appear in a declare target directive. if (auto *VD = dyn_cast<VarDecl>(D)) { + // Only global variables can be marked as declare target. + if (VD->isLocalVarDeclOrParm()) + return; + // 2.10.6: threadprivate variable cannot appear in a declare target + // directive. if (DSAStack->isThreadPrivate(VD)) { Diag(SL, diag::err_omp_threadprivate_in_target); reportOriginalDsa(*this, DSAStack, VD, DSAStack->getTopDSA(VD, false)); |

