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

Method removeDefinition

kdevplatform/language/duchain/definitions.cpp:226–250  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

224}
225
226void Definitions::removeDefinition(const DeclarationId& id, const IndexedDeclaration& definition)
227{
228 DefinitionsItem item;
229 item.declaration = id;
230 DefinitionsRequestItem request(item);
231
232 LockedItemRepository::write<Definitions>([&](DefinitionsRepo& repo) {
233 uint index = repo.findIndex(item);
234
235 if (index) {
236 // Check whether the item is already in the mapped list, else copy the list into the new created item
237 const DefinitionsItem* oldItem = repo.itemFromIndex(index);
238 for (unsigned int a = 0; a < oldItem->definitionsSize(); ++a)
239 if (!(oldItem->definitions()[a] == definition))
240 item.definitionsList().append(oldItem->definitions()[a]);
241
242 repo.deleteItem(index);
243 Q_ASSERT(repo.findIndex(item) == 0);
244
245 // This inserts the changed item
246 if (item.definitionsSize() != 0)
247 repo.index(request);
248 }
249 });
250}
251
252KDevVarLengthArray<IndexedDeclaration> Definitions::definitions(const DeclarationId& id) const
253{

Callers 3

~FunctionDefinitionMethod · 0.80
setDeclarationMethod · 0.80
testDefinitionsMethod · 0.80

Calls 6

findIndexMethod · 0.45
itemFromIndexMethod · 0.45
definitionsMethod · 0.45
appendMethod · 0.45
deleteItemMethod · 0.45
indexMethod · 0.45

Tested by 1

testDefinitionsMethod · 0.64