Skip to content

Commit b3bcabf

Browse files
authored
Merge pull request #724 from jbj/cfg-pr
C++: Construct a CFG with QL
2 parents bd9a2d7 + 1be91b5 commit b3bcabf

File tree

103 files changed

+22748
-7
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+22748
-7
lines changed

cpp/ql/src/Likely Bugs/InconsistentCheckReturnNull.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ predicate nullCheckInCondition(Expr e, Variable v, Declaration qualifier) {
6060
or exists(NotExpr exp | exp = e and nullCheckInCondition(exp.getAnOperand(), v, qualifier))
6161
or exists(FunctionCall c | c = e and nullCheckInCondition(c.getAnArgument(), v, qualifier) and
6262
c.getTarget().getName() = "__builtin_expect")
63-
or exists(ConditionDeclExpr d | d = e and nullCheckInCondition(d.getExpr(), v, qualifier))
63+
or exists(ConditionDeclExpr d | d = e and nullCheckInCondition(d.getVariableAccess(), v, qualifier))
6464
}
6565

6666
predicate hasNullCheck(Function enclosing, Variable v, Declaration qualifier) {

cpp/ql/src/semmle/code/cpp/Variable.qll

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,11 @@ deprecated class StackVariable extends Variable {
283283

284284
/**
285285
* A C/C++ local variable. In other words, any variable that has block
286-
* scope [N4140 3.3.3], but is not a function parameter.
286+
* scope [N4140 3.3.3], but is not a parameter of a `Function` or `CatchBlock`.
287+
* Local variables can be static; use the `isStatic` member predicate to detect
288+
* those.
289+
*
290+
* A local variable can be declared by a `DeclStmt` or a `ConditionDeclExpr`.
287291
*/
288292
class LocalVariable extends LocalScopeVariable, @localvariable {
289293
override string getName() { localvariables(underlyingElement(this),_,result) }

0 commit comments

Comments
 (0)