[clang] [Clang] Adjust concept definition locus (PR #103867)

2024-09-24 Thread Younan Zhang via cfe-commits
@@ -8499,23 +8498,63 @@ Decl *Sema::ActOnConceptDefinition( NewDecl->setInvalidDecl(); } + DeclarationNameInfo NameInfo(NewDecl->getDeclName(), NewDecl->getBeginLoc()); + LookupResult Previous(*this, NameInfo, LookupOrdinaryName, +forRedeclarati

[clang] [Clang][Sema] Bump the instantiated index when skipping past non-init-captures (PR #110887)

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

[clang] [Clang][NFC] Rearrange tests for CWG 2707 after #110473 (PR #110842)

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

[clang] [Clang][Sema] Bump the instantiated index when skipping past non-init-captures (PR #110887)

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

[clang] [Clang][Sema] Bump the instantiated index when skipping past non-init-captures (PR #110887)

2024-10-02 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 created https://github.com/llvm/llvm-project/pull/110887 Otherwise, we would probably have an unmatched instantiated declaration for init-captures when they come after a non-init capture. No release note because the bug only affects the trunk. Fixes #110721 >From 0

[clang] [Clang][NFC] Rearrange tests for CWG 2707 after #110473 (PR #110842)

2024-10-02 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 created https://github.com/llvm/llvm-project/pull/110842 This addresses comments from @Endilll in the post commit review of #110473. >From 5660d1ee7f5b815061f04e2f77eb1abced041ea6 Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Wed, 2 Oct 2024 21:41:53 +0800 Subje

[clang] [Clang] Implement CWG 2707 "Deduction guides cannot have a trailing requires-clause" (PR #110473)

2024-10-02 Thread Younan Zhang via cfe-commits
zyn0217 wrote: @Endilll Filed https://github.com/llvm/llvm-project/pull/110842 for your comments. PTAL, thanks! https://github.com/llvm/llvm-project/pull/110473 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mai

[clang] [Clang][NFC] Rearrange tests for CWG 2707 after #110473 (PR #110842)

2024-10-02 Thread Younan Zhang via cfe-commits
@@ -29,6 +29,35 @@ namespace std { #endif } // namespace std +namespace cwg2707 { // cwg2707: 20 + +#if __cplusplus >= 202002L + +template struct A { // #cwg2707-A + T value[N]; +}; + +template +A(T...) -> A requires (sizeof...(T) == 2); // #cwg2707-guide-A + +// Brace eli

[clang] [Clang][NFC] Rearrange tests for CWG 2707 after #110473 (PR #110842)

2024-10-02 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/110842 >From 5660d1ee7f5b815061f04e2f77eb1abced041ea6 Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Wed, 2 Oct 2024 21:41:53 +0800 Subject: [PATCH 1/2] [Clang][NFC] Rearrange tests for CWG 2707 after #110473 ---

[clang] [AST] Iterate redecls starting from the canonical one in getRawCommentsForAnyRedecl() (PR #108475)

2024-09-18 Thread Younan Zhang via cfe-commits
@@ -444,7 +444,7 @@ const RawComment *ASTContext::getRawCommentForAnyRedecl( return CommentlessRedeclChains.lookup(CanonicalD); }(); - for (const auto Redecl : D->redecls()) { + for (const auto Redecl : CanonicalD->redecls()) { zyn0217 wrote: I reread

[clang] [Clang] Ensure default arguments in friend declarations are only allowed in defining declarations to prevent multiple reachable declarations (PR #113777)

2024-11-07 Thread Younan Zhang via cfe-commits
zyn0217 wrote: > @zyn0217 should all the commits be squashed into one? Of course. By saying “flesh out the commit message”, I meant to edit the PR description on github, which would become the final commit message when we merge the PR. https://github.com/llvm/llvm-project/pull/113777

[clang] [Clang] Ensure default arguments in friend declarations are only allowed in defining declarations to prevent multiple reachable declarations (PR #113777)

2024-11-07 Thread Younan Zhang via cfe-commits
zyn0217 wrote: BTW, can you flesh out the commit message so we don't just have a single issue link there? Thanks https://github.com/llvm/llvm-project/pull/113777 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/ma

[clang] [Clang][Sema] Use the correct injected template arguments for partial specializations when collecting multi-level template argument lists (PR #112381)

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

[clang] [Clang][Sema] Use the correct injected template arguments for partial specializations when collecting multi-level template argument lists (PR #112381)

2024-10-15 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 approved this pull request. LG modulo one question. Thanks for the prompt fix. https://github.com/llvm/llvm-project/pull/112381 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/li

[clang] [Clang][Sema] Use the correct injected template arguments for partial specializations when collecting multi-level template argument lists (PR #112381)

2024-10-15 Thread Younan Zhang via cfe-commits
@@ -2085,7 +2085,9 @@ class ClassTemplateSpecializationDecl : public CXXRecordDecl, class ClassTemplatePartialSpecializationDecl : public ClassTemplateSpecializationDecl { /// The list of template parameters - TemplateParameterList* TemplateParams = nullptr; + TemplatePa

[clang] [Clang] Ensure default arguments in friend declarations are only allowed in defining declarations to prevent multiple reachable declarations (PR #113777)

2024-11-07 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 approved this pull request. LGTM as well, thanks for working on it! https://github.com/llvm/llvm-project/pull/113777 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-

[clang] [Clang] Distinguish expanding-packs-in-place cases for SubstTemplateTypeParmTypes (PR #114220)

2024-11-06 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/114220 >From 782caa155a746e7170f1794972b07d28fcf80692 Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Wed, 30 Oct 2024 20:35:33 +0800 Subject: [PATCH 1/3] [Clang] Distinguish expanding-packs-in-place cases for Subst

[clang] [Clang] Distinguish expanding-packs-in-place cases for SubstTemplateTypeParmTypes (PR #114220)

2024-11-06 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/114220 >From 782caa155a746e7170f1794972b07d28fcf80692 Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Wed, 30 Oct 2024 20:35:33 +0800 Subject: [PATCH 1/2] [Clang] Distinguish expanding-packs-in-place cases for Subst

[clang] [Clang] Remove the wrong assumption when rebuilding SizeOfPackExprs for constraint normalization (PR #115120)

2024-11-06 Thread Younan Zhang via cfe-commits
@@ -1736,23 +1736,13 @@ namespace { SourceLocation RParenLoc, std::optional Length, ArrayRef PartialArgs) { - if (SemaRef.CodeSynthesisContexts.back().Kind != -

[clang] [Clang] Remove the wrong assumption when rebuilding SizeOfPackExprs for constraint normalization (PR #115120)

2024-11-06 Thread Younan Zhang via cfe-commits
@@ -1881,6 +1871,15 @@ Decl *TemplateInstantiator::TransformDecl(SourceLocation Loc, Decl *D) { TemplateArgument Arg = TemplateArgs(TTP->getDepth(), TTP->getPosition()); if (TTP->isParameterPack()) { +// We might not have an index for pack expansion when n

[clang] [Clang] Distinguish expanding-packs-in-place cases for SubstTemplateTypeParmTypes (PR #114220)

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

[clang] [Clang] Remove the wrong assumption when rebuilding SizeOfPackExprs for constraint normalization (PR #115120)

2024-11-07 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/115120 >From 0017e08259472b4397c8be5578da33448e3d82cd Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Wed, 6 Nov 2024 13:51:01 +0800 Subject: [PATCH 1/2] [Clang] Remove the wrong assumption when rebuilding SizeOfPac

[clang] [Clang] Remove the wrong assumption when rebuilding SizeOfPackExprs for constraint normalization (PR #115120)

2024-11-07 Thread Younan Zhang via cfe-commits
@@ -1736,23 +1736,13 @@ namespace { SourceLocation RParenLoc, std::optional Length, ArrayRef PartialArgs) { - if (SemaRef.CodeSynthesisContexts.back().Kind != -

[clang] [Clang] Remove the wrong assumption when rebuilding SizeOfPackExprs for constraint normalization (PR #115120)

2024-11-07 Thread Younan Zhang via cfe-commits
@@ -1731,31 +1731,21 @@ namespace { return inherited::TransformLambdaBody(E, Body); } -ExprResult RebuildSizeOfPackExpr(SourceLocation OperatorLoc, - NamedDecl *Pack, SourceLocation PackLoc, -

[clang] [Clang] Remove the wrong assumption when rebuilding SizeOfPackExprs for constraint normalization (PR #115120)

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

[clang] [Clang] skip default argument instantiation for non-defining friend declarations without specialization info to meet [dcl.fct.default] p4 (PR #113777)

2024-11-08 Thread Younan Zhang via cfe-commits
zyn0217 wrote: Further reduced to: ```cpp struct CacheRequestImpl { friend void LoadOrRun(CacheRequestImpl, int = 42) {} }; void CacheRequestTests_MakesCacheKey_TestTestBody() { CacheRequestImpl req; LoadOrRun(req); } ``` There is no template in this case, so obviously, `FDecl->getMember

[clang] [Clang] prevent errors for deduction guides using deduced type aliases (PR #117450)

2024-11-25 Thread Younan Zhang via cfe-commits
@@ -33,7 +33,7 @@ template typename TT> struct E { // expected-note 2{{template }; A(int) -> int; // expected-error {{deduced type 'int' of deduction guide is not a specialization of template 'A'}} -template A(T)->B; // expected-error {{deduced type 'B' (aka 'A') o

[clang] [Clang] prevent errors for deduction guides using deduced type aliases (PR #117450)

2024-11-25 Thread Younan Zhang via cfe-commits
@@ -11451,7 +11451,11 @@ bool Sema::CheckDeductionGuideDeclarator(Declarator &D, QualType &R, bool MightInstantiateToSpecialization = false; if (auto RetTST = TSI->getTypeLoc().getAsAdjusted()) { - TemplateName SpecifiedName = RetTST.getTypePtr()->getT

[clang] [Clang] use begin member expr location for call expr with deducing this (PR #117345)

2024-11-25 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 approved this pull request. LGTM modulo a release note. https://github.com/llvm/llvm-project/pull/117345 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Don't add top-level const qualifiers to captured function types (PR #118050)

2024-11-28 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 created https://github.com/llvm/llvm-project/pull/118050 This aligns with the logic in `TreeTransform::RebuildQualifiedType()` where we refrain from adding const qualifiers to function types. Previously, we seemed to overlook this edge case when copy-capturing a vari

[clang] [clang-tools-extra] [clang] Compute accurate begin location for CallExpr with explicit object parameter (PR #117841)

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

[clang] [clang-tools-extra] [clang] Compute accurate begin location for CallExpr with explicit object parameter (PR #117841)

2024-11-28 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 approved this pull request. Thanks, while I haven’t come up with a better solution to model this situation, I think this looks good for now. Please give @cor3ntin some time before merging, in case there are some better approaches that I might have overlooked. https:

[clang] [clang-tools-extra] [clang] Compute accurate begin location for CallExpr with explicit object parameter (PR #117841)

2024-11-28 Thread Younan Zhang via cfe-commits
@@ -1639,11 +1639,19 @@ SourceLocation CallExpr::getBeginLoc() const { if (const auto *OCE = dyn_cast(this)) return OCE->getBeginLoc(); + if (const auto *Method = + dyn_cast_if_present(getCalleeDecl()); zyn0217 wrote: nit: I presume the `const

[clang] [Clang] fix crash due to incorrect argument position in merging deduced template arguments (PR #118041)

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

[clang] [Clang][AST] Fix PackIndexingExpr AST printout (PR #117947)

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

[clang] [Clang][AST] Fix PackIndexingExpr AST printout (PR #117947)

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

[clang] [Clang] Don't add top-level const qualifiers to captured function types (PR #118050)

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

[clang] Reland [Clang] skip default argument instantiation for non-defining friend declarations to meet [dcl.fct.default] p4 (PR #115487)

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

[clang] Reland [Clang] skip default argument instantiation for non-defining friend declarations to meet [dcl.fct.default] p4 (PR #115487)

2024-11-20 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 approved this pull request. LGTM modulo 1 nit. @mizvekov are you happy with it? https://github.com/llvm/llvm-project/pull/115487 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/l

[clang] Reland [Clang] skip default argument instantiation for non-defining friend declarations to meet [dcl.fct.default] p4 (PR #115487)

2024-11-20 Thread Younan Zhang via cfe-commits
@@ -185,3 +185,46 @@ template struct S { friend void X::f(T::type); }; } + +namespace GH113324 { +template struct S1 { + friend void f1(S1, int = 0); // expected-error {{friend declaration specifying a default argument must be a definition}} + friend void f2(S1 a, S1 = de

[clang] Reland [Clang] skip default argument instantiation for non-defining friend declarations to meet [dcl.fct.default] p4 (PR #115487)

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

[clang-tools-extra] [clangd] Check getFunctionTypeLoc() for validity in InlayHintVisitor (PR #117296)

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

[clang] [Clang] Preserve partially substituted pack indexing type/expressions (PR #116782)

2024-11-19 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 created https://github.com/llvm/llvm-project/pull/116782 Substituting into pack indexing types/expressions can still result in unexpanded types/expressions, such as PackIndexingType or PackIndexingExpr. To handle these cases correctly, we should defer the pack size c

[clang] [Clang] Preserve partially substituted pack indexing type/expressions (PR #116782)

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

[clang] [Clang][Parser] Make 'T...[N]' within a function parameter a valid pack expansion prior to C++2c (PR #116332)

2024-11-18 Thread Younan Zhang via cfe-commits
@@ -65,7 +64,7 @@ int main() { } -namespace GH11460 { +namespace GH111460 { zyn0217 wrote: That was a typo. The patch - https://github.com/llvm/llvm-project/commit/1ad5f315ae1cd44369a72cc8dc44fc9ef0cbe638#diff-64f7b2e488768fb71e127d736dc81d9d817ec14b759a8ec

[clang] [Clang][Parser] Make 'T...[N]' within a function parameter a valid pack expansion prior to C++2c (PR #116332)

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

[clang] [Clang][Parser] Make 'T...[N]' within a function parameter a valid pack expansion prior to C++2c (PR #116332)

2024-11-15 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 created https://github.com/llvm/llvm-project/pull/116332 This patch makes cases `void f(T... [N])` valid and adds a warning where the parameter is not of a pack indexing but of a pack expansion type, as per https://eel.is/c++draft/diff#cpp23.dcl.dcl-2. Fixes https:/

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

2024-11-17 Thread Younan Zhang via cfe-commits
@@ -13044,6 +13045,17 @@ class Sema final : public SemaBase { bool SkipForSpecialization = false, bool ForDefaultArgumentSubstitution = false); + /// Apart from storing the result to \p Result, this behaves the same as + /// another overload. + void getTemplateI

[clang] [Clang] enhance error recovery with RecoveryExpr for trailing commas in call arguments (PR #114684)

2024-11-20 Thread Younan Zhang via cfe-commits
@@ -3705,6 +3713,12 @@ bool Parser::ParseExpressionList(SmallVectorImpl &Exprs, Token Comma = Tok; ConsumeToken(); checkPotentialAngleBracketDelimiter(Comma); + +if (Tok.is(tok::r_paren)) { + if (HasTrailingComma) +*HasTrailingComma = true; +

[clang] [Clang] prevent errors for deduction guides using deduced type aliases (PR #117450)

2024-11-25 Thread Younan Zhang via cfe-commits
@@ -583,6 +583,8 @@ Improvements to Clang's diagnostics - For an rvalue reference bound to a temporary struct with an integer member, Clang will detect constant integer overflow in the initializer for the integer member (#GH46755). +- Clang now prevents errors for deduction

[clang] Reland [Clang] skip default argument instantiation for non-defining friend declarations to meet [dcl.fct.default] p4 (PR #115487)

2024-11-25 Thread Younan Zhang via cfe-commits
@@ -12,6 +12,31 @@ void g() { } } +namespace GH113324 { +struct S1 { + friend void f1(S1, int = 42) {} +}; + +template using __enable_if_t = int; zyn0217 wrote: I think you should at least remove these unrelated things in the test: they contributed nothing

[clang] [Clang][Parser] Make 'T...[N]' within a function parameter a valid pack expansion prior to C++2c (PR #116332)

2024-11-27 Thread Younan Zhang via cfe-commits
zyn0217 wrote: Thanks you all for the feedback. So I'm going to keep it invalid and just add a warning for clarity. https://github.com/llvm/llvm-project/pull/116332 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin

[clang] [Clang][Parser] Make 'T...[N]' within a function parameter a valid pack expansion prior to C++2c (PR #116332)

2024-11-27 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/116332 >From 5973de1d4c368a26fd179954a13de94595f35575 Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Fri, 15 Nov 2024 14:09:14 +0800 Subject: [PATCH 1/3] [Clang][Parser] Make 'T...[N]' within a function parameter a

[clang] [Clang][Parser] Add a warning to ambiguous uses of T...[N] types (PR #116332)

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

[clang] [Clang][Parser] Add a warning to ambiguous uses of T...[N] types (PR #116332)

2024-11-27 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/116332 >From 5973de1d4c368a26fd179954a13de94595f35575 Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Fri, 15 Nov 2024 14:09:14 +0800 Subject: [PATCH 1/4] [Clang][Parser] Make 'T...[N]' within a function parameter a

[clang] [Clang][Parser] Make 'T...[N]' within a function parameter a valid pack expansion prior to C++2c (PR #116332)

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

[clang] [Clang] Recover GLTemplateParameterList for generic lambdas in RebuildLambdaScopeInfo (PR #118176)

2024-11-30 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 created https://github.com/llvm/llvm-project/pull/118176 The NTTP argument appearing inside a trailing return type of a generic lambda would have to check for potential lambda captures, where the function needs GLTemplateParameterList of the current LSI to tell wheth

[clang] [AST] Iterate redecls starting from the canonical one in getRawCommentsForAnyRedecl() (PR #108475)

2024-09-17 Thread Younan Zhang via cfe-commits
zyn0217 wrote: Sorry, it might be I forgot to save the changes before I ran the tests yesterday! I looked into it again, and I think I have begun to understand  `TemplateParameterListsInfo`: The first intent is to describe out-of-line member functions that live in a templated scope. For examp

[clang] -ast-dump-decl-types crashes on codes involving concepts #94928 (PR #108142)

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

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

2024-11-16 Thread Younan Zhang via cfe-commits
zyn0217 wrote: Sadly I think I should figure out a way to remove reliance on the refactoring work of `getTemplateInstantiationArgs()`, as it is still unstable at this point. https://github.com/llvm/llvm-project/pull/102857 ___ cfe-commits mailing list

[clang] [Clang][Parser] Make 'T...[N]' within a function parameter a valid pack expansion prior to C++2c (PR #116332)

2024-11-16 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/116332 >From 5973de1d4c368a26fd179954a13de94595f35575 Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Fri, 15 Nov 2024 14:09:14 +0800 Subject: [PATCH 1/2] [Clang][Parser] Make 'T...[N]' within a function parameter a

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

2024-11-25 Thread Younan Zhang via cfe-commits
zyn0217 wrote: > > @cor3ntin Not much, we just need to move the handling of the friend > > declaration outside of `getTemplateInstantiationArgs()` :) > > > > > > Do you see any other outstanding issues? If not, can we go ahead with the > > status quo so we have sufficient timeframe in clang

[clang] [Clang] Preserve partially substituted pack indexing type/expressions (PR #116782)

2024-11-24 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/116782 >From 5c0d947576b692c32febf89703033715b0c51cda Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Tue, 19 Nov 2024 18:33:34 +0800 Subject: [PATCH 1/2] [Clang] Preserve partially substituted pack indexing type/ex

[clang] [Clang] Preserve partially substituted pack indexing type/expressions (PR #116782)

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

[clang] [Clang] use begin member expr location for call expr with deducing this (PR #117345)

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

[clang] [Clang] use begin member expr location for call expr with deducing this (PR #117345)

2024-11-25 Thread Younan Zhang via cfe-commits
@@ -717,6 +717,8 @@ Bug Fixes to C++ Support - Clang now uses valid deduced type locations when diagnosing functions with trailing return type missing placeholder return type. (#GH78694) - Fixed a bug where bounds of partially expanded pack indexing expressions were checked

[clang] [Clang] Recover GLTemplateParameterList for generic lambdas in RebuildLambdaScopeInfo (PR #118176)

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

[clang] [Clang] Recover GLTemplateParameterList for generic lambdas in RebuildLambdaScopeInfo (PR #118176)

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

[clang] [Clang] Recover GLTemplateParameterList for generic lambdas in RebuildLambdaScopeInfo (PR #118176)

2024-12-02 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/118176 >From 6d55d79dc7a67a94be0f72b15f8da90813ebb9fd Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Sat, 30 Nov 2024 23:23:47 +0800 Subject: [PATCH 1/2] [Clang] Recover GLTemplateParameterList for generic lambdas

[clang] [Clang] Recover GLTemplateParameterList for generic lambdas in RebuildLambdaScopeInfo (PR #118176)

2024-12-02 Thread Younan Zhang via cfe-commits
zyn0217 wrote: thanks for the review :) https://github.com/llvm/llvm-project/pull/118176 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Revert "Reapply "[Clang][Sema] Refactor collection of multi-level template argument lists (#106585, #111173)" (#111852)" (PR #115159)

2024-12-04 Thread Younan Zhang via cfe-commits
zyn0217 wrote: @sdkrystian Friendly ping. Any chance for you to reapply this patch recently? thanks https://github.com/llvm/llvm-project/pull/115159 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinf

[clang] [Clang] Recurse into parsing when using pack-indexing as a specifier (PR #119123)

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

[clang] [Clang] Recurse into parsing when using pack-indexing as a specifier (PR #119123)

2024-12-08 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 created https://github.com/llvm/llvm-project/pull/119123 Closes #119072 >From 7ea2b4c5a9042aeb77982e3f5bb03af36de23c96 Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Sun, 8 Dec 2024 18:17:46 +0800 Subject: [PATCH] [Clang] Recurse into parsing when using pack-index

[clang] [Clang] Recurse into parsing when using pack-indexing as a specifier (PR #119123)

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

[clang] [Clang] Recurse into parsing when using pack-indexing as a specifier (PR #119123)

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

[clang] [clang-tools-extra] [llvm] [clang] WIP: Improved Context Declaration tracking (PR #107942)

2024-12-06 Thread Younan Zhang via cfe-commits
@@ -247,18 +242,23 @@ getGenericLambdaTemplateParameterList(LambdaScopeInfo *LSI, Sema &SemaRef) { CXXRecordDecl * Sema::createLambdaClosureType(SourceRange IntroducerRange, TypeSourceInfo *Info, - unsigned LambdaDependencyKind, -

[clang] [clang-tools-extra] [llvm] [clang] WIP: Improved Context Declaration tracking (PR #107942)

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

[clang] [clang-tools-extra] [llvm] [clang] WIP: Improved Context Declaration tracking (PR #107942)

2024-12-06 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 commented: I took another pass through the code, and it looks good overall. Given the scale of this patch, input from others would be valuable. It would be nice if you could move the patch out of draft status to get more visibility :) https://github.com/llvm/llvm-pro

[clang] [clang-tools-extra] [llvm] [clang] WIP: Improved Context Declaration tracking (PR #107942)

2024-12-06 Thread Younan Zhang via cfe-commits
@@ -17658,8 +17662,49 @@ HandleImmediateInvocations(Sema &SemaRef, } } +static void setContextDecl(Sema &S, Decl *Base, Decl *ContextDecl) { + switch (Base->getKind()) { + case Decl::CXXRecord: { +auto *RD = cast(Base); +RD->setLambdaContextDecl(ContextDecl); +

[clang] [clang-tools-extra] [llvm] [clang] WIP: Improved Context Declaration tracking (PR #107942)

2024-12-06 Thread Younan Zhang via cfe-commits
@@ -7946,6 +7980,8 @@ class Sema final : public SemaBase { /// A stack of expression evaluation contexts. SmallVector ExprEvalContexts; + SmallVector PendingLazyContextDecls; zyn0217 wrote: So from a quick reading, PendingLazyContextDecls is used for lam

[clang] [clang-tools-extra] [llvm] [clang] WIP: Improved Context Declaration tracking (PR #107942)

2024-12-06 Thread Younan Zhang via cfe-commits
@@ -8494,10 +8495,21 @@ DeclResult Sema::ActOnClassTemplateSpecialization( return Specialization; } -Decl *Sema::ActOnTemplateDeclarator(Scope *S, - MultiTemplateParamsArg TemplateParameterLists, -Declarator &D

[clang] [clang-tools-extra] [llvm] [clang] WIP: Improved Context Declaration tracking (PR #107942)

2024-12-06 Thread Younan Zhang via cfe-commits
@@ -17658,8 +17662,49 @@ HandleImmediateInvocations(Sema &SemaRef, } } +static void setContextDecl(Sema &S, Decl *Base, Decl *ContextDecl) { + switch (Base->getKind()) { + case Decl::CXXRecord: { +auto *RD = cast(Base); +RD->setLambdaContextDecl(ContextDecl); +

[clang] [Serialization] Migrate away from PointerUnion::{is,get} (NFC) (PR #118948)

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

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

2025-01-03 Thread Younan Zhang via cfe-commits
@@ -,12 +,57 @@ bool Sema::EnsureTemplateArgumentListConstraints( return false; } -bool Sema::CheckInstantiatedFunctionTemplateConstraints( +static bool CheckFunctionConstraintsWithoutInstantiation( +Sema &SemaRef, SourceLocation PointOfInstantiation, +Functi

[clang] [Clang] Fix unexpanded packs in NTTP type constraints (PR #121296)

2025-01-03 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/121296 >From 102e031cae56c130f48f08bcb316b6f451facf49 Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Sun, 29 Dec 2024 23:13:52 +0800 Subject: [PATCH 1/5] [Clang] Diagnose unexpanded packs for NTTP type constraints

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

2025-01-03 Thread Younan Zhang via cfe-commits
@@ -6089,16 +6090,16 @@ bool TreeTransform::TransformFunctionTypeParams( const FunctionProtoType::ExtParameterInfo *ParamInfos, SmallVectorImpl &OutParamTypes, SmallVectorImpl *PVars, -Sema::ExtParameterInfoBuilder &PInfos, -unsigned *LastParamTransformed)

[clang] [Clang] Fix unexpanded packs in NTTP type constraints (PR #121296)

2025-01-02 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/121296 >From 102e031cae56c130f48f08bcb316b6f451facf49 Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Sun, 29 Dec 2024 23:13:52 +0800 Subject: [PATCH 1/5] [Clang] Diagnose unexpanded packs for NTTP type constraints

[clang] [Clang][P1061] Add stuctured binding packs (PR #121417)

2025-01-02 Thread Younan Zhang via cfe-commits
@@ -0,0 +1,82 @@ +// RUN: %clang_cc1 -fsyntax-only -std=c++2b %s -verify +// expected-no-diagnostics + +template +struct type_ { }; + +template +auto sum(T... t) { return (t + ...); } + +struct my_struct { + int a; + int b; + int c; + int d; +}; + +struct fake

[clang] [Clang][P1061] Add stuctured binding packs (PR #121417)

2025-01-02 Thread Younan Zhang via cfe-commits
@@ -422,8 +445,8 @@ Sema::DiagnoseUnexpandedParameterPacks(SourceLocation Loc, if (const TemplateTypeParmType *TTP = Unexpanded[I].first.dyn_cast()) Name = TTP->getIdentifier(); -else - Name = cast(Unexpanded[I].first)->getIdentifier(); +else if

[clang] [Clang] Fix unexpanded packs in NTTP type constraints (PR #121296)

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

[clang] [Clang][P1061] Add stuctured binding packs (PR #121417)

2025-01-02 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 commented: Here is an interesting case involving lambda captures: https://godbolt.org/z/Y7EhE7Gvq (Everything would become scary when lambda comes into play) https://github.com/llvm/llvm-project/pull/121417 ___ cfe-commits

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

2025-01-02 Thread Younan Zhang via cfe-commits
zyn0217 wrote: @cor3ntin Do we still want to block on the getTemplateInstantiationArgs() stuff or move forward anyway so we can (hopefully) have this in the upcoming clang 20? FWIW, this patch currently doesn't rely on the refactoring, using only a ternary operand as a workaround for which it

[clang] [Clang] Diagnose unexpanded packs for NTTP type constraints (PR #121296)

2025-01-02 Thread Younan Zhang via cfe-commits
@@ -857,7 +857,8 @@ class PackDeductionScope { if (auto *NTTP = dyn_cast( TemplateParams->getParam(Index))) { if (!NTTP->isExpandedParameterPack()) - if (auto *Expansion = dyn_cast(NTTP->getType())) + if (auto *Expansion = dyn_cast(

[clang] [Clang] Diagnose unexpanded packs for NTTP type constraints (PR #121296)

2025-01-02 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/121296 >From 102e031cae56c130f48f08bcb316b6f451facf49 Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Sun, 29 Dec 2024 23:13:52 +0800 Subject: [PATCH 1/5] [Clang] Diagnose unexpanded packs for NTTP type constraints

[clang] [Clang] Fix unexpanded packs in NTTP type constraints (PR #121296)

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

[clang] [Clang] Diagnose unexpanded packs for NTTP type constraints (PR #121296)

2024-12-31 Thread Younan Zhang via cfe-commits
@@ -857,7 +857,8 @@ class PackDeductionScope { if (auto *NTTP = dyn_cast( TemplateParams->getParam(Index))) { if (!NTTP->isExpandedParameterPack()) - if (auto *Expansion = dyn_cast(NTTP->getType())) + if (auto *Expansion = dyn_cast(

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

2025-01-06 Thread Younan Zhang via cfe-commits
@@ -174,6 +174,26 @@ static_assert(!__is_layout_compatible(StructWithAnonUnion, StructWithAnonUnion3) #endif } // namespace cwg2759 +#if __cplusplus >= 202002L +namespace cwg2770 { // cwg2770: 20 zyn0217 wrote: Yes, I implemented what that issue proposed. I

[clang] [clang][Sema] Fix initialization of `NonTypeTemplateParmDecl`... (PR #121768)

2025-01-06 Thread Younan Zhang via cfe-commits
@@ -1235,15 +1235,24 @@ bool Sema::AttachTypeConstraint(AutoTypeLoc TL, << NewConstrainedParm->getTypeSourceInfo() ->getTypeLoc() .getSourceRange(); +NewConstrainedParm->setPlaceholderTypeConstraint( +RecoveryExpr::Create(Contex

[clang] [clang][Sema] Fix initialization of `NonTypeTemplateParmDecl`... (PR #121768)

2025-01-06 Thread Younan Zhang via cfe-commits
@@ -0,0 +1,54 @@ +// RUN: rm -rf %t +// RUN: split-file %s %t +// RUN: cd %t + +// RUN: %clang_cc1 -std=c++20 mod.cppm -emit-module-interface -o mod.pcm -fallow-pcm-with-compiler-errors -verify +// RUN: %clang_cc1 -std=c++20 main.cpp -fmodule-file=mod=mod.pcm -verify -fallow-pcm

[clang] [clang] Improve `make_cxx_dr_status` behavior when error occurs (PR #121785)

2025-01-06 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 approved this pull request. Thanks, the patch looks great https://github.com/llvm/llvm-project/pull/121785 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

<    8   9   10   11   12   13   14   15   16   17   >