Przeglądaj źródła

[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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@366357 91177308-0d34-0410-b5e6-96231b3b80d8
Alexey Bataev 6 lat temu
rodzic
commit
2688e5894f
2 zmienionych plików z 16 dodań i 0 usunięć
  1. 12 0
      lib/AST/ParentMap.cpp
  2. 4 0
      test/Analysis/openmp-unsupported.c

+ 12 - 0
lib/AST/ParentMap.cpp

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

+ 4 - 0
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)
+      ;
 }