@@ -33,22 +33,20 @@ class AtomicAccessInFullExpressionOrdering extends Ordering::Configuration {
33
33
34
34
/**
35
35
* A read of a variable specified as `_Atomic`.
36
- *
36
+ *
37
37
* Note, it may be accessed directly, or by passing its address into the std atomic functions.
38
38
*/
39
39
class AtomicVariableAccess extends VariableAccess {
40
40
pragma [ noinline]
41
- AtomicVariableAccess ( ) {
42
- getTarget ( ) .getType ( ) .hasSpecifier ( "atomic" )
43
- }
41
+ AtomicVariableAccess ( ) { getTarget ( ) .getType ( ) .hasSpecifier ( "atomic" ) }
44
42
45
43
/* Get the `atomic_<read|write>()` call this VarAccess occurs in. */
46
44
FunctionCall getAtomicFunctionCall ( ) {
47
45
exists ( AddressOfExpr addrParent , FunctionCall fc |
48
46
fc .getTarget ( ) .getName ( ) .matches ( "__c11_atomic%" ) and
49
47
addrParent = fc .getArgument ( 0 ) and
50
- addrParent .getAnOperand ( ) = this
51
- and result = fc
48
+ addrParent .getAnOperand ( ) = this and
49
+ result = fc
52
50
)
53
51
}
54
52
@@ -59,8 +57,8 @@ class AtomicVariableAccess extends VariableAccess {
59
57
result = getAtomicFunctionCall ( ) .getArgument ( 1 )
60
58
or
61
59
exists ( AssignExpr assign |
62
- assign .getLValue ( ) = this
63
- and result = assign .getRValue ( )
60
+ assign .getLValue ( ) = this and
61
+ result = assign .getRValue ( )
64
62
)
65
63
}
66
64
@@ -75,8 +73,8 @@ class AtomicVariableAccess extends VariableAccess {
75
73
}
76
74
77
75
from
78
- AtomicAccessInFullExpressionOrdering config , FullExpr e , Variable v ,
79
- AtomicVariableAccess va1 , AtomicVariableAccess va2
76
+ AtomicAccessInFullExpressionOrdering config , FullExpr e , Variable v , AtomicVariableAccess va1 ,
77
+ AtomicVariableAccess va2
80
78
where
81
79
not isExcluded ( e , SideEffects3Package:: unsequencedAtomicReadsQuery ( ) ) and
82
80
e = va1 .( ConstituentExpr ) .getFullExpr ( ) and
89
87
TaintTracking:: localTaint ( DataFlow:: exprNode ( va2 .getARead ( ) ) , DataFlow:: exprNode ( write ) )
90
88
) and
91
89
// Impose an ordering, show the first access.
92
- va1 .getLocation ( ) .isBefore ( va2 .getLocation ( ) , _)
93
- select e , "Atomic variable $@ has a $@ that is unsequenced with $@." ,
94
- v , v . getName ( ) , va1 , "previous read" , va2 , "another read"
90
+ va1 .getLocation ( ) .isBefore ( va2 .getLocation ( ) , _)
91
+ select e , "Atomic variable $@ has a $@ that is unsequenced with $@." , v , v . getName ( ) , va1 ,
92
+ "previous read" , va2 , "another read"
0 commit comments