[indexer] Change macro's IndexVar::def::detail_name to its approximate definition

For `#define foo 3`,
Before this commit, `detail_name` was `foo` (displayed for textDocument/hover reqeusts).
It is now shown as `#define foo 3`
This commit is contained in:
Fangrui Song 2017-12-13 00:22:02 -08:00 committed by Jacob Dufault
parent a1fd516788
commit 17cac3d30a

View File

@ -923,13 +923,14 @@ ClangCursor::VisitResult VisitMacroDefinitionAndExpansions(ClangCursor cursor,
UniqueAdd(var_def->uses, decl_loc_spelling);
if (cursor.get_kind() == CXCursor_MacroDefinition) {
CXSourceRange cx_extent = clang_getCursorExtent(cursor.cx_cursor);
var_def->def.short_name = cursor.get_display_name();
var_def->def.detailed_name = var_def->def.short_name;
var_def->def.is_local = false;
var_def->def.is_macro = true;
var_def->def.definition_spelling = decl_loc_spelling;
var_def->def.definition_extent = ResolveExtent(cursor.cx_cursor);
;
var_def->def.definition_extent = Resolve(cx_extent, nullptr);
var_def->def.detailed_name =
"#define " + GetDocumentContentInRange(param->tu->cx_tu, cx_extent);
}
break;