From 74f9be1d6f88b5b8b61cffca34558c98b88cdbe6 Mon Sep 17 00:00:00 2001 From: Nathan Ridge Date: Thu, 1 Feb 2018 23:07:11 -0500 Subject: [PATCH] Use symbol kind 'Parameter' for template parameters Clients can distinguish between function and template parameters based on storage class. --- src/clang_symbol_kind.h | 2 ++ src/indexer.cc | 3 +++ 2 files changed, 5 insertions(+) diff --git a/src/clang_symbol_kind.h b/src/clang_symbol_kind.h index c168ae79..7e34dfac 100644 --- a/src/clang_symbol_kind.h +++ b/src/clang_symbol_kind.h @@ -38,6 +38,8 @@ enum class ClangSymbolKind : uint8_t { Destructor, ConversionFunction, + // Used for both function and template parameters. + // Clients can differentiate based on StorageClass. Parameter = 25, Using, }; diff --git a/src/indexer.cc b/src/indexer.cc index ab865bb3..913416f3 100644 --- a/src/indexer.cc +++ b/src/indexer.cc @@ -1197,6 +1197,7 @@ ClangCursor::VisitResult TemplateVisitor(ClangCursor cursor, if (ref_index->def.detailed_name.empty()) { ref_index->def.definition_spelling = ref_cursor.get_spelling_range(); ref_index->def.definition_extent = ref_cursor.get_extent(); + ref_index->def.kind = ClangSymbolKind::Parameter; SetVarDetail(ref_index, ref_cursor.get_spelling(), ref_cursor, nullptr, true, db, data->param); @@ -1252,6 +1253,7 @@ ClangCursor::VisitResult TemplateVisitor(ClangCursor cursor, ref_index->def.detailed_name = ref_cursor.get_spelling(); ref_index->def.short_name_offset = 0; ref_index->def.short_name_size = ref_index->def.detailed_name.size(); + ref_index->def.kind = ClangSymbolKind::Parameter; } UniqueAdd(ref_index->uses, cursor.get_spelling_range()); } @@ -1273,6 +1275,7 @@ ClangCursor::VisitResult TemplateVisitor(ClangCursor cursor, ref_index->def.detailed_name = ref_cursor.get_spelling(); ref_index->def.short_name_offset = 0; ref_index->def.short_name_size = ref_index->def.detailed_name.size(); + ref_index->def.kind = ClangSymbolKind::Parameter; } UniqueAdd(ref_index->uses, cursor.get_spelling_range()); }