Author: abataev Date: Wed Jul 17 11:03:39 2019 New Revision: 366357 URL: http://llvm.org/viewvc/llvm-project?rev=366357&view=rev Log: [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. Modified: cfe/trunk/lib/AST/ParentMap.cpp cfe/trunk/test/Analysis/openmp-unsupported.c Modified: cfe/trunk/lib/AST/ParentMap.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ParentMap.cpp?rev=366357&r1=366356&r2=366357&view=diff ============================================================================== --- cfe/trunk/lib/AST/ParentMap.cpp (original) +++ cfe/trunk/lib/AST/ParentMap.cpp Wed Jul 17 11:03:39 2019 @@ -83,6 +83,18 @@ static void BuildParentMap(MapTy& M, Stm } 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) { Modified: cfe/trunk/test/Analysis/openmp-unsupported.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/openmp-unsupported.c?rev=366357&r1=366356&r2=366357&view=diff ============================================================================== --- cfe/trunk/test/Analysis/openmp-unsupported.c (original) +++ cfe/trunk/test/Analysis/openmp-unsupported.c Wed Jul 17 11:03:39 2019 @@ -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) + ; } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits