mirror of
https://github.com/MaskRay/ccls.git
synced 2025-01-31 18:00:26 +00:00
[indexer] Index some references in ClassTemplate
This commit is contained in:
parent
719c6c9ae9
commit
34052fbf27
@ -1028,6 +1028,7 @@ ClangCursor::VisitResult VisitMacroDefinitionAndExpansions(ClangCursor cursor,
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
// TODO Move to another file and use clang C++ API
|
||||||
struct TemplateVisitorData {
|
struct TemplateVisitorData {
|
||||||
IndexFile* db;
|
IndexFile* db;
|
||||||
ClangCursor container;
|
ClangCursor container;
|
||||||
@ -1038,7 +1039,7 @@ ClangCursor::VisitResult TemplateVisitor(ClangCursor cursor,
|
|||||||
TemplateVisitorData* data) {
|
TemplateVisitorData* data) {
|
||||||
switch (cursor.get_kind()) {
|
switch (cursor.get_kind()) {
|
||||||
default:
|
default:
|
||||||
if (!IsFunctionCallContext(cursor.get_kind()))
|
//if (!IsFunctionCallContext(cursor.get_kind()))
|
||||||
cursor.VisitChildren(&TemplateVisitor, data);
|
cursor.VisitChildren(&TemplateVisitor, data);
|
||||||
/* fallthrough */
|
/* fallthrough */
|
||||||
// TODO Add other containers not covered by IsFunctionCallContext
|
// TODO Add other containers not covered by IsFunctionCallContext
|
||||||
@ -1607,6 +1608,13 @@ void OnIndexDeclaration(CXClientData client_data, const CXIdxDeclInfo* decl) {
|
|||||||
}
|
}
|
||||||
UniqueAdd(type->uses, decl_loc_spelling);
|
UniqueAdd(type->uses, decl_loc_spelling);
|
||||||
|
|
||||||
|
if (decl->entityInfo->templateKind == CXIdxEntity_Template) {
|
||||||
|
TemplateVisitorData data;
|
||||||
|
data.db = db;
|
||||||
|
data.container = decl_cursor;
|
||||||
|
decl_cursor.VisitChildren(&TemplateVisitor, &data);
|
||||||
|
}
|
||||||
|
|
||||||
// type_def->alias_of
|
// type_def->alias_of
|
||||||
// type_def->funcs
|
// type_def->funcs
|
||||||
// type_def->types
|
// type_def->types
|
||||||
@ -1624,7 +1632,7 @@ void OnIndexDeclaration(CXClientData client_data, const CXIdxDeclInfo* decl) {
|
|||||||
decl->lexicalContainer);
|
decl->lexicalContainer);
|
||||||
optional<IndexTypeId> parent_type_id =
|
optional<IndexTypeId> parent_type_id =
|
||||||
ResolveToDeclarationType(db, base_class->cursor);
|
ResolveToDeclarationType(db, base_class->cursor);
|
||||||
// type_def ptr could be invalidated by ResolveToDeclarationType.
|
// type_def ptr could be invalidated by ResolveToDeclarationType and TemplateVisitor.
|
||||||
type = db->Resolve(type_id);
|
type = db->Resolve(type_id);
|
||||||
if (parent_type_id) {
|
if (parent_type_id) {
|
||||||
IndexType* parent_type_def = db->Resolve(parent_type_id.value());
|
IndexType* parent_type_def = db->Resolve(parent_type_id.value());
|
||||||
|
Loading…
Reference in New Issue
Block a user