Skip to content

Commit b051766

Browse files
committed
Address query formatting
1 parent cc1c913 commit b051766

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

cpp/common/src/codingstandards/cpp/TypeUses.qll

+17-10
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ private Locatable getATypeUse_i(Type type, string reason) {
8282
// Ignore self referential variables and parameters
8383
not v.getDeclaringType().refersTo(type) and
8484
not type = v.(Parameter).getFunction().getDeclaringType()
85-
) and reason = "used as a variable type"
85+
) and
86+
reason = "used as a variable type"
8687
or
8788
// Used a function return type
8889
exists(Function f |
@@ -93,7 +94,8 @@ private Locatable getATypeUse_i(Type type, string reason) {
9394
type = f.getType() and reason = "used as a function return type"
9495
or
9596
type = f.getATemplateArgument() and reason = "used as a function template argument"
96-
) or
97+
)
98+
or
9799
// Used either in a function call as a template argument, or as the declaring type
98100
// of the function
99101
exists(FunctionCall fc | result = fc |
@@ -115,10 +117,12 @@ private Locatable getATypeUse_i(Type type, string reason) {
115117
reason = "used in a sizeof expr"
116118
or
117119
// A use in a `Cast`
118-
exists(Cast c | c = result | type = c.getType()) and reason = "used in a cast"
120+
exists(Cast c | c = result | type = c.getType()) and
121+
reason = "used in a cast"
119122
or
120123
// Use of the type name in source
121-
exists(TypeName t | t = result | type = t.getType()) and reason = "used in a typename"
124+
exists(TypeName t | t = result | type = t.getType()) and
125+
reason = "used in a typename"
122126
or
123127
// Access of an enum constant
124128
exists(EnumConstantAccess eca | result = eca | type = eca.getTarget().getDeclaringEnum()) and
@@ -128,15 +132,17 @@ private Locatable getATypeUse_i(Type type, string reason) {
128132
exists(FieldAccess fa |
129133
result = fa and
130134
type = fa.getTarget().getDeclaringType()
131-
) and reason = "used in a field access"
135+
) and
136+
reason = "used in a field access"
132137
or
133138
// Name qualifiers
134139
exists(NameQualifier nq |
135140
result = nq and
136141
type = nq.getQualifyingElement()
137-
) and reason = "used in name qualifier"
138-
// Temporary object creation of type `type`
142+
) and
143+
reason = "used in name qualifier"
139144
or
145+
// Temporary object creation of type `type`
140146
exists(TemporaryObjectExpr toe | result = toe | type = toe.getType()) and
141147
reason = "used in temporary object expr"
142148
)
@@ -160,8 +166,8 @@ private Locatable getATypeUse_i(Type type, string reason) {
160166
reason = "used in template class instantiation"
161167
or
162168
// This is a TemplateClass where one of the specializations is used
163-
type = used.(ClassTemplateSpecialization).getPrimaryTemplate()
164-
and reason = "used in template class specialization"
169+
type = used.(ClassTemplateSpecialization).getPrimaryTemplate() and
170+
reason = "used in template class specialization"
165171
or
166172
// Alias templates - alias templates and instantiations are not properly captured by the
167173
// extractor (last verified in CodeQL CLI 2.7.6). The only distinguishing factor is that
@@ -176,6 +182,7 @@ private Locatable getATypeUse_i(Type type, string reason) {
176182
not exists(instantiation.getLocation()) and
177183
// Template and instantiation both have the same qualified name
178184
template.getQualifiedName() = instantiation.getQualifiedName()
179-
) and reason = "used in alias template instantiation"
185+
) and
186+
reason = "used in alias template instantiation"
180187
)
181188
}

0 commit comments

Comments
 (0)