Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cpp/ql/src/Likely Bugs/InconsistentCheckReturnNull.ql
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ predicate nullCheckInCondition(Expr e, Variable v, Declaration qualifier) {
or exists(NotExpr exp | exp = e and nullCheckInCondition(exp.getAnOperand(), v, qualifier))
or exists(FunctionCall c | c = e and nullCheckInCondition(c.getAnArgument(), v, qualifier) and
c.getTarget().getName() = "__builtin_expect")
or exists(ConditionDeclExpr d | d = e and nullCheckInCondition(d.getExpr(), v, qualifier))
or exists(ConditionDeclExpr d | d = e and nullCheckInCondition(d.getVariableAccess(), v, qualifier))
}

predicate hasNullCheck(Function enclosing, Variable v, Declaration qualifier) {
Expand Down
6 changes: 5 additions & 1 deletion cpp/ql/src/semmle/code/cpp/Variable.qll
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,11 @@ deprecated class StackVariable extends Variable {

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