diff --git a/change_notes/2022-07-21-performance-fix-to-deadlock-query.md b/change_notes/2022-07-21-performance-fix-to-deadlock-query.md new file mode 100644 index 0000000000..338f081e9f --- /dev/null +++ b/change_notes/2022-07-21-performance-fix-to-deadlock-query.md @@ -0,0 +1,4 @@ +- `CON53-CPP` - `DeadlockByLockingInPredefinedOrder.ql` + - Optimized performance by removing unneeded conditionals. +- `CON35-C` - `DeadlockByLockingInPredefinedOrder.ql` + - Optimized performance by removing unneeded conditionals. diff --git a/cpp/common/src/codingstandards/cpp/rules/preventdeadlockbylockinginpredefinedorder/PreventDeadlockByLockingInPredefinedOrder.qll b/cpp/common/src/codingstandards/cpp/rules/preventdeadlockbylockinginpredefinedorder/PreventDeadlockByLockingInPredefinedOrder.qll index ca54e3c2d8..3767f023a0 100644 --- a/cpp/common/src/codingstandards/cpp/rules/preventdeadlockbylockinginpredefinedorder/PreventDeadlockByLockingInPredefinedOrder.qll +++ b/cpp/common/src/codingstandards/cpp/rules/preventdeadlockbylockinginpredefinedorder/PreventDeadlockByLockingInPredefinedOrder.qll @@ -25,7 +25,6 @@ predicate getAnOrderedLockPair( lock2 = node.coveredByLock() and not lock1 = lock2 and lock1.getEnclosingFunction() = lock2.getEnclosingFunction() and - node.(Expr).getEnclosingFunction() = lock1.getEnclosingFunction() and exists(Location l1Loc, Location l2Loc | l1Loc = lock1.getLocation() and l2Loc = lock2.getLocation()