[clang] [clang-tools-extra] [clangd] Show struct fields and enum members in hovers (PR #89557)

Nathan Ridge via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 23 23:47:27 PDT 2024


HighCommander4 wrote:

> > 3. Regarding the implementation approach, is it fine to add a flag to `PrintingPolicy` (which is a clang utility class used in a variety of places) for a clangd-specific use case like this? I did it this way because the alternative seemed to involve duplicating a bunch of code related to decl-printing, but I'm happy to explore alternatives if this is an issue.
> 
> I feel like "print only public fields" is too specific for clangd use case, and probably won't generalize to other callers at all. But I definitely agree with all the concerns around duplicating code. Looks like we have some `PrintingCallbacks`, maybe we can have something like `SummarizeTagDecl`, which enables customizing what to put into the body, when printing a TagDecl in terse mode?

Thanks for the suggestion! Using `PrintingCallbacks` here sounds like a promising idea.

https://github.com/llvm/llvm-project/pull/89557


More information about the cfe-commits mailing list