[PATCH] D119447: [clang][dataflow] Include terminator statements in buildStmtToBasicBlockMap

Stanislav Gatev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 10 08:38:54 PST 2022

sgatev created this revision.
sgatev added reviewers: ymandel, xazax.hun, gribozavr2.
Herald added subscribers: tschuett, steakhal, rnkovacs.
sgatev requested review of this revision.
Herald added a project: clang.

This will be necessary later when we add support for evaluating logic
expressions such as && and ||.

This is part of the implementation of the dataflow analysis framework.
See "[RFC] A dataflow analysis framework for Clang AST" on cfe-dev.

  rG LLVM Github Monorepo



Index: clang/lib/Analysis/FlowSensitive/ControlFlowContext.cpp
--- clang/lib/Analysis/FlowSensitive/ControlFlowContext.cpp
+++ clang/lib/Analysis/FlowSensitive/ControlFlowContext.cpp
@@ -38,6 +38,8 @@
       StmtToBlock[Stmt.getValue().getStmt()] = Block;
+    if (const Stmt *TerminatorStmt = Block->getTerminatorStmt())
+      StmtToBlock[TerminatorStmt] = Block;
   return StmtToBlock;

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119447.407551.patch
Type: text/x-patch
Size: 474 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220210/d5a20989/attachment.bin>

More information about the cfe-commits mailing list