[clang] [Clang] Correctly propagate type aliases' unexpanded flags up to lambda (PR #122875)

2025-01-17 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov approved this pull request. I think the change is ok, but I don't think this fixes the underlying issue. There is something generally wrong with type aliases which don't use all of their parameters, and this needs more thought. https://github.com/llvm/llvm-project/p

[clang] [clang][AST] Assert that DependentNameType::Name is not null (PR #122418)

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

[clang] [clang][AST] Assert that DependentNameType::Name is not null (PR #122418)

2025-01-14 Thread Matheus Izvekov via cfe-commits
@@ -7035,17 +7035,16 @@ class DependentNameType : public TypeWithKeyword, public llvm::FoldingSetNode { : TypeWithKeyword(Keyword, DependentName, CanonType, TypeDependence::DependentInstantiation | toTypeDependence(NNS-

[clang] [clang][AST] Assert that DependentNameType::Name is not null (PR #122418)

2025-01-14 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov approved this pull request. LGTM, Indeed a DependentNameType with no 'Name' doesn't make sense. https://github.com/llvm/llvm-project/pull/122418 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/

[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] Reapply "[Clang] Improve diagnostics for expansion length mismatch" (PR #121044)

2025-01-07 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov approved this pull request. LGTM, though I would have preferred to keep the patches separate, it's less of a revert risk. https://github.com/llvm/llvm-project/pull/121044 ___ cfe-commits mailing list cfe-commits@lists.llvm.

[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] [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][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] [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 ___

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

2024-12-24 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: Thanks! I think I completely missed the fact these were both reverted. https://github.com/llvm/llvm-project/pull/121044 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-12-16 Thread Matheus Izvekov via cfe-commits
@@ -4692,6 +4692,17 @@ bool Sema::InstantiateDefaultArgument(SourceLocation CallLoc, FunctionDecl *FD, ParmVarDecl *Param) { assert(Param->hasUninstantiatedDefaultArg()); + // FIXME: We don't track member specialization info for non-de

[clang] [clang-tools-extra] [llvm] [clang] WIP: Improved Context Declaration tracking (PR #107942)

2024-12-10 Thread Matheus Izvekov via cfe-commits
@@ -17658,8 +17662,49 @@ HandleImmediateInvocations(Sema &SemaRef, } } +static void setContextDecl(Sema &S, Decl *Base, Decl *ContextDecl) { + switch (Base->getKind()) { + case Decl::CXXRecord: { +auto *RD = cast(Base); +RD->setLambdaContextDecl(ContextDecl); +

[clang] [clang-tools-extra] [llvm] [clang] WIP: Improved Context Declaration tracking (PR #107942)

2024-12-10 Thread Matheus Izvekov via cfe-commits
@@ -17658,8 +17662,49 @@ HandleImmediateInvocations(Sema &SemaRef, } } +static void setContextDecl(Sema &S, Decl *Base, Decl *ContextDecl) { + switch (Base->getKind()) { + case Decl::CXXRecord: { +auto *RD = cast(Base); +RD->setLambdaContextDecl(ContextDecl); +

[clang] [clang-tools-extra] [llvm] [clang] WIP: Improved Context Declaration tracking (PR #107942)

2024-12-10 Thread Matheus Izvekov via cfe-commits
@@ -8494,10 +8495,21 @@ DeclResult Sema::ActOnClassTemplateSpecialization( return Specialization; } -Decl *Sema::ActOnTemplateDeclarator(Scope *S, - MultiTemplateParamsArg TemplateParameterLists, -Declarator &D

[clang] [clang-tools-extra] [llvm] [clang] WIP: Improved Context Declaration tracking (PR #107942)

2024-12-10 Thread Matheus Izvekov via cfe-commits
@@ -7946,6 +7980,8 @@ class Sema final : public SemaBase { /// A stack of expression evaluation contexts. SmallVector ExprEvalContexts; + SmallVector PendingLazyContextDecls; mizvekov wrote: The intention is that they are used for any declarations where

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

2024-12-06 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: I still find the current approach wrt the warning to be odd, we would basically force every modules user to change their command line, either by adding the new `-fmodules-reduced-bmi`, or add `-Wno-wathever` to suppress the warning, or just learn to live with the warning I gue

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

2024-12-06 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov approved this pull request. Thanks, LGTM! https://github.com/llvm/llvm-project/pull/118236 ___ 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-06 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-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] [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,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,15 +5347,18 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state, case NestedNameSpecifier::TypeSpec: case NestedNameSpecifier::TypeSpecWithTemplate: - ClsType = QualType(NNS->getAsType(), 0); - // Note: if t

[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] [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] 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] 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] [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] 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 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] 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] [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
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] 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 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
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] 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] 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] 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
@@ -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
@@ -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] 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] 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] 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] 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] 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] 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] 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] 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) +

[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] 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] 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][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] [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] 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] [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][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] [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] 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
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] [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] 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][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 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] [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] 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] 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] 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] 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] [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] 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 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] 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] 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 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] 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] [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-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] 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
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] [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] [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][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
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

  1   2   3   4   5   6   7   8   9   10   >