[clang] Fixing the logic issue in TransformTypos::TransformDesignatedInitExpr… (PR #127211)

2025-02-14 Thread Younan Zhang via cfe-commits
@@ -13665,21 +13665,22 @@ TreeTransform::TransformDesignatedInitExpr(DesignatedInitExpr *E) { } if (D.isArrayDesignator()) { - ExprResult Index = getDerived().TransformExpr(E->getArrayIndex(D)); - if (Index.isInvalid()) + // Transform the array index ex

[clang] Fixing the logic issue in TransformTypos::TransformDesignatedInitExpr… (PR #127211)

2025-02-16 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 approved this pull request. https://github.com/llvm/llvm-project/pull/127211 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Fixing the logic issue in TransformTypos::TransformDesignatedInitExpr… (PR #127211)

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

[clang] Fixing the logic issue in TransformTypos::TransformDesignatedInitExpr… (PR #127211)

2025-02-14 Thread Younan Zhang via cfe-commits
@@ -13665,15 +13665,15 @@ TreeTransform::TransformDesignatedInitExpr(DesignatedInitExpr *E) { } if (D.isArrayDesignator()) { - ExprResult Index = getDerived().TransformExpr(E->getArrayIndex(D)); - if (Index.isInvalid()) + ExprResult NewIndex = getDerive

[clang] [Clang] Implement CWG2918 'Consideration of constraints for address of overloaded function' (PR #127773)

2025-02-19 Thread Younan Zhang via cfe-commits
@@ -13443,9 +13499,9 @@ Sema::resolveAddressOfSingleOverloadCandidate(Expr *E, DeclAccessPair &Pair) { return nullptr; if (Result) { -SmallVector ResultAC; // We skipped over some ambiguous declarations which might be ambiguous with // the selected result

[clang] [Clang] Implement CWG2918 'Consideration of constraints for address of overloaded function' (PR #127773)

2025-02-19 Thread Younan Zhang via cfe-commits
@@ -1773,20 +1773,19 @@ bool Sema::IsAtLeastAsConstrained(NamedDecl *D1, NamedDecl *D2, MutableArrayRef AC2, bool &Result) { +#ifndef NDEBUG if (const auto *FD1 = dyn_cast(D

[clang] [Clang] Don't give up on an unsuccessful function instantiation (PR #126723)

2025-02-19 Thread Younan Zhang via cfe-commits
zyn0217 wrote: > > Technically swapping the first and second branches I mentioned above should > > work, but the last time I tried that it caused a regression and was > > reverted." > > > > Yeah, swapping the branches would have been a much simpler fix. > > > > What was the regression? Do

[clang] [Clang] Implement the core language parts of P2786 - Trivial relocation (PR #127636)

2025-02-20 Thread Younan Zhang via cfe-commits
@@ -7258,6 +7261,217 @@ void Sema::CheckCompletedCXXClass(Scope *S, CXXRecordDecl *Record) { } } +static bool hasSuitableConstructorForReplaceability(CXXRecordDecl *D, +bool Implicit) { + assert(D->hasDefinition() && !D->

[clang] [Clang] Implement the core language parts of P2786 - Trivial relocation (PR #127636)

2025-02-20 Thread Younan Zhang via cfe-commits
@@ -12427,6 +12427,11 @@ def err_builtin_invalid_arg_type: Error < "an 'int'|" "a vector of floating points}1 (was %2)">; +def err_builtin_trivially_relocate_invalid_arg_type: Error < + "first%select{||| and second}0 argument%select{|||s}0 to " zyn0217 wr

[clang] [Clang] Implement the core language parts of P2786 - Trivial relocation (PR #127636)

2025-02-20 Thread Younan Zhang via cfe-commits
@@ -2862,6 +2862,30 @@ bool QualType::isTriviallyRelocatableType(const ASTContext &Context) const { } } +bool QualType::isCppTriviallyRelocatableType(const ASTContext &Context) const { + QualType BaseElementType = Context.getBaseElementType(*this); + if (BaseElementType->

[clang] [Clang] Implement the core language parts of P2786 - Trivial relocation (PR #127636)

2025-02-20 Thread Younan Zhang via cfe-commits
@@ -757,7 +757,7 @@ static void InitializeCPlusPlusFeatureTestMacros(const LangOptions &LangOpts, Builder.defineMacro("__cpp_explicit_this_parameter", "202110L"); } - // We provide those C++23 features as extensions in earlier language modes, so + // We provide those

[clang] [Clang] Implement CWG2918 'Consideration of constraints for address of overloaded function' (PR #127773)

2025-02-20 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/127773 >From 2d9c248c70b6d24f277982a32f36e2ef1bde2829 Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Wed, 19 Feb 2025 17:13:56 +0800 Subject: [PATCH 1/3] [Clang] Implement CWG2918 'Consideration of constraints for

[clang] [Clang] Implement CWG2918 'Consideration of constraints for address of overloaded function' (PR #127773)

2025-02-20 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/127773 >From 2d9c248c70b6d24f277982a32f36e2ef1bde2829 Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Wed, 19 Feb 2025 17:13:56 +0800 Subject: [PATCH 1/4] [Clang] Implement CWG2918 'Consideration of constraints for

[clang] [clang][Index] Use HeuristicResolver in IndexTypeSourceInfo as well (PR #128106)

2025-02-20 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 edited https://github.com/llvm/llvm-project/pull/128106 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][Index] Use HeuristicResolver in IndexTypeSourceInfo as well (PR #128106)

2025-02-20 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 approved this pull request. Thanks, this is a nice improvement. not: I think it'd be better to say NFC in the PR title. https://github.com/llvm/llvm-project/pull/128106 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [clang][Index] Use HeuristicResolver in IndexTypeSourceInfo as well (PR #128106)

2025-02-20 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 edited https://github.com/llvm/llvm-project/pull/128106 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Implement CWG2918 'Consideration of constraints for address of overloaded function' (PR #127773)

2025-02-23 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/127773 >From 2d9c248c70b6d24f277982a32f36e2ef1bde2829 Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Wed, 19 Feb 2025 17:13:56 +0800 Subject: [PATCH 1/5] [Clang] Implement CWG2918 'Consideration of constraints for

[clang] [Clang] Implement CWG2918 'Consideration of constraints for address of overloaded function' (PR #127773)

2025-02-23 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/127773 >From 2d9c248c70b6d24f277982a32f36e2ef1bde2829 Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Wed, 19 Feb 2025 17:13:56 +0800 Subject: [PATCH 1/6] [Clang] Implement CWG2918 'Consideration of constraints for

[clang] [Clang] Handle instantiating captures in addInstantiatedCapturesToScope() (PR #128478)

2025-02-23 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 created https://github.com/llvm/llvm-project/pull/128478 `addInstantiatedCapturesToScope()` might be called when transforming a lambda body. In this situation, it would look into all the lambda's parents and figure out all the instantiated captures. However, the inst

[clang] [Clang] Handle instantiating captures in addInstantiatedCapturesToScope() (PR #128478)

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

[clang] [Clang] Implement CWG2918 'Consideration of constraints for address of overloaded function' (PR #127773)

2025-02-20 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/127773 >From 2d9c248c70b6d24f277982a32f36e2ef1bde2829 Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Wed, 19 Feb 2025 17:13:56 +0800 Subject: [PATCH 1/2] [Clang] Implement CWG2918 'Consideration of constraints for

[clang] [Clang] Implement CWG2918 'Consideration of constraints for address of overloaded function' (PR #127773)

2025-02-20 Thread Younan Zhang via cfe-commits
@@ -60,6 +60,90 @@ struct S { #endif } // namespace cwg2917 +namespace cwg2918 { // cwg2918: 21 + +#if __cplusplus >= 202002L zyn0217 wrote: Done. Now it tests `Example3` in C++11 onwards (Example 1 contains constraint expressions so it needs c++20) https://

[clang] [Clang] Implement CWG2918 'Consideration of constraints for address of overloaded function' (PR #127773)

2025-02-20 Thread Younan Zhang via cfe-commits
@@ -13252,6 +13273,33 @@ class AddressOfFunctionResolver { } } + void EliminateLessPartialOrderingConstrainedMatches() { +// C++ [over.over]p5: +// [...] Any given non-template function F0 is eliminated if the set +// contains a second non-template funct

[clang] [Clang] Fix an integer overflow issue in computing CTAD's parameter depth (PR #128704)

2025-02-25 Thread Younan Zhang via cfe-commits
zyn0217 wrote: > Need to add a release note as it fixes an existing issue. Do you think we need a backport? If so, we can add the release note in the backport PR https://github.com/llvm/llvm-project/pull/128704 ___ cfe-commits mailing list cfe-commit

[clang] [Clang] Fix an integer overflow issue in computing CTAD's parameter depth (PR #128704)

2025-02-25 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 ready_for_review https://github.com/llvm/llvm-project/pull/128704 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Implement CWG2918 'Consideration of constraints for address of overloaded function' (PR #127773)

2025-02-25 Thread Younan Zhang via cfe-commits
zyn0217 wrote: I'll merge it as-is now - post review comments are welcome https://github.com/llvm/llvm-project/pull/127773 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Implement CWG2918 'Consideration of constraints for address of overloaded function' (PR #127773)

2025-02-25 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 closed https://github.com/llvm/llvm-project/pull/127773 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Fix an integer overflow issue in computing CTAD's parameter depth (PR #128704)

2025-02-26 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/128704 >From eeae197a06bf4a7c23d8c517dc87807608d8dd86 Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Tue, 25 Feb 2025 19:56:40 +0800 Subject: [PATCH 1/2] [Clang] Fix an integer overflow issue in computing CTAD's pa

[clang] [Clang] Fix an integer overflow issue in computing CTAD's parameter depth (PR #128704)

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

[clang] [Clang] Fix an integer overflow issue in computing CTAD's parameter depth (PR #128704)

2025-02-26 Thread Younan Zhang via cfe-commits
zyn0217 wrote: I'll go ahead and merge this, and add the release note in the backport PR - else I have to tackle annoying merge conflicts https://github.com/llvm/llvm-project/pull/128704 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://

[clang] [Clang] Fix an integer overflow issue in computing CTAD's parameter depth (PR #128704)

2025-02-26 Thread Younan Zhang via cfe-commits
zyn0217 wrote: (Backport PR at https://github.com/llvm/llvm-project/pull/128845) https://github.com/llvm/llvm-project/pull/128704 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Fix an integer overflow issue in computing CTAD's parameter depth (PR #128704)

2025-02-25 Thread Younan Zhang via cfe-commits
@@ -377,8 +377,12 @@ struct ConvertConstructorToDeductionGuideTransform { if (NestedPattern) Args.addOuterRetainedLevels(NestedPattern->getTemplateDepth()); auto [Depth, Index] = getDepthAndIndex(Param); +assert(Depth || + cast(FT

[clang] [Clang] Fix an integer overflow issue in computing CTAD's parameter depth (PR #128704)

2025-02-25 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 edited https://github.com/llvm/llvm-project/pull/128704 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Fix an integer overflow issue in computing CTAD's parameter depth (PR #128704)

2025-02-25 Thread Younan Zhang via cfe-commits
@@ -377,8 +377,12 @@ struct ConvertConstructorToDeductionGuideTransform { if (NestedPattern) Args.addOuterRetainedLevels(NestedPattern->getTemplateDepth()); auto [Depth, Index] = getDepthAndIndex(Param); +assert(Depth || + cast(FT

[clang] [Clang] Fix an integer overflow issue in computing CTAD's parameter depth (PR #128704)

2025-02-25 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 created https://github.com/llvm/llvm-project/pull/128704 There were some cases where we computed incorrect template parameter depths for synthesized CTAD, invalid as they might be, we still shouldn't crash anyway. Fixes https://github.com/llvm/llvm-project/issues/128

[clang] [Clang] use constant evaluation context for constexpr if conditions (PR #123667)

2025-02-27 Thread Younan Zhang via cfe-commits
@@ -2203,8 +2203,18 @@ Parser::ParseCXXCondition(StmtResult *InitStmt, SourceLocation Loc, return ParseCXXCondition(nullptr, Loc, CK, MissingOK); } -// Parse the expression. -ExprResult Expr = ParseExpression(); // expression +ExprResult Expr; +{ +

[clang] Reapply "[Clang] Improve diagnostics for expansion length mismatch" (PR #121044)

2025-03-31 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/121044 >From 77537d523bc164a86b46e83651500a4b37c0c3bf Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Tue, 24 Dec 2024 13:06:44 +0800 Subject: [PATCH 1/6] Reapply "[Clang] Improve diagnostics for expansion length mi

[clang] [clang] implement common-sugar for adjusted member-pointers (PR #133613)

2025-03-29 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 approved this pull request. https://github.com/llvm/llvm-project/pull/133613 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Ensure the instantiation of array initializers for decltype/_typeof operator (PR #133575)

2025-03-29 Thread Younan Zhang via cfe-commits
zyn0217 wrote: > I find myself wanting a `RequireCompleteType` (or just `CompletesType` - > maybe with asserts that check that the resulting types is indeed complete) > overload that does not take a diagnostic. `getCompletedType` does not make it > clear what it does. And comments would help

[clang] [Clang] Ensure the instantiation of array initializers for decltype/_typeof operator (PR #133575)

2025-03-29 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/133575 >From 1100d56138a09a850aed4857ee69bffcff10fc6d Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Sat, 29 Mar 2025 16:42:12 +0800 Subject: [PATCH 1/2] [Clang] Ensure the instantiation of array initializers for d

[clang] Reapply "[Clang] Improve diagnostics for expansion length mismatch" (PR #121044)

2025-03-31 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/121044 >From 77537d523bc164a86b46e83651500a4b37c0c3bf Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Tue, 24 Dec 2024 13:06:44 +0800 Subject: [PATCH 1/7] Reapply "[Clang] Improve diagnostics for expansion length mi

[clang] Reapply "[Clang] Improve diagnostics for expansion length mismatch" (PR #121044)

2025-03-31 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/121044 >From 77537d523bc164a86b46e83651500a4b37c0c3bf Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Tue, 24 Dec 2024 13:06:44 +0800 Subject: [PATCH 1/9] Reapply "[Clang] Improve diagnostics for expansion length mi

[clang] Reapply "[Clang] Improve diagnostics for expansion length mismatch" (PR #121044)

2025-03-31 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/121044 >From 77537d523bc164a86b46e83651500a4b37c0c3bf Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Tue, 24 Dec 2024 13:06:44 +0800 Subject: [PATCH 1/8] Reapply "[Clang] Improve diagnostics for expansion length mi

[clang] [Clang] Fix dependent local class instantiation bugs (PR #134038)

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

[clang] [Clang] Fix dependent local class instantiation bugs (PR #134038)

2025-04-03 Thread Younan Zhang via cfe-commits
zyn0217 wrote: I talked to @erichkeane and updated the approach to make it feel less like a workaround and independent of lambda instantiation. As noted, both cases worked prior to clang 15, which means they didn’t rely on deferred lambda body instantiation to compile correctly. Regarding the

[clang] [clang][AST] Fix end location of DeclarationNameInfo on instantiated methods (PR #92654)

2025-04-03 Thread Younan Zhang via cfe-commits
zyn0217 wrote: @Abramo-Bagnara @steakhal I noticed the same issue and I have posted the fix in #134038 https://github.com/llvm/llvm-project/pull/92654 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listi

[clang] [Clang] fixed clang frontend crash with friend class declaration and overload == (PR #133878)

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

[clang] [Clang] Fix a lambda pattern comparison mismatch after ecc7e6ce4 (PR #133863)

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

[clang] [Clang] Fix a lambda pattern comparison mismatch after ecc7e6ce4 (PR #133863)

2025-04-02 Thread Younan Zhang via cfe-commits
zyn0217 wrote: /cherry-pick dcc2182bce https://github.com/llvm/llvm-project/pull/133863 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Check `std::initializer_list` more strictly (PR #133822)

2025-04-02 Thread Younan Zhang via cfe-commits
@@ -0,0 +1,77 @@ +// RUN: %clang_cc1 %s -verify=expected,type-param -std=c++23 -DTYPE_PARAM +// RUN: %clang_cc1 %s -verify=expected,others -std=c++23 -DCONSTANT_PARAM +// RUN: %clang_cc1 %s -verify=expected,others -std=c++23 -DTYPE_TEMPLATE_PARAM +// RUN: %clang_cc1 %s -verify=exp

[clang] [Clang] Fix a lambda pattern comparison mismatch after ecc7e6ce4 (PR #133863)

2025-04-02 Thread Younan Zhang via cfe-commits
zyn0217 wrote: /cherry-pick dcc2182bc https://github.com/llvm/llvm-project/pull/133863 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Check `std::initializer_list` more strictly (PR #133822)

2025-04-02 Thread Younan Zhang via cfe-commits
@@ -12155,16 +12185,16 @@ static ClassTemplateDecl *LookupStdInitializerList(Sema &S, SourceLocation Loc){ Result.suppressDiagnostics(); // We found something weird. Complain about the first thing we found. NamedDecl *Found = *Result.begin(); -S.Diag(Found->get

[clang] [Clang] Fix dependent local class instantiation bugs (PR #134038)

2025-04-04 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/134038 >From a670287721da08e54e2908e9abe52ad86a92769b Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Wed, 2 Apr 2025 14:44:40 +0800 Subject: [PATCH 1/5] [Clang] Fix dependent local class instantiation bugs --- cla

[clang] [Clang][WIP][RFC] Bypass TAD during overload resolution if a perfect match exists (PR #133426)

2025-04-04 Thread Younan Zhang via cfe-commits
@@ -10918,7 +11083,44 @@ bool OverloadCandidate::NotValidBecauseConstraintExprHasError() const { OverloadingResult OverloadCandidateSet::BestViableFunction(Sema &S, SourceLocation Loc, iterator &Best) { + + bool TwoPhaseResolution = +

[clang] [Clang] Fix various bugs in alias CTAD transform (PR #132061)

2025-04-04 Thread Younan Zhang via cfe-commits
@@ -1650,6 +1665,23 @@ namespace { return inherited::TransformTemplateArgument(Input, Output, Uneval); } +std::optional ComputeSizeOfPackExprWithoutSubstitution( +ArrayRef PackArgs) { + // Don't do this when rewriting template parameters for CTAD: +

[clang] [clang] fix RecursiveASTVisitor traversal from type to decl (PR #132551)

2025-03-22 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 approved this pull request. I think it would be better to have a release note as it looks like a potential behavior change of ASTVisitor. Otherwise feel free to merge to put out the fire. https://github.com/llvm/llvm-project/pull/132551 __

[clang] [Clang] Fix various bugs in alias CTAD transform (PR #132061)

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

[clang] [Clang] Fix the assertion condition after b8d1f3d6 (PR #132669)

2025-03-23 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 edited https://github.com/llvm/llvm-project/pull/132669 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Fix various bugs in alias CTAD transform (PR #132061)

2025-03-20 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 edited https://github.com/llvm/llvm-project/pull/132061 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Fix the assertion condition after b8d1f3d6 (PR #132669)

2025-03-23 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 converted_to_draft https://github.com/llvm/llvm-project/pull/132669 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Fix the assertion condition after b8d1f3d6 (PR #132669)

2025-03-23 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/132669 >From 27a42c2b5186b8bd5a71ca7e8bc574439d21e7fd Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Mon, 24 Mar 2025 12:43:17 +0800 Subject: [PATCH 1/2] [Clang] Fix the assertion condition after b8d1f3d6 MIME-Versi

[clang] [Clang] Fix the assertion condition after b8d1f3d6 (PR #132669)

2025-03-23 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/132669 >From 2894090c356438867c182fd76c9b89354c0bafee Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Mon, 24 Mar 2025 12:43:17 +0800 Subject: [PATCH 1/2] [Clang] Fix the assertion condition after b8d1f3d6 MIME-Versi

[clang] [clang-tools-extra] [clang] Concepts: support pack expansions for type constraints (PR #132626)

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

[clang] [clang-tools-extra] [clang] Concepts: support pack expansions for type constraints (PR #132626)

2025-03-24 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 commented: And, I think this also merits a compile-time regression test - we now hold more bytes when instantiating the constraint https://github.com/llvm/llvm-project/pull/132626 ___ cfe-commits mailing list cfe-commits@lis

[clang] [clang-tools-extra] [clang] Concepts: support pack expansions for type constraints (PR #132626)

2025-03-24 Thread Younan Zhang via cfe-commits
@@ -3239,61 +3162,11 @@ bool Sema::SubstTypeConstraint( TC->getTemplateArgsAsWritten(); if (!EvaluateConstraints) { -bool ShouldExpandExplicitTemplateArgs = -TemplArgInfo && ArgumentPackSubstitutionIndex != -1 && -llvm::any_of(TemplArgInfo->argument

[clang] [Clang] Fix the assertion condition after b8d1f3d6 (PR #132669)

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

[clang] [Clang] Fix the assertion condition after b8d1f3d6 (PR #132669)

2025-03-23 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 edited https://github.com/llvm/llvm-project/pull/132669 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Fix various bugs in alias CTAD transform (PR #132061)

2025-03-23 Thread Younan Zhang via cfe-commits
@@ -1072,12 +1072,27 @@ BuildDeductionGuideForTypeAlias(Sema &SemaRef, AliasRhsTemplateArgs, TDeduceInfo, DeduceResults, /*NumberOfArgumentsMustMatch=*/false); + static std::function IsNonDeducedArgument = zyn0217 wrote: Ah sorry I saw the commen

[clang] [Clang] Fix the assertion condition after b8d1f3d6 (PR #132669)

2025-03-23 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 edited https://github.com/llvm/llvm-project/pull/132669 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Fix the assertion condition after b8d1f3d6 (PR #132669)

2025-03-23 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/132669 >From 27a42c2b5186b8bd5a71ca7e8bc574439d21e7fd Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Mon, 24 Mar 2025 12:43:17 +0800 Subject: [PATCH 1/2] [Clang] Fix the assertion condition after b8d1f3d6 MIME-Versi

[clang] [clang] Implement CWG2803 and CWG2958 (PR #132779)

2025-03-25 Thread Younan Zhang via cfe-commits
@@ -110,6 +110,8 @@ Resolutions to C++ Defect Reports two releases. The improvements to template template parameter matching implemented in the previous release, as described in P3310 and P3579, made this flag unnecessary. +- Implemented `CWG2803 Overload resolution for

[clang] [Clang] fixed clang frontend crash with friend class declaration and overload == (PR #133878)

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

[clang] [Clang] fixed clang frontend crash with friend class declaration and overload == (PR #133878)

2025-04-02 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 approved this pull request. Thanks https://github.com/llvm/llvm-project/pull/133878 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Implement CWG2517 Useless restriction on use of parameter in constraint-expression (PR #132919)

2025-03-25 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 commented: Thanks for the prompt patch. https://github.com/llvm/llvm-project/pull/132919 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Correct the DeclRefExpr's Type after the initializer gets instantiated (PR #133212)

2025-03-26 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 created https://github.com/llvm/llvm-project/pull/133212 The instantiation of a VarDecl's initializer might be deferred until the variable is actually used. However, we were still building the DeclRefExpr with a type that could later be changed by the initializer's i

[clang] [Clang] Correct the DeclRefExpr's Type after the initializer gets instantiated (PR #133212)

2025-03-27 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/133212 >From 34632d01840af89745dc79d27e06bd86aeb04c84 Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Thu, 27 Mar 2025 13:58:36 +0800 Subject: [PATCH 1/3] [Clang] Correct the DeclRefExpr's Type after the initializer

[clang] [Clang] Correct the DeclRefExpr's Type after the initializer gets instantiated (PR #133212)

2025-03-27 Thread Younan Zhang via cfe-commits
@@ -19849,11 +19849,14 @@ static void DoMarkVarDeclReferenced( SemaRef.InstantiateVariableDefinition(PointOfInstantiation, Var); }); -// Re-set the member to trigger a recomputation of the dependence bits -// for the expression. -if (a

[clang] [Clang] Correct the DeclRefExpr's Type after the initializer gets instantiated (PR #133212)

2025-03-27 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/133212 >From 34632d01840af89745dc79d27e06bd86aeb04c84 Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Thu, 27 Mar 2025 13:58:36 +0800 Subject: [PATCH 1/3] [Clang] Correct the DeclRefExpr's Type after the initializer

[clang] [Clang] Correct the DeclRefExpr's Type after the initializer gets instantiated (PR #133212)

2025-03-27 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/133212 >From 34632d01840af89745dc79d27e06bd86aeb04c84 Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Thu, 27 Mar 2025 13:58:36 +0800 Subject: [PATCH 1/4] [Clang] Correct the DeclRefExpr's Type after the initializer

[clang] [clang] ASTContex: fix getCommonSugaredType for array types (PR #132559)

2025-03-25 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 approved this pull request. https://github.com/llvm/llvm-project/pull/132559 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Correct the DeclRefExpr's Type after the initializer gets instantiated (PR #133212)

2025-03-27 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 closed https://github.com/llvm/llvm-project/pull/133212 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Improve subsumption. (PR #132849)

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

[clang] [Clang] Improve subsumption. (PR #132849)

2025-03-27 Thread Younan Zhang via cfe-commits
@@ -170,102 +132,112 @@ struct alignas(ConstraintAlignment) FoldExpandedConstraint { const Expr *Pattern) : Kind(K), Constraint(std::move(C)), Pattern(Pattern) {}; - template - bool subsumes(const FoldExpandedConstraint &Other, -

[clang] [Clang] Improve subsumption. (PR #132849)

2025-03-27 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 approved this pull request. One small nit Otherwise looks great, thanks! https://github.com/llvm/llvm-project/pull/132849 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listin

[clang] [Clang] Fix dependent local class instantiation bugs (PR #134038)

2025-04-02 Thread Younan Zhang via cfe-commits
@@ -4264,7 +4264,8 @@ Sema::InstantiateClassMembers(SourceLocation PointOfInstantiation, if (FunctionDecl *Pattern = Function->getInstantiatedFromMemberFunction()) { -if (Function->isIneligibleOrNotSelected()) +if (!Instantiation->getDeclCo

[clang] [Clang] Fix dependent local class instantiation bugs (PR #134038)

2025-04-02 Thread Younan Zhang via cfe-commits
zyn0217 wrote: > This once again looks like an attempt at hacking around our lack of delayed > lambda body instantiation... And this one has some pretty sizable negatives > as far as I can see. I'm not sure I really like this direction. Yeah, admittedly this is another workaround of not havin

[clang] [Clang] Fix dependent local class instantiation bugs (PR #134038)

2025-04-02 Thread Younan Zhang via cfe-commits
zyn0217 wrote: > I wouldn't be able to convince you to start work on the delayed lambda body > instantiation instead, would I ? :-P AFAIK @LYP951018 is already working on this region. Though I haven't test that patch with it yet 🥲 https://github.com/llvm/llvm-project/pull/134038

[clang] [Clang] Fix dependent local class instantiation bugs (PR #134038)

2025-04-02 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/134038 >From a670287721da08e54e2908e9abe52ad86a92769b Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Wed, 2 Apr 2025 14:44:40 +0800 Subject: [PATCH 1/2] [Clang] Fix dependent local class instantiation bugs --- cla

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

2025-04-02 Thread Younan Zhang via cfe-commits
zyn0217 wrote: It's still broken, and I haven’t figured out an approach to fix the regression. I do recall that we were planning to wire up Sema and the constant evaluator, so this patch might end up being completely superseded if that gets implemented. https://github.com/llvm/llvm-project/pul

[clang] [Clang] Implement CWG2517 Useless restriction on use of parameter in constraint-expression (PR #132919)

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

[clang] [Clang] Fix a lambda pattern comparison mismatch after ecc7e6ce4 (PR #133863)

2025-04-04 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 created https://github.com/llvm/llvm-project/pull/133863 In ecc7e6ce4, we tried to inspect the `LambdaScopeInfo` on stack to recover the instantiating lambda captures. However, there was a mismatch in how we compared the pattern declarations of lambdas: the constrain

[clang] [C++20] Fix crash with invalid concept requirement (PR #138877)

2025-05-07 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 approved this pull request. Thanks! https://github.com/llvm/llvm-project/pull/138877 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Stop changing DC when instantiating dependent friend specializations (PR #139436)

2025-05-12 Thread Younan Zhang via cfe-commits
@@ -5751,14 +5751,16 @@ void Sema::InstantiateFunctionDefinition(SourceLocation PointOfInstantiation, RebuildTypeSourceInfoForDefaultSpecialMembers(); SetDeclDefaulted(Function, PatternDecl->getLocation()); } else { -NamedDecl *ND = Function; -DeclContext *DC

[clang] [Clang][RFC] Do not eat SFINAE diagnostics for explicit template arguments (PR #139066)

2025-05-12 Thread Younan Zhang via cfe-commits
@@ -12166,6 +12174,15 @@ static void DiagnoseBadDeduction(Sema &S, NamedDecl *Found, Decl *Templated, diag::note_ovl_candidate_explicit_arg_mismatch_unnamed) << (index + 1); } + +if (PartialDiagnosticAt *PDiag = DeductionFailure.getSFINAEDiagnost

[clang] [Clang] Stop changing DC when instantiating dependent friend specializations (PR #139436)

2025-05-12 Thread Younan Zhang via cfe-commits
@@ -5751,14 +5751,16 @@ void Sema::InstantiateFunctionDefinition(SourceLocation PointOfInstantiation, RebuildTypeSourceInfoForDefaultSpecialMembers(); SetDeclDefaulted(Function, PatternDecl->getLocation()); } else { -NamedDecl *ND = Function; -DeclContext *DC

[clang] [Clang][Sema] Disable checking invalid template id in primary variable template initializer (PR #139490)

2025-05-11 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 commented: I think we would prefer a revert than adding dead blocks https://github.com/llvm/llvm-project/pull/139490 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe

[clang] [clang][AST] Pass ProfileArguments by value in findSpecialization{Impl,Locally} (PR #139489)

2025-05-11 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 approved this pull request. https://github.com/llvm/llvm-project/pull/139489 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Don't ditch typo-corrected lookup result (PR #139374)

2025-05-10 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 closed https://github.com/llvm/llvm-project/pull/139374 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Don't ditch typo-corrected lookup result (PR #139374)

2025-05-10 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 created https://github.com/llvm/llvm-project/pull/139374 For a member function call like 'foo.bar()', there are two typo-correction points after parsing the dot. The first occurs in ParseOptionalCXXScopeSpecifier, which tries to annotate the template name following

[clang-tools-extra] [clangd] Add tweak to add pure virtual overrides (PR #139348)

2025-05-10 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 edited https://github.com/llvm/llvm-project/pull/139348 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

<    14   15   16   17   18   19   20   21   >