mirror of
https://github.com/github/codeql.git
synced 2026-04-14 11:34:00 +02:00
Merge pull request #18588 from jketema/decl-entry
C++: Fix join-order problem in `UserType::getADeclarationEntry`
This commit is contained in:
@@ -47,10 +47,16 @@ class UserType extends Type, Declaration, NameQualifyingElement, AccessHolder, @
|
||||
else result = this.getADeclarationLocation()
|
||||
}
|
||||
|
||||
pragma[nomagic]
|
||||
private TypeDeclarationEntry getADeclarationEntryBase() {
|
||||
type_decls(underlyingElement(result), unresolveElement(this), _)
|
||||
}
|
||||
|
||||
override TypeDeclarationEntry getADeclarationEntry() {
|
||||
if type_decls(_, unresolveElement(this), _)
|
||||
then type_decls(underlyingElement(result), unresolveElement(this), _)
|
||||
else exists(Class t | this.(Class).isConstructedFrom(t) and result = t.getADeclarationEntry())
|
||||
pragma[only_bind_into](result) = pragma[only_bind_into](this).getADeclarationEntryBase()
|
||||
or
|
||||
not exists(this.getADeclarationEntryBase()) and
|
||||
exists(Class t | this.(Class).isConstructedFrom(t) and result = t.getADeclarationEntry())
|
||||
}
|
||||
|
||||
override Location getADeclarationLocation() { result = this.getADeclarationEntry().getLocation() }
|
||||
|
||||
Reference in New Issue
Block a user