MCPcopy Create free account
hub / github.com/MaskRay/ccls / removeUsrs

Method removeUsrs

src/query.cc:192–233  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

190}
191
192template <typename Def> void DB::removeUsrs(Kind kind, int file_id, const std::vector<std::pair<Usr, Def>> &to_remove) {
193 switch (kind) {
194 case Kind::Func: {
195 for (auto &[usr, _] : to_remove) {
196 // FIXME
197 if (!hasFunc(usr))
198 continue;
199 QueryFunc &func = getFunc(usr);
200 auto it = llvm::find_if(func.def, [=](const QueryFunc::Def &def) { return def.file_id == file_id; });
201 if (it != func.def.end())
202 func.def.erase(it);
203 }
204 break;
205 }
206 case Kind::Type: {
207 for (auto &[usr, _] : to_remove) {
208 // FIXME
209 if (!hasType(usr))
210 continue;
211 QueryType &type = getType(usr);
212 auto it = llvm::find_if(type.def, [=](const QueryType::Def &def) { return def.file_id == file_id; });
213 if (it != type.def.end())
214 type.def.erase(it);
215 }
216 break;
217 }
218 case Kind::Var: {
219 for (auto &[usr, _] : to_remove) {
220 // FIXME
221 if (!hasVar(usr))
222 continue;
223 QueryVar &var = getVar(usr);
224 auto it = llvm::find_if(var.def, [=](const QueryVar::Def &def) { return def.file_id == file_id; });
225 if (it != var.def.end())
226 var.def.erase(it);
227 }
228 break;
229 }
230 default:
231 break;
232 }
233}
234
235void DB::applyIndexUpdate(IndexUpdate *u) {
236#define REMOVE_ADD(C, F) \

Callers

nothing calls this directly

Calls 1

endMethod · 0.80

Tested by

no test coverage detected