[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 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
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
@@ -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 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] 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][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] [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] [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: @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] 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-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] [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-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] 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-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
@@ -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-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
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] [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] 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] 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-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] 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] 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] [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-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] 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-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-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: 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] correct argument offset for function template partial ordering (PR #107972)

2024-09-10 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov closed https://github.com/llvm/llvm-project/pull/107972 ___ 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-09-10 Thread Matheus Izvekov via cfe-commits
@@ -19000,7 +19056,7 @@ bool Sema::tryCaptureVariable( Explicit = false; FunctionScopesIndex--; if (IsInScopeDeclarationContext) - DC = ParentDC; + DC = skipRequiresBody(ParentDC); mizvekov wrote: That is one of your tests actually: `cla

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

2024-09-10 Thread Matheus Izvekov via cfe-commits
@@ -18770,12 +18832,6 @@ bool Sema::tryCaptureVariable( if (CapturingFunctionScopes == 0 && (!BuildAndDiagnose || VarDC == DC)) return true; - // Exception: Function parameters are not tied to the function's DeclContext - // until we enter the function definition. Capt

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

2024-09-10 Thread Matheus Izvekov via cfe-commits
@@ -961,6 +961,7 @@ static const Expr *SubstituteConstraintExpressionWithoutSatisfaction( if (MLTAL.getNumSubstitutedLevels() == 0) return ConstrExpr; + MLTAL.setKind(TemplateSubstitutionKind::Rewrite); mizvekov wrote: The new difference introduced in

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

2024-09-10 Thread Matheus Izvekov via cfe-commits
@@ -254,6 +254,33 @@ class CXXBaseSpecifier { TypeSourceInfo *getTypeSourceInfo() const { return BaseTypeInfo; } }; +class ContextDeclOrSentinel { + uintptr_t Pointer; + +public: + ContextDeclOrSentinel(Decl *Pointer) : Pointer(uintptr_t(Pointer)) {} + explicit ContextDec

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

2024-09-10 Thread Matheus Izvekov via cfe-commits
@@ -6291,7 +6307,8 @@ bool Parser::isDeclarationSpecifier( bool Parser::isConstructorDeclarator(bool IsUnqualified, bool DeductionGuide, DeclSpec::FriendSpecified IsFriend, const ParsedTemplateInfo *Templ

[clang] [clang] correct argument offset for function template partial ordering (PR #107972)

2024-09-09 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov edited https://github.com/llvm/llvm-project/pull/107972 ___ 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-09 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: @alexfh That's a bug in the patch, thanks for reporting. This patch fixes it: https://github.com/llvm/llvm-project/pull/107972 https://github.com/llvm/llvm-project/pull/100692 ___ cfe-commits mailing list cfe-commits@lists.llvm.org htt

[clang] [clang] correct argument offset for function template partial ordering (PR #107972)

2024-09-09 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov created https://github.com/llvm/llvm-project/pull/107972 This fixes a bug in #18291, that was reported in the PR. Since this is a bug fix for a patch that was never released, no entries are added to the changelog. >From 395ddd73b4dd366155a8718c13410b03bf8c6d32 Mon

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

2024-09-07 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: I believe we have achieved consensus on getting rid of the fallback rules, and this patch does not do much beyond that, if anything. https://github.com/llvm/llvm-project/pull/96023 ___ cfe-commits mailing list cfe-commits@lists.llvm.or

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

2024-09-07 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] [clang] Finish implementation of P0522 This finishes the clan

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

2024-09-07 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov edited 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] Implement CWG2398 provisional TTP matching to class templates (PR #94981)

2024-09-07 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov closed 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-tools-extra] [clang] Implement CWG2398 provisional TTP matching to class templates (PR #94981)

2024-09-07 Thread Matheus Izvekov via cfe-commits
@@ -6753,16 +6758,41 @@ ASTContext::getNameForTemplate(TemplateName Name, case TemplateName::UsingTemplate: return DeclarationNameInfo(Name.getAsUsingShadowDecl()->getDeclName(), NameLoc); + case TemplateName::DeducedTemplate: { +Deduce

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

2024-09-05 Thread Matheus Izvekov via cfe-commits
@@ -6803,9 +6809,6 @@ bool CXXNameMangler::mangleSubstitution(QualType T) { } bool CXXNameMangler::mangleSubstitution(TemplateName Template) { - if (TemplateDecl *TD = Template.getAsTemplateDecl()) -return mangleSubstitution(TD); - mizvekov wrote: This o

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

2024-09-05 Thread Matheus Izvekov via cfe-commits
@@ -2143,15 +2107,17 @@ static TemplateDeductionResult DeduceTemplateArgumentsByTypeMatch( unsigned SubTDF = TDF & TDF_IgnoreQualifiers; if (auto Result = DeduceTemplateArgumentsByTypeMatch( S, TemplateParams, PPT, APT, Info, Deduced, SubTDF, -

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

2024-09-05 Thread Matheus Izvekov via cfe-commits
@@ -139,28 +165,63 @@ TemplateName::NameKind TemplateName::getKind() const { return AssumedTemplate; if (uncommon->getAsSubstTemplateTemplateParm()) return SubstTemplateTemplateParm; + if (uncommon->getAsDeducedTemplateName()) +return DeducedTemplate; + + assert

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

2024-09-05 Thread Matheus Izvekov via cfe-commits
@@ -5327,9 +5332,29 @@ bool Sema::CheckTemplateArgumentList( SmallVector CanonicalArgumentPack; unsigned ArgIdx = 0, NumArgs = NewArgs.size(); LocalInstantiationScope InstScope(*this, true); - for (TemplateParameterList::iterator Param = Params->begin(), -

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

2024-09-05 Thread Matheus Izvekov via cfe-commits
@@ -1198,6 +1198,18 @@ void TextNodeDumper::dumpBareTemplateName(TemplateName TN) { dumpTemplateName(STS->getReplacement(), "replacement"); return; } + case TemplateName::DeducedTemplate: { +OS << " deduced"; +const DeducedTemplateStorage *DTS = TN.getAsDedu

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

2024-09-05 Thread Matheus Izvekov via cfe-commits
@@ -139,28 +165,63 @@ TemplateName::NameKind TemplateName::getKind() const { return AssumedTemplate; if (uncommon->getAsSubstTemplateTemplateParm()) return SubstTemplateTemplateParm; + if (uncommon->getAsDeducedTemplateName()) +return DeducedTemplate; + + assert

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

2024-09-05 Thread Matheus Izvekov via cfe-commits
@@ -326,6 +320,48 @@ namespace classes { // expected-error@-1 {{no matching function for call}} } } // namespace packs + namespace nested { mizvekov wrote: The test case from 100692 doesn't have anything interesting new on top of this one. There

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

2024-09-05 Thread Matheus Izvekov via cfe-commits
@@ -1371,11 +1371,17 @@ class TemplateDiff { /// argument info into a tree. void DiffTemplate(const TemplateSpecializationType *FromTST, const TemplateSpecializationType *ToTST) { +// FIXME: With P3310R0, A TST formed from a DeducedTemplateName might

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

2024-09-05 Thread Matheus Izvekov via cfe-commits
@@ -645,6 +645,9 @@ static bool IsStructurallyEquivalent(StructuralEquivalenceContext &Context, // It is sufficient to check value of getAsTemplateDecl. break; + case TemplateName::DeducedTemplate: + // FIXME: We can't reach here. + llvm_unreachable("unimp

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

2024-09-05 Thread Matheus Izvekov via cfe-commits
@@ -412,6 +445,30 @@ class SubstTemplateTemplateParmStorage std::optional PackIndex); }; +class DeducedTemplateStorage : public UncommonTemplateNameStorage, mizvekov wrote: This one is a too internal detail of how the different kinds of

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

2024-09-05 Thread Matheus Izvekov via cfe-commits
@@ -9219,7 +9222,8 @@ class Sema final : public SemaBase { /// \returns true if an error occurred, false otherwise. bool CheckTemplateArgumentList( TemplateDecl *Template, SourceLocation TemplateLoc, - TemplateArgumentListInfo &TemplateArgs, bool PartialTemplateA

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

2024-09-05 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: By the way, just realized I should mention this, but we still support '-fno-relaxed-template-template-args', if anything, you could compile SPEC with that flag in order to workaround this breakage meanwhile, until the above patch is merged. https://github.com/llvm/llvm-project

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

2024-09-05 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: Yep, GCC gates __cpp_template_template_args on C++17 and above. We went with unrestricted enablement on clang, mainly because we thought we would have a full backwards compatibility solution by now. As I said, this is fixed by https://github.com/llvm/llvm-project/pull/94981, b

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

2024-09-05 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: Yep, there is probably a macro somewhere guarding against GCC and possibly also c++ standards from C++17 up. That should be replaced by a macro guarding for `__cpp_template_template_args <= 201611L` instead. https://github.com/llvm/llvm-project/pull/100692 _

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

2024-09-05 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: Oh cool, this is CWG2398 TTP-on-Class, this is fixed by https://github.com/llvm/llvm-project/pull/94981 :) On the SPEC source code side, this is probably similar to the xtensor breakage we got a while ago, there is probably a macro guard somewhere that should be expanded to co

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

2024-09-04 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: The problem is that I am not sure yet whether this is a breakage that is intended by this patch, and so SPEC should be fixed, or if that is otherwise something that could be fixed in this patch. It's bedtime now, my shift for today is over, so I'll only be able to take a look

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

2024-09-04 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: Thanks for the reduction. I can work with this reduction, but keep in mind that it's better to disable the c-reduce pass which renames things. The reason is that if this is a problem in SPEC that needs to be fixed, then having the names preserved would help locate which part o

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

2024-09-04 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: @lukel97 If you can reduce, I would appreciate it. You can also post here an unreduced pre-processed unit which compiles fine with clang before this patch. https://github.com/llvm/llvm-project/pull/100692 ___ cfe-commits mailing lis

[clang] [clang] NFCI: don't check deduced constraints when partial ordering (PR #106882)

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

[clang] [clang] NFCI: don't check deduced constraints when partial ordering (PR #106882)

2024-08-31 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov created https://github.com/llvm/llvm-project/pull/106882 We were incorrectly applying [temp.deduct]p5 to partial ordering. Marked as NFCI as I don't think the difference is actually observable in practice. During partial ordering, the deduced arguments will mostly b

[clang] [clang] CTAD: implement the missing IsDeducible constraint for alias templates (PR #89358)

2024-08-31 Thread Matheus Izvekov via cfe-commits
@@ -3237,6 +3237,40 @@ static TemplateDeductionResult FinishTemplateArgumentDeduction( return TemplateDeductionResult::Success; } +/// Complete template argument deduction for DeduceTemplateArgumentsFromType. +/// FIXME: this is mostly duplicated with the above two versions

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

2024-08-31 Thread Matheus Izvekov via cfe-commits
=?utf-8?q?Bal=C3=A1zs_K=C3=A9ri?= , =?utf-8?q?Bal=C3=A1zs_K=C3=A9ri?= Message-ID: In-Reply-To: https://github.com/mizvekov approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/101836 ___ cfe-commits mailing list cfe-commits@lis

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

2024-08-31 Thread Matheus Izvekov via cfe-commits
=?utf-8?q?Balázs_Kéri?= , =?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

[clang] [clang] function template non-call partial ordering fixes (PR #106829)

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

[clang] [clang] function template non-call partial ordering fixes (PR #106829)

2024-08-31 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov updated https://github.com/llvm/llvm-project/pull/106829 >From a3c08127868fb3b77c8cc79355e43ab5288371fc Mon Sep 17 00:00:00 2001 From: Matheus Izvekov Date: Fri, 30 Aug 2024 17:37:55 -0300 Subject: [PATCH] [clang] function template non-call partial ordering fixes Th

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

2024-08-30 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: @DavidTruby @DavidSpickett A fix for this issue is up at https://github.com/llvm/llvm-project/pull/106829 https://github.com/llvm/llvm-project/pull/100692 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/c

[clang] [clang] function template non-call partial ordering fixes (PR #106829)

2024-08-30 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: FYI @DavidTruby @DavidSpickett https://github.com/llvm/llvm-project/pull/106829 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] function template non-call partial ordering fixes (PR #106829)

2024-08-30 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov created https://github.com/llvm/llvm-project/pull/106829 This applies to function template non-call partial ordering the same provisional wording change applied in the call context: Don't perform the consistency check on return type and parameters which didn't have

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

2024-08-30 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: Reduction: ``` template struct __promote { using type = float; }; template class complex {}; template complex<_Tp> pow(const complex<_Tp> &) {}; template complex::type> pow(_Tp) = delete; using F0 = complex (*)(const complex &); F0 ptr{pow}; ``` This is the same as the

[clang] [clang] mangle placeholder for deduced type as a template-prefix (PR #106335)

2024-08-29 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: Thanks. I'll be happy to continue on post-commit if @zygoloid or @rjmccall have any concerns. https://github.com/llvm/llvm-project/pull/106335 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailm

[clang] [clang] mangle placeholder for deduced type as a template-prefix (PR #106335)

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

[clang] [clang] mangle placeholder for deduced type as a template-prefix (PR #106335)

2024-08-29 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov updated https://github.com/llvm/llvm-project/pull/106335 >From b86ebec082a82da967528819e9df7bd16c502b34 Mon Sep 17 00:00:00 2001 From: Matheus Izvekov Date: Wed, 28 Aug 2024 00:34:12 -0300 Subject: [PATCH 1/2] [clang] mangle placeholder for deduced type as a templat

[clang] a0441ce - [NFC] whitespace cleanup on clang/test/SemaTemplate/temp_arg_nontype.cpp

2024-08-29 Thread Matheus Izvekov via cfe-commits
Author: Matheus Izvekov Date: 2024-08-29T16:03:42-03:00 New Revision: a0441ced7a770036e00610989e2fabba5caeb31b URL: https://github.com/llvm/llvm-project/commit/a0441ced7a770036e00610989e2fabba5caeb31b DIFF: https://github.com/llvm/llvm-project/commit/a0441ced7a770036e00610989e2fabba5caeb31b.dif

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

2024-08-29 Thread Matheus Izvekov via cfe-commits
@@ -1144,6 +1164,46 @@ bool Sema::CheckInstantiatedFunctionTemplateConstraints( PointOfInstantiation, Satisfaction); } +bool Sema::CheckFunctionConstraintsWithoutInstantiation( +SourceLocation PointOfInstantiation, FunctionTemplateDecl

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

2024-08-29 Thread Matheus Izvekov via cfe-commits
@@ -1144,6 +1164,46 @@ bool Sema::CheckInstantiatedFunctionTemplateConstraints( PointOfInstantiation, Satisfaction); } +bool Sema::CheckFunctionConstraintsWithoutInstantiation( +SourceLocation PointOfInstantiation, FunctionTemplateDecl

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

2024-08-29 Thread Matheus Izvekov via cfe-commits
@@ -13051,11 +13051,14 @@ class Sema final : public SemaBase { /// instantiation arguments. /// /// \param DC In the event we don't HAVE a declaration yet, we instead provide - /// the decl context where it will be created. In this case, the `Innermost` - /// shoul

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

2024-08-29 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: Awesome, thanks! I will give a review later, but just want to note a different (but much smaller) PR touching the same area: https://github.com/llvm/llvm-project/pull/102922 Just to keep in mind that the idea is to later further simplify `getTemplateInstantiationArgs` by remo

[clang] [C++20] [Modules] Embed all source files for C++20 Modules (PR #102444)

2024-08-29 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: FWIW, I meant to review this, but somehow this disappeared from my waiting for review list and I lost track of it :) https://github.com/llvm/llvm-project/pull/102444 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists

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

2024-08-28 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov edited 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] check deduction consistency when partial ordering function templates (PR #100692)

2024-08-28 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov closed 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-commits

[clang] [clang] mangle placeholder for deduced type as a template-prefix (PR #106335)

2024-08-28 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov updated https://github.com/llvm/llvm-project/pull/106335 >From b86ebec082a82da967528819e9df7bd16c502b34 Mon Sep 17 00:00:00 2001 From: Matheus Izvekov Date: Wed, 28 Aug 2024 00:34:12 -0300 Subject: [PATCH 1/2] [clang] mangle placeholder for deduced type as a templat

[clang] [clang] mangle placeholder for deduced type as a template-prefix (PR #106335)

2024-08-28 Thread Matheus Izvekov via cfe-commits
@@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -std=c++20 %s -triple %itanium_abi_triple -emit-llvm -o - | FileCheck %s + +template class S> +void create_unique() + requires (S{0}, true) {} + +template struct A { + constexpr A(Fn) {}; +}; + +template void create_unique(); +// CHECK: @_

[clang] [clang] mangle placeholder for deduced type as a template-prefix (PR #106335)

2024-08-27 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov updated https://github.com/llvm/llvm-project/pull/106335 >From b86ebec082a82da967528819e9df7bd16c502b34 Mon Sep 17 00:00:00 2001 From: Matheus Izvekov Date: Wed, 28 Aug 2024 00:34:12 -0300 Subject: [PATCH] [clang] mangle placeholder for deduced type as a template-pr

[clang] [clang] mangle placeholder for deduced type as a template-prefix (PR #106335)

2024-08-27 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov created https://github.com/llvm/llvm-project/pull/106335 As agreed on https://github.com/itanium-cxx-abi/cxx-abi/issues/109 these placeholders should be mangled as a `template-prefix` production. ``` ::=# global template ::=

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

2024-08-26 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 1/3] [clang] check deduction consistency when partial ordering

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

2024-08-26 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-26 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 1/2] [clang] check deduction consistency when partial ordering

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

2024-08-26 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-26 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov edited 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-commits

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

2024-08-26 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-26 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][Sema] Fix particular operator overload crash (PR #105976)

2024-08-26 Thread Matheus Izvekov via cfe-commits
@@ -7425,6 +7425,13 @@ void Sema::AddMethodCandidate(DeclAccessPair FoundDecl, QualType ObjectType, /*ExplicitArgs*/ nullptr, ObjectType, ObjectClassification, Args, CandidateSet, Supp

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

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

[clang] [Clang][Sema] Revisit the fix for the lambda within a type alias template decl (PR #89934)

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

[clang] [Clang][Sema] Revisit the fix for the lambda within a type alias template decl (PR #89934)

2024-08-26 Thread Matheus Izvekov via cfe-commits
@@ -91,15 +91,84 @@ void bar() { namespace GH82104 { -template int Zero = 0; +template int Value = sizeof...(D); mizvekov wrote: ```suggestion template constexpr int Value = sizeof...(D); ``` https://github.com/llvm/llvm-project/pull/89934 __

  1   2   3   4   5   6   7   8   9   >