I incorrectly thought that the 'isLambda' check never fired, so when
splitting up a helper function, I lost the 'nullptr' return value.
ClangD Hover functionality apparently uses this, so the Unittest caught
that.
This patch correctly propogates the nullptr from the helper function.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373259
91177308-0d34-0410-b5e6-
96231b3b80d8
FunctionTemplateDecl* CXXRecordDecl::getDependentLambdaCallOperator() const {
NamedDecl *CallOp = getLambdaCallOperatorHelper(*this);
- return dyn_cast<FunctionTemplateDecl>(CallOp);
+ return dyn_cast_or_null<FunctionTemplateDecl>(CallOp);
}
CXXMethodDecl *CXXRecordDecl::getLambdaCallOperator() const {
NamedDecl *CallOp = getLambdaCallOperatorHelper(*this);
+
+ if (CallOp == nullptr)
+ return nullptr;
+
if (const auto *CallOpTmpl = dyn_cast<FunctionTemplateDecl>(CallOp))
return cast<CXXMethodDecl>(CallOpTmpl->getTemplatedDecl());