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

2025-05-10 Thread Younan Zhang via cfe-commits
@@ -0,0 +1,366 @@ +//===--- AddPureVirtualOverride.cpp --*- C++-*-===// +// +// 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: Ap

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

2025-05-10 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 commented: Just a drive-by comment. Thanks for working on it https://github.com/llvm/llvm-project/pull/139348 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2025-05-10 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/139374 >From 1e359714374418bf51e93d54169557c29bddf7c6 Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Sat, 10 May 2025 18:59:03 +0800 Subject: [PATCH 1/2] [Clang] Don't ditch typo-corrected lookup result For a membe

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

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

[clang] [Clang] Fix pack indexing profiling (PR #139276)

2025-05-09 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 edited https://github.com/llvm/llvm-project/pull/139276 ___ 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-09 Thread Younan Zhang via cfe-commits
@@ -1476,8 +1478,8 @@ namespace { } } -TemplateArgument -getTemplateArgumentPackPatternForRewrite(const TemplateArgument &TA) { +TemplateArgument getTemplateArgumentorUnsubstitutedExpansionPattern( zyn0217 wrote: ```suggestion Templa

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

2025-05-09 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 approved this pull request. one nit, else LG! 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 pack indexing profiling (PR #139276)

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

[clang] [Clang] Fix pack indexing profiling (PR #139276)

2025-05-09 Thread Younan Zhang via cfe-commits
@@ -4549,6 +4549,10 @@ class PackIndexingExpr final bool isFullySubstituted() const { return FullySubstituted; } + bool isPartiallySubstituted() const { +return isValueDependent() && TransformedExpressions; + }; zyn0217 wrote: Trailing semicolon htt

[clang] [Clang] Fix pack indexing profiling (PR #139276)

2025-05-09 Thread Younan Zhang via cfe-commits
@@ -4549,6 +4549,10 @@ class PackIndexingExpr final bool isFullySubstituted() const { return FullySubstituted; } + bool isPartiallySubstituted() const { zyn0217 wrote: Please document the difference with FullySubstituted https://github.com/llvm/llvm-proj

[clang] [Clang] Reland: Diagnose invalid function types in dependent contexts (PR #139246)

2025-05-09 Thread Younan Zhang via cfe-commits
@@ -33,7 +33,7 @@ T f1(T t1, U u1, int i1, T** tpp) i1 = t1[u1]; i1 *= t1; - i1(u1, t1); // expected-error {{called object type 'int' is not a function or function pointer}} + i1(u1, t1); zyn0217 wrote: This is unfortunate https://github.com/llvm/llvm

[clang] [Clang] Reland: Diagnose invalid function types in dependent contexts (PR #139246)

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

[clang] [Clang] Reland: Diagnose invalid function types in dependent contexts (PR #139246)

2025-05-09 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 edited https://github.com/llvm/llvm-project/pull/139246 ___ 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-09 Thread Younan Zhang via cfe-commits
@@ -779,3 +781,59 @@ template consteval void S::mfn() requires (bool(&fn)) {} } + + +namespace GH138255 { + + template + concept C = true; + + struct Func { + template + requires C + static auto buggy() -> void; + + template + requires C + fr

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

2025-05-10 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 created https://github.com/llvm/llvm-project/pull/139436 Since 346077aa, we began using the primary template's lexical DeclContext for template arguments in order to properly instantiate a friend definition. There is a missed peculiar case, as in a friend template is

[clang] Fix missing initializer for inline static template member with auto caused by delayed template instantiation. (PR #138122)

2025-05-08 Thread Younan Zhang via cfe-commits
@@ -6027,8 +6027,15 @@ void Sema::BuildVariableInstantiation( Context.setManglingNumber(NewVar, Context.getManglingNumber(OldVar)); Context.setStaticLocalNumber(NewVar, Context.getStaticLocalNumber(OldVar)); + bool VarTemplateWithAutoType = false; + QualType VarSourceTyp

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

2025-05-12 Thread Younan Zhang via cfe-commits
zyn0217 wrote: @mizvekov It's not a big deal to turn them into explicit specializations after all... I pushed a commit https://github.com/llvm/llvm-project/pull/139436 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-

[clang] [Clang][Sema] Disable checking invalid template id in initializer of primary variable template `std::format_kind` with libstdc++ (PR #139560)

2025-05-13 Thread Younan Zhang via cfe-commits
zyn0217 wrote: @cor3ntin @erichkeane I question if a hack is really necessary here. We had run into a similar situation when we broke libstdc++ 14.1 (#92439), and the consensus then was to wait for the next dot release. I'd expect they'll fix this issue in the next dot release too? @jwakely W

[clang] [clang-tools-extra] [Clang] Add builtins that deduplicate and sort types (PR #106730)

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

[clang] [clang-tools-extra] [Clang] Add builtins that deduplicate and sort types (PR #106730)

2025-05-13 Thread Younan Zhang via cfe-commits
@@ -1666,6 +1685,21 @@ namespace { return inherited::TransformTemplateArgument(Input, Output, Uneval); } +using TreeTransform::TransformTemplateSpecializationType; +QualType +TransformTemplateSpecializationType(TypeLocBuilder &TLB, +

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

2025-05-13 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/139436 >From 1756fbcd874097fdea256c2c5986810a011eafed Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Sun, 11 May 2025 12:54:12 +0800 Subject: [PATCH 1/3] [Clang] Stop looking for DC from dependent friend specializa

[clang] [clang-tools-extra] [Clang] Add builtins that deduplicate and sort types (PR #106730)

2025-05-14 Thread Younan Zhang via cfe-commits
@@ -5054,95 +5089,128 @@ bool TreeTransform::TransformTemplateArguments( } if (In.getArgument().isPackExpansion()) { - // We have a pack expansion, for which we will be substituting into - // the pattern. - SourceLocation Ellipsis; - UnsignedOrNone

[clang] [clang-tools-extra] [Clang] Add builtins that deduplicate and sort types (PR #106730)

2025-05-14 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 deleted https://github.com/llvm/llvm-project/pull/106730 ___ 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-05-14 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/14] Reapply "[Clang] Implement CWG2369 "Ordering between const

[clang] [clang-tools-extra] [Clang] Add builtins that deduplicate and sort types (PR #106730)

2025-05-14 Thread Younan Zhang via cfe-commits
@@ -6484,6 +6499,57 @@ class SubstTemplateTypeParmType final } }; +/// Represents the result of substituting a set of types as a template argument +/// that needs to be expanded later. +/// +/// These types are always dependent and produced depending on the situations: +///

[clang] [clang-tools-extra] [Clang] Add builtins that deduplicate and sort types (PR #106730)

2025-05-14 Thread Younan Zhang via cfe-commits
@@ -6484,6 +6499,57 @@ class SubstTemplateTypeParmType final } }; +/// Represents the result of substituting a set of types as a template argument +/// that needs to be expanded later. +/// +/// These types are always dependent and produced depending on the situations: +///

[clang] [clang-tools-extra] [Clang] Add builtins that deduplicate and sort types (PR #106730)

2025-05-14 Thread Younan Zhang via cfe-commits
@@ -5054,95 +5089,128 @@ bool TreeTransform::TransformTemplateArguments( } if (In.getArgument().isPackExpansion()) { - // We have a pack expansion, for which we will be substituting into - // the pattern. - SourceLocation Ellipsis; - UnsignedOrNone

[clang] [clang-tools-extra] [Clang] Add builtins that deduplicate and sort types (PR #106730)

2025-05-14 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 edited https://github.com/llvm/llvm-project/pull/106730 ___ 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-05-14 Thread Younan Zhang via cfe-commits
zyn0217 wrote: Not yet, I haven't check GCC's recent changes yet so there might still be some differences with them. https://github.com/llvm/llvm-project/pull/122423 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bi

[clang] [clang-tools-extra] [Clang] Add builtins that deduplicate and sort types (PR #106730)

2025-05-14 Thread Younan Zhang via cfe-commits
@@ -6484,6 +6499,57 @@ class SubstTemplateTypeParmType final } }; +/// Represents the result of substituting a set of types as a template argument +/// that needs to be expanded later. +/// +/// These types are always dependent and produced depending on the situations: +///

[clang] [clang-tools-extra] [Clang] Add builtins that deduplicate and sort types (PR #106730)

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

[clang] [clang-tools-extra] [Clang] Add builtins that deduplicate and sort types (PR #106730)

2025-05-14 Thread Younan Zhang via cfe-commits
@@ -5054,95 +5089,128 @@ bool TreeTransform::TransformTemplateArguments( } if (In.getArgument().isPackExpansion()) { - // We have a pack expansion, for which we will be substituting into - // the pattern. - SourceLocation Ellipsis; - UnsignedOrNone

[clang] [Clang] Fix missing initializer for inline static template member with auto caused by delayed template instantiation (PR #138122)

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

[clang] [Clang] Fix missed initializer instantiation bug for variable templates (PR #138122)

2025-05-14 Thread Younan Zhang via cfe-commits
@@ -27,3 +27,15 @@ template constexpr int A::n = sizeof(A) + sizeof(T); template inline constexpr int A::m = sizeof(A) + sizeof(T); static_assert(A().f() == 5); static_assert(A().g() == 5); + +template struct InlineAuto { + template inline static auto var = 5; +}; + +temp

[clang] [Clang] Fix missed initializer instantiation bug for variable templates (PR #138122)

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

[clang] [Clang] Fix missed initializer instantiation bug for variable templates (PR #138122)

2025-05-14 Thread Younan Zhang via cfe-commits
@@ -1,5 +1,19 @@ // RUN: %clang_cc1 -std=c++1z %s -emit-llvm -o - -triple x86_64-linux-gnu | FileCheck %s +template struct InlineAuto { + template inline static auto var = 5; +}; +int inlineauot = InlineAuto::var; +// CHECK: @_ZN10InlineAutoIiE3varIiEE = {{.*}}i32 5{{.*}}co

[clang] [Clang] Fix missed initializer instantiation bug for variable templates (PR #138122)

2025-05-14 Thread Younan Zhang via cfe-commits
@@ -1,5 +1,19 @@ // RUN: %clang_cc1 -std=c++1z %s -emit-llvm -o - -triple x86_64-linux-gnu | FileCheck %s +template struct InlineAuto { + template inline static auto var = 5; +}; +int inlineauot = InlineAuto::var; zyn0217 wrote: inlineauto? https://github

[clang] [Clang] Fix missed initializer instantiation bug for variable templates (PR #138122)

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

[clang] [Clang] Fix an inadvertent overwrite of sub-initializers (PR #140714)

2025-05-20 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 created https://github.com/llvm/llvm-project/pull/140714 When using InitChecker with VerifyOnly, we create a new designated initializer to handle anonymous fields. However in the last call to CheckDesignatedInitializer, the subinitializer isn't properly preserved but

[clang] [Clang] Fix an inadvertent overwrite of sub-initializers (PR #140714)

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

[clang] [clang] Fixed Constant Evaluation don't Call Destructor (PR #140278)

2025-05-20 Thread Younan Zhang via cfe-commits
@@ -1321,4 +1321,39 @@ namespace GH139160{ // expected-note@-2 {{non-constexpr function 'make_struct' cannot be used in a constant expression}} }; +// taken from: https://github.com/llvm/llvm-project/issues/139818 +namespace GH

[clang] [Clang] Set the final date for workaround for libstdc++'s `format_kind` (PR #140831)

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

[clang] Reapply "[Clang] Profile singly-resolved UnresolvedLookupExpr with the declaration" (PR #140680)

2025-05-19 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 created https://github.com/llvm/llvm-project/pull/140680 For a dependent variable template specialization, we don't build a dependent Decl node or a DeclRefExpr to represent it. Instead, we preserve the UnresolvedLookupExpr until instantiation. However, this approac

[clang] Reapply "[Clang] Profile singly-resolved UnresolvedLookupExpr with the declaration" (PR #140680)

2025-05-19 Thread Younan Zhang via cfe-commits
@@ -2189,8 +2189,14 @@ StmtProfiler::VisitCXXPseudoDestructorExpr(const CXXPseudoDestructorExpr *S) { void StmtProfiler::VisitOverloadExpr(const OverloadExpr *S) { VisitExpr(S); - VisitNestedNameSpecifier(S->getQualifier()); - VisitName(S->getName(), /*TreatAsDecl*/ true)

[clang] [Clang] Functions called in discarded statements should not be instantiated (PR #140576)

2025-05-19 Thread Younan Zhang via cfe-commits
zyn0217 wrote: Does it fix https://github.com/llvm/llvm-project/issues/115289? https://github.com/llvm/llvm-project/pull/140576 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Profile singly-resolved UnresolvedLookupExpr with the declaration (PR #140029)

2025-05-19 Thread Younan Zhang via cfe-commits
zyn0217 wrote: @rupprecht That doesn't seem right... Will look into it https://github.com/llvm/llvm-project/pull/140029 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Revert "[Clang] Profile singly-resolved UnresolvedLookupExpr with the declaration" (PR #140655)

2025-05-19 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 created https://github.com/llvm/llvm-project/pull/140655 This introduced a bug where noexcept specifiers are involved, as reported in https://github.com/llvm/llvm-project/pull/140029#issuecomment-2892259764 Addressing that doesn't seem trivial at the moment, so I'll

[clang] Revert "[Clang] Profile singly-resolved UnresolvedLookupExpr with the declaration" (PR #140655)

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

[clang] [Clang] Profile singly-resolved UnresolvedLookupExpr with the declaration (PR #140029)

2025-05-19 Thread Younan Zhang via cfe-commits
zyn0217 wrote: I reverted it :( https://github.com/llvm/llvm-project/pull/140029 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Fix missed initializer instantiation bug for variable templates (PR #138122)

2025-05-18 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 closed https://github.com/llvm/llvm-project/pull/138122 ___ 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-05-26 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/15] Reapply "[Clang] Implement CWG2369 "Ordering between const

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

2025-05-26 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/18] Reapply "[Clang] Implement CWG2369 "Ordering between const

[clang] [Clang] Fix a pack expansion bug in template argument deduction (PR #141547)

2025-05-26 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 created https://github.com/llvm/llvm-project/pull/141547 I think the intent of df18ee96206 was to substitute only those non-packs into a pack expansion type (e.g. `T` in `T::pack`...), so let's hold off pack expansions explicitly, in case there are calls coming from

[clang] [Clang] Fix a pack expansion bug in template argument deduction (PR #141547)

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

[clang] [Clang] Fix a pack expansion bug in template argument deduction (PR #141547)

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

[clang] [clang] Fix a typo in documentation (PR #141382)

2025-05-24 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 approved this pull request. https://github.com/llvm/llvm-project/pull/141382 ___ 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-05-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/16] Reapply "[Clang] Implement CWG2369 "Ordering between const

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

2025-05-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/17] Reapply "[Clang] Implement CWG2369 "Ordering between const

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

2025-05-25 Thread Younan Zhang via cfe-commits
zyn0217 wrote: @cor3ntin it's ready :) https://github.com/llvm/llvm-project/pull/122423 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Clean up the fix for deferred access checking (PR #141340)

2025-05-26 Thread Younan Zhang via cfe-commits
zyn0217 wrote: Sure, let's just wait until CWG opines. https://github.com/llvm/llvm-project/pull/141340 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Clean up the fix for deferred access checking (PR #141340)

2025-05-24 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 created https://github.com/llvm/llvm-project/pull/141340 https://github.com/llvm/llvm-project/commit/200f3bd39562f4d605f13567398025d30fa27d61 introduced a parsing scope to avoid deferring access checking for friend declarations. That turned out to be insufficient beca

[clang] [Clang] Reset ArgPackSubstIndex before rewriting CTAD template parameters (PR #141741)

2025-05-28 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 created https://github.com/llvm/llvm-project/pull/141741 032ad59 taught the instantiator to expand template argument packs for rewrite. However we might already be in a pack expansion when we synthesizing the CTAD guide, so we reset the ArgPackSubstIndex to ensure it

[clang] [Clang] Reset ArgPackSubstIndex before rewriting CTAD template parameters (PR #141741)

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

[clang] [llvm] Reland "Add macro to suppress -Wunnecessary-virtual-specifier" (PR #141091)

2025-05-28 Thread Younan Zhang via cfe-commits
zyn0217 wrote: @cor3ntin can we merge it? building clang with ToT clang results in a lot of warnings now. https://github.com/llvm/llvm-project/pull/141091 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/l

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

2025-05-28 Thread Younan Zhang via cfe-commits
@@ -522,6 +522,12 @@ enum class TemplateSubstitutionKind : char { llvm::PointerUnion * findInstantiationOf(const Decl *D); +/// Similar to \p findInstantiationOf(), but it wouldn't assert if the +/// instantiation was not found within the current instantiation

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

2025-05-28 Thread Younan Zhang via cfe-commits
@@ -13458,6 +13473,10 @@ class Sema final : public SemaBase { // FIXME: Should we have a similar limit for other forms of synthesis? unsigned NonInstantiationEntries; + /// The number of \p CodeSynthesisContexts that are not constraint + /// substitution. + unsigned Non

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

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

[clang] [Clang] Profile singly-resolved UnresolvedLookupExpr with the declaration (PR #140029)

2025-05-15 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 created https://github.com/llvm/llvm-project/pull/140029 For a dependent variable template specialization, we don't build a dependent Decl node or a DeclRefExpr to represent it. Instead, we preserve the UnresolvedLookupExpr until instantiation. However, this approac

[clang] [Clang] Fix parsing of expressions of the form (T())[/*...*/] (PR #140053)

2025-05-15 Thread Younan Zhang via cfe-commits
@@ -692,6 +692,70 @@ ExprResult Parser::ParseLambdaExpression() { return ParseLambdaExpressionAfterIntroducer(Intro); } +bool Parser::IsLambdaAfterTypeCast() { + assert(getLangOpts().CPlusPlus && Tok.is(tok::l_square) && + "Not at the start of a possible lambda expr

[clang] [Clang] Profile singly-resolved UnresolvedLookupExpr with the declaration (PR #140029)

2025-05-16 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/140029 >From 143a35ef0af10add4a0705ea4ca11856f00dcb83 Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Thu, 15 May 2025 16:51:51 +0800 Subject: [PATCH] [Clang] Profile singly-resolved UnresolvedLookupExpr with the de

[clang] Revert "[Clang] Fix missed initializer instantiation bug for variable templates" (PR #140930)

2025-05-21 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 approved this pull request. I'll approve it, because I have a similar experience that swapping the deferred instantiation and immediate instantiation order caused a very subtle failure of return type deduction. However, just as what @AaronBallman suggested, please ho

[clang] Revert "[Clang] Fix missed initializer instantiation bug for variable templates" (PR #140930)

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

[clang] Revert "[Clang] Fix missed initializer instantiation bug for variable templates" (PR #140930)

2025-05-21 Thread Younan Zhang via cfe-commits
zyn0217 wrote: I'll go ahead and merge this: the eager instantiation of member templates - even it is still dependent - doesnt look right to me In the meantime, I'll look into the case and see if I can figure out a solution https://github.com/llvm/llvm-project/pull/140930 _

[clang] [Clang] Optimize some `getBeginLoc` implementations (PR #141058)

2025-05-22 Thread Younan Zhang via cfe-commits
@@ -563,17 +563,21 @@ class alignas(void *) Stmt { unsigned HasFPFeatures : 1; /// True if the call expression is a must-elide call to a coroutine. +LLVM_PREFERRED_TYPE(bool) unsigned IsCoroElideSafe : 1; -/// Padding used to align OffsetToTrailingObject

[clang] [Clang] Optimize some `getBeginLoc` implementations (PR #141058)

2025-05-22 Thread Younan Zhang via cfe-commits
@@ -1638,43 +1647,6 @@ CallExpr::getUnusedResultAttr(const ASTContext &Ctx) const { return {nullptr, nullptr}; } -SourceLocation CallExpr::getBeginLoc() const { - if (const auto *OCE = dyn_cast(this)) -return OCE->getBeginLoc(); - - // A non-dependent call to a member

[clang] [Clang] Optimize some `getBeginLoc` implementations (PR #141058)

2025-05-22 Thread Younan Zhang via cfe-commits
@@ -296,14 +298,18 @@ class NestedNameSpecifierLoc { /// Retrieve the location of the beginning of this /// nested-name-specifier. SourceLocation getBeginLoc() const { -return getSourceRange().getBegin(); +if (!Qualifier) + return SourceLocation(); + +Nes

[clang] [Clang] Optimize some `getBeginLoc` implementations (PR #141058)

2025-05-22 Thread Younan Zhang via cfe-commits
@@ -542,7 +542,8 @@ bool SemaOpenCL::checkBuiltinToAddr(unsigned BuiltinID, CallExpr *Call) { auto RT = Call->getArg(0)->getType(); if (!RT->isPointerType() || RT->getPointeeType().getAddressSpace() == LangAS::opencl_constant) { -Diag(Call->getBeginLoc(), diag::e

[clang] [Clang] Optimize some `getBeginLoc` implementations (PR #141058)

2025-05-22 Thread Younan Zhang via cfe-commits
@@ -542,7 +542,8 @@ bool SemaOpenCL::checkBuiltinToAddr(unsigned BuiltinID, CallExpr *Call) { auto RT = Call->getArg(0)->getType(); if (!RT->isPointerType() || RT->getPointeeType().getAddressSpace() == LangAS::opencl_constant) { -Diag(Call->getBeginLoc(), diag::e

[clang] [Clang] Do not defer variable template instantiation for undeduced types (PR #141009)

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

[clang] [clang] Fixed an assertion failure triggered when instantiating a template with an expr that references an invalid decl (PR #140905)

2025-05-21 Thread Younan Zhang via cfe-commits
zyn0217 wrote: I feel an invalid Decl shouldn't make its way down so deeper into instantiation. Could you check? https://github.com/llvm/llvm-project/pull/140905 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/m

[clang] [Clang] Fix the access checking for non-aggregates in default arguments (PR #141207)

2025-05-23 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 created https://github.com/llvm/llvm-project/pull/141207 We check the accessibility of constructors when initializing a default argument whose type is not an aggregate. Make sure the check is performed within the correct DeclContext. Otherwise, it will be delayed un

[clang] [Clang] Fix the access checking for non-aggregates in default arguments (PR #141207)

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

[clang] [Clang] Fix the access checking for non-aggregates in default arguments (PR #141207)

2025-05-23 Thread Younan Zhang via cfe-commits
@@ -282,4 +283,25 @@ static_assert(S().SizeOfT() == sizeof(short *), ""); } // namespace GH68490 +namespace GH83608 { + +class single; + +class check_constructible { + // This makes it a non-aggregate in C++20+. + check_constructible() = default; zyn0217 w

[clang] [Clang] Fix the access checking for non-aggregates in default arguments (PR #141207)

2025-05-23 Thread Younan Zhang via cfe-commits
zyn0217 wrote: > Does this fixes #62444 ? Yes 😎 https://github.com/llvm/llvm-project/pull/141207 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Fix the access checking for non-aggregates in default arguments (PR #141207)

2025-05-23 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/141207 >From c63f3f82d6e4c576051532b2272abf4ac0055d7f Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Fri, 23 May 2025 15:29:49 +0800 Subject: [PATCH 1/2] [Clang] Fix the access checking for non-aggregates in defaul

[clang] [Clang] Fix the access checking for non-aggregates in default arguments (PR #141207)

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

[clang] [Clang] Fix an out of bound access in -verify comment parsing (PR #141940)

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

[clang] [clang] Serialization: support hashing null template arguments (PR #141890)

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

[clang] [Sema] Fixed type missmach error when 'builtin-elementwise-math' arguments have different qualifiers, this should be a well-formed. (PR #141485)

2025-05-28 Thread Younan Zhang via cfe-commits
zyn0217 wrote: @QiYueFeiXue I don't think @shafik means to directly copy his words to the PR body/title. Please at least flesh out these dotted parts and make the sentences complete, thanks. https://github.com/llvm/llvm-project/pull/141485 ___ cfe-co

[clang] [clang] Serialization: support hashing null template arguments (PR #141890)

2025-05-28 Thread Younan Zhang via cfe-commits
zyn0217 wrote: /cherry-pick 61314076f https://github.com/llvm/llvm-project/pull/141890 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Sema] Fix type mismatch error when arguments to elementwise math builtin have different qualifiers, which should be well-formed (PR #141485)

2025-05-29 Thread Younan Zhang via cfe-commits
@@ -669,6 +669,7 @@ Bug Fixes in This Version base classes. (GH139452) - Fixed an assertion failure in serialization of constexpr structs containing unions. (#GH140130) - Fixed duplicate entries in TableGen that caused the wrong attribute to be selected. (GH#140701) +- Fixe

[clang] [Sema] Fix type mismatch error when arguments to elementwise math builtin have different qualifiers, which should be well-formed (PR #141485)

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

[clang] [clang][AST] Reduce some AST node size. (PR #142585)

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

[clang] [Clang] Improve infrastructure for libstdc++ workarounds (Reland) (PR #142592)

2025-06-03 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 approved this pull request. I hope it helps! https://github.com/llvm/llvm-project/pull/142592 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] Revert "[clangd] [Modules] Fixes to correctly handle module dependencies" (PR #142162)

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

[clang] [Clang] Fix name lookup of conversion operators (PR #142945)

2025-06-05 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 created https://github.com/llvm/llvm-project/pull/142945 (TODO: Add explanation) Fixes https://github.com/llvm/llvm-project/issues/28181 Fixes https://github.com/llvm/llvm-project/issues/94052 >From cdd6868879abf4b6c991c7f2b3e9cf9673b0570a Mon Sep 17 00:00:00 2001 Fr

[clang] Reapply "[Clang] Profile singly-resolved UnresolvedLookupExpr with the declaration" (PR #140680)

2025-06-18 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 closed https://github.com/llvm/llvm-project/pull/140680 ___ 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-06-24 Thread Younan Zhang via cfe-commits
zyn0217 wrote: @maryammo I managed to reduce it to https://godbolt.org/z/vjcoq1qaG .. will look into it tomorrow https://github.com/llvm/llvm-project/pull/122423 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/m

[clang] [Clang] Back out the source location workaround for CXXConstructExpr (PR #145260)

2025-06-22 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 created https://github.com/llvm/llvm-project/pull/145260 This removes the workaround introduced in 3e1a9cf3b8 and 1ba7dc38d. The issues should have been already resolved elsewhere, at least removing these lines doesn't break any existing tests. The workaround overwr

[clang] [Clang] Back out the source location workaround for CXXConstructExpr (PR #145260)

2025-06-23 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/145260 >From 96f1c3bbbf7c07bf9d11bb907e3a35e196d181aa Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Mon, 23 Jun 2025 12:31:39 +0800 Subject: [PATCH] [Clang] Back out the source location workaround for CXXConstruct

<    15   16   17   18   19   20   21   >