14 #ifndef LLVM_CLANG_AST_TEMPLATENAME_H
15 #define LLVM_CLANG_AST_TEMPLATENAME_H
18 #include "llvm/ADT/FoldingSet.h"
19 #include "llvm/ADT/PointerUnion.h"
24 class DependentTemplateName;
25 class DiagnosticBuilder;
28 class NestedNameSpecifier;
30 class OverloadedTemplateStorage;
31 struct PrintingPolicy;
32 class QualifiedTemplateName;
33 class SubstTemplateTemplateParmPackStorage;
34 class SubstTemplateTemplateParmStorage;
35 class TemplateArgument;
37 class TemplateTemplateParmDecl;
99 return reinterpret_cast<NamedDecl **
>(
this + 1);
101 NamedDecl *
const *getStorage()
const {
102 return reinterpret_cast<NamedDecl *
const *
>(
this + 1);
129 Parameter(Parameter), Arguments(Arguments) { }
142 static void Profile(llvm::FoldingSetNodeID &
ID,
184 Storage = StorageType::getFromOpaqueValue(Ptr);
212 : Storage(Storage) { }
215 : Storage(Storage) { }
220 bool isNull()
const {
return Storage.isNull(); }
310 bool SuppressNNS =
false)
const;
313 void dump(raw_ostream &OS)
const;
320 ID.AddPointer(Storage.getOpaqueValue());
334 const DiagnosticBuilder &
operator<<(
const DiagnosticBuilder &DB,
349 Parameter(parameter), Replacement(replacement) {}
355 void Profile(llvm::FoldingSetNodeID &
ID);
357 static void Profile(llvm::FoldingSetNodeID &
ID,
363 : Storage(Storage) { }
391 llvm::PointerIntPair<NestedNameSpecifier *, 1> Qualifier;
401 : Qualifier(NNS, TemplateKeyword? 1 : 0),
402 Template(Template) { }
427 ID.AddBoolean(TemplateKeyword);
428 ID.AddPointer(Template);
447 llvm::PointerIntPair<NestedNameSpecifier *, 1, bool> Qualifier;
474 : Qualifier(Qualifier,
false), Identifier(Identifier),
475 CanonicalTemplateName(this) { }
480 : Qualifier(Qualifier,
false), Identifier(Identifier),
481 CanonicalTemplateName(Canon) { }
483 DependentTemplateName(NestedNameSpecifier *Qualifier,
485 : Qualifier(Qualifier,
true), Operator(Operator),
486 CanonicalTemplateName(this) { }
488 DependentTemplateName(NestedNameSpecifier *Qualifier,
491 : Qualifier(Qualifier,
true), Operator(Operator),
492 CanonicalTemplateName(Canon) { }
503 assert(
isIdentifier() &&
"Template name isn't an identifier?");
514 "Template name isn't an overloaded operator?");
528 ID.AddBoolean(
false);
529 ID.AddPointer(Identifier);
536 ID.AddInteger(Operator);
557 enum { NumLowBitsAvailable = 0 };
void print(raw_ostream &OS, const PrintingPolicy &Policy, bool SuppressNNS=false) const
Print the template name.
SubstTemplateTemplateParmStorage * getAsSubstTemplateTemplateParm() const
Retrieve the substituted template template parameter, if known.
TemplateName getReplacement() const
unsigned Size
The number of stored templates or template arguments, depending on which subclass we have...
TemplateDecl * getAsTemplateDecl() const
Retrieve the underlying template declaration that this template name refers to, if known...
OverloadedOperatorKind getOperator() const
Return the overloaded operator to which this template name refers.
static clang::TemplateName getFromVoidPointer(void *Ptr)
TemplateName(SubstTemplateTemplateParmPackStorage *Storage)
const DiagnosticBuilder & operator<<(const DiagnosticBuilder &DB, const Attr *At)
TemplateTemplateParmDecl * getParameterPack() const
Retrieve the template template parameter pack being substituted.
A template template parameter that has been substituted for some other template name.
void Profile(llvm::FoldingSetNodeID &ID, ASTContext &Context)
Describes how types, statements, expressions, and declarations should be printed. ...
TemplateTemplateParmDecl * getParameter() const
const IdentifierInfo * getIdentifier() const
Returns the identifier to which this template name refers.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Represents a dependent template name that cannot be resolved prior to template instantiation.
bool isIdentifier() const
Determine whether this template name refers to an identifier.
SubstTemplateTemplateParmStorage * getAsSubstTemplateTemplateParm()
SubstTemplateTemplateParmPackStorage * getAsSubstTemplateTemplateParmPack() const
Retrieve the substituted template template parameter pack, if known.
bool isNull() const
Determine whether this template name is NULL.
TemplateName(TemplateDecl *Template)
A qualified template name, where the qualification is kept to describe the source code as written...
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
OverloadedTemplateStorage * getAsOverloadedTemplate() const
Retrieve the underlying, overloaded function template.
TemplateArgument getArgumentPack() const
Retrieve the template template argument pack with which this parameter was substituted.
TemplateDecl * getTemplateDecl() const
The template declaration to which this qualified name refers.
SubstTemplateTemplateParmPackStorage * getAsSubstTemplateTemplateParmPack()
NestedNameSpecifier * getQualifier() const
Return the nested name specifier that qualifies this name.
void Profile(llvm::FoldingSetNodeID &ID)
DependentTemplateName * getAsDependentTemplateName() const
Retrieve the underlying dependent template name structure, if any.
TemplateName getUnderlying() const
void dump() const
Debugging aid that dumps the template name to standard error.
bool containsUnexpandedParameterPack() const
Determines whether this template name contains an unexpanded parameter pack (for C++0x variadic templ...
A dependent template name that has not been resolved to a template (or set of templates).
static void * getAsVoidPointer(clang::TemplateName TN)
ID
Defines the set of possible language-specific address spaces.
OverloadedOperatorKind Operator
The overloaded operator name.
static void Profile(llvm::FoldingSetNodeID &ID, NestedNameSpecifier *NNS, OverloadedOperatorKind Operator)
bool isInstantiationDependent() const
Determines whether this is a template name that somehow depends on a template parameter.
void Profile(llvm::FoldingSetNodeID &ID)
A structure for storing the information associated with a substituted template template parameter...
Represents a C++ template name within the type system.
static void Profile(llvm::FoldingSetNodeID &ID, NestedNameSpecifier *NNS, const IdentifierInfo *Identifier)
static void Profile(llvm::FoldingSetNodeID &ID, NestedNameSpecifier *NNS, bool TemplateKeyword, TemplateDecl *Template)
A template template parameter pack that has been substituted for a template template argument pack...
OverloadedTemplateStorage * getAsOverloadedStorage()
static TemplateName getFromVoidPointer(void *Ptr)
Build a template name from a void pointer.
A structure for storing an already-substituted template template parameter pack.
void Profile(llvm::FoldingSetNodeID &ID)
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
UncommonTemplateNameStorage(Kind kind, unsigned size)
void Profile(llvm::FoldingSetNodeID &ID)
TemplateName(OverloadedTemplateStorage *Storage)
QualifiedTemplateName * getAsQualifiedTemplateName() const
Retrieve the underlying qualified template name structure, if any.
Represents a template argument.
Represents a template name that was expressed as a qualified name.
void * getAsVoidPointer() const
Retrieve the template name as a void pointer.
bool hasTemplateKeyword() const
Whether the template name was prefixed by the "template" keyword.
The base class of all kinds of template declarations (e.g., class, function, etc.).
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
bool isDependent() const
Determines whether this is a dependent template name.
bool isOverloadedOperator() const
Determine whether this template name refers to an overloaded operator.
SubstTemplateTemplateParmPackStorage(TemplateTemplateParmDecl *Parameter, unsigned Size, const TemplateArgument *Arguments)
const IdentifierInfo * Identifier
The identifier template name.
TemplateDecl * getDecl() const
The template declaration that this qualified name refers to.
A structure for storing the information associated with an overloaded template name.
TemplateName(DependentTemplateName *Dep)
unsigned kind
All of the diagnostics that can be emitted by the frontend.
NestedNameSpecifier * getQualifier() const
Return the nested name specifier that qualifies this name.
TemplateName(QualifiedTemplateName *Qual)
A set of overloaded template declarations.
Implementation class used to describe either a set of overloaded template names or an already-substit...
A single template declaration.
NamedDecl *const * iterator