[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:46:20 PDT 2024
================
@@ -474,6 +477,17 @@ void DeclPrinter::VisitDeclContext(DeclContext *DC, bool Indent) {
for (DeclContext::decl_iterator D = DC->decls_begin(), DEnd = DC->decls_end();
D != DEnd; ++D) {
+ // Print enum members and public struct fields when
+ // PrintTagTypeContents=true. Only applicable when TerseOutput=true since
+ // otherwise all members are printed.
+ if (Policy.TerseOutput) {
+ assert(Policy.PrintTagTypeContents);
+ if (!(isa<EnumConstantDecl>(*D) ||
+ (isa<FieldDecl>(*D) &&
+ dyn_cast<FieldDecl>(*D)->getAccess() == AS_public)))
----------------
HighCommander4 wrote:
The patch does seem to work for me on C files, but adding a test to exercise the code in C mode is definitely a good idea. Thanks!
https://github.com/llvm/llvm-project/pull/89557
More information about the cfe-commits
mailing list