[clang-tools-extra] [clangd] Don't show inlay hints for __builtin_dump_struct (PR #71366)

Nathan Ridge via cfe-commits cfe-commits at lists.llvm.org
Sat Nov 25 22:03:09 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
----------------
HighCommander4 wrote:

This is not a case where the **syntactic** form is a `CallExpr` (here the syntactic form is an `MSPropertySubscriptExpr`), so here the hints would be retained.

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


More information about the cfe-commits mailing list