@@ -59,11 +59,11 @@ class LockType extends RefType {
5959}
6060
6161predicate lockBlock ( LockType t , BasicBlock b , int locks ) {
62- locks = strictcount ( int i | b .getNode ( i ) = t .getLockAccess ( ) )
62+ locks = strictcount ( int i | b .getNode ( i ) . asExpr ( ) = t .getLockAccess ( ) )
6363}
6464
6565predicate unlockBlock ( LockType t , BasicBlock b , int unlocks ) {
66- unlocks = strictcount ( int i | b .getNode ( i ) = t .getUnlockAccess ( ) )
66+ unlocks = strictcount ( int i | b .getNode ( i ) . asExpr ( ) = t .getUnlockAccess ( ) )
6767}
6868
6969/**
@@ -90,11 +90,11 @@ predicate failedLock(LockType t, BasicBlock lockblock, BasicBlock exblock) {
9090 exists ( ControlFlowNode lock |
9191 lock = lockblock .getLastNode ( ) and
9292 (
93- lock = t .getLockAccess ( )
93+ lock . asExpr ( ) = t .getLockAccess ( )
9494 or
9595 exists ( SsaExplicitUpdate lockbool |
9696 // Using the value of `t.getLockAccess()` ensures that it is a `tryLock` call.
97- lock = lockbool .getAUse ( ) and
97+ lock . asExpr ( ) = lockbool .getAUse ( ) and
9898 lockbool .getDefiningExpr ( ) .( VariableAssign ) .getSource ( ) = t .getLockAccess ( )
9999 )
100100 ) and
@@ -147,12 +147,12 @@ predicate blockIsLocked(LockType t, BasicBlock src, BasicBlock b, int locks) {
147147 )
148148}
149149
150- from Callable c , LockType t , BasicBlock src , BasicBlock exit , MethodCall lock
150+ from Callable c , LockType t , BasicBlock src , ExitBlock exit , MethodCall lock
151151where
152152 // Restrict results to those methods that actually attempt to unlock.
153153 t .getUnlockAccess ( ) .getEnclosingCallable ( ) = c and
154154 blockIsLocked ( t , src , exit , _) and
155- exit .getLastNode ( ) = c and
156- lock = src .getANode ( ) and
155+ exit .getEnclosingCallable ( ) = c and
156+ lock = src .getANode ( ) . asExpr ( ) and
157157 lock = t .getLockAccess ( )
158158select lock , "This lock might not be unlocked or might be locked more times than it is unlocked."
0 commit comments