@@ -1760,6 +1760,21 @@ class BuiltinTemplateDecl : public TemplateDecl {
1760
1760
BuiltinTemplateKind getBuiltinTemplateKind () const { return BTK; }
1761
1761
};
1762
1762
1763
+ // / Provides information about an explicit instantiation of a variable or class
1764
+ // / template.
1765
+ struct ExplicitInstantiationInfo {
1766
+ // / The template arguments as written..
1767
+ const ASTTemplateArgumentListInfo *TemplateArgsAsWritten = nullptr ;
1768
+
1769
+ // / The location of the extern keyword.
1770
+ SourceLocation ExternLoc;
1771
+
1772
+ // / The location of the template keyword.
1773
+ SourceLocation TemplateKeywordLoc;
1774
+
1775
+ ExplicitInstantiationInfo () = default ;
1776
+ };
1777
+
1763
1778
// / Represents a class template specialization, which refers to
1764
1779
// / a class template with a given set of template arguments.
1765
1780
// /
@@ -1792,19 +1807,6 @@ class ClassTemplateSpecializationDecl
1792
1807
llvm::PointerUnion<ClassTemplateDecl *, SpecializedPartialSpecialization *>
1793
1808
SpecializedTemplate;
1794
1809
1795
- struct ExplicitInstantiationInfo {
1796
- // / The template arguments as written..
1797
- const ASTTemplateArgumentListInfo *TemplateArgsAsWritten = nullptr ;
1798
-
1799
- // / The location of the extern keyword.
1800
- SourceLocation ExternLoc;
1801
-
1802
- // / The location of the template keyword.
1803
- SourceLocation TemplateKeywordLoc;
1804
-
1805
- ExplicitInstantiationInfo () = default ;
1806
- };
1807
-
1808
1810
// / Further info for explicit template specialization/instantiation.
1809
1811
// / Does not apply to implicit specializations.
1810
1812
llvm::PointerUnion<const ASTTemplateArgumentListInfo *,
@@ -1986,26 +1988,15 @@ class ClassTemplateSpecializationDecl
1986
1988
SpecializedTemplate = TemplDecl;
1987
1989
}
1988
1990
1991
+ // / Retrieve the template argument list as written in the sources,
1992
+ // / if any.
1989
1993
const ASTTemplateArgumentListInfo *getTemplateArgsAsWritten () const {
1990
1994
if (auto *Info = ExplicitInfo.dyn_cast <ExplicitInstantiationInfo *>())
1991
1995
return Info->TemplateArgsAsWritten ;
1992
1996
return ExplicitInfo.get <const ASTTemplateArgumentListInfo *>();
1993
1997
}
1994
1998
1995
- // / Gets the location of the extern keyword, if present.
1996
- SourceLocation getExternLoc () const {
1997
- if (auto *Info = ExplicitInfo.dyn_cast <ExplicitInstantiationInfo *>())
1998
- return Info->ExternLoc ;
1999
- return SourceLocation ();
2000
- }
2001
-
2002
- // / Gets the location of the template keyword, if present.
2003
- SourceLocation getTemplateKeywordLoc () const {
2004
- if (auto *Info = ExplicitInfo.dyn_cast <ExplicitInstantiationInfo *>())
2005
- return Info->TemplateKeywordLoc ;
2006
- return SourceLocation ();
2007
- }
2008
-
1999
+ // / Set the template argument list as written in the sources.
2009
2000
void
2010
2001
setTemplateArgsAsWritten (const ASTTemplateArgumentListInfo *ArgsWritten) {
2011
2002
if (auto *Info = ExplicitInfo.dyn_cast <ExplicitInstantiationInfo *>())
@@ -2014,14 +2005,29 @@ class ClassTemplateSpecializationDecl
2014
2005
ExplicitInfo = ArgsWritten;
2015
2006
}
2016
2007
2008
+ // / Set the template argument list as written in the sources.
2017
2009
void setTemplateArgsAsWritten (const TemplateArgumentListInfo &ArgsInfo) {
2018
2010
setTemplateArgsAsWritten (
2019
2011
ASTTemplateArgumentListInfo::Create (getASTContext (), ArgsInfo));
2020
2012
}
2021
2013
2014
+ // / Gets the location of the extern keyword, if present.
2015
+ SourceLocation getExternLoc () const {
2016
+ if (auto *Info = ExplicitInfo.dyn_cast <ExplicitInstantiationInfo *>())
2017
+ return Info->ExternLoc ;
2018
+ return SourceLocation ();
2019
+ }
2020
+
2022
2021
// / Sets the location of the extern keyword.
2023
2022
void setExternLoc (SourceLocation Loc);
2024
2023
2024
+ // / Gets the location of the template keyword, if present.
2025
+ SourceLocation getTemplateKeywordLoc () const {
2026
+ if (auto *Info = ExplicitInfo.dyn_cast <ExplicitInstantiationInfo *>())
2027
+ return Info->TemplateKeywordLoc ;
2028
+ return SourceLocation ();
2029
+ }
2030
+
2025
2031
// / Sets the location of the template keyword.
2026
2032
void setTemplateKeywordLoc (SourceLocation Loc);
2027
2033
@@ -2582,19 +2588,6 @@ class VarTemplateSpecializationDecl : public VarDecl,
2582
2588
llvm::PointerUnion<VarTemplateDecl *, SpecializedPartialSpecialization *>
2583
2589
SpecializedTemplate;
2584
2590
2585
- struct ExplicitInstantiationInfo {
2586
- // / The template arguments as written..
2587
- const ASTTemplateArgumentListInfo *TemplateArgsAsWritten = nullptr ;
2588
-
2589
- // / The location of the extern keyword.
2590
- SourceLocation ExternLoc;
2591
-
2592
- // / The location of the template keyword.
2593
- SourceLocation TemplateKeywordLoc;
2594
-
2595
- ExplicitInstantiationInfo () = default ;
2596
- };
2597
-
2598
2591
// / Further info for explicit template specialization/instantiation.
2599
2592
// / Does not apply to implicit specializations.
2600
2593
llvm::PointerUnion<const ASTTemplateArgumentListInfo *,
@@ -2603,7 +2596,6 @@ class VarTemplateSpecializationDecl : public VarDecl,
2603
2596
2604
2597
// / The template arguments used to describe this specialization.
2605
2598
const TemplateArgumentList *TemplateArgs;
2606
- const ASTTemplateArgumentListInfo *TemplateArgsInfo = nullptr ;
2607
2599
2608
2600
// / The point where this template was instantiated (if any).
2609
2601
SourceLocation PointOfInstantiation;
@@ -2760,26 +2752,15 @@ class VarTemplateSpecializationDecl : public VarDecl,
2760
2752
SpecializedTemplate = TemplDecl;
2761
2753
}
2762
2754
2755
+ // / Retrieve the template argument list as written in the sources,
2756
+ // / if any.
2763
2757
const ASTTemplateArgumentListInfo *getTemplateArgsAsWritten () const {
2764
2758
if (auto *Info = ExplicitInfo.dyn_cast <ExplicitInstantiationInfo *>())
2765
2759
return Info->TemplateArgsAsWritten ;
2766
2760
return ExplicitInfo.get <const ASTTemplateArgumentListInfo *>();
2767
2761
}
2768
2762
2769
- // / Gets the location of the extern keyword, if present.
2770
- SourceLocation getExternLoc () const {
2771
- if (auto *Info = ExplicitInfo.dyn_cast <ExplicitInstantiationInfo *>())
2772
- return Info->ExternLoc ;
2773
- return SourceLocation ();
2774
- }
2775
-
2776
- // / Gets the location of the template keyword, if present.
2777
- SourceLocation getTemplateKeywordLoc () const {
2778
- if (auto *Info = ExplicitInfo.dyn_cast <ExplicitInstantiationInfo *>())
2779
- return Info->TemplateKeywordLoc ;
2780
- return SourceLocation ();
2781
- }
2782
-
2763
+ // / Set the template argument list as written in the sources.
2783
2764
void
2784
2765
setTemplateArgsAsWritten (const ASTTemplateArgumentListInfo *ArgsWritten) {
2785
2766
if (auto *Info = ExplicitInfo.dyn_cast <ExplicitInstantiationInfo *>())
@@ -2788,14 +2769,29 @@ class VarTemplateSpecializationDecl : public VarDecl,
2788
2769
ExplicitInfo = ArgsWritten;
2789
2770
}
2790
2771
2772
+ // / Set the template argument list as written in the sources.
2791
2773
void setTemplateArgsAsWritten (const TemplateArgumentListInfo &ArgsInfo) {
2792
2774
setTemplateArgsAsWritten (
2793
2775
ASTTemplateArgumentListInfo::Create (getASTContext (), ArgsInfo));
2794
2776
}
2795
2777
2778
+ // / Gets the location of the extern keyword, if present.
2779
+ SourceLocation getExternLoc () const {
2780
+ if (auto *Info = ExplicitInfo.dyn_cast <ExplicitInstantiationInfo *>())
2781
+ return Info->ExternLoc ;
2782
+ return SourceLocation ();
2783
+ }
2784
+
2796
2785
// / Sets the location of the extern keyword.
2797
2786
void setExternLoc (SourceLocation Loc);
2798
2787
2788
+ // / Gets the location of the template keyword, if present.
2789
+ SourceLocation getTemplateKeywordLoc () const {
2790
+ if (auto *Info = ExplicitInfo.dyn_cast <ExplicitInstantiationInfo *>())
2791
+ return Info->TemplateKeywordLoc ;
2792
+ return SourceLocation ();
2793
+ }
2794
+
2799
2795
// / Sets the location of the template keyword.
2800
2796
void setTemplateKeywordLoc (SourceLocation Loc);
2801
2797
0 commit comments