[clang] [clang][dataflow] Check for backedges directly (instead of loop statements). (PR #68923)
Yitzhak Mandelbaum via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 16 10:54:03 PDT 2023
================
@@ -53,19 +52,8 @@ static int blockIndexInPredecessor(const CFGBlock &Pred,
return BlockPos - Pred.succ_begin();
}
-static bool isLoopHead(const CFGBlock &B) {
- if (const auto *T = B.getTerminatorStmt())
- switch (T->getStmtClass()) {
- case Stmt::WhileStmtClass:
- case Stmt::DoStmtClass:
- case Stmt::ForStmtClass:
- case Stmt::CXXForRangeStmtClass:
- return true;
- default:
- return false;
- }
-
- return false;
+static bool isBackedgeNode(const CFGBlock &B) {
----------------
ymand wrote:
https://github.com/llvm/llvm-project/blob/eb14f47bf1ccfda500ba3c3092d70e269f6f0b56/clang/include/clang/Analysis/CFG.h#L805
Fwiw, I think this comment is better than the one in the CFG, so I don't know that linking is worth much, especially since it can be found pretty easily just by looking at `getLoopTarget`.
https://github.com/llvm/llvm-project/pull/68923
More information about the cfe-commits
mailing list