From 5415f4be50514d3d412a487b4f96a7a7a5e2397a Mon Sep 17 00:00:00 2001 From: Jacob Dufault Date: Sat, 27 May 2017 12:58:40 -0700 Subject: [PATCH] Don't count the '~' in type usages for destructors. --- src/indexer.cc | 8 +++++--- tests/constructors/destructor.cc | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/indexer.cc b/src/indexer.cc index e1779188..989e3ab5 100644 --- a/src/indexer.cc +++ b/src/indexer.cc @@ -1039,9 +1039,11 @@ void indexDeclaration(CXClientData client_data, const CXIdxDeclInfo* decl) { // Mark a type reference at the ctor/dtor location. if (decl->entityInfo->kind == CXIdxEntity_CXXConstructor) UniqueAdd(declaring_type_def->uses, decl_loc_spelling); - // TODO/FIXME: +1 on dtor start range. - if (decl->entityInfo->kind == CXIdxEntity_CXXDestructor) - UniqueAdd(declaring_type_def->uses, decl_loc_spelling); + if (decl->entityInfo->kind == CXIdxEntity_CXXDestructor) { + Range dtor_type_range = decl_loc_spelling; + dtor_type_range.start.column += 1; // Don't count the leading ~ + UniqueAdd(declaring_type_def->uses, dtor_type_range); + } // Add function to declaring type. UniqueAdd(declaring_type_def->def.funcs, func_id); diff --git a/tests/constructors/destructor.cc b/tests/constructors/destructor.cc index 1a19ad2d..37a45941 100644 --- a/tests/constructors/destructor.cc +++ b/tests/constructors/destructor.cc @@ -25,7 +25,7 @@ OUTPUT: "definition_extent": "1:1-5:2", "funcs": [0, 1], "instances": [0], - "uses": ["1:7-1:10", "3:3-3:6", "4:3-4:7", "8:3-8:6"] + "uses": ["1:7-1:10", "3:3-3:6", "4:4-4:7", "8:3-8:6"] }], "funcs": [{ "id": 0,