[clang] [clang] fix merging of UsingShadowDecl (PR #80245)

2024-02-01 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: I have rebased on top of the change which reenables GMF ODR checker on the test suite, so I added a new regression test that exercises the false positive ODR violation. https://github.com/llvm/llvm-project/pull/80245 ___ cfe-commits m

[clang] [clang] fix merging of UsingShadowDecl (PR #80245)

2024-02-01 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: I took a look at what sort of complexity unittest would entail here. I don't think it's a good compromise complexity wise, it's a lot of boilerplate just to test a few AST nodes are correctly linked. On the other hand, these AST tests don't look particularly out of place compa

[clang] [clang] fix merging of UsingShadowDecl (PR #80245)

2024-02-01 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov updated https://github.com/llvm/llvm-project/pull/80245 >From f7340f3781a3e3094169c970aadb9b69414543f5 Mon Sep 17 00:00:00 2001 From: Matheus Izvekov Date: Thu, 1 Feb 2024 02:07:16 -0300 Subject: [PATCH 1/2] [NFC] [clang] add tests for merging of UsingShadowDecl ---

[clang] [clang] fix merging of UsingShadowDecl (PR #80245)

2024-02-01 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: I just pushed the change on this patch. What I meant is this patch will get, besides aforementioned regression test involving ODR checker failure, a simpler AST test that verifies just the UsingShadowDecl is correctly merged. https://github.com/llvm/llvm-project/pull/80245

[clang] [clang] fix merging of UsingShadowDecl (PR #80245)

2024-02-01 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: There is a lot of activity going on just in `clang/test/AST`, with multiple commits a day. I think there is a time and place, and the right tradeoffs for all kinds of tests we have. Shall we get others opinions? Shall we make an RFC so we get the community aligned on this new di

[clang] [clang] fix merging of UsingShadowDecl (PR #80245)

2024-02-01 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov updated https://github.com/llvm/llvm-project/pull/80245 >From 7bd920a14240c85442467706236e0644f320aa5c Mon Sep 17 00:00:00 2001 From: Matheus Izvekov Date: Thu, 1 Feb 2024 02:07:16 -0300 Subject: [PATCH 1/2] [NFC] [clang] add tests for merging of UsingShadowDecl ---

[clang] [clang] fix merging of UsingShadowDecl (PR #80245)

2024-02-01 Thread Matheus Izvekov via cfe-commits
@@ -0,0 +1,40 @@ +// RUN: rm -rf %t +// RUN: split-file %s %t +// RUN: cd %t +// +// RUN: %clang_cc1 -std=c++20 -I %t %t/A.cppm -emit-module-interface -o %t/A.pcm -verify +// RUN: %clang_cc1 -std=c++20 -I %t %t/B.cppm -emit-module-interface -o %t/B.pcm -verify +// RUN: %clang_cc

[clang] [clang] Make sure the same UsingType is searched and inserted (PR #79182)

2024-01-23 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: The change is correct. The problem is subtle though. It comes from the difference in behavior between the member and non-member Profile functions. I think we could do better instead with a change which makes it harder to trip on this. I think a simplification like this should

[clang] [clang] Make sure the same UsingType is searched and inserted (PR #79182)

2024-01-23 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: > Wonder what test should I add here. This only affects the content of the > internal folding set so we always create new types but result is still > correct. One possibility is doing an AST test, there are some examples in there that show how you can test two different AST no

[clang] [clang] Make sure the same UsingType is searched and inserted (PR #79182)

2024-01-24 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: LGTM. Thanks! https://github.com/llvm/llvm-project/pull/79182 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Make sure the same UsingType is searched and inserted (PR #79182)

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

[clang] [Clang][Sema] Treat explicit specializations of static data member templates declared without 'static' as static data members when diagnosing uses of 'auto' (PR #97425)

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

[clang] [Clang][Sema] Correctly transform dependent operands of overloaded binary operator& (PR #97596)

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

[clang] [Clang][Sema] Fix crash when rebuilding MemberExprs with invalid object expressions (PR #97455)

2024-07-03 Thread Matheus Izvekov via cfe-commits
@@ -2896,6 +2896,9 @@ class TreeTransform { SS.Adopt(QualifierLoc); Base = BaseResult.get(); +if (Base->containsErrors()) + return ExprError(); mizvekov wrote: I am still traveling back from St Louis, so I can't double check this: Why is thi

[clang] [clang] Diagnose use of deprecated template alias (PR #97619)

2024-07-03 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: For reference, see https://reviews.llvm.org/D136533 for similar expansion of diagnostics for uses of declarations, and how that lead to trouble in MacOS land. I'd suggest building libc++ on MacOS, to be sure this won't cause regressions and a future revert. I have a MacOS mac

[clang] [Clang][Sema] Fix crash when rebuilding MemberExprs with invalid object expressions (PR #97455)

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

[clang] [clang] CTAD alias: fix transformation for require-clause expr Part2. (PR #93533)

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

[clang] [clang] deprecate frelaxed-template-template-args, make it on by default (PR #89807)

2024-04-24 Thread Matheus Izvekov via cfe-commits
@@ -507,10 +507,62 @@ static TemplateDeductionResult DeduceNonTypeTemplateArgument( S, TemplateParams, NTTP, DeducedTemplateArgument(New), T, Info, Deduced); } +static NamedDecl *DeduceTemplateArguments(Sema &S, NamedDecl *A, + T

[clang] [clang] deprecate frelaxed-template-template-args, make it on by default (PR #89807)

2024-04-24 Thread Matheus Izvekov via cfe-commits
@@ -507,10 +507,62 @@ static TemplateDeductionResult DeduceNonTypeTemplateArgument( S, TemplateParams, NTTP, DeducedTemplateArgument(New), T, Info, Deduced); } +static NamedDecl *DeduceTemplateArguments(Sema &S, NamedDecl *A, + T

[clang] [clang] deprecate frelaxed-template-template-args, make it on by default (PR #89807)

2024-04-24 Thread Matheus Izvekov via cfe-commits
@@ -8343,58 +8343,52 @@ bool Sema::CheckTemplateTemplateArgument(TemplateTemplateParmDecl *Param, // C++1z [temp.arg.template]p3: (DR 150) // A template-argument matches a template template-parameter P when P // is at least as specialized as the template-argument A.

[clang] [clang] deprecate frelaxed-template-template-args, make it on by default (PR #89807)

2024-04-24 Thread Matheus Izvekov via cfe-commits
@@ -507,10 +507,62 @@ static TemplateDeductionResult DeduceNonTypeTemplateArgument( S, TemplateParams, NTTP, DeducedTemplateArgument(New), T, Info, Deduced); } +static NamedDecl *DeduceTemplateArguments(Sema &S, NamedDecl *A, + T

[clang] [clang] deprecate frelaxed-template-template-args, make it on by default (PR #89807)

2024-04-24 Thread Matheus Izvekov via cfe-commits
@@ -1133,8 +1133,8 @@ C++17 implementation status Matching template template parameters to compatible arguments - https://wg21.link/p0522r0";>P0522R0 - Partial (10) + https://wg21.link/p0522r0";>P0522R0 (DR) + Clang 4 (10) mi

[clang] [clang] deprecate frelaxed-template-template-args, make it on by default (PR #89807)

2024-04-24 Thread Matheus Izvekov via cfe-commits
@@ -519,13 +571,45 @@ DeduceTemplateArguments(Sema &S, TemplateParameterList *TemplateParams, return TemplateDeductionResult::Success; } - if (TemplateTemplateParmDecl *TempParam -= dyn_cast(ParamDecl)) { + if (auto *TempParam = dyn_cast(ParamDecl)) { //

[clang] [clang] deprecate frelaxed-template-template-args, make it on by default (PR #89807)

2024-04-24 Thread Matheus Izvekov via cfe-commits
@@ -507,10 +507,62 @@ static TemplateDeductionResult DeduceNonTypeTemplateArgument( S, TemplateParams, NTTP, DeducedTemplateArgument(New), T, Info, Deduced); } +static NamedDecl *DeduceTemplateArguments(Sema &S, NamedDecl *A, + T

[clang] [clang] deprecate frelaxed-template-template-args, make it on by default (PR #89807)

2024-04-24 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: So Jason pointed out that GCC's provisional wording for CWG2398 picks a dubious candidate for this example: ```C++ template struct match2; template class t1,typename T> struct match2, typename t1::type > { typedef int type; }; // #5

[clang] [clang] deprecate frelaxed-template-template-args, make it on by default (PR #89807)

2024-04-25 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov updated https://github.com/llvm/llvm-project/pull/89807 >From 3f6e50edc7b4d4bf4781c71bd29f48224b62822d Mon Sep 17 00:00:00 2001 From: Matheus Izvekov Date: Tue, 9 Apr 2024 01:14:28 -0300 Subject: [PATCH] [clang] Enable C++17 relaxed template template argument matchi

[clang] [clang] Enable C++17 relaxed template template argument matching by default (PR #89807)

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

[clang] [clang] Enable C++17 relaxed template template argument matching by default (PR #89807)

2024-04-26 Thread Matheus Izvekov via cfe-commits
@@ -0,0 +1,115 @@ +// RUN: %clang_cc1 %s -fsyntax-only -std=c++23 -verify=expected,new +// RUN: %clang_cc1 %s -fsyntax-only -std=c++23 -fno-relaxed-template-template-args -verify=expected,old mizvekov wrote: Okay, I think I m

[clang] [clang] Enable C++17 relaxed template template argument matching by default (PR #89807)

2024-04-26 Thread Matheus Izvekov via cfe-commits
@@ -0,0 +1,115 @@ +// RUN: %clang_cc1 %s -fsyntax-only -std=c++23 -verify=expected,new mizvekov wrote: While it's true this is a DR, I just don't think for this particular case it's worth the cost of testing every single mode

[clang] [clang] Enable C++17 relaxed template template argument matching by default (PR #89807)

2024-04-26 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov updated https://github.com/llvm/llvm-project/pull/89807 >From 43f813d0a1a87b6cad9b859237489778f4f2945f Mon Sep 17 00:00:00 2001 From: Matheus Izvekov Date: Tue, 9 Apr 2024 01:14:28 -0300 Subject: [PATCH] [clang] Enable C++17 relaxed template template argument matchi

[clang] [clang] Enable C++17 relaxed template template argument matching by default (PR #89807)

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

[clang] [clang] Enable C++17 relaxed template template argument matching by default (PR #89807)

2024-04-26 Thread Matheus Izvekov via cfe-commits
@@ -0,0 +1,115 @@ +// RUN: %clang_cc1 %s -fsyntax-only -std=c++23 -verify=expected,new +// RUN: %clang_cc1 %s -fsyntax-only -std=c++23 -fno-relaxed-template-template-args -verify=expected,old mizvekov wrote: Thanks. Since th

[clang] [clang] Enable C++17 relaxed template template argument matching by default (PR #89807)

2024-04-26 Thread Matheus Izvekov via cfe-commits
@@ -507,10 +507,62 @@ static TemplateDeductionResult DeduceNonTypeTemplateArgument( S, TemplateParams, NTTP, DeducedTemplateArgument(New), T, Info, Deduced); } +static NamedDecl *DeduceTemplateArguments(Sema &S, NamedDecl *A, + T

[clang] [clang] Enable C++17 relaxed template template argument matching by default (PR #89807)

2024-04-26 Thread Matheus Izvekov via cfe-commits
@@ -507,10 +507,62 @@ static TemplateDeductionResult DeduceNonTypeTemplateArgument( S, TemplateParams, NTTP, DeducedTemplateArgument(New), T, Info, Deduced); } +static NamedDecl *DeduceTemplateArguments(Sema &S, NamedDecl *A, + T

[clang] Fix a crash introduced by 3d5e9ab by adding a nullptr check. (PR #90301)

2024-04-27 Thread Matheus Izvekov via cfe-commits
@@ -54,7 +54,7 @@ class UncountedCallArgsChecker bool shouldVisitImplicitCode() const { return false; } bool TraverseDecl(Decl *D) { -if (isa(D) && isRefType(safeGetName(D))) +if (D && isa(D) && isRefType(safeGetName(D))) return true;

[clang] [clang] Enable C++17 relaxed template template argument matching by default (PR #89807)

2024-04-27 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov updated https://github.com/llvm/llvm-project/pull/89807 >From 4ee58efa0f154b531dcc674b6f4fe084182aa803 Mon Sep 17 00:00:00 2001 From: Matheus Izvekov Date: Tue, 9 Apr 2024 01:14:28 -0300 Subject: [PATCH] [clang] Enable C++17 relaxed template template argument matchi

[clang] [clang] Enable C++17 relaxed template template argument matching by default (PR #89807)

2024-04-27 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: > @mizvekov We have a bunch of related issues, could you look at them > https://github.com/llvm/llvm-project/issues?q=is%3Aissue+is%3Aopen+%22-frelaxed-template-template-args%22 > ? Removed a bunch of duplicates. 4 issues remaining: 1) #36505 Is the issue we are fixing in this

[clang] [clang] Enable C++17 relaxed template template argument matching by default (PR #89807)

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

[clang] Fix a crash introduced by 3d5e9ab by adding a nullptr check. (PR #90301)

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

[clang] [clang] Enable C++17 relaxed template template argument matching by default (PR #89807)

2024-04-30 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov updated https://github.com/llvm/llvm-project/pull/89807 >From 1756044e71d756f7102f962d0298627ede27871c Mon Sep 17 00:00:00 2001 From: Matheus Izvekov Date: Tue, 9 Apr 2024 01:14:28 -0300 Subject: [PATCH] [clang] Enable C++17 relaxed template template argument matchi

[clang] [Clang][Sema] fix a bug on constraint check with template friend function (PR #90646)

2024-05-01 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: I agree with @sdkrystian, even though the test crashes for maybe yet another reason, it demonstrates you can friend a function from a different template context, so comparing the depths from different branches is not helpful. https://github.com/llvm/llvm-project/pull/90646

[clang] [clang] Enable C++17 relaxed template template argument matching by default (PR #89807)

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

[clang] [clang] Implement provisional wording for CWG2398 regarding packs (PR #90820)

2024-05-01 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov created https://github.com/llvm/llvm-project/pull/90820 This solves some ambuguity introduced in P0522 regarding how template template parameters are partially ordered, and should reduce the negative impact of enabling `-frelaxed-template-template-args` by default.

[clang] [clang] Implement provisional wording for CWG2398 regarding packs (PR #90820)

2024-05-01 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: I had some discussion about that with @Endilll on the previous MR regarding this core issue: https://github.com/llvm/llvm-project/pull/89807 Since there is no posting at all in core about any possible solutions, I wanted to get feedback from t

[clang] [clang] Implement provisional wording for CWG2398 regarding packs (PR #90820)

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

[clang] [clang] Implement provisional wording for CWG2398 regarding packs (PR #90820)

2024-05-01 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: Note we are not implementing the solution Jason posted on the core mailing list, neither on the previous patch, as we have a better solution than current GCC on this, nor on this MR, as GCC implements no such workaround and still fails this te

[clang] [clang] Implement provisional wording for CWG2398 regarding packs (PR #90820)

2024-05-01 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: It would not be splitting though, it would be wholesale duplication in that case. This file is the only part of the suite still testing the old non-conformant mode, and I fail to see a test case we wouldn't be wanting to test on both. https://

[clang] [clang] Implement provisional wording for CWG2398 regarding packs (PR #90820)

2024-05-01 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: > Sounds like should perhaps note that we are implementing our own resolution, > until there's an update to the cwg issue that can be referred to? That could be. Is there another similar issue we could use as a reference on the format for this

[clang] [clang] NFCI: improve TemplateArgument and TemplateName dump methods (PR #94905)

2024-06-10 Thread Matheus Izvekov via cfe-commits
@@ -360,3 +360,34 @@ LLVM_DUMP_METHOD void ConceptReference::dump(raw_ostream &OS) const { ASTDumper P(OS, Ctx, Ctx.getDiagnostics().getShowColors()); P.Visit(this); } + +//===--===// +// TemplateName meth

[clang] [clang] NFCI: improve TemplateArgument and TemplateName dump methods (PR #94905)

2024-06-10 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov updated https://github.com/llvm/llvm-project/pull/94905 >From f918649a9208c2250873eb63641e106478371b43 Mon Sep 17 00:00:00 2001 From: Matheus Izvekov Date: Sat, 8 Jun 2024 11:07:27 -0300 Subject: [PATCH] [clang] improve TemplateArgument and TemplateName dump methods

[clang] [clang] NFCI: improve TemplateArgument and TemplateName dump methods (PR #94905)

2024-06-10 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov closed https://github.com/llvm/llvm-project/pull/94905 ___ 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-06-10 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov created https://github.com/llvm/llvm-project/pull/94981 This extends default argument deduction to cover class templates as well, and also applies outside of partial ordering, adding to the provisional wording introduced in https://github.com/llvm/llvm-project/pull/

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

2024-06-10 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov updated https://github.com/llvm/llvm-project/pull/94981 >From 015a05707caad5d39909bc68a5371161de464d9d Mon Sep 17 00:00:00 2001 From: Matheus Izvekov Date: Mon, 20 May 2024 01:15:03 -0300 Subject: [PATCH] [clang] Implement CWG2398 provisional TTP matching to class t

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

2024-06-10 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov updated https://github.com/llvm/llvm-project/pull/94981 >From ea98dec85a9817eb4e35ce97389433e4a5b9676d Mon Sep 17 00:00:00 2001 From: Matheus Izvekov Date: Mon, 20 May 2024 01:15:03 -0300 Subject: [PATCH] [clang] Implement CWG2398 provisional TTP matching to class t

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

2024-06-10 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov updated https://github.com/llvm/llvm-project/pull/94981 >From 68791782b7a1a0eafa98950f6e03aa1585be5223 Mon Sep 17 00:00:00 2001 From: Matheus Izvekov Date: Mon, 20 May 2024 01:15:03 -0300 Subject: [PATCH] [clang] Implement CWG2398 provisional TTP matching to class t

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

2024-06-11 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov updated https://github.com/llvm/llvm-project/pull/94981 >From d12c7d50b67cd669f09b3701ccf34154876786c9 Mon Sep 17 00:00:00 2001 From: Matheus Izvekov Date: Mon, 20 May 2024 01:15:03 -0300 Subject: [PATCH] [clang] Implement CWG2398 provisional TTP matching to class t

[clang] [StructuralEquivalence] improve NTTP and CXXDependentScopeMemberExpr comparison (PR #95190)

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

[clang] [Clang] Initialize AtLeastAsSpecialized to prevent undefined behavior in Sema::isTemplateTemplateParameterAtLeastAsSpecializedAs() (PR #95195)

2024-06-11 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: There is no potential UB, this is a false positive: this lambda will always be executed before runWithSufficientStackSpace returns. https://github.com/llvm/llvm-project/pull/95195 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [Clang] Initialize AtLeastAsSpecialized to prevent undefined behavior in Sema::isTemplateTemplateParameterAtLeastAsSpecializedAs() (PR #95195)

2024-06-11 Thread Matheus Izvekov via cfe-commits
@@ -6447,7 +6447,7 @@ bool Sema::isTemplateTemplateParameterAtLeastAsSpecializedAs( if (Inst.isInvalid()) return false; - bool AtLeastAsSpecialized; + bool AtLeastAsSpecialized = false; runWithSufficientStackSpace(Info.getLocation(), [&] { mizvekov

[clang] [clang] fix broken canonicalization of DeducedTemplateSpecializationType (PR #95202)

2024-06-12 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov created https://github.com/llvm/llvm-project/pull/95202 This reverts the functional elements of commit 3e78fa860235431323aaf08c8fa922d75a7cfffa and redoes it, by fixing the true root cause of #61317. A TemplateName can be non-canonical; profiling it based on the ca

[clang] [clang] fix broken canonicalization of DeducedTemplateSpecializationType (PR #95202)

2024-06-12 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: It still fixes the original bug report though. Otherwise adding a test which directly tests all observable effects of the profiling fix would be a bit arbitrary, as we don't have any unit tests for the gazillion ways this could go wrong for the other AST nodes. This usually ge

[clang] [clang] fix broken canonicalization of DeducedTemplateSpecializationType (PR #95202)

2024-06-12 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: > Or, are you saying it is too hard to get reduced? > > I don't have a reduced test case. It's not impossible to reduce. Though we usually do a poor job of preserving TemplateNames in other places, which makes this harder to test. I have patches on my pipeline dealing with t

[clang] [clang] fix broken canonicalization of DeducedTemplateSpecializationType (PR #95202)

2024-06-12 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov updated https://github.com/llvm/llvm-project/pull/95202 >From 5c4fa3ce2ce23fdaf877b71b2775244d15a149d3 Mon Sep 17 00:00:00 2001 From: Matheus Izvekov Date: Wed, 12 Jun 2024 00:42:48 -0300 Subject: [PATCH] [clang] fix broken canonicalization of DeducedTemplateSpecial

[clang] [clang] fix broken canonicalization of DeducedTemplateSpecializationType (PR #95202)

2024-06-12 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: I don't think regression tests are the right level here, we risk creating an unstable test. I have added a new unittest module for Profiling tests. I hope some day we will have time to add one test case for each property of each AST node. Though I still think the first line of

[clang] [clang] fix broken canonicalization of DeducedTemplateSpecializationType (PR #95202)

2024-06-12 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov updated https://github.com/llvm/llvm-project/pull/95202 >From dadb9244bee22bc303af154b47f527b973940b40 Mon Sep 17 00:00:00 2001 From: Matheus Izvekov Date: Wed, 12 Jun 2024 00:42:48 -0300 Subject: [PATCH] [clang] fix broken canonicalization of DeducedTemplateSpecial

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

2024-06-12 Thread Matheus Izvekov via cfe-commits
@@ -6371,6 +6376,70 @@ ASTContext::getCanonicalTemplateName(const TemplateName &Name) const { canonArgPack, subst->getAssociatedDecl()->getCanonicalDecl(), subst->getFinal(), subst->getIndex()); } + case TemplateName::DeducedTemplate: { +assert(IgnoreDed

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

2024-06-12 Thread Matheus Izvekov via cfe-commits
@@ -6371,6 +6376,70 @@ ASTContext::getCanonicalTemplateName(const TemplateName &Name) const { canonArgPack, subst->getAssociatedDecl()->getCanonicalDecl(), subst->getFinal(), subst->getIndex()); } + case TemplateName::DeducedTemplate: { +assert(IgnoreDed

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

2024-06-12 Thread Matheus Izvekov via cfe-commits
@@ -9434,6 +9505,32 @@ ASTContext::getSubstTemplateTemplateParmPack(const TemplateArgument &ArgPack, return TemplateName(Subst); } +/// Retrieve the template name that represents a template name +/// deduced from a specialization. +TemplateName +ASTContext::getDeducedTempla

[clang] [clang] fix broken canonicalization of DeducedTemplateSpecializationType (PR #95202)

2024-06-12 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov updated https://github.com/llvm/llvm-project/pull/95202 >From 8bd63f109c2bc1888b4d8dbd5e880900bbb4cef7 Mon Sep 17 00:00:00 2001 From: Matheus Izvekov Date: Wed, 12 Jun 2024 00:42:48 -0300 Subject: [PATCH] [clang] fix broken canonicalization of DeducedTemplateSpecial

[clang] [clang] fix broken canonicalization of DeducedTemplateSpecializationType (PR #95202)

2024-06-12 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov closed https://github.com/llvm/llvm-project/pull/95202 ___ 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-06-12 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov updated https://github.com/llvm/llvm-project/pull/94981 >From f05e8590c7fae599d0658829949fa907942e83f2 Mon Sep 17 00:00:00 2001 From: Matheus Izvekov Date: Mon, 20 May 2024 01:15:03 -0300 Subject: [PATCH] [clang] Implement CWG2398 provisional TTP matching to class t

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

2024-06-12 Thread Matheus Izvekov via cfe-commits
@@ -9434,6 +9505,32 @@ ASTContext::getSubstTemplateTemplateParmPack(const TemplateArgument &ArgPack, return TemplateName(Subst); } +/// Retrieve the template name that represents a template name +/// deduced from a specialization. +TemplateName +ASTContext::getDeducedTempla

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

2024-06-12 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-tools-extra] [clang] Implement CWG2398 provisional TTP matching to class templates (PR #94981)

2024-06-12 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: FYI https://github.com/itanium-cxx-abi/cxx-abi/issues/184 is the tracking issue for the mangling rules we need here. We will probably end up with something quite different than what I coded here so far. https://github.com/llvm/llvm-project/pull/94981 ___

[clang] [clang] Don't print extra space when dumping template names (PR #95213)

2024-06-12 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov approved this pull request. I think what I tried to do here is generally consistent: The convention on the Text node dumper is to add a space at the beginning of the field you want to append. I think the true issue here is the label: It breaks convention by adding a

[clang] Check whether EvaluatedStmt::Value is valid in VarDecl::hasInit (PR #94515)

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

[clang] Check whether EvaluatedStmt::Value is valid in VarDecl::hasInit (PR #94515)

2024-06-12 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov approved this pull request. This is much better, thanks! LGTM https://github.com/llvm/llvm-project/pull/94515 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commi

[clang] Check whether EvaluatedStmt::Value is valid in VarDecl::hasInit (PR #94515)

2024-06-12 Thread Matheus Izvekov via cfe-commits
@@ -2402,10 +2405,9 @@ Expr *VarDecl::getInit() { auto *Eval = getEvaluatedStmt(); - return cast_if_present( - Eval->Value.isOffset() - ? Eval->Value.get(getASTContext().getExternalSource()) - : Eval->Value.get(nullptr)); + return cast(Eval->Value.i

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

2024-06-12 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: I think this is missing one detail: We now have the same qualifier in two places: The elaborated type node attached to the TST, and in the name of the TST itself. While this is not ideal situation, I think it makes sense to just drop the TemplateName qualifier in the transform

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

2024-06-12 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov requested changes to this pull request. Needs changes as discussed. https://github.com/llvm/llvm-project/pull/94725 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-

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

2024-06-13 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] Instantiate local constexpr functions eagerly (PR #95660)

2024-06-15 Thread Matheus Izvekov via cfe-commits
@@ -18112,7 +18112,8 @@ void Sema::MarkFunctionReferenced(SourceLocation Loc, FunctionDecl *Func, if (FirstInstantiation || TSK != TSK_ImplicitInstantiation || Func->isConstexpr()) { - if (isa(Func->getDeclContext()) && + if (!Func->isCon

[clang] [Clang] Instantiate local constexpr functions eagerly (PR #95660)

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

[clang] [Clang] Instantiate local constexpr functions eagerly (PR #95660)

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

[clang] [clang] CTAD: use index and depth to retrieve template parameter for TemplateParamsReferencedInTemplateArgumentList (PR #98013)

2024-07-08 Thread Matheus Izvekov via cfe-commits
@@ -99,3 +99,28 @@ BFoo b2(1.0, 2.0); // CHECK-NEXT: | | |-ParmVarDecl {{.*}} 'type-parameter-0-0' // CHECK-NEXT: | | `-ParmVarDecl {{.*}} 'type-parameter-0-0' // CHECK-NEXT: | `-CXXDeductionGuideDecl {{.*}} implicit used 'auto (double, double) -> Foo' implicit_instantiation +

[clang] [clang] CTAD: use index and depth to retrieve template parameter for TemplateParamsReferencedInTemplateArgumentList (PR #98013)

2024-07-08 Thread Matheus Izvekov via cfe-commits
@@ -2653,20 +2653,34 @@ struct ConvertConstructorToDeductionGuideTransform { // Find all template parameters that appear in the given DeducedArgs. // Return the indices of the template parameters in the TemplateParams. SmallVector TemplateParamsReferencedInTemplateArgumentList(

[clang] [clang] CTAD: use index and depth to retrieve template parameter for TemplateParamsReferencedInTemplateArgumentList (PR #98013)

2024-07-08 Thread Matheus Izvekov via cfe-commits
@@ -2653,20 +2653,34 @@ struct ConvertConstructorToDeductionGuideTransform { // Find all template parameters that appear in the given DeducedArgs. // Return the indices of the template parameters in the TemplateParams. SmallVector TemplateParamsReferencedInTemplateArgumentList(

[clang] [clang] CTAD: use index and depth to retrieve template parameter for TemplateParamsReferencedInTemplateArgumentList (PR #98013)

2024-07-08 Thread Matheus Izvekov via cfe-commits
@@ -2653,20 +2653,34 @@ struct ConvertConstructorToDeductionGuideTransform { // Find all template parameters that appear in the given DeducedArgs. // Return the indices of the template parameters in the TemplateParams. SmallVector TemplateParamsReferencedInTemplateArgumentList(

[clang] [Clang][Index] Add support for dependent class scope explicit specializations of function templates to USRGenerator (PR #98027)

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

[clang] [Sema] Fix crash in Sema::FindInstantiatedDecl (PR #96509)

2024-07-08 Thread Matheus Izvekov via cfe-commits
Alejandro =?utf-8?q?Álvarez_Ayllón?Message-ID: In-Reply-To: @@ -6300,7 +6300,7 @@ NamedDecl *Sema::FindInstantiatedDecl(SourceLocation Loc, NamedDecl *D, getTrivialTemplateArgumentLoc(UnpackedArg, QualType(), Loc)); } QualType T = CheckT

[clang] [Clang] Fix the order of addInstantiatedParameters in LambdaScopeForCallOperatorInstantiationRAII (PR #97215)

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

[clang] [C++20] [Modules] [Itanium ABI] Generate the vtable in the module unit of dynamic classes (PR #75912)

2024-07-09 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: FYI, the commit 99873b35da7ecb905143c8a6b8deca4d4416f1a9, which lists this PR as a motivator, causes breakage building a project, which I am still looking for a reduced test case. The commit is not NFC despite what is says, just by cursory inspection of the change. Please avo

[clang] [Clang][Sema] Handle class member access expressions with valid nested-name-specifiers that become invalid after lookup (PR #98167)

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

[clang] [C++20] [Modules] [Itanium ABI] Generate the vtable in the module unit of dynamic classes (PR #75912)

2024-07-10 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: The reproducer turned out to be pretty simple: ```C++ export module a; module :private; static void f() {} void g() { f(); } ``` Compiles without that patch, otherwise produces: ``` error: no matching function for call to 'f' ``` > Oh, sorry, I took another look at the commi

[clang] [clang] CTAD: use index and depth to retrieve template parameter for TemplateParamsReferencedInTemplateArgumentList (PR #98013)

2024-07-11 Thread Matheus Izvekov via cfe-commits
@@ -99,3 +99,28 @@ BFoo b2(1.0, 2.0); // CHECK-NEXT: | | |-ParmVarDecl {{.*}} 'type-parameter-0-0' // CHECK-NEXT: | | `-ParmVarDecl {{.*}} 'type-parameter-0-0' // CHECK-NEXT: | `-CXXDeductionGuideDecl {{.*}} implicit used 'auto (double, double) -> Foo' implicit_instantiation +

[clang] [clang] CTAD: use index and depth to retrieve template parameter for TemplateParamsReferencedInTemplateArgumentList (PR #98013)

2024-07-11 Thread Matheus Izvekov via cfe-commits
@@ -2653,20 +2653,34 @@ struct ConvertConstructorToDeductionGuideTransform { // Find all template parameters that appear in the given DeducedArgs. // Return the indices of the template parameters in the TemplateParams. SmallVector TemplateParamsReferencedInTemplateArgumentList(

[clang] [clang] CTAD: use index and depth to retrieve template parameter for TemplateParamsReferencedInTemplateArgumentList (PR #98013)

2024-07-11 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov approved this pull request. LGTM, sans: * missing newline at end of test file * A similar test for template template parameter. https://github.com/llvm/llvm-project/pull/98013 ___ cfe-commits mailing list cfe-commits@lists.l

[clang] [Clang][Parse] Fix ambiguity with nested-name-specifiers that may declarative (PR #96364)

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

[clang] [clang-tools-extra] [Clang][AST] Move NamespaceDecl bits to DeclContext (PR #98567)

2024-07-12 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov approved this pull request. LGTM, as a clean up, and I see no notable performance implications. Is there any follow up work for this? https://github.com/llvm/llvm-project/pull/98567 ___ cfe-commits mailing list cfe-commits@

[clang] [C++20] [Modules] [Itanium ABI] Generate the vtable in the module unit of dynamic classes (PR #75912)

2024-07-12 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: > Clarifying a couple of things here I think we need the distinction between simple NFC, for trivial, non-controversial and non-surprising changes like some renames, small whitespace / formatting change, documentation changes, and complex NFC, which requires some thinking and

<    1   2   3   4   5   6   7   8   9   >