[clang] clangd: Show argument names for function pointer struct fields (PR #69011)
Nathan Ridge via cfe-commits
cfe-commits at lists.llvm.org
Sun Oct 22 21:20:58 PDT 2023
================
@@ -6133,7 +6133,17 @@ ProduceSignatureHelp(Sema &SemaRef, MutableArrayRef<ResultCandidate> Candidates,
// so that we can recover argument names from it.
static FunctionProtoTypeLoc GetPrototypeLoc(Expr *Fn) {
TypeLoc Target;
- if (const auto *T = Fn->getType().getTypePtr()->getAs<TypedefType>()) {
+
+ if (const auto *ME = dyn_cast<MemberExpr>(Fn)) {
+ const auto *MD = ME->getMemberDecl();
+ if (const auto *FD = dyn_cast<FieldDecl>(MD)) {
+ if (const auto *T = FD->getType().getTypePtr()->getAs<TypedefType>()) {
----------------
HighCommander4 wrote:
This case is actually handled by the `if (const auto *T = Fn->getType().getTypePtr()->getAs<TypedefType>())` branch, as long as it runs before the check for `MemberExpr`.
So:
* let's move the `MemberExpr` branch below the `DeclRefExpr` branch
* let's simplify it to omit this check for `TypedefType`
https://github.com/llvm/llvm-project/pull/69011
More information about the cfe-commits
mailing list