[PATCH] D148457: [clangd] Support macro evaluation on hover

Younan Zhang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 28 04:12:15 PDT 2023


zyounan added a comment.

Sorry for responding late and thank you for the good catch!
I've updated the code and please feel free to leave comments. :)



================
Comment at: clang-tools-extra/clangd/Hover.cpp:728
   }
+  SelectionTree::createEach(
+      AST.getASTContext(), AST.getTokens(), SM.getFileOffset(Tok.location()),
----------------
nridge wrote:
> Why `createEach()` when the [non-macro case](https://searchfox.org/llvm/rev/be9c91843bab5bb46574c27836bfcd9ad6fc9ef5/clang-tools-extra/clangd/Hover.cpp#1270) uses `createRight()`?
TBH, I didn't notice that we're using `createRight()` before and I'm not quite sure if there exists such case, that yields nothing with the right selection tree (which is exactly the 1st tree produced by `createEach()`) but could be evaluated with falling back to the left selection tree.
I'll change it to `createEach` anyway.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D148457



More information about the cfe-commits mailing list