[clang-tools-extra] [clangd] Don't show inlay hints for __builtin_dump_struct (PR #71366)
Younan Zhang via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 30 04:53:41 PST 2023
================
@@ -589,6 +589,24 @@ class InlayHintVisitor : public RecursiveASTVisitor<InlayHintVisitor> {
return true;
}
+ bool TraversePseudoObjectExpr(PseudoObjectExpr *E) {
+ // Do not show inlay hints for the __builtin_dump_struct, which would
+ // expand to a PseudoObjectExpr that includes a couple of calls to a
+ // printf function. Printing parameter names for that anyway would end up
+ // with duplicate parameter names (which, however, got de-duplicated after
+ // visiting) for the printf function.
+ if (auto *CE = dyn_cast<CallExpr>(E->getSyntacticForm());
+ CE && CE->getBuiltinCallee() == Builtin::BI__builtin_dump_struct)
+ // Only traverse the syntactic forms. This leaves the door open in case
+ // the arguments in the syntactic form for __builtin_dump_struct could
+ // possibly get parameter names.
+ return RecursiveASTVisitor<InlayHintVisitor>::TraverseStmt(
+ E->getSyntacticForm());
+ // FIXME: Shall we ignore semantic forms for other pseudo object
----------------
zyn0217 wrote:
Oops. sorry for messing up the types. :-(
https://github.com/llvm/llvm-project/pull/71366
More information about the cfe-commits
mailing list