@@ -129,7 +129,20 @@ class CheckerDocumentation
129
129
// / check::PostCall
130
130
void checkPostCall (const CallEvent &Call, CheckerContext &C) const {}
131
131
132
- // / Pre-visit of the condition statement of a branch (such as IfStmt).
132
+ // / Pre-visit of the condition statement of a branch.
133
+ // / For example:
134
+ // / - logical operators (&&, ||)
135
+ // / - if, do, while, for, ranged-for statements
136
+ // / - ternary operators (?:), gnu conditionals, gnu choose expressions
137
+ // / Interestingly, switch statements don't seem to trigger BranchCondition.
138
+ // /
139
+ // / check::BlockEntrance is a similar callback, which is strictly more
140
+ // / generic. Prefer check::BranchCondition to check::BlockEntrance if
141
+ // / pre-visiting conditional statements is enough for the checker.
142
+ // / Note that check::BlockEntrance is also invoked for leaving basic blocks
143
+ // / while entering the next.
144
+ // /
145
+ // / check::BranchCondition
133
146
void checkBranchCondition (const Stmt *Condition, CheckerContext &Ctx) const {}
134
147
135
148
// / Post-visit the C++ operator new's allocation call.
@@ -174,6 +187,10 @@ class CheckerDocumentation
174
187
// / and the callee. One will only see the edge between the entry block and
175
188
// / the body of the function once inlined.
176
189
// /
190
+ // / check::BranchCondition is a similar callback, which is only invoked for
191
+ // / pre-visiting the condition statement of a branch. Prefer that callback if
192
+ // / possible.
193
+ // /
177
194
// / \param E The ProgramPoint that describes the transition.
178
195
// /
179
196
// / check::BlockEntrance
0 commit comments