MCPcopy Create free account
hub / github.com/KDE/kdevelop / resolve

Method resolve

kdevplatform/language/duchain/forwarddeclaration.cpp:53–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51}
52
53Declaration* ForwardDeclaration::resolve(const TopDUContext* topContext) const
54{
55 ENSURE_CAN_READ
56
57 //If we've got a type assigned, that counts as a way of resolution.
58 AbstractType::Ptr t = abstractType();
59 auto* idType = dynamic_cast<IdentifiedType*>(t.data());
60 if (idType) {
61 Declaration* decl = idType->declaration(topContext);
62 if (decl && !decl->isForwardDeclaration())
63 return decl;
64 else
65 return nullptr;
66 }
67
68 if (!topContext)
69 topContext = this->topContext();
70
71 QualifiedIdentifier globalIdentifier = qualifiedIdentifier();
72 globalIdentifier.setExplicitlyGlobal(true);
73
74 //We've got to use DUContext::DirectQualifiedLookup so C++ works correctly.
75 const QList<Declaration*> declarations = topContext->findDeclarations(globalIdentifier,
76 CursorInRevision::invalid(),
77 AbstractType::Ptr(), nullptr,
78 DUContext::DirectQualifiedLookup);
79
80 for (Declaration* decl : declarations) {
81 if (!decl->isForwardDeclaration())
82 return decl;
83 }
84
85 return nullptr;
86}
87
88DUContext* ForwardDeclaration::logicalInternalContext(const TopDUContext* topContext) const
89{

Callers 3

ifFunction · 0.45
htmlMethod · 0.45

Calls 7

setExplicitlyGlobalMethod · 0.80
findDeclarationsMethod · 0.80
invalidFunction · 0.50
dataMethod · 0.45
declarationMethod · 0.45
isForwardDeclarationMethod · 0.45
topContextMethod · 0.45

Tested by

no test coverage detected