[PATCH] D108320: Add semantic token modifier for non-const reference parameter
Nathan Ridge via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 19 17:52:44 PDT 2021
nridge added inline comments.
================
Comment at: clang-tools-extra/clangd/SemanticHighlighting.cpp:538
+ for (size_t I = 0; I < FD->getNumParams(); ++I) {
+ if (const auto *Param = FD->getParamDecl(I)) {
+ auto T = Param->getType();
----------------
tom-anders wrote:
> sammccall wrote:
> > I feel like you'd be better off using the FunctionProtoType and iterating over argument types, rather than the argument declarations on a particular declaration of the function.
> >
> > e.g. this code is legal in C:
> > ```
> > int x(); // i suspect this is the canonical decl
> > int x(int); // but this one provides the type
> > ```
> > We don't have references in C of course!, but maybe similar issues lurking...
> I'm not really sure how to get from the CallExpr to the FunctionProtoType, can you give me a hint?
I think `FD->getType()->getAs<FunctionProtoType>()` should do it
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D108320/new/
https://reviews.llvm.org/D108320
More information about the cfe-commits
mailing list