mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
C++: Move mayBeFromImplicitlyDeclaredFunction to Call
This commit is contained in:
@@ -149,6 +149,11 @@ class Call extends Expr, NameQualifiableElement, TCall {
|
||||
variableAddressEscapesTreeNonConst(va, this.getQualifier().getFullyConverted()) and
|
||||
i = -1
|
||||
}
|
||||
|
||||
/** Holds if this expression could be the return value of an implicitly declared function. */
|
||||
predicate mayBeFromImplicitlyDeclaredFunction() {
|
||||
this.getTarget().getADeclarationEntry().isImplicit()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -300,10 +305,6 @@ class FunctionCall extends Call, @funbindexpr {
|
||||
this.isVirtual() or
|
||||
this.getTarget().getAnAttribute().getName() = "weak"
|
||||
}
|
||||
|
||||
override predicate mayBeFromImplicitlyDeclaredFunction() {
|
||||
this.getTarget().getADeclarationEntry().isImplicit()
|
||||
}
|
||||
}
|
||||
|
||||
/** A _user-defined_ unary `operator*` function. */
|
||||
|
||||
@@ -534,9 +534,6 @@ class Expr extends StmtParent, @expr {
|
||||
|
||||
/** Gets the function containing this control-flow node. */
|
||||
override Function getControlFlowScope() { result = this.getEnclosingFunction() }
|
||||
|
||||
/** Holds if this expression could be the return value of an implicitly declared function. */
|
||||
predicate mayBeFromImplicitlyDeclaredFunction() { none() }
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -171,7 +171,7 @@ where
|
||||
not arg.isAffectedByMacro() and
|
||||
not arg.isFromUninstantiatedTemplate(_) and
|
||||
not actual.getUnspecifiedType() instanceof ErroneousType and
|
||||
not arg.mayBeFromImplicitlyDeclaredFunction()
|
||||
not arg.(Call).mayBeFromImplicitlyDeclaredFunction()
|
||||
select arg,
|
||||
"This format specifier for type '" + expected.getName() + "' does not match the argument type '" +
|
||||
actual.getUnspecifiedType().getName() + "'."
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import cpp
|
||||
|
||||
from Expr e
|
||||
where e.mayBeFromImplicitlyDeclaredFunction()
|
||||
select e
|
||||
from Call c
|
||||
where c.mayBeFromImplicitlyDeclaredFunction()
|
||||
select c
|
||||
|
||||
Reference in New Issue
Block a user