From ce6087978f1aa60c2b38527a277c91704a95c970 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Sun, 7 Jan 2018 10:53:44 -0800 Subject: [PATCH] Use cursor extents for non-type template parameters --- src/indexer.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/indexer.cc b/src/indexer.cc index 6b937491..c675de45 100644 --- a/src/indexer.cc +++ b/src/indexer.cc @@ -1072,7 +1072,11 @@ ClangCursor::VisitResult TemplateVisitor(ClangCursor cursor, if (ref_type.get_usr().size()) { IndexType* ref_type_index = db->Resolve(db->ToTypeId(ref_type.get_usr())); - ref_type_index->uses.push_back(ref_cursor.get_spelling_range()); + // The cursor extent includes `type name`, not just `name`. There + // seems no way to extract the spelling range of `type` and we do + // not want to do subtraction here. + // See https://github.com/jacobdufault/cquery/issues/252 + ref_type_index->uses.push_back(ref_cursor.get_extent()); } } UniqueAdd(ref_index->uses, cursor.get_spelling_range());