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

2024-06-22 Thread Matheus Izvekov via cfe-commits

mizvekov wrote:

> I mean we can transform `QualifiedTemplateName` to `DependentTemplateName` 
> and this is what this patch does.

But that goes against the natural flow of template instantiation. We can't go 
back from non-dependent into dependent.
We can't transform a regular TemplateName back into a DependentTemplateName, 
just as we can't go back to DependentTemplateSpecializationType from a 
TemplateSpecializationType.

That's why I find this so confusing...

> If we build a `DependentTemplateName` instead of `QualifiedTemplateName` 
> earlier would affect the code in partial specialization like:
> 
> ```c++
> template
> struct A::B
> ```

Can you elaborate on that? That still seems like the right path to me, you 
probably found another problem, that happens some times.

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-commits


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

2024-06-22 Thread Matheus Izvekov via cfe-commits

mizvekov wrote:

> @mizvekov After looking into the code, I think we should transform qualifier 
> in TST. Consider the following code:

So the NNS is already dependent, that's great.

I still don't understand why you are saying we didn't or can't build a 
DependentTemplateSpecializationType instead.

Yes, the template name needs to stay a DependentTemplateName for that.

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-commits


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

2024-06-19 Thread Matheus Izvekov via cfe-commits




mizvekov wrote:

After we fork for clang-20, we can entirely remove 
`frelaxed-template-template-args`, and so won't need to worry about testing 
that non-conforming mode. Would it be reasonable to postpone that until then?

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] Change style of superseded issues on C++ DR status page (PR #96051)

2024-06-19 Thread Matheus Izvekov via cfe-commits

https://github.com/mizvekov approved this pull request.


https://github.com/llvm/llvm-project/pull/96051
___
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-18 Thread Matheus Izvekov via cfe-commits

https://github.com/mizvekov updated 
https://github.com/llvm/llvm-project/pull/94981

>From b238961ba3a174d7dc211caf36ff8fd6c8429a76 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
 templates

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/89807.

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.

Given the following example:
```C++
template  struct A;
template  struct B;

template  class TT1, class T5> struct B>;   // #1
template   struct B>; // #2

template struct B>;
```
Prior to P0522, `#2` was picked. Afterwards, this became ambiguous.
This patch restores the pre-P0522 behavior, `#2` is picked again.

As the consequences are not restricted to partial ordering,
the following code becomes valid:
```C++
template struct A {};
A v;
template class TT> void f(TT);

// OK: TT picks 'float' as the default argument for the second parameter.
void g() { f(v); }
```

Also, since 'f' deduced from `A` is different from 'f'
deduced from `A`, this implements an additional mangling
rule.

---

Since this changes provisional implementation of CWG2398 which has
not been released yet, and already contains a changelog entry,
we don't provide a changelog entry here.
---
 clang-tools-extra/clangd/DumpAST.cpp  |   1 +
 .../clangd/SemanticHighlighting.cpp   |   1 +
 clang/include/clang/AST/ASTContext.h  |  11 +-
 clang/include/clang/AST/ASTImporter.h |   5 +
 clang/include/clang/AST/DependenceFlags.h |   5 +
 clang/include/clang/AST/PropertiesBase.td |  17 ++
 clang/include/clang/AST/TemplateName.h|  63 ++-
 clang/include/clang/Sema/Sema.h   |  10 +-
 clang/lib/AST/ASTContext.cpp  | 153 +---
 clang/lib/AST/ASTDiagnostic.cpp   |  45 +++--
 clang/lib/AST/ASTImporter.cpp |  15 ++
 clang/lib/AST/ASTStructuralEquivalence.cpp|   3 +
 clang/lib/AST/Decl.cpp|   3 +-
 clang/lib/AST/ItaniumMangle.cpp   |  20 ++-
 clang/lib/AST/ODRHash.cpp |   1 +
 clang/lib/AST/TemplateName.cpp| 163 ++
 clang/lib/AST/TextNodeDumper.cpp  |  12 ++
 clang/lib/AST/Type.cpp|   3 +-
 clang/lib/AST/TypePrinter.cpp |   3 +-
 clang/lib/Sema/SemaDeclCXX.cpp|   9 +-
 clang/lib/Sema/SemaTemplate.cpp   |  63 +--
 clang/lib/Sema/SemaTemplateDeduction.cpp  | 158 +
 .../lib/Sema/SemaTemplateInstantiateDecl.cpp  |  24 +--
 .../CXX/temp/temp.decls/temp.alias/p2.cpp |   5 +-
 clang/test/CodeGenCXX/mangle-cwg2398.cpp  |  11 ++
 clang/test/SemaTemplate/cwg2398.cpp   |  62 +--
 clang/tools/libclang/CIndex.cpp   |   3 +
 clang/unittests/AST/ASTImporterTest.cpp   |  17 ++
 28 files changed, 629 insertions(+), 257 deletions(-)
 create mode 100644 clang/test/CodeGenCXX/mangle-cwg2398.cpp

diff --git a/clang-tools-extra/clangd/DumpAST.cpp 
b/clang-tools-extra/clangd/DumpAST.cpp
index 9a525efb938e8..e605f82e91fe4 100644
--- a/clang-tools-extra/clangd/DumpAST.cpp
+++ b/clang-tools-extra/clangd/DumpAST.cpp
@@ -187,6 +187,7 @@ class DumpVisitor : public RecursiveASTVisitor 
{
   TEMPLATE_KIND(SubstTemplateTemplateParm);
   TEMPLATE_KIND(SubstTemplateTemplateParmPack);
   TEMPLATE_KIND(UsingTemplate);
+  TEMPLATE_KIND(DeducedTemplate);
 #undef TEMPLATE_KIND
 }
 llvm_unreachable("Unhandled NameKind enum");
diff --git a/clang-tools-extra/clangd/SemanticHighlighting.cpp 
b/clang-tools-extra/clangd/SemanticHighlighting.cpp
index a366f1331c2d3..e6d16af2495fe 100644
--- a/clang-tools-extra/clangd/SemanticHighlighting.cpp
+++ b/clang-tools-extra/clangd/SemanticHighlighting.cpp
@@ -1120,6 +1120,7 @@ class CollectExtraHighlightings
 case TemplateName::SubstTemplateTemplateParm:
 case TemplateName::SubstTemplateTemplateParmPack:
 case TemplateName::UsingTemplate:
+case TemplateName::DeducedTemplate:
   // Names that could be resolved to a TemplateDecl are handled elsewhere.
   break;
 }
