ABataev added inline comments.
================ Comment at: clang/lib/CodeGen/CGOpenMPRuntime.cpp:1483 + // OpenMPIRBuilder is asked to construct a parallel (or similar) construct. + auto FiniCB = [&](llvm::OpenMPIRBuilder::InsertPointTy IP) { + assert(IP.getBlock()->end() == IP.getPoint() && ---------------- Better to not capture all the object implicitly by reference, provide explicit list ================ Comment at: clang/lib/CodeGen/CGOpenMPRuntime.cpp:1486 + "Clang CG should cause non-terminated block!"); + auto OldIP = CGF.Builder.saveIP(); + CGF.Builder.restoreIP(IP); ---------------- Use `InsertPointGuard` where possible rather than use `saveIP/restoreIP` explicitly ================ Comment at: clang/lib/CodeGen/CGOpenMPRuntime.cpp:1490 + CGF.getOMPCancelDestination(OMPD_parallel); + assert(Dest.getBlock()); + CGF.EmitBranchThroughCleanup(Dest); ---------------- Add a message for the assert. ================ Comment at: clang/lib/CodeGen/CGOpenMPRuntime.cpp:1499-1509 + OMPBuilder->pushFinalizationCB(std::move(FI)); + } + CGOpenMPOutlinedRegionInfo CGInfo(*CS, ThreadIDVar, CodeGen, InnermostKind, HasCancel, OutlinedHelperName); CodeGenFunction::CGCapturedStmtRAII CapInfoRAII(CGF, &CGInfo); + llvm::Function *Fn = CGF.GenerateOpenMPCapturedStmtFunction(*CS); ---------------- Again, need RAII ================ Comment at: llvm/include/llvm/Frontend/OpenMPIRBuilder.h:69-71 + void pushFinalizationCB(FinalizationInfo &&FI) { + FinalizationStack.emplace_back(std::move(FI)); + } ---------------- Maybe `push...` for const reference and `emplace...` for variadic template (just like in standard library)? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D70258/new/ https://reviews.llvm.org/D70258 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits