[PATCH] D35894: [clangd] Code hover for Clangd

Simon Marchi via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 13 05:03:10 PST 2018


simark added a comment.

> I'm not aware of the code that pretty-prints macros. There's a code that dumps debug output, but it's not gonna help in that case.
>  Alternatively, we could simply print the macro name and not print the definition. That's super-simple and is in line with hovers for the AST decls. Let's do that in the initial version.

Ok, I'm considering printing "#define MACRO".  Just printing the name would not be very useful, at least printing "#define" gives the information that the hovered entity is defined as a macro (and not a function or variable).

Is there a way to get the macro name from the MacroInfo object?  I couldn't find any, so the solution I'm considering is to make `DeclarationAndMacrosFinder::takeMacroInfos` return an `std::vector<std::pair<StringRef, const MacroInfo *>>`, where the first member of the pair is the macro name.  It would come from `IdentifierInfo->getName()` in `DeclarationAndMacrosFinder::finish`.  Does that make sense, or is there a simpler way?


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D35894





More information about the cfe-commits mailing list