diff --git a/clang/include/clang/AST/ASTContext.h 
b/clang/include/clang/AST/ASTContext.h
index de86cb5e9d7fc..837bcacbc0bfc 100644
--- a/clang/include/clang/AST/ASTContext.h
+++ b/clang/include/clang/AST/ASTContext.h
@@ -262,6 +262,8 @@ class ASTContext : public RefCountedBase {
   mutable llvm::ContextualFoldingSet
 SubstTemplateTemplateParmPacks;
+  mutable llvm::ContextualFoldingSet
+  DeducedTemplates;
 
   mutable llvm::ContextualFoldingSet
   

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


@@ -18112,7 +18112,8 @@ void Sema::MarkFunctionReferenced(SourceLocation Loc, 
FunctionDecl *Func,
 
 if (FirstInstantiation || TSK != TSK_ImplicitInstantiation ||
 Func->isConstexpr()) {
-  if (isa(Func->getDeclContext()) &&
+  if (!Func->isConstexpr() &&

mizvekov wrote:

Nit: Slight simplification, you might as well move this branch after the `else 
if (Func->isConstexpr())` below instead of testing it's negation.

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-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 , bool PartialTemplateArgs,
+  TemplateArgumentListInfo ,

mizvekov wrote:

Yeah. One issue I have often had with these functions with large amount of both 
defaulted and non-defaulted parameters, is that you would want to extend it by 
changing the signature, then arguments would match parameters incorrectly, but 
this would not cause a hard error on all of the call sites.

I could have easily added DefaultArgs as defaulted empty here, but chose not to 
due to this reason.

Besides that, overloading functions with such huge numbers of parameters 
creates some confusion as well.
I'd slightly prefer if we avoided that, but don't have strong enough feelings 
to go on a crusade against it.

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


[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 for now, so we don't keep transforming 
it twice, until we make the situation consistent again. Right now the NNS in 
the TST name is not printed, its only purpose there is to carry the template 
keyword information, which shouldn't be affected here.

The fact that this change somehow affects program semantics is still unexpected 
and unexplained.

As I said on the other PR, after we have built a TST, per current AST design, 
we shouldn't need the nested name specifier anymore beyond type sugar.

So either we built this TST too early, as in it should have stayed as a 
DependentTemplateSpecializationType longer or some such, or there is something 
that needs to be rectified in the AST design, but I can't imagine what.

If I had to take a guess, there is something wrong in the dependency 
computation for the NNS. Have you checked that?

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-commits


[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.isOffset()
+? Eval->Value.get(getASTContext().getExternalSource())
+: Eval->Value.get(nullptr));

mizvekov wrote:

Small nit: It seems this could move the conditional into the argument for 
`Eval->Value.get`.

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-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 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] [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 
space after the colon.

I think it would be better to fix that, but I don't know the impact.

Since right now this field is only added after the label, this makes little 
practical difference, so I leave it up to you, either way is fine.

Thanks for the fix!

https://github.com/llvm/llvm-project/pull/95213
___
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

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


@@ -9219,7 +9222,8 @@ class Sema final : public SemaBase {
   /// \returns true if an error occurred, false otherwise.
   bool CheckTemplateArgumentList(
   TemplateDecl *Template, SourceLocation TemplateLoc,
-  TemplateArgumentListInfo , bool PartialTemplateArgs,
+  TemplateArgumentListInfo ,

mizvekov wrote:

I am not seeing a worthwhile tradeoff.

Just the function signature is hugely complicated, and would need to be 
duplicated.
The implementation would be mostly the same, with a small block which would be 
omitted in one of the implementations.

What did you have in mind?

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-06-12 Thread Matheus Izvekov via cfe-commits


@@ -9434,6 +9505,32 @@ ASTContext::getSubstTemplateTemplateParmPack(const 
TemplateArgument ,
   return TemplateName(Subst);
 }
 
+/// Retrieve the template name that represents a template name
+/// deduced from a specialization.
+TemplateName
+ASTContext::getDeducedTemplateName(TemplateName Underlying,
+   DefaultArguments DefaultArgs) const {
+  if (!DefaultArgs)
+return Underlying;
+
+  auto  = const_cast(*this);

mizvekov wrote:

Actually in this case the relevant hash tables were already declared mutable, 
but there were a couple of profile functions not marked const. Fixed.

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-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
 templates

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/89807.

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.

Given the following example:
```C++
template  struct A;
template  struct B;

template  class TT1, class T5> struct B>;   // #1
template   struct B>; // #2

template struct B>;
```
Prior to P0522, `#2` was picked. Afterwards, this became ambiguous.
This patch restores the pre-P0522 behavior, `#2` is picked again.

As the consequences are not restricted to partial ordering,
the following code becomes valid:
```C++
template struct A {};
A v;
template class TT> void f(TT);

// OK: TT picks 'float' as the default argument for the second parameter.
void g() { f(v); }
```

Also, since 'f' deduced from `A` is different from 'f'
deduced from `A`, this implements an additional mangling
rule.

---

Since this changes provisional implementation of CWG2398 which has
not been released yet, and already contains a changelog entry,
we don't provide a changelog entry here.
---
 clang-tools-extra/clangd/DumpAST.cpp  |   1 +
 .../clangd/SemanticHighlighting.cpp   |   1 +
 clang/include/clang/AST/ASTContext.h  |  11 +-
 clang/include/clang/AST/ASTImporter.h |   5 +
 clang/include/clang/AST/DependenceFlags.h |   5 +
 clang/include/clang/AST/PropertiesBase.td |  17 ++
 clang/include/clang/AST/TemplateName.h|  63 ++-
 clang/include/clang/Sema/Sema.h   |  10 +-
 clang/lib/AST/ASTContext.cpp  | 153 +---
 clang/lib/AST/ASTDiagnostic.cpp   |  45 +++--
 clang/lib/AST/ASTImporter.cpp |  15 ++
 clang/lib/AST/ASTStructuralEquivalence.cpp|   3 +
 clang/lib/AST/Decl.cpp|   3 +-
 clang/lib/AST/ItaniumMangle.cpp   |  20 ++-
 clang/lib/AST/ODRHash.cpp |   1 +
 clang/lib/AST/TemplateName.cpp| 163 ++
 clang/lib/AST/TextNodeDumper.cpp  |  12 ++
 clang/lib/AST/Type.cpp|   3 +-
 clang/lib/AST/TypePrinter.cpp |   3 +-
 clang/lib/Sema/SemaDeclCXX.cpp|   9 +-
 clang/lib/Sema/SemaTemplate.cpp   |  63 +--
 clang/lib/Sema/SemaTemplateDeduction.cpp  | 158 +
 .../lib/Sema/SemaTemplateInstantiateDecl.cpp  |  24 +--
 .../CXX/temp/temp.decls/temp.alias/p2.cpp |   5 +-
 clang/test/CodeGenCXX/mangle-cwg2398.cpp  |  11 ++
 clang/test/SemaTemplate/cwg2398.cpp   |  62 +--
 clang/tools/libclang/CIndex.cpp   |   3 +
 clang/unittests/AST/ASTImporterTest.cpp   |  17 ++
 28 files changed, 629 insertions(+), 257 deletions(-)
 create mode 100644 clang/test/CodeGenCXX/mangle-cwg2398.cpp

diff --git a/clang-tools-extra/clangd/DumpAST.cpp 
b/clang-tools-extra/clangd/DumpAST.cpp
index 9a525efb938e8..e605f82e91fe4 100644
--- a/clang-tools-extra/clangd/DumpAST.cpp
+++ b/clang-tools-extra/clangd/DumpAST.cpp
@@ -187,6 +187,7 @@ class DumpVisitor : public RecursiveASTVisitor 
{
   TEMPLATE_KIND(SubstTemplateTemplateParm);
   TEMPLATE_KIND(SubstTemplateTemplateParmPack);
   TEMPLATE_KIND(UsingTemplate);
+  TEMPLATE_KIND(DeducedTemplate);
 #undef TEMPLATE_KIND
 }
 llvm_unreachable("Unhandled NameKind enum");
diff --git a/clang-tools-extra/clangd/SemanticHighlighting.cpp 
b/clang-tools-extra/clangd/SemanticHighlighting.cpp
index a366f1331c2d3..e6d16af2495fe 100644
--- a/clang-tools-extra/clangd/SemanticHighlighting.cpp
+++ b/clang-tools-extra/clangd/SemanticHighlighting.cpp
@@ -1120,6 +1120,7 @@ class CollectExtraHighlightings
 case TemplateName::SubstTemplateTemplateParm:
 case TemplateName::SubstTemplateTemplateParmPack:
 case TemplateName::UsingTemplate:
+case TemplateName::DeducedTemplate:
   // Names that could be resolved to a TemplateDecl are handled elsewhere.
   break;
 }
diff --git a/clang/include/clang/AST/ASTContext.h 
b/clang/include/clang/AST/ASTContext.h
index f1f20fca477a4..c9376dc02fcfc 100644
--- a/clang/include/clang/AST/ASTContext.h
+++ b/clang/include/clang/AST/ASTContext.h
@@ -262,6 +262,8 @@ class ASTContext : public RefCountedBase {
   mutable llvm::ContextualFoldingSet
 SubstTemplateTemplateParmPacks;
+  mutable llvm::ContextualFoldingSet
+  DeducedTemplates;
 
   mutable llvm::ContextualFoldingSet
   

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

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 canonical
name would result in inconsistent preservation of as-written information
in the AST.

The true problem in #61317 is that we would not consider the methods
with requirements expression which contain DTSTs as the same
in relation to merging of declarations when importing modules.

The expressions would never match because they contained DTSTs pointing
to different redeclarations of the same class template, but since
canonicalization for them was broken, their canonical types would not
match either.

---

No changelog entry because #61317 was already claimed as fixed in
previous release.
---
 clang/include/clang/AST/ASTContext.h   |  7 +++
 clang/include/clang/AST/TemplateName.h |  4 +-
 clang/include/clang/AST/Type.h | 11 ++--
 clang/lib/AST/ASTContext.cpp   | 25 ++---
 clang/lib/AST/TemplateName.cpp |  9 
 clang/unittests/AST/CMakeLists.txt |  1 +
 clang/unittests/AST/ProfilingTest.cpp  | 73 ++
 7 files changed, 107 insertions(+), 23 deletions(-)
 create mode 100644 clang/unittests/AST/ProfilingTest.cpp

diff --git a/clang/include/clang/AST/ASTContext.h 
b/clang/include/clang/AST/ASTContext.h
index a1d1d1c51cd41..53ece996769a8 100644
--- a/clang/include/clang/AST/ASTContext.h
+++ b/clang/include/clang/AST/ASTContext.h
@@ -1771,6 +1771,13 @@ class ASTContext : public RefCountedBase {
 QualType DeducedType,
 bool IsDependent) const;
 
+private:
+  QualType getDeducedTemplateSpecializationTypeInternal(TemplateName Template,
+QualType DeducedType,
+bool IsDependent,
+QualType Canon) const;
+
+public:
   /// Return the unique reference to the type for the specified TagDecl
   /// (struct/union/class/enum) decl.
   QualType getTagDeclType(const TagDecl *Decl) const;
diff --git a/clang/include/clang/AST/TemplateName.h 
b/clang/include/clang/AST/TemplateName.h
index 988a55acd2252..24a7fde76195d 100644
--- a/clang/include/clang/AST/TemplateName.h
+++ b/clang/include/clang/AST/TemplateName.h
@@ -346,7 +346,9 @@ class TemplateName {
   /// error.
   void dump() const;
 
-  void Profile(llvm::FoldingSetNodeID );
+  void Profile(llvm::FoldingSetNodeID ) {
+ID.AddPointer(Storage.getOpaqueValue());
+  }
 
   /// Retrieve the template name as a void pointer.
   void *getAsVoidPointer() const { return Storage.getOpaqueValue(); }
diff --git a/clang/include/clang/AST/Type.h b/clang/include/clang/AST/Type.h
index 9eb3f6c09e3d3..fab233b62d8d1 100644
--- a/clang/include/clang/AST/Type.h
+++ b/clang/include/clang/AST/Type.h
@@ -6050,30 +6050,27 @@ class DeducedTemplateSpecializationType : public 
DeducedType,
 
   DeducedTemplateSpecializationType(TemplateName Template,
 QualType DeducedAsType,
-bool IsDeducedAsDependent)
+bool IsDeducedAsDependent, QualType Canon)
   : DeducedType(DeducedTemplateSpecialization, DeducedAsType,
 toTypeDependence(Template.getDependence()) |
 (IsDeducedAsDependent
  ? TypeDependence::DependentInstantiation
  : TypeDependence::None),
-DeducedAsType.isNull() ? QualType(this, 0)
-   : DeducedAsType.getCanonicalType()),
+Canon),
 Template(Template) {}
 
 public:
   /// Retrieve the name of the template that we are deducing.
   TemplateName getTemplateName() const { return Template;}
 
-  void Profile(llvm::FoldingSetNodeID ) {
+  void Profile(llvm::FoldingSetNodeID ) const {
 Profile(ID, getTemplateName(), getDeducedType(), isDependentType());
   }
 
   static void Profile(llvm::FoldingSetNodeID , TemplateName Template,
   QualType Deduced, bool IsDependent) {
 Template.Profile(ID);
-QualType CanonicalType =
-Deduced.isNull() ? Deduced : Deduced.getCanonicalType();
-ID.AddPointer(CanonicalType.getAsOpaquePtr());
+Deduced.Profile(ID);
 ID.AddBoolean(IsDependent || Template.isDependent());
   }
 
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index bf74e56a14799..34aa399fda2f8 100644
--- 

[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 ,
   return TemplateName(Subst);
 }
 
+/// Retrieve the template name that represents a template name
+/// deduced from a specialization.
+TemplateName
+ASTContext::getDeducedTemplateName(TemplateName Underlying,
+   DefaultArguments DefaultArgs) const {
+  if (!DefaultArgs)
+return Underlying;
+
+  auto  = const_cast(*this);

mizvekov wrote:

This is done throughout the ASTContext and is not novel here.

We wish to be able to create a new node from a const ASTContext reference.

These creation functions mostly behave const-ish, they just use hash tables in 
the ASTContext for caching / identity purposes.

The other alternative is to declare these hash tables as mutable, though this 
would necessitate a large noisy change to update everything at once.

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-06-12 Thread Matheus Izvekov via cfe-commits


@@ -6371,6 +6376,70 @@ ASTContext::getCanonicalTemplateName(const TemplateName 
) const {
 canonArgPack, subst->getAssociatedDecl()->getCanonicalDecl(),
 subst->getFinal(), subst->getIndex());
   }
+  case TemplateName::DeducedTemplate: {
+assert(IgnoreDeduced == false);
+DeducedTemplateStorage *DTS = Name.getAsDeducedTemplateName();
+DefaultArguments DefArgs = DTS->getDefaultArguments();
+TemplateName Underlying = DTS->getUnderlying();
+
+bool NonCanonical = false;
+TemplateName CanonUnderlying =
+getCanonicalTemplateName(Underlying, /*IgnoreDeduced=*/true);
+NonCanonical |= CanonUnderlying != Underlying;
+auto CanonArgs =
+getCanonicalTemplateArguments(*this, DefArgs.Args, NonCanonical);
+{
+  unsigned NumArgs = CanonArgs.size() - 1;
+  auto handleParamDefArg = [&](const TemplateArgument ,
+   unsigned I) {
+auto CanonParamDefArg = getCanonicalTemplateArgument(ParamDefArg);
+TemplateArgument  = CanonArgs[I];
+if (CanonDefArg.structurallyEquals(CanonParamDefArg))
+  return;
+if (I == NumArgs)
+  CanonArgs.pop_back();
+NonCanonical = true;
+  };
+  auto handleParam = [&](auto *TP, int I) -> bool {
+if (!TP->hasDefaultArgument())
+  return true;
+handleParamDefArg(TP->getDefaultArgument().getArgument(), I);
+return false;
+  };
+
+  ArrayRef Params = CanonUnderlying.getAsTemplateDecl()
+ ->getTemplateParameters()
+ ->asArray();
+  assert(CanonArgs.size() <= Params.size());
+  for (int I = NumArgs; I >= 0; --I) {

mizvekov wrote:

The code is correct, but the variable name is not right. Should have been 
`LastArgIndex` or some such.

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-06-12 Thread Matheus Izvekov via cfe-commits


@@ -6371,6 +6376,70 @@ ASTContext::getCanonicalTemplateName(const TemplateName 
) const {
 canonArgPack, subst->getAssociatedDecl()->getCanonicalDecl(),
 subst->getFinal(), subst->getIndex());
   }
+  case TemplateName::DeducedTemplate: {
+assert(IgnoreDeduced == false);
+DeducedTemplateStorage *DTS = Name.getAsDeducedTemplateName();
+DefaultArguments DefArgs = DTS->getDefaultArguments();
+TemplateName Underlying = DTS->getUnderlying();

mizvekov wrote:

They are pointer sized, it's the same as a QualType, and we never take those by 
reference either.

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

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 canonical
name would result in inconsistent preservation of as-written information
in the AST.

The true problem in #61317 is that we would not consider the methods
with requirements expression which contain DTSTs as the same
in relation to merging of declarations when importing modules.

The expressions would never match because they contained DTSTs pointing
to different redeclarations of the same class template, but since
canonicalization for them was broken, their canonical types would not
match either.

---

No changelog entry because #61317 was already claimed as fixed in
previous release.
---
 clang/include/clang/AST/ASTContext.h   |  7 +++
 clang/include/clang/AST/TemplateName.h |  4 +-
 clang/include/clang/AST/Type.h | 11 ++--
 clang/lib/AST/ASTContext.cpp   | 25 ++---
 clang/lib/AST/TemplateName.cpp |  9 
 clang/unittests/AST/CMakeLists.txt |  1 +
 clang/unittests/AST/ProfilingTest.cpp  | 75 ++
 7 files changed, 109 insertions(+), 23 deletions(-)
 create mode 100644 clang/unittests/AST/ProfilingTest.cpp

diff --git a/clang/include/clang/AST/ASTContext.h 
b/clang/include/clang/AST/ASTContext.h
index a1d1d1c51cd41..53ece996769a8 100644
--- a/clang/include/clang/AST/ASTContext.h
+++ b/clang/include/clang/AST/ASTContext.h
@@ -1771,6 +1771,13 @@ class ASTContext : public RefCountedBase {
 QualType DeducedType,
 bool IsDependent) const;
 
+private:
+  QualType getDeducedTemplateSpecializationTypeInternal(TemplateName Template,
+QualType DeducedType,
+bool IsDependent,
+QualType Canon) const;
+
+public:
   /// Return the unique reference to the type for the specified TagDecl
   /// (struct/union/class/enum) decl.
   QualType getTagDeclType(const TagDecl *Decl) const;
diff --git a/clang/include/clang/AST/TemplateName.h 
b/clang/include/clang/AST/TemplateName.h
index 988a55acd2252..24a7fde76195d 100644
--- a/clang/include/clang/AST/TemplateName.h
+++ b/clang/include/clang/AST/TemplateName.h
@@ -346,7 +346,9 @@ class TemplateName {
   /// error.
   void dump() const;
 
-  void Profile(llvm::FoldingSetNodeID );
+  void Profile(llvm::FoldingSetNodeID ) {
+ID.AddPointer(Storage.getOpaqueValue());
+  }
 
   /// Retrieve the template name as a void pointer.
   void *getAsVoidPointer() const { return Storage.getOpaqueValue(); }
diff --git a/clang/include/clang/AST/Type.h b/clang/include/clang/AST/Type.h
index 9eb3f6c09e3d3..fab233b62d8d1 100644
--- a/clang/include/clang/AST/Type.h
+++ b/clang/include/clang/AST/Type.h
@@ -6050,30 +6050,27 @@ class DeducedTemplateSpecializationType : public 
DeducedType,
 
   DeducedTemplateSpecializationType(TemplateName Template,
 QualType DeducedAsType,
-bool IsDeducedAsDependent)
+bool IsDeducedAsDependent, QualType Canon)
   : DeducedType(DeducedTemplateSpecialization, DeducedAsType,
 toTypeDependence(Template.getDependence()) |
 (IsDeducedAsDependent
  ? TypeDependence::DependentInstantiation
  : TypeDependence::None),
-DeducedAsType.isNull() ? QualType(this, 0)
-   : DeducedAsType.getCanonicalType()),
+Canon),
 Template(Template) {}
 
 public:
   /// Retrieve the name of the template that we are deducing.
   TemplateName getTemplateName() const { return Template;}
 
-  void Profile(llvm::FoldingSetNodeID ) {
+  void Profile(llvm::FoldingSetNodeID ) const {
 Profile(ID, getTemplateName(), getDeducedType(), isDependentType());
   }
 
   static void Profile(llvm::FoldingSetNodeID , TemplateName Template,
   QualType Deduced, bool IsDependent) {
 Template.Profile(ID);
-QualType CanonicalType =
-Deduced.isNull() ? Deduced : Deduced.getCanonicalType();
-ID.AddPointer(CanonicalType.getAsOpaquePtr());
+Deduced.Profile(ID);
 ID.AddBoolean(IsDependent || Template.isDependent());
   }
 
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index bf74e56a14799..34aa399fda2f8 100644
--- 

[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 defense here should have been code 
review.

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

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 canonical
name would result in inconsistent preservation of as-written information
in the AST.

The true problem in #61317 is that we would not consider the methods
with requirements expression which contain DTSTs as the same
in relation to merging of declarations when importing modules.

The expressions would never match because they contained DTSTs pointing
to different redeclarations of the same class template, but since
canonicalization for them was broken, their canonical types would not
match either.

---

No changelog entry because #61317 was already claimed as fixed in
previous release.
---
 clang/include/clang/AST/ASTContext.h   |  4 ++
 clang/include/clang/AST/TemplateName.h |  4 +-
 clang/include/clang/AST/Type.h | 11 ++--
 clang/lib/AST/ASTContext.cpp   | 25 ++---
 clang/lib/AST/TemplateName.cpp |  9 
 clang/unittests/AST/CMakeLists.txt |  1 +
 clang/unittests/AST/ProfilingTest.cpp  | 75 ++
 7 files changed, 106 insertions(+), 23 deletions(-)
 create mode 100644 clang/unittests/AST/ProfilingTest.cpp

diff --git a/clang/include/clang/AST/ASTContext.h 
b/clang/include/clang/AST/ASTContext.h
index a1d1d1c51cd41..5985887000d44 100644
--- a/clang/include/clang/AST/ASTContext.h
+++ b/clang/include/clang/AST/ASTContext.h
@@ -1770,6 +1770,10 @@ class ASTContext : public RefCountedBase {
   QualType getDeducedTemplateSpecializationType(TemplateName Template,
 QualType DeducedType,
 bool IsDependent) const;
+  QualType getDeducedTemplateSpecializationTypeInternal(TemplateName Template,
+QualType DeducedType,
+bool IsDependent,
+QualType Canon) const;
 
   /// Return the unique reference to the type for the specified TagDecl
   /// (struct/union/class/enum) decl.
diff --git a/clang/include/clang/AST/TemplateName.h 
b/clang/include/clang/AST/TemplateName.h
index 988a55acd2252..24a7fde76195d 100644
--- a/clang/include/clang/AST/TemplateName.h
+++ b/clang/include/clang/AST/TemplateName.h
@@ -346,7 +346,9 @@ class TemplateName {
   /// error.
   void dump() const;
 
-  void Profile(llvm::FoldingSetNodeID );
+  void Profile(llvm::FoldingSetNodeID ) {
+ID.AddPointer(Storage.getOpaqueValue());
+  }
 
   /// Retrieve the template name as a void pointer.
   void *getAsVoidPointer() const { return Storage.getOpaqueValue(); }
diff --git a/clang/include/clang/AST/Type.h b/clang/include/clang/AST/Type.h
index 9eb3f6c09e3d3..fab233b62d8d1 100644
--- a/clang/include/clang/AST/Type.h
+++ b/clang/include/clang/AST/Type.h
@@ -6050,30 +6050,27 @@ class DeducedTemplateSpecializationType : public 
DeducedType,
 
   DeducedTemplateSpecializationType(TemplateName Template,
 QualType DeducedAsType,
-bool IsDeducedAsDependent)
+bool IsDeducedAsDependent, QualType Canon)
   : DeducedType(DeducedTemplateSpecialization, DeducedAsType,
 toTypeDependence(Template.getDependence()) |
 (IsDeducedAsDependent
  ? TypeDependence::DependentInstantiation
  : TypeDependence::None),
-DeducedAsType.isNull() ? QualType(this, 0)
-   : DeducedAsType.getCanonicalType()),
+Canon),
 Template(Template) {}
 
 public:
   /// Retrieve the name of the template that we are deducing.
   TemplateName getTemplateName() const { return Template;}
 
-  void Profile(llvm::FoldingSetNodeID ) {
+  void Profile(llvm::FoldingSetNodeID ) const {
 Profile(ID, getTemplateName(), getDeducedType(), isDependentType());
   }
 
   static void Profile(llvm::FoldingSetNodeID , TemplateName Template,
   QualType Deduced, bool IsDependent) {
 Template.Profile(ID);
-QualType CanonicalType =
-Deduced.isNull() ? Deduced : Deduced.getCanonicalType();
-ID.AddPointer(CanonicalType.getAsOpaquePtr());
+Deduced.Profile(ID);
 ID.AddBoolean(IsDependent || Template.isDependent());
   }
 
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index bf74e56a14799..34aa399fda2f8 100644
--- 

[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 this though.

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] 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 gets caught incidentally in diagnostics for unrelated tests. In 
this case that incidental test was in libc++.

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] 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 canonical name 
would result in inconsistent preservation of as-written information in the AST.

The true problem in #61317 is that we would not consider the methods with 
requirements expression which contain DTSTs as the same in relation to merging 
of declarations when importing modules.

The expressions would never match because they contained DTSTs pointing to 
different redeclarations of the same class template, but since canonicalization 
for them was broken, their canonical types would not match either.

---

No changelog entry because #61317 was already claimed as fixed in previous 
release.

>From 71a827e8ff6dcc47f1fd434a19070e6f841ee27a 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
 DeducedTemplateSpecializationType

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 canonical
name would result in inconsistent preservation of as-written information
in the AST.

The true problem in #61317 is that we would not consider the methods
with requirements expression which contain DTSTs as the same
in relation to merging of declarations when importing modules.

The expressions would never match because they contained DTSTs pointing
to different redeclarations of the same class template, but since
canonicalization for them was broken, their canonical types would not
match either.

---

No changelog entry because #61317 was already claimed as fixed in
previous release.
---
 clang/include/clang/AST/ASTContext.h   |  4 
 clang/include/clang/AST/TemplateName.h |  4 +++-
 clang/include/clang/AST/Type.h |  9 +++--
 clang/lib/AST/ASTContext.cpp   | 25 +++--
 clang/lib/AST/TemplateName.cpp |  9 -
 5 files changed, 29 insertions(+), 22 deletions(-)

diff --git a/clang/include/clang/AST/ASTContext.h 
b/clang/include/clang/AST/ASTContext.h
index a1d1d1c51cd41..5985887000d44 100644
--- a/clang/include/clang/AST/ASTContext.h
+++ b/clang/include/clang/AST/ASTContext.h
@@ -1770,6 +1770,10 @@ class ASTContext : public RefCountedBase {
   QualType getDeducedTemplateSpecializationType(TemplateName Template,
 QualType DeducedType,
 bool IsDependent) const;
+  QualType getDeducedTemplateSpecializationTypeInternal(TemplateName Template,
+QualType DeducedType,
+bool IsDependent,
+QualType Canon) const;
 
   /// Return the unique reference to the type for the specified TagDecl
   /// (struct/union/class/enum) decl.
diff --git a/clang/include/clang/AST/TemplateName.h 
b/clang/include/clang/AST/TemplateName.h
index 988a55acd2252..24a7fde76195d 100644
--- a/clang/include/clang/AST/TemplateName.h
+++ b/clang/include/clang/AST/TemplateName.h
@@ -346,7 +346,9 @@ class TemplateName {
   /// error.
   void dump() const;
 
-  void Profile(llvm::FoldingSetNodeID );
+  void Profile(llvm::FoldingSetNodeID ) {
+ID.AddPointer(Storage.getOpaqueValue());
+  }
 
   /// Retrieve the template name as a void pointer.
   void *getAsVoidPointer() const { return Storage.getOpaqueValue(); }
diff --git a/clang/include/clang/AST/Type.h b/clang/include/clang/AST/Type.h
index 9eb3f6c09e3d3..f557697da74c6 100644
--- a/clang/include/clang/AST/Type.h
+++ b/clang/include/clang/AST/Type.h
@@ -6050,14 +6050,13 @@ class DeducedTemplateSpecializationType : public 
DeducedType,
 
   DeducedTemplateSpecializationType(TemplateName Template,
 QualType DeducedAsType,
-bool IsDeducedAsDependent)
+bool IsDeducedAsDependent, QualType Canon)
   : DeducedType(DeducedTemplateSpecialization, DeducedAsType,
 toTypeDependence(Template.getDependence()) |
 (IsDeducedAsDependent
  ? TypeDependence::DependentInstantiation
  : TypeDependence::None),
-DeducedAsType.isNull() ? QualType(this, 0)
-   : DeducedAsType.getCanonicalType()),
+Canon),
 Template(Template) {}
 
 public:
@@ -6071,9 +6070,7 @@ class DeducedTemplateSpecializationType : public 
DeducedType,
   static void Profile(llvm::FoldingSetNodeID , TemplateName 

[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 wrote:

runWithSufficientStackSpace is a small helper used to prevent stack exhaustion.

https://github.com/llvm/llvm-project/pull/95195
___
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
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

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/89807.

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.

Given the following example:
```C++
template  struct A;
template  struct B;

template  class TT1, class T5> struct B>;   // #1
template   struct B>; // #2

template struct B>;
```
Prior to P0522, `#2` was picked. Afterwards, this became ambiguous.
This patch restores the pre-P0522 behavior, `#2` is picked again.

As the consequences are not restricted to partial ordering,
the following code becomes valid:
```C++
template struct A {};
A v;
template class TT> void f(TT);

// OK: TT picks 'float' as the default argument for the second parameter.
void g() { f(v); }
```

Also, since 'f' deduced from `A` is different from 'f'
deduced from `A`, this implements an additional mangling
rule.

---

Since this changes provisional implementation of CWG2398 which has
not been released yet, and already contains a changelog entry,
we don't provide a changelog entry here.
---
 clang-tools-extra/clangd/DumpAST.cpp  |   1 +
 .../clangd/SemanticHighlighting.cpp   |   1 +
 clang/include/clang/AST/ASTContext.h  |   8 +-
 clang/include/clang/AST/ASTImporter.h |   5 +
 clang/include/clang/AST/DependenceFlags.h |   5 +
 clang/include/clang/AST/PropertiesBase.td |  17 ++
 clang/include/clang/AST/TemplateName.h|  59 ++-
 clang/include/clang/Sema/Sema.h   |  10 +-
 clang/lib/AST/ASTContext.cpp  | 129 --
 clang/lib/AST/ASTDiagnostic.cpp   |  24 +--
 clang/lib/AST/ASTImporter.cpp |  15 ++
 clang/lib/AST/ASTStructuralEquivalence.cpp|   3 +
 clang/lib/AST/ItaniumMangle.cpp   |  11 ++
 clang/lib/AST/ODRHash.cpp |   1 +
 clang/lib/AST/TemplateName.cpp| 157 ++
 clang/lib/AST/TextNodeDumper.cpp  |  12 ++
 clang/lib/AST/Type.cpp|   3 +-
 clang/lib/Sema/SemaTemplate.cpp   |  63 +--
 clang/lib/Sema/SemaTemplateDeduction.cpp  | 128 --
 .../lib/Sema/SemaTemplateInstantiateDecl.cpp  |  24 +--
 .../CXX/temp/temp.decls/temp.alias/p2.cpp |   5 +-
 clang/test/CodeGenCXX/mangle-cwg2398.cpp  |  11 ++
 clang/test/SemaTemplate/cwg2398.cpp   |  60 +--
 clang/tools/libclang/CIndex.cpp   |   3 +
 clang/unittests/AST/ASTImporterTest.cpp   |  17 ++
 25 files changed, 564 insertions(+), 208 deletions(-)
 create mode 100644 clang/test/CodeGenCXX/mangle-cwg2398.cpp

diff --git a/clang-tools-extra/clangd/DumpAST.cpp 
b/clang-tools-extra/clangd/DumpAST.cpp
index 9a525efb938e8..e605f82e91fe4 100644
--- a/clang-tools-extra/clangd/DumpAST.cpp
+++ b/clang-tools-extra/clangd/DumpAST.cpp
@@ -187,6 +187,7 @@ class DumpVisitor : public RecursiveASTVisitor 
{
   TEMPLATE_KIND(SubstTemplateTemplateParm);
   TEMPLATE_KIND(SubstTemplateTemplateParmPack);
   TEMPLATE_KIND(UsingTemplate);
+  TEMPLATE_KIND(DeducedTemplate);
 #undef TEMPLATE_KIND
 }
 llvm_unreachable("Unhandled NameKind enum");
diff --git a/clang-tools-extra/clangd/SemanticHighlighting.cpp 
b/clang-tools-extra/clangd/SemanticHighlighting.cpp
index a366f1331c2d3..e6d16af2495fe 100644
--- a/clang-tools-extra/clangd/SemanticHighlighting.cpp
+++ b/clang-tools-extra/clangd/SemanticHighlighting.cpp
@@ -1120,6 +1120,7 @@ class CollectExtraHighlightings
 case TemplateName::SubstTemplateTemplateParm:
 case TemplateName::SubstTemplateTemplateParmPack:
 case TemplateName::UsingTemplate:
+case TemplateName::DeducedTemplate:
   // Names that could be resolved to a TemplateDecl are handled elsewhere.
   break;
 }
diff --git a/clang/include/clang/AST/ASTContext.h 
b/clang/include/clang/AST/ASTContext.h
index 8bce4812f0d48..8818314de9364 100644
--- a/clang/include/clang/AST/ASTContext.h
+++ b/clang/include/clang/AST/ASTContext.h
@@ -262,6 +262,8 @@ class ASTContext : public RefCountedBase {
   mutable llvm::ContextualFoldingSet
 SubstTemplateTemplateParmPacks;
+  mutable llvm::ContextualFoldingSet
+  DeducedTemplates;
 
   mutable llvm::ContextualFoldingSet
   ArrayParameterTypes;
@@ -2247,6 +2249,9 @@ class ASTContext : public RefCountedBase {
 unsigned Index,

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

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/89807.

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.

Given the following example:
```C++
template  struct A;
template  struct B;

template  class TT1, class T5> struct B>;   // #1
template   struct B>; // #2

template struct B>;
```
Prior to P0522, `#2` was picked. Afterwards, this became ambiguous.
This patch restores the pre-P0522 behavior, `#2` is picked again.

As the consequences are not restricted to partial ordering,
the following code becomes valid:
```C++
template struct A {};
A v;
template class TT> void f(TT);

// OK: TT picks 'float' as the default argument for the second parameter.
void g() { f(v); }
```

Also, since 'f' deduced from `A` is different from 'f'
deduced from `A`, this implements an additional mangling
rule.

---

Since this changes provisional implementation of CWG2398 which has
not been released yet, and already contains a changelog entry,
we don't provide a changelog entry here.
---
 clang-tools-extra/clangd/DumpAST.cpp  |   1 +
 .../clangd/SemanticHighlighting.cpp   |   1 +
 clang/include/clang/AST/ASTContext.h  |   8 +-
 clang/include/clang/AST/ASTImporter.h |   5 +
 clang/include/clang/AST/DependenceFlags.h |   5 +
 clang/include/clang/AST/PropertiesBase.td |  17 ++
 clang/include/clang/AST/TemplateName.h|  59 ++-
 clang/include/clang/Sema/Sema.h   |  10 +-
 clang/lib/AST/ASTContext.cpp  | 129 --
 clang/lib/AST/ASTDiagnostic.cpp   |  24 +--
 clang/lib/AST/ASTImporter.cpp |  92 +-
 clang/lib/AST/ASTStructuralEquivalence.cpp|   3 +
 clang/lib/AST/ItaniumMangle.cpp   |  11 ++
 clang/lib/AST/ODRHash.cpp |   1 +
 clang/lib/AST/TemplateName.cpp| 157 ++
 clang/lib/AST/TextNodeDumper.cpp  |  12 ++
 clang/lib/AST/Type.cpp|   3 +-
 clang/lib/Sema/SemaTemplate.cpp   |  63 +--
 clang/lib/Sema/SemaTemplateDeduction.cpp  | 128 --
 .../lib/Sema/SemaTemplateInstantiateDecl.cpp  |  24 +--
 .../CXX/temp/temp.decls/temp.alias/p2.cpp |   5 +-
 clang/test/CodeGenCXX/mangle-cwg2398.cpp  |  11 ++
 clang/test/SemaTemplate/cwg2398.cpp   |  60 +--
 clang/tools/libclang/CIndex.cpp   |   3 +
 clang/unittests/AST/ASTImporterTest.cpp   |  17 ++
 25 files changed, 594 insertions(+), 255 deletions(-)
 create mode 100644 clang/test/CodeGenCXX/mangle-cwg2398.cpp

diff --git a/clang-tools-extra/clangd/DumpAST.cpp 
b/clang-tools-extra/clangd/DumpAST.cpp
index 9a525efb938e8..e605f82e91fe4 100644
--- a/clang-tools-extra/clangd/DumpAST.cpp
+++ b/clang-tools-extra/clangd/DumpAST.cpp
@@ -187,6 +187,7 @@ class DumpVisitor : public RecursiveASTVisitor 
{
   TEMPLATE_KIND(SubstTemplateTemplateParm);
   TEMPLATE_KIND(SubstTemplateTemplateParmPack);
   TEMPLATE_KIND(UsingTemplate);
+  TEMPLATE_KIND(DeducedTemplate);
 #undef TEMPLATE_KIND
 }
 llvm_unreachable("Unhandled NameKind enum");
diff --git a/clang-tools-extra/clangd/SemanticHighlighting.cpp 
b/clang-tools-extra/clangd/SemanticHighlighting.cpp
index a366f1331c2d3..e6d16af2495fe 100644
--- a/clang-tools-extra/clangd/SemanticHighlighting.cpp
+++ b/clang-tools-extra/clangd/SemanticHighlighting.cpp
@@ -1120,6 +1120,7 @@ class CollectExtraHighlightings
 case TemplateName::SubstTemplateTemplateParm:
 case TemplateName::SubstTemplateTemplateParmPack:
 case TemplateName::UsingTemplate:
+case TemplateName::DeducedTemplate:
   // Names that could be resolved to a TemplateDecl are handled elsewhere.
   break;
 }
diff --git a/clang/include/clang/AST/ASTContext.h 
b/clang/include/clang/AST/ASTContext.h
index 8bce4812f0d48..8818314de9364 100644
--- a/clang/include/clang/AST/ASTContext.h
+++ b/clang/include/clang/AST/ASTContext.h
@@ -262,6 +262,8 @@ class ASTContext : public RefCountedBase {
   mutable llvm::ContextualFoldingSet
 SubstTemplateTemplateParmPacks;
+  mutable llvm::ContextualFoldingSet
+  DeducedTemplates;
 
   mutable llvm::ContextualFoldingSet
   ArrayParameterTypes;
@@ -2247,6 +2249,9 @@ class ASTContext : public RefCountedBase {
 unsigned Index,

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

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/89807.

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.

Given the following example:
```C++
template  struct A;
template  struct B;

template  class TT1, class T5> struct B>;   // #1
template   struct B>; // #2

template struct B>;
```
Prior to P0522, `#2` was picked. Afterwards, this became ambiguous.
This patch restores the pre-P0522 behavior, `#2` is picked again.

As the consequences are not restricted to partial ordering,
the following code becomes valid:
```C++
template struct A {};
A v;
template class TT> void f(TT);

// OK: TT picks 'float' as the default argument for the second parameter.
void g() { f(v); }
```

Also, since 'f' deduced from `A` is different from 'f'
deduced from `A`, this implements an additional mangling
rule.

---

Since this changes provisional implementation of CWG2398 which has
not been released yet, and already contains a changelog entry,
we don't provide a changelog entry here.
---
 clang-tools-extra/clangd/DumpAST.cpp  |   1 +
 .../clangd/SemanticHighlighting.cpp   |   1 +
 clang/include/clang/AST/ASTContext.h  |   8 +-
 clang/include/clang/AST/ASTImporter.h |   5 +
 clang/include/clang/AST/DependenceFlags.h |   5 +
 clang/include/clang/AST/PropertiesBase.td |  17 ++
 clang/include/clang/AST/TemplateName.h|  59 ++-
 clang/include/clang/Sema/Sema.h   |  10 +-
 clang/lib/AST/ASTContext.cpp  | 129 --
 clang/lib/AST/ASTDiagnostic.cpp   |  24 +--
 clang/lib/AST/ASTImporter.cpp |  92 +-
 clang/lib/AST/ASTStructuralEquivalence.cpp|   3 +
 clang/lib/AST/ItaniumMangle.cpp   |  11 ++
 clang/lib/AST/ODRHash.cpp |   1 +
 clang/lib/AST/TemplateName.cpp| 157 ++
 clang/lib/AST/TextNodeDumper.cpp  |  12 ++
 clang/lib/AST/Type.cpp|   3 +-
 clang/lib/Sema/SemaTemplate.cpp   |  63 +--
 clang/lib/Sema/SemaTemplateDeduction.cpp  | 134 ---
 .../lib/Sema/SemaTemplateInstantiateDecl.cpp  |  24 +--
 .../CXX/temp/temp.decls/temp.alias/p2.cpp |   5 +-
 clang/test/CodeGenCXX/mangle-cwg2398.cpp  |  11 ++
 clang/test/SemaTemplate/cwg2398.cpp   |  60 +--
 clang/tools/libclang/CIndex.cpp   |   3 +
 clang/unittests/AST/ASTImporterTest.cpp   |  17 ++
 25 files changed, 600 insertions(+), 255 deletions(-)
 create mode 100644 clang/test/CodeGenCXX/mangle-cwg2398.cpp

diff --git a/clang-tools-extra/clangd/DumpAST.cpp 
b/clang-tools-extra/clangd/DumpAST.cpp
index 9a525efb938e8..e605f82e91fe4 100644
--- a/clang-tools-extra/clangd/DumpAST.cpp
+++ b/clang-tools-extra/clangd/DumpAST.cpp
@@ -187,6 +187,7 @@ class DumpVisitor : public RecursiveASTVisitor 
{
   TEMPLATE_KIND(SubstTemplateTemplateParm);
   TEMPLATE_KIND(SubstTemplateTemplateParmPack);
   TEMPLATE_KIND(UsingTemplate);
+  TEMPLATE_KIND(DeducedTemplate);
 #undef TEMPLATE_KIND
 }
 llvm_unreachable("Unhandled NameKind enum");
diff --git a/clang-tools-extra/clangd/SemanticHighlighting.cpp 
b/clang-tools-extra/clangd/SemanticHighlighting.cpp
index a366f1331c2d3..e6d16af2495fe 100644
--- a/clang-tools-extra/clangd/SemanticHighlighting.cpp
+++ b/clang-tools-extra/clangd/SemanticHighlighting.cpp
@@ -1120,6 +1120,7 @@ class CollectExtraHighlightings
 case TemplateName::SubstTemplateTemplateParm:
 case TemplateName::SubstTemplateTemplateParmPack:
 case TemplateName::UsingTemplate:
+case TemplateName::DeducedTemplate:
   // Names that could be resolved to a TemplateDecl are handled elsewhere.
   break;
 }
diff --git a/clang/include/clang/AST/ASTContext.h 
b/clang/include/clang/AST/ASTContext.h
index 8bce4812f0d48..8818314de9364 100644
--- a/clang/include/clang/AST/ASTContext.h
+++ b/clang/include/clang/AST/ASTContext.h
@@ -262,6 +262,8 @@ class ASTContext : public RefCountedBase {
   mutable llvm::ContextualFoldingSet
 SubstTemplateTemplateParmPacks;
+  mutable llvm::ContextualFoldingSet
+  DeducedTemplates;
 
   mutable llvm::ContextualFoldingSet
   ArrayParameterTypes;
@@ -2247,6 +2249,9 @@ class ASTContext : public RefCountedBase {
 unsigned Index,
   

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

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/89807.

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.

Given the following example:
```C++
template  struct A;
template  struct B;

template  class TT1, class T5> struct B>;   // #1
template   struct B>; // #2

template struct B>;
```
Prior to P0522, `#2` was picked. Afterwards, this became ambiguous.
This patch restores the pre-P0522 behavior, `#2` is picked again.

As the consequences are not restricted to partial ordering,
the following code becomes valid:
```C++
template struct A {};
A v;
template class TT> void f(TT);

// OK: TT picks 'float' as the default argument for the second parameter.
void g() { f(v); }
```

Also, since 'f' deduced from `A` is different from 'f'
deduced from `A`, this implements an additional mangling
rule.

---

Since this changes provisional implementation of CWG2398 which has
not been released yet, and already contains a changelog entry,
we don't provide a changelog entry here.
---
 clang-tools-extra/clangd/DumpAST.cpp  |   1 +
 .../clangd/SemanticHighlighting.cpp   |   1 +
 clang/include/clang/AST/ASTContext.h  |   8 +-
 clang/include/clang/AST/ASTImporter.h |   5 +
 clang/include/clang/AST/DependenceFlags.h |   5 +
 clang/include/clang/AST/PropertiesBase.td |  17 ++
 clang/include/clang/AST/TemplateName.h|  59 ++-
 clang/include/clang/Sema/Sema.h   |  10 +-
 clang/lib/AST/ASTContext.cpp  | 129 --
 clang/lib/AST/ASTDiagnostic.cpp   |  24 +--
 clang/lib/AST/ASTImporter.cpp |  92 +-
 clang/lib/AST/ASTStructuralEquivalence.cpp|   3 +
 clang/lib/AST/ItaniumMangle.cpp   |  11 ++
 clang/lib/AST/ODRHash.cpp |   1 +
 clang/lib/AST/TemplateName.cpp| 157 ++
 clang/lib/AST/TextNodeDumper.cpp  |  12 ++
 clang/lib/AST/Type.cpp|   3 +-
 clang/lib/Sema/SemaTemplate.cpp   |  63 +--
 clang/lib/Sema/SemaTemplateDeduction.cpp  | 134 ---
 .../lib/Sema/SemaTemplateInstantiateDecl.cpp  |  24 +--
 .../CXX/temp/temp.decls/temp.alias/p2.cpp |   5 +-
 clang/test/CodeGenCXX/mangle-cwg2398.cpp  |  11 ++
 clang/test/SemaTemplate/cwg2398.cpp   |  44 +++--
 clang/tools/libclang/CIndex.cpp   |   3 +
 clang/unittests/AST/ASTImporterTest.cpp   |  17 ++
 25 files changed, 584 insertions(+), 255 deletions(-)
 create mode 100644 clang/test/CodeGenCXX/mangle-cwg2398.cpp

diff --git a/clang-tools-extra/clangd/DumpAST.cpp 
b/clang-tools-extra/clangd/DumpAST.cpp
index 9a525efb938e8..e605f82e91fe4 100644
--- a/clang-tools-extra/clangd/DumpAST.cpp
+++ b/clang-tools-extra/clangd/DumpAST.cpp
@@ -187,6 +187,7 @@ class DumpVisitor : public RecursiveASTVisitor 
{
   TEMPLATE_KIND(SubstTemplateTemplateParm);
   TEMPLATE_KIND(SubstTemplateTemplateParmPack);
   TEMPLATE_KIND(UsingTemplate);
+  TEMPLATE_KIND(DeducedTemplate);
 #undef TEMPLATE_KIND
 }
 llvm_unreachable("Unhandled NameKind enum");
diff --git a/clang-tools-extra/clangd/SemanticHighlighting.cpp 
b/clang-tools-extra/clangd/SemanticHighlighting.cpp
index a366f1331c2d3..e6d16af2495fe 100644
--- a/clang-tools-extra/clangd/SemanticHighlighting.cpp
+++ b/clang-tools-extra/clangd/SemanticHighlighting.cpp
@@ -1120,6 +1120,7 @@ class CollectExtraHighlightings
 case TemplateName::SubstTemplateTemplateParm:
 case TemplateName::SubstTemplateTemplateParmPack:
 case TemplateName::UsingTemplate:
+case TemplateName::DeducedTemplate:
   // Names that could be resolved to a TemplateDecl are handled elsewhere.
   break;
 }
diff --git a/clang/include/clang/AST/ASTContext.h 
b/clang/include/clang/AST/ASTContext.h
index 8bce4812f0d48..8818314de9364 100644
--- a/clang/include/clang/AST/ASTContext.h
+++ b/clang/include/clang/AST/ASTContext.h
@@ -262,6 +262,8 @@ class ASTContext : public RefCountedBase {
   mutable llvm::ContextualFoldingSet
 SubstTemplateTemplateParmPacks;
+  mutable llvm::ContextualFoldingSet
+  DeducedTemplates;
 
   mutable llvm::ContextualFoldingSet
   ArrayParameterTypes;
@@ -2247,6 +2249,9 @@ class ASTContext : public RefCountedBase {
 unsigned Index,
 

[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/89807.

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.

Given the following example:
```C++
template  struct A;
template  struct B;

template  class TT1, class T5> struct B>;   // #1
template   struct B>; // #2

template struct B>;
```
Prior to P0522, `#2` was picked. Afterwards, this became ambiguous. This patch 
restores the pre-P0522 behavior, `#2` is picked again.

As the consequences are not restricted to partial ordering, the following code 
becomes valid:
```C++
template struct A {};
A v;
template class TT> void f(TT);

// OK: TT picks 'float' as the default argument for the second parameter.
void g() { f(v); }
```

Also, since 'f' deduced from `A` is different from 'f' deduced from 
`A`, this implements an additional mangling rule.

---

Since this changes provisional implementation of CWG2398 which has not been 
released yet, and already contains a changelog entry, we don't provide a 
changelog entry here.

>From 28bc152e72d458e91aee90d46763eea04091ebe2 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
 templates

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/89807.

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.

Given the following example:
```C++
template  struct A;
template  struct B;

template  class TT1, class T5> struct B>;   // #1
template   struct B>; // #2

template struct B>;
```
Prior to P0522, `#2` was picked. Afterwards, this became ambiguous.
This patch restores the pre-P0522 behavior, `#2` is picked again.

As the consequences are not restricted to partial ordering,
the following code becomes valid:
```C++
template struct A {};
A v;
template class TT> void f(TT);

// OK: TT picks 'float' as the default argument for the second parameter.
void g() { f(v); }
```

Also, since 'f' deduced from `A` is different from 'f'
deduced from `A`, this implements an additional mangling
rule.

---

Since this changes provisional implementation of CWG2398 which has
not been released yet, and already contains a changelog entry,
we don't provide a changelog entry here.
---
 clang-tools-extra/clangd/DumpAST.cpp  |   1 +
 .../clangd/SemanticHighlighting.cpp   |   1 +
 clang/include/clang/AST/ASTContext.h  |   8 +-
 clang/include/clang/AST/ASTImporter.h |   5 +
 clang/include/clang/AST/DependenceFlags.h |   5 +
 clang/include/clang/AST/PropertiesBase.td |  17 ++
 clang/include/clang/AST/TemplateName.h|  59 ++-
 clang/include/clang/Sema/Sema.h   |  10 +-
 clang/lib/AST/ASTContext.cpp  | 129 --
 clang/lib/AST/ASTDiagnostic.cpp   |  24 +--
 clang/lib/AST/ASTImporter.cpp |  92 +-
 clang/lib/AST/ASTStructuralEquivalence.cpp|   3 +
 clang/lib/AST/ItaniumMangle.cpp   |  11 ++
 clang/lib/AST/ODRHash.cpp |   1 +
 clang/lib/AST/TemplateName.cpp| 157 ++
 clang/lib/AST/TextNodeDumper.cpp  |  12 ++
 clang/lib/AST/Type.cpp|   3 +-
 clang/lib/Sema/SemaTemplate.cpp   |  63 +--
 clang/lib/Sema/SemaTemplateDeduction.cpp  | 133 ---
 .../lib/Sema/SemaTemplateInstantiateDecl.cpp  |  24 +--
 .../CXX/temp/temp.decls/temp.alias/p2.cpp |   5 +-
 clang/test/CodeGenCXX/mangle-cwg2398.cpp  |  11 ++
 clang/test/SemaTemplate/cwg2398.cpp   |  43 +++--
 clang/tools/libclang/CIndex.cpp   |   3 +
 clang/unittests/AST/ASTImporterTest.cpp   |  17 ++
 25 files changed, 582 insertions(+), 255 deletions(-)
 create mode 100644 clang/test/CodeGenCXX/mangle-cwg2398.cpp

diff --git a/clang-tools-extra/clangd/DumpAST.cpp 
b/clang-tools-extra/clangd/DumpAST.cpp
index 9a525efb938e8..e605f82e91fe4 100644
--- a/clang-tools-extra/clangd/DumpAST.cpp
+++ b/clang-tools-extra/clangd/DumpAST.cpp
@@ -187,6 +187,7 @@ class DumpVisitor : public RecursiveASTVisitor 
{
   TEMPLATE_KIND(SubstTemplateTemplateParm);
   TEMPLATE_KIND(SubstTemplateTemplateParmPack);
   TEMPLATE_KIND(UsingTemplate);
+  TEMPLATE_KIND(DeducedTemplate);
 

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

These will work as AST Text node dumpers, as usual, instead of AST
printers.

Note that for now, the TemplateName dumper is using the TemplateArgument
dumper through an implicit conversion.
This can be fixed in a later pass.
---
 clang/include/clang/AST/TemplateBase.h |  2 +-
 clang/include/clang/AST/TemplateName.h |  2 +-
 clang/lib/AST/ASTDumper.cpp| 34 ++
 clang/lib/AST/TemplateBase.cpp |  9 ---
 clang/lib/AST/TemplateName.cpp | 11 -
 5 files changed, 36 insertions(+), 22 deletions(-)

diff --git a/clang/include/clang/AST/TemplateBase.h 
b/clang/include/clang/AST/TemplateBase.h
index fea2c8ccfee67..0eaa4b0eedb35 100644
--- a/clang/include/clang/AST/TemplateBase.h
+++ b/clang/include/clang/AST/TemplateBase.h
@@ -459,7 +459,7 @@ class TemplateArgument {
  bool IncludeType) const;
 
   /// Debugging aid that dumps the template argument.
-  void dump(raw_ostream ) const;
+  void dump(raw_ostream , const ASTContext ) const;
 
   /// Debugging aid that dumps the template argument to standard error.
   void dump() const;
diff --git a/clang/include/clang/AST/TemplateName.h 
b/clang/include/clang/AST/TemplateName.h
index 489fccb2ef74d..988a55acd2252 100644
--- a/clang/include/clang/AST/TemplateName.h
+++ b/clang/include/clang/AST/TemplateName.h
@@ -340,7 +340,7 @@ class TemplateName {
  Qualified Qual = Qualified::AsWritten) const;
 
   /// Debugging aid that dumps the template name.
-  void dump(raw_ostream ) const;
+  void dump(raw_ostream , const ASTContext ) const;
 
   /// Debugging aid that dumps the template name to standard
   /// error.
diff --git a/clang/lib/AST/ASTDumper.cpp b/clang/lib/AST/ASTDumper.cpp
index c8973fdeda352..f0603880c32dd 100644
--- a/clang/lib/AST/ASTDumper.cpp
+++ b/clang/lib/AST/ASTDumper.cpp
@@ -360,3 +360,37 @@ LLVM_DUMP_METHOD void ConceptReference::dump(raw_ostream 
) const {
   ASTDumper P(OS, Ctx, Ctx.getDiagnostics().getShowColors());
   P.Visit(this);
 }
+
+//===--===//
+// TemplateName method implementations
+//===--===//
+
+// FIXME: These are actually using the TemplateArgument dumper, through
+// an implicit conversion. The dump will claim this is a template argument,
+// which is misleading.
+
+LLVM_DUMP_METHOD void TemplateName::dump() const {
+  ASTDumper Dumper(llvm::errs(), /*ShowColors=*/false);
+  Dumper.Visit(*this);
+}
+
+LLVM_DUMP_METHOD void TemplateName::dump(llvm::raw_ostream ,
+ const ASTContext ) const {
+  ASTDumper Dumper(OS, Context, Context.getDiagnostics().getShowColors());
+  Dumper.Visit(*this);
+}
+
+//===--===//
+// TemplateArgument method implementations
+//===--===//
+
+LLVM_DUMP_METHOD void TemplateArgument::dump() const {
+  ASTDumper Dumper(llvm::errs(), /*ShowColors=*/false);
+  Dumper.Visit(*this);
+}
+
+LLVM_DUMP_METHOD void TemplateArgument::dump(llvm::raw_ostream ,
+ const ASTContext ) const {
+  ASTDumper Dumper(OS, Context, Context.getDiagnostics().getShowColors());
+  Dumper.Visit(*this);
+}
diff --git a/clang/lib/AST/TemplateBase.cpp b/clang/lib/AST/TemplateBase.cpp
index 46f7b79b272ef..2e6839e948d9d 100644
--- a/clang/lib/AST/TemplateBase.cpp
+++ b/clang/lib/AST/TemplateBase.cpp
@@ -577,15 +577,6 @@ void TemplateArgument::print(const PrintingPolicy , 
raw_ostream ,
   }
 }
 
-void TemplateArgument::dump(raw_ostream ) const {
-  LangOptions LO; // FIXME! see also TemplateName::dump().
-  LO.CPlusPlus = true;
-  LO.Bool = true;
-  print(PrintingPolicy(LO), Out, /*IncludeType*/ true);
-}
-
-LLVM_DUMP_METHOD void TemplateArgument::dump() const { dump(llvm::errs()); }
-
 
//===--===//
 // TemplateArgumentLoc Implementation
 
//===--===//
diff --git a/clang/lib/AST/TemplateName.cpp b/clang/lib/AST/TemplateName.cpp
index 4fc25cb34803e..11544dbb56e31 100644
--- a/clang/lib/AST/TemplateName.cpp
+++ b/clang/lib/AST/TemplateName.cpp
@@ -360,14 +360,3 @@ const StreamingDiagnostic ::operator<<(const 
StreamingDiagnostic ,
   OS.flush();
   return DB << NameStr;
 }
-
-void TemplateName::dump(raw_ostream ) const {
-  LangOptions LO;  // FIXME!
-  LO.CPlusPlus = true;
-  LO.Bool = true;
-  print(OS, PrintingPolicy(LO));
-}
-
-LLVM_DUMP_METHOD void TemplateName::dump() const {
-  

[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 
) const {
   ASTDumper P(OS, Ctx, Ctx.getDiagnostics().getShowColors());
   P.Visit(this);
 }
+
+//===--===//
+// TemplateName method implementations
+//===--===//
+
+// FIXME: These are using the TemplateArgument dumper.

mizvekov wrote:

Well you are going to hit dump on a TemplateName, and it's going to dump a 
TemplateArgument of template kind, which is misleading and incorrect, but still 
helpful in the narrow context this is a debugging aid not actually used in 
production.

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] NFCI: improve TemplateArgument and TemplateName dump methods (PR #94905)

2024-06-09 Thread Matheus Izvekov via cfe-commits

https://github.com/mizvekov edited 
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] improve TemplateArgument and TemplateName dump methods (PR #94905)

2024-06-09 Thread Matheus Izvekov via cfe-commits

https://github.com/mizvekov created 
https://github.com/llvm/llvm-project/pull/94905

These will work as AST Text node dumpers, as usual, instead of AST printers.

Note that for now, the TemplateName dumper is using the TemplateArgument dumper 
through an implicit conversion.
This can be fixed in a later pass.

>From fb159ba1974e9311818892950c301f590bbe6360 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

These will work as AST Text node dumpers, as usual, instead of AST
printers.

Note that for now, the TemplateName dumper is using the TemplateArgument
dumper through an implicit conversion.
This can be fixed in a later pass.
---
 clang/include/clang/AST/TemplateBase.h |  2 +-
 clang/include/clang/AST/TemplateName.h |  2 +-
 clang/lib/AST/ASTDumper.cpp| 31 ++
 clang/lib/AST/TemplateBase.cpp |  9 
 clang/lib/AST/TemplateName.cpp | 11 -
 5 files changed, 33 insertions(+), 22 deletions(-)

diff --git a/clang/include/clang/AST/TemplateBase.h 
b/clang/include/clang/AST/TemplateBase.h
index fea2c8ccfee67..0eaa4b0eedb35 100644
--- a/clang/include/clang/AST/TemplateBase.h
+++ b/clang/include/clang/AST/TemplateBase.h
@@ -459,7 +459,7 @@ class TemplateArgument {
  bool IncludeType) const;
 
   /// Debugging aid that dumps the template argument.
-  void dump(raw_ostream ) const;
+  void dump(raw_ostream , const ASTContext ) const;
 
   /// Debugging aid that dumps the template argument to standard error.
   void dump() const;
diff --git a/clang/include/clang/AST/TemplateName.h 
b/clang/include/clang/AST/TemplateName.h
index 489fccb2ef74d..988a55acd2252 100644
--- a/clang/include/clang/AST/TemplateName.h
+++ b/clang/include/clang/AST/TemplateName.h
@@ -340,7 +340,7 @@ class TemplateName {
  Qualified Qual = Qualified::AsWritten) const;
 
   /// Debugging aid that dumps the template name.
-  void dump(raw_ostream ) const;
+  void dump(raw_ostream , const ASTContext ) const;
 
   /// Debugging aid that dumps the template name to standard
   /// error.
diff --git a/clang/lib/AST/ASTDumper.cpp b/clang/lib/AST/ASTDumper.cpp
index c8973fdeda352..869527241f2c8 100644
--- a/clang/lib/AST/ASTDumper.cpp
+++ b/clang/lib/AST/ASTDumper.cpp
@@ -360,3 +360,34 @@ LLVM_DUMP_METHOD void ConceptReference::dump(raw_ostream 
) const {
   ASTDumper P(OS, Ctx, Ctx.getDiagnostics().getShowColors());
   P.Visit(this);
 }
+
+//===--===//
+// TemplateName method implementations
+//===--===//
+
+// FIXME: These are using the TemplateArgument dumper.
+LLVM_DUMP_METHOD void TemplateName::dump() const {
+  ASTDumper Dumper(llvm::errs(), /*ShowColors=*/false);
+  Dumper.Visit(*this);
+}
+
+LLVM_DUMP_METHOD void TemplateName::dump(llvm::raw_ostream ,
+ const ASTContext ) const {
+  ASTDumper Dumper(OS, Context, Context.getDiagnostics().getShowColors());
+  Dumper.Visit(*this);
+}
+
+//===--===//
+// TemplateArgument method implementations
+//===--===//
+
+LLVM_DUMP_METHOD void TemplateArgument::dump() const {
+  ASTDumper Dumper(llvm::errs(), /*ShowColors=*/false);
+  Dumper.Visit(*this);
+}
+
+LLVM_DUMP_METHOD void TemplateArgument::dump(llvm::raw_ostream ,
+ const ASTContext ) const {
+  ASTDumper Dumper(OS, Context, Context.getDiagnostics().getShowColors());
+  Dumper.Visit(*this);
+}
diff --git a/clang/lib/AST/TemplateBase.cpp b/clang/lib/AST/TemplateBase.cpp
index 46f7b79b272ef..2e6839e948d9d 100644
--- a/clang/lib/AST/TemplateBase.cpp
+++ b/clang/lib/AST/TemplateBase.cpp
@@ -577,15 +577,6 @@ void TemplateArgument::print(const PrintingPolicy , 
raw_ostream ,
   }
 }
 
-void TemplateArgument::dump(raw_ostream ) const {
-  LangOptions LO; // FIXME! see also TemplateName::dump().
-  LO.CPlusPlus = true;
-  LO.Bool = true;
-  print(PrintingPolicy(LO), Out, /*IncludeType*/ true);
-}
-
-LLVM_DUMP_METHOD void TemplateArgument::dump() const { dump(llvm::errs()); }
-
 
//===--===//
 // TemplateArgumentLoc Implementation
 
//===--===//
diff --git a/clang/lib/AST/TemplateName.cpp b/clang/lib/AST/TemplateName.cpp
index 4fc25cb34803e..11544dbb56e31 100644
--- a/clang/lib/AST/TemplateName.cpp
+++ b/clang/lib/AST/TemplateName.cpp
@@ -360,14 +360,3 @@ const StreamingDiagnostic ::operator<<(const 
StreamingDiagnostic ,
   OS.flush();
   return DB << NameStr;
 }
-
-void TemplateName::dump(raw_ostream ) const {
-  LangOptions LO;  // FIXME!
-  LO.CPlusPlus = true;
-  

[clang] e090bac - [clang] NFC: add new cwg2398 tests

2024-06-09 Thread Matheus Izvekov via cfe-commits

Author: Matheus Izvekov
Date: 2024-06-09T13:44:45-03:00
New Revision: e090bac638e56ff9db87e622cdf925f2b99dfc30

URL: 
https://github.com/llvm/llvm-project/commit/e090bac638e56ff9db87e622cdf925f2b99dfc30
DIFF: 
https://github.com/llvm/llvm-project/commit/e090bac638e56ff9db87e622cdf925f2b99dfc30.diff

LOG: [clang] NFC: add new cwg2398 tests

Added: 


Modified: 
clang/test/SemaTemplate/cwg2398.cpp

Removed: 




diff  --git a/clang/test/SemaTemplate/cwg2398.cpp 
b/clang/test/SemaTemplate/cwg2398.cpp
index f7f69e9d4268a..7675d4287cb88 100644
--- a/clang/test/SemaTemplate/cwg2398.cpp
+++ b/clang/test/SemaTemplate/cwg2398.cpp
@@ -200,8 +200,120 @@ namespace consistency {
 template struct A, B, B>;
 // new-error@-1 {{ambiguous partial specializations}}
   } // namespace t2
+  namespace t3 {
+template struct A;
+
+template class TT1,
+ class T1, class T2, class T3, class T4>
+struct A, TT1, typename nondeduced>::type> 
{};
+// new-note@-1 {{partial specialization matches}}
+
+template class UU1,
+ class U1, class U2>
+struct A, UU1, typename nondeduced>::type>;
+// new-note@-1 {{partial specialization matches}}
+
+template struct A, B, B>;
+// new-error@-1 {{ambiguous partial specializations}}
+  } // namespace t3
+  namespace t4 {
+template struct A;
+
+template class TT1,
+ class T1, class T2, class T3, class T4>
+struct A, TT1, typename nondeduced>::type> 
{};
+// new-note@-1 {{partial specialization matches}}
+
+template class UU1,
+ class U1, class U2>
+struct A, UU1, typename nondeduced>::type>;
+// new-note@-1 {{partial specialization matches}}
+
+template struct A, B, B>;
+// new-error@-1 {{ambiguous partial specializations}}
+  } // namespace t4
+  namespace t5 {
+template struct A;
+
+template class TT1,
+ class T1, class T2, class T3, class T4>
+struct A, TT1> {};
+// new-note@-1 {{partial specialization matches}}
+
+template class UU1,
+ class U1, class U2>
+struct A, UU1>;
+// new-note@-1 {{partial specialization matches}}
+
+template struct A, B>;
+// new-error@-1 {{ambiguous partial specializations}}
+  } // namespace t5
+  namespace t6 {
+template struct A;
+
+template class TT1,
+ class T1, class T2, class T3>
+struct A, TT1> {};
+// new-note@-1 {{partial specialization matches}}
+
+template class UU1,
+ class U1, class U2>
+struct A, UU1>;
+// new-note@-1 {{partial specialization matches}}
+
+template struct A, B>;
+// new-error@-1 {{ambiguous partial specializations}}
+  } // namespace t6
 } // namespace consistency
 
+namespace classes {
+  namespace canon {
+template struct A {};
+
+template class TT> auto f(TT a) { return a; }
+// old-note@-1 2{{template template argument has 
diff erent template parameters}}
+// new-note@-2 2{{substitution failure: too few template arguments}}
+
+A v1;
+A v2;
+
+using X = decltype(f(v1));
+// expected-error@-1 {{no matching function for call}}
+
+using X = decltype(f(v2));
+// expected-error@-1 {{no matching function for call}}
+  } // namespace canon
+  namespace expr {
+template  struct A {
+  static constexpr auto val = E1;
+};
+template  class TT> void f(TT v) {
+  // old-note@-1 {{template template argument has 
diff erent template parameters}}
+  // new-note@-2 {{substitution failure: too few template arguments}}
+  static_assert(v.val == 3);
+};
+void test() {
+  f(A());
+  // expected-error@-1 {{no matching function for call}}
+}
+  } // namespace expr
+  namespace packs {
+template  struct A {
+  static constexpr auto val = sizeof...(T2s);
+};
+
+template  class TT> void f(TT v) {
+  // old-note@-1 {{template template argument has 
diff erent template parameters}}
+  // new-note@-2 {{deduced type 'A<[...], (no argument), (no argument), 
(no argument)>' of 1st parameter does not match adjusted type 'A<[...], void, 
void, void>' of argument [with TT = A]}}
+  static_assert(v.val == 3);
+};
+void test() {
+  f(A());
+  // expected-error@-1 {{no matching function for call}}
+}
+  } // namespace packs
+} // namespace classes
+
 namespace regression1 {
   template  struct map {};
   template  class foo {};



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] Enable LLDB tests in Linux pre-merge CI (PR #94208)

2024-06-08 Thread Matheus Izvekov via cfe-commits

https://github.com/mizvekov approved this pull request.


https://github.com/llvm/llvm-project/pull/94208
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] Enable LLDB tests in Linux pre-merge CI (PR #94208)

2024-06-07 Thread Matheus Izvekov via cfe-commits

mizvekov wrote:

@Endilll This looks good, thanks!

How will this affect test capacity? Right now, the Linux bots are lagging, 
while the Windows bot is breezing through.

This is the opposite of the usual. Are we under-provisioned on Linux CI 
resources? How much worse will it get when we add this extra workload?

https://github.com/llvm/llvm-project/pull/94208
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] always use resolved arguments for default argument deduction (PR #94756)

2024-06-07 Thread Matheus Izvekov via cfe-commits

https://github.com/mizvekov closed 
https://github.com/llvm/llvm-project/pull/94756
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [libcxx] [Clang] Implement resolution for CWG1835 (PR #92957)

2024-06-07 Thread Matheus Izvekov via cfe-commits


@@ -390,29 +390,37 @@ bool Sema::isAcceptableNestedNameSpecifier(const 
NamedDecl *SD,
 /// (e.g., Base::), perform name lookup for that identifier as a
 /// nested-name-specifier within the given scope, and return the result of that
 /// name lookup.
-NamedDecl *Sema::FindFirstQualifierInScope(Scope *S, NestedNameSpecifier *NNS) 
{
-  if (!S || !NNS)
-return nullptr;
+bool Sema::LookupFirstQualifierInScope(Scope *S, NestedNameSpecifier *NNS,
+   UnresolvedSetImpl ) {
+  if (!S)
+return false;
 
   while (NNS->getPrefix())
 NNS = NNS->getPrefix();
 
-  if (NNS->getKind() != NestedNameSpecifier::Identifier)
-return nullptr;
-
-  LookupResult Found(*this, NNS->getAsIdentifier(), SourceLocation(),
- LookupNestedNameSpecifierName);
+  // FIXME: This is a rather nasty hack! Ideally we should get the results

mizvekov wrote:

I don't think this is a hack per se, I think this is just a consequence of not 
having a special NNS kind for this situation, and representing it with a DTST.

The alternative that I see is to implement a new NNS prefix which is composed 
by an identifier followed by template arguments.

It can still be represented internally with the type, if that's cheaper, but 
having a special accessor, and making `NNS->getAsIdentifier()` work for it, 
would be nicer.

https://github.com/llvm/llvm-project/pull/92957
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [libcxx] [Clang] Implement resolution for CWG1835 (PR #92957)

2024-06-07 Thread Matheus Izvekov via cfe-commits


@@ -548,6 +575,7 @@ bool Sema::BuildCXXNestedNameSpecifier(Scope *S, 
NestedNameSpecInfo ,
 // Perform unqualified name lookup in the current scope.
 LookupName(Found, S);
   }
+#endif

mizvekov wrote:

A left-over.

https://github.com/llvm/llvm-project/pull/92957
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [libcxx] [Clang] Implement resolution for CWG1835 (PR #92957)

2024-06-07 Thread Matheus Izvekov via cfe-commits

https://github.com/mizvekov approved this pull request.

LGTM save a few minor cleanups needed.

I think this patch has an incredible amount of noise due to amount of cosmetic 
changes caused by reformatting, specially due to changing parameters and such.

This is fine for now and I am not suggesting you go back and do it for this 
patch, but I think it would have been helpful to pre-clang-format the file, and 
offload more of the minor changes into a previous patch.

https://github.com/llvm/llvm-project/pull/92957
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [libcxx] [Clang] Implement resolution for CWG1835 (PR #92957)

2024-06-07 Thread Matheus Izvekov via cfe-commits


@@ -2923,10 +2920,9 @@ class TreeTransform {
 }
 
 return getSema().BuildMemberReferenceExpr(Base, BaseType, OpLoc, isArrow,
-  SS, TemplateKWLoc,
-  FirstQualifierInScope,
-  R, ExplicitTemplateArgs,
-  /*S*/nullptr);
+  SS, TemplateKWLoc, R,
+  ExplicitTemplateArgs,
+  /*S*/ nullptr);

mizvekov wrote:

```suggestion
  /*S=*/nullptr);
```

https://github.com/llvm/llvm-project/pull/92957
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [libcxx] [Clang] Implement resolution for CWG1835 (PR #92957)

2024-06-07 Thread Matheus Izvekov via cfe-commits

https://github.com/mizvekov edited 
https://github.com/llvm/llvm-project/pull/92957
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] always use resolved arguments for default argument deduction (PR #94756)

2024-06-07 Thread Matheus Izvekov via cfe-commits

mizvekov wrote:

@kadircet @yozhu FYI this fixes the problem you reported.

https://github.com/llvm/llvm-project/pull/94756
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] always use resolved arguments for default argument deduction (PR #94756)

2024-06-07 Thread Matheus Izvekov via cfe-commits

https://github.com/mizvekov created 
https://github.com/llvm/llvm-project/pull/94756

This fixes a regression introduced with the changes in 
https://github.com/llvm/llvm-project/pull/93433 around preservation of 
TemplateName sugar in template type deduction.

Since the argument side TST is non-canonical, we have to extract the arguments 
from it's canonical type.
This was done for the deduction of the TST arguments, but we missed it for the 
default arguments used in the deduction of the TST name.

>From df6049fd91c95e341dd80a61e5bd173ce5837131 Mon Sep 17 00:00:00 2001
From: Matheus Izvekov 
Date: Fri, 7 Jun 2024 10:32:12 -0300
Subject: [PATCH] [clang] always use resolved arguments for default argument
 deduction

This fixes a regression introduced with the changes in
https://github.com/llvm/llvm-project/pull/93433 around preservation
of TemplateName sugar in template type deduction.

Since the argument side TST is non-canonical, we have to extract the
arguments from it's canonical type.
This was done for the deduction of the TST arguments, but we missed it
for the default arguments used in the deduction of the TST name.
---
 clang/lib/Sema/SemaTemplateDeduction.cpp | 13 ++---
 clang/test/SemaTemplate/cwg2398.cpp  | 16 
 2 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/clang/lib/Sema/SemaTemplateDeduction.cpp 
b/clang/lib/Sema/SemaTemplateDeduction.cpp
index 1011db2d2830d..befeb38e1fe5b 100644
--- a/clang/lib/Sema/SemaTemplateDeduction.cpp
+++ b/clang/lib/Sema/SemaTemplateDeduction.cpp
@@ -712,13 +712,6 @@ DeduceTemplateSpecArguments(Sema , TemplateParameterList 
*TemplateParams,
 if (const auto *TD = TNA.getAsTemplateDecl(); TD && TD->isTypeAlias())
   return TemplateDeductionResult::Success;
 
-// Perform template argument deduction for the template name.
-if (auto Result =
-DeduceTemplateArguments(S, TemplateParams, TNP, TNA, Info,
-SA->template_arguments(), Deduced);
-Result != TemplateDeductionResult::Success)
-  return Result;
-
 // FIXME: To preserve sugar, the TST needs to carry sugared resolved
 // arguments.
 ArrayRef AResolved =
@@ -726,6 +719,12 @@ DeduceTemplateSpecArguments(Sema , TemplateParameterList 
*TemplateParams,
 ->castAs()
 ->template_arguments();
 
+// Perform template argument deduction for the template name.
+if (auto Result = DeduceTemplateArguments(S, TemplateParams, TNP, TNA, 
Info,
+  AResolved, Deduced);
+Result != TemplateDeductionResult::Success)
+  return Result;
+
 // Perform template argument deduction on each template
 // argument. Ignore any missing/extra arguments, since they could be
 // filled in by default arguments.
diff --git a/clang/test/SemaTemplate/cwg2398.cpp 
b/clang/test/SemaTemplate/cwg2398.cpp
index 45e74cce3a98c..f7f69e9d4268a 100644
--- a/clang/test/SemaTemplate/cwg2398.cpp
+++ b/clang/test/SemaTemplate/cwg2398.cpp
@@ -201,3 +201,19 @@ namespace consistency {
 // new-error@-1 {{ambiguous partial specializations}}
   } // namespace t2
 } // namespace consistency
+
+namespace regression1 {
+  template  struct map {};
+  template  class foo {};
+
+  template  class MapType, typename Value>
+  Value bar(MapType map);
+
+  template  class MapType, typename Value>
+  Value bar(MapType> map);
+
+  void aux() {
+map> input;
+bar(input);
+  }
+} // namespace regression1

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [libcxx] [clang] Preserve Qualifiers and type sugar in TemplateNames (PR #93433)

2024-06-07 Thread Matheus Izvekov via cfe-commits

mizvekov wrote:

> so after this patch, clang seems to be crashing on:

Thanks for the reproducer. Yeah this is about default argument deduction, which 
doesn't involve default arguments as written in source.

I confirm the crash and it's indeed caused by changes in this patch. The fix is 
very simple and I will be posting a patch shortly.



https://github.com/llvm/llvm-project/pull/93433
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Clang][Sema][TemplateDeduction] Skip pack expansion type at the end of default template argument list if unneeded (PR #94659)

2024-06-06 Thread Matheus Izvekov via cfe-commits

https://github.com/mizvekov requested changes to this pull request.

Please include test case.

https://github.com/llvm/llvm-project/pull/94659
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] Enable LLDB tests in Linux pre-merge CI (PR #94208)

2024-06-06 Thread Matheus Izvekov via cfe-commits

mizvekov wrote:

> > 2. Build system does not support Multi-config generators. You can grep for 
> > https://cmake.org/cmake/help/latest/variable/CMAKE_CFG_INTDIR.html as an 
> > example.
> 
> This simply isn't true. Xcode is a multi-config build system and we have [a 
> bot](https://ci.swift.org/view/all/job/llvm.org/view/LLDB/job/lldb-cmake-standalone/)
>  that ensures that doesn't break. Maybe there's something different about 
> MSVC?

The page I linked about this deprecated variable talks about poor support in 
"Ninja Multi-Config" specifically, which is what I use, but implies it can be 
used in Xcode.

https://github.com/llvm/llvm-project/pull/94208
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] NFCI: Make ASTContext optional in the AST text dumper again (PR #94522)

2024-06-06 Thread Matheus Izvekov via cfe-commits

https://github.com/mizvekov closed 
https://github.com/llvm/llvm-project/pull/94522
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] Enable LLDB tests in Linux pre-merge CI (PR #94208)

2024-06-05 Thread Matheus Izvekov via cfe-commits

mizvekov wrote:

> Can you elaborate on what specifically you find hard? Building should be 
> fairly straightforward, besides Python and SWIG, which are required to run 
> the tests, most of our dependencies are optional. Unlike the compiler, the 
> debugger is (1) tied to the system it's running on, and (2) an interactive 
> tool, so maybe that's what you're referring to? Either way, if there are 
> concrete ways we can make LLDB easier to work on, I'd love to hear your 
> suggestions!

This was about a year ago, and I remember @erichkeane had similar issues, but 
the main points:
1) Windows support
2) Build system does not support Multi-config generators. You can grep for 
https://cmake.org/cmake/help/latest/variable/CMAKE_CFG_INTDIR.html as an 
example.
3) Not all tests pass and it's quite unclear when that is not your fault.

AFAIK, on windows I would run into this issue where running the LLDB test suite 
would cause hundreds of frozen terminal windows to spawn, and that was quite 
difficult to recover from without rebooting.
This might be related to 2) above, before I figured it out.

I eventually thought that was too dangerous to run on windows and managed to 
get it working on linux virtual machine.


https://github.com/llvm/llvm-project/pull/94208
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] NFCI: Make ASTContext optional in the AST text dumper again (PR #94522)

2024-06-05 Thread Matheus Izvekov via cfe-commits

https://github.com/mizvekov edited 
https://github.com/llvm/llvm-project/pull/94522
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] NFCI: Make ASTContext optional again (PR #94522)

2024-06-05 Thread Matheus Izvekov via cfe-commits

https://github.com/mizvekov created 
https://github.com/llvm/llvm-project/pull/94522

Previous patches 3cabbf60393cc8d55fe635e35e89e5973162de33 and 
1a2f3309765fdc143fdc3809211fb85d2e2ca341 broke the assumption that the AST 
Context was optional for the text node dumper.

While missing an ASTContext makes some helpful information unavailable, the 
pure `dump` overloads taking no parameters are quite convenient for quick 
debugging, so let's make that work again.

>From 422e23d1daed53e096eb55ceb2e915904ee3635b Mon Sep 17 00:00:00 2001
From: Matheus Izvekov 
Date: Wed, 5 Jun 2024 16:01:33 -0300
Subject: [PATCH] [clang] NFCI: Make ASTContext optional again

Previous patches 3cabbf60393cc8d55fe635e35e89e5973162de33 and 
1a2f3309765fdc143fdc3809211fb85d2e2ca341
broke the assumption that the AST Context was optional for the text node dumper.

While missing an ASTContext makes some helpful information unavailable,
the pure `dump` overloads taking no parameters are quite convenient for
quick debugging, so let's make that work again.
---
 clang/lib/AST/TextNodeDumper.cpp | 21 +
 clang/lib/AST/Type.cpp   |  1 -
 2 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/clang/lib/AST/TextNodeDumper.cpp b/clang/lib/AST/TextNodeDumper.cpp
index 8bacceea0f22b..1076dcd40a694 100644
--- a/clang/lib/AST/TextNodeDumper.cpp
+++ b/clang/lib/AST/TextNodeDumper.cpp
@@ -958,6 +958,9 @@ void TextNodeDumper::dumpTemplateArgument(const 
TemplateArgument ) {
   }
   OS << " '" << Str << "'";
 
+  if (!Context)
+return;
+
   if (TemplateArgument CanonTA = Context->getCanonicalTemplateArgument(TA);
   !CanonTA.structurallyEquals(TA)) {
 llvm::SmallString<128> CanonStr;
@@ -1139,15 +1142,17 @@ void TextNodeDumper::dumpTemplateName(TemplateName TN, 
StringRef Label) {
   }
   OS << " '" << Str << "'";
 
-  if (TemplateName CanonTN = Context->getCanonicalTemplateName(TN);
-  CanonTN != TN) {
-llvm::SmallString<128> CanonStr;
-{
-  llvm::raw_svector_ostream SS(CanonStr);
-  CanonTN.print(SS, PrintPolicy);
+  if (Context) {
+if (TemplateName CanonTN = Context->getCanonicalTemplateName(TN);
+CanonTN != TN) {
+  llvm::SmallString<128> CanonStr;
+  {
+llvm::raw_svector_ostream SS(CanonStr);
+CanonTN.print(SS, PrintPolicy);
+  }
+  if (CanonStr != Str)
+OS << ":'" << CanonStr << "'";
 }
-if (CanonStr != Str)
-  OS << ":'" << CanonStr << "'";
   }
 }
 dumpBareTemplateName(TN);
diff --git a/clang/lib/AST/Type.cpp b/clang/lib/AST/Type.cpp
index 2097b29b7e0b6..2cc06a3df9d18 100644
--- a/clang/lib/AST/Type.cpp
+++ b/clang/lib/AST/Type.cpp
@@ -,7 +,6 @@ static CachedProperties computeCachedProperties(const 
Type *T) {
 #define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class,Base) case Type::Class:
 #include "clang/AST/TypeNodes.inc"
 // Treat instantiation-dependent types as external.
-if (!T->isInstantiationDependentType()) T->dump();
 assert(T->isInstantiationDependentType());
 return CachedProperties(Linkage::External, false);
 

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] Enable LLDB tests in Linux pre-merge CI (PR #94208)

2024-06-05 Thread Matheus Izvekov via cfe-commits

mizvekov wrote:

I would normally have no issue making the changes needed to other projects, and 
I mostly try to do that.
But lldb sets itself apart in how hard it is to get a project setup going, and 
how impactful it is.

It's a bit concerning when the changes needed are quite trivial, for example 
just changing diagnostics expectations, but you have no other way to test that.

I think the lldb pre-commit CI would at least help here, for trivial changes, 
we can keep trying to fix and verifying it by pushing to the PR, no changes 
needed on developer setup side.

https://github.com/llvm/llvm-project/pull/94208
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] Enable LLDB tests in Linux pre-merge CI (PR #94208)

2024-06-04 Thread Matheus Izvekov via cfe-commits

mizvekov wrote:

> I think it makes a lot of sense for lldb to have a precommit CI pipeline 
> which tests changes to lldb. I don't think we're at a point where it would 
> make sense to enable lldb precommit CI testing for changes to clang, though.
> 
> For starters, the false positive rate from flaky lldb test failures is pretty 
> high:

I think we only need a subset of lldb tests for pure clang changes, and my 
experience is that those aren't as flaky.

> But also, changes in Clang that break lldb do not necessarily mean that a PR 
> is not ready to land. There are conforming changes that can be made to Clang 
> which lldb needs to react to as a downstream consumer of Clang as a library 
> rather than a PR author needing to react to it. (e.g., adding a new AST node 
> to Clang or changing diagnostic wording/behavior). We should try to come up 
> with and document a policy about what the expectations are regarding Clang 
> and lldb interactions before we add lldb to Clang's precommit CI pipeline.

Yeah clarifying this would be helpful. In my past experience, this is not the 
expectation lldb maintainers have. I have had clang patches reverted only 
because they broke lldb tests on pure diagnostics / type printing improvements.

https://github.com/llvm/llvm-project/pull/94208
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [libcxx] [Clang] Implement resolution for CWG1835 (PR #92957)

2024-06-04 Thread Matheus Izvekov via cfe-commits


@@ -55,15 +55,21 @@ namespace PR11856 {
 
   template T *end(T*);
 
-  class X { };
+  struct X { };
+  struct Y {
+int end;
+  };
   template 
   void Foo2() {
 T it1;
-if (it1->end < it1->end) {
-}
+if (it1->end < it1->end) { }
 
 X *x;
-if (x->end < 7) {  // expected-error{{no member named 'end' in 
'PR11856::X'}}
-}
+if (x->end < 7) { } // expected-error{{expected '>'}}
+// expected-note@-1{{to match this '<'}}
+// expected-error@-2{{expected unqualified-id}}

mizvekov wrote:

Yes, this looks great now, thanks!

I still have to finish review of the rest of this huge patch, this is going to 
take a while :)

https://github.com/llvm/llvm-project/pull/92957
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] NFCI: remove obsolete workaround for template default arguments (PR #94311)

2024-06-04 Thread Matheus Izvekov via cfe-commits

https://github.com/mizvekov closed 
https://github.com/llvm/llvm-project/pull/94311
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] NFCI: remove obsolete workaround for template default arguments (PR #94311)

2024-06-03 Thread Matheus Izvekov via cfe-commits

https://github.com/mizvekov created 
https://github.com/llvm/llvm-project/pull/94311

This removes a workaround for template template arguments pointing to older 
template declarations, which don't have the most recent default argument 
definition.

The removed workaround was introduced in 
1abacfcb2358a1928f0ced693e149a6cf2fc482e, but 
https://github.com/llvm/llvm-project/pull/75569 introduced a better fix which 
is more comprehensive and doesn't require rebuilding TemplateNames.

>From 7b0186176437e22a5bfe221dd6ed3daf0c949fea Mon Sep 17 00:00:00 2001
From: Matheus Izvekov 
Date: Tue, 4 Jun 2024 01:26:10 -0300
Subject: [PATCH] [clang] NFCI: remove obsolete workaround for template default
 arguments

This removes a workaround for template template arguments pointing to
older template declarations, which don't have the most recent default
argument definition.

The removed workaround was introduced in 
1abacfcb2358a1928f0ced693e149a6cf2fc482e,
but https://github.com/llvm/llvm-project/pull/75569 introduced a
better fix which is more comprehensive and doesn't require rebuilding
TemplateNames.
---
 clang/include/clang/AST/TemplateName.h |  5 -
 clang/lib/AST/TemplateName.cpp | 17 -
 clang/lib/Sema/SemaTemplateInstantiate.cpp | 10 --
 3 files changed, 4 insertions(+), 28 deletions(-)

diff --git a/clang/include/clang/AST/TemplateName.h 
b/clang/include/clang/AST/TemplateName.h
index 7aedc086ab7d0..489fccb2ef74d 100644
--- a/clang/include/clang/AST/TemplateName.h
+++ b/clang/include/clang/AST/TemplateName.h
@@ -314,11 +314,6 @@ class TemplateName {
 
   TemplateName getUnderlying() const;
 
-  /// Get the template name to substitute when this template name is used as a
-  /// template template argument. This refers to the most recent declaration of
-  /// the template, including any default template arguments.
-  TemplateName getNameToSubstitute() const;
-
   TemplateNameDependence getDependence() const;
 
   /// Determines whether this is a dependent template name.
diff --git a/clang/lib/AST/TemplateName.cpp b/clang/lib/AST/TemplateName.cpp
index 3dbdad92813f6..4fc25cb34803e 100644
--- a/clang/lib/AST/TemplateName.cpp
+++ b/clang/lib/AST/TemplateName.cpp
@@ -214,23 +214,6 @@ UsingShadowDecl *TemplateName::getAsUsingShadowDecl() 
const {
   return nullptr;
 }
 
-TemplateName TemplateName::getNameToSubstitute() const {
-  TemplateDecl *Decl = getAsTemplateDecl();
-
-  // Substituting a dependent template name: preserve it as written.
-  if (!Decl)
-return *this;
-
-  // If we have a template declaration, use the most recent non-friend
-  // declaration of that template.
-  Decl = cast(Decl->getMostRecentDecl());
-  while (Decl->getFriendObjectKind()) {
-Decl = cast(Decl->getPreviousDecl());
-assert(Decl && "all declarations of template are friends");
-  }
-  return TemplateName(Decl);
-}
-
 TemplateNameDependence TemplateName::getDependence() const {
   auto D = TemplateNameDependence::None;
   switch (getKind()) {
diff --git a/clang/lib/Sema/SemaTemplateInstantiate.cpp 
b/clang/lib/Sema/SemaTemplateInstantiate.cpp
index abb8a260faab9..863cc53c55afa 100644
--- a/clang/lib/Sema/SemaTemplateInstantiate.cpp
+++ b/clang/lib/Sema/SemaTemplateInstantiate.cpp
@@ -1856,7 +1856,7 @@ Decl *TemplateInstantiator::TransformDecl(SourceLocation 
Loc, Decl *D) {
 Arg = getPackSubstitutedTemplateArgument(getSema(), Arg);
   }
 
-  TemplateName Template = Arg.getAsTemplate().getNameToSubstitute();
+  TemplateName Template = Arg.getAsTemplate();
   assert(!Template.isNull() && Template.getAsTemplateDecl() &&
  "Wrong kind of template template argument");
   return Template.getAsTemplateDecl();
@@ -2029,10 +2029,8 @@ TemplateName TemplateInstantiator::TransformTemplateName(
 Arg = getPackSubstitutedTemplateArgument(getSema(), Arg);
   }
 
-  TemplateName Template = Arg.getAsTemplate().getNameToSubstitute();
+  TemplateName Template = Arg.getAsTemplate();
   assert(!Template.isNull() && "Null template template argument");
-  assert(!Template.getAsQualifiedTemplateName() &&
- "template decl to substitute is qualified?");
 
   if (Final)
 return Template;
@@ -2052,8 +2050,8 @@ TemplateName TemplateInstantiator::TransformTemplateName(
 if (SubstPack->getFinal())
   return Template;
 return getSema().Context.getSubstTemplateTemplateParm(
-Template.getNameToSubstitute(), SubstPack->getAssociatedDecl(),
-SubstPack->getIndex(), getPackIndex(Pack));
+Template, SubstPack->getAssociatedDecl(), SubstPack->getIndex(),
+getPackIndex(Pack));
   }
 
   return inherited::TransformTemplateName(SS, Name, NameLoc, ObjectType,

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] AST Visitor: skip empty qualifiers in QualifiedTemplateName (PR #93926)

2024-06-03 Thread Matheus Izvekov via cfe-commits

mizvekov wrote:

> Even with this fix, I'm seeing a segfault in clang/lib/AST/QualTypeNames.cpp 
> at line 216.
> I have a fix in testing that adds this check, but if you would double check 
> it after it goes in, that would be helpful.
> 
> Unfortunately the failure is in an internal tool, against internal sources, 
> which makes getting a reproducer a long process. I'm also working on that.

The fix gets the intended behavior right.

There are `unittests` for QualTypeNames, a new test case could go in there.

https://github.com/llvm/llvm-project/pull/93926
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] AST Visitor: skip empty qualifiers in QualifiedTemplateName (PR #93926)

2024-05-31 Thread Matheus Izvekov via cfe-commits

https://github.com/mizvekov closed 
https://github.com/llvm/llvm-project/pull/93926
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] AST Visitor: skip empty qualifiers in QualifiedTemplateName (PR #93926)

2024-05-31 Thread Matheus Izvekov via cfe-commits


@@ -855,10 +855,14 @@ bool 
RecursiveASTVisitor::TraverseDeclarationNameInfo(
 
 template 
 bool RecursiveASTVisitor::TraverseTemplateName(TemplateName Template) 
{
-  if (DependentTemplateName *DTN = Template.getAsDependentTemplateName())
+  if (DependentTemplateName *DTN = Template.getAsDependentTemplateName()) {
 TRY_TO(TraverseNestedNameSpecifier(DTN->getQualifier()));
-  else if (QualifiedTemplateName *QTN = Template.getAsQualifiedTemplateName())
-TRY_TO(TraverseNestedNameSpecifier(QTN->getQualifier()));
+  } else if (QualifiedTemplateName *QTN =
+ Template.getAsQualifiedTemplateName()) {
+if (QTN->getQualifier()) {
+  TRY_TO(TraverseNestedNameSpecifier(QTN->getQualifier()));
+}
+  }

mizvekov wrote:

I am going to merge since this fixes broken build bot.

Let's continue in post.

https://github.com/llvm/llvm-project/pull/93926
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] AST Visitor: skip empty qualifiers in QualifiedTemplateName (PR #93926)

2024-05-31 Thread Matheus Izvekov via cfe-commits

https://github.com/mizvekov edited 
https://github.com/llvm/llvm-project/pull/93926
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] AST Visitor: skip empty qualifiers in QualifiedTemplateName (PR #93926)

2024-05-31 Thread Matheus Izvekov via cfe-commits


@@ -855,10 +855,14 @@ bool 
RecursiveASTVisitor::TraverseDeclarationNameInfo(
 
 template 
 bool RecursiveASTVisitor::TraverseTemplateName(TemplateName Template) 
{
-  if (DependentTemplateName *DTN = Template.getAsDependentTemplateName())
+  if (DependentTemplateName *DTN = Template.getAsDependentTemplateName()) {
 TRY_TO(TraverseNestedNameSpecifier(DTN->getQualifier()));
-  else if (QualifiedTemplateName *QTN = Template.getAsQualifiedTemplateName())
-TRY_TO(TraverseNestedNameSpecifier(QTN->getQualifier()));
+  } else if (QualifiedTemplateName *QTN =
+ Template.getAsQualifiedTemplateName()) {
+if (QTN->getQualifier()) {
+  TRY_TO(TraverseNestedNameSpecifier(QTN->getQualifier()));
+}
+  }

mizvekov wrote:

I understand that looks cleaner at first glance, but the intention in the 
original code was to match each kind of `TemplateName`.

For example, this doesn't traverse `OverloadTemplateName` right now, but if we 
wanted to add it after this change, this would necessitate to refactor the if 
branches once again.

https://github.com/llvm/llvm-project/pull/93926
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] AST Visitor: skip empty qualifiers in QualifiedTemplateName (PR #93926)

2024-05-31 Thread Matheus Izvekov via cfe-commits

https://github.com/mizvekov edited 
https://github.com/llvm/llvm-project/pull/93926
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] AST Visitor: skip empty qualifiers in QualifiedTemplateName (PR #93926)

2024-05-31 Thread Matheus Izvekov via cfe-commits

https://github.com/mizvekov updated 
https://github.com/llvm/llvm-project/pull/93926

>From 55d946648a44e7a0b2fc45d20866f29ef4528c15 Mon Sep 17 00:00:00 2001
From: Matheus Izvekov 
Date: Fri, 31 May 2024 02:53:18 -0300
Subject: [PATCH] [clang] AST Visitor: skip empty qualifiers in
 QualifiedTemplateName

This change was missed in #93433.
---
 clang/include/clang/AST/RecursiveASTVisitor.h | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/clang/include/clang/AST/RecursiveASTVisitor.h 
b/clang/include/clang/AST/RecursiveASTVisitor.h
index 4bbb4380cdd7f..99093aa17972c 100644
--- a/clang/include/clang/AST/RecursiveASTVisitor.h
+++ b/clang/include/clang/AST/RecursiveASTVisitor.h
@@ -855,10 +855,14 @@ bool 
RecursiveASTVisitor::TraverseDeclarationNameInfo(
 
 template 
 bool RecursiveASTVisitor::TraverseTemplateName(TemplateName Template) 
{
-  if (DependentTemplateName *DTN = Template.getAsDependentTemplateName())
+  if (DependentTemplateName *DTN = Template.getAsDependentTemplateName()) {
 TRY_TO(TraverseNestedNameSpecifier(DTN->getQualifier()));
-  else if (QualifiedTemplateName *QTN = Template.getAsQualifiedTemplateName())
-TRY_TO(TraverseNestedNameSpecifier(QTN->getQualifier()));
+  } else if (QualifiedTemplateName *QTN =
+ Template.getAsQualifiedTemplateName()) {
+if (QTN->getQualifier()) {
+  TRY_TO(TraverseNestedNameSpecifier(QTN->getQualifier()));
+}
+  }
 
   return true;
 }

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] AST Visitor: skip empty qualifiers in QualifiedTemplateName (PR #93926)

2024-05-31 Thread Matheus Izvekov via cfe-commits

https://github.com/mizvekov updated 
https://github.com/llvm/llvm-project/pull/93926

>From db56ac3130164f570942d54686ffb39cf7d2ae33 Mon Sep 17 00:00:00 2001
From: Matheus Izvekov 
Date: Fri, 31 May 2024 02:53:18 -0300
Subject: [PATCH] [clang] AST Visitor: skip empty qualifiers in
 QualifiedTemplateName

This change was missed in #93433.
---
 clang/include/clang/AST/RecursiveASTVisitor.h | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/clang/include/clang/AST/RecursiveASTVisitor.h 
b/clang/include/clang/AST/RecursiveASTVisitor.h
index 4bbb4380cdd7f..d16074443b2dc 100644
--- a/clang/include/clang/AST/RecursiveASTVisitor.h
+++ b/clang/include/clang/AST/RecursiveASTVisitor.h
@@ -855,10 +855,14 @@ bool 
RecursiveASTVisitor::TraverseDeclarationNameInfo(
 
 template 
 bool RecursiveASTVisitor::TraverseTemplateName(TemplateName Template) 
{
-  if (DependentTemplateName *DTN = Template.getAsDependentTemplateName())
+  if (DependentTemplateName *DTN = Template.getAsDependentTemplateName()) {
 TRY_TO(TraverseNestedNameSpecifier(DTN->getQualifier()));
-  else if (QualifiedTemplateName *QTN = Template.getAsQualifiedTemplateName())
-TRY_TO(TraverseNestedNameSpecifier(QTN->getQualifier()));
+  } else if (QualifiedTemplateName *QTN =
+ Template.getAsQualifiedTemplateName()) {
+if (T->getQualifier()) {
+  TRY_TO(TraverseNestedNameSpecifier(QTN->getQualifier()));
+}
+  }
 
   return true;
 }

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [libcxx] [clang] Preserve Qualifiers and type sugar in TemplateNames (PR #93433)

2024-05-31 Thread Matheus Izvekov via cfe-commits

mizvekov wrote:

@pcc https://github.com/llvm/llvm-project/pull/93926 should fix it, can you 
double check that it gets all issues?

https://github.com/llvm/llvm-project/pull/93433
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] AST Visitor: skip empty qualifiers in QualifiedTemplateName (PR #93926)

2024-05-30 Thread Matheus Izvekov via cfe-commits

https://github.com/mizvekov created 
https://github.com/llvm/llvm-project/pull/93926

This change was missed in #93433.

>From dd8839b4f3294241b2a6df8bc10e869176baff72 Mon Sep 17 00:00:00 2001
From: Matheus Izvekov 
Date: Fri, 31 May 2024 02:53:18 -0300
Subject: [PATCH] [clang] AST Visitor: skip empty qualifiers in
 QualifiedTemplateName

This change was missed in #93433.
---
 clang/include/clang/AST/RecursiveASTVisitor.h | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/clang/include/clang/AST/RecursiveASTVisitor.h 
b/clang/include/clang/AST/RecursiveASTVisitor.h
index 4bbb4380cdd7f..28a90dffcb8dc 100644
--- a/clang/include/clang/AST/RecursiveASTVisitor.h
+++ b/clang/include/clang/AST/RecursiveASTVisitor.h
@@ -855,10 +855,13 @@ bool 
RecursiveASTVisitor::TraverseDeclarationNameInfo(
 
 template 
 bool RecursiveASTVisitor::TraverseTemplateName(TemplateName Template) 
{
-  if (DependentTemplateName *DTN = Template.getAsDependentTemplateName())
+  if (DependentTemplateName *DTN = Template.getAsDependentTemplateName()) {
 TRY_TO(TraverseNestedNameSpecifier(DTN->getQualifier()));
-  else if (QualifiedTemplateName *QTN = Template.getAsQualifiedTemplateName())
-TRY_TO(TraverseNestedNameSpecifier(QTN->getQualifier()));
+  } else if (QualifiedTemplateName *QTN = 
Template.getAsQualifiedTemplateName()) {
+if (T->getQualifier()) {
+  TRY_TO(TraverseNestedNameSpecifier(QTN->getQualifier()));
+}
+  }
 
   return true;
 }

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Clang][Sema] Diagnose variable template explicit specializations with storage-class-specifiers (PR #93873)

2024-05-30 Thread Matheus Izvekov via cfe-commits

https://github.com/mizvekov commented:

Interestingly, only GCC errors on a case like this:

```
namespace {
  template int A = 0;
}
template<> int A = 0;
```

https://godbolt.org/z/TTjssKxz5

https://github.com/llvm/llvm-project/pull/93873
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Clang][Sema] Diagnose variable template explicit specializations with storage-class-specifiers (PR #93873)

2024-05-30 Thread Matheus Izvekov via cfe-commits


@@ -3561,6 +3562,7 @@ Sema::ActOnCXXMemberDeclarator(Scope *S, AccessSpecifier 
AS, Declarator ,
   }
   return nullptr;
 }
+#endif

mizvekov wrote:

Leftover

https://github.com/llvm/llvm-project/pull/93873
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Clang][Sema] Diagnose variable template explicit specializations with storage-class-specifiers (PR #93873)

2024-05-30 Thread Matheus Izvekov via cfe-commits


@@ -3541,6 +3541,7 @@ Sema::ActOnCXXMemberDeclarator(Scope *S, AccessSpecifier 
AS, Declarator ,
 
 IdentifierInfo *II = Name.getAsIdentifierInfo();
 
+#if 0

mizvekov wrote:

Leftover

https://github.com/llvm/llvm-project/pull/93873
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] Fix a crash when a variable is captured by a block nested inside a lambda (PR #93749)

2024-05-30 Thread Matheus Izvekov via cfe-commits

https://github.com/mizvekov commented:

I see it stops crashing, but is it actually working now?

Why `hasInit` returns true, but the variable doesn't actually have an 
initializer?
Shouldn't the fix go there?

https://github.com/llvm/llvm-project/pull/93749
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Clang][Sema] Use correct TemplateName when transforming TemplateSpecializationType (PR #93411)

2024-05-30 Thread Matheus Izvekov via cfe-commits

https://github.com/mizvekov commented:

So After we have formed a TemplateSpecializationType, we are done with the NNS. 
We keep it around in an ElaboratedType for type sugar only, it should not be 
needed to compile the program correctly anymore.

So I think this solution violates one important aspect of our AST design.

If we still need the NNS, we have to hold-off on building the TST until we 
don't.

https://github.com/llvm/llvm-project/pull/93411
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [libcxx] [clang] Preserve Qualifiers and type sugar in TemplateNames (PR #93433)

2024-05-30 Thread Matheus Izvekov via cfe-commits

mizvekov wrote:

> Could you please take another look?

Sure, but let's take the discussion to the other PR.

https://github.com/llvm/llvm-project/pull/93433
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] text ast-dumper: dump TemplateName for TST and DTST (PR #93766)

2024-05-30 Thread Matheus Izvekov via cfe-commits

https://github.com/mizvekov closed 
https://github.com/llvm/llvm-project/pull/93766
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] text ast-dumper: dump TemplateName for TST and DTST (PR #93766)

2024-05-30 Thread Matheus Izvekov via cfe-commits

https://github.com/mizvekov updated 
https://github.com/llvm/llvm-project/pull/93766

>From 774fa391d3ba427adf81919c361dd4f01e72d6a1 Mon Sep 17 00:00:00 2001
From: Matheus Izvekov 
Date: Thu, 30 May 2024 01:24:53 -0300
Subject: [PATCH] [clang] text ast-dumper: dump TemplateName for TST and DTST

Implement AST text dumping of the TemplateName for
TemplateSpecializationType and VisitDeducedTemplateSpecializationType.
---
 clang/include/clang/AST/TemplateName.h|  4 ++
 clang/include/clang/AST/TextNodeDumper.h  |  3 +-
 clang/lib/AST/TextNodeDumper.cpp  | 43 
 clang/test/AST/ast-dump-ctad-alias.cpp|  6 ++-
 clang/test/AST/ast-dump-template-decls.cpp| 14 --
 clang/test/AST/ast-dump-template-name.cpp |  6 +++
 clang/test/AST/ast-dump-using-template.cpp| 18 +--
 clang/test/Import/builtin-template/test.cpp   | 11 +---
 .../aggregate-deduction-candidate.cpp |  4 +-
 clang/test/SemaTemplate/deduction-guide.cpp   | 22 
 clang/test/SemaTemplate/make_integer_seq.cpp  | 50 +--
 clang/test/SemaTemplate/type_pack_element.cpp | 34 +
 12 files changed, 149 insertions(+), 66 deletions(-)

diff --git a/clang/include/clang/AST/TemplateName.h 
b/clang/include/clang/AST/TemplateName.h
index 876be463c71d0..7aedc086ab7d0 100644
--- a/clang/include/clang/AST/TemplateName.h
+++ b/clang/include/clang/AST/TemplateName.h
@@ -360,6 +360,10 @@ class TemplateName {
   static TemplateName getFromVoidPointer(void *Ptr) {
 return TemplateName(Ptr);
   }
+
+  /// Structural equality.
+  bool operator==(TemplateName Other) const { return Storage == Other.Storage; 
}
+  bool operator!=(TemplateName Other) const { return !operator==(Other); }
 };
 
 /// Insertion operator for diagnostics.  This allows sending TemplateName's
diff --git a/clang/include/clang/AST/TextNodeDumper.h 
b/clang/include/clang/AST/TextNodeDumper.h
index 63fa16c9ec47c..caa33abd99e47 100644
--- a/clang/include/clang/AST/TextNodeDumper.h
+++ b/clang/include/clang/AST/TextNodeDumper.h
@@ -214,7 +214,8 @@ class TextNodeDumper
   void dumpNestedNameSpecifier(const NestedNameSpecifier *NNS);
   void dumpConceptReference(const ConceptReference *R);
   void dumpTemplateArgument(const TemplateArgument );
-  void dumpTemplateName(TemplateName TN);
+  void dumpBareTemplateName(TemplateName TN);
+  void dumpTemplateName(TemplateName TN, StringRef Label = {});
 
   void dumpDeclRef(const Decl *D, StringRef Label = {});
 
diff --git a/clang/lib/AST/TextNodeDumper.cpp b/clang/lib/AST/TextNodeDumper.cpp
index a0eedc71ea220..0e0e0a86f5cfc 100644
--- a/clang/lib/AST/TextNodeDumper.cpp
+++ b/clang/lib/AST/TextNodeDumper.cpp
@@ -1126,7 +1126,32 @@ void TextNodeDumper::VisitIntegralTemplateArgument(const 
TemplateArgument ) {
   dumpTemplateArgument(TA);
 }
 
-void TextNodeDumper::dumpTemplateName(TemplateName TN) {
+void TextNodeDumper::dumpTemplateName(TemplateName TN, StringRef Label) {
+  AddChild(Label, [=] {
+{
+  llvm::SmallString<128> Str;
+  {
+llvm::raw_svector_ostream SS(Str);
+TN.print(SS, PrintPolicy);
+  }
+  OS << " '" << Str << "'";
+
+  if (TemplateName CanonTN = Context->getCanonicalTemplateName(TN);
+  CanonTN != TN) {
+llvm::SmallString<128> CanonStr;
+{
+  llvm::raw_svector_ostream SS(CanonStr);
+  CanonTN.print(SS, PrintPolicy);
+}
+if (CanonStr != Str)
+  OS << ":'" << CanonStr << "'";
+  }
+}
+dumpBareTemplateName(TN);
+  });
+}
+
+void TextNodeDumper::dumpBareTemplateName(TemplateName TN) {
   switch (TN.getKind()) {
   case TemplateName::Template:
 AddChild([=] { Visit(TN.getAsTemplateDecl()); });
@@ -1143,7 +1168,7 @@ void TextNodeDumper::dumpTemplateName(TemplateName TN) {
 if (QTN->hasTemplateKeyword())
   OS << " keyword";
 dumpNestedNameSpecifier(QTN->getQualifier());
-dumpTemplateName(QTN->getUnderlyingTemplate());
+dumpBareTemplateName(QTN->getUnderlyingTemplate());
 return;
   }
   case TemplateName::DependentTemplate: {
@@ -1162,7 +1187,7 @@ void TextNodeDumper::dumpTemplateName(TemplateName TN) {
 if (const TemplateTemplateParmDecl *P = STS->getParameter())
   AddChild("parameter", [=] { Visit(P); });
 dumpDeclRef(STS->getAssociatedDecl(), "associated");
-AddChild("replacement", [=] { dumpTemplateName(STS->getReplacement()); });
+dumpTemplateName(STS->getReplacement(), "replacement");
 return;
   }
   // FIXME: Implement these.
@@ -1182,14 +1207,14 @@ void TextNodeDumper::dumpTemplateName(TemplateName TN) {
 void TextNodeDumper::VisitTemplateTemplateArgument(const TemplateArgument ) 
{
   OS << " template";
   dumpTemplateArgument(TA);
-  dumpTemplateName(TA.getAsTemplate());
+  dumpBareTemplateName(TA.getAsTemplate());
 }
 
 void TextNodeDumper::VisitTemplateExpansionTemplateArgument(
 const TemplateArgument ) {
   OS << " template expansion";
   dumpTemplateArgument(TA);
- 

[clang] [clang] text ast-dumper: dump TemplateName for TST and DTST (PR #93766)

2024-05-30 Thread Matheus Izvekov via cfe-commits

https://github.com/mizvekov edited 
https://github.com/llvm/llvm-project/pull/93766
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] CWG150: add tests and change to unreleased (PR #93758)

2024-05-30 Thread Matheus Izvekov via cfe-commits

https://github.com/mizvekov closed 
https://github.com/llvm/llvm-project/pull/93758
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [libcxx] [clang] Preserve Qualifiers and type sugar in TemplateNames (PR #93433)

2024-05-30 Thread Matheus Izvekov via cfe-commits

mizvekov wrote:

@nikic Thanks for the heads-up. I expected some impact. There are some ideas to 
regain that loss in follow up work.

https://github.com/llvm/llvm-project/pull/93433
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] CWG150: add tests and change to unreleased (PR #93758)

2024-05-30 Thread Matheus Izvekov via cfe-commits

https://github.com/mizvekov updated 
https://github.com/llvm/llvm-project/pull/93758

>From 5ecb3c36d40bb4a361b9af8776e9c4e45fa15b8d Mon Sep 17 00:00:00 2001
From: Matheus Izvekov 
Date: Wed, 29 May 2024 22:23:01 -0300
Subject: [PATCH] [clang] CWG150: add tests and change to unreleased

---
 clang/test/CXX/drs/cwg1xx.cpp | 40 +++
 clang/www/cxx_dr_status.html  |  2 +-
 2 files changed, 41 insertions(+), 1 deletion(-)

diff --git a/clang/test/CXX/drs/cwg1xx.cpp b/clang/test/CXX/drs/cwg1xx.cpp
index 6bc63760f8333..b39cc21fa4917 100644
--- a/clang/test/CXX/drs/cwg1xx.cpp
+++ b/clang/test/CXX/drs/cwg1xx.cpp
@@ -753,6 +753,46 @@ namespace cwg148 { // cwg148: yes
 
 // cwg149: na
 
+namespace cwg150 { // cwg150: 19
+  namespace p1 {
+template 
+class ARG { };
+
+template  class PARM>
+void f(PARM) { }
+
+void g() {
+  ARG x;
+  f(x);
+}
+  } // namespace p1
+
+  namespace p2 {
+template  class PARM>
+class C {
+  PARM pi;
+};
+  } // namespace p2
+
+  namespace n1 {
+struct Dense { static const unsigned int dim = 1; };
+
+template  class View,
+  typename Block>
+void operator+(float, View const&);
+
+template 
+class Lvalue_proxy { operator float() const; };
+
+void test_1d (void) {
+  Lvalue_proxy p;
+  float b;
+  b + p;
+}
+  } // namespace n1
+}
+
 namespace cwg151 { // cwg151: 3.1
   struct X {};
   typedef int X::*p;
diff --git a/clang/www/cxx_dr_status.html b/clang/www/cxx_dr_status.html
index 4cce88fe0490f..628ee12992e6b 100755
--- a/clang/www/cxx_dr_status.html
+++ b/clang/www/cxx_dr_status.html
@@ -938,7 +938,7 @@ C++ defect report implementation status
 https://cplusplus.github.io/CWG/issues/150.html;>150
 C++17
 Template template parameters and default arguments
-Unknown
+Clang 19
   
   
 https://cplusplus.github.io/CWG/issues/151.html;>151

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2024-05-30 Thread Matheus Izvekov via cfe-commits

https://github.com/mizvekov closed 
https://github.com/llvm/llvm-project/pull/80245
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2024-05-30 Thread Matheus Izvekov via cfe-commits

mizvekov wrote:

I have revived this PR after a long time.

The original ODR violation bad diagnostic from the GH issue is gone from main, 
so I have removed the test for it.
My best guess is that the ODR checking must have gotten weakened somehow.
I really don't have time to dig into it though.

The original bug is still there in main, is self evident from looking at the 
source code, and can be confirmed bad and that it gets fixed by just looking at 
the AST dump.

https://github.com/llvm/llvm-project/pull/80245
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2024-05-30 Thread Matheus Izvekov via cfe-commits

https://github.com/mizvekov updated 
https://github.com/llvm/llvm-project/pull/80245

>From 9763cc9e6f081bc28b74164c77a2b80ac42aec1c Mon Sep 17 00:00:00 2001
From: Matheus Izvekov 
Date: Thu, 1 Feb 2024 02:26:10 -0300
Subject: [PATCH] [clang] fix merging of UsingShadowDecl

Previously, when deciding if two UsingShadowDecls where mergeable,
we would incorrectly only look for both pointing to the exact redecla
ration, whereas the correct thing is to look for declarations to the
same entity.

This problem has existed as far back as 2013, introduced in commit
fd8634a09de71.

This problem could manifest itself as ODR check false positives
when importing modules.

Fixes: #80252
---
 clang/docs/ReleaseNotes.rst | 3 +++
 clang/lib/AST/ASTContext.cpp| 2 +-
 clang/test/Modules/cxx20-decls.cppm | 4 ++--
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 44035f48cb3f9..9dc93f53fe716 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -813,6 +813,9 @@ Bug Fixes to C++ Support
 - Clang now allows ``@$``` in raw string literals. Fixes (#GH93130).
 - Fix an assertion failure when checking invalid ``this`` usage in the wrong 
context. (Fixes #GH91536).
 - Clang no longer models dependent NTTP arguments as 
``TemplateParamObjectDecl`` s. Fixes (#GH84052).
+- Fix incorrect merging of modules which contain using declarations which 
shadow
+  other declarations. This could manifest as ODR checker false positives.
+  Fixes (`#80252 `_)
 
 Bug Fixes to AST Handling
 ^
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index 06780ceba4074..73d3b152c49f1 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -6794,7 +6794,7 @@ bool ASTContext::isSameEntity(const NamedDecl *X, const 
NamedDecl *Y) const {
   // Using shadow declarations with the same target match.
   if (const auto *USX = dyn_cast(X)) {
 const auto *USY = cast(Y);
-return USX->getTargetDecl() == USY->getTargetDecl();
+return declaresSameEntity(USX->getTargetDecl(), USY->getTargetDecl());
   }
 
   // Using declarations with the same qualifier match. (We already know that
diff --git a/clang/test/Modules/cxx20-decls.cppm 
b/clang/test/Modules/cxx20-decls.cppm
index 9f0c40685b68f..0e8b59708ab4c 100644
--- a/clang/test/Modules/cxx20-decls.cppm
+++ b/clang/test/Modules/cxx20-decls.cppm
@@ -28,8 +28,8 @@ using xxx = baz::foo;
 // CHECK-NEXT: NamespaceDecl 0x[[BAZ_REDECL_ADDR:[^ ]*]] prev 0x[[BAZ_ADDR:[^ 
]*]]
 // CHECK:  TypeAliasDecl 0x[[ALIAS_REDECL_ADDR:[^ ]*]] prev 
0x[[ALIAS_ADDR:[^ ]*]]
 // FIXME: UsingShadowDecl should have been merged
-// CHECK:  UsingShadowDecl 0x{{[^ ]*}} <{{.*}}> col:{{.*}} imported in 
A. hidden implicit TypeAlias 0x[[ALIAS_REDECL_ADDR]] 'foo'
+// CHECK:  UsingShadowDecl 0x{{[^ ]*}} prev 0x[[SHADOW_ADDR:[^ ]*]] {{.*}} 
imported in A. {{.*}} 'foo'
 
 // CHECK-LABEL: Dumping baz:
 // CHECK-NEXT: NamespaceDecl 0x[[BAZ_ADDR]] <{{.*}}> line:{{.*}} baz
-// CHECK:  UsingShadowDecl 0x[[SHADOW_ADDR:[^ ]*]] <{{.*}}> col:{{.*}} 
implicit TypeAlias 0x[[ALIAS_ADDR]] 'foo'
+// CHECK:  UsingShadowDecl 0x[[SHADOW_ADDR]] {{.*}} 'foo'

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 498da62 - [NFC] [clang] add tests for merging of UsingShadowDecl

2024-05-29 Thread Matheus Izvekov via cfe-commits

Author: Matheus Izvekov
Date: 2024-05-30T02:56:57-03:00
New Revision: 498da62088b22ef1d4e90d6021a80ae7bab6abae

URL: 
https://github.com/llvm/llvm-project/commit/498da62088b22ef1d4e90d6021a80ae7bab6abae
DIFF: 
https://github.com/llvm/llvm-project/commit/498da62088b22ef1d4e90d6021a80ae7bab6abae.diff

LOG: [NFC] [clang] add tests for merging of UsingShadowDecl

Added: 
clang/test/Modules/cxx20-decls.cppm

Modified: 


Removed: 




diff  --git a/clang/test/Modules/cxx20-decls.cppm 
b/clang/test/Modules/cxx20-decls.cppm
new file mode 100644
index 0..9f0c40685b68f
--- /dev/null
+++ b/clang/test/Modules/cxx20-decls.cppm
@@ -0,0 +1,35 @@
+// 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.cpp -fmodule-file=A=%t/A.pcm 
-fsyntax-only -verify -ast-dump-all -ast-dump-filter baz | FileCheck %s
+
+//--- foo.h
+namespace baz {
+  using foo = char;
+  using baz::foo;
+}
+
+//--- A.cppm
+// expected-no-diagnostics
+module;
+#include "foo.h"
+export module A;
+
+//--- B.cpp
+// expected-no-diagnostics
+#include "foo.h"
+import A;
+// Since modules are loaded lazily, force loading by performing a lookup.
+using xxx = baz::foo;
+
+// CHECK-LABEL: Dumping baz:
+// CHECK-NEXT: NamespaceDecl 0x[[BAZ_REDECL_ADDR:[^ ]*]] prev 0x[[BAZ_ADDR:[^ 
]*]]
+// CHECK:  TypeAliasDecl 0x[[ALIAS_REDECL_ADDR:[^ ]*]] prev 
0x[[ALIAS_ADDR:[^ ]*]]
+// FIXME: UsingShadowDecl should have been merged
+// CHECK:  UsingShadowDecl 0x{{[^ ]*}} <{{.*}}> col:{{.*}} imported in 
A. hidden implicit TypeAlias 0x[[ALIAS_REDECL_ADDR]] 'foo'
+
+// CHECK-LABEL: Dumping baz:
+// CHECK-NEXT: NamespaceDecl 0x[[BAZ_ADDR]] <{{.*}}> line:{{.*}} baz
+// CHECK:  UsingShadowDecl 0x[[SHADOW_ADDR:[^ ]*]] <{{.*}}> col:{{.*}} 
implicit TypeAlias 0x[[ALIAS_ADDR]] 'foo'



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] Add option to generate additional debug info for expression dereferencing pointer to pointers. (PR #81545)

2024-05-29 Thread Matheus Izvekov via cfe-commits

mizvekov wrote:

I think the fix for the breakage is to just pin the new test to a fixed triple 
like so `-triple x86_64-linux-gnu`.

https://github.com/llvm/llvm-project/pull/81545
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] CWG150: add tests and change to unreleased (PR #93758)

2024-05-29 Thread Matheus Izvekov via cfe-commits

https://github.com/mizvekov created 
https://github.com/llvm/llvm-project/pull/93758

None

>From 834696f9b0a74c5a4c0d261480be6cff71fc91f5 Mon Sep 17 00:00:00 2001
From: Matheus Izvekov 
Date: Wed, 29 May 2024 22:23:01 -0300
Subject: [PATCH] [clang] CWG150: add tests and change to unreleased

---
 clang/test/CXX/drs/cwg1xx.cpp | 40 +++
 clang/www/cxx_dr_status.html  |  2 +-
 2 files changed, 41 insertions(+), 1 deletion(-)

diff --git a/clang/test/CXX/drs/cwg1xx.cpp b/clang/test/CXX/drs/cwg1xx.cpp
index 6bc63760f8333..6016af67aae1a 100644
--- a/clang/test/CXX/drs/cwg1xx.cpp
+++ b/clang/test/CXX/drs/cwg1xx.cpp
@@ -753,6 +753,46 @@ namespace cwg148 { // cwg148: yes
 
 // cwg149: na
 
+namespace cwg150 { // cwg150: yes
+  namespace p1 {
+template 
+class ARG { };
+
+template  class PARM>
+void f(PARM) { }
+
+void g() {
+  ARG x;
+  f(x);
+}
+  } // namespace p1
+
+  namespace p2 {
+template  class PARM>
+class C {
+  PARM pi;
+};
+  } // namespace p2
+
+  namespace n1 {
+struct Dense { static const unsigned int dim = 1; };
+
+template  class View,
+  typename Block>
+void operator+(float, View const&);
+
+template 
+class Lvalue_proxy { operator float() const; };
+
+void test_1d (void) {
+  Lvalue_proxy p;
+  float b;
+  b + p;
+}
+  } // namespace n1
+}
+
 namespace cwg151 { // cwg151: 3.1
   struct X {};
   typedef int X::*p;
diff --git a/clang/www/cxx_dr_status.html b/clang/www/cxx_dr_status.html
index 4cce88fe0490f..628ee12992e6b 100755
--- a/clang/www/cxx_dr_status.html
+++ b/clang/www/cxx_dr_status.html
@@ -938,7 +938,7 @@ C++ defect report implementation status
 https://cplusplus.github.io/CWG/issues/150.html;>150
 C++17
 Template template parameters and default arguments
-Unknown
+Clang 19
   
   
 https://cplusplus.github.io/CWG/issues/151.html;>151

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] fix printing of canonical template template parameters take 2 (PR #93448)

2024-05-29 Thread Matheus Izvekov via cfe-commits

https://github.com/mizvekov closed 
https://github.com/llvm/llvm-project/pull/93448
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] fix printing of canonical template template parameters take 2 (PR #93448)

2024-05-29 Thread Matheus Izvekov via cfe-commits

https://github.com/mizvekov updated 
https://github.com/llvm/llvm-project/pull/93448

>From 4ed34c959afa51328102ec037b418dbfc84ab063 Mon Sep 17 00:00:00 2001
From: Matheus Izvekov 
Date: Mon, 27 May 2024 05:51:18 -0300
Subject: [PATCH] [clang] fix printing of canonical template template
 parameters take 2

Since they can also occur as the template name of
template specializations, handle them from TemplateName
printing instead of TemplateArgument.
---
 clang/lib/AST/TemplateBase.cpp  | 11 +--
 clang/lib/AST/TemplateName.cpp  | 14 ++
 clang/test/SemaTemplate/deduction-guide.cpp | 10 +-
 3 files changed, 20 insertions(+), 15 deletions(-)

diff --git a/clang/lib/AST/TemplateBase.cpp b/clang/lib/AST/TemplateBase.cpp
index 6d3c843cfd29e..46f7b79b272ef 100644
--- a/clang/lib/AST/TemplateBase.cpp
+++ b/clang/lib/AST/TemplateBase.cpp
@@ -544,16 +544,7 @@ void TemplateArgument::print(const PrintingPolicy , 
raw_ostream ,
 break;
 
   case Template: {
-TemplateName TN = getAsTemplate();
-if (const auto *TD = TN.getAsTemplateDecl();
-TD && TD->getDeclName().isEmpty()) {
-  assert(isa(TD) &&
- "Unexpected anonymous template");
-  const auto *TTP = cast(TD);
-  Out << "template-parameter-" << TTP->getDepth() << "-" << 
TTP->getIndex();
-} else {
-  TN.print(Out, Policy);
-}
+getAsTemplate().print(Out, Policy);
 break;
   }
 
diff --git a/clang/lib/AST/TemplateName.cpp b/clang/lib/AST/TemplateName.cpp
index 3aae998eceeb0..3dbdad92813f6 100644
--- a/clang/lib/AST/TemplateName.cpp
+++ b/clang/lib/AST/TemplateName.cpp
@@ -292,6 +292,14 @@ void TemplateName::Profile(llvm::FoldingSetNodeID ) {
 
 void TemplateName::print(raw_ostream , const PrintingPolicy ,
  Qualified Qual) const {
+  auto handleAnonymousTTP = [](TemplateDecl *TD, raw_ostream ) {
+if (TemplateTemplateParmDecl *TTP = dyn_cast(TD);
+TTP && TTP->getIdentifier() == nullptr) {
+  OS << "template-parameter-" << TTP->getDepth() << "-" << TTP->getIndex();
+  return true;
+}
+return false;
+  };
   if (NameKind Kind = getKind();
   Kind == TemplateName::Template || Kind == TemplateName::UsingTemplate) {
 // After `namespace ns { using std::vector }`, what is the fully-qualified
@@ -304,6 +312,8 @@ void TemplateName::print(raw_ostream , const 
PrintingPolicy ,
 // names more often than to export them, thus using the original name is
 // most useful in this case.
 TemplateDecl *Template = getAsTemplateDecl();
+if (handleAnonymousTTP(Template, OS))
+  return;
 if (Qual == Qualified::None)
   OS << *Template;
 else
@@ -320,6 +330,10 @@ void TemplateName::print(raw_ostream , const 
PrintingPolicy ,
Underlying.getKind() == TemplateName::UsingTemplate);
 
 TemplateDecl *UTD = Underlying.getAsTemplateDecl();
+
+if (handleAnonymousTTP(UTD, OS))
+  return;
+
 if (IdentifierInfo *II = UTD->getIdentifier();
 Policy.CleanUglifiedParameters && II &&
 isa(UTD))
diff --git a/clang/test/SemaTemplate/deduction-guide.cpp 
b/clang/test/SemaTemplate/deduction-guide.cpp
index 96b4cd9622a24..100b580fe9f02 100644
--- a/clang/test/SemaTemplate/deduction-guide.cpp
+++ b/clang/test/SemaTemplate/deduction-guide.cpp
@@ -315,19 +315,19 @@ namespace TTP {
 // CHECK-NEXT:  |-TemplateTypeParmDecl {{.+}} class depth 0 index 0 T{{$}}
 // CHECK-NEXT:  |-TemplateTemplateParmDecl {{.+}} depth 0 index 1 TT{{$}}
 // CHECK-NEXT:  | `-TemplateTypeParmDecl {{.+}} class depth 1 index 0{{$}}
-// CHECK-NEXT:  |-CXXDeductionGuideDecl {{.+}} 'auto () -> B'{{$}}
-// CHECK-NEXT:  | `-ParmVarDecl {{.+}} ''{{$}}
+// CHECK-NEXT:  |-CXXDeductionGuideDecl {{.+}} 'auto 
(template-parameter-0-1) -> B'{{$}}
+// CHECK-NEXT:  | `-ParmVarDecl {{.+}} 'template-parameter-0-1'{{$}}
 // CHECK-NEXT:  `-CXXDeductionGuideDecl {{.+}} 'auto (A) -> TTP::B'
 // CHECK-NEXT:|-TemplateArgument type 'int'
 // CHECK-NEXT:| `-BuiltinType {{.+}} 'int'{{$}}
 // CHECK-NEXT:|-TemplateArgument template 'TTP::A'{{$}}
 // CHECK-NEXT:| `-ClassTemplateDecl {{.+}} A{{$}}
 // CHECK-NEXT:`-ParmVarDecl {{.+}} 'A':'TTP::A'{{$}}
-// CHECK-NEXT:  FunctionProtoType {{.+}} 'auto () -> B' dependent 
trailing_return cdecl{{$}}
+// CHECK-NEXT:  FunctionProtoType {{.+}} 'auto (template-parameter-0-1) -> 
B' dependent trailing_return cdecl{{$}}
 // CHECK-NEXT:  |-InjectedClassNameType {{.+}} 'B' dependent{{$}}
 // CHECK-NEXT:  | `-CXXRecord {{.+}} 'B'{{$}}
-// CHECK-NEXT:  `-ElaboratedType {{.+}} '' sugar dependent{{$}}
-// CHECK-NEXT:`-TemplateSpecializationType {{.+}} '' dependent {{$}}
+// CHECK-NEXT:  `-ElaboratedType {{.+}} 'template-parameter-0-1' sugar 
dependent{{$}}
+// CHECK-NEXT:`-TemplateSpecializationType {{.+}} 
'template-parameter-0-1' dependent template-parameter-0-1{{$}}
 // CHECK-NEXT:  `-TemplateArgument type 'T':'type-parameter-0-0'{{$}}
 // CHECK-NEXT:

[clang] [libcxx] [clang] fix printing of canonical template template parameters take 2 (PR #93448)

2024-05-29 Thread Matheus Izvekov via cfe-commits

https://github.com/mizvekov edited 
https://github.com/llvm/llvm-project/pull/93448
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [libcxx] [clang] Preserve Qualifiers and type sugar in TemplateNames (PR #93433)

2024-05-29 Thread Matheus Izvekov via cfe-commits

https://github.com/mizvekov closed 
https://github.com/llvm/llvm-project/pull/93433
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [libcxx] [clang] Preserve Qualifiers and type sugar in TemplateNames (PR #93433)

2024-05-29 Thread Matheus Izvekov via cfe-commits

https://github.com/mizvekov edited 
https://github.com/llvm/llvm-project/pull/93433
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] Improve ast-dumper text printing of TemplateArgument (PR #93431)

2024-05-29 Thread Matheus Izvekov via cfe-commits

https://github.com/mizvekov closed 
https://github.com/llvm/llvm-project/pull/93431
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


  1   2   3   4   5   6   >