SymbolMap CursorInfo::virtuals(const Location &loc, const SymbolMap &map) const { SymbolMap ret; ret[loc] = copy(); const SymbolMap s = (kind == CXCursor_CXXMethod ? allReferences(loc, map) : targetInfos(map)); for (auto it = s.begin(); it != s.end(); ++it) { if (it->second->kind == kind) ret[it->first] = it->second; } return ret; }
CursorInfo CursorInfo::bestTarget(const SymbolMap &map, const SymbolMap *errors, Location *loc) const { const SymbolMap targets = targetInfos(map, errors); SymbolMap::const_iterator best = targets.end(); int bestRank = -1; for (SymbolMap::const_iterator it = targets.begin(); it != targets.end(); ++it) { const CursorInfo &ci = it->second; const int r = targetRank(ci); if (r > bestRank || (r == bestRank && ci.isDefinition())) { bestRank = r; best = it; } } if (best != targets.end()) { if (loc) *loc = best->first; return best->second; } return CursorInfo(); }
std::shared_ptr<CursorInfo> CursorInfo::bestTarget(const SymbolMap &map, Location *loc) const { const SymbolMap targets = targetInfos(map); auto best = targets.end(); int bestRank = -1; for (auto it = targets.begin(); it != targets.end(); ++it) { const std::shared_ptr<CursorInfo> &ci = it->second; const int r = targetRank(ci); if (r > bestRank || (r == bestRank && ci->isDefinition())) { bestRank = r; best = it; } } if (best != targets.end()) { if (loc) *loc = best->first; return best->second; } return std::shared_ptr<CursorInfo>(); }
SymbolMap CursorInfo::virtuals(const Location &loc, const SymbolMap &map, const SymbolMap *errors) const { SymbolMap ret; ret[loc] = *this; const SymbolMap s = (kind == CXCursor_CXXMethod ? allReferences(loc, map, errors) : targetInfos(map, errors)); for (SymbolMap::const_iterator it = s.begin(); it != s.end(); ++it) { if (it->second.kind == kind) ret[it->first] = it->second; } return ret; }