@@ -23,14 +23,33 @@ class AtomicVoidType extends Type {
2323 }
2424}
2525
26- Type getNestedType ( Type root ) {
27- result = root
26+ predicate usesAtomicVoid ( Type root ) {
27+ root instanceof AtomicVoidType
2828 or
29- exists ( DerivedType derived | derived = root | result = getNestedType ( derived .getBaseType ( ) ) )
29+ usesAtomicVoid ( root .( DerivedType ) .getBaseType ( ) )
30+ or
31+ usesAtomicVoid ( root .( RoutineType ) .getReturnType ( ) )
32+ or
33+ usesAtomicVoid ( root .( RoutineType ) .getAParameterType ( ) )
34+ or
35+ usesAtomicVoid ( root .( FunctionPointerType ) .getReturnType ( ) )
36+ or
37+ usesAtomicVoid ( root .( FunctionPointerType ) .getAParameterType ( ) )
38+ or
39+ usesAtomicVoid ( root .( TypedefType ) .getBaseType ( ) )
40+ }
41+
42+ class ExplicitType extends Type {
43+ Element getDeclaration ( string description ) {
44+ result .( DeclarationEntry ) .getType ( ) = this and description = result .( DeclarationEntry ) .getName ( )
45+ or
46+ result .( CStyleCast ) .getType ( ) = this and description = "Cast"
47+ }
3048}
3149
32- from DeclarationEntry decl , AtomicVoidType atomicVoid
50+ from Element decl , ExplicitType explicitType , string elementDescription
3351where
3452 not isExcluded ( decl , Declarations9Package:: atomicQualifierAppliedToVoidQuery ( ) ) and
35- atomicVoid = getNestedType ( decl .getType ( ) )
36- select decl , decl .getName ( ) + " declared with an atomic void type."
53+ decl = explicitType .getDeclaration ( elementDescription ) and
54+ usesAtomicVoid ( explicitType )
55+ select decl , elementDescription + " declared with an atomic void type."
0 commit comments