[PATCH] D117472: [clangd] Bring back early-claim approach to fix a selection-tree regression.

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 17 06:11:58 PST 2022

sammccall accepted this revision.
sammccall added inline comments.
This revision is now accepted and ready to land.

Comment at: clang-tools-extra/clangd/Selection.cpp:758
+      // ranges of children are not overlapped with their parent's.
+      // But there are some AST-weird cases, e.g.
+      //    auto fun = [bar = foo]() { ... }
I don't think this is an e.g., but rather is suitable for specifically this case.

If there are other cases, we likely should be testing DeclaratorDecl here, and excluding Constructor/Destructor as before.

Comment at: clang-tools-extra/clangd/Selection.cpp:773
   void claimTokensFor(const DynTypedNode &N, SelectionTree::Selection &Result) {
     // CXXConstructExpr often shows implicit construction, like `string s;`.
     // Don't associate any tokens with it unless there's some syntax like {}.
I wonder whether we want to keep the CXXConstructExpr hack now, up to you.

  rG LLVM Github Monorepo



More information about the cfe-commits mailing list