[clang] [clang-tools-extra] [codegen] Emit cleanups for lifetime-extended temporaries when an expr contains control-flow (PR #80698)

2024-02-09 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 updated https://github.com/llvm/llvm-project/pull/80698 >From 28d90711ff8e4924135d4bd4e5f252d96ac41b93 Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Tue, 23 Jan 2024 20:18:25 + Subject: [PATCH 1/9] [misc-coroutine-hostile-raii] Use getOperand instead of getCom

[clang] [clang-tools-extra] [codegen] Emit cleanups for lifetime-extended temporaries when an expr contains control-flow (PR #80698)

2024-02-09 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 updated https://github.com/llvm/llvm-project/pull/80698 >From 28d90711ff8e4924135d4bd4e5f252d96ac41b93 Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Tue, 23 Jan 2024 20:18:25 + Subject: [PATCH 01/10] [misc-coroutine-hostile-raii] Use getOperand instead of getC

[clang] [clang-tools-extra] [codegen] Emit cleanups for lifetime-extended temporaries when an expr contains control-flow (PR #80698)

2024-02-12 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 edited https://github.com/llvm/llvm-project/pull/80698 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [codegen] Emit cleanups for lifetime-extended temporaries when an expr contains control-flow (PR #80698)

2024-02-12 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 updated https://github.com/llvm/llvm-project/pull/80698 >From 28d90711ff8e4924135d4bd4e5f252d96ac41b93 Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Tue, 23 Jan 2024 20:18:25 + Subject: [PATCH 01/11] [misc-coroutine-hostile-raii] Use getOperand instead of getC

[clang] [clang-tools-extra] [codegen] Emit cleanups for lifetime-extended temporaries when an expr contains control-flow (PR #80698)

2024-02-12 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 edited https://github.com/llvm/llvm-project/pull/80698 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [codegen] Emit missing cleanups when an expression contains a branch (PR #80698)

2024-02-12 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 edited https://github.com/llvm/llvm-project/pull/80698 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [codegen] Emit missing cleanups when an expression contains a branch (PR #80698)

2024-02-12 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 updated https://github.com/llvm/llvm-project/pull/80698 >From 28d90711ff8e4924135d4bd4e5f252d96ac41b93 Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Tue, 23 Jan 2024 20:18:25 + Subject: [PATCH 01/12] [misc-coroutine-hostile-raii] Use getOperand instead of getC

[clang] [clang-tools-extra] [codegen] Emit missing cleanups when an expression contains a branch (PR #80698)

2024-02-12 Thread Utkarsh Saxena via cfe-commits
usx95 wrote: I updated the patch to work for all the initializations that were missing cleanups due to branch in an expression. https://github.com/llvm/llvm-project/pull/80698 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.

[clang] [clang-tools-extra] [codegen] Emit missing cleanups when an expression contains a branch (PR #80698)

2024-02-12 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 updated https://github.com/llvm/llvm-project/pull/80698 >From 28d90711ff8e4924135d4bd4e5f252d96ac41b93 Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Tue, 23 Jan 2024 20:18:25 + Subject: [PATCH 01/13] [misc-coroutine-hostile-raii] Use getOperand instead of getC

[clang] [clang-tools-extra] [codegen] Emit missing cleanups when an expression contains a branch (PR #80698)

2024-02-12 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 edited https://github.com/llvm/llvm-project/pull/80698 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [codegen] Emit missing cleanups when an expression contains a branch (PR #80698)

2024-02-12 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 edited https://github.com/llvm/llvm-project/pull/80698 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [codegen] Emit missing cleanups when an expression contains a branch (PR #80698)

2024-02-12 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 edited https://github.com/llvm/llvm-project/pull/80698 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [codegen] Emit missing cleanups when an expression contains a branch (PR #80698)

2024-02-12 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 edited https://github.com/llvm/llvm-project/pull/80698 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [codegen] Emit missing cleanups when an expression contains a branch (PR #80698)

2024-02-12 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 edited https://github.com/llvm/llvm-project/pull/80698 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [codegen] Emit missing cleanups when an expression contains a branch (PR #80698)

2024-02-13 Thread Utkarsh Saxena via cfe-commits
@@ -592,10 +590,14 @@ void AggExprEmitter::EmitArrayInit(Address DestPtr, llvm::ArrayType *AType, // observed to be unnecessary. if (endOfInit.isValid()) Builder.CreateStore(element, endOfInit); } - -LValue elementLV = CGF.MakeAddrLValue( -Address(e

[clang] [clang-tools-extra] [codegen] Emit missing cleanups when an expression contains a branch (PR #80698)

2024-02-13 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 edited https://github.com/llvm/llvm-project/pull/80698 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [codegen] Emit missing cleanups when an expression contains a branch (PR #80698)

2024-02-13 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 edited https://github.com/llvm/llvm-project/pull/80698 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [codegen] Emit missing cleanups when an expression contains a branch (PR #80698)

2024-02-13 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 updated https://github.com/llvm/llvm-project/pull/80698 >From 28d90711ff8e4924135d4bd4e5f252d96ac41b93 Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Tue, 23 Jan 2024 20:18:25 + Subject: [PATCH 01/14] [misc-coroutine-hostile-raii] Use getOperand instead of getC

[clang] [clang-tools-extra] [codegen] Emit missing cleanups when an expression contains a branch (PR #80698)

2024-02-13 Thread Utkarsh Saxena via cfe-commits
@@ -627,9 +627,11 @@ CodeGenFunction::getJumpDestForLabel(const LabelDecl *D) { if (Dest.isValid()) return Dest; // Create, but don't insert, the new block. + // FIXME: We do not know `BranchInExprDepth` for the destination and currently + // emit *all* the BranchInExpr

[clang] [clang-tools-extra] [codegen] Emit missing cleanups when an expression contains a branch (PR #80698)

2024-02-13 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 edited https://github.com/llvm/llvm-project/pull/80698 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [codegen] Emit missing cleanups when an expression contains a branch (PR #80698)

2024-02-28 Thread Utkarsh Saxena via cfe-commits
usx95 wrote: I tried using the EHCleanups as the only source of cleanups for these branch-in-expr. https://github.com/llvm/llvm-project/pull/83224 is an attempt. I do not like it very much. The first challenge is to add these cleanups to the stack even when exceptions are disabled. Some of th

[clang] [coroutine] Suppress unreachable-code warning on coroutine statements. (PR #77454)

2024-02-01 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 edited https://github.com/llvm/llvm-project/pull/77454 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [coroutine] Suppress unreachable-code warning on coroutine statements. (PR #77454)

2024-02-01 Thread Utkarsh Saxena via cfe-commits
@@ -453,26 +454,68 @@ bool DeadCodeScan::isDeadCodeRoot(const clang::CFGBlock *Block) { return isDeadRoot; } -static bool isValidDeadStmt(const Stmt *S) { +// Check if the given `DeadStmt` is a coroutine statement and is a substmt of +// the coroutine statement. +static boo

[clang] [coroutine] Suppress unreachable-code warning on coroutine statements. (PR #77454)

2024-02-01 Thread Utkarsh Saxena via cfe-commits
@@ -0,0 +1,65 @@ +// RUN: %clang_cc1 -triple x86_64-unknown-unknown %s -std=c++20 -fsyntax-only -verify -Wunreachable-code + +#include "Inputs/std-coroutine.h" + +extern void abort (void) __attribute__ ((__noreturn__)); + +struct task { + struct promise_type { +std::suspend_

[clang] [coroutine] Suppress unreachable-code warning on coroutine statements. (PR #77454)

2024-02-01 Thread Utkarsh Saxena via cfe-commits
@@ -493,26 +454,68 @@ bool DeadCodeScan::isDeadCodeRoot(const clang::CFGBlock *Block) { return isDeadRoot; } -static bool isValidDeadStmt(const Stmt *S) { +// Check if the given `DeadStmt` is a coroutine statement and is a substmt of +// the coroutine statement. ---

[clang] [coroutine] Suppress unreachable-code warning on coroutine statements. (PR #77454)

2024-02-01 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 commented: Skipping coroutine statements SG. Change mostly LG. Left few comments. https://github.com/llvm/llvm-project/pull/77454 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/l

[clang] [coroutine] Suppress unreachable-code warning on coroutine statements. (PR #77454)

2024-02-01 Thread Utkarsh Saxena via cfe-commits
@@ -493,26 +454,68 @@ bool DeadCodeScan::isDeadCodeRoot(const clang::CFGBlock *Block) { return isDeadRoot; } -static bool isValidDeadStmt(const Stmt *S) { +// Check if the given `DeadStmt` is a coroutine statement and is a substmt of +// the coroutine statement. +static boo

[clang] [coroutine] Suppress unreachable-code warning on coroutine statements. (PR #77454)

2024-02-01 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 edited https://github.com/llvm/llvm-project/pull/77454 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [coroutine] Suppress unreachable-code warning on coroutine statements. (PR #77454)

2024-02-01 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 edited https://github.com/llvm/llvm-project/pull/77454 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [coroutine] Suppress unreachable-code warning on coroutine statements. (PR #77454)

2024-02-01 Thread Utkarsh Saxena via cfe-commits
@@ -453,26 +454,68 @@ bool DeadCodeScan::isDeadCodeRoot(const clang::CFGBlock *Block) { return isDeadRoot; } -static bool isValidDeadStmt(const Stmt *S) { +// Check if the given `DeadStmt` is a coroutine statement and is a substmt of +// the coroutine statement. +static boo

[clang] [coroutine] Suppress unreachable-code warning on coroutine statements. (PR #77454)

2024-02-01 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 edited https://github.com/llvm/llvm-project/pull/77454 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [coroutine] Suppress unreachable-code warning on coroutine statements. (PR #77454)

2024-02-02 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 approved this pull request. LGTM. Thanks. https://github.com/llvm/llvm-project/pull/77454 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [coroutine] Suppress unreachable-code warning on coroutine statements. (PR #77454)

2024-02-02 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 edited https://github.com/llvm/llvm-project/pull/77454 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [coroutine] Suppress unreachable-code warning on coroutine statements. (PR #77454)

2024-02-02 Thread Utkarsh Saxena via cfe-commits
@@ -33,33 +40,37 @@ task test3() { task test4() { abort(); - 1; // expected-warning {{code will never be executed}} + 1; // expected-warning {{code will never be executed}} co_return; } - task test5() { abort(); - co_await std::suspend_never{}; + co_await 1;

[clang] [coroutine] Suppress unreachable-code warning on coroutine statements. (PR #77454)

2024-02-02 Thread Utkarsh Saxena via cfe-commits
@@ -12,6 +12,13 @@ struct task { std::suspend_always yield_value(int) { return {}; } task get_return_object(); void unhandled_exception(); + +struct Awaiter { + bool await_ready(); + void await_suspend(auto); + int await_resume(); +}; +aut

[clang] [coroutine] Suppress unreachable-code warning on coroutine statements. (PR #77454)

2024-02-02 Thread Utkarsh Saxena via cfe-commits
@@ -453,26 +454,68 @@ bool DeadCodeScan::isDeadCodeRoot(const clang::CFGBlock *Block) { return isDeadRoot; } -static bool isValidDeadStmt(const Stmt *S) { +// Check if the given `DeadStmt` is a coroutine statement and is a substmt of +// the coroutine statement. +static boo

[clang] [coroutine] Suppress unreachable-code warning on coroutine statements. (PR #77454)

2024-02-02 Thread Utkarsh Saxena via cfe-commits
@@ -12,6 +12,13 @@ struct task { std::suspend_always yield_value(int) { return {}; } task get_return_object(); void unhandled_exception(); + +struct Awaiter { + bool await_ready(); + void await_suspend(auto); + int await_resume(); +}; +aut

[clang] [clang-tools-extra] [llvm] [codegen] Emit cleanups for lifetime-extended temporaries when stmt-expr has control-flow (PR #80698)

2024-02-05 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 created https://github.com/llvm/llvm-project/pull/80698 Partially solves https://github.com/llvm/llvm-project/issues/63818 for control flow in braced aggregate initialisation. The reason why we miss cleanups for temporaries in braced aggregate init is that the lifetime

[clang] [clang-tools-extra] [llvm] [codegen] Emit cleanups for lifetime-extended temporaries when an expr contains control-flow (PR #80698)

2024-02-05 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 edited https://github.com/llvm/llvm-project/pull/80698 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [llvm] [codegen] Emit cleanups for lifetime-extended temporaries when an expr contains control-flow (PR #80698)

2024-02-05 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 edited https://github.com/llvm/llvm-project/pull/80698 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [clang-tools-extra] [codegen] Emit cleanups for lifetime-extended temporaries when an expr contains control-flow (PR #80698)

2024-02-06 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 edited https://github.com/llvm/llvm-project/pull/80698 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [misc-coroutine-hostile-raii] Use getOperand instead of getCommonExpr. (PR #79206)

2024-01-23 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 created https://github.com/llvm/llvm-project/pull/79206 We were previously allowlisting awaitable types returned by `await_transform` instead of the type of the operand of the `co_await` expression. >From 28d90711ff8e4924135d4bd4e5f252d96ac41b93 Mon Sep 17 00:00:00 2001

[clang] [llvm] [clang-tools-extra] [misc-coroutine-hostile-raii] Use getOperand instead of getCommonExpr. (PR #79206)

2024-01-23 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 updated https://github.com/llvm/llvm-project/pull/79206 >From 28d90711ff8e4924135d4bd4e5f252d96ac41b93 Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Tue, 23 Jan 2024 20:18:25 + Subject: [PATCH] [misc-coroutine-hostile-raii] Use getOperand instead of getCommonE

[clang-tools-extra] [clang] [llvm] [misc-coroutine-hostile-raii] Use getOperand instead of getCommonExpr. (PR #79206)

2024-01-23 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 edited https://github.com/llvm/llvm-project/pull/79206 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [clang-tools-extra] [misc-coroutine-hostile-raii] Use getOperand instead of getCommonExpr. (PR #79206)

2024-01-23 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 ready_for_review https://github.com/llvm/llvm-project/pull/79206 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [llvm] [clang] [misc-coroutine-hostile-raii] Use getOperand instead of getCommonExpr. (PR #79206)

2024-01-23 Thread Utkarsh Saxena via cfe-commits
usx95 wrote: Thanks. This is trivial and might not require another pair of eyes. https://github.com/llvm/llvm-project/pull/79206 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [llvm] [clang] [misc-coroutine-hostile-raii] Use getOperand instead of getCommonExpr. (PR #79206)

2024-01-23 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 closed https://github.com/llvm/llvm-project/pull/79206 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Reapply Handle templated operators with reversed arguments (PR #72213)

2024-01-11 Thread Utkarsh Saxena via cfe-commits
usx95 wrote: All the blockers to land this have been addressed. Since this is not approved, does it look fine to land @ilya-biryukov ? https://github.com/llvm/llvm-project/pull/72213 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://list

[clang] [clang] Reapply Handle templated operators with reversed arguments (PR #72213)

2024-01-12 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 updated https://github.com/llvm/llvm-project/pull/72213 >From b0183f23ffad814080e82c725ee4cb7902aea23f Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Fri, 12 Jan 2024 13:38:15 + Subject: [PATCH] rebase --- clang/docs/ReleaseNotes.rst | 21 +++

[clang] [clang] Reapply Handle templated operators with reversed arguments (PR #72213)

2024-01-12 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 reopened https://github.com/llvm/llvm-project/pull/72213 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Reapply Handle templated operators with reversed arguments (PR #72213)

2024-01-12 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 updated https://github.com/llvm/llvm-project/pull/72213 >From b0183f23ffad814080e82c725ee4cb7902aea23f Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Fri, 12 Jan 2024 13:38:15 + Subject: [PATCH 1/2] rebase --- clang/docs/ReleaseNotes.rst | 21

[clang] [clang] Reapply Handle templated operators with reversed arguments (PR #72213)

2024-01-12 Thread Utkarsh Saxena via cfe-commits
@@ -10088,9 +10088,13 @@ static bool allowAmbiguity(ASTContext &Context, const FunctionDecl *F1, const FunctionDecl *F2) { if (declaresSameEntity(F1, F2)) return true; - if (F1->isTemplateInstantiation() && F2->isTemplateInstantiation() && -

[clang] [clang] Reapply Handle templated operators with reversed arguments (PR #72213)

2024-01-12 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 updated https://github.com/llvm/llvm-project/pull/72213 >From b0183f23ffad814080e82c725ee4cb7902aea23f Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Fri, 12 Jan 2024 13:38:15 + Subject: [PATCH 1/4] rebase --- clang/docs/ReleaseNotes.rst | 21

[clang] [clang] Reapply Handle templated operators with reversed arguments (PR #72213)

2024-01-12 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 closed https://github.com/llvm/llvm-project/pull/72213 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [coroutines][coro_lifetimebound] Detect lifetime issues with lambda captures (PR #77066)

2024-01-12 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 updated https://github.com/llvm/llvm-project/pull/77066 >From 3e0d0ab6c4fc6cba68285816a95e423bc18e8e55 Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Fri, 5 Jan 2024 10:11:20 +0100 Subject: [PATCH 1/6] [coroutines] Detect lifetime issues with coroutine lambda captu

[clang] [coroutines][coro_lifetimebound] Detect lifetime issues with lambda captures (PR #77066)

2024-01-12 Thread Utkarsh Saxena via cfe-commits
@@ -297,6 +297,26 @@ struct ReadySuspendResumeResult { bool IsInvalid; }; +// Adds [[clang::coro_wrapper]] and [[clang::coro_disable_lifetimebound]] +// attributes to `get_return_object`. +static void handleGetReturnObject(Sema &S, MemberExpr *ME) { + if (!ME || !ME->getMem

[clang] [coroutines][coro_lifetimebound] Detect lifetime issues with lambda captures (PR #77066)

2024-01-12 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 updated https://github.com/llvm/llvm-project/pull/77066 >From 3e0d0ab6c4fc6cba68285816a95e423bc18e8e55 Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Fri, 5 Jan 2024 10:11:20 +0100 Subject: [PATCH 1/7] [coroutines] Detect lifetime issues with coroutine lambda captu

[clang] Recognize friend operator != to fix ambiguity with operator== (PR #70217)

2024-01-13 Thread Utkarsh Saxena via cfe-commits
usx95 wrote: Will wait for the EWG to give final guidance. https://github.com/llvm/llvm-project/pull/70217 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Recognize friend operator != to fix ambiguity with operator== (PR #70217)

2024-01-13 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 closed https://github.com/llvm/llvm-project/pull/70217 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [coroutines][coro_lifetimebound] Detect lifetime issues with lambda captures (PR #77066)

2024-01-15 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 updated https://github.com/llvm/llvm-project/pull/77066 >From 3e0d0ab6c4fc6cba68285816a95e423bc18e8e55 Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Fri, 5 Jan 2024 10:11:20 +0100 Subject: [PATCH 1/8] [coroutines] Detect lifetime issues with coroutine lambda captu

[clang] [coroutines][coro_lifetimebound] Detect lifetime issues with lambda captures (PR #77066)

2024-01-15 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 updated https://github.com/llvm/llvm-project/pull/77066 >From 3e0d0ab6c4fc6cba68285816a95e423bc18e8e55 Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Fri, 5 Jan 2024 10:11:20 +0100 Subject: [PATCH 1/9] [coroutines] Detect lifetime issues with coroutine lambda captu

[clang] [coroutines][coro_lifetimebound] Detect lifetime issues with lambda captures (PR #77066)

2024-01-15 Thread Utkarsh Saxena via cfe-commits
@@ -33,6 +34,7 @@ #include "llvm/ADT/SmallString.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringExtras.h" +#include "llvm/Support/Casting.h" usx95 wrote: Removed. https://github.com/llvm/llvm-project/pull/77066 _

[clang] [coroutines][coro_lifetimebound] Detect lifetime issues with lambda captures (PR #77066)

2024-01-15 Thread Utkarsh Saxena via cfe-commits
@@ -15845,8 +15845,10 @@ void Sema::CheckCoroutineWrapper(FunctionDecl *FD) { RecordDecl *RD = FD->getReturnType()->getAsRecordDecl(); if (!RD || !RD->getUnderlyingDecl()->hasAttr()) return; - // Allow `get_return_object()`. - if (FD->getDeclName().isIdentifier() && +

[clang] [coroutines][coro_lifetimebound] Detect lifetime issues with lambda captures (PR #77066)

2024-01-15 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 updated https://github.com/llvm/llvm-project/pull/77066 >From 3e0d0ab6c4fc6cba68285816a95e423bc18e8e55 Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Fri, 5 Jan 2024 10:11:20 +0100 Subject: [PATCH 01/10] [coroutines] Detect lifetime issues with coroutine lambda cap

[clang] [coroutines][coro_lifetimebound] Detect lifetime issues with lambda captures (PR #77066)

2024-01-15 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 updated https://github.com/llvm/llvm-project/pull/77066 >From 3e0d0ab6c4fc6cba68285816a95e423bc18e8e55 Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Fri, 5 Jan 2024 10:11:20 +0100 Subject: [PATCH 01/11] [coroutines] Detect lifetime issues with coroutine lambda cap

[clang] [coroutines][coro_lifetimebound] Detect lifetime issues with lambda captures (PR #77066)

2024-01-15 Thread Utkarsh Saxena via cfe-commits
@@ -15845,8 +15845,10 @@ void Sema::CheckCoroutineWrapper(FunctionDecl *FD) { RecordDecl *RD = FD->getReturnType()->getAsRecordDecl(); if (!RD || !RD->getUnderlyingDecl()->hasAttr()) return; - // Allow `get_return_object()`. - if (FD->getDeclName().isIdentifier() && +

[clang] [coroutines][coro_lifetimebound] Detect lifetime issues with lambda captures (PR #77066)

2024-01-15 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 edited https://github.com/llvm/llvm-project/pull/77066 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [coroutines][coro_lifetimebound] Detect lifetime issues with lambda captures (PR #77066)

2024-01-16 Thread Utkarsh Saxena via cfe-commits
@@ -15845,8 +15845,10 @@ void Sema::CheckCoroutineWrapper(FunctionDecl *FD) { RecordDecl *RD = FD->getReturnType()->getAsRecordDecl(); if (!RD || !RD->getUnderlyingDecl()->hasAttr()) return; - // Allow `get_return_object()`. - if (FD->getDeclName().isIdentifier() && +

[clang] [coroutines][coro_lifetimebound] Detect lifetime issues with lambda captures (PR #77066)

2024-01-16 Thread Utkarsh Saxena via cfe-commits
@@ -7575,15 +7577,27 @@ static void visitLifetimeBoundArguments(IndirectLocalPath &Path, Expr *Call, Path.pop_back(); }; - if (ObjectArg && implicitObjectParamIsLifetimeBound(Callee)) -VisitLifetimeBoundArg(Callee, ObjectArg); - bool CheckCoroCall = false; if

[clang] [coroutines][coro_lifetimebound] Detect lifetime issues with lambda captures (PR #77066)

2024-01-16 Thread Utkarsh Saxena via cfe-commits
@@ -15845,8 +15845,10 @@ void Sema::CheckCoroutineWrapper(FunctionDecl *FD) { RecordDecl *RD = FD->getReturnType()->getAsRecordDecl(); if (!RD || !RD->getUnderlyingDecl()->hasAttr()) return; - // Allow `get_return_object()`. - if (FD->getDeclName().isIdentifier() && +

[clang] [coroutines][coro_lifetimebound] Detect lifetime issues with lambda captures (PR #77066)

2024-01-16 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 edited https://github.com/llvm/llvm-project/pull/77066 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [coroutines][coro_lifetimebound] Detect lifetime issues with lambda captures (PR #77066)

2024-01-16 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 updated https://github.com/llvm/llvm-project/pull/77066 >From 3e0d0ab6c4fc6cba68285816a95e423bc18e8e55 Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Fri, 5 Jan 2024 10:11:20 +0100 Subject: [PATCH 01/12] [coroutines] Detect lifetime issues with coroutine lambda cap

[clang] [coroutines][coro_lifetimebound] Detect lifetime issues with lambda captures (PR #77066)

2024-01-16 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 updated https://github.com/llvm/llvm-project/pull/77066 >From 3e0d0ab6c4fc6cba68285816a95e423bc18e8e55 Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Fri, 5 Jan 2024 10:11:20 +0100 Subject: [PATCH 01/13] [coroutines] Detect lifetime issues with coroutine lambda cap

[clang] [coroutines][coro_lifetimebound] Detect lifetime issues with lambda captures (PR #77066)

2024-01-16 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 updated https://github.com/llvm/llvm-project/pull/77066 >From 3e0d0ab6c4fc6cba68285816a95e423bc18e8e55 Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Fri, 5 Jan 2024 10:11:20 +0100 Subject: [PATCH 01/14] [coroutines] Detect lifetime issues with coroutine lambda cap

[clang] [coroutines][coro_lifetimebound] Detect lifetime issues with lambda captures (PR #77066)

2024-01-17 Thread Utkarsh Saxena via cfe-commits
@@ -15845,8 +15845,10 @@ void Sema::CheckCoroutineWrapper(FunctionDecl *FD) { RecordDecl *RD = FD->getReturnType()->getAsRecordDecl(); if (!RD || !RD->getUnderlyingDecl()->hasAttr()) return; - // Allow `get_return_object()`. - if (FD->getDeclName().isIdentifier() && +

[clang] [coroutines][coro_lifetimebound] Detect lifetime issues with lambda captures (PR #77066)

2024-01-17 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 updated https://github.com/llvm/llvm-project/pull/77066 >From 3e0d0ab6c4fc6cba68285816a95e423bc18e8e55 Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Fri, 5 Jan 2024 10:11:20 +0100 Subject: [PATCH 01/15] [coroutines] Detect lifetime issues with coroutine lambda cap

[clang] [coroutines][coro_lifetimebound] Detect lifetime issues with lambda captures (PR #77066)

2024-01-17 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 edited https://github.com/llvm/llvm-project/pull/77066 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [coroutines][coro_lifetimebound] Detect lifetime issues with lambda captures (PR #77066)

2024-01-17 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 edited https://github.com/llvm/llvm-project/pull/77066 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [coroutines][coro_lifetimebound] Detect lifetime issues with lambda captures (PR #77066)

2024-01-18 Thread Utkarsh Saxena via cfe-commits
@@ -11220,6 +11220,11 @@ class Sema final { VarDecl *buildCoroutinePromise(SourceLocation Loc); void CheckCompletedCoroutineBody(FunctionDecl *FD, Stmt *&Body); + // Heuristically tells if the function is get_return_object by matching usx95 wrote: Both d

[clang] [coroutines][coro_lifetimebound] Detect lifetime issues with lambda captures (PR #77066)

2024-01-18 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 updated https://github.com/llvm/llvm-project/pull/77066 >From 3e0d0ab6c4fc6cba68285816a95e423bc18e8e55 Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Fri, 5 Jan 2024 10:11:20 +0100 Subject: [PATCH 01/16] [coroutines] Detect lifetime issues with coroutine lambda cap

[clang] [coroutines][coro_lifetimebound] Detect lifetime issues with lambda captures (PR #77066)

2024-01-18 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 updated https://github.com/llvm/llvm-project/pull/77066 >From 3e0d0ab6c4fc6cba68285816a95e423bc18e8e55 Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Fri, 5 Jan 2024 10:11:20 +0100 Subject: [PATCH 01/17] [coroutines] Detect lifetime issues with coroutine lambda cap

[clang] [coroutines][coro_lifetimebound] Detect lifetime issues with lambda captures (PR #77066)

2024-01-18 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 closed https://github.com/llvm/llvm-project/pull/77066 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [coroutine] Create coroutine body in the correct eval context (PR #78589)

2024-01-18 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 created https://github.com/llvm/llvm-project/pull/78589 Fixes: https://github.com/llvm/llvm-project/issues/78290 See the bug for more context. ``` Gen ACoroutine() { if constexpr (0) // remove it make clang compile. co_return; co_await Gen{}; } ``` We miss symbol

[clang] [coroutine] Create coroutine body in the correct eval context (PR #78589)

2024-01-18 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 updated https://github.com/llvm/llvm-project/pull/78589 >From 07c6ad92fda63e69489933b5cededf8f03a68ef3 Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Thu, 18 Jan 2024 14:38:22 + Subject: [PATCH 1/2] [coroutine] Create coroutine body in the correct eval context

[clang] [coroutine] Create coroutine body in the correct eval context (PR #78589)

2024-01-18 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 edited https://github.com/llvm/llvm-project/pull/78589 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [coroutine] Create coroutine body in the correct eval context (PR #78589)

2024-01-18 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 updated https://github.com/llvm/llvm-project/pull/78589 >From 07c6ad92fda63e69489933b5cededf8f03a68ef3 Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Thu, 18 Jan 2024 14:38:22 + Subject: [PATCH 1/3] [coroutine] Create coroutine body in the correct eval context

[clang] [coroutine] Create coroutine body in the correct eval context (PR #78589)

2024-01-18 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 updated https://github.com/llvm/llvm-project/pull/78589 >From 07c6ad92fda63e69489933b5cededf8f03a68ef3 Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Thu, 18 Jan 2024 14:38:22 + Subject: [PATCH 1/4] [coroutine] Create coroutine body in the correct eval context

[clang] [coroutine] Create coroutine body in the correct eval context (PR #78589)

2024-01-18 Thread Utkarsh Saxena via cfe-commits
usx95 wrote: Added release notes and fix new line. https://github.com/llvm/llvm-project/pull/78589 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [coroutine] Create coroutine body in the correct eval context (PR #78589)

2024-01-18 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 updated https://github.com/llvm/llvm-project/pull/78589 >From 07c6ad92fda63e69489933b5cededf8f03a68ef3 Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Thu, 18 Jan 2024 14:38:22 + Subject: [PATCH 1/5] [coroutine] Create coroutine body in the correct eval context

[clang] [coroutine] Create coroutine body in the correct eval context (PR #78589)

2024-01-18 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 updated https://github.com/llvm/llvm-project/pull/78589 >From 07c6ad92fda63e69489933b5cededf8f03a68ef3 Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Thu, 18 Jan 2024 14:38:22 + Subject: [PATCH 1/6] [coroutine] Create coroutine body in the correct eval context

[clang] [coroutine] Create coroutine body in the correct eval context (PR #78589)

2024-01-18 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 closed https://github.com/llvm/llvm-project/pull/78589 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [coroutine] Suppress unreachable-code warning on coroutine statements. (PR #77454)

2024-01-19 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 updated https://github.com/llvm/llvm-project/pull/77454 >From 3d7d3e5e5bc613637cb019e5e370654e0c58b5cd Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Tue, 9 Jan 2024 12:29:45 +0100 Subject: [PATCH 1/2] [coroutine] Suppress unreachable-code warning on coroutine statemen

[clang] [coroutine] Suppress unreachable-code warning on coroutine statements. (PR #77454)

2024-01-19 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 edited https://github.com/llvm/llvm-project/pull/77454 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [coroutine] Suppress unreachable-code warning on coroutine statements. (PR #77454)

2024-01-19 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 requested changes to this pull request. This also disables the warning when it was actually correct. See comments. https://github.com/llvm/llvm-project/pull/77454 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://

[clang] [coroutine] Suppress unreachable-code warning on coroutine statements. (PR #77454)

2024-01-19 Thread Utkarsh Saxena via cfe-commits
@@ -0,0 +1,50 @@ +// RUN: %clang_cc1 -triple x86_64-unknown-unknown %s -std=c++20 -fsyntax-only -verify -Wunreachable-code + +#include "Inputs/std-coroutine.h" + +extern void abort (void) __attribute__ ((__noreturn__)); + +struct task { + struct promise_type { +std::suspend_

[clang] [coroutine] Suppress unreachable-code warning on coroutine statements. (PR #77454)

2024-01-19 Thread Utkarsh Saxena via cfe-commits
@@ -60,6 +61,45 @@ static bool isTrivialDoWhile(const CFGBlock *B, const Stmt *S) { return false; } +// Check if the block starts with a coroutine statement and see if the given +// unreachable 'S' is the substmt of the coroutine statement. +// +// We suppress the unreachab

[clang] [coroutine] Suppress unreachable-code warning on coroutine statements. (PR #77454)

2024-01-19 Thread Utkarsh Saxena via cfe-commits
@@ -60,6 +61,45 @@ static bool isTrivialDoWhile(const CFGBlock *B, const Stmt *S) { return false; } +// Check if the block starts with a coroutine statement and see if the given +// unreachable 'S' is the substmt of the coroutine statement. +// +// We suppress the unreachab

[clang] [coroutine] Suppress unreachable-code warning on coroutine statements. (PR #77454)

2024-01-19 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 edited https://github.com/llvm/llvm-project/pull/77454 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Correctly compute conversion seq for args to fn with reversed param order (PR #68999)

2023-10-18 Thread Utkarsh Saxena via cfe-commits
usx95 wrote: This breaks new code (expected) but does not respect `-Wno-ambiguous-reversed-operator`. https://godbolt.org/z/oMsGeK1nc @zygoloid IIUC this should be silenced by this warning but somehow does not. Will investigate further. Reverting to put out large unsuppresable breakages https

[clang] Correctly compute conversion seq for args to fn with reversed param order (PR #68999)

2023-10-18 Thread Utkarsh Saxena via cfe-commits
usx95 wrote: Ah. I see, this is because this is not a warning but hard errors in C++20. https://github.com/llvm/llvm-project/pull/68999 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

<    1   2   3   4   5   6   7   8   9   10   >