[clang] [Clang][Parser] Don't always destroy template annotations at the end of a declaration (PR #89494)

2024-04-23 Thread Younan Zhang via cfe-commits
zyn0217 wrote: > I'm not strongly opposed to merge that, however, i did confirm locally that > removing the call to `MaybeDestroyTemplateIds` in > `ParseStatementOrDeclaration` fixes the bug. > > We currently destroy annotations > > * At the end of a top level decl (and extern decl) > * At th

[clang] [Clang][Parser] Don't always destroy template annotations at the end of a declaration (PR #89494)

2024-04-23 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 closed https://github.com/llvm/llvm-project/pull/89494 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Parser] Don't always destroy template annotations at the end of a declaration (PR #89494)

2024-04-23 Thread Younan Zhang via cfe-commits
zyn0217 wrote: Oops. I thought there was some latency between clicking the merge button and your latest comment. Should I revert? https://github.com/llvm/llvm-project/pull/89494 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llv

[clang] [Clang][Parser] Don't always destroy template annotations at the end of a declaration (PR #89494)

2024-04-23 Thread Younan Zhang via cfe-commits
zyn0217 wrote: > > Oops. I thought there was some latency between clicking the merge button > > and your latest comment. Should I revert? > > No worries, I should have hit `Request Changes` instead of `Comment`. :-) No > need to revert yet. OK, so if you feel that approach is better, I think

[clang] [Clang][Parser] Don't always destroy template annotations at the end of a declaration (PR #89494)

2024-04-23 Thread Younan Zhang via cfe-commits
zyn0217 wrote: Thank you @AaronBallman again for providing performance data from trackers. (I think it's also time for me to learn how to use the tracker, by the way :-) https://github.com/llvm/llvm-project/pull/89494 ___ cfe-commits mailing list cfe-

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

2024-07-23 Thread Younan Zhang via cfe-commits
zyn0217 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 for lambda bodie

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

2024-07-23 Thread Younan Zhang via cfe-commits
zyn0217 wrote: I can get around to my patch again very soon :) 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 Younan Zhang via cfe-commits
@@ -44,6 +44,13 @@ using namespace clang; // TemplateParameterList Implementation //===--===// +namespace { +template +bool DefaultArgumentContainsUnexpandedPack(const TemplateParam &P) { zy

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

2024-07-23 Thread Younan Zhang via cfe-commits
zyn0217 wrote: I think somehow we still need an extra bit in `Stmt` to carry over the unexpanded info because a body could contain other statements e.g. `DeclStmt` other than full expressions that could propagate up the unexpanded flag through calls to `ContainsUnexpandedParameterPack()`. For

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

2024-07-25 Thread Younan Zhang via cfe-commits
zyn0217 wrote: > 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 logic > to update the LambdaScopeInfo::ContainsUnexpandedPacks so we can avoid this > extra traversal. Cheers. Thanks for the

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

2024-07-25 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/86265 >From 6e7b38b3e3f781e11db2fa5d552fdfb6123609df Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Fri, 22 Mar 2024 17:34:08 +0800 Subject: [PATCH 01/16] [Sema] Preserve ContainsUnexpandedParameterPack in Transfor

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

2024-07-25 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/86265 >From 6e7b38b3e3f781e11db2fa5d552fdfb6123609df Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Fri, 22 Mar 2024 17:34:08 +0800 Subject: [PATCH 01/17] [Sema] Preserve ContainsUnexpandedParameterPack in Transfor

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

