kadircet created this revision. kadircet added a reviewer: sammccall. kadircet requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits.
Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D96950 Files: clang/lib/Sema/SemaCodeComplete.cpp Index: clang/lib/Sema/SemaCodeComplete.cpp =================================================================== --- clang/lib/Sema/SemaCodeComplete.cpp +++ clang/lib/Sema/SemaCodeComplete.cpp @@ -5257,11 +5257,21 @@ // Peel off the ParenListExpr by chosing the last one, as they don't have a // predefined type. - if (auto *PLE = llvm::dyn_cast<ParenListExpr>(Base)) + if (auto *PLE = llvm::dyn_cast<ParenListExpr>(Base)) { + // FIXME: Get rid of this check once we are sure the ParenListExpr in here + // cannot be empty. This is assumed to ultimately be a chain of comma + // operators. We expect other ParenListExprs to be resolved to e.g. + // constructor calls before getting here. Same for OtherOpBase. + if (PLE->getNumExprs() == 0) + return; Base = PLE->getExpr(PLE->getNumExprs() - 1); + } if (OtherOpBase) { - if (auto *PLE = llvm::dyn_cast<ParenListExpr>(OtherOpBase)) + if (auto *PLE = llvm::dyn_cast<ParenListExpr>(OtherOpBase)) { + if (PLE->getNumExprs() == 0) + return; OtherOpBase = PLE->getExpr(PLE->getNumExprs() - 1); + } } ExprResult ConvertedBase = PerformMemberExprBaseConversion(Base, IsArrow); @@ -5698,8 +5708,15 @@ // If we have a ParenListExpr for LHS, peel it off by chosing the last expr. // As ParenListExprs don't have a predefined type. - if (auto *PLE = llvm::dyn_cast<ParenListExpr>(Fn)) + if (auto *PLE = llvm::dyn_cast<ParenListExpr>(Fn)) { + // FIXME: Get rid of this check once we are sure the ParenListExpr in here + // cannot be empty. This is assumed to ultimately be a chain of comma + // operators. We expect other ParenListExprs to be resolved to e.g. + // constructor calls before getting here. + if (PLE->getNumExprs() == 0) + return QualType(); Fn = PLE->getExpr(PLE->getNumExprs() - 1); + } // FIXME: Provide support for variadic template functions. // Ignore type-dependent call expressions entirely.
Index: clang/lib/Sema/SemaCodeComplete.cpp =================================================================== --- clang/lib/Sema/SemaCodeComplete.cpp +++ clang/lib/Sema/SemaCodeComplete.cpp @@ -5257,11 +5257,21 @@ // Peel off the ParenListExpr by chosing the last one, as they don't have a // predefined type. - if (auto *PLE = llvm::dyn_cast<ParenListExpr>(Base)) + if (auto *PLE = llvm::dyn_cast<ParenListExpr>(Base)) { + // FIXME: Get rid of this check once we are sure the ParenListExpr in here + // cannot be empty. This is assumed to ultimately be a chain of comma + // operators. We expect other ParenListExprs to be resolved to e.g. + // constructor calls before getting here. Same for OtherOpBase. + if (PLE->getNumExprs() == 0) + return; Base = PLE->getExpr(PLE->getNumExprs() - 1); + } if (OtherOpBase) { - if (auto *PLE = llvm::dyn_cast<ParenListExpr>(OtherOpBase)) + if (auto *PLE = llvm::dyn_cast<ParenListExpr>(OtherOpBase)) { + if (PLE->getNumExprs() == 0) + return; OtherOpBase = PLE->getExpr(PLE->getNumExprs() - 1); + } } ExprResult ConvertedBase = PerformMemberExprBaseConversion(Base, IsArrow); @@ -5698,8 +5708,15 @@ // If we have a ParenListExpr for LHS, peel it off by chosing the last expr. // As ParenListExprs don't have a predefined type. - if (auto *PLE = llvm::dyn_cast<ParenListExpr>(Fn)) + if (auto *PLE = llvm::dyn_cast<ParenListExpr>(Fn)) { + // FIXME: Get rid of this check once we are sure the ParenListExpr in here + // cannot be empty. This is assumed to ultimately be a chain of comma + // operators. We expect other ParenListExprs to be resolved to e.g. + // constructor calls before getting here. + if (PLE->getNumExprs() == 0) + return QualType(); Fn = PLE->getExpr(PLE->getNumExprs() - 1); + } // FIXME: Provide support for variadic template functions. // Ignore type-dependent call expressions entirely.
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits