diff options
| author | Erich Keane <erich.keane@intel.com> | 2019-09-30 20:45:12 +0000 |
|---|---|---|
| committer | Erich Keane <erich.keane@intel.com> | 2019-09-30 20:45:12 +0000 |
| commit | a60ef724b4bbde8b33f62133a4ae3ef102ff6b71 (patch) | |
| tree | 74fc85d975884ae401c4fe082376ea6ee2131d6f | |
| parent | 24703284eab60c9bdd5d537da9ad92d69781ce18 (diff) | |
| download | bcm5719-llvm-a60ef724b4bbde8b33f62133a4ae3ef102ff6b71.tar.gz bcm5719-llvm-a60ef724b4bbde8b33f62133a4ae3ef102ff6b71.zip | |
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
| -rw-r--r-- | clang/lib/AST/DeclCXX.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/AST/DeclCXX.cpp b/clang/lib/AST/DeclCXX.cpp index 942588f4ede..5f181fa67de 100644 --- a/clang/lib/AST/DeclCXX.cpp +++ b/clang/lib/AST/DeclCXX.cpp @@ -1413,11 +1413,15 @@ NamedDecl* getLambdaCallOperatorHelper(const CXXRecordDecl &RD) { 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()); |

