Remove CXCursor_MacroDefinition from uses

This commit is contained in:
Fangrui Song 2018-01-28 11:42:40 -08:00
parent 818ef8a834
commit 79b60561d1

View File

@ -1145,10 +1145,7 @@ ClangCursor::VisitResult VisitMacroDefinitionAndExpansions(ClangCursor cursor,
else else
decl_usr = cursor.get_referenced().get_usr_hash(); decl_usr = cursor.get_referenced().get_usr_hash();
IndexVarId var_id = db->ToVarId(decl_usr); IndexVar* var_def = db->Resolve(db->ToVarId(decl_usr));
IndexVar* var_def = db->Resolve(var_id);
UniqueAdd(var_def->uses, decl_loc_spelling);
if (cursor.get_kind() == CXCursor_MacroDefinition) { if (cursor.get_kind() == CXCursor_MacroDefinition) {
CXSourceRange cx_extent = clang_getCursorExtent(cursor.cx_cursor); CXSourceRange cx_extent = clang_getCursorExtent(cursor.cx_cursor);
var_def->def.short_name = cursor.get_display_name(); 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_spelling = decl_loc_spelling;
var_def->def.definition_extent = var_def->def.definition_extent =
ResolveCXSourceRange(cx_extent, nullptr); ResolveCXSourceRange(cx_extent, nullptr);
} } else
UniqueAdd(var_def->uses, decl_loc_spelling);
break; break;
} }