[PATCH] D158249: [clangd] Parameter hints for calls through function pointers
Sam McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 18 02:12:02 PDT 2023
sammccall added inline comments.
================
Comment at: clang-tools-extra/clangd/InlayHints.cpp:466
+// so that we can recover argument names from it.
+// FIXME: This function is mostly duplicated in SemaCodeComplete.cpp; unify.
+static FunctionProtoTypeLoc getPrototypeLoc(Expr *Callee) {
----------------
nridge wrote:
> nridge wrote:
> > The reason I didn't unify them in this patch is less that I'm lazy, and more that I'm not sure where to put code that will be shared by SemaCodeComplete.cpp and clangd.
> >
> > Do we have some sort of dumping ground for miscellaneous AST utilities, like `clang-tools-extra/clangd/AST.h` but also usable in libSema?
> I guess the function is performing a heuristic / best-effort operation, so HeuristicResolver could be the place for it once that is upstreamed.
(I'm happy with this being where it is, for lack of a really good option)
I don't have a good answer here - sometimes people seem to dumb these as methods on `Expr` etc itself, but that seems terrible. `AST` is probably the best existing library for it if we want to use it from Sema, but it feels a little... impure.
It doesn't feel like a perfect fit for HeuristicResolver but in practice if we're going to move that into AST then it seems best overall for this function to come along for the ride.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D158249/new/
https://reviews.llvm.org/D158249
More information about the cfe-commits
mailing list