1 //===-- DeclTemplate.h - Classes for representing C++ templates -*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines the C++ template declaration subclasses.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_CLANG_AST_DECLTEMPLATE_H
15 #define LLVM_CLANG_AST_DECLTEMPLATE_H
17 #include "clang/AST/DeclCXX.h"
18 #include "clang/AST/TemplateBase.h"
19 #include "llvm/ADT/PointerUnion.h"
24 class TemplateParameterList;
26 class FunctionTemplateDecl;
27 class ClassTemplateDecl;
28 class ClassTemplatePartialSpecializationDecl;
29 class TemplateTypeParmDecl;
30 class NonTypeTemplateParmDecl;
31 class TemplateTemplateParmDecl;
33 /// \brief Stores a template parameter of any kind.
34 typedef llvm::PointerUnion3<TemplateTypeParmDecl*, NonTypeTemplateParmDecl*,
35 TemplateTemplateParmDecl*> TemplateParameter;
37 /// TemplateParameterList - Stores a list of template parameters for a
38 /// TemplateDecl and its derived classes.
39 class TemplateParameterList {
40 /// The location of the 'template' keyword.
41 SourceLocation TemplateLoc;
43 /// The locations of the '<' and '>' angle brackets.
44 SourceLocation LAngleLoc, RAngleLoc;
46 /// The number of template parameters in this template
50 TemplateParameterList(SourceLocation TemplateLoc, SourceLocation LAngleLoc,
51 NamedDecl **Params, unsigned NumParams,
52 SourceLocation RAngleLoc);
55 static TemplateParameterList *Create(ASTContext &C,
56 SourceLocation TemplateLoc,
57 SourceLocation LAngleLoc,
60 SourceLocation RAngleLoc);
62 /// iterator - Iterates through the template parameters in this list.
63 typedef NamedDecl** iterator;
65 /// const_iterator - Iterates through the template parameters in this list.
66 typedef NamedDecl* const* const_iterator;
68 iterator begin() { return reinterpret_cast<NamedDecl **>(this + 1); }
69 const_iterator begin() const {
70 return reinterpret_cast<NamedDecl * const *>(this + 1);
72 iterator end() { return begin() + NumParams; }
73 const_iterator end() const { return begin() + NumParams; }
75 unsigned size() const { return NumParams; }
77 NamedDecl* getParam(unsigned Idx) {
78 assert(Idx < size() && "Template parameter index out-of-range");
82 const NamedDecl* getParam(unsigned Idx) const {
83 assert(Idx < size() && "Template parameter index out-of-range");
87 /// \btief Returns the minimum number of arguments needed to form a
88 /// template specialization. This may be fewer than the number of
89 /// template parameters, if some of the parameters have default
90 /// arguments or if there is a parameter pack.
91 unsigned getMinRequiredArguments() const;
93 /// \brief Get the depth of this template parameter list in the set of
94 /// template parameter lists.
96 /// The first template parameter list in a declaration will have depth 0,
97 /// the second template parameter list will have depth 1, etc.
98 unsigned getDepth() const;
100 SourceLocation getTemplateLoc() const { return TemplateLoc; }
101 SourceLocation getLAngleLoc() const { return LAngleLoc; }
102 SourceLocation getRAngleLoc() const { return RAngleLoc; }
104 SourceRange getSourceRange() const {
105 return SourceRange(TemplateLoc, RAngleLoc);
109 /// \brief A helper class for making template argument lists.
110 class TemplateArgumentListBuilder {
111 TemplateArgument *StructuredArgs;
112 unsigned MaxStructuredArgs;
113 unsigned NumStructuredArgs;
115 llvm::SmallVector<TemplateArgument, 4> FlatArgs;
116 unsigned MaxFlatArgs;
117 unsigned NumFlatArgs;
120 unsigned PackBeginIndex;
123 TemplateArgumentListBuilder(const TemplateParameterList *Parameters,
124 unsigned NumTemplateArgs)
125 : StructuredArgs(0), MaxStructuredArgs(Parameters->size()),
126 NumStructuredArgs(0), FlatArgs(0),
127 MaxFlatArgs(std::max(MaxStructuredArgs, NumTemplateArgs)), NumFlatArgs(0),
128 AddingToPack(false), PackBeginIndex(0) { }
130 void Append(const TemplateArgument &Arg);
134 unsigned flatSize() const { return FlatArgs.size(); }
135 const TemplateArgument *getFlatArguments() const { return FlatArgs.data(); }
137 unsigned structuredSize() const {
138 // If we don't have any structured args, just reuse the flat size.
142 return NumStructuredArgs;
144 const TemplateArgument *getStructuredArguments() const {
145 // If we don't have any structured args, just reuse the flat args.
147 return getFlatArguments();
149 return StructuredArgs;
153 /// \brief A template argument list.
155 /// FIXME: In the future, this class will be extended to support
156 /// variadic templates and member templates, which will make some of
157 /// the function names below make more sense.
158 class TemplateArgumentList {
159 /// \brief The template argument list.
161 /// The integer value will be non-zero to indicate that this
162 /// template argument list does own the pointer.
163 llvm::PointerIntPair<const TemplateArgument *, 1> FlatArguments;
165 /// \brief The number of template arguments in this template
167 unsigned NumFlatArguments;
169 llvm::PointerIntPair<const TemplateArgument *, 1> StructuredArguments;
170 unsigned NumStructuredArguments;
172 TemplateArgumentList(const TemplateArgumentList &Other); // DO NOT IMPL
173 void operator=(const TemplateArgumentList &Other); // DO NOT IMPL
175 /// TemplateArgumentList - If this constructor is passed "true" for 'TakeArgs'
176 /// it copies them into a locally new[]'d array. If passed "false", then it
177 /// just references the array passed in. This is only safe if the builder
178 /// outlives it, but saves a copy.
179 TemplateArgumentList(ASTContext &Context,
180 TemplateArgumentListBuilder &Builder,
183 /// Produces a shallow copy of the given template argument list. This
184 /// assumes that the input argument list outlives it. This takes the list as
185 /// a pointer to avoid looking like a copy constructor, since this really
186 /// really isn't safe to use that way.
187 explicit TemplateArgumentList(const TemplateArgumentList *Other);
189 /// Used to release the memory associated with a TemplateArgumentList
190 /// object. FIXME: This is currently not called anywhere, but the
191 /// memory will still be freed when using a BumpPtrAllocator.
192 void Destroy(ASTContext &C);
194 ~TemplateArgumentList();
196 /// \brief Retrieve the template argument at a given index.
197 const TemplateArgument &get(unsigned Idx) const {
198 assert(Idx < NumFlatArguments && "Invalid template argument index");
199 return getFlatArgumentList()[Idx];
202 /// \brief Retrieve the template argument at a given index.
203 const TemplateArgument &operator[](unsigned Idx) const { return get(Idx); }
205 /// \brief Retrieve the number of template arguments in this
206 /// template argument list.
207 unsigned size() const { return NumFlatArguments; }
209 /// \brief Retrieve the number of template arguments in the
210 /// flattened template argument list.
211 unsigned flat_size() const { return NumFlatArguments; }
213 /// \brief Retrieve the flattened template argument list.
214 const TemplateArgument *getFlatArgumentList() const {
215 return FlatArguments.getPointer();
219 //===----------------------------------------------------------------------===//
220 // Kinds of Templates
221 //===----------------------------------------------------------------------===//
223 /// TemplateDecl - The base class of all kinds of template declarations (e.g.,
224 /// class, function, etc.). The TemplateDecl class stores the list of template
225 /// parameters and a reference to the templated scoped declaration: the
226 /// underlying AST node.
227 class TemplateDecl : public NamedDecl {
229 // This is probably never used.
230 TemplateDecl(Kind DK, DeclContext *DC, SourceLocation L,
231 DeclarationName Name)
232 : NamedDecl(DK, DC, L, Name), TemplatedDecl(0), TemplateParams(0) { }
234 // Construct a template decl with the given name and parameters.
235 // Used when there is not templated element (tt-params, alias?).
236 TemplateDecl(Kind DK, DeclContext *DC, SourceLocation L,
237 DeclarationName Name, TemplateParameterList *Params)
238 : NamedDecl(DK, DC, L, Name), TemplatedDecl(0), TemplateParams(Params) { }
240 // Construct a template decl with name, parameters, and templated element.
241 TemplateDecl(Kind DK, DeclContext *DC, SourceLocation L,
242 DeclarationName Name, TemplateParameterList *Params,
244 : NamedDecl(DK, DC, L, Name), TemplatedDecl(Decl),
245 TemplateParams(Params) { }
249 /// Get the list of template parameters
250 TemplateParameterList *getTemplateParameters() const {
251 return TemplateParams;
254 /// Get the underlying, templated declaration.
255 NamedDecl *getTemplatedDecl() const { return TemplatedDecl; }
257 // Implement isa/cast/dyncast/etc.
258 static bool classof(const Decl *D) { return classofKind(D->getKind()); }
259 static bool classof(const TemplateDecl *D) { return true; }
260 static bool classof(const FunctionTemplateDecl *D) { return true; }
261 static bool classof(const ClassTemplateDecl *D) { return true; }
262 static bool classof(const TemplateTemplateParmDecl *D) { return true; }
263 static bool classofKind(Kind K) {
264 return K >= TemplateFirst && K <= TemplateLast;
268 NamedDecl *TemplatedDecl;
269 TemplateParameterList* TemplateParams;
272 /// \brief Provides information about a function template specialization,
273 /// which is a FunctionDecl that has been explicitly specialization or
274 /// instantiated from a function template.
275 class FunctionTemplateSpecializationInfo : public llvm::FoldingSetNode {
277 /// \brief The function template specialization that this structure
279 FunctionDecl *Function;
281 /// \brief The function template from which this function template
282 /// specialization was generated.
284 /// The two bits are contain the top 4 values of TemplateSpecializationKind.
285 llvm::PointerIntPair<FunctionTemplateDecl *, 2> Template;
287 /// \brief The template arguments used to produce the function template
288 /// specialization from the function template.
289 const TemplateArgumentList *TemplateArguments;
291 /// \brief The template arguments as written in the sources, if provided.
292 const TemplateArgumentListInfo *TemplateArgumentsAsWritten;
294 /// \brief The point at which this function template specialization was
295 /// first instantiated.
296 SourceLocation PointOfInstantiation;
298 /// \brief Retrieve the template from which this function was specialized.
299 FunctionTemplateDecl *getTemplate() const { return Template.getPointer(); }
301 /// \brief Determine what kind of template specialization this is.
302 TemplateSpecializationKind getTemplateSpecializationKind() const {
303 return (TemplateSpecializationKind)(Template.getInt() + 1);
306 /// \brief Set the template specialization kind.
307 void setTemplateSpecializationKind(TemplateSpecializationKind TSK) {
308 assert(TSK != TSK_Undeclared &&
309 "Cannot encode TSK_Undeclared for a function template specialization");
310 Template.setInt(TSK - 1);
313 /// \brief Retrieve the first point of instantiation of this function
314 /// template specialization.
316 /// The point of instantiation may be an invalid source location if this
317 /// function has yet to be instantiated.
318 SourceLocation getPointOfInstantiation() const {
319 return PointOfInstantiation;
322 /// \brief Set the (first) point of instantiation of this function template
324 void setPointOfInstantiation(SourceLocation POI) {
325 PointOfInstantiation = POI;
328 void Profile(llvm::FoldingSetNodeID &ID) {
329 Profile(ID, TemplateArguments->getFlatArgumentList(),
330 TemplateArguments->flat_size(),
331 Function->getASTContext());
335 Profile(llvm::FoldingSetNodeID &ID, const TemplateArgument *TemplateArgs,
336 unsigned NumTemplateArgs, ASTContext &Context) {
337 ID.AddInteger(NumTemplateArgs);
338 for (unsigned Arg = 0; Arg != NumTemplateArgs; ++Arg)
339 TemplateArgs[Arg].Profile(ID, Context);
343 /// \brief Provides information a specialization of a member of a class
344 /// template, which may be a member function, static data member, or
346 class MemberSpecializationInfo {
347 // The member declaration from which this member was instantiated, and the
348 // manner in which the instantiation occurred (in the lower two bits).
349 llvm::PointerIntPair<NamedDecl *, 2> MemberAndTSK;
351 // The point at which this member was first instantiated.
352 SourceLocation PointOfInstantiation;
356 MemberSpecializationInfo(NamedDecl *IF, TemplateSpecializationKind TSK)
357 : MemberAndTSK(IF, TSK - 1), PointOfInstantiation() {
358 assert(TSK != TSK_Undeclared &&
359 "Cannot encode undeclared template specializations for members");
362 /// \brief Retrieve the member declaration from which this member was
364 NamedDecl *getInstantiatedFrom() const { return MemberAndTSK.getPointer(); }
366 /// \brief Determine what kind of template specialization this is.
367 TemplateSpecializationKind getTemplateSpecializationKind() const {
368 return (TemplateSpecializationKind)(MemberAndTSK.getInt() + 1);
371 /// \brief Set the template specialization kind.
372 void setTemplateSpecializationKind(TemplateSpecializationKind TSK) {
373 assert(TSK != TSK_Undeclared &&
374 "Cannot encode undeclared template specializations for members");
375 MemberAndTSK.setInt(TSK - 1);
378 /// \brief Retrieve the first point of instantiation of this member.
379 /// If the point of instantiation is an invalid location, then this member
380 /// has not yet been instantiated.
381 SourceLocation getPointOfInstantiation() const {
382 return PointOfInstantiation;
385 /// \brief Set the first point of instantiation.
386 void setPointOfInstantiation(SourceLocation POI) {
387 PointOfInstantiation = POI;
391 /// \brief Provides information about a dependent function-template
392 /// specialization declaration. Since explicit function template
393 /// specialization and instantiation declarations can only appear in
394 /// namespace scope, and you can only specialize a member of a
395 /// fully-specialized class, the only way to get one of these is in
396 /// a friend declaration like the following:
398 /// template <class T> void foo(T);
399 /// template <class T> class A {
400 /// friend void foo<>(T);
402 class DependentFunctionTemplateSpecializationInfo {
404 // Force sizeof to be a multiple of sizeof(void*) so that the
405 // trailing data is aligned.
409 /// The number of potential template candidates.
410 unsigned NumTemplates;
412 /// The number of template arguments.
417 /// The locations of the left and right angle brackets.
418 SourceRange AngleLocs;
420 FunctionTemplateDecl * const *getTemplates() const {
421 return reinterpret_cast<FunctionTemplateDecl*const*>(this+1);
424 const TemplateArgumentLoc *getTemplateArgs() const {
425 return reinterpret_cast<const TemplateArgumentLoc*>(
426 &getTemplates()[getNumTemplates()]);
430 DependentFunctionTemplateSpecializationInfo(
431 const UnresolvedSetImpl &Templates,
432 const TemplateArgumentListInfo &TemplateArgs);
434 /// \brief Returns the number of function templates that this might
435 /// be a specialization of.
436 unsigned getNumTemplates() const {
437 return d.NumTemplates;
440 /// \brief Returns the i'th template candidate.
441 FunctionTemplateDecl *getTemplate(unsigned I) const {
442 assert(I < getNumTemplates() && "template index out of range");
443 return getTemplates()[I];
446 /// \brief Returns the number of explicit template arguments that were given.
447 unsigned getNumTemplateArgs() const {
451 /// \brief Returns the nth template argument.
452 const TemplateArgumentLoc &getTemplateArg(unsigned I) const {
453 assert(I < getNumTemplateArgs() && "template arg index out of range");
454 return getTemplateArgs()[I];
457 SourceLocation getLAngleLoc() const {
458 return AngleLocs.getBegin();
461 SourceLocation getRAngleLoc() const {
462 return AngleLocs.getEnd();
466 /// Declaration of a template function.
467 class FunctionTemplateDecl : public TemplateDecl {
468 static void DeallocateCommon(void *Ptr);
471 /// \brief Data that is common to all of the declarations of a given
472 /// function template.
474 Common() : InstantiatedFromMember(0, false) { }
476 /// \brief The function template specializations for this function
477 /// template, including explicit specializations and instantiations.
478 llvm::FoldingSet<FunctionTemplateSpecializationInfo> Specializations;
480 /// \brief The member function template from which this was most
481 /// directly instantiated (or null).
483 /// The boolean value indicates whether this member function template
484 /// was explicitly specialized.
485 llvm::PointerIntPair<FunctionTemplateDecl*, 1, bool> InstantiatedFromMember;
488 /// \brief A pointer to the previous declaration (if this is a redeclaration)
489 /// or to the data that is common to all declarations of this function
491 llvm::PointerUnion<Common*, FunctionTemplateDecl*> CommonOrPrev;
493 /// \brief Retrieves the "common" pointer shared by all
494 /// (re-)declarations of the same function template. Calling this routine
495 /// may implicitly allocate memory for the common pointer.
496 Common *getCommonPtr();
498 FunctionTemplateDecl(DeclContext *DC, SourceLocation L, DeclarationName Name,
499 TemplateParameterList *Params, NamedDecl *Decl)
500 : TemplateDecl(FunctionTemplate, DC, L, Name, Params, Decl),
501 CommonOrPrev((Common*)0) { }
504 void Destroy(ASTContext &C);
506 /// Get the underlying function declaration of the template.
507 FunctionDecl *getTemplatedDecl() const {
508 return static_cast<FunctionDecl*>(TemplatedDecl);
511 /// \brief Retrieve the set of function template specializations of this
512 /// function template.
513 llvm::FoldingSet<FunctionTemplateSpecializationInfo> &getSpecializations() {
514 return getCommonPtr()->Specializations;
517 /// \brief Retrieve the previous declaration of this function template, or
518 /// NULL if no such declaration exists.
519 const FunctionTemplateDecl *getPreviousDeclaration() const {
520 return CommonOrPrev.dyn_cast<FunctionTemplateDecl*>();
523 /// \brief Retrieve the previous declaration of this function template, or
524 /// NULL if no such declaration exists.
525 FunctionTemplateDecl *getPreviousDeclaration() {
526 return CommonOrPrev.dyn_cast<FunctionTemplateDecl*>();
529 /// \brief Set the previous declaration of this function template.
530 void setPreviousDeclaration(FunctionTemplateDecl *Prev) {
535 virtual FunctionTemplateDecl *getCanonicalDecl();
537 /// \brief Retrieve the member function template that this function template
538 /// was instantiated from.
540 /// This routine will return non-NULL for member function templates of
541 /// class templates. For example, given:
544 /// template <typename T>
546 /// template <typename U> void f();
550 /// X<int>::A<float> is a CXXMethodDecl (whose parent is X<int>, a
551 /// ClassTemplateSpecializationDecl) for which getPrimaryTemplate() will
552 /// return X<int>::f, a FunctionTemplateDecl (whose parent is again
553 /// X<int>) for which getInstantiatedFromMemberTemplate() will return
554 /// X<T>::f, a FunctionTemplateDecl (whose parent is X<T>, a
555 /// ClassTemplateDecl).
557 /// \returns NULL if this is not an instantiation of a member function
559 FunctionTemplateDecl *getInstantiatedFromMemberTemplate() {
560 return getCommonPtr()->InstantiatedFromMember.getPointer();
563 void setInstantiatedFromMemberTemplate(FunctionTemplateDecl *FTD) {
564 assert(!getCommonPtr()->InstantiatedFromMember.getPointer());
565 getCommonPtr()->InstantiatedFromMember.setPointer(FTD);
568 /// \brief Determines whether this template was a specialization of a
571 /// In the following example, the function template \c X<int>::f is a
572 /// member specialization.
575 /// template<typename T>
577 /// template<typename U> void f(T, U);
580 /// template<> template<typename T>
581 /// void X<int>::f(int, T);
583 bool isMemberSpecialization() {
584 return getCommonPtr()->InstantiatedFromMember.getInt();
587 /// \brief Note that this member template is a specialization.
588 void setMemberSpecialization() {
589 assert(getCommonPtr()->InstantiatedFromMember.getPointer() &&
590 "Only member templates can be member template specializations");
591 getCommonPtr()->InstantiatedFromMember.setInt(true);
594 /// Create a template function node.
595 static FunctionTemplateDecl *Create(ASTContext &C, DeclContext *DC,
597 DeclarationName Name,
598 TemplateParameterList *Params,
601 // Implement isa/cast/dyncast support
602 static bool classof(const Decl *D) { return classofKind(D->getKind()); }
603 static bool classof(const FunctionTemplateDecl *D) { return true; }
604 static bool classofKind(Kind K) { return K == FunctionTemplate; }
607 //===----------------------------------------------------------------------===//
608 // Kinds of Template Parameters
609 //===----------------------------------------------------------------------===//
611 /// The TemplateParmPosition class defines the position of a template parameter
612 /// within a template parameter list. Because template parameter can be listed
613 /// sequentially for out-of-line template members, each template parameter is
614 /// given a Depth - the nesting of template parameter scopes - and a Position -
615 /// the occurrence within the parameter list.
616 /// This class is inheritedly privately by different kinds of template
617 /// parameters and is not part of the Decl hierarchy. Just a facility.
618 class TemplateParmPosition {
620 // FIXME: This should probably never be called, but it's here as
621 TemplateParmPosition()
622 : Depth(0), Position(0)
623 { /* assert(0 && "Cannot create positionless template parameter"); */ }
625 TemplateParmPosition(unsigned D, unsigned P)
626 : Depth(D), Position(P)
629 // FIXME: These probably don't need to be ints. int:5 for depth, int:8 for
635 /// Get the nesting depth of the template parameter.
636 unsigned getDepth() const { return Depth; }
638 /// Get the position of the template parameter within its parameter list.
639 unsigned getPosition() const { return Position; }
641 /// Get the index of the template parameter within its parameter list.
642 unsigned getIndex() const { return Position; }
645 /// TemplateTypeParmDecl - Declaration of a template type parameter,
648 /// template<typename T> class vector;
650 class TemplateTypeParmDecl : public TypeDecl {
651 /// \brief Whether this template type parameter was declaration with
652 /// the 'typename' keyword. If false, it was declared with the
656 /// \brief Whether this template type parameter inherited its
657 /// default argument.
658 bool InheritedDefault : 1;
660 /// \brief Whether this is a parameter pack.
661 bool ParameterPack : 1;
663 /// \brief The default template argument, if any.
664 TypeSourceInfo *DefaultArgument;
666 TemplateTypeParmDecl(DeclContext *DC, SourceLocation L, IdentifierInfo *Id,
667 bool Typename, QualType Type, bool ParameterPack)
668 : TypeDecl(TemplateTypeParm, DC, L, Id), Typename(Typename),
669 InheritedDefault(false), ParameterPack(ParameterPack), DefaultArgument() {
670 TypeForDecl = Type.getTypePtr();
674 static TemplateTypeParmDecl *Create(ASTContext &C, DeclContext *DC,
675 SourceLocation L, unsigned D, unsigned P,
676 IdentifierInfo *Id, bool Typename,
679 /// \brief Whether this template type parameter was declared with
680 /// the 'typename' keyword. If not, it was declared with the 'class'
682 bool wasDeclaredWithTypename() const { return Typename; }
684 /// \brief Determine whether this template parameter has a default
686 bool hasDefaultArgument() const { return DefaultArgument != 0; }
688 /// \brief Retrieve the default argument, if any.
689 QualType getDefaultArgument() const { return DefaultArgument->getType(); }
691 /// \brief Retrieves the default argument's source information, if any.
692 TypeSourceInfo *getDefaultArgumentInfo() const { return DefaultArgument; }
694 /// \brief Retrieves the location of the default argument declaration.
695 SourceLocation getDefaultArgumentLoc() const;
697 /// \brief Determines whether the default argument was inherited
698 /// from a previous declaration of this template.
699 bool defaultArgumentWasInherited() const { return InheritedDefault; }
701 /// \brief Set the default argument for this template parameter, and
702 /// whether that default argument was inherited from another
704 void setDefaultArgument(TypeSourceInfo *DefArg, bool Inherited) {
705 DefaultArgument = DefArg;
706 InheritedDefault = Inherited;
709 /// \brief Removes the default argument of this template parameter.
710 void removeDefaultArgument() {
712 InheritedDefault = false;
715 /// \brief Retrieve the depth of the template parameter.
716 unsigned getDepth() const;
718 /// \brief Retrieve the index of the template parameter.
719 unsigned getIndex() const;
721 /// \brief Returns whether this is a parameter pack.
722 bool isParameterPack() const { return ParameterPack; }
724 // Implement isa/cast/dyncast/etc.
725 static bool classof(const Decl *D) { return classofKind(D->getKind()); }
726 static bool classof(const TemplateTypeParmDecl *D) { return true; }
727 static bool classofKind(Kind K) { return K == TemplateTypeParm; }
730 /// NonTypeTemplateParmDecl - Declares a non-type template parameter,
733 /// template<int Size> class array { };
735 class NonTypeTemplateParmDecl
736 : public VarDecl, protected TemplateParmPosition {
737 /// \brief The default template argument, if any.
738 Expr *DefaultArgument;
740 NonTypeTemplateParmDecl(DeclContext *DC, SourceLocation L, unsigned D,
741 unsigned P, IdentifierInfo *Id, QualType T,
742 TypeSourceInfo *TInfo)
743 : VarDecl(NonTypeTemplateParm, DC, L, Id, T, TInfo, VarDecl::None,
745 TemplateParmPosition(D, P), DefaultArgument(0)
749 static NonTypeTemplateParmDecl *
750 Create(ASTContext &C, DeclContext *DC, SourceLocation L, unsigned D,
751 unsigned P, IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo);
753 using TemplateParmPosition::getDepth;
754 using TemplateParmPosition::getPosition;
755 using TemplateParmPosition::getIndex;
757 /// \brief Determine whether this template parameter has a default
759 bool hasDefaultArgument() const { return DefaultArgument; }
761 /// \brief Retrieve the default argument, if any.
762 Expr *getDefaultArgument() const { return DefaultArgument; }
764 /// \brief Retrieve the location of the default argument, if any.
765 SourceLocation getDefaultArgumentLoc() const;
767 /// \brief Set the default argument for this template parameter.
768 void setDefaultArgument(Expr *DefArg) {
769 DefaultArgument = DefArg;
772 // Implement isa/cast/dyncast/etc.
773 static bool classof(const Decl *D) { return classofKind(D->getKind()); }
774 static bool classof(const NonTypeTemplateParmDecl *D) { return true; }
775 static bool classofKind(Kind K) { return K == NonTypeTemplateParm; }
778 /// TemplateTemplateParmDecl - Declares a template template parameter,
781 /// template <template <typename> class T> class container { };
783 /// A template template parameter is a TemplateDecl because it defines the
784 /// name of a template and the template parameters allowable for substitution.
785 class TemplateTemplateParmDecl
786 : public TemplateDecl, protected TemplateParmPosition {
788 /// \brief The default template argument, if any.
789 TemplateArgumentLoc DefaultArgument;
791 TemplateTemplateParmDecl(DeclContext *DC, SourceLocation L,
792 unsigned D, unsigned P,
793 IdentifierInfo *Id, TemplateParameterList *Params)
794 : TemplateDecl(TemplateTemplateParm, DC, L, Id, Params),
795 TemplateParmPosition(D, P), DefaultArgument()
799 static TemplateTemplateParmDecl *Create(ASTContext &C, DeclContext *DC,
800 SourceLocation L, unsigned D,
801 unsigned P, IdentifierInfo *Id,
802 TemplateParameterList *Params);
804 using TemplateParmPosition::getDepth;
805 using TemplateParmPosition::getPosition;
806 using TemplateParmPosition::getIndex;
808 /// \brief Determine whether this template parameter has a default
810 bool hasDefaultArgument() const {
811 return !DefaultArgument.getArgument().isNull();
814 /// \brief Retrieve the default argument, if any.
815 const TemplateArgumentLoc &getDefaultArgument() const {
816 return DefaultArgument;
819 /// \brief Set the default argument for this template parameter.
820 void setDefaultArgument(const TemplateArgumentLoc &DefArg) {
821 DefaultArgument = DefArg;
824 // Implement isa/cast/dyncast/etc.
825 static bool classof(const Decl *D) { return classofKind(D->getKind()); }
826 static bool classof(const TemplateTemplateParmDecl *D) { return true; }
827 static bool classofKind(Kind K) { return K == TemplateTemplateParm; }
830 /// \brief Represents a class template specialization, which refers to
831 /// a class template with a given set of template arguments.
833 /// Class template specializations represent both explicit
834 /// specialization of class templates, as in the example below, and
835 /// implicit instantiations of class templates.
838 /// template<typename T> class array;
841 /// class array<bool> { }; // class template specialization array<bool>
843 class ClassTemplateSpecializationDecl
844 : public CXXRecordDecl, public llvm::FoldingSetNode {
846 /// \brief Structure that stores information about a class template
847 /// specialization that was instantiated from a class template partial
849 struct SpecializedPartialSpecialization {
850 /// \brief The class template partial specialization from which this
851 /// class template specialization was instantiated.
852 ClassTemplatePartialSpecializationDecl *PartialSpecialization;
854 /// \brief The template argument list deduced for the class template
855 /// partial specialization itself.
856 TemplateArgumentList *TemplateArgs;
859 /// \brief The template that this specialization specializes
860 llvm::PointerUnion<ClassTemplateDecl *, SpecializedPartialSpecialization *>
863 /// \brief The type-as-written of an explicit template specialization.
864 /// Does not apply to implicit specializations.
865 TypeSourceInfo *TypeAsWritten;
867 /// \brief The template arguments used to describe this specialization.
868 TemplateArgumentList TemplateArgs;
870 /// \brief The point where this template was instantiated (if any)
871 SourceLocation PointOfInstantiation;
873 /// \brief The kind of specialization this declaration refers to.
874 /// Really a value of type TemplateSpecializationKind.
875 unsigned SpecializationKind : 3;
878 ClassTemplateSpecializationDecl(ASTContext &Context, Kind DK, TagKind TK,
879 DeclContext *DC, SourceLocation L,
880 ClassTemplateDecl *SpecializedTemplate,
881 TemplateArgumentListBuilder &Builder,
882 ClassTemplateSpecializationDecl *PrevDecl);
885 static ClassTemplateSpecializationDecl *
886 Create(ASTContext &Context, TagKind TK, DeclContext *DC, SourceLocation L,
887 ClassTemplateDecl *SpecializedTemplate,
888 TemplateArgumentListBuilder &Builder,
889 ClassTemplateSpecializationDecl *PrevDecl);
891 virtual void Destroy(ASTContext& C);
893 virtual void getNameForDiagnostic(std::string &S,
894 const PrintingPolicy &Policy,
895 bool Qualified) const;
897 /// \brief Retrieve the template that this specialization specializes.
898 ClassTemplateDecl *getSpecializedTemplate() const;
900 /// \brief Retrieve the template arguments of the class template
902 const TemplateArgumentList &getTemplateArgs() const {
906 /// \brief Determine the kind of specialization that this
907 /// declaration represents.
908 TemplateSpecializationKind getSpecializationKind() const {
909 return static_cast<TemplateSpecializationKind>(SpecializationKind);
912 void setSpecializationKind(TemplateSpecializationKind TSK) {
913 SpecializationKind = TSK;
916 /// \brief Get the point of instantiation (if any), or null if none.
917 SourceLocation getPointOfInstantiation() const {
918 return PointOfInstantiation;
921 void setPointOfInstantiation(SourceLocation Loc) {
922 assert(Loc.isValid() && "point of instantiation must be valid!");
923 PointOfInstantiation = Loc;
926 /// \brief If this class template specialization is an instantiation of
927 /// a template (rather than an explicit specialization), return the
928 /// class template or class template partial specialization from which it
929 /// was instantiated.
930 llvm::PointerUnion<ClassTemplateDecl *,
931 ClassTemplatePartialSpecializationDecl *>
932 getInstantiatedFrom() const {
933 if (getSpecializationKind() != TSK_ImplicitInstantiation &&
934 getSpecializationKind() != TSK_ExplicitInstantiationDefinition &&
935 getSpecializationKind() != TSK_ExplicitInstantiationDeclaration)
936 return (ClassTemplateDecl*)0;
938 if (SpecializedPartialSpecialization *PartialSpec
939 = SpecializedTemplate.dyn_cast<SpecializedPartialSpecialization*>())
940 return PartialSpec->PartialSpecialization;
942 return const_cast<ClassTemplateDecl*>(
943 SpecializedTemplate.get<ClassTemplateDecl*>());
946 /// \brief Retrieve the set of template arguments that should be used
947 /// to instantiate members of the class template or class template partial
948 /// specialization from which this class template specialization was
951 /// \returns For a class template specialization instantiated from the primary
952 /// template, this function will return the same template arguments as
953 /// getTemplateArgs(). For a class template specialization instantiated from
954 /// a class template partial specialization, this function will return the
955 /// deduced template arguments for the class template partial specialization
957 const TemplateArgumentList &getTemplateInstantiationArgs() const {
958 if (SpecializedPartialSpecialization *PartialSpec
959 = SpecializedTemplate.dyn_cast<SpecializedPartialSpecialization*>())
960 return *PartialSpec->TemplateArgs;
962 return getTemplateArgs();
965 /// \brief Note that this class template specialization is actually an
966 /// instantiation of the given class template partial specialization whose
967 /// template arguments have been deduced.
968 void setInstantiationOf(ClassTemplatePartialSpecializationDecl *PartialSpec,
969 TemplateArgumentList *TemplateArgs) {
970 SpecializedPartialSpecialization *PS
971 = new (getASTContext()) SpecializedPartialSpecialization();
972 PS->PartialSpecialization = PartialSpec;
973 PS->TemplateArgs = TemplateArgs;
974 SpecializedTemplate = PS;
977 /// \brief Sets the type of this specialization as it was written by
978 /// the user. This will be a class template specialization type.
979 void setTypeAsWritten(TypeSourceInfo *T) {
983 /// \brief Gets the type of this specialization as it was written by
984 /// the user, if it was so written.
985 TypeSourceInfo *getTypeAsWritten() const {
986 return TypeAsWritten;
989 void Profile(llvm::FoldingSetNodeID &ID) const {
990 Profile(ID, TemplateArgs.getFlatArgumentList(), TemplateArgs.flat_size(),
995 Profile(llvm::FoldingSetNodeID &ID, const TemplateArgument *TemplateArgs,
996 unsigned NumTemplateArgs, ASTContext &Context) {
997 ID.AddInteger(NumTemplateArgs);
998 for (unsigned Arg = 0; Arg != NumTemplateArgs; ++Arg)
999 TemplateArgs[Arg].Profile(ID, Context);
1002 static bool classof(const Decl *D) { return classofKind(D->getKind()); }
1003 static bool classofKind(Kind K) {
1004 return K == ClassTemplateSpecialization ||
1005 K == ClassTemplatePartialSpecialization;
1008 static bool classof(const ClassTemplateSpecializationDecl *) {
1012 static bool classof(const ClassTemplatePartialSpecializationDecl *) {
1017 class ClassTemplatePartialSpecializationDecl
1018 : public ClassTemplateSpecializationDecl {
1019 /// \brief The list of template parameters
1020 TemplateParameterList* TemplateParams;
1022 /// \brief The source info for the template arguments as written.
1023 /// FIXME: redundant with TypeAsWritten?
1024 TemplateArgumentLoc *ArgsAsWritten;
1025 unsigned NumArgsAsWritten;
1027 /// \brief Sequence number indicating when this class template partial
1028 /// specialization was added to the set of partial specializations for
1029 /// its owning class template.
1030 unsigned SequenceNumber;
1032 /// \brief The class template partial specialization from which this
1033 /// class template partial specialization was instantiated.
1035 /// The boolean value will be true to indicate that this class template
1036 /// partial specialization was specialized at this level.
1037 llvm::PointerIntPair<ClassTemplatePartialSpecializationDecl *, 1, bool>
1038 InstantiatedFromMember;
1040 ClassTemplatePartialSpecializationDecl(ASTContext &Context, TagKind TK,
1041 DeclContext *DC, SourceLocation L,
1042 TemplateParameterList *Params,
1043 ClassTemplateDecl *SpecializedTemplate,
1044 TemplateArgumentListBuilder &Builder,
1045 TemplateArgumentLoc *ArgInfos,
1046 unsigned NumArgInfos,
1047 ClassTemplatePartialSpecializationDecl *PrevDecl,
1048 unsigned SequenceNumber)
1049 : ClassTemplateSpecializationDecl(Context,
1050 ClassTemplatePartialSpecialization,
1051 TK, DC, L, SpecializedTemplate, Builder,
1053 TemplateParams(Params), ArgsAsWritten(ArgInfos),
1054 NumArgsAsWritten(NumArgInfos), SequenceNumber(SequenceNumber),
1055 InstantiatedFromMember(0, false) { }
1058 static ClassTemplatePartialSpecializationDecl *
1059 Create(ASTContext &Context, TagKind TK,DeclContext *DC, SourceLocation L,
1060 TemplateParameterList *Params,
1061 ClassTemplateDecl *SpecializedTemplate,
1062 TemplateArgumentListBuilder &Builder,
1063 const TemplateArgumentListInfo &ArgInfos,
1064 QualType CanonInjectedType,
1065 ClassTemplatePartialSpecializationDecl *PrevDecl,
1066 unsigned SequenceNumber);
1068 /// Get the list of template parameters
1069 TemplateParameterList *getTemplateParameters() const {
1070 return TemplateParams;
1073 /// Get the template arguments as written.
1074 TemplateArgumentLoc *getTemplateArgsAsWritten() const {
1075 return ArgsAsWritten;
1078 /// Get the number of template arguments as written.
1079 unsigned getNumTemplateArgsAsWritten() const {
1080 return NumArgsAsWritten;
1083 /// \brief Get the sequence number for this class template partial
1085 unsigned getSequenceNumber() const { return SequenceNumber; }
1087 /// \brief Retrieve the member class template partial specialization from
1088 /// which this particular class template partial specialization was
1092 /// template<typename T>
1094 /// template<typename U> struct Inner;
1095 /// template<typename U> struct Inner<U*> { }; // #1
1098 /// Outer<float>::Inner<int*> ii;
1101 /// In this example, the instantiation of \c Outer<float>::Inner<int*> will
1102 /// end up instantiating the partial specialization
1103 /// \c Outer<float>::Inner<U*>, which itself was instantiated from the class
1104 /// template partial specialization \c Outer<T>::Inner<U*>. Given
1105 /// \c Outer<float>::Inner<U*>, this function would return
1106 /// \c Outer<T>::Inner<U*>.
1107 ClassTemplatePartialSpecializationDecl *getInstantiatedFromMember() {
1108 ClassTemplatePartialSpecializationDecl *First
1109 = cast<ClassTemplatePartialSpecializationDecl>(getFirstDeclaration());
1110 return First->InstantiatedFromMember.getPointer();
1113 void setInstantiatedFromMember(
1114 ClassTemplatePartialSpecializationDecl *PartialSpec) {
1115 ClassTemplatePartialSpecializationDecl *First
1116 = cast<ClassTemplatePartialSpecializationDecl>(getFirstDeclaration());
1117 First->InstantiatedFromMember.setPointer(PartialSpec);
1120 /// \brief Determines whether this class template partial specialization
1121 /// template was a specialization of a member partial specialization.
1123 /// In the following example, the member template partial specialization
1124 /// \c X<int>::Inner<T*> is a member specialization.
1127 /// template<typename T>
1129 /// template<typename U> struct Inner;
1130 /// template<typename U> struct Inner<U*>;
1133 /// template<> template<typename T>
1134 /// struct X<int>::Inner<T*> { /* ... */ };
1136 bool isMemberSpecialization() {
1137 ClassTemplatePartialSpecializationDecl *First
1138 = cast<ClassTemplatePartialSpecializationDecl>(getFirstDeclaration());
1139 return First->InstantiatedFromMember.getInt();
1142 /// \brief Note that this member template is a specialization.
1143 void setMemberSpecialization() {
1144 ClassTemplatePartialSpecializationDecl *First
1145 = cast<ClassTemplatePartialSpecializationDecl>(getFirstDeclaration());
1146 assert(First->InstantiatedFromMember.getPointer() &&
1147 "Only member templates can be member template specializations");
1148 return First->InstantiatedFromMember.setInt(true);
1151 /// Retrieves the injected specialization type for this partial
1152 /// specialization. This is not the same as the type-decl-type for
1153 /// this partial specialization, which is an InjectedClassNameType.
1154 QualType getInjectedSpecializationType() const {
1155 assert(getTypeForDecl() && "partial specialization has no type set!");
1156 return cast<InjectedClassNameType>(getTypeForDecl())
1157 ->getInjectedSpecializationType();
1160 // FIXME: Add Profile support!
1162 static bool classof(const Decl *D) { return classofKind(D->getKind()); }
1163 static bool classofKind(Kind K) {
1164 return K == ClassTemplatePartialSpecialization;
1167 static bool classof(const ClassTemplatePartialSpecializationDecl *) {
1172 /// Declaration of a class template.
1173 class ClassTemplateDecl : public TemplateDecl {
1174 static void DeallocateCommon(void *Ptr);
1177 /// \brief Data that is common to all of the declarations of a given
1180 Common() : InstantiatedFromMember(0, 0) {}
1182 /// \brief The class template specializations for this class
1183 /// template, including explicit specializations and instantiations.
1184 llvm::FoldingSet<ClassTemplateSpecializationDecl> Specializations;
1186 /// \brief The class template partial specializations for this class
1188 llvm::FoldingSet<ClassTemplatePartialSpecializationDecl>
1189 PartialSpecializations;
1191 /// \brief The injected-class-name type for this class template.
1192 QualType InjectedClassNameType;
1194 /// \brief The templated member class from which this was most
1195 /// directly instantiated (or null).
1197 /// The boolean value indicates whether this member class template
1198 /// was explicitly specialized.
1199 llvm::PointerIntPair<ClassTemplateDecl *, 1, bool> InstantiatedFromMember;
1202 // FIXME: Combine PreviousDeclaration with CommonPtr, as in
1203 // FunctionTemplateDecl.
1205 /// \brief Previous declaration of this class template.
1206 ClassTemplateDecl *PreviousDeclaration;
1208 /// \brief Pointer to the data that is common to all of the
1209 /// declarations of this class template.
1211 /// The first declaration of a class template (e.g., the declaration
1212 /// with no "previous declaration") owns this pointer.
1215 ClassTemplateDecl(DeclContext *DC, SourceLocation L, DeclarationName Name,
1216 TemplateParameterList *Params, NamedDecl *Decl,
1217 ClassTemplateDecl *PrevDecl, Common *CommonPtr)
1218 : TemplateDecl(ClassTemplate, DC, L, Name, Params, Decl),
1219 PreviousDeclaration(PrevDecl), CommonPtr(CommonPtr) { }
1221 ~ClassTemplateDecl();
1224 /// Get the underlying class declarations of the template.
1225 CXXRecordDecl *getTemplatedDecl() const {
1226 return static_cast<CXXRecordDecl *>(TemplatedDecl);
1229 /// \brief Retrieve the previous declaration of this template.
1230 ClassTemplateDecl *getPreviousDeclaration() const {
1231 return PreviousDeclaration;
1234 virtual ClassTemplateDecl *getCanonicalDecl();
1236 /// Create a class template node.
1237 static ClassTemplateDecl *Create(ASTContext &C, DeclContext *DC,
1239 DeclarationName Name,
1240 TemplateParameterList *Params,
1242 ClassTemplateDecl *PrevDecl);
1244 /// \brief Retrieve the set of specializations of this class template.
1245 llvm::FoldingSet<ClassTemplateSpecializationDecl> &getSpecializations() {
1246 return CommonPtr->Specializations;
1249 /// \brief Retrieve the set of partial specializations of this class
1251 llvm::FoldingSet<ClassTemplatePartialSpecializationDecl> &
1252 getPartialSpecializations() {
1253 return CommonPtr->PartialSpecializations;
1256 /// \brief Retrieve the partial specializations as an ordered list.
1257 void getPartialSpecializations(
1258 llvm::SmallVectorImpl<ClassTemplatePartialSpecializationDecl *> &PS);
1260 /// \brief Find a class template partial specialization with the given
1263 /// \brief A dependent type that names a specialization of this class
1266 /// \returns the class template partial specialization that exactly matches
1267 /// the type \p T, or NULL if no such partial specialization exists.
1268 ClassTemplatePartialSpecializationDecl *findPartialSpecialization(QualType T);
1270 /// \brief Retrieve the template specialization type of the
1271 /// injected-class-name for this class template.
1273 /// The injected-class-name for a class template \c X is \c
1274 /// X<template-args>, where \c template-args is formed from the
1275 /// template arguments that correspond to the template parameters of
1276 /// \c X. For example:
1279 /// template<typename T, int N>
1281 /// typedef array this_type; // "array" is equivalent to "array<T, N>"
1284 QualType getInjectedClassNameSpecialization(ASTContext &Context);
1286 /// \brief Retrieve the member class template that this class template was
1289 /// This routine will return non-NULL for templated member classes of
1290 /// class templates. For example, given:
1293 /// template <typename T>
1295 /// template <typename U> struct A {};
1299 /// X<int>::A<float> is a ClassTemplateSpecializationDecl (whose parent
1300 /// is X<int>, also a CTSD) for which getSpecializedTemplate() will
1301 /// return X<int>::A<U>, a TemplateClassDecl (whose parent is again
1302 /// X<int>) for which getInstantiatedFromMemberTemplate() will return
1303 /// X<T>::A<U>, a TemplateClassDecl (whose parent is X<T>, also a TCD).
1305 /// \returns null if this is not an instantiation of a member class template.
1306 ClassTemplateDecl *getInstantiatedFromMemberTemplate() const {
1307 return CommonPtr->InstantiatedFromMember.getPointer();
1310 void setInstantiatedFromMemberTemplate(ClassTemplateDecl *CTD) {
1311 assert(!CommonPtr->InstantiatedFromMember.getPointer());
1312 CommonPtr->InstantiatedFromMember.setPointer(CTD);
1315 /// \brief Determines whether this template was a specialization of a
1316 /// member template.
1318 /// In the following example, the member template \c X<int>::Inner is a
1319 /// member specialization.
1322 /// template<typename T>
1324 /// template<typename U> struct Inner;
1327 /// template<> template<typename T>
1328 /// struct X<int>::Inner { /* ... */ };
1330 bool isMemberSpecialization() {
1331 return CommonPtr->InstantiatedFromMember.getInt();
1334 /// \brief Note that this member template is a specialization.
1335 void setMemberSpecialization() {
1336 assert(CommonPtr->InstantiatedFromMember.getPointer() &&
1337 "Only member templates can be member template specializations");
1338 CommonPtr->InstantiatedFromMember.setInt(true);
1341 // Implement isa/cast/dyncast support
1342 static bool classof(const Decl *D) { return classofKind(D->getKind()); }
1343 static bool classof(const ClassTemplateDecl *D) { return true; }
1344 static bool classofKind(Kind K) { return K == ClassTemplate; }
1346 virtual void Destroy(ASTContext& C);
1349 /// Declaration of a friend template. For example:
1351 /// template <typename T> class A {
1352 /// friend class MyVector<T>; // not a friend template
1353 /// template <typename U> friend class B; // friend template
1354 /// template <typename U> friend class Foo<T>::Nested; // friend template
1355 class FriendTemplateDecl : public Decl {
1357 typedef llvm::PointerUnion<NamedDecl*,TypeSourceInfo*> FriendUnion;
1360 // The number of template parameters; always non-zero.
1363 // The parameter list.
1364 TemplateParameterList **Params;
1366 // The declaration that's a friend of this class.
1369 // Location of the 'friend' specifier.
1370 SourceLocation FriendLoc;
1373 FriendTemplateDecl(DeclContext *DC, SourceLocation Loc,
1375 TemplateParameterList **Params,
1377 SourceLocation FriendLoc)
1378 : Decl(Decl::FriendTemplate, DC, Loc),
1382 FriendLoc(FriendLoc)
1386 static FriendTemplateDecl *Create(ASTContext &Context,
1387 DeclContext *DC, SourceLocation Loc,
1389 TemplateParameterList **Params,
1391 SourceLocation FriendLoc);
1393 /// If this friend declaration names a templated type (or
1394 /// a dependent member type of a templated type), return that
1395 /// type; otherwise return null.
1396 TypeSourceInfo *getFriendType() const {
1397 return Friend.dyn_cast<TypeSourceInfo*>();
1400 /// If this friend declaration names a templated function (or
1401 /// a member function of a templated type), return that type;
1402 /// otherwise return null.
1403 NamedDecl *getFriendDecl() const {
1404 return Friend.dyn_cast<NamedDecl*>();
1407 /// Retrieves the location of the 'friend' keyword.
1408 SourceLocation getFriendLoc() const {
1412 TemplateParameterList *getTemplateParameterList(unsigned i) const {
1413 assert(i <= NumParams);
1417 unsigned getNumTemplateParameters() const {
1421 // Implement isa/cast/dyncast/etc.
1422 static bool classof(const Decl *D) { return classofKind(D->getKind()); }
1423 static bool classofKind(Kind K) { return K == Decl::FriendTemplate; }
1424 static bool classof(const FriendTemplateDecl *D) { return true; }
1427 /// Implementation of inline functions that require the template declarations
1428 inline AnyFunctionDecl::AnyFunctionDecl(FunctionTemplateDecl *FTD)
1431 } /* end of namespace clang */