MCPcopy Create free account
hub / github.com/KDE/kdevelop / ~Declaration

Method ~Declaration

kdevplatform/language/duchain/declaration.cpp:136–171  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

134}
135
136Declaration::~Declaration()
137{
138 uint oldOwnIndex = m_indexInTopContext;
139
140 TopDUContext* topContext = this->topContext();
141
142 //Only perform the actions when the top-context isn't being deleted, or when it hasn't been stored to disk
143 if (persistentlyDestroying()) {
144 DUCHAIN_D_DYNAMIC(Declaration);
145
146 // Inserted by the builder after construction has finished.
147 if (d->m_internalContext.context())
148 d->m_internalContext.context()->setOwner(nullptr);
149
150 setInSymbolTable(false);
151 }
152
153 // If the parent-context already has dynamic data, like for example any temporary context,
154 // always delete the declaration, to not create crashes within more complex code like C++ template stuff.
155 if (context() && !d_func()->m_anonymousInContext) {
156 if (!topContext->deleting() || !topContext->isOnDisk() || context()->d_func()->isDynamic())
157 context()->m_dynamicData->removeDeclaration(this);
158 }
159
160 clearOwnIndex();
161
162 if (!topContext->deleting() || !topContext->isOnDisk()) {
163 setContext(nullptr);
164
165 setAbstractType(AbstractType::Ptr());
166 }
167 Q_ASSERT(d_func()->isDynamic() ==
168 (!topContext->deleting() || !topContext->isOnDisk() ||
169 topContext->m_dynamicData->isTemporaryDeclarationIndex(oldOwnIndex)));
170 Q_UNUSED(oldOwnIndex);
171}
172
173QByteArray Declaration::comment() const
174{

Callers

nothing calls this directly

Calls 9

topContextMethod · 0.95
contextFunction · 0.85
setOwnerMethod · 0.80
deletingMethod · 0.80
d_funcMethod · 0.80
contextMethod · 0.45
isOnDiskMethod · 0.45
removeDeclarationMethod · 0.45

Tested by

no test coverage detected