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

Method addDeclaration

kdevplatform/language/duchain/dumpdotgraph.cpp:64–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

62DumpDotGraph::~DumpDotGraph() = default;
63
64void DumpDotGraphPrivate::addDeclaration(QTextStream& stream, Declaration* dec)
65{
66 if (m_hadObjects.contains(dec))
67 return;
68
69 m_hadObjects[dec] = true;
70
71 Declaration* declarationForDefinition = nullptr;
72 if (dynamic_cast<FunctionDefinition*>(dec))
73 declarationForDefinition = static_cast<FunctionDefinition*>(dec)->declaration(m_topContext);
74
75 if (!declarationForDefinition) {
76 //Declaration
77 stream << shortLabel(dec) <<
78 "[shape=box, label=\"" <<
79 dec->toString() << " [" <<
80 dec->qualifiedIdentifier().toString() << "]" << " " <<
81 rangeToString(dec->range().castToSimpleRange()) << "\"];\n";
82 stream << shortLabel(dec->context()) << " -> " << shortLabel(dec) << "[color=green];\n";
83 if (dec->internalContext())
84 stream << shortLabel(dec) << " -> " << shortLabel(dec->internalContext()) <<
85 "[label=\"internal\", color=blue];\n";
86 } else {
87 //Definition
88 stream << shortLabel(dec) << "[shape=regular,color=yellow,label=\"" << declarationForDefinition->toString() <<
89 " " << rangeToString(dec->range().castToSimpleRange()) << "\"];\n";
90 stream << shortLabel(dec->context()) << " -> " << shortLabel(dec) << ";\n";
91
92 stream << shortLabel(dec) << " -> " << shortLabel(declarationForDefinition) <<
93 "[label=\"defines\",color=green];\n";
94 addDeclaration(stream, declarationForDefinition);
95
96 if (dec->internalContext())
97 stream << shortLabel(dec) << " -> " << shortLabel(dec->internalContext()) <<
98 "[label=\"internal\", color=blue];\n";
99 }
100}
101
102QString DumpDotGraphPrivate::dotGraphInternal(KDevelop::DUContext* context, bool isMaster, bool shortened)
103{

Callers

nothing calls this directly

Calls 9

shortLabelFunction · 0.85
rangeToStringFunction · 0.85
containsMethod · 0.45
declarationMethod · 0.45
toStringMethod · 0.45
qualifiedIdentifierMethod · 0.45
rangeMethod · 0.45
contextMethod · 0.45
internalContextMethod · 0.45

Tested by

no test coverage detected