[clang] Surface error for plain return statement in coroutine earlier (PR #100985)

2024-08-02 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov closed https://github.com/llvm/llvm-project/pull/100985 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Surface error for plain return statement in coroutine earlier (PR #100985)

2024-08-02 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov updated https://github.com/llvm/llvm-project/pull/100985 >From d35544d971f073f98fba047cfcbe3cfe92dd78c4 Mon Sep 17 00:00:00 2001 From: Ivana Ivanovska Date: Mon, 29 Jul 2024 08:08:00 + Subject: [PATCH 1/4] Surface error for plain return statement in

[clang] Surface error for plain return statement in coroutine earlier (PR #100985)

2024-08-02 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov approved this pull request. Thanks! The changes LG, I'll wait until premerge checks finish and merge it into mainline. https://github.com/llvm/llvm-project/pull/100985 ___ cfe-commits mailing list

[clang] Surface error for plain return statement in coroutine earlier (PR #100985)

2024-08-01 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov edited https://github.com/llvm/llvm-project/pull/100985 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Surface error for plain return statement in coroutine earlier (PR #100985)

2024-08-01 Thread Ilya Biryukov via cfe-commits
@@ -684,6 +684,19 @@ bool Sema::checkFinalSuspendNoThrow(const Stmt *FinalSuspend) { return ThrowingDecls.empty(); } +// [stmt.return.coroutine]p1: +// A coroutine shall not enclose a return statement ([stmt.return]). +static void checkReturnStmtInCoroutine(Sema ,

[clang] Surface error for plain return statement in coroutine earlier (PR #100985)

2024-08-01 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov requested changes to this pull request. The `assert` condition seems wrong, otherwise this should be good to go. I've also left one more suggestion to leave a comment that I missed in the original review since we need another round anyway.

[clang] Surface error for plain return statement in coroutine earlier (PR #100985)

2024-08-01 Thread Ilya Biryukov via cfe-commits
@@ -694,6 +707,9 @@ bool Sema::ActOnCoroutineBodyStart(Scope *SC, SourceLocation KWLoc, auto *ScopeInfo = getCurFunction(); assert(ScopeInfo->CoroutinePromise); + if (ScopeInfo->FirstCoroutineStmtLoc == KWLoc) ilya-biryukov wrote: NIT: add a comment

[clang] Surface error for plain return statement in coroutine earlier (PR #100985)

2024-08-01 Thread Ilya Biryukov via cfe-commits
@@ -291,6 +318,50 @@ void mixed_coreturn_template2(bool b, T) { return; // expected-error {{not allowed in coroutine}} } +struct promise_handle; + +struct Handle : std::coroutine_handle { // expected-note 4{{not viable}} +// expected-note@-1 4{{not viable}} +

[clang] Surface error for plain return statement in coroutine earlier (PR #100985)

2024-08-01 Thread Ilya Biryukov via cfe-commits
@@ -3,6 +3,7 @@ // RUN: %clang_cc1 -std=c++23 -fsyntax-only -verify=expected,cxx20_23,cxx23 %s -fcxx-exceptions -fexceptions -Wunused-result // RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected,cxx14_20,cxx20_23 %s -fcxx-exceptions -fexceptions -Wunused-result

[clang] Surface error for plain return statement in coroutine earlier (PR #100985)

2024-08-01 Thread Ilya Biryukov via cfe-commits
@@ -291,6 +294,38 @@ void mixed_coreturn_template2(bool b, T) { return; // expected-error {{not allowed in coroutine}} } +struct promise_handle; + +struct Handle : std::coroutine_handle { // expected-note 2{{candidate constructor (the implicit copy constructor) not

[clang] Surface error for plain return statement in coroutine earlier (PR #100985)

2024-08-01 Thread Ilya Biryukov via cfe-commits
@@ -684,6 +684,18 @@ bool Sema::checkFinalSuspendNoThrow(const Stmt *FinalSuspend) { return ThrowingDecls.empty(); } +// [stmt.return.coroutine]p1: +// A coroutine shall not enclose a return statement ([stmt.return]). +static void checkReturnStmtInCoroutine(Sema ,

[clang] Surface error for plain return statement in coroutine earlier (PR #100985)

2024-08-01 Thread Ilya Biryukov via cfe-commits
@@ -684,6 +684,18 @@ bool Sema::checkFinalSuspendNoThrow(const Stmt *FinalSuspend) { return ThrowingDecls.empty(); } +// [stmt.return.coroutine]p1: +// A coroutine shall not enclose a return statement ([stmt.return]). +static void checkReturnStmtInCoroutine(Sema ,

[clang] Surface error for plain return statement in coroutine earlier (PR #100985)

2024-08-01 Thread Ilya Biryukov via cfe-commits
@@ -291,6 +318,50 @@ void mixed_coreturn_template2(bool b, T) { return; // expected-error {{not allowed in coroutine}} } +struct promise_handle; + +struct Handle : std::coroutine_handle { // expected-note 4{{not viable}} +// expected-note@-1 4{{not viable}} +

[clang] Surface error for plain return statement in coroutine earlier (PR #100985)

2024-08-01 Thread Ilya Biryukov via cfe-commits
@@ -694,6 +706,10 @@ bool Sema::ActOnCoroutineBodyStart(Scope *SC, SourceLocation KWLoc, auto *ScopeInfo = getCurFunction(); assert(ScopeInfo->CoroutinePromise); + if (ScopeInfo->FirstCoroutineStmtLoc == KWLoc) { ilya-biryukov wrote: NIT: remove braces

[clang] Surface error for plain return statement in coroutine earlier (PR #100985)

2024-08-01 Thread Ilya Biryukov via cfe-commits
@@ -291,6 +318,50 @@ void mixed_coreturn_template2(bool b, T) { return; // expected-error {{not allowed in coroutine}} } +struct promise_handle; + +struct Handle : std::coroutine_handle { // expected-note 4{{not viable}} +// expected-note@-1 4{{not viable}} +

[clang] Surface error for plain return statement in coroutine earlier (PR #100985)

2024-08-01 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov edited https://github.com/llvm/llvm-project/pull/100985 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Surface error for plain return statement in coroutine earlier (PR #100985)

2024-08-01 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov commented: I have a lot of nitpicks, but otherwise LG, happy to approve as soon as they're fixed. https://github.com/llvm/llvm-project/pull/100985 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] Surface error for plain return statement in coroutine earlier (PR #100985)

2024-07-29 Thread Ilya Biryukov via cfe-commits
@@ -291,6 +294,38 @@ void mixed_coreturn_template2(bool b, T) { return; // expected-error {{not allowed in coroutine}} } +struct promise_handle; + +struct Handle : std::coroutine_handle { // expected-note 2{{candidate constructor (the implicit copy constructor) not

[clang] Surface error for plain return statement in coroutine earlier (PR #100985)

2024-07-29 Thread Ilya Biryukov via cfe-commits
@@ -1120,7 +1120,7 @@ void Sema::CheckCompletedCoroutineBody(FunctionDecl *FD, Stmt *) { // [stmt.return.coroutine]p1: // A coroutine shall not enclose a return statement ([stmt.return]). - if (Fn->FirstReturnLoc.isValid()) { + if (Fn->FirstReturnLoc.isValid() &&

[clang] Surface error for plain return statement in coroutine earlier (PR #100985)

2024-07-29 Thread Ilya Biryukov via cfe-commits
@@ -291,6 +294,38 @@ void mixed_coreturn_template2(bool b, T) { return; // expected-error {{not allowed in coroutine}} } +struct promise_handle; + +struct Handle : std::coroutine_handle { // expected-note 2{{candidate constructor (the implicit copy constructor) not

[clang] Surface error for plain return statement in coroutine earlier (PR #100985)

2024-07-29 Thread Ilya Biryukov via cfe-commits
@@ -3747,6 +3747,16 @@ Sema::ActOnReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp, Diag(ReturnLoc, diag::err_acc_branch_in_out_compute_construct) << /*return*/ 1 << /*out of */ 0); + // using plain return in a coroutine is not allowed. +

[clang] Surface error for plain return statement in coroutine earlier (PR #100985)

2024-07-29 Thread Ilya Biryukov via cfe-commits
@@ -291,6 +294,38 @@ void mixed_coreturn_template2(bool b, T) { return; // expected-error {{not allowed in coroutine}} } +struct promise_handle; + +struct Handle : std::coroutine_handle { // expected-note 2{{candidate constructor (the implicit copy constructor) not

[clang] Surface error for plain return statement in coroutine earlier (PR #100985)

2024-07-29 Thread Ilya Biryukov via cfe-commits
@@ -3747,6 +3747,16 @@ Sema::ActOnReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp, Diag(ReturnLoc, diag::err_acc_branch_in_out_compute_construct) << /*return*/ 1 << /*out of */ 0); + // using plain return in a coroutine is not allowed. +

[clang] Surface error for plain return statement in coroutine earlier (PR #100985)

2024-07-29 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov commented: Thanks for the change! This looks like an improvement, but I suspect we can do even better. See the comments I've left in the code. https://github.com/llvm/llvm-project/pull/100985 ___ cfe-commits mailing

[clang] Surface error for plain return statement in coroutine earlier (PR #100985)

2024-07-29 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov edited https://github.com/llvm/llvm-project/pull/100985 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Avoid accessing unset optional, workaround for #100095 (PR #100408)

2024-07-26 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov edited https://github.com/llvm/llvm-project/pull/100408 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Avoid accessing unset optional, workaround for #100095 (PR #100408)

2024-07-26 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov approved this pull request. LGTM, since it now has a test that executes this code path and changes from UB to defined (even if undesired behavior). As mentioned earlier, I'm working on a proper fix for those cases

[clang] [Sema] Preserve ContainsUnexpandedParameterPack in TransformLambdaExpr (PR #86265)

2024-07-24 Thread Ilya Biryukov via cfe-commits
ilya-biryukov wrote: Looking at the code a bit deeper, I think (not 100% sure) we're not calling `DiagnoseUnexpandedPacks` during substitution. And we probably don't want the logic that produces diagnostics (substitutions cannot create new unexpanded packs in bad places), but we do need the

[clang] [Sema] Preserve ContainsUnexpandedParameterPack in TransformLambdaExpr (PR #86265)

2024-07-24 Thread Ilya Biryukov via cfe-commits
ilya-biryukov wrote: > This patch resolves it by visiting the body twice (of course, it's > suboptimal), however patch #99882 still crashes because that relies on the > mechanism above, I believe. I have also observed it crashes, but I still think that in principle we don't need to traverse

[clang] [clang][Driver] Add flag for setting SkipFunctionBodies (PR #100135)

2024-07-24 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov approved this pull request. https://github.com/llvm/llvm-project/pull/100135 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][Driver] Add flag for setting SkipFunctionBodies (PR #100135)

2024-07-24 Thread Ilya Biryukov via cfe-commits
ilya-biryukov wrote: > But I'll still ask the question: would it make sense to name this > `-helpful-reproducers` or something more generic so we don't feel tempted to > expose even more internal options this way? This is tricky as some issues reproduce only when we skip function bodies and

[clang] [Sema] Default arguments for template parameters affect ContainsUnexpandedPacks (PR #99880)

2024-07-23 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov updated https://github.com/llvm/llvm-project/pull/99880 >From ad2d2f42282d5493761fa0af13b77dc7aab73bba Mon Sep 17 00:00:00 2001 From: Ilya Biryukov Date: Mon, 22 Jul 2024 15:19:07 +0200 Subject: [PATCH 1/5] [Sema] Default arguments for template parameters

[clang] [Sema] Default arguments for template parameters affect ContainsUnexpandedPacks (PR #99880)

2024-07-23 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov updated https://github.com/llvm/llvm-project/pull/99880 >From ad2d2f42282d5493761fa0af13b77dc7aab73bba Mon Sep 17 00:00:00 2001 From: Ilya Biryukov Date: Mon, 22 Jul 2024 15:19:07 +0200 Subject: [PATCH 1/5] [Sema] Default arguments for template parameters

[clang] [Sema] Default arguments for template parameters affect ContainsUnexpandedPacks (PR #99880)

2024-07-23 Thread Ilya Biryukov via cfe-commits
@@ -44,6 +44,13 @@ using namespace clang; // TemplateParameterList Implementation //===--===// +namespace { +template +bool DefaultArgumentContainsUnexpandedPack(const TemplateParam ) {

[clang] [Sema] Fix computations of "unexpanded packs" in substituted lambdas (PR #99882)

2024-07-23 Thread Ilya Biryukov via cfe-commits
ilya-biryukov wrote: > This would be excellent, but I think we would still need that just because > building a lambda is an horrible state machine. Yeah, unfortunately there probably isn't a way to get rid of the state machine. I can only see a path towards getting rid of that single flag. But

[clang] [Sema] Avoid excessive desuraging in template deduction (PR #100144)

2024-07-23 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov edited https://github.com/llvm/llvm-project/pull/100144 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Sema] Avoid excessive desuraging in template deduction (PR #100144)

2024-07-23 Thread Ilya Biryukov via cfe-commits
@@ -688,10 +688,7 @@ DeduceTemplateSpecArguments(Sema , TemplateParameterList *TemplateParams, // FIXME: To preserve sugar, the TST needs to carry sugared resolved // arguments. - ArrayRef PResolved = - TP->getCanonicalTypeInternal() - ->castAs() -

[clang] [Sema] Avoid excessive desuraging in template deduction (PR #100144)

2024-07-23 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov created https://github.com/llvm/llvm-project/pull/100144 Not for submission yet. Will eventually aim to fix #100095. The current approach should not be correct as it would have *too* much sugar in turn. We should also make sure the final substitution arguments

[clang] [clang][CUDA] Assume unknown emission status for skipped function definitions (PR #100124)

2024-07-23 Thread Ilya Biryukov via cfe-commits
ilya-biryukov wrote: Could you reformat the code so that the clang-format presubmit is happy? Otherwise LG. https://github.com/llvm/llvm-project/pull/100124 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [clang][Driver] Add flag for setting SkipFunctionBodies (PR #100135)

2024-07-23 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov commented: Let's give other folks a chance to reply before landing this. https://github.com/llvm/llvm-project/pull/100135 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [clang][Driver] Add flag for setting SkipFunctionBodies (PR #100135)

2024-07-23 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov edited https://github.com/llvm/llvm-project/pull/100135 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][Driver] Add flag for setting SkipFunctionBodies (PR #100135)

2024-07-23 Thread Ilya Biryukov via cfe-commits
@@ -0,0 +1,8 @@ +// Trivial check to ensure skip-function-bodies flag is propagated. +// +// RUN: %clang_cc1 -verify -skip-function-bodies -pedantic-errors %s ilya-biryukov wrote: Could you also check in the test that this flag is not available outside of

[clang] [clang][Driver] Add flag for setting SkipFunctionBodies (PR #100135)

2024-07-23 Thread Ilya Biryukov via cfe-commits
ilya-biryukov wrote: I am generally supportive of the idea to expose this for more easily reproducing bugs in source tools, and clangd, in particular. However, I think it'd be useful to make sure the Clang maintainers are on board. @cor3ntin, @AaronBallman do you have any objection to exposing

[clang] [Sema] Fix computations of "unexpanded packs" in substituted lambdas (PR #99882)

2024-07-23 Thread Ilya Biryukov via cfe-commits
ilya-biryukov wrote: > My main concern is this line which seems very artificial > https://github.com/llvm/llvm-project/pull/99882/files#diff-10901a3bb08d903a57820f09c2eb5f40cb4cd47c54ca3cad472106814c4bf15dR359 Yeah, I can see your point. My north-start vision for that issue is that is should

[clang] [Sema] Fix computations of "unexpanded packs" in substituted lambdas (PR #99882)

2024-07-23 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov closed https://github.com/llvm/llvm-project/pull/99882 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Sema] Default arguments for template parameters affect ContainsUnexpandedPacks (PR #99880)

2024-07-23 Thread Ilya Biryukov via cfe-commits
@@ -61,27 +68,34 @@ TemplateParameterList::TemplateParameterList(const ASTContext& C, bool IsPack = P->isTemplateParameterPack(); if (const auto *NTTP = dyn_cast(P)) { - if (!IsPack && NTTP->getType()->containsUnexpandedParameterPack()) -

[clang] [Sema] Default arguments for template parameters affect ContainsUnexpandedPacks (PR #99880)

2024-07-23 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov updated https://github.com/llvm/llvm-project/pull/99880 >From ad2d2f42282d5493761fa0af13b77dc7aab73bba Mon Sep 17 00:00:00 2001 From: Ilya Biryukov Date: Mon, 22 Jul 2024 15:19:07 +0200 Subject: [PATCH 1/4] [Sema] Default arguments for template parameters

[clang] [Sema] Fix computations of "unexpanded packs" in substituted lambdas (PR #99882)

2024-07-23 Thread Ilya Biryukov via cfe-commits
ilya-biryukov wrote: > @ilya-biryukov I'm a bit torn about how we would proceed: if Corentin insists > on the current (which my patch continues the effort) implementation, do you > think it feasible for me to merge part of your codes (specifically, the way > we propagate up unexpanded flags

[clang] [Sema] Default arguments for template parameters affect ContainsUnexpandedPacks (PR #99880)

2024-07-23 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov updated https://github.com/llvm/llvm-project/pull/99880 >From ad2d2f42282d5493761fa0af13b77dc7aab73bba Mon Sep 17 00:00:00 2001 From: Ilya Biryukov Date: Mon, 22 Jul 2024 15:19:07 +0200 Subject: [PATCH 1/3] [Sema] Default arguments for template parameters

[clang] [Sema] Default arguments for template parameters affect ContainsUnexpandedPacks (PR #99880)

2024-07-23 Thread Ilya Biryukov via cfe-commits
@@ -61,27 +61,43 @@ TemplateParameterList::TemplateParameterList(const ASTContext& C, bool IsPack = P->isTemplateParameterPack(); if (const auto *NTTP = dyn_cast(P)) { - if (!IsPack && NTTP->getType()->containsUnexpandedParameterPack()) -

[clang] [Sema] Default arguments for template parameters affect ContainsUnexpandedPacks (PR #99880)

2024-07-23 Thread Ilya Biryukov via cfe-commits
@@ -61,27 +61,43 @@ TemplateParameterList::TemplateParameterList(const ASTContext& C, bool IsPack = P->isTemplateParameterPack(); if (const auto *NTTP = dyn_cast(P)) { - if (!IsPack && NTTP->getType()->containsUnexpandedParameterPack()) -

[clang] [Sema] Default arguments for template parameters affect ContainsUnexpandedPacks (PR #99880)

2024-07-23 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov updated https://github.com/llvm/llvm-project/pull/99880 >From ad2d2f42282d5493761fa0af13b77dc7aab73bba Mon Sep 17 00:00:00 2001 From: Ilya Biryukov Date: Mon, 22 Jul 2024 15:19:07 +0200 Subject: [PATCH 1/2] [Sema] Default arguments for template parameters

[clang] 363e036 - [AST] NFC: add an assertion for invariant of CXXFoldExpr

2024-07-23 Thread Ilya Biryukov via cfe-commits
Author: Ilya Biryukov Date: 2024-07-23T12:28:59+02:00 New Revision: 363e036ac002d5af4bb82e303052b806a98086a1 URL: https://github.com/llvm/llvm-project/commit/363e036ac002d5af4bb82e303052b806a98086a1 DIFF: https://github.com/llvm/llvm-project/commit/363e036ac002d5af4bb82e303052b806a98086a1.diff

[clang] [Sema] Fix computations of "unexpanded packs" in substituted lambdas (PR #99882)

2024-07-22 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov edited https://github.com/llvm/llvm-project/pull/99882 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Sema] Fix computations of "unexpanded packs" in substituted lambdas (PR #99882)

2024-07-22 Thread Ilya Biryukov via cfe-commits
@@ -353,7 +353,11 @@ Sema::DiagnoseUnexpandedParameterPacks(SourceLocation Loc, } if (!EnclosingStmtExpr) { -LSI->ContainsUnexpandedParameterPack = true; +// It is ok to have unexpanded packs in captures, template parameters +// and

[clang] [Sema] Fix computations of "unexpanded packs" in substituted lambdas (PR #99882)

2024-07-22 Thread Ilya Biryukov via cfe-commits
ilya-biryukov wrote: > I think I prefer the approach chosen by @zyn0217. > > The changes are more targeted, and using a visitor for the call operator > avoid a lot of code duplication. In particular, if we want to properly handle > attributes, we might need code in

[clang] Record mainfile name in the Frontend time trace (PR #99866)

2024-07-22 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/99866 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Sema] Preserve ContainsUnexpandedParameterPack in TransformLambdaExpr (PR #86265)

2024-07-22 Thread Ilya Biryukov via cfe-commits
ilya-biryukov wrote: Just FYI, I wasn't aware of this PR and have ended up with an alternative approach to tracking the unexpanded packs in #99882. (Thanks @cor3ntin for pointing this out) I'll let the reviewers decide if we should go with this change or mine, also happy to have some

[clang] [Sema] Fix computations of "unexpanded packs" in substituted lambdas (PR #99882)

2024-07-22 Thread Ilya Biryukov via cfe-commits
ilya-biryukov wrote: > At first glance this seems like a duplicate of #86265 That seems right, I was not aware of the other PR, thanks for pointing this out. I still feel that avoiding the use of the flag from `LambdaScopeInfo` is an overall improvement that makes the code simpler, but the

[clang] Record mainfile name in the Frontend time trace (PR #99866)

2024-07-22 Thread Ilya Biryukov via cfe-commits
@@ -209,7 +208,7 @@ constexpr int slow_init_list[] = {1, 1, 2, 3, 5, 8, 13, 21}; // 25th line ASSERT_TRUE(compileFromString(Code, "-std=c++20", "test.cc")); std::string Json = teardownProfiler(); ASSERT_EQ(R"( -Frontend +Frontend (, test.cc)

[clang] Record mainfile name in the Frontend time trace (PR #99866)

2024-07-22 Thread Ilya Biryukov via cfe-commits
@@ -152,7 +152,13 @@ void clang::ParseAST(Sema , bool PrintStats, bool SkipFunctionBodies) { bool HaveLexer = S.getPreprocessor().getCurrentLexer(); if (HaveLexer) { -llvm::TimeTraceScope TimeScope("Frontend"); +llvm::TimeTraceScope TimeScope("Frontend", [&]() {

[clang] Record mainfile name in the Frontend time trace (PR #99866)

2024-07-22 Thread Ilya Biryukov via cfe-commits
@@ -81,7 +81,6 @@ std::string GetMetadata(json::Object *Event) { if (json::Object *Args = Event->getObject("args")) { if (auto Detail = Args->getString("detail")) OS << Detail; -// Use only filename to not include os-specific path separators.

[clang] [Sema] Fix computations of "unexpanded packs" in substituted lambdas (PR #99882)

2024-07-22 Thread Ilya Biryukov via cfe-commits
ilya-biryukov wrote: This PR also includes changes from #99880, which I separated into another commit to simplify the review as this PR is a bit involved. https://github.com/llvm/llvm-project/pull/99882 ___ cfe-commits mailing list

[clang] [Sema] Fix computations of "unexpanded packs" in substituted lambdas (PR #99882)

2024-07-22 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov created https://github.com/llvm/llvm-project/pull/99882 This addresses a crash in https://github.com/llvm/llvm-project/issues/99877 that happens on nested lambdas that use template parameter packs, see the added test. Before this patch, the code computing the

[clang] [Sema] Default arguments for template parameters affect ContainsUnexpandedPacks (PR #99880)

2024-07-22 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov created https://github.com/llvm/llvm-project/pull/99880 This addresses the FIXME in the code. There are tests for the new behavior in a follow up fix for #99877, which also addresses other bugs that prevent exposing the wrong results of

[clang] [llvm] Reapply "Add source file name for template instantiations in -ftime-trace" (PR #99545)

2024-07-19 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov approved this pull request. LGTM, thanks https://github.com/llvm/llvm-project/pull/99545 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] Reapply "Add source file name for template instantiations in -ftime-trace" (PR #99545)

2024-07-19 Thread Ilya Biryukov via cfe-commits
@@ -60,13 +75,29 @@ bool compileFromString(StringRef Code, StringRef Standard, StringRef FileName) { return Compiler.ExecuteAction(Action); } +std::string GetMetadata(json::Object *Event) { + std::string Metadata; + llvm::raw_string_ostream OS(Metadata); + if

[clang] [llvm] Reapply "Add source file name for template instantiations in -ftime-trace" (PR #99545)

2024-07-19 Thread Ilya Biryukov via cfe-commits
ilya-biryukov wrote: This still fails on Windows, see the buildkite errors. I believe the `filename(..., style::posix)` does not do what you intend, it actually assumes the inputs are in posix format, which is not the case on Windows. You want to use the native style

[clang] [llvm] Add source file name for template instantiations in -ftime-trace (PR #98320)

2024-07-18 Thread Ilya Biryukov via cfe-commits
@@ -3426,11 +3426,16 @@ Sema::InstantiateClass(SourceLocation PointOfInstantiation, return true; llvm::TimeTraceScope TimeScope("InstantiateClass", [&]() { -std::string Name; -llvm::raw_string_ostream OS(Name); +llvm::TimeTraceMetadata M; +

[clang] [llvm] Add source file name for template instantiations in -ftime-trace (PR #98320)

2024-07-18 Thread Ilya Biryukov via cfe-commits
@@ -38,14 +42,24 @@ std::string teardownProfiler() { // Returns true if code compiles successfully. // We only parse AST here. This is enough for constexpr evaluation. -bool compileFromString(StringRef Code, StringRef Standard, StringRef FileName) { +bool

[clang] [llvm] Add source file name for template instantiations in -ftime-trace (PR #98320)

2024-07-18 Thread Ilya Biryukov via cfe-commits
@@ -3426,11 +3426,16 @@ Sema::InstantiateClass(SourceLocation PointOfInstantiation, return true; llvm::TimeTraceScope TimeScope("InstantiateClass", [&]() { -std::string Name; -llvm::raw_string_ostream OS(Name); +llvm::TimeTraceMetadata M; +

[clang] [llvm] Add source file name for template instantiations in -ftime-trace (PR #98320)

2024-07-18 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov commented: A few more suggestions, and happy to approve as soon as the question about source events gets resolved. https://github.com/llvm/llvm-project/pull/98320 ___ cfe-commits mailing list

[clang] [llvm] Add source file name for template instantiations in -ftime-trace (PR #98320)

2024-07-18 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov edited https://github.com/llvm/llvm-project/pull/98320 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] Add source file name for template instantiations in -ftime-trace (PR #98320)

2024-07-18 Thread Ilya Biryukov via cfe-commits
@@ -60,39 +74,65 @@ bool compileFromString(StringRef Code, StringRef Standard, StringRef FileName) { return Compiler.ExecuteAction(Action); } +std::string GetMetadata(json::Object *Event) { + std::string Metadata = ""; + if (json::Object *Args = Event->getObject("args"))

[clang] [llvm] Add source file name for template instantiations in -ftime-trace (PR #98320)

2024-07-17 Thread Ilya Biryukov via cfe-commits
@@ -83,16 +83,27 @@ namespace llvm { class raw_pwrite_stream; +struct TimeTraceMetadata { + std::string Detail; + // Source file information for the event. + std::string Filename; ilya-biryukov wrote: NIT: Maybe use `File` here and `file` in JSON for

[clang] [llvm] Add source file name for template instantiations in -ftime-trace (PR #98320)

2024-07-17 Thread Ilya Biryukov via cfe-commits
@@ -60,39 +74,65 @@ bool compileFromString(StringRef Code, StringRef Standard, StringRef FileName) { return Compiler.ExecuteAction(Action); } +std::string GetMetadata(json::Object *Event) { + std::string Metadata = ""; + if (json::Object *Args = Event->getObject("args"))

[clang] [llvm] Add source file name for template instantiations in -ftime-trace (PR #98320)

2024-07-17 Thread Ilya Biryukov via cfe-commits
@@ -83,16 +83,27 @@ namespace llvm { class raw_pwrite_stream; +struct TimeTraceMetadata { ilya-biryukov wrote: Could we also include the line numbers? I suspect it would be trivial to add that, but we will have an option of pointing at an exact line in the

[clang] [llvm] Add source file name for template instantiations in -ftime-trace (PR #98320)

2024-07-17 Thread Ilya Biryukov via cfe-commits
@@ -307,14 +331,25 @@ struct llvm::TimeTraceProfiler { // Minimum time granularity (in microseconds) const unsigned TimeTraceGranularity; + + // Make time trace capture verbose event details (eg. source filenames). This ilya-biryukov wrote: NIT: `e.g. `

[clang] [llvm] Add source file name for template instantiations in -ftime-trace (PR #98320)

2024-07-17 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov commented: Thanks for adding an optional flag for this. Given that the profiles are 2-3x larger now, this seems very much warranted. Mostly LG, but I did have some questions and suggestions. PTAL. https://github.com/llvm/llvm-project/pull/98320

[clang] [llvm] Add source file name for template instantiations in -ftime-trace (PR #98320)

2024-07-17 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov edited https://github.com/llvm/llvm-project/pull/98320 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Extend lifetime analysis to support assignments for pointer-like objects. (PR #99032)

2024-07-17 Thread Ilya Biryukov via cfe-commits
@@ -34,6 +34,6 @@ struct basic_string { }; } // namespace std void test(const char* a) { - // verify we're emitting the `-Wdangling-assignment` warning. + // verify we're emitting the `-Wdangling-assignment-gsl` warning. a = std::basic_string().c_str(); //

[clang] [clang] Extend lifetime analysis to support assignments for pointer-like objects. (PR #99032)

2024-07-17 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov edited https://github.com/llvm/llvm-project/pull/99032 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Extend lifetime analysis to support assignments for pointer-like objects. (PR #99032)

2024-07-17 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov approved this pull request. LGTM, but I also have one question (either I don't understand something or there might be an error in the comment) https://github.com/llvm/llvm-project/pull/99032 ___ cfe-commits mailing

[clang] Add source file name for template instantiations in -ftime-trace (PR #98320)

2024-07-11 Thread Ilya Biryukov via cfe-commits
@@ -3430,6 +3430,7 @@ Sema::InstantiateClass(SourceLocation PointOfInstantiation, llvm::raw_string_ostream OS(Name); Instantiation->getNameForDiagnostic(OS, getPrintingPolicy(), /*Qualified=*/true); +OS << ", file:" <<

[clang] Add source file name for template instantiations in -ftime-trace (PR #98320)

2024-07-11 Thread Ilya Biryukov via cfe-commits
@@ -3430,6 +3430,7 @@ Sema::InstantiateClass(SourceLocation PointOfInstantiation, llvm::raw_string_ostream OS(Name); ilya-biryukov wrote: Should we do this for other things? Most of the nodes are likely to have a source location they can be attributed to.

[clang] Add source file name for template instantiations in -ftime-trace (PR #98320)

2024-07-11 Thread Ilya Biryukov via cfe-commits
@@ -3430,6 +3430,7 @@ Sema::InstantiateClass(SourceLocation PointOfInstantiation, llvm::raw_string_ostream OS(Name); Instantiation->getNameForDiagnostic(OS, getPrintingPolicy(), /*Qualified=*/true); +OS << ", file:" <<

[clang] Add source file name for template instantiations in -ftime-trace (PR #98320)

2024-07-11 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov commented: Are we worried about the increase in the output file sizes? https://github.com/llvm/llvm-project/pull/98320 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] Add source file name for template instantiations in -ftime-trace (PR #98320)

2024-07-11 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov edited https://github.com/llvm/llvm-project/pull/98320 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Doc] Update documentation for no-transitive-change (PR #96453)

2024-07-01 Thread Ilya Biryukov via cfe-commits
@@ -652,6 +652,141 @@ in the future. The expected roadmap for Reduced BMIs as of Clang 19.x is: comes, the term BMI will refer to the Reduced BMI and the Full BMI will only be meaningful to build systems which elect to support two-phase compilation. +Experimental No

[clang] [Doc] Update documentation for no-transitive-change (PR #96453)

2024-06-26 Thread Ilya Biryukov via cfe-commits
@@ -229,6 +229,10 @@ C++20 Feature Support will now work. (#GH62925). +- Clang refactored the BMI format to make it possible to support no transitive changes ilya-biryukov wrote: > Good suggestions. Applied. (Just change should to can. Since I feel

[clang] [Doc] Update documentation for no-transitive-change (PR #96453)

2024-06-26 Thread Ilya Biryukov via cfe-commits
@@ -652,6 +652,134 @@ in the future. The expected roadmap for Reduced BMIs as of Clang 19.x is: comes, the term BMI will refer to the Reduced BMI and the Full BMI will only be meaningful to build systems which elect to support two-phase compilation. +Experimental No

[clang] [Doc] Update documentation for no-transitive-change (PR #96453)

2024-06-26 Thread Ilya Biryukov via cfe-commits
@@ -652,6 +652,141 @@ in the future. The expected roadmap for Reduced BMIs as of Clang 19.x is: comes, the term BMI will refer to the Reduced BMI and the Full BMI will only be meaningful to build systems which elect to support two-phase compilation. +Experimental No

[clang] [Doc] Update documentation for no-transitive-change (PR #96453)

2024-06-26 Thread Ilya Biryukov via cfe-commits
@@ -652,6 +652,134 @@ in the future. The expected roadmap for Reduced BMIs as of Clang 19.x is: comes, the term BMI will refer to the Reduced BMI and the Full BMI will only be meaningful to build systems which elect to support two-phase compilation. +Experimental No

[clang] [clang][Sema] Move the initializer lifetime checking code from SemaInit.cpp to a new place, NFC (PR #96758)

2024-06-26 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov approved this pull request. LGTM, this opens up the possibility to extend this for assignments and provides better modularity! https://github.com/llvm/llvm-project/pull/96758 ___ cfe-commits mailing list

[clang] [clang][Sema] Move the initializer lifetime checking code from SemaInit.cpp to a new place, NFC (PR #96758)

2024-06-26 Thread Ilya Biryukov via cfe-commits
@@ -0,0 +1,1258 @@ +//===--- CheckExprLifetime.cpp ===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier:

[clang] [Serialization] Storing DeclID separately (PR #95897)

2024-06-25 Thread Ilya Biryukov via cfe-commits
ilya-biryukov wrote: Thanks for this patch, I will try it on our codebase to see the effects of it and report back to you. I am also trying to understand in which cases this would be a win and when not. IIUC, this is always a win when `ModuleFileIndex != 0` and a pessimization otherwise.

[clang] [Doc] Update documentation for no-transitive-change (PR #96453)

2024-06-25 Thread Ilya Biryukov via cfe-commits
@@ -652,6 +652,134 @@ in the future. The expected roadmap for Reduced BMIs as of Clang 19.x is: comes, the term BMI will refer to the Reduced BMI and the Full BMI will only be meaningful to build systems which elect to support two-phase compilation. +Experimental No

[clang] [Doc] Update documentation for no-transitive-change (PR #96453)

2024-06-25 Thread Ilya Biryukov via cfe-commits
@@ -652,6 +652,134 @@ in the future. The expected roadmap for Reduced BMIs as of Clang 19.x is: comes, the term BMI will refer to the Reduced BMI and the Full BMI will only be meaningful to build systems which elect to support two-phase compilation. +Experimental No

[clang] [Doc] Update documentation for no-transitive-change (PR #96453)

2024-06-25 Thread Ilya Biryukov via cfe-commits
@@ -652,6 +652,134 @@ in the future. The expected roadmap for Reduced BMIs as of Clang 19.x is: comes, the term BMI will refer to the Reduced BMI and the Full BMI will only be meaningful to build systems which elect to support two-phase compilation. +Experimental No

[clang] [Doc] Update documentation for no-transitive-change (PR #96453)

2024-06-25 Thread Ilya Biryukov via cfe-commits
@@ -229,6 +229,10 @@ C++20 Feature Support will now work. (#GH62925). +- Clang refactored the BMI format to make it possible to support no transitive changes ilya-biryukov wrote: Maybe explicitly mention the user-facing effect of what "no transitive

  1   2   3   4   5   6   7   8   9   10   >