2024-07-26 Thread Younan Zhang via cfe-commits
@@ -4006,6 +4007,37 @@ class TreeTransform { NumExpansions); } + void RebuildLambdaExprImpl(SourceLocation StartLoc, SourceLocation EndLoc, + LambdaScopeInfo *LSI) {} + + ExprResult RebuildLambdaExpr(SourceL

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

2024-07-26 Thread Younan Zhang via cfe-commits
@@ -8270,6 +8303,15 @@ TreeTransform::TransformDeclStmt(DeclStmt *S) { if (Transformed != D) DeclChanged = true; +if (LSI && isa(Transformed)) + LSI->ContainsUnexpandedParameterPack |= + getSema() + .getASTContext() + .getT

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

2024-07-26 Thread Younan Zhang via cfe-commits
@@ -1394,7 +1395,22 @@ namespace { SourceRange PatternRange, ArrayRef Unexpanded, bool &ShouldExpand, bool &RetainExpansion, - std::optional &NumEx

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

2024-07-26 Thread Younan Zhang via cfe-commits
@@ -14636,6 +14645,20 @@ TreeTransform::TransformLambdaExpr(LambdaExpr *E) { /*IsInstantiation*/ true); SavedContext.pop(); + // Parts other than the capture e.g. the lambda body might still contain a + // pattern that an outer fold exp

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

2024-07-26 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/86265 >From 6e7b38b3e3f781e11db2fa5d552fdfb6123609df Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Fri, 22 Mar 2024 17:34:08 +0800 Subject: [PATCH 01/18] [Sema] Preserve ContainsUnexpandedParameterPack in Transfor

[clang] [Clang][CTAD][NFC] Unify transformTemplateParameter() (PR #100865)

2024-07-27 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 created https://github.com/llvm/llvm-project/pull/100865 We ended up having two transformTemplateParameter() after CTAD for type aliases was landed. This patch cleans them up and allows them to share one implementation. >From 13724c6cd47c17b92b57f04436c544bd9d681070

[clang] [Clang][CTAD][NFC] Unify transformTemplateParameter() (PR #100865)

2024-07-27 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/100865 >From 13724c6cd47c17b92b57f04436c544bd9d681070 Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Sat, 27 Jul 2024 18:52:23 +0800 Subject: [PATCH 1/2] [Clang][CTAD][NFC] Unify transformTemplateParameter() We end

[clang] [Clang][CTAD][NFC] Unify transformTemplateParameter() (PR #100865)

2024-07-27 Thread Younan Zhang via cfe-commits
zyn0217 wrote: The flaky test `basic-project.test` failure is unrelated -- I didn't rebase my branch onto 88549cf4 https://github.com/llvm/llvm-project/pull/100865 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/

[clang] [Clang][CTAD][NFC] Unify transformTemplateParameter() (PR #100865)

2024-07-28 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/100865 >From 13724c6cd47c17b92b57f04436c544bd9d681070 Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Sat, 27 Jul 2024 18:52:23 +0800 Subject: [PATCH 1/3] [Clang][CTAD][NFC] Unify transformTemplateParameter() We end

[clang] [Clang][CTAD][NFC] Unify transformTemplateParameter() (PR #100865)

2024-07-28 Thread Younan Zhang via cfe-commits
@@ -284,6 +283,42 @@ transformTemplateParam(Sema &SemaRef, DeclContext *DC, return NewParam; } +NamedDecl *transformTemplateParameter(Sema &SemaRef, DeclContext *DC, + NamedDecl *TemplateParam, + Multi

[clang] [Clang][CTAD][NFC] Unify transformTemplateParameter() (PR #100865)

2024-07-28 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 edited https://github.com/llvm/llvm-project/pull/100865 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][CTAD][NFC] Unify transformTemplateParameter() (PR #100865)

2024-07-28 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 edited https://github.com/llvm/llvm-project/pull/100865 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][CTAD][NFC] Unify transformTemplateParameter() (PR #100865)

2024-07-28 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 closed https://github.com/llvm/llvm-project/pull/100865 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Parser] Fix name lookup of template parameters for out-of-line specializations (PR #101020)

2024-07-29 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 created https://github.com/llvm/llvm-project/pull/101020 Since the implementation of DR458 (d1446017), we have had an algorithm that template parameters would take precedence over its parent scopes at the name lookup. However, we failed to handle the following case w

[clang] [Clang][Parser] Fix name lookup of template parameters for out-of-line specializations (PR #101020)

2024-07-29 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 edited https://github.com/llvm/llvm-project/pull/101020 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] Remove duplicate check in if-condition (PR #101070)

2024-07-29 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 approved this pull request. Thanks. (However I'm not an OpenMP maintainer, but since this PR is clearly an NFC change, I'd boldly approve it.) https://github.com/llvm/llvm-project/pull/101070 ___ cfe-commits mailing list cfe

[clang] [Clang][Sema] Remove duplicate check in if-condition (PR #101070)

2024-07-29 Thread Younan Zhang via cfe-commits
zyn0217 wrote: (I presume you don't have commit access, so I'll help you merge it. Next time, please add an "NFC" term to the commit title if the PR doesn't contain any functional changes.) https://github.com/llvm/llvm-project/pull/101070 ___ cfe-com

[clang] [Clang][Sema] Remove duplicate check in if-condition (PR #101070)

2024-07-29 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 closed https://github.com/llvm/llvm-project/pull/101070 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Reconsider the timing of instantiation of local constexpr lambdas (PR #98758)

2024-07-15 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 closed https://github.com/llvm/llvm-project/pull/98758 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Reconsider the timing of instantiation of local constexpr lambdas (PR #98758)

2024-07-15 Thread Younan Zhang via cfe-commits
zyn0217 wrote: Finally, I decide to revert #95660 and close this PR for now. Regarding issues associated with #95660, I realized they are actually part of a bigger problem in constant evaluation. As discussed in #59966, it might be beneficial to implement on-demand template instantiation for c

[clang] Revert "[Clang] Instantiate local constexpr functions eagerly (#95660)" (PR #98991)

2024-07-15 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 created https://github.com/llvm/llvm-project/pull/98991 Unfortunately, this has caused a regression in DeduceReturnType(), which causes a problem in that some of the local recursive lambdas are getting incorrectly rejected. This reverts commit 5548ea34341e9d0ae64571

[clang] Revert "[Clang] Instantiate local constexpr functions eagerly (#95660)" (PR #98991)

2024-07-15 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 edited https://github.com/llvm/llvm-project/pull/98991 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Revert "[Clang] Instantiate local constexpr functions eagerly (#95660)" (PR #98991)

2024-07-16 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/98991 >From 727d92f0651cec3110d321582a884f1c939d8a6d Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Tue, 16 Jul 2024 12:43:33 +0800 Subject: [PATCH 1/2] Revert "[Clang] Instantiate local constexpr functions eagerly

[clang] Revert "[Clang] Instantiate local constexpr functions eagerly (#95660)" (PR #98991)

2024-07-16 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 closed https://github.com/llvm/llvm-project/pull/98991 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Concepts] Avoid substituting into constraints for invalid TemplateDecls (PR #75697)

2024-07-16 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/75697 >From a6e01586f5d406b51492d973cb693ba32cc63d99 Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Sat, 16 Dec 2023 18:49:59 +0800 Subject: [PATCH 1/3] [Concepts] Avoid substituting into constraints for invalid Te

[clang] [Concepts] Avoid substituting into constraints for invalid TemplateDecls (PR #75697)

2024-07-16 Thread Younan Zhang via cfe-commits
zyn0217 wrote: @cor3ntin I moved the check to `CheckConstraintSatisfaction` so we don't end up with many substitution failure notes. Can you check it out again? https://github.com/llvm/llvm-project/pull/75697 ___ cfe-commits mailing list cfe-commits@l

[clang] [Concepts] Avoid substituting into constraints for invalid TemplateDecls (PR #75697)

2024-07-16 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/75697 >From a6e01586f5d406b51492d973cb693ba32cc63d99 Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Sat, 16 Dec 2023 18:49:59 +0800 Subject: [PATCH 1/4] [Concepts] Avoid substituting into constraints for invalid Te

[clang] [Concepts] Avoid substituting into constraints for invalid TemplateDecls (PR #75697)

2024-07-16 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/75697 >From a6e01586f5d406b51492d973cb693ba32cc63d99 Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Sat, 16 Dec 2023 18:49:59 +0800 Subject: [PATCH 1/5] [Concepts] Avoid substituting into constraints for invalid Te

[clang] [Concepts] Avoid substituting into constraints for invalid TemplateDecls (PR #75697)

2024-07-17 Thread Younan Zhang via cfe-commits
@@ -227,3 +227,20 @@ struct r6 {}; using r6i = r6; // expected-error@-1 {{constraints not satisfied for class template 'r6' [with T = int]}} + +namespace GH73885 { + +template // expected-error {{extraneous}} +template requires(T{}) +bool e_v = true; + +static_assert(e_v);

[clang] [Concepts] Avoid substituting into constraints for invalid TemplateDecls (PR #75697)

2024-07-17 Thread Younan Zhang via cfe-commits
@@ -227,3 +227,20 @@ struct r6 {}; using r6i = r6; // expected-error@-1 {{constraints not satisfied for class template 'r6' [with T = int]}} + +namespace GH73885 { + +template // expected-error {{extraneous}} +template requires(T{}) +bool e_v = true; + +static_assert(e_v);

[clang] [Concepts] Avoid substituting into constraints for invalid TemplateDecls (PR #75697)

2024-07-17 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 closed https://github.com/llvm/llvm-project/pull/75697 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clangd] Support go-to-definition on type hints. The core part (PR #86629)

2024-07-17 Thread Younan Zhang via cfe-commits
zyn0217 wrote: @HighCommander4 Given that this PR has been growing larger, I plan to split it up. Hopefully, this will make the code review easier. Moreover, I realized it's probably insufficient to build the whole thing on top of a `TypeVisitor`. Like, a pointer to an array, we have to handle

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

2024-07-18 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/86265 >From 6e7b38b3e3f781e11db2fa5d552fdfb6123609df Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Fri, 22 Mar 2024 17:34:08 +0800 Subject: [PATCH 01/10] [Sema] Preserve ContainsUnexpandedParameterPack in Transfor

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

2024-07-18 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/86265 >From 6e7b38b3e3f781e11db2fa5d552fdfb6123609df Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Fri, 22 Mar 2024 17:34:08 +0800 Subject: [PATCH 01/11] [Sema] Preserve ContainsUnexpandedParameterPack in Transfor

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

2024-07-18 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/86265 >From 6e7b38b3e3f781e11db2fa5d552fdfb6123609df Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Fri, 22 Mar 2024 17:34:08 +0800 Subject: [PATCH 01/12] [Sema] Preserve ContainsUnexpandedParameterPack in Transfor

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

2024-07-18 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 edited https://github.com/llvm/llvm-project/pull/86265 ___ 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-18 Thread Younan Zhang via cfe-commits
@@ -14636,6 +14645,20 @@ TreeTransform::TransformLambdaExpr(LambdaExpr *E) { /*IsInstantiation*/ true); SavedContext.pop(); + // Parts other than the capture e.g. the lambda body might still contain a + // pattern that an outer fold exp

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

2024-07-18 Thread Younan Zhang via cfe-commits
@@ -23,3 +23,104 @@ namespace PR41576 { } static_assert(f(3, 4) == 6); // expected-note {{instantiation}} } + +namespace PR85667 { + +template +struct identity { + using type = T; +}; + +template void f() { + + static_assert([](Is... x) { +return ([I(x)] { + re

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

2024-07-18 Thread Younan Zhang via cfe-commits
@@ -14636,6 +14645,20 @@ TreeTransform::TransformLambdaExpr(LambdaExpr *E) { /*IsInstantiation*/ true); SavedContext.pop(); + // Parts other than the capture e.g. the lambda body might still contain a + // pattern that an outer fold exp

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

2024-07-18 Thread Younan Zhang via cfe-commits
@@ -23,3 +23,104 @@ namespace PR41576 { } static_assert(f(3, 4) == 6); // expected-note {{instantiation}} } + +namespace PR85667 { + +template +struct identity { + using type = T; +}; + +template void f() { + + static_assert([](Is... x) { +return ([I(x)] { + re

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

2024-07-18 Thread Younan Zhang via cfe-commits
@@ -14636,6 +14645,20 @@ TreeTransform::TransformLambdaExpr(LambdaExpr *E) { /*IsInstantiation*/ true); SavedContext.pop(); + // Parts other than the capture e.g. the lambda body might still contain a + // pattern that an outer fold exp

[clang] [Clang] fix generic lambda inside requires-clause of friend function template (PR #99813)

2024-07-21 Thread Younan Zhang via cfe-commits
@@ -1691,10 +1691,7 @@ class ConstraintRefersToContainingTemplateChecker using inherited::TransformTemplateTypeParmType; QualType TransformTemplateTypeParmType(TypeLocBuilder &TLB, TemplateTypeParmTypeLoc TL, bool) { -assert(TL.g

[clang] [Clang] fix generic lambda inside requires-clause of friend function template (PR #99813)

2024-07-21 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 edited https://github.com/llvm/llvm-project/pull/99813 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] fix generic lambda inside requires-clause of friend function template (PR #99813)

2024-07-21 Thread Younan Zhang via cfe-commits
@@ -1691,10 +1691,7 @@ class ConstraintRefersToContainingTemplateChecker using inherited::TransformTemplateTypeParmType; QualType TransformTemplateTypeParmType(TypeLocBuilder &TLB, TemplateTypeParmTypeLoc TL, bool) { -assert(TL.g

[clang] [Clang][NFCI] Prefer non-canonical template arguments for synthesized CTAD guides (PR #99840)

2024-07-21 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 created https://github.com/llvm/llvm-project/pull/99840 This seems to be low-hanging fruit: We could remove all calls to `Context.getCanonicalTemplateArgument()` and gain a better diagnostic/AST. The non-canonical template arguments shouldn't make a difference when

[clang] [Clang][NFCI] Prefer non-canonical template arguments for synthesized CTAD guides (PR #99840)

2024-07-22 Thread Younan Zhang via cfe-commits
zyn0217 wrote: Thanks for the prompt review. > There is an ambiguous case that I'm a little concerned about: if the alias > template parameter and the underlying template parameter have the same name, > the synthesized deduction guide may end up with two template parameters with > the same na

[clang] [Clang][NFCI] Prefer non-canonical template arguments for synthesized CTAD guides (PR #99840)

2024-07-22 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 closed https://github.com/llvm/llvm-project/pull/99840 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Fix #99858 (PR #99859)

2024-07-22 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 commented: Do you have a test against your changes? This also needs a release note. https://github.com/llvm/llvm-project/pull/99859 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailma

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

2024-07-22 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 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 Younan Zhang via cfe-commits
https://github.com/zyn0217 commented: Thanks for working on this. I did a rough look, and I think the general approach looks good. Although this unfortunately happens to be a duplicate work of #86265 (sorry I didn't get around to that during the 19 development cycle due to my timeframe), I thi

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

2024-07-22 Thread Younan Zhang 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 paramete

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

2024-07-22 Thread Younan Zhang via cfe-commits
@@ -0,0 +1,78 @@ +// RUN: %clang_cc1 -fsyntax-only -std=c++20 -verify %s zyn0217 wrote: It would be very nice if you can merge other tests from #86265 e.g. tests including constraints/noexcepts specifiers. That way this could completely supersede that. https:

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

2024-07-22 Thread Younan Zhang 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 paramete

[clang] [Clang][Sema] Revisit the fix for the lambda within a type alias template decl (PR #89934)

2024-04-24 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 created https://github.com/llvm/llvm-project/pull/89934 Previously commited as https://github.com/llvm/llvm-project/issues/82310. In the last patch, we used template depths to tell if such alias decls contain lambdas, which is wrong because the lambda can also appear

[clang] [Clang][Sema] Revisit the fix for the lambda within a type alias template decl (PR #89934)

2024-04-24 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/89934 >From 92f8cfb255a549769c39327239c69edd6b2e947e Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Wed, 24 Apr 2024 20:54:58 +0800 Subject: [PATCH] [Clang][Sema] Revisit the lambda within a type alias template dec

[clang] [Clang][Sema] Revisit the fix for the lambda within a type alias template decl (PR #89934)

2024-04-24 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 edited https://github.com/llvm/llvm-project/pull/89934 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] Revisit the fix for the lambda within a type alias template decl (PR #89934)

2024-04-24 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 edited https://github.com/llvm/llvm-project/pull/89934 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] Revisit the fix for the lambda within a type alias template decl (PR #89934)

2024-04-24 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 edited https://github.com/llvm/llvm-project/pull/89934 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] Revisit the fix for the lambda within a type alias template decl (PR #89934)

2024-04-24 Thread Younan Zhang via cfe-commits
zyn0217 wrote: I didn't add a release note because the previous patch has not been released yet. https://github.com/llvm/llvm-project/pull/89934 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cf

[clang] [Clang][Sema] Revisit the fix for the lambda within a type alias template decl (PR #89934)

2024-04-24 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 edited https://github.com/llvm/llvm-project/pull/89934 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] Revisit the fix for the lambda within a type alias template decl (PR #89934)

2024-04-24 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/89934 >From 92f8cfb255a549769c39327239c69edd6b2e947e Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Wed, 24 Apr 2024 20:54:58 +0800 Subject: [PATCH 1/2] [Clang][Sema] Revisit the lambda within a type alias template

[clang] [Clang][Sema] Revisit the fix for the lambda within a type alias template decl (PR #89934)

2024-04-24 Thread Younan Zhang via cfe-commits
zyn0217 wrote: > FYI in my issue, even if the lambda didn't appear as part of the default > argument, I was [still able to trigger the > bug](https://godbolt.org/z/4KrEMTTdd). Noting in case this fix only resolves > the case of lambdas in default template arguments, and not passed in > explic

[clang] [Clang][Sema] Revisit the fix for the lambda within a type alias template decl (PR #89934)

2024-04-24 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/89934 >From 92f8cfb255a549769c39327239c69edd6b2e947e Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Wed, 24 Apr 2024 20:54:58 +0800 Subject: [PATCH 1/3] [Clang][Sema] Revisit the lambda within a type alias template

[clang] [Clang][Sema] Revisit the fix for the lambda within a type alias template decl (PR #89934)

2024-04-24 Thread Younan Zhang via cfe-commits
@@ -91,15 +91,60 @@ void bar() { namespace GH82104 { -template int Zero = 0; +template int Value = sizeof...(D); -template -using T14 = decltype([]() { return Zero; }()); +template +using T14 = decltype([](auto Param) { + return Value + V + (int)sizeof(Param); +}("hell

[clang] [Clang][Sema] Revisit the fix for the lambda within a type alias template decl (PR #89934)

2024-04-24 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 ready_for_review https://github.com/llvm/llvm-project/pull/89934 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Sema] Avoid an undesired pack expansion while transforming PackIndexingType (PR #90195)

2024-04-26 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 created https://github.com/llvm/llvm-project/pull/90195 Fixes https://github.com/llvm/llvm-project/issues/88925 >From f708694fc2686684589dca7b8f3738a117fc047e Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Fri, 26 Apr 2024 19:06:57 +0800 Subject: [PATCH] [Sema] Av

[clang] [Sema] Avoid an undesired pack expansion while transforming PackIndexingType (PR #90195)

2024-04-26 Thread Younan Zhang via cfe-commits
@@ -160,3 +160,22 @@ namespace GH88929 { using E = P...[0]; // expected-error {{unknown type name 'P'}} \ // expected-error {{expected ';' after alias declaration}} } + +namespace GH88925 { +template struct S {}; + +template struct sequence {}; + +

[clang] [Sema] Avoid an undesired pack expansion while transforming PackIndexingType (PR #90195)

2024-04-26 Thread Younan Zhang via cfe-commits
@@ -160,3 +160,22 @@ namespace GH88929 { using E = P...[0]; // expected-error {{unknown type name 'P'}} \ // expected-error {{expected ';' after alias declaration}} } + +namespace GH88925 { +template struct S {}; + +template struct sequence {}; + +

[clang] [Sema] Avoid an undesired pack expansion while transforming PackIndexingType (PR #90195)

2024-04-26 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/90195 >From f708694fc2686684589dca7b8f3738a117fc047e Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Fri, 26 Apr 2024 19:06:57 +0800 Subject: [PATCH 1/2] [Sema] Avoid an undesired pack expansion while transforming P

[clang-tools-extra] [clangd] Show definition of underlying struct when hovering over a typedef (PR #89570)

2024-04-26 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 commented: Thanks for working on this! One thought from me. https://github.com/llvm/llvm-project/pull/89570 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clangd] Show definition of underlying struct when hovering over a typedef (PR #89570)

2024-04-26 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 edited https://github.com/llvm/llvm-project/pull/89570 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clangd] Show definition of underlying struct when hovering over a typedef (PR #89570)

2024-04-26 Thread Younan Zhang via cfe-commits
@@ -136,6 +136,41 @@ std::string getNamespaceScope(const Decl *D) { return ""; } +void printDeclAndWrappers(const TypedefNameDecl *TND, + llvm::raw_string_ostream &OS, PrintingPolicy PP) { + TND->print(OS, PP); + const Decl *LastPrintedDecl = TND;

[clang-tools-extra] [clangd] Show definition of underlying struct when hovering over a typedef (PR #89570)

2024-04-26 Thread Younan Zhang via cfe-commits
zyn0217 wrote: > (I still need to figure out how to do proper stacked PRs...) AFAIK, not possible unless our release manager installs e.g. [such an application](https://github.com/marketplace/stacked-pull-requests) to the repository; but candidly, I have never used it before so I have no idea

[clang] [Sema] Avoid an undesired pack expansion while transforming PackIndexingType (PR #90195)

2024-04-27 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/90195 >From f708694fc2686684589dca7b8f3738a117fc047e Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Fri, 26 Apr 2024 19:06:57 +0800 Subject: [PATCH 1/3] [Sema] Avoid an undesired pack expansion while transforming P

[clang] [Sema] Avoid an undesired pack expansion while transforming PackIndexingType (PR #90195)

2024-04-27 Thread Younan Zhang via cfe-commits
@@ -160,3 +160,22 @@ namespace GH88929 { using E = P...[0]; // expected-error {{unknown type name 'P'}} \ // expected-error {{expected ';' after alias declaration}} } + +namespace GH88925 { +template struct S {}; + +template struct sequence {}; + +

[clang] [Sema] Avoid an undesired pack expansion while transforming PackIndexingType (PR #90195)

2024-04-27 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/90195 >From f708694fc2686684589dca7b8f3738a117fc047e Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Fri, 26 Apr 2024 19:06:57 +0800 Subject: [PATCH 1/3] [Sema] Avoid an undesired pack expansion while transforming P

[clang] [Sema] Avoid an undesired pack expansion while transforming PackIndexingType (PR #90195)

2024-04-27 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 edited https://github.com/llvm/llvm-project/pull/90195 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] Fix a bug on template partial specialization with issue on deduction of nontype tempalte parameter (PR #90376)

2024-04-28 Thread Younan Zhang via cfe-commits
@@ -8508,6 +8507,16 @@ Sema::BuildExpressionFromDeclTemplateArgument(const TemplateArgument &Arg, } else { assert(ParamType->isReferenceType() && "unexpected type for decl template argument"); +if (ParamType->isLValueReferenceType()) + if (NonTypeTemp

[clang] [clang] Distinguish unresolved templates in UnresolvedLookupExpr (PR #89019)

2024-04-28 Thread Younan Zhang via cfe-commits
@@ -186,3 +186,74 @@ class E { #endif template using D = int; // expected-note {{declared here}} E ed; // expected-note {{instantiation of}} + +namespace non_functions { + +#if __cplusplus >= 201103L +namespace PR88832 { +template struct O { + static const T v = 0; +}; + +st

[clang] [Sema] Avoid an undesired pack expansion while transforming PackIndexingType (PR #90195)

2024-04-30 Thread Younan Zhang via cfe-commits
zyn0217 wrote: @cor3ntin Mind looking at it again? Thanks so much! https://github.com/llvm/llvm-project/pull/90195 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] Revisit the fix for the lambda within a type alias template decl (PR #89934)

2024-08-26 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/89934 >From 9eb7a15b385bff343969382c911d744ae954b7f0 Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Wed, 24 Apr 2024 20:54:58 +0800 Subject: [PATCH 1/4] [Clang][Sema] Revisit the lambda within a type alias template

[clang] [Clang][Sema] Revisit the fix for the lambda within a type alias template decl (PR #89934)

2024-08-26 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 closed https://github.com/llvm/llvm-project/pull/89934 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] Revisit the fix for the lambda within a type alias template decl (PR #89934)

2024-08-26 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 milestoned https://github.com/llvm/llvm-project/pull/89934 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] Revisit the fix for the lambda within a type alias template decl (PR #89934)

2024-08-26 Thread Younan Zhang via cfe-commits
zyn0217 wrote: /cherry-pick b412ec5d3 https://github.com/llvm/llvm-project/pull/89934 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] `__noop` not marked as constexpr #102064 (PR #105983)

2024-08-26 Thread Younan Zhang via cfe-commits
zyn0217 wrote: An off-topic concern: The issue was initially assigned to @AdiSin123 three weeks ago. Did you talk to @AdiSin123 to ensure that @AdiSin123 gives up the fix? It would be polite to ask first in the issue before you start working on this. https://github.com/llvm/llvm-project/pull/1

[clang] [libcxx] [Clang] Implement CWG2369 "Ordering between constraints and substitution" (PR #102857)

2024-08-28 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/102857 >From 1119f0a8d180e482bff45c999d488827ac5ae49e Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Mon, 12 Aug 2024 23:32:34 +0800 Subject: [PATCH 01/13] [Clang][NFCI] Slightly refactor getTemplateInstantiationAr

[clang] [libcxx] [Clang] Implement CWG2369 "Ordering between constraints and substitution" (PR #102857)

2024-08-28 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/102857 >From 1119f0a8d180e482bff45c999d488827ac5ae49e Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Mon, 12 Aug 2024 23:32:34 +0800 Subject: [PATCH 01/14] [Clang][NFCI] Slightly refactor getTemplateInstantiationAr

[clang] [libcxx] [Clang] Implement CWG2369 "Ordering between constraints and substitution" (PR #102857)

2024-08-28 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/102857 >From 1119f0a8d180e482bff45c999d488827ac5ae49e Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Mon, 12 Aug 2024 23:32:34 +0800 Subject: [PATCH 01/15] [Clang][NFCI] Slightly refactor getTemplateInstantiationAr

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