Skip to content

Commit

Permalink
[OPENMP]Fix PR42632: crash on the analysis of the OpenMP constructs.
Browse files Browse the repository at this point in the history
Fixed processing of the CapturedStmt children to fix the crash of the
OpenMP constructs during analysis.

llvm-svn: 366357
  • Loading branch information
alexey-bataev committed Jul 17, 2019
1 parent f90d3df commit 48f5a43
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
12 changes: 12 additions & 0 deletions clang/lib/AST/ParentMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,18 @@ static void BuildParentMap(MapTy& M, Stmt* S,
}
break;
}
case Stmt::CapturedStmtClass:
for (Stmt *SubStmt : S->children()) {
if (SubStmt) {
M[SubStmt] = S;
BuildParentMap(M, SubStmt, OVMode);
}
}
if (Stmt *SubStmt = cast<CapturedStmt>(S)->getCapturedStmt()) {
M[SubStmt] = S;
BuildParentMap(M, SubStmt, OVMode);
}
break;
default:
for (Stmt *SubStmt : S->children()) {
if (SubStmt) {
Expand Down
4 changes: 4 additions & 0 deletions clang/test/Analysis/openmp-unsupported.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@
void openmp_parallel_crash_test() {
#pragma omp parallel
;
#pragma omp parallel for
for (int i = 0; i < 8; ++i)
for (int j = 0, k = 0; j < 8; ++j)
;
}

0 comments on commit 48f5a43

Please sign in to comment.