[clang] [clang] [ASTDump] Add support for structural value template arguments in TextNodeDumper (PR #126341)

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

[clang] [clang][AST] Handle dependent representation of call to function with explicit object parameter in CallExpr::getBeginLoc() (PR #126868)

2025-02-13 Thread Younan Zhang via cfe-commits
zyn0217 wrote: > > While this may not be the most optimal solution, we can likely go with it > > as-is to put the fire out. > > Given [this > comment](https://github.com/llvm/llvm-project/pull/126868#discussion_r1953948099) > (i.e. that the behaviour with this patch is correct for the depende

[clang] [clang][AST] Handle dependent representation of call to function with explicit object parameter in CallExpr::getBeginLoc() (PR #126868)

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

[clang] [clang] [ASTDump] Add support for structural value template arguments in TextNodeDumper (PR #126341)

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

[clang] [clang][AST] Handle dependent representation of call to function with explicit object parameter in CallExpr::getBeginLoc() (PR #126868)

2025-02-12 Thread Younan Zhang via cfe-commits
@@ -1645,11 +1645,21 @@ SourceLocation CallExpr::getBeginLoc() const { if (const auto *OCE = dyn_cast(this)) return OCE->getBeginLoc(); + // A non-dependent call to a member function with an explicit object parameter + // is modelled with the object expression being t

[clang] [Clang] Remove the PackExpansion restrictions for rewrite substitution (PR #126206)

2025-02-13 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/126206 >From 2ce86d8842b7b37141d4a415830880b9d1d30260 Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Fri, 7 Feb 2025 17:15:05 +0800 Subject: [PATCH 1/2] [Clang] Remove the PackExpansion restrictions for rewrite sub

[clang] [clang][ASTDump] Dump value of structural TemplateArguments (PR #126937)

2025-02-12 Thread Younan Zhang via cfe-commits
zyn0217 wrote: FYI https://github.com/llvm/llvm-project/pull/126341 is doing exactly the same thing https://github.com/llvm/llvm-project/pull/126937 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinf

[clang] [clang][Index] Use HeuristicResolver in libIndex (PR #125153)

2025-02-16 Thread Younan Zhang via cfe-commits
@@ -168,51 +169,33 @@ class BodyIndexer : public RecursiveASTVisitor { Parent, ParentDC, Roles, Relations, E); } - bool indexDependentReference( - const Expr *E, const Type *T, const DeclarationNameInfo &NameInfo, - llvm::funct

[clang] [clang][Index] Use HeuristicResolver in libIndex (PR #125153)

2025-02-16 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 edited https://github.com/llvm/llvm-project/pull/125153 ___ 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 libIndex (PR #125153)

2025-02-16 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 commented: Thanks, the improvement looks good https://github.com/llvm/llvm-project/pull/125153 ___ 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 libIndex (PR #125153)

2025-02-16 Thread Younan Zhang via cfe-commits
@@ -168,51 +169,33 @@ class BodyIndexer : public RecursiveASTVisitor { Parent, ParentDC, Roles, Relations, E); } - bool indexDependentReference( - const Expr *E, const Type *T, const DeclarationNameInfo &NameInfo, - llvm::funct

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

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

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

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

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

2025-02-11 Thread Younan Zhang via cfe-commits
zyn0217 wrote: Compile time tracker: http://llvm-compile-time-tracker.com/compare.php?from=83a8bb363ad578da67a7cb568460a3871ce0ad8b&to=21ca76a13ca62715ce98fb2c8b0361df727769b0 I think the difference is acceptable? https://github.com/llvm/llvm-project/pull/126723 ___

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

2025-02-11 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/126723 >From 21ca76a13ca62715ce98fb2c8b0361df727769b0 Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Tue, 11 Feb 2025 17:13:34 +0800 Subject: [PATCH 1/2] [Clang] Don't give up on an unsuccessful function instantiat

[clang] [clang][AST] Handle dependent representation of call to function with explicit object parameter in CallExpr::getBeginLoc() (PR #126868)

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

[clang] [clang][AST] Handle dependent representation of call to function with explicit object parameter in CallExpr::getBeginLoc() (PR #126868)

2025-02-12 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 commented: Thanks for the patch. While this may not be the most optimal solution, we can likely go with it as-is to put the fire out. (I think @cor3ntin is not present right now) https://github.com/llvm/llvm-project/pull/126868 ___

[clang] [clang][AST] Handle dependent representation of call to function with explicit object parameter in CallExpr::getBeginLoc() (PR #126868)

2025-02-12 Thread Younan Zhang via cfe-commits
@@ -1648,8 +1648,11 @@ SourceLocation CallExpr::getBeginLoc() const { if (const auto *Method = dyn_cast_if_present(getCalleeDecl()); Method && Method->isExplicitObjectMemberFunction()) { -assert(getNumArgs() > 0 && getArg(0)); -return getArg(0)->getBeg

[clang] [clang][AST] Handle dependent representation of call to function with explicit object parameter in CallExpr::getBeginLoc() (PR #126868)

2025-02-12 Thread Younan Zhang via cfe-commits
@@ -1648,8 +1648,11 @@ SourceLocation CallExpr::getBeginLoc() const { if (const auto *Method = dyn_cast_if_present(getCalleeDecl()); Method && Method->isExplicitObjectMemberFunction()) { -assert(getNumArgs() > 0 && getArg(0)); -return getArg(0)->getBeg

[clang] [Sema] Add code completion for if constexpr (PR #124315)

2025-02-15 Thread Younan Zhang via cfe-commits
@@ -6749,6 +6749,21 @@ void SemaCodeCompletion::CodeCompleteInitializer(Scope *S, Decl *D) { CodeCompleteExpression(S, Data); } +void SemaCodeCompletion::CodeCompleteIfConstExpr(Scope *S) const { + ResultBuilder Results(SemaRef, CodeCompleter->getAllocator(), +

[clang] [Sema] Add code completion for if constexpr (PR #124315)

2025-02-15 Thread Younan Zhang via cfe-commits
@@ -6749,6 +6749,21 @@ void SemaCodeCompletion::CodeCompleteInitializer(Scope *S, Decl *D) { CodeCompleteExpression(S, Data); } +void SemaCodeCompletion::CodeCompleteIfConstExpr(Scope *S) const { + ResultBuilder Results(SemaRef, CodeCompleter->getAllocator(), +

[clang] [Clang] Implement P0963R3 "Structured binding declaration as a condition" (PR #130228)

2025-03-15 Thread Younan Zhang via cfe-commits
@@ -5218,16 +5218,28 @@ static bool EvaluateVarDecl(EvalInfo &Info, const VarDecl *VD) { return true; } +static bool EvaluateDecompositionDeclInit(EvalInfo &Info, + const DecompositionDecl *DD); + static bool EvaluateDecl(EvalInfo &

[clang] [Clang] Implement P0963R3 "Structured binding declaration as a condition" (PR #130228)

2025-03-15 Thread Younan Zhang via cfe-commits
@@ -5218,16 +5218,28 @@ static bool EvaluateVarDecl(EvalInfo &Info, const VarDecl *VD) { return true; } +static bool EvaluateDecompositionDeclInit(EvalInfo &Info, + const DecompositionDecl *DD); + static bool EvaluateDecl(EvalInfo &

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

2025-03-19 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 created https://github.com/llvm/llvm-project/pull/132061 (I'll add more details to the description tomorrow) Fixes #123591 Fixes #127539 Fixes #129077 Fixes #129998 >From fb9fa67da10a7dbfb2db5520d2773085585f4c14 Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Thu,

[clang] [Clang][Sema] Retain the expanding index for unevaluated type constraints (PR #109518)

2025-03-22 Thread Younan Zhang via cfe-commits
zyn0217 wrote: > @zyn0217 > > > > I am having second thoughts on both this PR and the follow up fix > https://github.com/llvm/llvm-project/commit/adb0d8ddceb143749c519d14b8b31b481071da77 > > > > We shouldn't be adding information that is required for correct substitution > into `SubstTem

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

2025-03-23 Thread Younan Zhang via cfe-commits
zyn0217 wrote: @cor3ntin do you have any other concerns? thanks https://github.com/llvm/llvm-project/pull/121044 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2025-03-21 Thread Younan Zhang via cfe-commits
@@ -749,132 +759,124 @@ ExprResult Sema::CheckPackExpansion(Expr *Pattern, SourceLocation EllipsisLoc, PackExpansionExpr(Context.DependentTy, Pattern, EllipsisLoc, NumExpansions); } +static bool IsUnexpandedPackExpansion(const TemplateArgument &TA) { + if (!TA.isPackExp

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

2025-03-21 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/132061 >From fb9fa67da10a7dbfb2db5520d2773085585f4c14 Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Thu, 20 Mar 2025 00:54:54 +0800 Subject: [PATCH 1/5] [Clang] Fix various bugs in alias CTAD transform --- clang/

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

2025-03-21 Thread Younan Zhang via cfe-commits
@@ -1072,12 +1072,25 @@ BuildDeductionGuideForTypeAlias(Sema &SemaRef, AliasRhsTemplateArgs, TDeduceInfo, DeduceResults, /*NumberOfArgumentsMustMatch=*/false); + static auto IsNonDeducedArgument = [&](const DeducedTemplateArgument &TA) { +// The following case

[clang] Minor unused variable error for sanitizer builds (PR #132372)

2025-03-21 Thread Younan Zhang via cfe-commits
@@ -11761,7 +11761,7 @@ void OMPClauseReader::VisitOMPReductionClause(OMPReductionClause *C) { unsigned NumFlags = Record.readInt(); SmallVector Flags; Flags.reserve(NumFlags); - for (unsigned I : llvm::seq(NumFlags)) + for ([[maybe_unused]] unsigned I : llvm::seq(NumF

[clang] [Clang][NFC] Use MarkUsedTemplateParameters in building alias CTAD guides (PR #132369)

2025-03-21 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/132369 >From ab0cca1c85dcf08ba78e4f916325c86f5a425b8f Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Fri, 21 Mar 2025 18:18:39 +0800 Subject: [PATCH 1/2] [Clang][NFC] Use MarkUsedTemplateParameters It turns out tha

[clang] [Clang][NFC] Use MarkUsedTemplateParameters in building alias CTAD guides (PR #132369)

2025-03-21 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 created https://github.com/llvm/llvm-project/pull/132369 It turns out that TemplateParamsReferencedInTemplateArgumentList() and MarkUsedTemplateParameters() have the similar goal, so let's drop the hand-written ASTVisitor. >From ab0cca1c85dcf08ba78e4f916325c86f5a425

[clang] [Clang][NFC] Use MarkUsedTemplateParameters in building alias CTAD guides (PR #132369)

2025-03-22 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 closed https://github.com/llvm/llvm-project/pull/132369 ___ 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-22 Thread Younan Zhang via cfe-commits
zyn0217 wrote: I'll merge without a release note, instead I plan to backport it to the 20 release along with a changelog. https://github.com/llvm/llvm-project/pull/132061 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/

[clang] [Clang] Fix a bot failure after 032ad590 (PR #132555)

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

[clang] [Clang] Fix a bot failure after 032ad590 (PR #132555)

2025-03-22 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 created https://github.com/llvm/llvm-project/pull/132555 See https://github.com/llvm/llvm-project/pull/132061?notification_referrer_id=NT_kwDOBv04MLUxNTM5NjQwOTM5MToxMTcyNTgyODg#issuecomment-2745313527 >From e74045c3cb0264d434411b7a9046637e1d9984ae Mon Sep 17 00:00:0

[clang] [Clang] Fix a bot failure after 032ad590 (PR #132555)

2025-03-22 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 closed https://github.com/llvm/llvm-project/pull/132555 ___ 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: Thanks for working on it. The patch looks good overall, but as you've suggested that this is incomplete, I think we want to go over it again after the cache part gets adapted. I left a question, for which we probably want an assertion there. https://githu

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

2025-03-25 Thread Younan Zhang via cfe-commits
@@ -155,6 +155,19 @@ int g() { } } +namespace GH132825 { zyn0217 wrote: This should go in cwg25xx.cpp, and you should run make_cxx_dr_status to update the status page. Also this needs a release note. https://github.com/llvm/llvm-project/pull/132919 __

[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 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] Implement CWG2815 (PR #132778)

2025-03-25 Thread Younan Zhang via cfe-commits
@@ -12529,11 +12529,11 @@ C++ defect report implementation status Direct or copy initialization for omitted aggregate initializers Unknown - + https://cplusplus.github.io/CWG/issues/2117.html";>2117 -open +NAD Explicit specializations and const

[clang] [clang] Implement CWG2815 (PR #132778)

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

[clang] [clang] Implement CWG2815 (PR #132778)

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

[clang] [clang] Implement CWG2815 (PR #132778)

2025-03-25 Thread Younan Zhang via cfe-commits
@@ -5242,10 +5255,12 @@ TryReferenceInit(Sema &S, Expr *Init, QualType DeclType, // FIXME: As a speculative fix to a defect introduced by CWG2352, we rank // a reference binding that performs a non-top-level qualification // conversion as a qualification conversion,

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

2025-03-24 Thread Younan Zhang via cfe-commits
@@ -0,0 +1,194 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++20 %s + +namespace A { +template +concept C = true; + +template +requires C && C +void f() {} + +template +requires C && true +void f() {} + +template <> +void f(); +} + +namespace B { +template +concept A = t

[clang] [Clang][NFC] Cleanup UnaryExprOrTypeTraitExpr itanium mangling code (PR #131764)

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

[clang] [Clang][RFC] Intrododuce a builtin to determine the structure binding size (PR #131515)

2025-03-16 Thread Younan Zhang via cfe-commits
@@ -4160,6 +4160,54 @@ static bool CheckVecStepTraitOperandType(Sema &S, QualType T, return false; } +static ExprResult BuildStructuredBindingSizeTraitImpl(Sema &S, QualType T, + Expr *E, +

[clang] [Clang][RFC] Intrododuce a builtin to determine the structure binding size (PR #131515)

2025-03-16 Thread Younan Zhang via cfe-commits
@@ -4160,6 +4160,54 @@ static bool CheckVecStepTraitOperandType(Sema &S, QualType T, return false; } +static ExprResult BuildStructuredBindingSizeTraitImpl(Sema &S, QualType T, + Expr *E, +

[clang] [Clang][RFC] Intrododuce a builtin to determine the structure binding size (PR #131515)

2025-03-16 Thread Younan Zhang via cfe-commits
@@ -0,0 +1,168 @@ +// RUN: %clang_cc1 %s -std=c++2c -fsyntax-only -verify + +struct S0 {}; +struct S1 {int a;}; +struct S2 {int a; int b;}; +struct S3 {double a; int b; int c;}; + + + +struct SD : S1 {}; +struct SE1 : S1 { int b;}; + +class P1 {int a;}; // #note-private + + +temp

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

2025-03-14 Thread Younan Zhang via cfe-commits
@@ -749,132 +759,124 @@ ExprResult Sema::CheckPackExpansion(Expr *Pattern, SourceLocation EllipsisLoc, PackExpansionExpr(Context.DependentTy, Pattern, EllipsisLoc, NumExpansions); } +static bool IsUnexpandedPackExpansion(const TemplateArgument &TA) { + if (!TA.isPackExp

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

2025-03-13 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/3] Reapply "[Clang] Improve diagnostics for expansion length mi

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

2025-03-13 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/4] Reapply "[Clang] Improve diagnostics for expansion length mi

[clang] [clang][CodeGen] Do not try to emit definition of variable whose initializer contains errors (PR #131278)

2025-03-13 Thread Younan Zhang via cfe-commits
zyn0217 wrote: Note that doing so might also hide those similar bugs where we accidentally make RecoveryExpr into CodeGen. So I don't know if this is on the right track https://github.com/llvm/llvm-project/pull/131278 ___ cfe-commits mailing list cfe-

[clang] [Clang][RFC] Introduce a trait to determine the structure binding size (PR #131515)

2025-03-17 Thread Younan Zhang via cfe-commits
@@ -0,0 +1,168 @@ +// RUN: %clang_cc1 %s -std=c++2c -fsyntax-only -verify + +struct S0 {}; +struct S1 {int a;}; +struct S2 {int a; int b;}; +struct S3 {double a; int b; int c;}; + + + +struct SD : S1 {}; +struct SE1 : S1 { int b;}; + +class P1 {int a;}; // #note-private + + +temp

[clang] [Clang][RFC] Introduce a trait to determine the structure binding size (PR #131515)

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

[clang] [Clang] Fix an incorrect assumption on getTemplatedDecl() (PR #131559)

2025-03-17 Thread Younan Zhang via cfe-commits
zyn0217 wrote: > Thank you for the quick fix, I would have also added the test that did not > crash but issued a diagnostic from the issue as well: #131530 > > unless we have a similar test already. Yeah, probably it merits a followup NFC patch https://github.com/llvm/llvm-project/pull/1315

[clang] [Clang][RFC] Intrododuce a builtin to determine the structure binding size (PR #131515)

2025-03-17 Thread Younan Zhang via cfe-commits
@@ -4160,6 +4160,54 @@ static bool CheckVecStepTraitOperandType(Sema &S, QualType T, return false; } +static ExprResult BuildStructuredBindingSizeTraitImpl(Sema &S, QualType T, + Expr *E, +

[clang] [Clang] Fix an incorrect assumption on getTemplatedDecl() (PR #131559)

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

[clang] [Clang] Fix an incorrect assumption on getTemplatedDecl() (PR #131559)

2025-03-16 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/131559 >From a3d01049bca20b9d44a07499b3204756edc8d0e1 Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Mon, 17 Mar 2025 12:41:42 +0800 Subject: [PATCH 1/2] [Clang] Fix an incorrect assumption on getTemplatedDecl() Si

[clang] [Clang] Fix an incorrect assumption on getTemplatedDecl() (PR #131559)

2025-03-16 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 created https://github.com/llvm/llvm-project/pull/131559 Since a68d20e98, we've been calling HandleDelayedAccessCheck() for concept declarations when the declaration contains invalid member accesses. However, a concept declaration is TemplateDecl such that doesn't co

[clang] [Clang] Fix an incorrect assumption on getTemplatedDecl() (PR #131559)

2025-03-16 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 edited https://github.com/llvm/llvm-project/pull/131559 ___ 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 updated https://github.com/llvm/llvm-project/pull/132061 >From fb9fa67da10a7dbfb2db5520d2773085585f4c14 Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Thu, 20 Mar 2025 00:54:54 +0800 Subject: [PATCH 1/3] [Clang] Fix various bugs in alias CTAD transform --- clang/

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

2025-03-20 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/132061 >From fb9fa67da10a7dbfb2db5520d2773085585f4c14 Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Thu, 20 Mar 2025 00:54:54 +0800 Subject: [PATCH 1/2] [Clang] Fix various bugs in alias CTAD transform --- clang/

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

2025-03-20 Thread Younan Zhang via cfe-commits
@@ -1348,6 +1348,16 @@ std::optional Sema::isSFINAEContext() const { return std::nullopt; } +static TemplateArgument +getPackSubstitutedTemplateArgument(Sema &S, TemplateArgument Arg) { zyn0217 wrote: This is pre-existing - do I have to rename that? https

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

2025-03-20 Thread Younan Zhang via cfe-commits
@@ -3660,6 +3660,8 @@ class TreeTransform { return SemaRef.BuildCXXNoexceptExpr(Range.getBegin(), Arg, Range.getEnd()); } + bool HeuristicallyComputeSizeOfPackExpr() const { return true; } + zyn0217 wrote: I choose to extract a function `ComputeSizeOfP

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

2025-03-20 Thread Younan Zhang via cfe-commits
@@ -1077,7 +1077,11 @@ BuildDeductionGuideForTypeAlias(Sema &SemaRef, // !!NOTE: DeduceResults respects the sequence of template parameters of // the deduction guide f. for (unsigned Index = 0; Index < DeduceResults.size(); ++Index) { -if (const auto &D = DeduceResult

[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 various bugs in alias CTAD transform (PR #132061)

2025-03-20 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/132061 >From fb9fa67da10a7dbfb2db5520d2773085585f4c14 Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Thu, 20 Mar 2025 00:54:54 +0800 Subject: [PATCH 1/4] [Clang] Fix various bugs in alias CTAD transform --- clang/

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

2025-04-04 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 edited 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-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/4] [Clang] Fix dependent local class instantiation bugs --- cla

[clang] [Clang][Sema] Handle invalid variable template specialization whose type depends on itself (PR #134522)

2025-04-06 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/134522 ___ 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-04-05 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][RFC] Bypass TAD during overload resolution if a perfect match exists (PR #133426)

2025-04-05 Thread Younan Zhang via cfe-commits
@@ -14354,6 +14584,17 @@ ExprResult Sema::BuildOverloadedCallExpr(Scope *S, Expr *Fn, OverloadingResult OverloadResult = CandidateSet.BestViableFunction(*this, Fn->getBeginLoc(), Best); + // [C++23][over.call.func] + // if overload resolution selects a non-static me

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

2025-04-05 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 closed 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 a lambda pattern comparison mismatch after ecc7e6ce4 (PR #133863)

2025-04-05 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 milestoned 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 crash on invalid `std::initializer_list` template-id (PR #132284)

2025-04-05 Thread Younan Zhang via cfe-commits
@@ -0,0 +1,14 @@ +// RUN: %clang_cc1 %s -verify -std=c++20 + +namespace std { + +template // expected-error 2 {{type 'int' cannot be used prior to '::' because it has no members}} +class initializer_list; + +} + +auto x = {1}; // expected-note {{in instantiation of default argume

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

2025-04-05 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 commented: Thanks, this should come with a release entry. Please make sure you add a note to the `Bug Fixes to C++ Support` section in `clang/docs/ReleaseNotes.rst`. https://github.com/llvm/llvm-project/pull/133878 ___ cfe-c

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

2025-04-05 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 created https://github.com/llvm/llvm-project/pull/132669 Thanks to the example provided by @MagentaTreehouse, I realized the assertion I added didn't cover all valid cases like, when inheriting from a class template specialization, the source of a synthesized templat

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

2025-04-05 Thread Younan Zhang via cfe-commits
@@ -1467,10 +1477,16 @@ namespace { } } -static TemplateArgument +bool HeuristicallyComputeSizeOfPackExpr() const { + return !TemplateArgs.isRewrite(); +} + +TemplateArgument zyn0217 wrote: It is intended because we need to acce

[clang] [clang] Fix Mame Mangling Crashes (PR #134486)

2025-04-05 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 commented: This needs tests as well as release notes. Also please run clang-format on the changes. Given that @mizvekov is working on fixing unevaluated lambda contexts, I wonder if these issues could be resolved the other way around, especially since there seems to

[clang] [clang] fix partial ordering of NTTP packs (PR #134461)

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

[clang] [clang] fix partial ordering of NTTP packs (PR #134461)

2025-04-05 Thread Younan Zhang via cfe-commits
@@ -6837,64 +6846,55 @@ ExprResult Sema::CheckTemplateArgument(NonTypeTemplateParmDecl *Param, assert(!ParamType.hasQualifiers() && "non-type template parameter type cannot be qualified"); + // If either the parameter has a dependent type or the argument is + //

[clang] [clang] fix partial ordering of NTTP packs (PR #134461)

2025-04-05 Thread Younan Zhang via cfe-commits
@@ -6837,64 +6846,55 @@ ExprResult Sema::CheckTemplateArgument(NonTypeTemplateParmDecl *Param, assert(!ParamType.hasQualifiers() && "non-type template parameter type cannot be qualified"); + // If either the parameter has a dependent type or the argument is + //

[clang] [clang] fix partial ordering of NTTP packs (PR #134461)

2025-04-05 Thread Younan Zhang via cfe-commits
@@ -6250,9 +6171,10 @@ FunctionDecl *Sema::getMoreConstrainedFunction(FunctionDecl *FD1, /// TemplateDecl or {Class,Var}TemplatePartialSpecializationDecl. /// \param T1 The injected-class-name of P1 (faked for a variable template). /// \param T2 The injected-class-name of P2 (

[clang] [clang] fix partial ordering of NTTP packs (PR #134461)

2025-04-05 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 approved this pull request. LGTM in general, but please wait for a few days before you commit. https://github.com/llvm/llvm-project/pull/134461 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cg

[clang] [clang] fix partial ordering of NTTP packs (PR #134461)

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

[clang] Minor unused variable error for sanitizer builds (PR #132372)

2025-04-05 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 approved this pull request. https://github.com/llvm/llvm-project/pull/132372 ___ 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-04-05 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 created https://github.com/llvm/llvm-project/pull/133575 This is a follow-up to a9672515ce, per Richard's suggestion we should ensure the instantiation for these unevaluated operators as well. No release entry because the issue being fixed was already claimed resolve

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

2025-04-05 Thread Younan Zhang via cfe-commits
zyn0217 wrote: The commit message is mysteriously gone when merging with the github app 🥲 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-commi

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

2025-04-05 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] Reapply "[Clang] Improve diagnostics for expansion length mismatch" (PR #121044)

2025-04-04 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] Implement CWG2517 Useless restriction on use of parameter in constraint-expression (PR #132919)

2025-03-25 Thread Younan Zhang via cfe-commits
zyn0217 wrote: > CC @mizvekov since it was suggested this is related to > https://github.com/llvm/llvm-project/issues/126550 and it looked like based > on the conversation there, there was some existing work going on. I think the crash I presented is independent of this DR. (This DR makes that

[clang] [clang] fix structural comparison for dependent class member pointer (PR #133343)

2025-03-27 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 approved this pull request. Honestly I have no idea what's going wrong here. But please go on to get rid of these bugs. Thanks! https://github.com/llvm/llvm-project/pull/133343 ___ cfe-commits mailing list cfe-commits@lists.

[clang] [clang] Implement CWG2815 (PR #132778)

2025-03-26 Thread Younan Zhang via cfe-commits
@@ -5229,10 +5229,23 @@ TryReferenceInit(Sema &S, Expr *Init, QualType DeclType, S.CompareReferenceRelationship(DeclLoc, T1, T2, &RefConv); auto SetAsReferenceBinding = [&](bool BindsDirectly) { +// C++2c [over.ics.ref] p1: zyn0217 wrote: This doe

[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/2] [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] Handle default template arguments for alias CTAD guides (PR #134807)

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

[clang] [Clang] Handle default template arguments for alias CTAD guides (PR #134807)

2025-04-08 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 created https://github.com/llvm/llvm-project/pull/134807 It's possible that some deduced template arguments come from default arguments, not just from the return type. So we need to recursively visit the default arguments of the parameter if it's referenced, thereby

[clang] [clang] consistently quote expressions in diagnostics (PR #134769)

2025-04-07 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 commented: Thanks for working productively. https://github.com/llvm/llvm-project/pull/134769 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

<    11   12   13   14   15   16   17   18   19   20   >