@@ -519,8 +519,11 @@ class FunctionTemplateSpecializationInfo final
519
519
return Function.getInt ();
520
520
}
521
521
522
+ void loadExternalRedecls ();
523
+
522
524
public:
523
525
friend TrailingObjects;
526
+ friend class ASTReader ;
524
527
525
528
static FunctionTemplateSpecializationInfo *
526
529
Create (ASTContext &C, FunctionDecl *FD, FunctionTemplateDecl *Template,
@@ -817,13 +820,20 @@ class RedeclarableTemplateDecl : public TemplateDecl,
817
820
return SpecIterator<EntryType>(isEnd ? Specs.end () : Specs.begin ());
818
821
}
819
822
820
- void loadLazySpecializationsImpl () const ;
823
+ void loadExternalSpecializations () const ;
821
824
822
825
template <class EntryType , typename ...ProfileArguments>
823
826
typename SpecEntryTraits<EntryType>::DeclType*
824
827
findSpecializationImpl (llvm::FoldingSetVector<EntryType> &Specs,
825
828
void *&InsertPos, ProfileArguments &&...ProfileArgs);
826
829
830
+ template <class EntryType , typename ... ProfileArguments>
831
+ typename SpecEntryTraits<EntryType>::DeclType *
832
+ findLocalSpecialization (llvm::FoldingSetVector<EntryType> &Specs,
833
+ void *&InsertPos, ProfileArguments &&... ProfileArgs);
834
+
835
+ bool loadLazySpecializationsWithArgs (ArrayRef<TemplateArgument> TemplateArgs);
836
+
827
837
template <class Derived , class EntryType >
828
838
void addSpecializationImpl (llvm::FoldingSetVector<EntryType> &Specs,
829
839
EntryType *Entry, void *InsertPos);
@@ -842,9 +852,13 @@ class RedeclarableTemplateDecl : public TemplateDecl,
842
852
// / If non-null, points to an array of specializations (including
843
853
// / partial specializations) known only by their external declaration IDs.
844
854
// /
855
+ // / These specializations needs to be loaded at once in
856
+ // / loadExternalSpecializations to complete the redecl chain or be preparing
857
+ // / for template resolution.
858
+ // /
845
859
// / The first value in the array is the number of specializations/partial
846
860
// / specializations that follow.
847
- uint32_t *LazySpecializations = nullptr ;
861
+ uint32_t *ExternalSpecializations = nullptr ;
848
862
849
863
// / The set of "injected" template arguments used within this
850
864
// / template.
@@ -878,6 +892,8 @@ class RedeclarableTemplateDecl : public TemplateDecl,
878
892
friend class ASTDeclWriter ;
879
893
friend class ASTReader ;
880
894
template <class decl_type > friend class RedeclarableTemplate ;
895
+ friend class ClassTemplateSpecializationDecl ;
896
+ friend class VarTemplateSpecializationDecl ;
881
897
882
898
// / Retrieves the canonical declaration of this template.
883
899
RedeclarableTemplateDecl *getCanonicalDecl () override {
@@ -1005,6 +1021,7 @@ SpecEntryTraits<FunctionTemplateSpecializationInfo> {
1005
1021
class FunctionTemplateDecl : public RedeclarableTemplateDecl {
1006
1022
protected:
1007
1023
friend class FunctionDecl ;
1024
+ friend class FunctionTemplateSpecializationInfo ;
1008
1025
1009
1026
// / Data that is common to all of the declarations of a given
1010
1027
// / function template.
@@ -1040,13 +1057,13 @@ class FunctionTemplateDecl : public RedeclarableTemplateDecl {
1040
1057
void addSpecialization (FunctionTemplateSpecializationInfo* Info,
1041
1058
void *InsertPos);
1042
1059
1060
+ // / Load any lazily-loaded specializations from the external source.
1061
+ void LoadLazySpecializations () const ;
1062
+
1043
1063
public:
1044
1064
friend class ASTDeclReader ;
1045
1065
friend class ASTDeclWriter ;
1046
1066
1047
- // / Load any lazily-loaded specializations from the external source.
1048
- void LoadLazySpecializations () const ;
1049
-
1050
1067
// / Get the underlying function declaration of the template.
1051
1068
FunctionDecl *getTemplatedDecl () const {
1052
1069
return static_cast <FunctionDecl *>(TemplatedDecl);
@@ -1884,6 +1901,8 @@ class ClassTemplateSpecializationDecl
1884
1901
// / Really a value of type TemplateSpecializationKind.
1885
1902
unsigned SpecializationKind : 3 ;
1886
1903
1904
+ void loadExternalRedecls ();
1905
+
1887
1906
protected:
1888
1907
ClassTemplateSpecializationDecl (ASTContext &Context, Kind DK, TagKind TK,
1889
1908
DeclContext *DC, SourceLocation StartLoc,
@@ -1897,6 +1916,7 @@ class ClassTemplateSpecializationDecl
1897
1916
public:
1898
1917
friend class ASTDeclReader ;
1899
1918
friend class ASTDeclWriter ;
1919
+ friend class ASTReader ;
1900
1920
1901
1921
static ClassTemplateSpecializationDecl *
1902
1922
Create (ASTContext &Context, TagKind TK, DeclContext *DC,
@@ -2325,6 +2345,9 @@ class ClassTemplateDecl : public RedeclarableTemplateDecl {
2325
2345
friend class ASTDeclReader ;
2326
2346
friend class ASTDeclWriter ;
2327
2347
2348
+ friend class TemplateDeclInstantiator ;
2349
+ friend class ClassTemplateSpecializationDecl ;
2350
+
2328
2351
// / Load any lazily-loaded specializations from the external source.
2329
2352
void LoadLazySpecializations () const ;
2330
2353
@@ -2767,6 +2790,8 @@ class VarTemplateSpecializationDecl : public VarDecl,
2767
2790
// / no initializer.
2768
2791
unsigned IsCompleteDefinition : 1 ;
2769
2792
2793
+ void loadExternalRedecls ();
2794
+
2770
2795
protected:
2771
2796
VarTemplateSpecializationDecl (Kind DK, ASTContext &Context, DeclContext *DC,
2772
2797
SourceLocation StartLoc, SourceLocation IdLoc,
@@ -2780,6 +2805,7 @@ class VarTemplateSpecializationDecl : public VarDecl,
2780
2805
public:
2781
2806
friend class ASTDeclReader ;
2782
2807
friend class ASTDeclWriter ;
2808
+ friend class ASTReader ;
2783
2809
friend class VarDecl ;
2784
2810
2785
2811
static VarTemplateSpecializationDecl *
@@ -3185,8 +3211,7 @@ class VarTemplateDecl : public RedeclarableTemplateDecl {
3185
3211
friend class ASTDeclReader ;
3186
3212
friend class ASTDeclWriter ;
3187
3213
3188
- // / Load any lazily-loaded specializations from the external source.
3189
- void LoadLazySpecializations () const ;
3214
+ friend class VarTemplatePartialSpecializationDecl ;
3190
3215
3191
3216
// / Get the underlying variable declarations of the template.
3192
3217
VarDecl *getTemplatedDecl () const {
0 commit comments