Bladeren bron

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
Erich Keane 5 jaren geleden
bovenliggende
commit
53fd6e7e48
1 gewijzigde bestanden met toevoegingen van 5 en 1 verwijderingen
  1. 5 1
      lib/AST/DeclCXX.cpp

+ 5 - 1
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());