[clang] [C++20][Coroutines] Lambda-coroutine with operator new in promise_type (PR #84193)

2024-04-02 Thread Andreas Fertig via cfe-commits
andreasfertig wrote: Hello all, I did more investigation and found another shortcoming. In some cases, my initial implementation picked the wrong `this`- type, for example, https://github.com/andreasfertig/llvm-project/blob/9c60fec6881cca7e7fed9dca5cf24a0bd1924eaa/clang/test/SemaCXX/coroutine-

[clang] [C++20][Coroutines] Lambda-coroutine with operator new in promise_type (PR #84193)

2024-04-02 Thread Chuanqi Xu via cfe-commits
ChuanqiXu9 wrote: Hi Andreas, thanks for looking into this. I am still confused about whether or not your new branch can fix the crash or not. For the question about the crash itself, I don't have any insight though, I feel like this is a defect in the code generator. I didn't understand why m

[clang] [C++20][Coroutines] Lambda-coroutine with operator new in promise_type (PR #84193)

2024-04-02 Thread Andreas Fertig via cfe-commits
andreasfertig wrote: Hello @ChuanqiXu9, > Hi Andreas, thanks for looking into this. I am still confused about whether > or not your new branch can fix the crash or not. It's my pleasure! The new branch doesn't fix the crash. If I understand why it is crashing, this branch is a better change c

[clang] [C++20][Coroutines] Lambda-coroutine with operator new in promise_type (PR #84193)

2024-03-06 Thread Andreas Fertig via cfe-commits
https://github.com/andreasfertig created https://github.com/llvm/llvm-project/pull/84193 Fix #84064 According to http://eel.is/c++draft/dcl.fct.def.coroutine#9 the first parameter for overload resolution of `operator new` is `size_t` followed by the arguments of the coroutine function. http:/

[clang] [C++20][Coroutines] Lambda-coroutine with operator new in promise_type (PR #84193)

2024-03-06 Thread Erich Keane via cfe-commits
@@ -6898,10 +6898,18 @@ class Sema final { BinaryOperatorKind Operator); ActOnCXXThis - Parse 'this' pointer. - ExprResult ActOnCXXThis(SourceLocation loc); + /// + /// \param SkipLambdaCaptureCheck Whether to skip the 'this' check

[clang] [C++20][Coroutines] Lambda-coroutine with operator new in promise_type (PR #84193)

2024-03-06 Thread Erich Keane via cfe-commits
@@ -1378,8 +1379,21 @@ bool CoroutineStmtBuilder::makeReturnOnAllocFailure() { static bool collectPlacementArgs(Sema &S, FunctionDecl &FD, SourceLocation Loc, SmallVectorImpl &PlacementArgs) { if (auto *MD = dyn_cast(&FD)) { -if (MD->isImp

[clang] [C++20][Coroutines] Lambda-coroutine with operator new in promise_type (PR #84193)

2024-03-06 Thread Erich Keane via cfe-commits
@@ -6898,10 +6898,18 @@ class Sema final { BinaryOperatorKind Operator); ActOnCXXThis - Parse 'this' pointer. - ExprResult ActOnCXXThis(SourceLocation loc); + /// + /// \param SkipLambdaCaptureCheck Whether to skip the 'this' check

[clang] [C++20][Coroutines] Lambda-coroutine with operator new in promise_type (PR #84193)

2024-03-06 Thread Andreas Fertig via cfe-commits
@@ -6898,10 +6898,18 @@ class Sema final { BinaryOperatorKind Operator); ActOnCXXThis - Parse 'this' pointer. - ExprResult ActOnCXXThis(SourceLocation loc); + /// + /// \param SkipLambdaCaptureCheck Whether to skip the 'this' check

[clang] [C++20][Coroutines] Lambda-coroutine with operator new in promise_type (PR #84193)

2024-03-06 Thread Erich Keane via cfe-commits
@@ -6898,10 +6898,18 @@ class Sema final { BinaryOperatorKind Operator); ActOnCXXThis - Parse 'this' pointer. - ExprResult ActOnCXXThis(SourceLocation loc); + /// + /// \param SkipLambdaCaptureCheck Whether to skip the 'this' check

[clang] [C++20][Coroutines] Lambda-coroutine with operator new in promise_type (PR #84193)

2024-03-06 Thread Andreas Fertig via cfe-commits
@@ -6898,10 +6898,18 @@ class Sema final { BinaryOperatorKind Operator); ActOnCXXThis - Parse 'this' pointer. - ExprResult ActOnCXXThis(SourceLocation loc); + /// + /// \param SkipLambdaCaptureCheck Whether to skip the 'this' check

[clang] [C++20][Coroutines] Lambda-coroutine with operator new in promise_type (PR #84193)

2024-03-06 Thread Andreas Fertig via cfe-commits
https://github.com/andreasfertig edited https://github.com/llvm/llvm-project/pull/84193 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [C++20][Coroutines] Lambda-coroutine with operator new in promise_type (PR #84193)

2024-03-06 Thread Andreas Fertig via cfe-commits
https://github.com/andreasfertig edited https://github.com/llvm/llvm-project/pull/84193 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [C++20][Coroutines] Lambda-coroutine with operator new in promise_type (PR #84193)

2024-03-06 Thread Chuanqi Xu via cfe-commits
@@ -6898,10 +6898,18 @@ class Sema final { BinaryOperatorKind Operator); ActOnCXXThis - Parse 'this' pointer. - ExprResult ActOnCXXThis(SourceLocation loc); + /// + /// \param SkipLambdaCaptureCheck Whether to skip the 'this' check

[clang] [C++20][Coroutines] Lambda-coroutine with operator new in promise_type (PR #84193)

2024-03-06 Thread Shafik Yaghmour via cfe-commits
@@ -0,0 +1,54 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -I%S/Inputs -std=c++20 %s + +// expected-no-diagnostics + +#include "std-coroutine.h" + +using size_t = decltype(sizeof(0)); + +struct Generator { + struct promise_type { +int _val{}; + +Generator get_return_objec

[clang] [C++20][Coroutines] Lambda-coroutine with operator new in promise_type (PR #84193)

2024-03-06 Thread Shafik Yaghmour via cfe-commits
@@ -1434,13 +1434,18 @@ ExprResult Sema::ActOnCXXThis(SourceLocation Loc) { return Diag(Loc, diag::err_invalid_this_use) << 0; } - return BuildCXXThisExpr(Loc, ThisTy, /*IsImplicit=*/false); + return BuildCXXThisExpr(Loc, ThisTy, /*IsImplicit=*/false, +

[clang] [C++20][Coroutines] Lambda-coroutine with operator new in promise_type (PR #84193)

2024-03-06 Thread Andreas Fertig via cfe-commits
@@ -6898,10 +6898,18 @@ class Sema final { BinaryOperatorKind Operator); ActOnCXXThis - Parse 'this' pointer. - ExprResult ActOnCXXThis(SourceLocation loc); + /// + /// \param SkipLambdaCaptureCheck Whether to skip the 'this' check

[clang] [C++20][Coroutines] Lambda-coroutine with operator new in promise_type (PR #84193)

2024-03-06 Thread Andreas Fertig via cfe-commits
@@ -0,0 +1,54 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -I%S/Inputs -std=c++20 %s + +// expected-no-diagnostics + +#include "std-coroutine.h" + +using size_t = decltype(sizeof(0)); + +struct Generator { + struct promise_type { +int _val{}; + +Generator get_return_objec

[clang] [C++20][Coroutines] Lambda-coroutine with operator new in promise_type (PR #84193)

2024-03-06 Thread Andreas Fertig via cfe-commits
@@ -1434,13 +1434,18 @@ ExprResult Sema::ActOnCXXThis(SourceLocation Loc) { return Diag(Loc, diag::err_invalid_this_use) << 0; } - return BuildCXXThisExpr(Loc, ThisTy, /*IsImplicit=*/false); + return BuildCXXThisExpr(Loc, ThisTy, /*IsImplicit=*/false, +

[clang] [C++20][Coroutines] Lambda-coroutine with operator new in promise_type (PR #84193)

2024-03-06 Thread Chuanqi Xu via cfe-commits
@@ -6898,10 +6898,18 @@ class Sema final { BinaryOperatorKind Operator); ActOnCXXThis - Parse 'this' pointer. - ExprResult ActOnCXXThis(SourceLocation loc); + /// + /// \param SkipLambdaCaptureCheck Whether to skip the 'this' check

[clang] [C++20][Coroutines] Lambda-coroutine with operator new in promise_type (PR #84193)

2024-03-06 Thread Vlad Serebrennikov via cfe-commits
https://github.com/Endilll commented: `Sema.h` changes look good. https://github.com/llvm/llvm-project/pull/84193 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [C++20][Coroutines] Lambda-coroutine with operator new in promise_type (PR #84193)

2024-03-06 Thread Chuanqi Xu via cfe-commits
https://github.com/ChuanqiXu9 approved this pull request. LGTM with the adding the comments. https://github.com/llvm/llvm-project/pull/84193 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-com

[clang] [C++20][Coroutines] Lambda-coroutine with operator new in promise_type (PR #84193)

2024-03-06 Thread Chuanqi Xu via cfe-commits
@@ -6898,10 +6898,18 @@ class Sema final { BinaryOperatorKind Operator); ActOnCXXThis - Parse 'this' pointer. - ExprResult ActOnCXXThis(SourceLocation loc); + /// + /// \param SkipLambdaCaptureCheck Whether to skip the 'this' check

[clang] [C++20][Coroutines] Lambda-coroutine with operator new in promise_type (PR #84193)

2024-03-07 Thread via cfe-commits
@@ -6898,10 +6898,18 @@ class Sema final { BinaryOperatorKind Operator); ActOnCXXThis - Parse 'this' pointer. - ExprResult ActOnCXXThis(SourceLocation loc); + /// + /// \param SkipLambdaCaptureCheck Whether to skip the 'this' check

[clang] [C++20][Coroutines] Lambda-coroutine with operator new in promise_type (PR #84193)

2024-03-08 Thread Andreas Fertig via cfe-commits
@@ -6898,10 +6898,18 @@ class Sema final { BinaryOperatorKind Operator); ActOnCXXThis - Parse 'this' pointer. - ExprResult ActOnCXXThis(SourceLocation loc); + /// + /// \param SkipLambdaCaptureCheck Whether to skip the 'this' check

[clang] [C++20][Coroutines] Lambda-coroutine with operator new in promise_type (PR #84193)

2024-03-08 Thread Andreas Fertig via cfe-commits
https://github.com/andreasfertig edited https://github.com/llvm/llvm-project/pull/84193 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [C++20][Coroutines] Lambda-coroutine with operator new in promise_type (PR #84193)

2024-03-08 Thread Andreas Fertig via cfe-commits
https://github.com/andreasfertig updated https://github.com/llvm/llvm-project/pull/84193 >From 680c99b2d832a5fad617f632df4a750f9c6f1cae Mon Sep 17 00:00:00 2001 From: Andreas Fertig Date: Wed, 6 Mar 2024 14:20:00 +0100 Subject: [PATCH] [C++20][Coroutines] Lambda-coroutine with operator new in

[clang] [C++20][Coroutines] Lambda-coroutine with operator new in promise_type (PR #84193)

2024-03-08 Thread Andreas Fertig via cfe-commits
@@ -1378,8 +1379,21 @@ bool CoroutineStmtBuilder::makeReturnOnAllocFailure() { static bool collectPlacementArgs(Sema &S, FunctionDecl &FD, SourceLocation Loc, SmallVectorImpl &PlacementArgs) { if (auto *MD = dyn_cast(&FD)) { -if (MD->isImp

[clang] [C++20][Coroutines] Lambda-coroutine with operator new in promise_type (PR #84193)

2024-03-08 Thread Andreas Fertig via cfe-commits
@@ -0,0 +1,54 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -I%S/Inputs -std=c++20 %s + +// expected-no-diagnostics + +#include "std-coroutine.h" + +using size_t = decltype(sizeof(0)); + +struct Generator { + struct promise_type { +int _val{}; + +Generator get_return_objec

[clang] [C++20][Coroutines] Lambda-coroutine with operator new in promise_type (PR #84193)

2024-03-08 Thread Andreas Fertig via cfe-commits
@@ -1434,13 +1434,18 @@ ExprResult Sema::ActOnCXXThis(SourceLocation Loc) { return Diag(Loc, diag::err_invalid_this_use) << 0; } - return BuildCXXThisExpr(Loc, ThisTy, /*IsImplicit=*/false); + return BuildCXXThisExpr(Loc, ThisTy, /*IsImplicit=*/false, +

[clang] [C++20][Coroutines] Lambda-coroutine with operator new in promise_type (PR #84193)

2024-03-08 Thread Andreas Fertig via cfe-commits
https://github.com/andreasfertig updated https://github.com/llvm/llvm-project/pull/84193 >From 9f8a741864b01e89ea17b5ea4c4296da27ef Mon Sep 17 00:00:00 2001 From: Andreas Fertig Date: Wed, 6 Mar 2024 14:20:00 +0100 Subject: [PATCH] [C++20][Coroutines] Lambda-coroutine with operator new in

[clang] [C++20][Coroutines] Lambda-coroutine with operator new in promise_type (PR #84193)

2024-03-08 Thread Andreas Fertig via cfe-commits
andreasfertig wrote: The clang-format check fails due to a change in `clang/docs/ReleaseNotes. rst`, which isn't mine. What's the protocol? Shall I fix the format issue, or can my change be merged anyway? https://github.com/llvm/llvm-project/pull/84193 _

[clang] [C++20][Coroutines] Lambda-coroutine with operator new in promise_type (PR #84193)

2024-03-08 Thread Erich Keane via cfe-commits
erichkeane wrote: > The clang-format check fails due to a change in `clang/docs/ReleaseNotes. > rst`, which isn't mine. What's the protocol? Shall I fix the format issue, or > can my change be merged anyway? Nope, don't worry about that one. That bot is being weird, feel free to merge withou

[clang] [C++20][Coroutines] Lambda-coroutine with operator new in promise_type (PR #84193)

2024-03-08 Thread via cfe-commits
cor3ntin wrote: @andreasfertig Will you need us to merge that for you? https://github.com/llvm/llvm-project/pull/84193 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [C++20][Coroutines] Lambda-coroutine with operator new in promise_type (PR #84193)

2024-03-08 Thread Andreas Fertig via cfe-commits
andreasfertig wrote: > @andreasfertig Will you need us to merge that for you? @cor3ntin: It looks like I need you, yes. I can only close the PR :-/ https://github.com/llvm/llvm-project/pull/84193 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [C++20][Coroutines] Lambda-coroutine with operator new in promise_type (PR #84193)

2024-03-08 Thread Erich Keane via cfe-commits
https://github.com/erichkeane closed https://github.com/llvm/llvm-project/pull/84193 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [C++20][Coroutines] Lambda-coroutine with operator new in promise_type (PR #84193)

2024-03-08 Thread via cfe-commits
github-actions[bot] wrote: @andreasfertig Congratulations on having your first Pull Request (PR) merged into the LLVM Project! Your changes will be combined with recent changes from other authors, then tested by our [build bots](https://lab.llvm.org/buildbot/). If there is a problem with a

[clang] [C++20][Coroutines] Lambda-coroutine with operator new in promise_type (PR #84193)

2024-03-11 Thread Chuanqi Xu via cfe-commits
ChuanqiXu9 wrote: This commit breaks our coroutines library async_simple `https://github.com/alibaba/async_simple` and here is a (relative) minimal reproducer: https://godbolt.org/z/sG5jzcGEz The reproducer comes from an implementation for async_simple::Generator (https://github.com/alibaba/a

[clang] [C++20][Coroutines] Lambda-coroutine with operator new in promise_type (PR #84193)

2024-03-11 Thread Andreas Fertig via cfe-commits
andreasfertig wrote: Interesting! I'll see what I can do. https://github.com/llvm/llvm-project/pull/84193 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits