Skip to content

Commit c2aee37

Browse files
committed
getSyntacticQualifier -> getSyntacticQualifierBaseType
This improves performance.
1 parent ede3b9f commit c2aee37

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

go/ql/lib/semmle/go/dataflow/internal/FlowSummaryImpl.qll

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ module SourceSinkInterpretationInput implements
292292
|
293293
sse.hasTypeInfo(pkg, typename, subtypes) and
294294
targetType.hasQualifiedName(pkg, typename) and
295-
syntacticQualBaseType = lookThroughPointerType(getSyntacticQualifier(qual).getType())
295+
syntacticQualBaseType = getSyntacticQualifierBaseType(qual)
296296
|
297297
subtypes = [true, false] and
298298
syntacticQualBaseType = targetType
@@ -336,21 +336,22 @@ module SourceSinkInterpretationInput implements
336336
}
337337

338338
/**
339-
* Gets `underlying`, where `n` if of the form `implicitDeref?(underlying.implicitFieldRead1.implicitFieldRead2...)`
339+
* Gets the base type of `underlying`, where `n` is of the form
340+
* `implicitDeref?(underlying.implicitFieldRead1.implicitFieldRead2...)`
340341
*
341342
* For Go syntax like `qualifier.method()` or `qualifier.field`, this is the type of `qualifier`, before any
342343
* implicit dereference is interposed because `qualifier` is of pointer type, or implicit field accesses
343344
* navigate to any embedded struct types that truly host `field`.
344345
*/
345-
private DataFlow::Node getSyntacticQualifier(DataFlow::Node n) {
346+
private Type getSyntacticQualifierBaseType(DataFlow::Node n) {
346347
exists(DataFlow::Node n2 |
347348
// look through implicit dereference, if there is one
348349
not exists(n.asInstruction().(IR::EvalImplicitDerefInstruction).getOperand()) and
349350
n2 = n
350351
or
351352
n2.asExpr() = n.asInstruction().(IR::EvalImplicitDerefInstruction).getOperand()
352353
|
353-
result = skipImplicitFieldReads(n2)
354+
result = lookThroughPointerType(skipImplicitFieldReads(n2).getType())
354355
)
355356
}
356357

0 commit comments

Comments
 (0)