From: Erich Keane Date: Mon, 30 Sep 2019 20:45:12 +0000 (+0000) Subject: Fix failure caused by r373247 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=53fd6e7e480eee70f1343fc14b394fbda67068a1;p=clang 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373259 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/DeclCXX.cpp b/lib/AST/DeclCXX.cpp index 942588f4ed..5f181fa67d 100644 --- a/lib/AST/DeclCXX.cpp +++ b/lib/AST/DeclCXX.cpp @@ -1413,11 +1413,15 @@ NamedDecl* getLambdaCallOperatorHelper(const CXXRecordDecl &RD) { FunctionTemplateDecl* CXXRecordDecl::getDependentLambdaCallOperator() const { NamedDecl *CallOp = getLambdaCallOperatorHelper(*this); - return dyn_cast(CallOp); + return dyn_cast_or_null(CallOp); } CXXMethodDecl *CXXRecordDecl::getLambdaCallOperator() const { NamedDecl *CallOp = getLambdaCallOperatorHelper(*this); + + if (CallOp == nullptr) + return nullptr; + if (const auto *CallOpTmpl = dyn_cast(CallOp)) return cast(CallOpTmpl->getTemplatedDecl());