[clang] [clang][ASTImporter] New fix for default template parameter values. (PR #101836)

2024-08-19 Thread Matheus Izvekov via cfe-commits
=?utf-8?q?Balázs_Kéri?= Message-ID: In-Reply-To: @@ -5968,11 +5962,21 @@ ASTNodeImporter::VisitTemplateTypeParmDecl(TemplateTypeParmDecl *D) { } if (D->hasDefaultArgument()) { +// Default argument can be "inherited" when it has a reference to the +// previous d

[clang] [clang-tools-extra] [clang][NFC] Un-constify `MultiLevelTemplateArgumentList` (PR #104687)

2024-08-19 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: Yes, I think it's ok having the template instantiator own these lists, but only copy them when needed. Note I have a WIP patch that will eventually touch this area and this may force me to seek a solution here. Basically TemplateArgument lists will need to get the AST node uni

[clang] [clang][ASTImporter] New fix for default template parameter values. (PR #101836)

2024-08-22 Thread Matheus Izvekov via cfe-commits
=?utf-8?q?Balázs_Kéri?= Message-ID: In-Reply-To: @@ -5968,11 +5962,21 @@ ASTNodeImporter::VisitTemplateTypeParmDecl(TemplateTypeParmDecl *D) { } if (D->hasDefaultArgument()) { +// Default argument can be "inherited" when it has a reference to the +// previous d

[clang] [clang][ASTImporter] New fix for default template parameter values. (PR #101836)

2024-08-22 Thread Matheus Izvekov via cfe-commits
=?utf-8?q?Balázs_Kéri?= Message-ID: In-Reply-To: https://github.com/mizvekov edited https://github.com/llvm/llvm-project/pull/101836 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][ASTImporter] New fix for default template parameter values. (PR #101836)

2024-08-23 Thread Matheus Izvekov via cfe-commits
=?utf-8?q?Balázs_Kéri?= Message-ID: In-Reply-To: @@ -5968,11 +5962,21 @@ ASTNodeImporter::VisitTemplateTypeParmDecl(TemplateTypeParmDecl *D) { } if (D->hasDefaultArgument()) { +// Default argument can be "inherited" when it has a reference to the +// previous d

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

2024-08-23 Thread Matheus Izvekov via cfe-commits
@@ -5346,7 +5346,6 @@ static EvalStmtResult EvaluateStmt(StmtResult &Result, EvalInfo &Info, const Expr *RetExpr = cast(S)->getRetValue(); FullExpressionRAII Scope(Info); if (RetExpr && RetExpr->isValueDependent()) { - EvaluateDependentExpr(RetExpr, Info); ---

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

2024-08-23 Thread Matheus Izvekov via cfe-commits
@@ -5554,38 +5869,50 @@ FunctionTemplateDecl *Sema::getMoreSpecializedTemplate( // "that is a member function with no expicit object argument". // Otherwise the ordering rules for methods with expicit objet arguments // against anything else make no sense. -Shou

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

2024-08-23 Thread Matheus Izvekov via cfe-commits
@@ -1343,6 +1343,9 @@ namespace { DeclarationName Entity; // Whether to evaluate the C++20 constraints or simply substitute into them. bool EvaluateConstraints = true; +// Whether Substitution was Incomplete, that is, we tried to substitute in +// any templ

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

2024-08-23 Thread Matheus Izvekov via cfe-commits
@@ -5395,11 +5520,100 @@ static QualType GetImplicitObjectParameterType(ASTContext &Context, return Context.getLValueReferenceType(RawType); } +static TemplateDeductionResult CheckDeductionConsistency( +Sema &S, FunctionTemplateDecl *FTD, int ArgIdx, QualType P, QualTyp

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

2024-08-23 Thread Matheus Izvekov via cfe-commits
@@ -5421,34 +5635,139 @@ static bool isAtLeastAsSpecializedAs(Sema &S, SourceLocation Loc, // the partial ordering is done: TemplateDeductionInfo Info(Loc); switch (TPOC) { - case TPOC_Call: -if (DeduceTemplateArguments(S, TemplateParams, Args2.data(), Args2.size(

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

2024-08-23 Thread Matheus Izvekov via cfe-commits
@@ -5421,34 +5635,139 @@ static bool isAtLeastAsSpecializedAs(Sema &S, SourceLocation Loc, // the partial ordering is done: TemplateDeductionInfo Info(Loc); switch (TPOC) { - case TPOC_Call: -if (DeduceTemplateArguments(S, TemplateParams, Args2.data(), Args2.size(

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

2024-08-23 Thread Matheus Izvekov via cfe-commits
@@ -859,8 +861,10 @@ class PackDeductionScope { // by this pack expansion, then clear out the deduction. DeducedFromEarlierParameter = !Deduced[Index].isNull(); DeducedPack Pack(Index); -Pack.Saved = Deduced[Index]; -Deduced[Index] = TemplateArgument(); +

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

2024-08-23 Thread Matheus Izvekov via cfe-commits
@@ -1307,6 +1304,62 @@ DeduceTemplateArguments(Sema &S, TemplateParameterList *TemplateParams, return TemplateDeductionResult::Success; } +/// Deduce the template arguments by comparing the list of parameter +/// types to the list of argument types, as in the parameter-type

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

2024-08-23 Thread Matheus Izvekov via cfe-commits
@@ -0,0 +1,32 @@ +// RUN: %clang_cc1 -std=c++23 -verify %s + +namespace t1 { +template struct enable_if { typedef void type; }; +template class Foo {}; +template constexpr bool check() { return true; } +template struct Bar {}; + +template void func(Bar()>::type>) {} +// expecte

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

2024-08-23 Thread Matheus Izvekov via cfe-commits
@@ -5399,11 +5434,85 @@ static QualType GetImplicitObjectParameterType(ASTContext &Context, return Context.getLValueReferenceType(RawType); } +static TemplateDeductionResult FinishTemplateArgumentDeduction( +Sema &S, FunctionTemplateDecl *FTD, int ArgIdx, QualType P, Qu

[clang] [clang-tools-extra] [clang][NFC] Un-constify `MultiLevelTemplateArgumentList` (PR #104687)

2024-08-23 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: I not opposed to exploring a solution now. I suspect there might be a nicer solution that doesn't involve copies, I just have other priorities right now and it will take me a while until I can sit down and think about this. But if you want to think about the problem and find a

[clang] [Clang][Concepts] Fix the constraint equivalence checking involving parameter packs (PR #102131)

2024-08-23 Thread Matheus Izvekov via cfe-commits
@@ -972,8 +972,15 @@ static const Expr *SubstituteConstraintExpressionWithoutSatisfaction( // equivalence. LocalInstantiationScope ScopeForParameters(S); if (auto *FD = DeclInfo.getDecl()->getAsFunction()) -for (auto *PVD : FD->parameters()) - ScopeForParameters

[clang] [Clang][Concepts] Fix the constraint equivalence checking involving parameter packs (PR #102131)

2024-08-23 Thread Matheus Izvekov via cfe-commits
@@ -972,8 +972,15 @@ static const Expr *SubstituteConstraintExpressionWithoutSatisfaction( // equivalence. LocalInstantiationScope ScopeForParameters(S); if (auto *FD = DeclInfo.getDecl()->getAsFunction()) -for (auto *PVD : FD->parameters()) - ScopeForParameters

[clang] [Clang][Concepts] Fix the constraint equivalence checking involving parameter packs (PR #102131)

2024-08-23 Thread Matheus Izvekov via cfe-commits
@@ -972,8 +972,15 @@ static const Expr *SubstituteConstraintExpressionWithoutSatisfaction( // equivalence. LocalInstantiationScope ScopeForParameters(S); if (auto *FD = DeclInfo.getDecl()->getAsFunction()) -for (auto *PVD : FD->parameters()) - ScopeForParameters

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

2024-08-24 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov updated https://github.com/llvm/llvm-project/pull/100692 >From f8fd471a954f5e304f3118df3236cf7ff4ef1020 Mon Sep 17 00:00:00 2001 From: Matheus Izvekov Date: Wed, 24 Jul 2024 03:59:41 -0300 Subject: [PATCH] [clang] check deduction consistency when partial ordering fu

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

2024-08-24 Thread Matheus Izvekov via cfe-commits
@@ -5554,38 +5869,50 @@ FunctionTemplateDecl *Sema::getMoreSpecializedTemplate( // "that is a member function with no expicit object argument". // Otherwise the ordering rules for methods with expicit objet arguments // against anything else make no sense. -Shou

[clang] [Clang][Sema] qualifier should be transformed (PR #94725)

2024-06-22 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: > @mizvekov After looking into the code, I think we should transform qualifier > in TST. Consider the following code: So the NNS is already dependent, that's great. I still don't understand why you are saying we didn't or can't build a DependentTemplateSpecializationType inste

[clang] [Clang][Sema] qualifier should be transformed (PR #94725)

2024-06-22 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: > I mean we can transform `QualifiedTemplateName` to `DependentTemplateName` > and this is what this patch does. But that goes against the natural flow of template instantiation. We can't go back from non-dependent into dependent. We can't transform a regular TemplateName back

[clang] [clang-tools-extra] [clang] Implement CWG2398 provisional TTP matching to class templates (PR #94981)

2024-09-12 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: Thanks for the repro! I am taking a look. https://github.com/llvm/llvm-project/pull/94981 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Implement transforms for DeducedTemplateName (PR #108491)

2024-09-12 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov created https://github.com/llvm/llvm-project/pull/108491 Fixes regression introduced in #94981, reported on the pull-request. Since this fixes a commit which was never released, there are no release notes. >From 2d79745e93cdda66cec9781efa7e10bce5544e8f Mon Sep 17 00

[clang] [clang-tools-extra] [clang] Implement CWG2398 provisional TTP matching to class templates (PR #94981)

2024-09-12 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: @alexfh Thanks, fixed in https://github.com/llvm/llvm-project/pull/108491 https://github.com/llvm/llvm-project/pull/94981 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commit

[clang] [clang] Implement transforms for DeducedTemplateName (PR #108491)

2024-09-15 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov updated https://github.com/llvm/llvm-project/pull/108491 >From d0863742db50da3ac9b4ea2ec12ba55001a7ce63 Mon Sep 17 00:00:00 2001 From: Matheus Izvekov Date: Fri, 13 Sep 2024 02:21:36 -0300 Subject: [PATCH] [clang] Fix incorrect partial ordering context setting Fixes

[clang] [clang] Fix incorrect partial ordering context setting (PR #108491)

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

[clang] [clang] Fix incorrect partial ordering context setting (PR #108491)

2024-09-15 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: @alexfh thanks, the latest push should fix it. https://github.com/llvm/llvm-project/pull/108491 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Fix incorrect partial ordering context setting (PR #108491)

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

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

2024-10-08 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: Yeah, I think its only user was reverted a while ago, but should be merged back eventually. https://github.com/llvm/llvm-project/pull/73 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman

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

2024-10-08 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov updated https://github.com/llvm/llvm-project/pull/110387 >From 28e582bc3b3058aa5ba946c9eb9b3d0e989b5c28 Mon Sep 17 00:00:00 2001 From: Matheus Izvekov Date: Sat, 28 Sep 2024 14:28:58 -0300 Subject: [PATCH] [clang] Track function template instantiation from definition

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

2024-10-08 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: Now this is rebased on top of the `getTemplateInstantiationArgs` refactoring. https://github.com/llvm/llvm-project/pull/110387 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-c

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

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

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

2024-10-08 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: FYI I just realized the Final parameter is not wired up to the Collecter. It appertains to the Innermost argument. https://github.com/llvm/llvm-project/pull/73 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.l

[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 approved this pull request. 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-tools-extra] [llvm] [clang] WIP: Improved Context Declaration tracking (PR #107942)

2024-10-15 Thread Matheus Izvekov via cfe-commits
@@ -17257,8 +17258,11 @@ void Sema::PushExpressionEvaluationContext( ExpressionEvaluationContext NewContext, ReuseLambdaContextDecl_t, ExpressionEvaluationContextRecord::ExpressionKind ExprContext) { - Decl *ClosureContextDecl = ExprEvalContexts.back().ManglingContextD

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

2024-10-09 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: FIY you should include revert reason on the commit message/ PR description. https://github.com/llvm/llvm-project/pull/111764 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-com

[clang] Reland: [clang] Finish implementation of P0522 (PR #111711)

2024-10-09 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: No difference at all. It's just that the PR which will take care of the problem is not small, so I want to keep them separate and merge them all in one go. https://github.com/llvm/llvm-project/pull/111711 ___ cfe-commits mailing list c

[clang] Reland: [clang] Finish implementation of P0522 (PR #111711)

2024-10-09 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov created https://github.com/llvm/llvm-project/pull/111711 This finishes the clang implementation of P0522, getting rid of the fallback to the old, pre-P0522 rules. Before this patch, when partial ordering template template parameters, we would perform, in order: * I

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

2024-10-09 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: FWIW https://github.com/llvm/llvm-project/commit/4336f00f2156970cc0af2816331387a0a4039317 does not really depend on this patch significantly, the same change more or less should work, you just need to adjust for the changes in the function signature. https://github.com/llvm/l

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

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

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

2024-10-07 Thread Matheus Izvekov via cfe-commits
@@ -4159,7 +4159,7 @@ FunctionTemplateDecl *FunctionDecl::getPrimaryTemplate() const { if (FunctionTemplateSpecializationInfo *Info = TemplateOrSpecialization .dyn_cast()) { -return Info->getTemplate(); +return Info->getTemplate()->getMostRecentDe

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

2024-10-07 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: This will be fixed by https://github.com/llvm/llvm-project/pull/111457 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][Sema] Fix exception specification comparison for functions with different template depths (PR #111561)

2024-10-08 Thread Matheus Izvekov via cfe-commits
@@ -501,6 +519,89 @@ bool Sema::CheckEquivalentExceptionSpec( return Result; } +static const Expr *SubstituteExceptionSpecWithoutEvaluation( +Sema &S, const Sema::TemplateCompareNewDeclInfo &DeclInfo, +const Expr *ExceptionSpec) { + MultiLevelTemplateArgumentList ML

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

2024-10-08 Thread Matheus Izvekov via cfe-commits
@@ -1008,6 +1008,15 @@ class FunctionTemplateDecl : public RedeclarableTemplateDecl { return getTemplatedDecl()->isThisDeclarationADefinition(); } + bool isCompatibleWithDefinition() const { +return getTemplatedDecl()->isInstantiatedFromMemberTemplate() || +

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

2024-10-05 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov updated https://github.com/llvm/llvm-project/pull/110387 >From e6d3e6f1df5db1618c7302adac4b45b7aa451a34 Mon Sep 17 00:00:00 2001 From: Matheus Izvekov Date: Sat, 28 Sep 2024 14:28:58 -0300 Subject: [PATCH] [clang] Track function template instantiation from definition

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

2024-10-06 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: This implements the wording I presented here: https://lists.isocpp.org/core/2024/09/16266.php This will be part of the next revision of P3310. https://github.com/llvm/llvm-project/pull/107350 ___ cfe-commits mailing list cfe-commits@li

[clang] [Clang] Remove the special-casing for RequiresExprBodyDecl in BuildResolvedCallExpr() after fd87d765c0 (PR #111277)

2024-10-06 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/111277 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-10-06 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov updated https://github.com/llvm/llvm-project/pull/110387 >From 226b1bea7b287f31f4dc8d57466c8af5c6012c4e Mon Sep 17 00:00:00 2001 From: Matheus Izvekov Date: Sat, 28 Sep 2024 14:28:58 -0300 Subject: [PATCH] [clang] Track function template instantiation from definition

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

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

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

2024-10-04 Thread Matheus Izvekov via cfe-commits
@@ -4159,7 +4159,7 @@ FunctionTemplateDecl *FunctionDecl::getPrimaryTemplate() const { if (FunctionTemplateSpecializationInfo *Info = TemplateOrSpecialization .dyn_cast()) { -return Info->getTemplate(); +return Info->getTemplate()->getMostRecentDe

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

2024-10-04 Thread Matheus Izvekov via cfe-commits
@@ -4159,7 +4159,7 @@ FunctionTemplateDecl *FunctionDecl::getPrimaryTemplate() const { if (FunctionTemplateSpecializationInfo *Info = TemplateOrSpecialization .dyn_cast()) { -return Info->getTemplate(); +return Info->getTemplate()->getMostRecentDe

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

2024-10-05 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov updated https://github.com/llvm/llvm-project/pull/107350 >From 9b12c0b5a0b701984a83308273385c53ced29e41 Mon Sep 17 00:00:00 2001 From: Matheus Izvekov Date: Thu, 5 Sep 2024 00:25:40 -0300 Subject: [PATCH] [clang] CWG2398: improve overload resolution backwards compat

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

2024-10-07 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: Ops, somehow missed the original notification. Will look into it, thanks for the report. https://github.com/llvm/llvm-project/pull/96023 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/list

[clang] [Clang][NFC] Consolidate the parameter check for the `requires` expression parameter. (PR #110773)

2024-10-01 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: > Thank you so much for your quick review! However, it seems the current CI is > blocked by the issues mentioned in #110783 :( I wouldn't be worried about that for a simple change like this, you can go ahead and merge. https://github.com/llvm/llvm-project/pull/110773 _

[clang] [Clang] Emit a diagnostic note at the class declaration when the method definition does not match any declaration. (PR #110638)

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

[clang] [Clang][NFC] Consolidate the parameter check for the `requires` expression parameter. (PR #110773)

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

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

2024-10-05 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: I pushed a new implementation for this fix. I have updated the implementation of InstantiateFunctionDefinition so that it doesn't depend anymore on having the exact function declaration instantiation which has the same template context as the definition. This avoids the more e

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

2024-10-05 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov created https://github.com/llvm/llvm-project/pull/111267 …on templates When instantiating a class template, we would lose track of function template explicit specializations, marking them with the wrong specialization kind. This would lead to improperly using the e

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

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

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

2024-10-15 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: Hello, sorry I missed your earlier notification. Your test case further reduces to: https://godbolt.org/z/q6ndebaeW ```C++ template struct Traits { using Type = Traits; }; template void FillVRegs(typename Traits::Type...); template void FillVRegs(typename Traits::Type); voi

[clang] [Clang][Sema] Fix exception specification comparison for functions with different template depths (PR #111561)

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

[clang] [Clang][Sema] Fix exception specification comparison for functions with different template depths (PR #111561)

2024-10-18 Thread Matheus Izvekov via cfe-commits
@@ -314,6 +316,22 @@ bool Sema::CheckEquivalentExceptionSpec(FunctionDecl *Old, FunctionDecl *New) { return false; } + if (Old->getExceptionSpecType() == EST_DependentNoexcept && + New->getExceptionSpecType() == EST_DependentNoexcept) { +const auto *OldType =

[clang] [Clang][Sema] Fix exception specification comparison for functions with different template depths (PR #111561)

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

[clang] Fix build break in SemaHLSL.cpp on MSVC 2022: warning C4715: 'getResourceClass': not all control paths return a value (PR #112767)

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

[clang] Fix build break in SemaHLSL.cpp on MSVC 2022: warning C4715: 'getResourceClass': not all control paths return a value (PR #112767)

2024-10-17 Thread Matheus Izvekov via cfe-commits
@@ -102,6 +102,7 @@ static ResourceClass getResourceClass(RegisterType RT) { return ResourceClass::Sampler; case RegisterType::C: case RegisterType::I: + default: llvm_unreachable("unexpected RegisterType value"); } mizvekov wrote: There is a

[clang] Fix build break in SemaHLSL.cpp on MSVC 2022: warning C4715: 'getResourceClass': not all control paths return a value (PR #112767)

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

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

2024-10-10 Thread Matheus Izvekov via cfe-commits
@@ -860,6 +860,16 @@ class RedeclarableTemplateDecl : public TemplateDecl, /// \endcode bool isMemberSpecialization() const { return Common.getInt(); } + /// Determines whether any redeclaration of this template was + /// a specialization of a member template. + bool ha

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

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

[clang] [clang] Remove the deprecated flag `-frelaxed-template-template-args`. (PR #111894)

2024-10-10 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov created https://github.com/llvm/llvm-project/pull/111894 This flag has been deprecated since Clang 19, having been the default since then. It has remained because its negation was still useful to work around backwards compatibility breaking changes from P0522. How

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

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

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

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

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

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

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

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

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

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

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

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

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

2024-10-09 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: I am not sure I can offer a better option here. The global change seems odd, and I think it may run into other problems. One option would be to do the big hammer approach as you suggest, but then afterwards back out and then try to nail the places where the most recent declara

[clang] Reland: [clang] Finish implementation of P0522 (PR #111711)

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

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

2024-10-10 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] CWG2398: improve overload resolution backwards compat (PR #107350)

2024-10-10 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov updated https://github.com/llvm/llvm-project/pull/107350 >From e3487474838b1393dc9e4d1b349259f300f9af7b Mon Sep 17 00:00:00 2001 From: Matheus Izvekov Date: Thu, 5 Sep 2024 00:25:40 -0300 Subject: [PATCH] [clang] CWG2398: improve overload resolution backwards compat

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

2024-10-10 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov closed 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] Implement TTP P0522 pack matching for deduced function template calls. (PR #111457)

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

[clang] [clang] Implement TTP P0522 pack matching for deduced function template calls. (PR #111457)

2024-10-10 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov updated https://github.com/llvm/llvm-project/pull/111457 >From 9ff2c1eb98baeea624afd2bd1d0fdbc365041700 Mon Sep 17 00:00:00 2001 From: Matheus Izvekov Date: Sat, 5 Oct 2024 21:56:51 -0300 Subject: [PATCH] [clang] Implement TTP 'reversed' pack matching for deduced fu

[clang] [clang] Implement TTP P0522 pack matching for deduced function template calls. (PR #111457)

2024-10-10 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov closed https://github.com/llvm/llvm-project/pull/111457 ___ 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-10-05 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov updated https://github.com/llvm/llvm-project/pull/110387 >From 0ac3d1a93bbfcf50ed932ff149a48755819d4da0 Mon Sep 17 00:00:00 2001 From: Matheus Izvekov Date: Sat, 28 Sep 2024 14:28:58 -0300 Subject: [PATCH] [clang] Track function template instantiation from definition

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

2024-10-05 Thread Matheus Izvekov via cfe-commits
@@ -0,0 +1,84 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++26 %s mizvekov wrote: Yeah I think this is big enough to be on its own file. https://github.com/llvm/llvm-project/pull/110387 ___ cfe-commits mailing l

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

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

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

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

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

2024-10-05 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov ready_for_review 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] Fix a DeclContext mismatch when parsing nested lambda parameters (PR #112177)

2024-10-14 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov approved this pull request. https://github.com/llvm/llvm-project/pull/112177 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-10-14 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov created https://github.com/llvm/llvm-project/pull/112241 This fixes instantiation of definition for friend function templates, when the declaration found and the one containing the definition have different template contexts. In these cases, the the function declar

[clang] [Clang][Sema] Ignore previous partial specializations of member class templates explicitly specialized for a implicitly instantiated class template specialization (PR #113464)

2024-11-05 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov commented: Sorry for the late review. The patch looks fine, thanks! I have a minor concern about the 3x repetition here, and would be happy to see this refactored at some point. https://github.com/llvm/llvm-project/pull/113464 __

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

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

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

2024-11-05 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov approved this pull request. LGTM with small nit, thanks! https://github.com/llvm/llvm-project/pull/114220 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-11-05 Thread Matheus Izvekov via cfe-commits
@@ -4205,6 +4205,7 @@ SubstTemplateTypeParmType::SubstTemplateTypeParmType( SubstTemplateTypeParmTypeBits.Index = Index; SubstTemplateTypeParmTypeBits.PackIndex = PackIndex ? *PackIndex + 1 : 0; + SubstTemplateTypeParmTypeBits.ExpandPacksInPlace = ExpandPacksInPlace;

[clang] [C++20] [Modules] Convert '-fexperimental-modules-reduced-bmi' to '-fmodules-reduced-bmi' (PR #114382)

2024-11-05 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov commented: I think the overall plan is fine, thanks for working on it! I think the idea of issuing a warning in order to get users to opt-in to a flag is somewhat novel. Have I missed discussion about this approach, versus simply changing the default? Regardless, f

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

2024-11-05 Thread Matheus Izvekov via cfe-commits
@@ -11757,6 +11791,42 @@ static void DiagnoseBadDeduction(Sema &S, NamedDecl *Found, Decl *Templated, return; } +// Errors in deduction guides from inherited constructors +// will manifest as substitution failures in the return type +// partial specializ

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

2024-11-05 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] prevent assertion failure from an invalid template instantiation pattern when adding instantiated params to the scope in friend functions with defaulted params (PR #113777)

2024-11-05 Thread Matheus Izvekov via cfe-commits
@@ -3430,15 +3430,17 @@ bool Sema::SubstDefaultArgument( ContextRAII SavedContext(*this, FD); std::unique_ptr LIS; -if (ForCallExpr) { +FunctionDecl *PatternFD = +ForCallExpr +? FD->getTemplateInstantiationPattern(/*ForDefinition*/ false) +

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