@@ -2596,27 +2588,14 @@ class VarTemplateSpecializationDecl : public VarDecl,
llvm::PointerUnion
SpecializedTemplate;
- /// Further info for explicit template specialization/instantiation.
- struct ExplicitSpecializationInfo {
-/// The type-as-written.
-
@@ -2596,27 +2588,14 @@ class VarTemplateSpecializationDecl : public VarDecl,
llvm::PointerUnion
SpecializedTemplate;
- /// Further info for explicit template specialization/instantiation.
- struct ExplicitSpecializationInfo {
-/// The type-as-written.
-
@@ -2596,27 +2588,14 @@ class VarTemplateSpecializationDecl : public VarDecl,
llvm::PointerUnion
SpecializedTemplate;
- /// Further info for explicit template specialization/instantiation.
- struct ExplicitSpecializationInfo {
-/// The type-as-written.
-
@@ -1455,21 +1455,17 @@ void TypePrinter::printTag(TagDecl *D, raw_ostream )
{
// If this is a class template specialization, print the template
// arguments.
- if (const auto *Spec = dyn_cast(D)) {
-ArrayRef Args;
-TypeSourceInfo *TAW =
@@ -1455,21 +1455,17 @@ void TypePrinter::printTag(TagDecl *D, raw_ostream )
{
// If this is a class template specialization, print the template
// arguments.
- if (const auto *Spec = dyn_cast(D)) {
-ArrayRef Args;
-TypeSourceInfo *TAW =
erichkeane wrote:
> @erichkeane Regarding "Still waiting on this?", I pushed a commit that
> addresses the fixme. I'll be addressing the rest of your review comments in a
> subsequent commit..
>
> Also, if we are renaming `ExplicitInstantiationInfo::ExternLoc` to
> `ExternKeywordLoc`, should
sdkrystian wrote:
@erichkeane Regarding "Still waiting on this?", I pushed a commit that
addresses the fixme. I'll be addressing the rest of your review comments in a
subsequent commit..
Also, if we are renaming `ExplicitInstantiationInfo::ExternLoc` to
`ExternKeywordLoc`, should we rename
https://github.com/sdkrystian updated
https://github.com/llvm/llvm-project/pull/81642
>From b45a42322682f3b872e6753965c4e4a7edb68333 Mon Sep 17 00:00:00 2001
From: Krystian Stasiowski
Date: Fri, 9 Feb 2024 14:00:49 -0500
Subject: [PATCH 1/6] [Clang] Unify interface for accessing template
@@ -1455,21 +1455,17 @@ void TypePrinter::printTag(TagDecl *D, raw_ostream )
{
// If this is a class template specialization, print the template
// arguments.
- if (const auto *Spec = dyn_cast(D)) {
-ArrayRef Args;
-TypeSourceInfo *TAW =
@@ -1455,21 +1455,17 @@ void TypePrinter::printTag(TagDecl *D, raw_ostream )
{
// If this is a class template specialization, print the template
// arguments.
- if (const auto *Spec = dyn_cast(D)) {
-ArrayRef Args;
-TypeSourceInfo *TAW =
https://github.com/erichkeane commented:
A few more suggestions, also I like Shafik's suggestion on the variable name.
https://github.com/llvm/llvm-project/pull/81642
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
@@ -2545,10 +2545,12 @@ ASTDeclReader::VisitClassTemplateSpecializationDeclImpl(
}
// Explicit info.
- if (TypeSourceInfo *TyInfo = readTypeSourceInfo()) {
-auto *ExplicitInfo =
-new (C) ClassTemplateSpecializationDecl::ExplicitSpecializationInfo;
-
@@ -2596,27 +2588,14 @@ class VarTemplateSpecializationDecl : public VarDecl,
llvm::PointerUnion
SpecializedTemplate;
- /// Further info for explicit template specialization/instantiation.
- struct ExplicitSpecializationInfo {
-/// The type-as-written.
-
https://github.com/erichkeane edited
https://github.com/llvm/llvm-project/pull/81642
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/sdkrystian updated
https://github.com/llvm/llvm-project/pull/81642
>From b45a42322682f3b872e6753965c4e4a7edb68333 Mon Sep 17 00:00:00 2001
From: Krystian Stasiowski
Date: Fri, 9 Feb 2024 14:00:49 -0500
Subject: [PATCH 1/5] [Clang] Unify interface for accessing template
github-actions[bot] wrote:
:warning: C/C++ code formatter, clang-format found issues in your code.
:warning:
You can test this locally with the following command:
``bash
git-clang-format --diff f914e8e77c4703814e2f2dcef1d4569b17837c92
01858345a1146f761dec8e5d0a5a36dc0507ec48 --
https://github.com/sdkrystian updated
https://github.com/llvm/llvm-project/pull/81642
>From b45a42322682f3b872e6753965c4e4a7edb68333 Mon Sep 17 00:00:00 2001
From: Krystian Stasiowski
Date: Fri, 9 Feb 2024 14:00:49 -0500
Subject: [PATCH 1/4] [Clang] Unify interface for accessing template
@@ -1760,6 +1760,21 @@ class BuiltinTemplateDecl : public TemplateDecl {
BuiltinTemplateKind getBuiltinTemplateKind() const { return BTK; }
};
+/// Provides information about an explicit instantiation of a variable or class
+/// template.
+struct ExplicitInstantiationInfo {
@@ -1760,6 +1760,21 @@ class BuiltinTemplateDecl : public TemplateDecl {
BuiltinTemplateKind getBuiltinTemplateKind() const { return BTK; }
};
+/// Provides information about an explicit instantiation of a variable or class
+/// template.
+struct ExplicitInstantiationInfo {
@@ -1792,23 +1807,11 @@ class ClassTemplateSpecializationDecl
llvm::PointerUnion
SpecializedTemplate;
- /// Further info for explicit template specialization/instantiation.
- struct ExplicitSpecializationInfo {
-/// The type-as-written.
-TypeSourceInfo
https://github.com/ChuanqiXu9 commented:
Sounds good. My instinct reaction to the title is that you're going to unify
the annoying duplicated interfaces for the 5 specialization classes (function
specialization, class/var (partial) specializations). But it is still good to
merge these
@@ -1792,23 +1807,11 @@ class ClassTemplateSpecializationDecl
llvm::PointerUnion
SpecializedTemplate;
- /// Further info for explicit template specialization/instantiation.
- struct ExplicitSpecializationInfo {
-/// The type-as-written.
-TypeSourceInfo
https://github.com/ChuanqiXu9 edited
https://github.com/llvm/llvm-project/pull/81642
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -2545,10 +2545,12 @@ ASTDeclReader::VisitClassTemplateSpecializationDeclImpl(
}
// Explicit info.
- if (TypeSourceInfo *TyInfo = readTypeSourceInfo()) {
-auto *ExplicitInfo =
-new (C) ClassTemplateSpecializationDecl::ExplicitSpecializationInfo;
-
@@ -6316,6 +6310,15 @@ TEST(HasAnyTemplateArgumentLoc,
BindsToSpecializationWithDoubleArgument) {
hasTypeLoc(loc(asString("double")));
}
+TEST(HasAnyTemplateArgumentLoc, BindsToExplicitSpecializationWithIntArgument) {
+ EXPECT_TRUE(
+
@@ -6390,6 +6394,7 @@ TEST(HasTemplateArgumentLoc,
BindsToSpecializationWithDoubleArgument) {
0, hasTypeLoc(loc(asString("double")));
}
+#if 0
erichkeane wrote:
Same question here :)
@@ -2545,10 +2545,12 @@ ASTDeclReader::VisitClassTemplateSpecializationDeclImpl(
}
// Explicit info.
- if (TypeSourceInfo *TyInfo = readTypeSourceInfo()) {
-auto *ExplicitInfo =
-new (C) ClassTemplateSpecializationDecl::ExplicitSpecializationInfo;
-
@@ -6316,6 +6310,15 @@ TEST(HasAnyTemplateArgumentLoc,
BindsToSpecializationWithDoubleArgument) {
hasTypeLoc(loc(asString("double")));
}
+TEST(HasAnyTemplateArgumentLoc, BindsToExplicitSpecializationWithIntArgument) {
+ EXPECT_TRUE(
+
https://github.com/sdkrystian edited
https://github.com/llvm/llvm-project/pull/81642
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -285,30 +285,23 @@ template<>
class SpecializationDecl;
// CHECK: [[@LINE-1]]:7 | class(Gen,TS)/C++ | SpecializationDecl |
c:@S@SpecializationDecl>#I | | Decl,RelSpecialization | rel: 1
// CHECK-NEXT: RelSpecialization | SpecializationDecl |
c:@ST>1#T@SpecializationDecl
https://github.com/sdkrystian updated
https://github.com/llvm/llvm-project/pull/81642
>From 0834af0d1fcd2a87656fabdb7b0aee0f42b9b52f Mon Sep 17 00:00:00 2001
From: Krystian Stasiowski
Date: Fri, 9 Feb 2024 14:00:49 -0500
Subject: [PATCH 1/3] [Clang] Unify interface for accessing template
https://github.com/sdkrystian updated
https://github.com/llvm/llvm-project/pull/81642
>From 0834af0d1fcd2a87656fabdb7b0aee0f42b9b52f Mon Sep 17 00:00:00 2001
From: Krystian Stasiowski
Date: Fri, 9 Feb 2024 14:00:49 -0500
Subject: [PATCH 1/2] [Clang] Unify interface for accessing template
@@ -285,30 +285,23 @@ template<>
class SpecializationDecl;
// CHECK: [[@LINE-1]]:7 | class(Gen,TS)/C++ | SpecializationDecl |
c:@S@SpecializationDecl>#I | | Decl,RelSpecialization | rel: 1
// CHECK-NEXT: RelSpecialization | SpecializationDecl |
c:@ST>1#T@SpecializationDecl
@@ -279,7 +279,7 @@ namespace dr727 { // dr727: partial
// cxx98-11-error@-1 {{variable templates are a C++14 extension}}
// cxx98-14-error@-2 {{inline variables are a C++17 extension}}
template<> static inline int v2; // #dr727-v2-T
-// cxx98-14-error@-1
@@ -222,7 +220,7 @@ int binTempl;
template
float binTempl = 1;
-// CHECK: VarTemplatePartialSpecializationDecl 0x{{[^ ]*}}
col:7 binTempl 'float' cinit
sdkrystian wrote:
I removed `cinit` because the output will contain "`explicit_specialization`"
@@ -2596,23 +2582,24 @@ class VarTemplateSpecializationDecl : public VarDecl,
llvm::PointerUnion
SpecializedTemplate;
- /// Further info for explicit template specialization/instantiation.
- struct ExplicitSpecializationInfo {
-/// The type-as-written.
-
@@ -1985,44 +1986,45 @@ class ClassTemplateSpecializationDecl
SpecializedTemplate = TemplDecl;
}
- /// Sets the type of this specialization as it was written by
- /// the user. This will be a class template specialization type.
- void setTypeAsWritten(TypeSourceInfo
@@ -285,30 +285,23 @@ template<>
class SpecializationDecl;
// CHECK: [[@LINE-1]]:7 | class(Gen,TS)/C++ | SpecializationDecl |
c:@S@SpecializationDecl>#I | | Decl,RelSpecialization | rel: 1
// CHECK-NEXT: RelSpecialization | SpecializationDecl |
c:@ST>1#T@SpecializationDecl
@@ -279,7 +279,7 @@ namespace dr727 { // dr727: partial
// cxx98-11-error@-1 {{variable templates are a C++14 extension}}
// cxx98-14-error@-2 {{inline variables are a C++17 extension}}
template<> static inline int v2; // #dr727-v2-T
-// cxx98-14-error@-1
@@ -222,7 +220,7 @@ int binTempl;
template
float binTempl = 1;
-// CHECK: VarTemplatePartialSpecializationDecl 0x{{[^ ]*}}
col:7 binTempl 'float' cinit
erichkeane wrote:
Why are we losing 'const-int' (Is that what cinit means?) here? Is that
perhaps
@@ -1985,44 +1986,45 @@ class ClassTemplateSpecializationDecl
SpecializedTemplate = TemplDecl;
}
- /// Sets the type of this specialization as it was written by
- /// the user. This will be a class template specialization type.
- void setTypeAsWritten(TypeSourceInfo
@@ -2596,23 +2582,24 @@ class VarTemplateSpecializationDecl : public VarDecl,
llvm::PointerUnion
SpecializedTemplate;
- /// Further info for explicit template specialization/instantiation.
- struct ExplicitSpecializationInfo {
-/// The type-as-written.
-
erichkeane wrote:
>The "most breaking" change is to AST Matchers, insofar that hasTypeLoc will no
>longer match class template specializations (since they no longer store the
>type as written). I wasn't entirely sure what to replace the tests for this
>behavior with, so I just commented them
llvmbot wrote:
@llvm/pr-subscribers-clang-modules
@llvm/pr-subscribers-clang
Author: Krystian Stasiowski (sdkrystian)
Changes
Our current method of storing the template arguments as written for
`(Class/Var)Template(Partial)SpecializationDecl` suffers from a number of flaws:
- We use
https://github.com/sdkrystian created
https://github.com/llvm/llvm-project/pull/81642
Our current method of storing the template arguments as written for
`(Class/Var)Template(Partial)SpecializationDecl` suffers from a number of flaws:
- We use `TypeSourceInfo` to store `TemplateArgumentLocs`
45 matches
Mail list logo