================
@@ -166,6 +179,23 @@ class CheckerDocumentation
   /// check::Bind
   void checkBind(SVal Loc, SVal Val, const Stmt *S, CheckerContext &) const {}
 
+  /// Called after a CFG edge is taken within a function.
+  ///
+  /// This callback can be used to obtain information about potential branching
+  /// points or any other constructs that involve traversing a CFG edge.
+  /// Note that when inlining a call, there is no CFG edge between the caller
+  /// and the callee. One will only see the edge between the entry block and
+  /// the body of the function once inlined.
----------------
balazs-benics-sonarsource wrote:

This doc should be as clear as possible. I take full blame here.
There are a couple of things when inlining a function. Each of those steps are 
represented by different ProgramPoints, and they are strictly following a 
specific sequence:
 1) PreVisit the `CallExpr`
 2) Create a `CallEnter` ProgramPoint
 3) Traverse the first CFG edge from the entry (artificial) node of the callee 
CFG to the first meaningful CFG block of the callee. This will be represented 
by a BlockEdge. (this is the first ProgramPoint btw from starting the analysis 
from top-level context)
 4) Create `BlockEntrance` ProgramPoint.
 5) From this patch onward, checkers may create more nodes below this 
`BlockEnrtance` node with different State or split the state as they see fit. 
In the past there was exactly 1 `BlockEntrance` following a `BlockEdge`.

To me, "inlining" means the first 4 of these steps, I'm only mentioning the 5th 
steps because that's related to this patch.

What I wanted to describe here is that one may expect a BlockEdge from the 
caller CFG basic block from where the CallExpr resides, but there won't be such 
BlockEdge. But you would have this other artificial egde instead from the 
imaginary entry block to the actual basic block in the callee.
To me, this was surprising so I wanted to share this.

https://github.com/llvm/llvm-project/pull/140924
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to