@@ -2426,7 +2426,7 @@ class TemplateSpecializationType
2426
2426
// The bool is whether this is a current instantiation.
2427
2427
llvm::PointerIntPair<ASTContext*, 1 , bool > ContextAndCurrentInstantiation;
2428
2428
2429
- // / \brief The name of the template being specialized.
2429
+ // / \brief The name of the template being specialized.
2430
2430
TemplateName Template;
2431
2431
2432
2432
// / \brief - The number of template arguments named in this class
@@ -2476,7 +2476,7 @@ class TemplateSpecializationType
2476
2476
typedef const TemplateArgument * iterator;
2477
2477
2478
2478
iterator begin () const { return getArgs (); }
2479
- iterator end () const ;
2479
+ iterator end () const ; // defined inline in TemplateBase.h
2480
2480
2481
2481
// / \brief Retrieve the name of the template that we are specializing.
2482
2482
TemplateName getTemplateName () const { return Template; }
@@ -2491,7 +2491,7 @@ class TemplateSpecializationType
2491
2491
2492
2492
// / \brief Retrieve a specific template argument as a type.
2493
2493
// / \precondition @c isArgType(Arg)
2494
- const TemplateArgument &getArg (unsigned Idx) const ;
2494
+ const TemplateArgument &getArg (unsigned Idx) const ; // in TemplateBase.h
2495
2495
2496
2496
bool isSugared () const {
2497
2497
return !isDependentType () || isCurrentInstantiation ();
@@ -2682,6 +2682,7 @@ class ElaboratedType : public TypeWithKeyword, public llvm::FoldingSetNode {
2682
2682
friend class ASTContext ; // ASTContext creates these
2683
2683
2684
2684
public:
2685
+ ~ElaboratedType ();
2685
2686
2686
2687
// / \brief Retrieve the qualification on this type.
2687
2688
NestedNameSpecifier *getQualifier () const { return NNS; }
@@ -2726,11 +2727,8 @@ class DependentNameType : public TypeWithKeyword, public llvm::FoldingSetNode {
2726
2727
// / \brief The nested name specifier containing the qualifier.
2727
2728
NestedNameSpecifier *NNS;
2728
2729
2729
- typedef llvm::PointerUnion<const IdentifierInfo *,
2730
- const TemplateSpecializationType *> NameType;
2731
-
2732
2730
// / \brief The type that this typename specifier refers to.
2733
- NameType Name;
2731
+ const IdentifierInfo * Name;
2734
2732
2735
2733
DependentNameType (ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS,
2736
2734
const IdentifierInfo *Name, QualType CanonType)
@@ -2740,17 +2738,10 @@ class DependentNameType : public TypeWithKeyword, public llvm::FoldingSetNode {
2740
2738
" DependentNameType requires a dependent nested-name-specifier" );
2741
2739
}
2742
2740
2743
- DependentNameType (ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS,
2744
- const TemplateSpecializationType *Ty, QualType CanonType)
2745
- : TypeWithKeyword(Keyword, DependentName, CanonType, true ),
2746
- NNS(NNS), Name(Ty) {
2747
- assert (NNS->isDependent () &&
2748
- " DependentNameType requires a dependent nested-name-specifier" );
2749
- }
2750
-
2751
2741
friend class ASTContext ; // ASTContext creates these
2752
2742
2753
2743
public:
2744
+ virtual ~DependentNameType ();
2754
2745
2755
2746
// / \brief Retrieve the qualification on this type.
2756
2747
NestedNameSpecifier *getQualifier () const { return NNS; }
@@ -2762,13 +2753,7 @@ class DependentNameType : public TypeWithKeyword, public llvm::FoldingSetNode {
2762
2753
// / form of the original typename was terminated by an identifier,
2763
2754
// / e.g., "typename T::type".
2764
2755
const IdentifierInfo *getIdentifier () const {
2765
- return Name.dyn_cast <const IdentifierInfo *>();
2766
- }
2767
-
2768
- // / \brief Retrieve the type named by the typename specifier as a
2769
- // / type specialization.
2770
- const TemplateSpecializationType *getTemplateId () const {
2771
- return Name.dyn_cast <const TemplateSpecializationType *>();
2756
+ return Name;
2772
2757
}
2773
2758
2774
2759
bool isSugared () const { return false ; }
@@ -2779,10 +2764,10 @@ class DependentNameType : public TypeWithKeyword, public llvm::FoldingSetNode {
2779
2764
}
2780
2765
2781
2766
static void Profile (llvm::FoldingSetNodeID &ID, ElaboratedTypeKeyword Keyword,
2782
- NestedNameSpecifier *NNS, NameType Name) {
2767
+ NestedNameSpecifier *NNS, const IdentifierInfo * Name) {
2783
2768
ID.AddInteger (Keyword);
2784
2769
ID.AddPointer (NNS);
2785
- ID.AddPointer (Name. getOpaqueValue () );
2770
+ ID.AddPointer (Name);
2786
2771
}
2787
2772
2788
2773
static bool classof (const Type *T) {
@@ -2791,6 +2776,88 @@ class DependentNameType : public TypeWithKeyword, public llvm::FoldingSetNode {
2791
2776
static bool classof (const DependentNameType *T) { return true ; }
2792
2777
};
2793
2778
2779
+ // / DependentTemplateSpecializationType - Represents a template
2780
+ // / specialization type whose template cannot be resolved, e.g.
2781
+ // / A<T>::template B<T>
2782
+ class DependentTemplateSpecializationType :
2783
+ public TypeWithKeyword, public llvm::FoldingSetNode {
2784
+
2785
+ // / The AST context. Unfortunately required in order to profile
2786
+ // / template arguments.
2787
+ ASTContext &Context;
2788
+
2789
+ // / \brief The nested name specifier containing the qualifier.
2790
+ NestedNameSpecifier *NNS;
2791
+
2792
+ // / \brief The identifier of the template.
2793
+ const IdentifierInfo *Name;
2794
+
2795
+ // / \brief - The number of template arguments named in this class
2796
+ // / template specialization.
2797
+ unsigned NumArgs;
2798
+
2799
+ const TemplateArgument *getArgBuffer () const {
2800
+ return reinterpret_cast <const TemplateArgument*>(this +1 );
2801
+ }
2802
+ TemplateArgument *getArgBuffer () {
2803
+ return reinterpret_cast <TemplateArgument*>(this +1 );
2804
+ }
2805
+
2806
+ DependentTemplateSpecializationType (ASTContext &Context,
2807
+ ElaboratedTypeKeyword Keyword,
2808
+ NestedNameSpecifier *NNS,
2809
+ const IdentifierInfo *Name,
2810
+ unsigned NumArgs,
2811
+ const TemplateArgument *Args,
2812
+ QualType Canon);
2813
+
2814
+ virtual void Destroy (ASTContext& C);
2815
+
2816
+ friend class ASTContext ; // ASTContext creates these
2817
+
2818
+ public:
2819
+ virtual ~DependentTemplateSpecializationType ();
2820
+
2821
+ NestedNameSpecifier *getQualifier () const { return NNS; }
2822
+ const IdentifierInfo *getIdentifier () const { return Name; }
2823
+
2824
+ // / \brief Retrieve the template arguments.
2825
+ const TemplateArgument *getArgs () const {
2826
+ return getArgBuffer ();
2827
+ }
2828
+
2829
+ // / \brief Retrieve the number of template arguments.
2830
+ unsigned getNumArgs () const { return NumArgs; }
2831
+
2832
+ const TemplateArgument &getArg (unsigned Idx) const ; // in TemplateBase.h
2833
+
2834
+ typedef const TemplateArgument * iterator;
2835
+ iterator begin () const { return getArgs (); }
2836
+ iterator end () const ; // inline in TemplateBase.h
2837
+
2838
+ bool isSugared () const { return false ; }
2839
+ QualType desugar () const { return QualType (this , 0 ); }
2840
+
2841
+ void Profile (llvm::FoldingSetNodeID &ID) {
2842
+ Profile (ID, Context, getKeyword (), NNS, Name, NumArgs, getArgs ());
2843
+ }
2844
+
2845
+ static void Profile (llvm::FoldingSetNodeID &ID,
2846
+ ASTContext &Context,
2847
+ ElaboratedTypeKeyword Keyword,
2848
+ NestedNameSpecifier *Qualifier,
2849
+ const IdentifierInfo *Name,
2850
+ unsigned NumArgs,
2851
+ const TemplateArgument *Args);
2852
+
2853
+ static bool classof (const Type *T) {
2854
+ return T->getTypeClass () == DependentTemplateSpecialization;
2855
+ }
2856
+ static bool classof (const DependentTemplateSpecializationType *T) {
2857
+ return true ;
2858
+ }
2859
+ };
2860
+
2794
2861
// / ObjCObjectType - Represents a class type in Objective C.
2795
2862
// / Every Objective C type is a combination of a base type and a
2796
2863
// / list of protocols.
0 commit comments