[PATCH] D154580: [clangd][c++20]Add missing semantic highlighing for concepts.

Jens Massberg via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 6 02:52:44 PDT 2023


massberg marked 2 inline comments as done.
massberg added inline comments.


================
Comment at: clang-tools-extra/clangd/SemanticHighlighting.cpp:969
+       if (ATL.isConstrained()) {
+         StartLoc = ATL.getConceptNameInfo().getEndLoc().getLocWithOffset(1);
+       }
----------------
sammccall wrote:
> getLocWithOffset(1) is just jumping one byte in the source code
> why is this correct?
> 
> IIUC the intention here is to jump to the `auto` token, and the AutoTypeLoc doesn't actually expose this
> 
> I'd suggest:
>  - for now just bailing out - this is not important enough to hack around (and the current hack doesn't seem robust)
>  - if you have the appetite, adding this location to AutoTypeLoc seems like a good thing
It seems that we can directly get the correct location, see above.
The test had been wrong before as the auto in `auto` in `Fooable auto f = ..` should have a class deduced token as it would have without the concept.
This is now fixed.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D154580



More information about the cfe-commits mailing list