================
@@ -6292,11 +6298,16 @@ SemaCodeCompletion::ProduceCallSignatureHelp(Expr *Fn, 
ArrayRef<Expr *> Args,
         SmallVector<Expr *, 12> ArgExprs(1, NakedFn);
         ArgExprs.append(ArgsWithoutDependentTypes.begin(),
                         ArgsWithoutDependentTypes.end());
+        auto *const LambdaName =
+            DC->isLambda() ? 
cast<VarDecl>(NakedFn->getReferencedDeclOfCallee())
----------------
tilobyte wrote:

@erichkeane stepping through the test i added for a lambda returned from a 
function, `NakedFn->getReferencedDeclOfCallee()` returns `nullptr` in the case 
of a lambda returned from a function. i believe this is because `NakedFn` is an 
rvalue, so there is no referenced decl to get.
using `cast_if_present`/`dyn_cast_if_present` seems to cover that case.

@zyn0217 yes, you are correct that `NakedFn` is a `DeclRefExpr` referring to 
the `VarDecl` of the declaration. `dyn_cast_if_present` indeed works, though i 
wonder--if `NakedFn->getReferencedDeclOfCallee()` returns `nullptr` in the case 
of a lambda returned from a function, could we get away with just 
`cast_if_present`?

https://github.com/llvm/llvm-project/pull/101857
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to