@@ -23,8 +23,7 @@ abstract class MutexType extends Type {
2323 abstract predicate trylockAccess ( FunctionCall fc , Expr arg ) ;
2424
2525 /**
26- * Holds if `fc` is a call that unlocks mutex `arg`
27- * of this type.
26+ * Holds if `fc` is a call that unlocks mutex `arg` of this type.
2827 */
2928 abstract predicate unlockAccess ( FunctionCall fc , Expr arg ) ;
3029
@@ -38,53 +37,52 @@ abstract class MutexType extends Type {
3837 }
3938
4039 /**
41- * Holds if `fc` is a call that locks or tries to lock any
42- * mutex of this type.
40+ * Gets a call that locks or tries to lock any mutex of this type.
4341 */
4442 FunctionCall getLockAccess ( ) {
4543 result = getMustlockAccess ( ) or
4644 result = getTrylockAccess ( )
4745 }
4846
4947 /**
50- * Holds if `fc` is a call that always locks any mutex of this type.
48+ * Gets a call that always locks any mutex of this type.
5149 */
5250 FunctionCall getMustlockAccess ( ) { this .mustlockAccess ( result , _) }
5351
5452 /**
55- * Holds if `fc` is a call that tries to lock any mutex of this type,
53+ * Gets a call that tries to lock any mutex of this type,
5654 * by may return without success.
5755 */
5856 FunctionCall getTrylockAccess ( ) { this .trylockAccess ( result , _) }
5957
6058 /**
61- * Holds if `fc` is a call that unlocks any mutex of this type.
59+ * Gets a call that unlocks any mutex of this type.
6260 */
6361 FunctionCall getUnlockAccess ( ) { this .unlockAccess ( result , _) }
6462
6563 /**
66- * DEPRECATED: use mustlockAccess(fc, arg) instead
64+ * DEPRECATED: use mustlockAccess(fc, arg) instead.
6765 */
6866 deprecated Function getMustlockFunction ( ) { result = getMustlockAccess ( ) .getTarget ( ) }
6967
7068 /**
71- * DEPRECATED: use trylockAccess(fc, arg) instead
69+ * DEPRECATED: use trylockAccess(fc, arg) instead.
7270 */
7371 deprecated Function getTrylockFunction ( ) { result = getTrylockAccess ( ) .getTarget ( ) }
7472
7573 /**
76- * DEPRECATED: use lockAccess(fc, arg) instead
74+ * DEPRECATED: use lockAccess(fc, arg) instead.
7775 */
7876 deprecated Function getLockFunction ( ) { result = getLockAccess ( ) .getTarget ( ) }
7977
8078 /**
81- * DEPRECATED: use unlockAccess(fc, arg) instead
79+ * DEPRECATED: use unlockAccess(fc, arg) instead.
8280 */
8381 deprecated Function getUnlockFunction ( ) { result = getUnlockAccess ( ) .getTarget ( ) }
8482}
8583
8684/**
87- * A function that looks like a lock function.
85+ * Gets a function that looks like a lock function.
8886 */
8987private Function mustlockCandidate ( ) {
9088 exists ( string name | name = result .getName ( ) |
@@ -94,7 +92,7 @@ private Function mustlockCandidate() {
9492}
9593
9694/**
97- * A function that looks like a try-lock function.
95+ * Gets a function that looks like a try-lock function.
9896 */
9997private Function trylockCandidate ( ) {
10098 exists ( string name | name = result .getName ( ) |
@@ -104,7 +102,7 @@ private Function trylockCandidate() {
104102}
105103
106104/**
107- * A function that looks like an unlock function.
105+ * Gets a function that looks like an unlock function.
108106 */
109107private Function unlockCandidate ( ) {
110108 exists ( string name | name = result .getName ( ) |
@@ -171,7 +169,7 @@ class DefaultMutexType extends MutexType {
171169 }
172170}
173171
174- /** Get the mutex argument of a call to lock or unlock. */
172+ /** Holds if `arg` is the mutex argument of a call to lock or unlock. */
175173private predicate lockArg ( Expr arg , MutexType argType , FunctionCall call ) {
176174 argType = arg .getUnderlyingType ( ) .stripType ( ) and
177175 (
@@ -184,18 +182,31 @@ private predicate lockArg(Expr arg, MutexType argType, FunctionCall call) {
184182 // `MutexType.mustlockAccess`.
185183}
186184
185+ /**
186+ * Holds if `call` is a call that locks or tries to lock its argument `arg`.
187+ */
187188predicate lockCall ( Expr arg , FunctionCall call ) {
188189 exists ( MutexType t | lockArg ( arg , t , call ) and call = t .getLockAccess ( ) )
189190}
190191
192+ /**
193+ * Holds if `call` is a call that always locks its argument `arg`.
194+ */
191195predicate mustlockCall ( Expr arg , FunctionCall call ) {
192196 exists ( MutexType t | lockArg ( arg , t , call ) and call = t .getMustlockAccess ( ) )
193197}
194198
199+ /**
200+ * Holds if `call` is a call that tries to lock its argument `arg`, but may
201+ * return without success.
202+ */
195203predicate trylockCall ( Expr arg , FunctionCall call ) {
196204 exists ( MutexType t | lockArg ( arg , t , call ) and call = t .getTrylockAccess ( ) )
197205}
198206
207+ /**
208+ * Holds if `call` is a call that unlocks its argument `arg`.
209+ */
199210predicate unlockCall ( Expr arg , FunctionCall call ) {
200211 exists ( MutexType t | lockArg ( arg , t , call ) and call = t .getUnlockAccess ( ) )
201212}
0 commit comments