mirror of
https://github.com/github/codeql.git
synced 2025-12-22 19:56:32 +01:00
CPP: Replace getAllocatorCall with getDeallocator call.
This commit is contained in:
@@ -826,7 +826,7 @@ private predicate namedExprChildPredicates(Expr expr, Element ele, string pred)
|
||||
or
|
||||
expr.(Conversion).getExpr() = ele and pred = "getExpr()"
|
||||
or
|
||||
expr.(DeleteOrDeleteArrayExpr).getAllocatorCall() = ele and pred = "getAllocatorCall()"
|
||||
expr.(DeleteOrDeleteArrayExpr).getDeallocatorCall() = ele and pred = "getDeallocatorCall()"
|
||||
or
|
||||
expr.(DeleteOrDeleteArrayExpr).getDestructorCall() = ele and pred = "getDestructorCall()"
|
||||
or
|
||||
|
||||
@@ -337,7 +337,7 @@ private Node getControlOrderChildSparse(Node n, int i) {
|
||||
or
|
||||
i = 1 and result = del.getDestructorCall()
|
||||
or
|
||||
i = 2 and result = del.getAllocatorCall()
|
||||
i = 2 and result = del.getDeallocatorCall()
|
||||
)
|
||||
or
|
||||
n =
|
||||
@@ -346,7 +346,7 @@ private Node getControlOrderChildSparse(Node n, int i) {
|
||||
or
|
||||
i = 1 and result = del.getDestructorCall()
|
||||
or
|
||||
i = 2 and result = del.getAllocatorCall()
|
||||
i = 2 and result = del.getDeallocatorCall()
|
||||
)
|
||||
or
|
||||
n =
|
||||
|
||||
@@ -963,13 +963,18 @@ class DeleteOrDeleteArrayExpr extends Expr, TDeleteOrDeleteArrayExpr {
|
||||
expr_deallocator(underlyingElement(this), unresolveElement(result), _)
|
||||
}
|
||||
|
||||
/**
|
||||
* DEPRECATED: use `getDeallocatorCall` instead.
|
||||
*/
|
||||
deprecated FunctionCall getAllocatorCall() { result = this.getChild(0) }
|
||||
|
||||
/**
|
||||
* Gets the call to a non-default `operator delete` that deallocates storage, if any.
|
||||
*
|
||||
* This will only be present when the type being deleted has a custom `operator delete` and
|
||||
* is not a class with a virtual destructor.
|
||||
*/
|
||||
FunctionCall getAllocatorCall() { result = this.getChild(0) }
|
||||
FunctionCall getDeallocatorCall() { result = this.getChild(0) }
|
||||
|
||||
/**
|
||||
* Holds if the deallocation function expects a size argument.
|
||||
|
||||
@@ -84,9 +84,9 @@ private predicate ignoreExprAndDescendants(Expr expr) {
|
||||
or
|
||||
// We do not yet translate destructors properly, so for now we ignore any
|
||||
// custom deallocator call, if present.
|
||||
exists(DeleteExpr deleteExpr | deleteExpr.getAllocatorCall() = expr)
|
||||
exists(DeleteExpr deleteExpr | deleteExpr.getDeallocatorCall() = expr)
|
||||
or
|
||||
exists(DeleteArrayExpr deleteArrayExpr | deleteArrayExpr.getAllocatorCall() = expr)
|
||||
exists(DeleteArrayExpr deleteArrayExpr | deleteArrayExpr.getDeallocatorCall() = expr)
|
||||
or
|
||||
exists(BuiltInVarArgsStart vaStartExpr |
|
||||
vaStartExpr.getLastNamedParameter().getFullyConverted() = expr
|
||||
|
||||
@@ -8477,7 +8477,7 @@ ir.cpp:
|
||||
# 1018| getExpr(): [DeleteExpr] delete
|
||||
# 1018| Type = [VoidType] void
|
||||
# 1018| ValueCategory = prvalue
|
||||
# 1018| getAllocatorCall(): [FunctionCall] call to operator delete
|
||||
# 1018| getDeallocatorCall(): [FunctionCall] call to operator delete
|
||||
# 1018| Type = [VoidType] void
|
||||
# 1018| ValueCategory = prvalue
|
||||
# 1018| getExpr(): [Literal] 0
|
||||
@@ -8555,7 +8555,7 @@ ir.cpp:
|
||||
# 1027| getExpr(): [DeleteArrayExpr] delete[]
|
||||
# 1027| Type = [VoidType] void
|
||||
# 1027| ValueCategory = prvalue
|
||||
# 1027| getAllocatorCall(): [FunctionCall] call to operator delete[]
|
||||
# 1027| getDeallocatorCall(): [FunctionCall] call to operator delete[]
|
||||
# 1027| Type = [VoidType] void
|
||||
# 1027| ValueCategory = prvalue
|
||||
# 1027| getExpr(): [Literal] 0
|
||||
|
||||
Reference in New Issue
Block a user