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

Method dump

kdevplatform/language/duchain/duchaindumper.cpp:118–184  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

116}
117
118void DUChainDumperPrivate::dump(DUContext* context, int allowedDepth, bool isFromImport, QTextStream& out)
119{
120 QDebug qout = fromTextStream(out);
121
122 qout << Indent(m_indent * 2) << (isFromImport ? " ==import==>" : "")
123 << (dynamic_cast<TopDUContext*>(context) ? "Top-Context" : "Context") << typeToString(context->type())
124 << "(owner: " << context->owner() << ")" << context << context->localScopeIdentifier() << "["
125 << context->scopeIdentifier(true) << "]" << context->range().castToSimpleRange()
126 << (dynamic_cast<TopDUContext*>(context) ? static_cast<TopDUContext*>(context)->url().byteArray() : "")
127 << Qt::endl;
128
129 if (!Algorithm::insert(m_visitedContexts, context).inserted) {
130 qout << Indent((m_indent + 2) * 2) << "(Skipping" << context->scopeIdentifier(true)
131 << "because it was already printed)" << Qt::endl;
132 return;
133 }
134
135 auto top = context->topContext();
136 if (allowedDepth >= 0) {
137 const auto localDeclarations = context->localDeclarations(top);
138 for (Declaration* dec : localDeclarations) {
139 //IdentifiedType* idType = dynamic_cast<IdentifiedType*>(dec->abstractType().data());
140
141 qout << Indent((m_indent + 2) * 2) << "Declaration:" << dec->toString() << "[" << dec->qualifiedIdentifier()
142 << "]" << dec << "(internal ctx:" << dec->internalContext() << ")" << dec->range().castToSimpleRange()
143 << ","
144 << (dec->isDefinition() ? "defined, " : (FunctionDefinition::definition(dec) ? "" : "no definition, "))
145 << dec->uses().count() << "use(s)." << Qt::endl;
146 if (FunctionDefinition::definition(dec)) {
147 qout << Indent((m_indent + 2) * 2 + 1)
148 << "Definition:" << FunctionDefinition::definition(dec)->range().castToSimpleRange() << Qt::endl;
149 }
150 const auto uses = dec->uses();
151 for (auto it = uses.constBegin(); it != uses.constEnd(); ++it) {
152 qout << Indent((m_indent + 3) * 2) << "File:" << it.key().str() << Qt::endl;
153 for (const RangeInRevision range : std::as_const(*it)) {
154 qout << Indent((m_indent + 4) * 2) << "Use:" << range.castToSimpleRange() << Qt::endl;
155 }
156 }
157 }
158 } else {
159 qout << Indent((m_indent + 2) * 2) << context->localDeclarations(top).count() << "Declarations,"
160 << context->childContexts().size() << "child-contexts" << Qt::endl;
161 }
162
163 ++m_indent;
164 {
165 /*
166 const auto importedParentContexts = context->importedParentContexts();
167 for (const DUContext::Import& parent : importedParentContexts) {
168 DUContext* import = parent.context(top);
169 if(!import) {
170 qout << Indent((m_indent+2) * 2+1) << "Could not get parent, is it registered in the DUChain?" << Qt::endl;
171 continue;
172 }
173
174 dump(import, allowedDepth-1, true, out);
175 }

Callers

nothing calls this directly

Calls 15

IndentClass · 0.85
typeToStringFunction · 0.85
insertFunction · 0.85
localScopeIdentifierMethod · 0.80
scopeIdentifierMethod · 0.80
byteArrayMethod · 0.80
localDeclarationsMethod · 0.80
isDefinitionMethod · 0.80
constBeginMethod · 0.80
constEndMethod · 0.80
strMethod · 0.80
childContextsMethod · 0.80

Tested by

no test coverage detected