diff options
author | Arpith Chacko Jacob <acjacob@us.ibm.com> | 2017-01-23 15:38:49 +0000 |
---|---|---|
committer | Arpith Chacko Jacob <acjacob@us.ibm.com> | 2017-01-23 15:38:49 +0000 |
commit | 1f46b70b5dec51858074248da4af3fbc38198a13 (patch) | |
tree | 0c38eb03ce1ae32c2d05bdb9a2f78aea7a00360b /clang/lib/Sema/SemaOpenMP.cpp | |
parent | f6f3a361590fe2a0c2269583804daab614cb83e0 (diff) | |
download | bcm5719-llvm-1f46b70b5dec51858074248da4af3fbc38198a13.tar.gz bcm5719-llvm-1f46b70b5dec51858074248da4af3fbc38198a13.zip |
[OpenMP] DSAChecker bug fix for combined directives.
The DSAChecker code in SemaOpenMP looks at the captured statement
associated with an OpenMP directive. A combined directive such as
'target parallel' has nested capture statements, which have to be
fully traversed before executing the DSAChecker. This is a patch
to perform the traversal for such combined directives.
Reviewers: ABataev
Differential Revision: https://reviews.llvm.org/D29026
llvm-svn: 292794
Diffstat (limited to 'clang/lib/Sema/SemaOpenMP.cpp')
-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 a4622e1dfb3..c902118f652 100644 --- a/clang/lib/Sema/SemaOpenMP.cpp +++ b/clang/lib/Sema/SemaOpenMP.cpp @@ -2268,7 +2268,11 @@ StmtResult Sema::ActOnOpenMPExecutableDirective( // Check default data sharing attributes for referenced variables. DSAAttrChecker DSAChecker(DSAStack, *this, cast<CapturedStmt>(AStmt)); - DSAChecker.Visit(cast<CapturedStmt>(AStmt)->getCapturedStmt()); + int ThisCaptureLevel = getOpenMPCaptureLevels(Kind); + Stmt *S = AStmt; + while (--ThisCaptureLevel >= 0) + S = cast<CapturedStmt>(S)->getCapturedStmt(); + DSAChecker.Visit(S); if (DSAChecker.isErrorFound()) return StmtError(); // Generate list of implicitly defined firstprivate variables. |