C++: Simplify NewDelete.qll.

This commit is contained in:
Geoffrey White
2020-04-06 14:44:38 +01:00
parent 050e239507
commit 492c5f367f

View File

@@ -13,14 +13,9 @@ import semmle.code.cpp.models.implementations.Deallocation
* a string describing the type of the allocation.
*/
predicate allocExpr(Expr alloc, string kind) {
(
alloc.(FunctionCall) instanceof AllocationExpr
or
alloc = any(NewOrNewArrayExpr new | not exists(new.getPlacementPointer()))
) and
(
exists(Function target |
alloc.(FunctionCall).getTarget() = target and
alloc.(AllocationExpr).(FunctionCall).getTarget() = target and
(
target.getName() = "operator new" and
kind = "new"