mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-26 17:41:58 +00:00
Better template specialization
This commit is contained in:
parent
dc1c72ce30
commit
b7ce3dd60a
@ -1701,14 +1701,6 @@ void OnIndexDeclaration(CXClientData client_data, const CXIdxDeclInfo* decl) {
|
||||
switch (decl->entityInfo->templateKind) {
|
||||
default:
|
||||
break;
|
||||
case CXIdxEntity_Template: {
|
||||
TemplateVisitorData data;
|
||||
data.db = db;
|
||||
data.container = decl_cursor;
|
||||
data.param = param;
|
||||
decl_cursor.VisitChildren(&TemplateVisitor, &data);
|
||||
break;
|
||||
}
|
||||
case CXIdxEntity_TemplateSpecialization:
|
||||
case CXIdxEntity_TemplatePartialSpecialization: {
|
||||
// TODO Use a different dimension
|
||||
@ -1733,6 +1725,14 @@ void OnIndexDeclaration(CXClientData client_data, const CXIdxDeclInfo* decl) {
|
||||
}
|
||||
origin->derived.push_back(type_id);
|
||||
type->def.parents.push_back(origin_id);
|
||||
}
|
||||
// fallthrough
|
||||
case CXIdxEntity_Template: {
|
||||
TemplateVisitorData data;
|
||||
data.db = db;
|
||||
data.container = decl_cursor;
|
||||
data.param = param;
|
||||
decl_cursor.VisitChildren(&TemplateVisitor, &data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -187,7 +187,10 @@ std::vector<QueryLocation> GetUsesOfSymbol(QueryDatabase* db,
|
||||
switch (symbol.kind) {
|
||||
case SymbolKind::Type: {
|
||||
QueryType& type = db->types[symbol.idx];
|
||||
return type.uses;
|
||||
std::vector<QueryLocation> ret = type.uses;
|
||||
if (include_decl && type.def)
|
||||
ret.push_back(*type.def->definition_spelling);
|
||||
return ret;
|
||||
}
|
||||
case SymbolKind::Func: {
|
||||
// TODO: the vector allocation could be avoided.
|
||||
|
Loading…
Reference in New Issue
Block a user