[OPENMP]Fix PR42632: crash on the analysis of the OpenMP constructs.

Fixed processing of the CapturedStmt children to fix the crash of the
OpenMP constructs during analysis.

llvm-svn: 366357
This commit is contained in:
Alexey Bataev 2019-07-17 18:03:39 +00:00
parent f90d3dff6e
commit 48f5a43bcc
2 changed files with 16 additions and 0 deletions

View File

@ -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) {

View File

@ -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)
;
}