]> granicus.if.org Git - clang/commitdiff
[OPENMP]Fix PR42632: crash on the analysis of the OpenMP constructs.
authorAlexey Bataev <a.bataev@hotmail.com>
Wed, 17 Jul 2019 18:03:39 +0000 (18:03 +0000)
committerAlexey Bataev <a.bataev@hotmail.com>
Wed, 17 Jul 2019 18:03:39 +0000 (18:03 +0000)
Fixed processing of the CapturedStmt children to fix the crash of the
OpenMP constructs during analysis.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@366357 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/ParentMap.cpp
test/Analysis/openmp-unsupported.c

index e09b5bbe75f328430f372d2febc6e0f75d781b7c..2ff5c9d8aeb5781121f04f7ce7a6aff39780793e 100644 (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) {
index 7e363eecbaa084500f7a9031a4e60bfe22b0c55b..b2e1a1b0217978deff0f4bfe45aba39068b88073 100644 (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)
+      ;
 }