Don't count the '~' in type usages for destructors.

This commit is contained in:
Jacob Dufault 2017-05-27 12:58:40 -07:00
parent dcc71f2470
commit 5415f4be50
2 changed files with 6 additions and 4 deletions

View File

@ -1039,9 +1039,11 @@ void indexDeclaration(CXClientData client_data, const CXIdxDeclInfo* decl) {
// Mark a type reference at the ctor/dtor location. // Mark a type reference at the ctor/dtor location.
if (decl->entityInfo->kind == CXIdxEntity_CXXConstructor) if (decl->entityInfo->kind == CXIdxEntity_CXXConstructor)
UniqueAdd(declaring_type_def->uses, decl_loc_spelling); UniqueAdd(declaring_type_def->uses, decl_loc_spelling);
// TODO/FIXME: +1 on dtor start range. if (decl->entityInfo->kind == CXIdxEntity_CXXDestructor) {
if (decl->entityInfo->kind == CXIdxEntity_CXXDestructor) Range dtor_type_range = decl_loc_spelling;
UniqueAdd(declaring_type_def->uses, 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. // Add function to declaring type.
UniqueAdd(declaring_type_def->def.funcs, func_id); UniqueAdd(declaring_type_def->def.funcs, func_id);

View File

@ -25,7 +25,7 @@ OUTPUT:
"definition_extent": "1:1-5:2", "definition_extent": "1:1-5:2",
"funcs": [0, 1], "funcs": [0, 1],
"instances": [0], "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": [{ "funcs": [{
"id": 0, "id": 0,