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,
284 bool SuppressNNS =
false)
const;
287 void dump(raw_ostream &OS)
const;
294 ID.AddPointer(Storage.getOpaqueValue());
308 const DiagnosticBuilder &
operator<<(
const DiagnosticBuilder &DB,
323 Parameter(parameter), Replacement(replacement) {}
329 void Profile(llvm::FoldingSetNodeID &
ID);
331 static void Profile(llvm::FoldingSetNodeID &
ID,
362 llvm::PointerIntPair<NestedNameSpecifier *, 1> Qualifier;
372 : Qualifier(NNS, TemplateKeyword? 1 : 0),
373 Template(Template) { }
398 ID.AddBoolean(TemplateKeyword);
399 ID.AddPointer(Template);
418 llvm::PointerIntPair<NestedNameSpecifier *, 1, bool> Qualifier;
445 : Qualifier(Qualifier,
false), Identifier(Identifier),
446 CanonicalTemplateName(this) { }
451 : Qualifier(Qualifier,
false), Identifier(Identifier),
452 CanonicalTemplateName(Canon) { }
454 DependentTemplateName(NestedNameSpecifier *Qualifier,
456 : Qualifier(Qualifier,
true), Operator(Operator),
457 CanonicalTemplateName(this) { }
459 DependentTemplateName(NestedNameSpecifier *Qualifier,
462 : Qualifier(Qualifier,
true), Operator(Operator),
463 CanonicalTemplateName(Canon) { }
474 assert(
isIdentifier() &&
"Template name isn't an identifier?");
485 "Template name isn't an overloaded operator?");
499 ID.AddBoolean(
false);
500 ID.AddPointer(Identifier);
507 ID.AddInteger(Operator);
528 enum { NumLowBitsAvailable = 0 };
void print(raw_ostream &OS, const PrintingPolicy &Policy, bool SuppressNNS=false) const
Print the template name.
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)
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.
One of these records is kept for each identifier that is lexed.
OverloadedTemplateStorage * getAsOverloadedTemplate() const
Retrieve the underlying, overloaded function template.
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()
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...
TemplateArgument getArgumentPack() const
Retrieve the template template argument pack with which this parameter was substituted.
QualifiedTemplateName * getAsQualifiedTemplateName() const
Retrieve the underlying qualified template name structure, if any.
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)
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...
SubstTemplateTemplateParmPackStorage * getAsSubstTemplateTemplateParmPack() const
Retrieve the substituted template template parameter pack, if known.
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)
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
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)
SubstTemplateTemplateParmStorage * getAsSubstTemplateTemplateParm() const
Retrieve the substituted template template parameter, if known.
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.
bool isNull() const
Determine whether this template name is NULL.
TemplateDecl * getDecl() const
The template declaration that this qualified name refers to.
DependentTemplateName * getAsDependentTemplateName() const
Retrieve the underlying dependent template name structure, if any.
A structure for storing the information associated with an overloaded template name.
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.
A set of overloaded template declarations.
NamedDecl - This represents a decl with a name.
Implementation class used to describe either a set of overloaded template names or an already-substit...
A single template declaration.
NamedDecl *const * iterator