Fix failure caused by r373247
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.
llvm-svn: 373259
diff --git a/clang/lib/AST/DeclCXX.cpp b/clang/lib/AST/DeclCXX.cpp
index 942588f..5f181fa 100644
--- a/clang/lib/AST/DeclCXX.cpp
+++ b/clang/lib/AST/DeclCXX.cpp
@@ -1413,11 +1413,15 @@
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());