From 79b60561d1d069136626a504390e1e1285752860 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Sun, 28 Jan 2018 11:42:40 -0800 Subject: [PATCH] Remove CXCursor_MacroDefinition from uses --- src/indexer.cc | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/indexer.cc b/src/indexer.cc index 8cc52d18..84a48c9c 100644 --- a/src/indexer.cc +++ b/src/indexer.cc @@ -1145,10 +1145,7 @@ ClangCursor::VisitResult VisitMacroDefinitionAndExpansions(ClangCursor cursor, else decl_usr = cursor.get_referenced().get_usr_hash(); - IndexVarId var_id = db->ToVarId(decl_usr); - IndexVar* var_def = db->Resolve(var_id); - UniqueAdd(var_def->uses, decl_loc_spelling); - + IndexVar* var_def = db->Resolve(db->ToVarId(decl_usr)); if (cursor.get_kind() == CXCursor_MacroDefinition) { CXSourceRange cx_extent = clang_getCursorExtent(cursor.cx_cursor); var_def->def.short_name = cursor.get_display_name(); @@ -1160,7 +1157,8 @@ ClangCursor::VisitResult VisitMacroDefinitionAndExpansions(ClangCursor cursor, var_def->def.definition_spelling = decl_loc_spelling; var_def->def.definition_extent = ResolveCXSourceRange(cx_extent, nullptr); - } + } else + UniqueAdd(var_def->uses, decl_loc_spelling); break; }