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

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 6 02:12:18 PDT 2023


sammccall added inline comments.


================
Comment at: clang-tools-extra/clangd/SemanticHighlighting.cpp:966
+
+    if (auto *TSI = D->getTypeSourceInfo()) {
+       auto ATL = TSI->getTypeLoc().getContainedAutoTypeLoc();
----------------
if we add this logic it definitely needs a comment explaining that we're looking for the auto token (because we're not doing so directly) and why


================
Comment at: clang-tools-extra/clangd/SemanticHighlighting.cpp:969
+       if (ATL.isConstrained()) {
+         StartLoc = ATL.getConceptNameInfo().getEndLoc().getLocWithOffset(1);
+       }
----------------
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


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