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

2024-11-11 Thread Matheus Izvekov 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] Fix name lookup for dependent bases (PR #114978)

2024-11-08 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov approved this pull request. LGTM, but give some time for @sdkrystian to take a look, since he is actively working on this area. https://github.com/llvm/llvm-project/pull/114978 ___ cfe-commits mailing list cfe-commits@lists

[clang] [clang] Use canonical type for substitution which might be incomplete (PR #109065)

2024-09-18 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov closed https://github.com/llvm/llvm-project/pull/109065 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] check deduction consistency when partial ordering function templates (PR #100692)

2024-09-17 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: Regarding test case 2, that further reduces to: ```C++ template class Q {}; template void F(Q); template void F(Q) = delete; void test() { F(Q()); } ``` The problem is that we consider the parenthesized expression significant in terms of forming a distinct type. You can s

[clang] [clang] check deduction consistency when partial ordering function templates (PR #100692)

2024-09-18 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: > Wow, I would never have thought it was a problem. Making these the same type > removes the compilation error. Can you explain why this is a problem from the > C++ standard PoV? That's https://eel.is/c++draft/temp.deduct.type#20 In deduced contexts for an NTTP, the type of th

[clang] [clang] check deduction consistency when partial ordering function templates (PR #100692)

2024-09-18 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: It's one thing that we might tweak the rules to account for redundant parenthesis. But the more complete example shows there is no way to order these unrelated things. Note that we hadn't so far implemented these rules for partial ordering of function templates, but the same i

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

2024-09-25 Thread Matheus Izvekov via cfe-commits
@@ -7326,11 +7326,13 @@ void ItaniumMangleContextImpl::mangleCXXCtorVTable(const CXXRecordDecl *RD, raw_ostream &Out) { // ::= TC _ CXXNameMangler Mangler(*this, Out); + QualType RDType = getASTContext().getRecordType

[clang] [clang] fix assert in ADL finding entity in the implicit global module (PR #109882)

2024-09-24 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov updated https://github.com/llvm/llvm-project/pull/109882 >From b1a659af4fccba0f7511ab52f0932d5a32958eb7 Mon Sep 17 00:00:00 2001 From: Matheus Izvekov Date: Tue, 24 Sep 2024 20:02:05 -0300 Subject: [PATCH 1/2] [clang] fix assert in ADL finding entity in the implicit

[clang] [clang] fix assert in ADL finding entity in the implicit global module (PR #109882)

2024-09-24 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov closed https://github.com/llvm/llvm-project/pull/109882 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] fix assert in ADL finding entity in the implicit global module (PR #109882)

2024-09-24 Thread Matheus Izvekov via cfe-commits
@@ -115,7 +115,7 @@ C++ Language Changes - Allow single element access of GCC vector/ext_vector_type object to be constant expression. Supports the `V.xyzw` syntax and other tidbits as seen in OpenCL. Selecting multiple elements is left as a future work. -- Implement `CWG18

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

2024-09-24 Thread Matheus Izvekov 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] fix assert in ADL finding entity in the implicit global module (PR #109882)

2024-09-24 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov created https://github.com/llvm/llvm-project/pull/109882 This adds to the assert the implicit global module case as in module purview. Fixes #109879 >From b1a659af4fccba0f7511ab52f0932d5a32958eb7 Mon Sep 17 00:00:00 2001 From: Matheus Izvekov Date: Tue, 24 Sep 2024

[clang] [Clang][Sema] Refactor collection of multi-level template argument lists (PR #106585)

2024-09-24 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: Yep, I agree that the reduction indicates the original code was IFNDR. We need a new reduction with no rename in order to locate this on QT code base and know for sure. https://github.com/llvm/llvm-project/pull/106585 ___ cfe-commits

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

2024-09-26 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov approved this pull request. LGTM, Thanks! Can you also add a release note, mentioning the potential ABI breaking change? Please wait 24h before merging in case the other reviewers want to chime in. https://github.com/llvm/llvm-project/pull/109970 ___

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

2024-09-28 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: Same then, go ahead, but please make sure the error handling strategies don't diverge unnecessarily. https://github.com/llvm/llvm-project/pull/109831 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bi

[clang] [clang] Redeclare function templates instances per primary template (PR #110387)

2024-09-28 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov created https://github.com/llvm/llvm-project/pull/110387 This fixes handling of friend function templates instances when their template context changes, such as when a new friend declaration is introduced after an instance was already created from a previous declara

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-09-27 Thread Matheus Izvekov via cfe-commits
@@ -944,12 +950,72 @@ getRHSTemplateDeclAndArgs(Sema &SemaRef, TypeAliasTemplateDecl *AliasTemplate) { return {Template, AliasRhsTemplateArgs}; } +struct InheritedConstructorDeductionInfo { + // Class template for which we are declaring deduction guides + // This is `C` i

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-09-27 Thread Matheus Izvekov via cfe-commits
@@ -11723,6 +11764,40 @@ static void DiagnoseBadDeduction(Sema &S, NamedDecl *Found, Decl *Templated, return; } +// Errors in deduction guides from inherited constructors +// will present as substitution failures in the mapping +// partial specialization

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-09-27 Thread Matheus Izvekov via cfe-commits
@@ -2211,17 +2211,20 @@ CXXDeductionGuideDecl *CXXDeductionGuideDecl::Create( ASTContext &C, DeclContext *DC, SourceLocation StartLoc, ExplicitSpecifier ES, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, SourceLocation EndLocation, CXXConstr

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-09-27 Thread Matheus Izvekov via cfe-commits
@@ -10581,6 +10581,47 @@ bool clang::isBetterOverloadCandidate( auto *Guide1 = dyn_cast_or_null(Cand1.Function); auto *Guide2 = dyn_cast_or_null(Cand2.Function); if (Guide1 && Guide2) { + // -- F1 and F2 are generated from class template argument deduction +

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-09-27 Thread Matheus Izvekov via cfe-commits
@@ -1186,17 +1281,34 @@ void DeclareImplicitDeductionGuidesForTypeAlias( NewParam->setScopeInfo(0, I); FPTL.setParam(I, NewParam); } - auto *Transformed = cast(buildDeductionGuide( - SemaRef, AliasTemplate, /*TemplateParams=*/nullptr, + +

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-09-27 Thread Matheus Izvekov via cfe-commits
@@ -11723,6 +11764,40 @@ static void DiagnoseBadDeduction(Sema &S, NamedDecl *Found, Decl *Templated, return; } +// Errors in deduction guides from inherited constructors +// will present as substitution failures in the mapping +// partial specialization

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-09-27 Thread Matheus Izvekov via cfe-commits
@@ -2007,6 +2022,21 @@ class CXXDeductionGuideDecl : public FunctionDecl { /// this is an implicit deduction guide. CXXConstructorDecl *getCorrespondingConstructor() const { return Ctor; } + /// Get the deduction guide from which this deduction guide was generated, + ///

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

2024-09-27 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: > I'm wondering what level of granularity we should aim for when reusing the > current implementation in `GetTypeForDeclarator`? You can perhaps extract just the parts that are common between both use cases into a separate function, or another possible approach would be to reus

[clang] [clang] Improve deduction of reference typed NTTP (PR #110393)

2024-09-28 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov created https://github.com/llvm/llvm-project/pull/110393 This improves the existing workaround for a core issue introduced in CWG1770. When performing template argument deduction for an NNTP which the parameter side is a reference, instead of dropping the references

[clang] [clang] Finish implementation of P0522 (PR #96023)

2024-09-28 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: ping https://github.com/llvm/llvm-project/pull/96023 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Redeclare function templates instances per primary template (PR #110387)

2024-09-28 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov updated https://github.com/llvm/llvm-project/pull/110387 >From ee9ef305403cbcdf004e9777feab44689bf579a4 Mon Sep 17 00:00:00 2001 From: Matheus Izvekov Date: Sat, 28 Sep 2024 14:28:58 -0300 Subject: [PATCH] [clang] Redeclare function templates instances per primary t

[clang] [clang] Improve deduction of reference typed NTTP (PR #110393)

2024-09-28 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov updated https://github.com/llvm/llvm-project/pull/110393 >From a06cdbc7a2d010a3f3081b7eb53326aeb7a702b1 Mon Sep 17 00:00:00 2001 From: Matheus Izvekov Date: Sat, 28 Sep 2024 21:40:54 -0300 Subject: [PATCH] [clang] Improve deduction of reference typed NTTP This impro

[clang] [ItaniumMangle] Add substitutions for record types when mangling vtables (PR #109970)

2024-09-28 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov 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] [clang] Improve deduction of reference typed NTTP (PR #110393)

2024-09-28 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov edited https://github.com/llvm/llvm-project/pull/110393 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Redeclare function templates instances per primary template (PR #110387)

2024-09-30 Thread Matheus Izvekov via cfe-commits
@@ -3949,28 +3949,15 @@ TemplateDeductionResult Sema::FinishTemplateArgumentDeduction( TemplateArgumentList::CreateCopy(Context, CanonicalBuilder); Info.reset(SugaredDeducedArgumentList, CanonicalDeducedArgumentList); + FunctionTemplate = FunctionTemplate->getMostRec

[clang] [clang] Finish implementation of P0522 (PR #96023)

2024-10-01 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov updated https://github.com/llvm/llvm-project/pull/96023 >From b29e3d3285a414df74a75404c6fe4a39f4a0725d Mon Sep 17 00:00:00 2001 From: Matheus Izvekov Date: Mon, 17 Jun 2024 21:39:08 -0300 Subject: [PATCH 1/2] [clang] Finish implementation of P0522 This finishes the

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

2024-09-30 Thread Matheus Izvekov 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 Matheus Izvekov 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] Redeclare function templates instances per primary template (PR #110387)

2024-09-30 Thread Matheus Izvekov via cfe-commits
@@ -2146,9 +2147,15 @@ Decl *TemplateDeclInstantiator::VisitFunctionDecl( FunctionDecl *SpecFunc = FunctionTemplate->findSpecialization(Innermost, InsertPos); -// If we already have a function template specialization, return it. -if (SpecFunc) - return S

[clang] [clang-tools-extra] [llvm] [Clang] Add __builtin_type_pack_dedup template to deduplicate types in template arguments (PR #106730)

2024-09-18 Thread Matheus Izvekov via cfe-commits
@@ -3158,6 +3161,33 @@ checkBuiltinTemplateIdType(Sema &SemaRef, BuiltinTemplateDecl *BTD, int64_t N = Index.getExtValue(); return Ts.getPackAsArray()[N].getAsType(); } + case BTK__type_pack_dedup: { +assert(Converted.size() == 2 && "__builtin_type_pack_dedup sh

[clang] [clang-tools-extra] [llvm] [Clang] Add __builtin_type_pack_dedup template to deduplicate types in template arguments (PR #106730)

2024-09-18 Thread Matheus Izvekov via cfe-commits
@@ -309,7 +309,10 @@ enum BuiltinTemplateKind : int { BTK__make_integer_seq, /// This names the __type_pack_element BuiltinTemplateDecl. - BTK__type_pack_element + BTK__type_pack_element, + + /// This names the __type_list_dedup BuiltinTemplateDecl. + BTK__type_list_de

[clang] [clang] check deduction consistency when partial ordering function templates (PR #100692)

2024-09-18 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: @alexfh Your third test case reduces to: ```C++ template struct InlinedVector {}; template void PackArgsHelper(InlinedVector, unsigned char); template void PackArgsHelper(InlinedVector packed_args, T0, TRest... args_rest) { PackArgsHelper(packed_args, a

[clang] [clang] implement current direction of CWG2765 for string literal comparisons in constant evaluation (PR #109208)

2024-09-18 Thread Matheus Izvekov via cfe-commits
@@ -1306,3 +1306,18 @@ constexpr int field(int a) { static_assert(field(3), ""); // expected-error {{constant expression}} \ // expected-note {{in call to 'field(3)'}} } + +namespace literal_comparison { + +constexpr bool different_in_loop(bool b =

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

2024-09-25 Thread Matheus Izvekov via cfe-commits
@@ -7326,11 +7326,13 @@ void ItaniumMangleContextImpl::mangleCXXCtorVTable(const CXXRecordDecl *RD, raw_ostream &Out) { // ::= TC _ CXXNameMangler Mangler(*this, Out); + QualType RDType = getASTContext().getRecordType

[clang] [clang] Improve deduction of reference typed NTTP (PR #110393)

2024-10-01 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov closed https://github.com/llvm/llvm-project/pull/110393 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Finish implementation of P0522 (PR #96023)

2024-10-01 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov closed https://github.com/llvm/llvm-project/pull/96023 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [clang] CWG2398: improve overload resolution backwards compat (PR #107350)

2024-10-01 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov edited https://github.com/llvm/llvm-project/pull/107350 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Improve deduction of reference typed NTTP (PR #110393)

2024-10-01 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov updated https://github.com/llvm/llvm-project/pull/110393 >From a06cdbc7a2d010a3f3081b7eb53326aeb7a702b1 Mon Sep 17 00:00:00 2001 From: Matheus Izvekov Date: Sat, 28 Sep 2024 21:40:54 -0300 Subject: [PATCH] [clang] Improve deduction of reference typed NTTP This impro

[clang] [libcxx] [clang] Handle template argument conversions for non-pack param to pack argument (PR #110963)

2024-10-03 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov updated https://github.com/llvm/llvm-project/pull/110963 >From e98e024104501f61e589deaeee13553d67e2a64e Mon Sep 17 00:00:00 2001 From: Matheus Izvekov Date: Thu, 3 Oct 2024 01:14:52 -0300 Subject: [PATCH] [clang] Handle template argument conversions for non-pack par

[clang] [clang] Handle template argument conversions for non-pack param to pack argument (PR #110963)

2024-10-02 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov created https://github.com/llvm/llvm-project/pull/110963 This fixes a regression introduced in #96023, reported in https://github.com/llvm/llvm-project/issues/110231#issuecomment-2389131854 >From b37fd6faea430d77ff97568259a3792a3534b481 Mon Sep 17 00:00:00 2001 From

[clang] [libcxx] [clang] Handle template argument conversions for non-pack param to pack argument (PR #110963)

2024-10-03 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov closed https://github.com/llvm/llvm-project/pull/110963 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [llvm] [Clang] Add __builtin_type_pack_dedup template to deduplicate types in template arguments (PR #106730)

2024-09-17 Thread Matheus Izvekov via cfe-commits
@@ -309,7 +309,10 @@ enum BuiltinTemplateKind : int { BTK__make_integer_seq, /// This names the __type_pack_element BuiltinTemplateDecl. - BTK__type_pack_element + BTK__type_pack_element, + + /// This names the __type_list_dedup BuiltinTemplateDecl. + BTK__type_list_de

[clang] [clang-tools-extra] [llvm] [Clang] Add __builtin_type_pack_dedup template to deduplicate types in template arguments (PR #106730)

2024-09-17 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov 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] [llvm] [Clang] Add __builtin_type_pack_dedup template to deduplicate types in template arguments (PR #106730)

2024-09-17 Thread Matheus Izvekov via cfe-commits
@@ -3158,6 +3161,33 @@ checkBuiltinTemplateIdType(Sema &SemaRef, BuiltinTemplateDecl *BTD, int64_t N = Index.getExtValue(); return Ts.getPackAsArray()[N].getAsType(); } + case BTK__type_pack_dedup: { +assert(Converted.size() == 2 && "__builtin_type_pack_dedup sh

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

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

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

2024-11-06 Thread Matheus Izvekov via cfe-commits
@@ -4694,6 +4694,15 @@ bool Sema::InstantiateDefaultArgument(SourceLocation CallLoc, FunctionDecl *FD, ParmVarDecl *Param) { assert(Param->hasUninstantiatedDefaultArg()); + // C++ [dcl.fct.default]p4 + // If a friend declaration D s

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

2024-11-06 Thread Matheus Izvekov via cfe-commits
@@ -4694,6 +4694,15 @@ bool Sema::InstantiateDefaultArgument(SourceLocation CallLoc, FunctionDecl *FD, ParmVarDecl *Param) { assert(Param->hasUninstantiatedDefaultArg()); + // C++ [dcl.fct.default]p4 + // If a friend declaration D s

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

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

[clang] [Clang] Fix name lookup for dependent bases (PR #114978)

2024-11-06 Thread Matheus Izvekov via cfe-commits
@@ -265,8 +268,8 @@ bool CXXBasePaths::lookupInBases(ASTContext &Context, BaseRecord = nullptr; } } else { -BaseRecord = cast( -BaseSpec.getType()->castAs()->getDecl()); +if (auto *RT = BaseSpec.getType()->getAs()) +

[clang] [Clang] Fix name lookup for dependent bases (PR #114978)

2024-11-06 Thread Matheus Izvekov via cfe-commits
@@ -169,14 +169,18 @@ bool CXXBasePaths::lookupInBases(ASTContext &Context, // Find the record of the base class subobjects for this type. QualType BaseType = Context.getCanonicalType(BaseSpec.getType()).getUnqualifiedType(); +bool isCurrentInstantiation = f

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

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

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

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

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

2024-11-07 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov approved this pull request. LGTM, Thanks! https://github.com/llvm/llvm-project/pull/115120 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-11-07 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov edited https://github.com/llvm/llvm-project/pull/113777 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

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

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

2024-11-07 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov edited https://github.com/llvm/llvm-project/pull/115120 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-11-07 Thread Matheus Izvekov via cfe-commits
@@ -3149,9 +3156,15 @@ struct ExpandPackedTypeConstraints assert(SemaRef.ArgumentPackSubstitutionIndex != -1); +TemplateArgument Arg = TemplateArgs(T->getDepth(), T->getIndex()); + +std::optional PackIndex; +if (Arg.getKind() == TemplateArgument::Pack) +

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

2024-11-07 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: @zyn0217 meant the PR description, which is the body of the commit, not the title. I already fixed it for you. https://github.com/llvm/llvm-project/pull/113777 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.

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

2024-11-07 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov closed https://github.com/llvm/llvm-project/pull/113777 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

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

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

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

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-11-06 Thread Matheus Izvekov via cfe-commits
@@ -931,12 +935,73 @@ getRHSTemplateDeclAndArgs(Sema &SemaRef, TypeAliasTemplateDecl *AliasTemplate) { return {Template, AliasRhsTemplateArgs}; } +struct InheritedConstructorDeductionInfo { + // Class template for which we are declaring deduction guides + // This is `C` i

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-11-06 Thread Matheus Izvekov via cfe-commits
@@ -931,12 +935,73 @@ getRHSTemplateDeclAndArgs(Sema &SemaRef, TypeAliasTemplateDecl *AliasTemplate) { return {Template, AliasRhsTemplateArgs}; } +struct InheritedConstructorDeductionInfo { + // Class template for which we are declaring deduction guides + // This is `C` i

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-11-06 Thread Matheus Izvekov via cfe-commits
@@ -1173,25 +1276,52 @@ void DeclareImplicitDeductionGuidesForTypeAlias( NewParam->setScopeInfo(0, I); FPTL.setParam(I, NewParam); } - auto *Transformed = cast(buildDeductionGuide( - SemaRef, AliasTemplate, /*TemplateParams=*/nullptr, + +

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

2024-11-06 Thread Matheus Izvekov via cfe-commits
@@ -6018,6 +6018,13 @@ bool Sema::GatherArgumentsForCall(SourceLocation CallLoc, FunctionDecl *FDecl, } else { assert(Param && "can't use default arguments without a known callee"); + // C++ [dcl.fct.default]p4 + // If a friend declaration D specifies a

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

2024-11-06 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov edited https://github.com/llvm/llvm-project/pull/113777 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-11-06 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov approved this pull request. LGTM except for a couple of nits. Thanks! https://github.com/llvm/llvm-project/pull/113777 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/

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

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

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

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

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

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

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

2024-11-07 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: Reverted. The issue looks like the instantiation of the default argument was skipped, but without any previous error actually being produced, so it proceeded to CodeGen with invalid AST. https://github.com/llvm/llvm-project/pull/113777 __

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

2024-11-07 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov created https://github.com/llvm/llvm-project/pull/115404 Reverts llvm/llvm-project#113777 Reverted due to regression reported here: https://github.com/llvm/llvm-project/pull/113777#issuecomment-2463465741 >From c702e6179cdde1460f33a300b78708f232f146e3 Mon Sep 17 00

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

2024-11-07 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov closed https://github.com/llvm/llvm-project/pull/115404 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Serialization] Downgrade error to warning for inconsistent language flags (PR #117840)

2024-11-28 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: I think this is too risky to become the default. We could map out what are the most user affecting compat issues here, and start from there, without opening the floodgates all at once. https://github.com/llvm/llvm-project/pull/117840

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

2024-11-28 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov approved this pull request. Yeah, this LGTM, thanks again. https://github.com/llvm/llvm-project/pull/115487 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Fix name lookup for dependent bases (PR #114978)

2024-11-15 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: Please wait for a week before pinging someone again. I think this is fine to merge as is, if you want to go ahead. We can always do post commit review later. https://github.com/llvm/llvm-project/pull/114978 ___ cfe-commits mailing lis

[clang] [clang] check deduction consistency when partial ordering function templates (PR #100692)

2024-09-17 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: > Now I think these should cover all remaining issues we see after this commit > (and up to the current ToT): > > > > * Test case 1: https://gcc.godbolt.org/z/zMG5nsda3 > > * Test case 2: https://gcc.godbolt.org/z/YbTKzao7d > > * Test case 3: https://gcc.godbolt.org/z/89Yn3d

[clang] [clang-tools-extra] [llvm] Remove clang-rename (PR #108988)

2024-09-17 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: AFAIK the bazel build scripts are externally automatically updated based on the cmake scripts, so I don't think we should be touching them. https://github.com/llvm/llvm-project/pull/108988 ___ cfe-commits mailing list cfe-commits@lists

[clang] [clang] Use canonical type for substitution which might be incomplete (PR #109065)

2024-09-17 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov created https://github.com/llvm/llvm-project/pull/109065 When checking deduction consistency, a substitution can be incomplete such that only sugar parts refer to non-deduced template parameters. This would not otherwise lead to an inconsistent deduction, so this pa

[clang] [clang] check deduction consistency when partial ordering function templates (PR #100692)

2024-09-17 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: @alexfh https://github.com/llvm/llvm-project/pull/109065 Fixes test case 1. https://github.com/llvm/llvm-project/pull/100692 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-com

[clang] [clang-tools-extra] [llvm] [Clang] Add __builtin_type_pack_dedup template to deduplicate types in template arguments (PR #106730)

2024-09-17 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov commented: Thanks for working on this problem! I think the current approach is limited in ABI stability, we could broaden the usability here by designing this builtin so it produces a type list which is unique per set of types (order independent). I had a chat with

[clang] [clang-tools-extra] [llvm] [Clang] Add __builtin_type_pack_dedup template to deduplicate types in template arguments (PR #106730)

2024-09-17 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov 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] [Sema] Preserve nested name specifier prefix in MemberPointerType (PR #118236)

2024-12-01 Thread Matheus Izvekov via cfe-commits
@@ -5347,15 +5347,18 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state, case NestedNameSpecifier::TypeSpec: case NestedNameSpecifier::TypeSpecWithTemplate: - ClsType = QualType(NNS->getAsType(), 0); - // Note: if t

[clang] [clang-tools-extra] [clang] [Sema] Preserve nested name specifier prefix in MemberPointerType (PR #118236)

2024-12-01 Thread Matheus Izvekov via cfe-commits
@@ -5347,13 +5347,16 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state, case NestedNameSpecifier::TypeSpec: case NestedNameSpecifier::TypeSpecWithTemplate: - ClsType = QualType(NNS->getAsType(), 0); + const Type *N

[clang] [clang-tools-extra] [clang] [Sema] Preserve nested name specifier prefix in MemberPointerType (PR #118236)

2024-12-01 Thread Matheus Izvekov via cfe-commits
@@ -5347,13 +5347,16 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state, case NestedNameSpecifier::TypeSpec: case NestedNameSpecifier::TypeSpecWithTemplate: - ClsType = QualType(NNS->getAsType(), 0); + const Type *N

[clang] Revert "Reland: [clang][test] add testing for the AST matcher reference" (PR #116477)

2024-11-15 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: Can you please describe the reason the patch was reverted? It's better to put this information in the commit message. https://github.com/llvm/llvm-project/pull/116477 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://list

[clang] [clang-tools-extra] [clang] [Sema] Preserve nested name specifier prefix in MemberPointerType (PR #118236)

2024-12-01 Thread Matheus Izvekov via cfe-commits
@@ -5347,15 +5347,18 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state, case NestedNameSpecifier::TypeSpec: case NestedNameSpecifier::TypeSpecWithTemplate: - ClsType = QualType(NNS->getAsType(), 0); - // Note: if t

[clang] [clang-tools-extra] [clang] [Sema] Preserve nested name specifier prefix in MemberPointerType (PR #118236)

2024-12-01 Thread Matheus Izvekov via cfe-commits
@@ -5347,13 +5347,16 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state, case NestedNameSpecifier::TypeSpec: case NestedNameSpecifier::TypeSpecWithTemplate: - ClsType = QualType(NNS->getAsType(), 0); + const Type *N

[clang] [Clang] Enable -fpointer-tbaa by default. (PR #117244)

2024-12-04 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov commented: I think this is a strict improvement over the general 'fstrict-aliasing' mode we already have, and I see little value in maintaining separate levels of strict aliasing conformance long term. I think it would not be a good situation for users to rely on so

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

2025-01-07 Thread Matheus Izvekov via cfe-commits
Alejandro =?utf-8?q?Álvarez_Ayllón?=, Alejandro =?utf-8?q?Álvarez_Ayllón?Message-ID: In-Reply-To: @@ -1228,35 +1228,45 @@ bool Sema::AttachTypeConstraint(AutoTypeLoc TL, NonTypeTemplateParmDecl *NewConstrainedParm,

[clang] [Clang] Added nullptr check to getFriendDecl access (PR #121056)

2025-01-07 Thread Matheus Izvekov via cfe-commits
@@ -886,6 +886,7 @@ Bug Fixes to C++ Support out of a module (which is the case e.g. in MSVC's implementation of ``std`` module). (#GH118218) - Fixed a pack expansion issue in checking unexpanded parameter sizes. (#GH17042) - Fixed a bug where captured structured bindings w

[clang] [Clang] Added nullptr check to getFriendDecl access (PR #121056)

2025-01-07 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov edited https://github.com/llvm/llvm-project/pull/121056 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Added nullptr check to getFriendDecl access (PR #121056)

2025-01-07 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov commented: We also usually attach the issue number to the test case somehow, either put the new test cases under a namespace named `GH120857`, or rename the new test file to that same name. https://github.com/llvm/llvm-project/pull/121056 ___

[clang] [C++20] [Modules] [Serialization] Delay marking pending incomplete decl chains until the end of `finishPendingActions`. (PR #121245)

2025-01-07 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: Can you reduce your modules test case into a self contained project with build system? If so, you can use [cvise](https://github.com/marxin/cvise) for reducing a whole project directory recursively in one invocation. https://github.com/llvm/llvm-project/pull/121245 ___

<    5   6   7   8   9   10   11   12   13   14   >