[clang] [Concepts] Add regression test for #99036 (PR #113137)

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

[clang] [Clang] Instantiate Typedefs referenced by type alias deduction guides (PR #111804)

2024-10-10 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 created https://github.com/llvm/llvm-project/pull/111804 Fixes #111508 >From 1319a3c3220df06f5436fd3f135e50c998940296 Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Thu, 10 Oct 2024 16:40:10 +0800 Subject: [PATCH] [Clang] Instantiate Typedefs referenced by type a

[clang] [Clang] Instantiate Typedefs referenced by type alias deduction guides (PR #111804)

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

[clang] [Clang] Instantiate Typedefs referenced by type alias deduction guides (PR #111804)

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

[clang] [Clang] Instantiate Typedefs referenced by type alias deduction guides (PR #111804)

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

[clang] [clang] Don't lose track of explicit specializations of member functi… (PR #111267)

2024-10-05 Thread Younan Zhang via cfe-commits
@@ -4206,18 +4206,14 @@ Sema::InstantiateClassMembers(SourceLocation PointOfInstantiation, if (Function->hasAttr()) continue; -MemberSpecializationInfo *MSInfo = -Function->getMemberSpecializationInfo(); -assert(MSInfo && "No memb

[clang] [clang] Don't lose track of explicit specializations of member functi… (PR #111267)

2024-10-05 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 approved this pull request. Makes sense to me, but I'd like to @erichkeane to have a look as well. https://github.com/llvm/llvm-project/pull/111267 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.or

[clang] [clang] Don't lose track of explicit specializations of member functi… (PR #111267)

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

[clang] [clang] Don't lose track of explicit specializations of member functi… (PR #111267)

2024-10-05 Thread Younan Zhang via cfe-commits
@@ -156,7 +156,13 @@ namespace UsesThis { auto h() -> decltype(this); // expected-error {{'this' cannot be used in a static member function declaration}} }; - template struct A; // expected-note 3{{in instantiation of}} + template struct A; // expected-note {{in insta

[clang] [clang] Track function template instantiation from definition (PR #110387)

2024-10-05 Thread Younan Zhang via cfe-commits
@@ -5185,9 +5189,24 @@ void Sema::InstantiateFunctionDefinition(SourceLocation PointOfInstantiation, RebuildTypeSourceInfoForDefaultSpecialMembers(); SetDeclDefaulted(Function, PatternDecl->getLocation()); } else { +NamedDecl *ND = Function; +std::optional> I

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

2024-10-08 Thread Younan Zhang via cfe-commits
@@ -1841,9 +1872,71 @@ Decl *TemplateInstantiator::TransformDecl(SourceLocation Loc, Decl *D) { // template parameter. } + if (auto *PVD = dyn_cast(D); + PVD && PVD->getDeclContext() == FunctionDCForParameterDeclInstantiation && + !ParameterInstantiationScop

[clang] [Clang][Sema] fix noexecpt mismatch of friend declaration (PR #102267)

2024-10-04 Thread Younan Zhang via cfe-commits
@@ -4698,7 +4698,22 @@ void Sema::InstantiateExceptionSpec(SourceLocation PointOfInstantiation, // Enter the scope of this instantiation. We don't use // PushDeclContext because we don't have a scope. Sema::ContextRAII savedContext(*this, Decl); + + FunctionDecl *Source

[clang] [Clang][Parser] Remove the concept from the DeclContext if the definition is invalid (PR #111179)

2024-10-04 Thread Younan Zhang via cfe-commits
@@ -337,6 +343,8 @@ Parser::ParseConceptDefinition(const ParsedTemplateInfo &TemplateInfo, ExprResult ConstraintExprResult = Actions.CorrectDelayedTyposInExpr(ParseConstraintExpression()); if (ConstraintExprResult.isInvalid()) { +if (AddedToScope) ---

[clang] [clang] Track function template instantiation from definition (PR #110387)

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

[clang] [clang] Track function template instantiation from definition (PR #110387)

2024-10-05 Thread Younan Zhang via cfe-commits
@@ -492,8 +489,10 @@ MultiLevelTemplateArgumentList Sema::getTemplateInstantiationArgs( // has a depth of 0. if (const auto *TTP = dyn_cast(CurDecl)) HandleDefaultTempArgIntoTempTempParam(TTP, Result); -CurDecl = Response::UseNextDecl(CurDecl).NextDecl; - }

[clang] [clang] Track function template instantiation from definition (PR #110387)

2024-10-05 Thread Younan Zhang via cfe-commits
@@ -492,8 +489,10 @@ MultiLevelTemplateArgumentList Sema::getTemplateInstantiationArgs( // has a depth of 0. if (const auto *TTP = dyn_cast(CurDecl)) HandleDefaultTempArgIntoTempTempParam(TTP, Result); -CurDecl = Response::UseNextDecl(CurDecl).NextDecl; - }

[clang] [clang] Track function template instantiation from definition (PR #110387)

2024-10-05 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 commented: Thanks for taking another look at it. My main concern is that changes in `getTemplateInstantiationArgs()` would conflict with @sdkrystian's recent work, so if these changes are necessary, I suggest we merge this one after the refactoring patch lands, WDYT?

[clang] [clang] Track function template instantiation from definition (PR #110387)

2024-10-05 Thread Younan Zhang via cfe-commits
@@ -1994,8 +1995,10 @@ TemplateDeclInstantiator::VisitFunctionTemplateDecl(FunctionTemplateDecl *D) { // Link the instantiation back to the pattern *unless* this is a // non-definition friend declaration. if (!InstTemplate->getInstantiatedFromMemberTemplate() && - !

[clang] [clang] Track function template instantiation from definition (PR #110387)

2024-10-05 Thread Younan Zhang via cfe-commits
@@ -5185,9 +5189,24 @@ void Sema::InstantiateFunctionDefinition(SourceLocation PointOfInstantiation, RebuildTypeSourceInfoForDefaultSpecialMembers(); SetDeclDefaulted(Function, PatternDecl->getLocation()); } else { +NamedDecl *ND = Function; +std::optional> I

[clang] [clang] Track function template instantiation from definition (PR #110387)

2024-10-05 Thread Younan Zhang via cfe-commits
@@ -1829,7 +1831,7 @@ class DeclContext { /// exactly 64 bits and thus the width of NumCtorInitializers /// will need to be shrunk if some bit is added to NumDeclContextBitfields, /// NumFunctionDeclBitfields or CXXConstructorDeclBitfields. -uint64_t NumCtorInit

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

2024-10-11 Thread Younan Zhang via cfe-commits
@@ -1109,12 +1109,50 @@ bool Sema::EnsureTemplateArgumentListConstraints( return false; } -bool Sema::CheckInstantiatedFunctionTemplateConstraints( +static bool CheckFunctionConstraintsWithoutInstantiation( +Sema &SemaRef, SourceLocation PointOfInstantiation, +Functi

[clang] [clang-tools-extra] [llvm] Add code completion for C++20 keywords. (PR #107982)

2024-10-12 Thread Younan Zhang via cfe-commits
@@ -460,6 +460,18 @@ Decl *Parser::ParseExportDeclaration() { assert(Tok.is(tok::kw_export)); SourceLocation ExportLoc = ConsumeToken(); + if (Tok.is(tok::code_completion)) { +cutOffParsing(); +SemaCodeCompletion::ParserCompletionContext PCC; +if (PP.isIncreme

[clang] [Clang] Fix a DeclContext mismatch when parsing nested lambda parameters (PR #112177)

2024-10-14 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/112177 >From 0a147d305d0b8839a95692612f45c0d4258c5a01 Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Mon, 14 Oct 2024 17:42:17 +0800 Subject: [PATCH] [Clang] Fix a DeclContext mismatch when parsing nested lambda pa

[clang] [Clang] Don't assert on substituted-but-yet-expanded packs for nested lambdas (PR #112896)

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

[clang] [clang][NFC] Move `concepts::createSubstDiagAt` from AST to Sema (PR #113294)

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

[clang] [clang][NFC] Move `concepts::createSubstDiagAt` from AST to Sema (PR #113294)

2024-10-22 Thread Younan Zhang via cfe-commits
@@ -13435,6 +13435,13 @@ class Sema final : public SemaBase { return CodeSynthesisContexts.size() > NonInstantiationEntries; } + using EntityPrinter = llvm::function_ref; + + /// \brief create a Requirement::SubstitutionDiagnostic with only a + /// SubstitutedEntity a

[clang] [Clang] Consider outer instantiation scopes for constraint normalization (PR #114749)

2024-11-03 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 created https://github.com/llvm/llvm-project/pull/114749 We need to compare constraint expressions when instantiating a friend declaration that is lexically defined within a class template. Since the evaluation is deferred, the expression might refer to untransformed

[clang] [Clang] Consider outer instantiation scopes for constraint normalization (PR #114749)

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

[clang] [Clang] Consider outer instantiation scopes for constraint normalization (PR #114749)

2024-11-05 Thread Younan Zhang via cfe-commits
zyn0217 wrote: Backport PR https://github.com/llvm/llvm-project/pull/114951 (I have to backport it manually as there are some other changes on the post-19 branch) https://github.com/llvm/llvm-project/pull/114749 ___ cfe-commits mailing list cfe-commi

[clang] [Clang] Consider outer instantiation scopes for constraint normalization (PR #114749)

2024-11-04 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 ready_for_review https://github.com/llvm/llvm-project/pull/114749 ___ 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-03 Thread Younan Zhang via cfe-commits
@@ -1109,12 +1109,50 @@ bool Sema::EnsureTemplateArgumentListConstraints( return false; } -bool Sema::CheckInstantiatedFunctionTemplateConstraints( +static bool CheckFunctionConstraintsWithoutInstantiation( +Sema &SemaRef, SourceLocation PointOfInstantiation, +Functi

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

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

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

2024-11-03 Thread Younan Zhang via cfe-commits
@@ -4008,6 +3996,38 @@ TemplateDeductionResult Sema::FinishTemplateArgumentDeduction( Owner = FunctionTemplate->getLexicalDeclContext(); FunctionDecl *FD = FunctionTemplate->getTemplatedDecl(); + // C++20 [temp.deduct.general]p5: (CWG2369) + // If the function templat

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

2024-10-30 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 created https://github.com/llvm/llvm-project/pull/114220 Fixes https://github.com/llvm/llvm-project/issues/113518 >From 782caa155a746e7170f1794972b07d28fcf80692 Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Wed, 30 Oct 2024 20:35:33 +0800 Subject: [PATCH] [Clang]

[clang] [Clang] Fix dependent expression handling for assumptions (PR #115646)

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

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

2024-10-30 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 edited 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] Distinguish expanding-packs-in-place cases for SubstTemplateTypeParmTypes (PR #114220)

2024-10-30 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 ready_for_review 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] prevent setting default lexical access specifier for missing primary declarations (PR #112424)

2024-10-31 Thread Younan Zhang via cfe-commits
zyn0217 wrote: Thanks! https://github.com/llvm/llvm-project/pull/112424 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] prevent setting default lexical access specifier for missing primary declarations (PR #112424)

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

[clang] [Clang] prevent assertion failure from an invalid template instantiation pattern when adding instantiated params to the scope in friend functions with defaulted params (PR #113777)

2024-10-31 Thread Younan Zhang via cfe-commits
@@ -3437,10 +3437,10 @@ bool Sema::SubstDefaultArgument( // template void f(T a, int = decltype(a)()); // void g() { f(0); } LIS = std::make_unique(*this); - FunctionDecl *PatternFD = FD->getTemplateInstantiationPattern( - /*ForDefinition*/ f

[clang] [Clang] prevent assertion failure from an invalid template instantiation pattern when adding instantiated params to the scope in friend functions with defaulted params (PR #113777)

2024-10-31 Thread Younan Zhang via cfe-commits
@@ -3437,10 +3437,10 @@ bool Sema::SubstDefaultArgument( // template void f(T a, int = decltype(a)()); // void g() { f(0); } LIS = std::make_unique(*this); - FunctionDecl *PatternFD = FD->getTemplateInstantiationPattern( - /*ForDefinition*/ f

[clang] [Clang] prevent setting default lexical access specifier for missing primary declarations (PR #112424)

2024-10-31 Thread Younan Zhang via cfe-commits
@@ -585,10 +585,11 @@ Bug Fixes to C++ Support - Clang incorrectly considered a class with an anonymous union member to not be const-default-constructible even if a union member has a default member initializer. (#GH95854). -- Fixed an assertion failure when evaluating an

[clang] [Clang] prevent assertion failure from an invalid template instantiation pattern when adding instantiated params to the scope in friend functions with defaulted params (PR #113777)

2024-11-01 Thread Younan Zhang via cfe-commits
@@ -3437,10 +3437,10 @@ bool Sema::SubstDefaultArgument( // template void f(T a, int = decltype(a)()); // void g() { f(0); } LIS = std::make_unique(*this); - FunctionDecl *PatternFD = FD->getTemplateInstantiationPattern( - /*ForDefinition*/ f

[clang] [Clang] Fix dependent expression handling for assumptions (PR #115646)

2024-11-10 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 created https://github.com/llvm/llvm-project/pull/115646 The function definition instantiation assumes any declarations used inside are already transformed before transforming the body, so we need to preserve the transformed expression of CXXAssumeAttr even if it is

[clang] [clang-tools-extra] Remove clang-pseudo (PR #109154)

2024-09-18 Thread Younan Zhang via cfe-commits
zyn0217 wrote: For visibility, see the last attempt at removal: https://github.com/llvm/llvm-project/pull/80081 AFAIK, some Clangd features e.g. code folding, are still relying on it, so ditching it completely is probably not an option at the moment. https://github.com/llvm/llvm-project/pull/

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

2024-09-18 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 closed 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] [Clang][Sema] Retain the expanding index for unevaluated type constraints (PR #109518)

2024-09-21 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/109518 >From 1deb74f00b518eb595dbe49be3234a05c3753c6f Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Sat, 21 Sep 2024 12:48:27 +0800 Subject: [PATCH 1/2] [Clang][Sema] Retain the expanding index for unevaluated typ

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

2024-09-21 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 created https://github.com/llvm/llvm-project/pull/109518 Fixes #101754 >From f09bb393dc173ba47af49ecf4da6ecfcf969adb1 Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Sat, 21 Sep 2024 12:48:27 +0800 Subject: [PATCH] [Clang][Sema] Retain the expanding index for uneva

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

2024-09-21 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/109518 >From 1deb74f00b518eb595dbe49be3234a05c3753c6f Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Sat, 21 Sep 2024 12:48:27 +0800 Subject: [PATCH] [Clang][Sema] Retain the expanding index for unevaluated type co

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

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

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

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

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

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

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

2024-09-21 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/109518 >From 1deb74f00b518eb595dbe49be3234a05c3753c6f Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Sat, 21 Sep 2024 12:48:27 +0800 Subject: [PATCH 1/3] [Clang][Sema] Retain the expanding index for unevaluated typ

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

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

[clang] [ItaniumMangle] Use mangleType instead of mangleNameOrStandardSubstitution in mangleCXXCtorVTable function (PR #109970)

2024-09-26 Thread Younan Zhang via cfe-commits
zyn0217 wrote: Do we need an ABI flag guarding against the change as well? https://github.com/llvm/llvm-project/pull/109970 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Concepts] Normalize SizeOfPackExpr's pack declaration (PR #110238)

2024-09-28 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/110238 >From 23a765ac6d8e455121346405332d2066dcc0861e Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Fri, 27 Sep 2024 18:23:47 +0800 Subject: [PATCH 1/7] [Clang] GH93099 --- clang/include/clang/Sema/Sema.h

[clang] [clang] Fix the local parameter of void type inside the `Requires` expression. (PR #109831)

2024-09-28 Thread Younan Zhang via cfe-commits
zyn0217 wrote: > Therefore, I recommend adding the void parameter check directly into > SemaExprCXX for an immediate fix. If there's a future need to consolidate the > checks, we can consider refactoring later. That works for me if it turns out to take much more effort than our anticipation,

[clang] [ItaniumMangle] Use mangleType instead of mangleNameOrStandardSubstitution in mangleCXXCtorVTable function (PR #109970)

2024-09-27 Thread Younan Zhang via cfe-commits
@@ -11,6 +11,7 @@ struct Y { }; //CHECK: @pr5966_i = external global //CHECK: @_ZL8pr5966_j = internal global + zyn0217 wrote: nit: revert the blank line https://github.com/llvm/llvm-project/pull/109970 ___ cfe-com

[clang] [ItaniumMangle] Use mangleType instead of mangleNameOrStandardSubstitution in mangleCXXCtorVTable function (PR #109970)

2024-09-27 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 approved this pull request. Some nits, otherwise LGTM as well. https://github.com/llvm/llvm-project/pull/109970 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commi

[clang] [ItaniumMangle] Use mangleType instead of mangleNameOrStandardSubstitution in mangleCXXCtorVTable function (PR #109970)

2024-09-27 Thread Younan Zhang via cfe-commits
@@ -237,6 +237,11 @@ class LangOptionsBase { /// in the initializers of members of local classes. Ver18, +/// Attempt to be ABI-compatible with code generated by Clang 19.0.x. +/// This causes clang to: +/// - Incorrect Mangling of CXXCtorVTable -

[clang] [Clang] GH93099 (PR #110238)

2024-09-27 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/110238 >From 23a765ac6d8e455121346405332d2066dcc0861e Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Fri, 27 Sep 2024 18:23:47 +0800 Subject: [PATCH 1/2] [Clang] GH93099 --- clang/include/clang/Sema/Sema.h

[clang] [Clang] GH93099 (PR #110238)

2024-09-28 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/110238 >From 23a765ac6d8e455121346405332d2066dcc0861e Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Fri, 27 Sep 2024 18:23:47 +0800 Subject: [PATCH 1/4] [Clang] GH93099 --- clang/include/clang/Sema/Sema.h

[clang] [Clang] GH93099 (PR #110238)

2024-09-28 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/110238 >From 23a765ac6d8e455121346405332d2066dcc0861e Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Fri, 27 Sep 2024 18:23:47 +0800 Subject: [PATCH 1/5] [Clang] GH93099 --- clang/include/clang/Sema/Sema.h

[clang] [Clang] GH93099 (PR #110238)

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

[clang] [Clang] GH93099 (PR #110238)

2024-09-28 Thread Younan Zhang via cfe-commits
zyn0217 wrote: The CI failure looks unrelated - it also *failed* in other PRs e.g. https://buildkite.com/llvm-project/github-pull-requests/builds/104957#019238e6-fd32-40a1-987a-4cd1c539926a (Which happens to fail in `std::common_type` that might have connections with the `sizeof...` expression

[clang] [Clang] GH93099 (PR #110238)

2024-09-28 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/110238 >From 23a765ac6d8e455121346405332d2066dcc0861e Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Fri, 27 Sep 2024 18:23:47 +0800 Subject: [PATCH 1/6] [Clang] GH93099 --- clang/include/clang/Sema/Sema.h

[clang] [Clang][Concepts] Normalize SizeOfPackExpr's pack declaration (PR #110238)

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

[clang] [Clang][Concepts] Normalize SizeOfPackExpr's pack declaration (PR #110238)

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

[clang] [Clang][Concepts] Normalize SizeOfPackExpr's pack declaration (PR #110238)

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

[clang] [ItaniumMangle] Use mangleType instead of mangleNameOrStandardSubstitution in mangleCXXCtorVTable function (PR #109970)

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

[clang] [ItaniumMangle] Use mangleType instead of mangleNameOrStandardSubstitution in mangleCXXCtorVTable function (PR #109970)

2024-09-27 Thread Younan Zhang via cfe-commits
@@ -1,4 +1,8 @@ // RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-apple-darwin9 | FileCheck %s +// RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-apple-darwin9 -fclang-abi-compat=19 | FileCheck %s --check-prefix=CHECK-CLANG-19 + +//CHECK: @_ZTCN16MangleCtorVTable4InstE0_N

[clang] [Clang] GH93099 (PR #110238)

2024-09-27 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 created https://github.com/llvm/llvm-project/pull/110238 Fixes #93099 >From 23a765ac6d8e455121346405332d2066dcc0861e Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Fri, 27 Sep 2024 18:23:47 +0800 Subject: [PATCH] [Clang] GH93099 --- clang/include/clang/Sema/Sem

[clang] [clang] Fix the local parameter of void type inside the `Requires` expression. (PR #109831)

2024-09-28 Thread Younan Zhang via cfe-commits
zyn0217 wrote: > ``` > static_assert(requires(this int) { true; }); > ``` The grammar doesn't appear to disallow the explicit object parameter in a requires expression, see https://eel.is/c++draft/expr.prim.req#nt:requirement-parameter-list. But the usage is indeed suspicious to me. We probab

[clang] [AST] Ensure getRawCommentsForAnyRedecl() does not miss any redecl with a comment (PR #108475)

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

[clang] [Clang] Avoid transforming lambdas when rebuilding immediate expressions (PR #108693)

2024-09-18 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/108693 >From 4e05a1972e539d08589b44677031f506b0c91203 Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Sat, 14 Sep 2024 18:31:42 +0800 Subject: [PATCH] [Clang] Avoid transforming lambdas when rebuilding immediate exp

[clang] [Clang] Avoid transforming lambdas when rebuilding immediate expressions (PR #108693)

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

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

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

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

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

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

2024-09-18 Thread Younan Zhang via cfe-commits
@@ -0,0 +1,99 @@ +//===- unittests/AST/RawCommentForDeclTestTest.cpp +//-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier:

[clang] [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: Yup, in

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

2024-09-18 Thread Younan Zhang via cfe-commits
@@ -440,14 +440,23 @@ const RawComment *ASTContext::getRawCommentForAnyRedecl( // Any redeclarations of D that we haven't checked for comments yet? // We can't use DenseMap::iterator directly since it'd get invalid. - auto LastCheckedRedecl = [this, CanonicalD]() -> const

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

2024-09-30 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/110473 >From f0692e16f08fc40865cc83aa6c3eb73f5d11144a Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Mon, 30 Sep 2024 16:57:14 +0800 Subject: [PATCH] [Clang] Implement CWG 2707 "Deduction guides cannot have a trail

[clang] [clang-tools-extra] [clangd] [AST] Handle uninitialized type constraints (PR #110496)

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

[clang] [clang-tools-extra] [clangd] [AST] Handle uninitialized type constraints (PR #110496)

2024-09-30 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 commented: Thanks again for analyzing & working on this issue. Some suggestions regarding the test: 1. As this is more of a clang issue (the offending code belongs to the serialization part of clang), so it is more appropriate to write a clang test instead of a clan

[clang] [clang-tools-extra] [clangd] [AST] Handle uninitialized type constraints (PR #110496)

2024-09-30 Thread Younan Zhang via cfe-commits
@@ -1899,7 +1899,7 @@ void ASTDeclWriter::VisitTemplateTypeParmDecl(TemplateTypeParmDecl *D) { Record.push_back(D->wasDeclaredWithTypename()); const TypeConstraint *TC = D->getTypeConstraint(); - assert((bool)TC == D->hasTypeConstraint()); + Record.push_back(TC != nullp

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

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

[clang] [clang] Fix the local parameter of void type inside the `Requires` expression. (PR #109831)

2024-09-30 Thread Younan Zhang via cfe-commits
@@ -153,6 +153,10 @@ RequiresExpr::RequiresExpr(ASTContext &C, SourceLocation RequiresKWLoc, std::copy(Requirements.begin(), Requirements.end(), getTrailingObjects()); RequiresExprBits.IsSatisfied |= Dependent; + RequiresExprBits.IsSatisfied &= + llvm::no

[clang] [clang] Fix the local parameter of void type inside the `Requires` expression. (PR #109831)

2024-09-30 Thread Younan Zhang via cfe-commits
@@ -9509,6 +9509,19 @@ Sema::ActOnStartRequiresExpr(SourceLocation RequiresKWLoc, PushDeclContext(BodyScope, Body); for (ParmVarDecl *Param : LocalParameters) { +if (Param->getType()->isVoidType()) { + if (LocalParameters.size() > 1) { +Diag(Param->getBeg

[clang] [Clang][Concepts] Normalize SizeOfPackExpr's pack declaration (PR #110238)

2024-09-30 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/110238 >From 23a765ac6d8e455121346405332d2066dcc0861e Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Fri, 27 Sep 2024 18:23:47 +0800 Subject: [PATCH 1/9] [Clang] GH93099 --- clang/include/clang/Sema/Sema.h

[clang] [clang-tools-extra] [clangd] [AST] Handle uninitialized type constraints (PR #110496)

2024-09-30 Thread Younan Zhang via cfe-commits
zyn0217 wrote: @falbrechtskirchinger We need to resort to `-fallow-pch-with-compiler-errors` :) Specifically, add the following file to `clang/test/PCH` (or somehow merge it into a pre-existing test, which I'd prefer) Name it with a reasonable name e.g. `cxx2a-invalid-constraint-serializatio

[clang] [Clang][Concepts] Normalize SizeOfPackExpr's pack declaration (PR #110238)

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

[clang] [Clang] Avoid transforming lambdas when rebuilding immediate expressions (PR #108693)

2024-09-18 Thread Younan Zhang via cfe-commits
zyn0217 wrote: > In the future, it would be better to push the unrelated parts of the pr in > separate NFC commits, for ease of review. Oops, I thought that was not too large, so I refactored that along the way of the call... anyways, I'll be careful next time :) https://github.com/llvm/llvm-

[clang] [Clang] Avoid transforming lambdas when rebuilding immediate expressions (PR #108693)

2024-09-18 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/108693 >From 4e05a1972e539d08589b44677031f506b0c91203 Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Sat, 14 Sep 2024 18:31:42 +0800 Subject: [PATCH] [Clang] Avoid transforming lambdas when rebuilding immediate exp

[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: Yeah, bu

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

2024-09-18 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 approved this pull request. Thanks for working on this! I think this probably needs a release note, otherwise it looks good on the whole. Please give other folks some time before merging it, and I invited @AaronBallman for the second pair of eyes. https://github.com

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

2024-09-18 Thread Younan Zhang via cfe-commits
@@ -0,0 +1,99 @@ +//===- unittests/AST/RawCommentForDeclTestTest.cpp +//-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier:

[clang] [clang] Fix the local parameter of void type inside the `Requires` expression. (PR #109831)

2024-09-24 Thread Younan Zhang via cfe-commits
@@ -9509,6 +9509,19 @@ Sema::ActOnStartRequiresExpr(SourceLocation RequiresKWLoc, PushDeclContext(BodyScope, Body); for (ParmVarDecl *Param : LocalParameters) { +if (Param->getType()->isVoidType()) { + if (LocalParameters.size() > 1) { +Diag(Param->getBeg

[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] Fix the local parameter of void type inside the `Requires` expression. (PR #109831)

2024-09-24 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 commented: There should be a release note :) I think I agree with @mizvekov's idea of merging the parameter checks into SemaType; we can probably in part reuse GetTypeForDeclarator. I would appreciate it if we can see some exploration here. Another thing is that we

[clang] [clang] Fix the local parameter of void type inside the `Requires` expression. (PR #109831)

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

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