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

Method removeUse

kdevplatform/language/duchain/uses.cpp:151–175  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

149}
150
151void Uses::removeUse(const DeclarationId& id, const IndexedTopDUContext& use)
152{
153 UsesItem item;
154 item.declaration = id;
155 UsesRequestItem request(item);
156
157 LockedItemRepository::write<Uses>([&](UsesRepo& repo) {
158 uint index = repo.findIndex(item);
159
160 if (index) {
161 // Check whether the item is already in the mapped list, else copy the list into the new created item
162 const UsesItem* oldItem = repo.itemFromIndex(index);
163 for (unsigned int a = 0; a < oldItem->usesSize(); ++a)
164 if (!(oldItem->uses()[a] == use))
165 item.usesList().append(oldItem->uses()[a]);
166
167 repo.deleteItem(index);
168 Q_ASSERT(repo.findIndex(item) == 0);
169
170 // This inserts the changed item
171 if (item.usesSize() != 0)
172 repo.index(request);
173 }
174 });
175}
176
177bool Uses::hasUses(const DeclarationId& id) const
178{

Callers 1

Calls 6

findIndexMethod · 0.45
itemFromIndexMethod · 0.45
usesMethod · 0.45
appendMethod · 0.45
deleteItemMethod · 0.45
indexMethod · 0.45

Tested by

no test coverage detected