[PATCH] D154853: [clangd][c++20]Consider the constraint of a constrained auto in FindTarget.

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Jul 15 09:39:07 PDT 2023


sammccall added a comment.

Sorry about the delay here.

Making the whole AutoTypeLoc resolve to the concept doesn't seem right - the `auto` part does not refer to the concept, and in principle refers to another type entirely.

Really I think there should be a child node representing just the concept part, probably a ConceptReference.

Compared to the case we discussed where constrained auto is a template type param, this looks easier: all the information is there in AutoTypeLoc.
I think we need RecursiveASTVisitor to assemble it into a ConceptReference, and (to use it with SelectionTree) we need the ability to store it in a DynTypedNode.



================
Comment at: clang-tools-extra/clangd/unittests/FindTargetTests.cpp:581
+
+    [[Fooable]] auto i = 42;
+  )cpp";
----------------
this is going to have the same behavior on the `auto` token, right?

This is my main practical concern, that go-to-definition, hover, find-refs, go-to-type etc on `auto` will now treat `Fooable` as their target.

(That said, I'm not sure exactly how common it is for `auto` to be constrained in a non-dependent context...)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D154853



More information about the cfe-commits mailing list