[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
diff --git a/clang/lib/AST/ParentMap.cpp b/clang/lib/AST/ParentMap.cpp
index e09b5bb..2ff5c9d 100644
--- a/clang/lib/AST/ParentMap.cpp
+++ b/clang/lib/AST/ParentMap.cpp
@@ -83,6 +83,18 @@
}
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) {
diff --git a/clang/test/Analysis/openmp-unsupported.c b/clang/test/Analysis/openmp-unsupported.c
index 7e363ee..b2e1a1b 100644
--- a/clang/test/Analysis/openmp-unsupported.c
+++ b/clang/test/Analysis/openmp-unsupported.c
@@ -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)
+ ;
}