git: 49a6e426df84 - main - Merge commit f5f3d5d6534f from llvm-project (by Qizhi Hu):
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 06 Apr 2024 20:19:21 UTC
The branch main has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=49a6e426df84eff1ae54905a02f66910a6a177d3 commit 49a6e426df84eff1ae54905a02f66910a6a177d3 Author: Dimitry Andric <dim@FreeBSD.org> AuthorDate: 2024-03-21 20:50:26 +0000 Commit: Dimitry Andric <dim@FreeBSD.org> CommitDate: 2024-04-06 20:14:31 +0000 Merge commit f5f3d5d6534f from llvm-project (by Qizhi Hu): [Clang][Sema] Fix a crash in lambda instantiation (#85565) Fix https://github.com/llvm/llvm-project/issues/85343 When build lambda expression in lambda instantiation, `ThisType` is required in `Sema::CheckCXXThisCapture` to build `this` capture. Set `this` type by import `Sema::CXXThisScopeRAII` and it will be used later in lambda expression transformation. Co-authored-by: huqizhi <836744285@qq.com> This fixes 'Assertion failed: (!isNull() && "Cannot retrieve a NULL type pointer"), function getCommonPtr" when building the x11-wm/wayfire port. PR: 276104 MFC after: 1 month --- contrib/llvm-project/clang/lib/Sema/TreeTransform.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/contrib/llvm-project/clang/lib/Sema/TreeTransform.h b/contrib/llvm-project/clang/lib/Sema/TreeTransform.h index e55e752b9cc3..2f012cade6b9 100644 --- a/contrib/llvm-project/clang/lib/Sema/TreeTransform.h +++ b/contrib/llvm-project/clang/lib/Sema/TreeTransform.h @@ -13516,6 +13516,16 @@ TreeTransform<Derived>::TransformLambdaExpr(LambdaExpr *E) { // Capturing 'this' is trivial. if (C->capturesThis()) { + // If this is a lambda that is part of a default member initialiser + // and which we're instantiating outside the class that 'this' is + // supposed to refer to, adjust the type of 'this' accordingly. + // + // Otherwise, leave the type of 'this' as-is. + Sema::CXXThisScopeRAII ThisScope( + getSema(), + dyn_cast_if_present<CXXRecordDecl>( + getSema().getFunctionLevelDeclContext()), + Qualifiers()); getSema().CheckCXXThisCapture(C->getLocation(), C->isExplicit(), /*BuildAndDiagnose*/ true, nullptr, C->getCaptureKind() == LCK_StarThis);