[clang] [Clang] Preserve CXXParenListInitExpr in TreeTransform. (PR #138518)

2025-05-05 Thread Younan Zhang via cfe-commits
@@ -16487,12 +16501,22 @@ ExprResult TreeTransform::TransformCXXParenListInitExpr(CXXParenListInitExpr *E) { SmallVector TransformedInits; ArrayRef InitExprs = E->getInitExprs(); - if (TransformExprs(InitExprs.data(), InitExprs.size(), true, - Transfor

[clang] [Clang] diagnose deleted/default redeclaration of defined friend functions (PR #136717)

2025-04-24 Thread Younan Zhang via cfe-commits
@@ -142,6 +142,14 @@ NamedDecl *Parser::ParseCXXInlineMethodDef( SkipUntil(tok::semi); } +if (FunctionDecl *FD = +dyn_cast_if_present(FnD->getPreviousDecl())) { + if (isa(FD->getLexicalDeclContext()) || + Actions.getDefaultedFunctionKind

[clang] [Clang] diagnose deleted/default redeclaration of defined friend functions (PR #136717)

2025-04-23 Thread Younan Zhang via cfe-commits
@@ -142,6 +142,14 @@ NamedDecl *Parser::ParseCXXInlineMethodDef( SkipUntil(tok::semi); } +if (FunctionDecl *FD = +dyn_cast_if_present(FnD->getPreviousDecl())) { + if (isa(FD->getLexicalDeclContext()) || + Actions.getDefaultedFunctionKind

[clang] [Clang] diagnose deleted/default redeclaration of defined friend functions (PR #136717)

2025-04-23 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 requested changes to this pull request. https://github.com/llvm/llvm-project/pull/136717 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Reapply CWG2369 "Ordering between constraints and substitution" (PR #122423)

2025-04-25 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/122423 >From 56bacf47c53aca276ae4fa6aa2972b7eda152ddd Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Fri, 10 Jan 2025 09:46:24 +0800 Subject: [PATCH 01/10] Reapply "[Clang] Implement CWG2369 "Ordering between const

[clang] [Clang] Reapply CWG2369 "Ordering between constraints and substitution" (PR #122423)

2025-04-25 Thread Younan Zhang via cfe-commits
@@ -8058,6 +8061,46 @@ bool Sema::CheckNonDependentConversions( } } + // A speculative workaround for self-dependent constraint bugs that manifest + // after CWG2369. + // FIXME: Add references to the standard once P3606 is adopted. + auto MaybeInvolveUserDefinedConv

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

2025-04-14 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 closed 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] Handle default template arguments for alias CTAD guides (PR #134807)

2025-04-15 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/134807 >From 3f09d114d6c4c51bd879a19caaf1c73c531cfedd Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Tue, 8 Apr 2025 16:16:53 +0800 Subject: [PATCH 1/2] [Clang] Handle default template arguments for alias CTAD guid

[clang] [clang][AST] Handle implicit first argument in CallExpr::getBeginLoc() (PR #135757)

2025-04-15 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 approved this pull request. Yes, would be great to see it get backported https://github.com/llvm/llvm-project/pull/135757 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo

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

2025-04-15 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/134807 >From 3f09d114d6c4c51bd879a19caaf1c73c531cfedd Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Tue, 8 Apr 2025 16:16:53 +0800 Subject: [PATCH 1/3] [Clang] Handle default template arguments for alias CTAD guid

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

2025-04-28 Thread Younan Zhang via cfe-commits
@@ -4368,15 +4385,63 @@ Sema::CheckVarTemplateId(VarTemplateDecl *Template, SourceLocation TemplateLoc, // Produce a placeholder value if the specialization is dependent. if (Template->getDeclContext()->isDependentContext() || TemplateSpecializationType::anyDependent

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

2025-04-29 Thread Younan Zhang via cfe-commits
@@ -7594,6 +7594,54 @@ ASTContext::getCanonicalTemplateArgument(const TemplateArgument &Arg) const { llvm_unreachable("Unhandled template argument kind"); } +bool ASTContext::isSameTemplateArgument(const TemplateArgument &Arg1, +const

[clang] [Clang] Don't retain template FoundDecl for conversion function calls (PR #138377)

2025-05-02 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 created https://github.com/llvm/llvm-project/pull/138377 In consteval calls rewriting, we expect an instantiated AST to remain untouched. However, this was not true when rebuilding a MemberExpr in TreeTransform, as it relies on FoundDecl to build a resolved member ca

[clang] [Clang] Never consider conversion from single-element braced-init-list perfect (PR #138307)

2025-05-02 Thread Younan Zhang via cfe-commits
@@ -360,6 +360,13 @@ class Sema; LLVM_PREFERRED_TYPE(bool) unsigned ObjCLifetimeConversionBinding : 1; +/// Whether the source expression was originally a single element +/// braced-init-list. Such a conversion is not a perfect match, +/// as we prefer a st

[clang] [Clang] Never consider conversion from single-element braced-init-list perfect (PR #138307)

2025-05-02 Thread Younan Zhang via cfe-commits
@@ -412,6 +419,12 @@ class Sema; bool isPerfect(const ASTContext &C) const { if (!isIdentityConversion()) return false; + + // We might prefer a std::initializer constructor, zyn0217 wrote: `std::initializer_list` https://github.com/llv

[clang] [Clang] Don't retain template FoundDecl for conversion function calls (PR #138377)

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

[clang] [clang-tools-extra] [lldb] Reland [clang] Unify `SourceLocation` and `IdentifierInfo*` pair-like data structures to `IdentifierLoc` (PR #136077)

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

[clang] [Clang] Make the result type of sizeof/pointer subtraction/size_t lit… (PR #136542)

2025-04-21 Thread Younan Zhang via cfe-commits
@@ -4745,7 +4760,10 @@ Sema::CreateUnaryExprOrTypeTraitExpr(Expr *E, SourceLocation OpLoc, // C99 6.5.3.4p4: the type (an unsigned integer type) is size_t. return new (Context) UnaryExprOrTypeTraitExpr( - ExprKind, E, Context.getSizeType(), OpLoc, E->getSourceRange()

[clang] [Clang] Reapply CWG2369 "Ordering between constraints and substitution" (PR #122423)

2025-05-07 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/122423 >From 56bacf47c53aca276ae4fa6aa2972b7eda152ddd Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Fri, 10 Jan 2025 09:46:24 +0800 Subject: [PATCH 01/12] Reapply "[Clang] Implement CWG2369 "Ordering between const

[clang-tools-extra] allow implicit completion inside empty template argument list (PR #138846)

2025-05-07 Thread Younan Zhang via cfe-commits
@@ -2455,6 +2455,11 @@ bool isIncludeFile(llvm::StringRef Line) { } bool allowImplicitCompletion(llvm::StringRef Content, unsigned Offset) { + // Check if we're inside an empty template argument list + if (Content.size() > 2 && Content[Offset - 1] == '<' && + Content[Of

[clang] [Clang] Fix handling of pack indexing types in constraints of redeclaration (PR #139057)

2025-05-08 Thread Younan Zhang via cfe-commits
@@ -76,9 +77,18 @@ enum class TemplateSubstitutionKind : char { class MultiLevelTemplateArgumentList { /// The template argument list at a certain template depth +enum ListProperties { + /// A 'Final' substitution means that Subst* nodes won't be built + //

[clang] [Clang] Fix handling of pack indexing types in constraints of redeclaration (PR #139057)

2025-05-08 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 commented: Thanks for working on it. Will take a closer look later https://github.com/llvm/llvm-project/pull/139057 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-c

[clang] [Clang] Fix handling of pack indexing types in constraints of redeclaration (PR #139057)

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

[clang] [Clang] Fix handling of pack indexing types in constraints of redeclaration (PR #139057)

2025-05-08 Thread Younan Zhang via cfe-commits
@@ -2060,14 +2064,17 @@ TemplateName TemplateInstantiator::TransformTemplateName( return Arg.getAsTemplate(); } - auto [AssociatedDecl, Final] = + auto [AssociatedDecl, Final, ArgumentsAreInjectedTemplateParams] = TemplateArgs.getAssociatedD

[clang] [Clang] Fix handling of pack indexing types in constraints of redeclaration (PR #139057)

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

[clang] [Clang] Fix handling of pack indexing types in constraints of redeclaration (PR #139057)

2025-05-08 Thread Younan Zhang via cfe-commits
@@ -6884,7 +6884,7 @@ TreeTransform::TransformPackIndexingType(TypeLocBuilder &TLB, assert(!Unexpanded.empty() && "Pack expansion without parameter packs?"); // Determine whether the set of unexpanded parameter packs can and should // be expanded. -bool ShouldE

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

2025-05-08 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/139066 >From a6ee1af04225063bab4d853611c7a57b1db37aa9 Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Thu, 8 May 2025 19:42:51 +0800 Subject: [PATCH] [Clang] Do not eat SFINAE diagnostics for explicit template argum

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

2025-05-08 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 created https://github.com/llvm/llvm-project/pull/139066 Instead of merely suggesting the template arguments are invalid, we now provide an explanation of why the explicit template argument is invalid, following the last diagnostic note. For example, ```cpp templat

[clang] [Clang] Fix handling of pack indexing types in constraints of redeclaration (PR #139057)

2025-05-08 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 commented: I think this LGTM in general, but please wait for some time in case @erichkeane @mizvekov have some ideas https://github.com/llvm/llvm-project/pull/139057 ___ cfe-commits mailing list cfe-commits@lists.llvm.org ht

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

2025-02-19 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 created https://github.com/llvm/llvm-project/pull/127773 Closes https://github.com/llvm/llvm-project/issues/122523 >From 2d9c248c70b6d24f277982a32f36e2ef1bde2829 Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Wed, 19 Feb 2025 17:13:56 +0800 Subject: [PATCH] [Clang

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

2025-02-19 Thread Younan Zhang via cfe-commits
zyn0217 wrote: I looked into that weeks ago, and the reason I remembered was kind of subtle. I'll explain why the fix is necessary later - I'll need a debugger to help me recall that. https://github.com/llvm/llvm-project/pull/126723 ___ cfe-commits m

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

2025-02-18 Thread Younan Zhang via cfe-commits
zyn0217 wrote: Ping 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-19 Thread Younan Zhang via cfe-commits
zyn0217 wrote: @mizvekov The nuance is right here, where we tackle local lambdas and member functions separately: https://github.com/llvm/llvm-project/blob/404f94ac7d8c368fba8ad1f97512c26efd5ec965/clang/lib/Sema/SemaExpr.cpp#L18273-L18282 ```cpp template constexpr int visit(F f) { return f(0)

[clang] [Clang] Check for uninitialized use in lambda within CXXOperatorCallExpr (PR #129198)

2025-02-28 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 commented: Thanks for the contribution, and this makes sense to me. However I'd like others to take a look too. Of course this should come with a release note, in `clang/docs/ReleaseNotes.rst`. https://github.com/llvm/llvm-project/pull/129198 __

[clang] [Clang] Check for uninitialized use in lambda within CXXOperatorCallExpr (PR #129198)

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

[clang] [Clang] Check for uninitialized use in lambda within CXXOperatorCallExpr (PR #129198)

2025-02-28 Thread Younan Zhang via cfe-commits
@@ -12796,6 +12803,7 @@ namespace { } void VisitCXXOperatorCallExpr(CXXOperatorCallExpr *E) { + isInCXXOperatorCall = true; zyn0217 wrote: You can use `llvm::SaveAndRestore` to avoid restoring it manually https://github.com/llvm/llvm-project/pul

[clang] [Clang] Check for uninitialized use in lambda within CXXOperatorCallExpr (PR #129198)

2025-02-28 Thread Younan Zhang via cfe-commits
@@ -12804,6 +12812,20 @@ namespace { Visit(Callee); for (auto Arg: E->arguments()) HandleValue(Arg->IgnoreParenImpCasts()); + isInCXXOperatorCall = false; +} + +void VisitLambdaExpr(LambdaExpr *E) { + if (isInCXXOperatorCall) {

[clang] [Clang] Check for uninitialized use in lambda within CXXOperatorCallExpr (PR #129198)

2025-02-28 Thread Younan Zhang via cfe-commits
@@ -12597,6 +12597,12 @@ namespace { bool isRecordType; bool isPODType; bool isReferenceType; +// Tracks whether the current expression is being visited within a +// CXXOperatorCallExpr. This flag is set to true when entering a +// CXXOperatorCallExpr an

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

2025-03-07 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/130228 >From 295b8173b6913d9014c5786eb4af0112384afa65 Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Fri, 7 Mar 2025 11:38:11 +0800 Subject: [PATCH] [Clang] Implement P0963R3 "Structured binding declaration as a co

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

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

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

2025-03-07 Thread Younan Zhang via cfe-commits
@@ -6749,6 +6749,55 @@ void SemaCodeCompletion::CodeCompleteInitializer(Scope *S, Decl *D) { CodeCompleteExpression(S, Data); } +void SemaCodeCompletion::CodeCompleteIfConst(Scope *S, + bool AfterExclaim) const { + ResultBuilder

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

2025-03-07 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 and consteval (PR #124315)

2025-03-07 Thread Younan Zhang via cfe-commits
@@ -6749,6 +6749,55 @@ void SemaCodeCompletion::CodeCompleteInitializer(Scope *S, Decl *D) { CodeCompleteExpression(S, Data); } +void SemaCodeCompletion::CodeCompleteIfConst(Scope *S, + bool AfterExclaim) const {

[clang] [Clang] Check for uninitialized use in lambda within CXXOperatorCallExpr (PR #129198)

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

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

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

[clang] [clang] fix matching of nested template template parameters (PR #130447)

2025-03-09 Thread Younan Zhang via cfe-commits
@@ -11363,14 +11363,17 @@ class Sema final : public SemaBase { /// The context in which we are checking a template parameter list. enum TemplateParamListContext { -TPC_ClassTemplate, -TPC_VarTemplate, +// For this context, Class, Variable, TypeAlias, and non-pa

[clang] [clang] fix matching of nested template template parameters (PR #130447)

2025-03-09 Thread Younan Zhang via cfe-commits
@@ -11363,14 +11363,17 @@ class Sema final : public SemaBase { /// The context in which we are checking a template parameter list. enum TemplateParamListContext { -TPC_ClassTemplate, -TPC_VarTemplate, +// For this context, Class, Variable, TypeAlias, and non-pa

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

2025-03-09 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/130228 >From 295b8173b6913d9014c5786eb4af0112384afa65 Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Fri, 7 Mar 2025 11:38:11 +0800 Subject: [PATCH 1/3] [Clang] Implement P0963R3 "Structured binding declaration as

[clang] [clang] fix matching of nested template template parameters (PR #130447)

2025-03-09 Thread Younan Zhang via cfe-commits
@@ -11363,14 +11363,17 @@ class Sema final : public SemaBase { /// The context in which we are checking a template parameter list. enum TemplateParamListContext { -TPC_ClassTemplate, -TPC_VarTemplate, +// For this context, Class, Variable, TypeAlias, and non-pa

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

2025-03-09 Thread Younan Zhang via cfe-commits
@@ -309,6 +309,7 @@ Bug Fixes to AST Handling ^ - Fixed type checking when a statement expression ends in an l-value of atomic type. (#GH106576) - Fixed uninitialized use check in a lambda within CXXOperatorCallExpr. (#GH129198) +- Clang now correctly

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

2025-03-09 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/130228 >From 295b8173b6913d9014c5786eb4af0112384afa65 Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Fri, 7 Mar 2025 11:38:11 +0800 Subject: [PATCH 1/2] [Clang] Implement P0963R3 "Structured binding declaration as

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

2025-03-09 Thread Younan Zhang via cfe-commits
@@ -4285,6 +4290,8 @@ class DecompositionDecl final std::move(Bindings)); } + bool isDecisionVariable() const { return IsDecisionVariable; } zyn0217 wrote: Done, I was referring to https://eel.is/c++draft/dcl.str

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

2025-03-09 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 edited https://github.com/llvm/llvm-project/pull/130228 ___ 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-03-04 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 closed 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][AST] Remove HasFirstArg assertion in CallExpr::getBeginLoc() (PR #130725)

2025-03-10 Thread Younan Zhang via cfe-commits
zyn0217 wrote: @cor3ntin I would appreciate it if you can take a look too https://github.com/llvm/llvm-project/pull/130725 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][AST] Remove HasFirstArg assertion in CallExpr::getBeginLoc() (PR #130725)

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

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

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

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

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

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

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

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

2025-03-10 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-09 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/130228 >From 295b8173b6913d9014c5786eb4af0112384afa65 Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Fri, 7 Mar 2025 11:38:11 +0800 Subject: [PATCH 1/4] [Clang] Implement P0963R3 "Structured binding declaration as

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

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

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

2025-03-10 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/130228 >From 295b8173b6913d9014c5786eb4af0112384afa65 Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Fri, 7 Mar 2025 11:38:11 +0800 Subject: [PATCH 1/5] [Clang] Implement P0963R3 "Structured binding declaration as

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

2025-03-10 Thread Younan Zhang via cfe-commits
@@ -4224,15 +4224,18 @@ class DecompositionDecl final : public VarDecl, private llvm::TrailingObjects { /// The number of BindingDecl*s following this object. - unsigned NumBindings; + unsigned NumBindings : 31; + + LLVM_PREFERRED_TYPE(bool) + unsigned IsDecisio

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

2025-03-10 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/130228 >From 295b8173b6913d9014c5786eb4af0112384afa65 Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Fri, 7 Mar 2025 11:38:11 +0800 Subject: [PATCH 1/8] [Clang] Implement P0963R3 "Structured binding declaration as

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

2025-03-11 Thread Younan Zhang via cfe-commits
zyn0217 wrote: > Hum, do we want to add tests for > https://cplusplus.github.io/CWG/issues/2867.html at the same time? I'll look into that in a followup https://github.com/llvm/llvm-project/pull/130228 ___ cfe-commits mailing list cfe-commits@lists.l

[clang] [Clang] Fix the printout of CXXParenListInitExpr involving default arguments (PR #130731)

2025-03-11 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/130731 >From c643ba2de0bb3e5fcb6514b70c86e594badc396b Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Tue, 11 Mar 2025 14:18:20 +0800 Subject: [PATCH 1/2] [Clang] Fix the printout of CXXParenListInitExpr involving d

[clang] [Clang] Fix the printout of CXXParenListInitExpr involving default arguments (PR #130731)

2025-03-11 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/130731 >From c643ba2de0bb3e5fcb6514b70c86e594badc396b Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Tue, 11 Mar 2025 14:18:20 +0800 Subject: [PATCH] [Clang] Fix the printout of CXXParenListInitExpr involving defau

[clang] [Clang] Fix the printout of CXXParenListInitExpr involving default arguments (PR #130731)

2025-03-11 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/130731 >From c643ba2de0bb3e5fcb6514b70c86e594badc396b Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Tue, 11 Mar 2025 14:18:20 +0800 Subject: [PATCH 1/3] [Clang] Fix the printout of CXXParenListInitExpr involving d

[clang] [Clang] Fix the printout of CXXParenListInitExpr involving default arguments (PR #130731)

2025-03-11 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 created https://github.com/llvm/llvm-project/pull/130731 The parantheses are unnecessary IMO because they should have been handled in the parents of such expressions, e.g. in CXXFunctionalCastExpr. Moreover, we shouldn't join CXXDefaultInitExpr either because they ar

[clang] [Clang] Fix the printout of CXXParenListInitExpr involving default arguments (PR #130731)

2025-03-11 Thread Younan Zhang via cfe-commits
zyn0217 wrote: > The CI failure seems relevant here Not a big deal. https://github.com/llvm/llvm-project/pull/130731 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2025-03-11 Thread Younan Zhang via cfe-commits
@@ -529,8 +529,12 @@ def warn_cxx14_compat_decomp_decl : Warning< def ext_decomp_decl : ExtWarn< "decomposition declarations are a C++17 extension">, InGroup; def ext_decomp_decl_cond : ExtWarn< - "ISO C++17 does not permit structured binding declaration in a condition">, -

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

2025-03-11 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-11 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/130228 >From 295b8173b6913d9014c5786eb4af0112384afa65 Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Fri, 7 Mar 2025 11:38:11 +0800 Subject: [PATCH 1/9] [Clang] Implement P0963R3 "Structured binding declaration as

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

2025-03-11 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/130228 >From 295b8173b6913d9014c5786eb4af0112384afa65 Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Fri, 7 Mar 2025 11:38:11 +0800 Subject: [PATCH 01/10] [Clang] Implement P0963R3 "Structured binding declaration a

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

2025-03-11 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 created https://github.com/llvm/llvm-project/pull/130228 Todo: - [ ] Adapt the bytecode interpreter to the new evaluation model - [ ] Tests for CG & Constant evaluation - [ ] Release notes With this patch, the example shown in https://godbolt.org/z/b64x65716 (the R

[clang] [clang] more useful error message for decomposition declaration missing initializer (PR #127924)

2025-03-01 Thread Younan Zhang via cfe-commits
@@ -140,18 +140,23 @@ namespace Template { template auto [a, b, c] = n; // expected-error {{decomposition declaration template not supported}} } +#define MYC C + namespace Init { - void f() { + template T f(T t) { int arr[1]; struct S { int n; }; -auto &[ba

[clang] [Clang] Fixed UnresolvedLookupExpr propagating into the codegen phase (PR #124609)

2025-03-13 Thread Younan Zhang via cfe-commits
@@ -703,6 +703,48 @@ auto f(auto x) { // cxx14-error {{'auto' not allowed in function prototype}} return f(1) + 1; } +namespace GH122892 { zyn0217 wrote: I think the test should live in CodeGen/ rather than SemaCXX/, which mostly contains '-fsyntax-only'

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

2025-03-11 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 closed https://github.com/llvm/llvm-project/pull/130228 ___ 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-13 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
@@ -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
@@ -75,7 +75,7 @@ getDepthAndIndex(UnexpandedParameterPack UPP) { if (const auto *TTP = dyn_cast(UPP.first)) return std::make_pair(TTP->getDepth(), TTP->getIndex()); zyn0217 wrote: I think the users of this function shouldn't expect a `SubstTemplateTyp

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

2025-03-13 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] Improve `getReplacedTemplateParameterList()` const correctness (PR #131165)

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

[clang] [Clang] Fixed UnresolvedLookupExpr propagating into the codegen phase (PR #124609)

2025-03-13 Thread Younan Zhang via cfe-commits
@@ -703,6 +703,48 @@ auto f(auto x) { // cxx14-error {{'auto' not allowed in function prototype}} return f(1) + 1; } +namespace GH122892 { zyn0217 wrote: I don't know, but the original issue doesn't manifest with `-fsyntax-only` https://godbolt.org/z/MdMz

[clang] [Clang] Fixed UnresolvedLookupExpr propagating into the codegen phase (PR #124609)

2025-03-13 Thread Younan Zhang via cfe-commits
@@ -703,6 +703,48 @@ auto f(auto x) { // cxx14-error {{'auto' not allowed in function prototype}} return f(1) + 1; } +namespace GH122892 { zyn0217 wrote: Oh so it is the case - looks like we now have errors for the case in question. https://github.com/llv

[clang] [Clang][NFCI] Remove CallExpr::CreateTemporary() (PR #130921)

2025-03-12 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 closed https://github.com/llvm/llvm-project/pull/130921 ___ 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-03-04 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/3] [Clang] Don't give up on an unsuccessful function instantiat

[clang] [Clang][NFCI] Remove CallExpr::CreateTemporary() (PR #130921)

2025-03-12 Thread Younan Zhang via cfe-commits
zyn0217 wrote: (Duplicate of #130919.) https://github.com/llvm/llvm-project/pull/130921 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][NFC] Remove CallExpr::CreateTemporary (PR #130919)

2025-03-12 Thread Younan Zhang via cfe-commits
zyn0217 wrote: Oops, I just filed #130921 https://github.com/llvm/llvm-project/pull/130919 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][NFC] Remove CallExpr::CreateTemporary (PR #130919)

2025-03-12 Thread Younan Zhang via cfe-commits
@@ -1655,14 +1645,8 @@ SourceLocation CallExpr::getBeginLoc() const { if (!isTypeDependent()) { if (const auto *Method = dyn_cast_if_present(getCalleeDecl()); -Method && Method->isExplicitObjectMemberFunction()) { - // Note: while we typically exp

[clang] [Clang][NFC] Remove CallExpr::CreateTemporary (PR #130919)

2025-03-12 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 approved this pull request. https://github.com/llvm/llvm-project/pull/130919 ___ 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-12 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/2] Reapply "[Clang] Improve diagnostics for expansion length mi

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

2025-03-12 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] Reapply "[Clang] Improve diagnostics for expansion length mismat

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

2025-03-12 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 ready_for_review 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] [Clang] Remove the PackExpansion restrictions for rewrite substitution (PR #126206)

2025-02-13 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 closed https://github.com/llvm/llvm-project/pull/126206 ___ 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 approved this pull request. LGTM 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] Fixing the logic issue in TransformTypos::TransformDesignatedInitExpr… (PR #127211)

2025-02-14 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 commented: Thanks. Though I think we should just fix the problematic condition expression, and other changes seem a bit unnecessary since they are already clear enough. https://github.com/llvm/llvm-project/pull/127211 ___ cf

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

2025-02-14 Thread Younan Zhang via cfe-commits
@@ -13697,6 +13698,7 @@ TreeTransform::TransformDesignatedInitExpr(DesignatedInitExpr *E) { ArrayExprs.push_back(End.get()); } + // Compare the transformed initializer against the original. zyn0217 wrote: I think the code is self-explanatory enough so

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

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

<    13   14   15   16   17   18   19   20   21   >