[PATCH] D157956: [clangd] don't add inlay hint for dependent type in structured binding

Vincent Hong via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Aug 20 20:12:06 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rGdc10bd43a103: [clangd] don't add inlay hint for dependent type in structured binding (authored by v1nh1shungry).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D157956/new/

https://reviews.llvm.org/D157956

Files:
  clang-tools-extra/clangd/InlayHints.cpp
  clang-tools-extra/clangd/unittests/InlayHintTests.cpp


Index: clang-tools-extra/clangd/unittests/InlayHintTests.cpp
===================================================================
--- clang-tools-extra/clangd/unittests/InlayHintTests.cpp
+++ clang-tools-extra/clangd/unittests/InlayHintTests.cpp
@@ -1353,6 +1353,11 @@
       // FIXME: It would be nice to show "T" as the hint.
       auto $var2[[var2]] = arg;
     }
+
+    template <typename T>
+    void bar(T arg) {
+      auto [a, b] = arg;
+    }
   )cpp");
 }
 
Index: clang-tools-extra/clangd/InlayHints.cpp
===================================================================
--- clang-tools-extra/clangd/InlayHints.cpp
+++ clang-tools-extra/clangd/InlayHints.cpp
@@ -733,7 +733,8 @@
         // For structured bindings, print canonical types. This is important
         // because for bindings that use the tuple_element protocol, the
         // non-canonical types would be "tuple_element<I, A>::type".
-        if (auto Type = Binding->getType(); !Type.isNull())
+        if (auto Type = Binding->getType();
+            !Type.isNull() && !Type->isDependentType())
           addTypeHint(Binding->getLocation(), Type.getCanonicalType(),
                       /*Prefix=*/": ");
       }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D157956.551885.patch
Type: text/x-patch
Size: 1198 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230821/0d7333a0/attachment.bin>


More information about the cfe-commits mailing list