14 #ifndef LLVM_CLANG_AST_TEMPLATENAME_H 15 #define LLVM_CLANG_AST_TEMPLATENAME_H 18 #include "llvm/ADT/FoldingSet.h" 19 #include "llvm/ADT/PointerIntPair.h" 20 #include "llvm/ADT/PointerUnion.h" 21 #include "llvm/Support/PointerLikeTypeTraits.h" 27 class DependentTemplateName;
28 class DiagnosticBuilder;
31 class NestedNameSpecifier;
33 class OverloadedTemplateStorage;
34 struct PrintingPolicy;
35 class QualifiedTemplateName;
36 class SubstTemplateTemplateParmPackStorage;
37 class SubstTemplateTemplateParmStorage;
38 class TemplateArgument;
40 class TemplateTemplateParmDecl;
102 return reinterpret_cast<NamedDecl **
>(
this + 1);
105 return reinterpret_cast<NamedDecl *
const *
>(
this + 1);
132 Parameter(Parameter), Arguments(Arguments) {}
143 void Profile(llvm::FoldingSetNodeID &
ID,
ASTContext &Context);
145 static void Profile(llvm::FoldingSetNodeID &ID,
235 TemplateDecl *getAsTemplateDecl()
const;
263 QualifiedTemplateName *getAsQualifiedTemplateName()
const;
267 DependentTemplateName *getAsDependentTemplateName()
const;
277 bool isDependent()
const;
281 bool isInstantiationDependent()
const;
285 bool containsUnexpandedParameterPack()
const;
296 bool SuppressNNS =
false)
const;
299 void dump(raw_ostream &OS)
const;
306 ID.AddPointer(Storage.getOpaqueValue());
335 Parameter(parameter), Replacement(replacement) {}
341 void Profile(llvm::FoldingSetNodeID &
ID);
343 static void Profile(llvm::FoldingSetNodeID &ID,
376 llvm::PointerIntPair<NestedNameSpecifier *, 1> Qualifier;
384 : Qualifier(NNS, TemplateKeyword? 1 : 0), Template(Template) {}
403 Profile(ID, getQualifier(), hasTemplateKeyword(), getTemplateDecl());
409 ID.AddBoolean(TemplateKeyword);
410 ID.AddPointer(Template);
431 llvm::PointerIntPair<NestedNameSpecifier *, 1, bool> Qualifier;
456 : Qualifier(Qualifier,
false), Identifier(Identifier),
457 CanonicalTemplateName(this) {}
462 : Qualifier(Qualifier,
false), Identifier(Identifier),
463 CanonicalTemplateName(Canon) {}
467 : Qualifier(Qualifier,
true), Operator(Operator),
468 CanonicalTemplateName(
this) {}
473 : Qualifier(Qualifier,
true), Operator(Operator),
474 CanonicalTemplateName(Canon) {}
485 assert(isIdentifier() &&
"Template name isn't an identifier?");
495 assert(isOverloadedOperator() &&
496 "Template name isn't an overloaded operator?");
504 Profile(ID, getQualifier(), getOperator());
510 ID.AddBoolean(
false);
511 ID.AddPointer(Identifier);
518 ID.AddInteger(Operator);
538 enum { NumLowBitsAvailable = 0 };
543 #endif // LLVM_CLANG_AST_TEMPLATENAME_H TemplateTemplateParmDecl * getParameterPack() const
Retrieve the template template parameter pack being substituted.
static llvm::GlobalValue::DLLStorageClassTypes getStorage(CodeGenModule &CGM, StringRef 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.
OverloadedOperatorKind getOperator() const
Return the overloaded operator to which this template name refers.
NestedNameSpecifier * getQualifier() const
Return the nested name specifier that qualifies this name.
DominatorTree GraphTraits specialization so the DominatorTree can be iterable by generic graph iterat...
unsigned Size
The number of stored templates or template arguments, depending on which subclass we have...
const DiagnosticBuilder & operator<<(const DiagnosticBuilder &DB, const Attr *At)
A template template parameter that has been substituted for some other template name.
const IdentifierInfo * getIdentifier() const
Returns the identifier to which this template name refers.
Describes how types, statements, expressions, and declarations should be printed. ...
One of these records is kept for each identifier that is lexed.
TemplateName getUnderlying() const
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.
SubstTemplateTemplateParmStorage * getAsSubstTemplateTemplateParm()
TemplateName getReplacement() const
A qualified template name, where the qualification is kept to describe the source code as written...
static void dump(llvm::raw_ostream &OS, StringRef FunctionName, ArrayRef< CounterExpression > Expressions, ArrayRef< CounterMappingRegion > Regions)
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
SubstTemplateTemplateParmPackStorage * getAsSubstTemplateTemplateParmPack()
TemplateTemplateParmDecl * getParameter() const
NamedDecl *const * iterator
void Profile(llvm::FoldingSetNodeID &ID)
A little helper class used to produce diagnostics.
A dependent template name that has not been resolved to a template (or set of templates).
TemplateDecl * getTemplateDecl() const
The template declaration to which this qualified name refers.
OverloadedOperatorKind Operator
The overloaded operator name.
static void Profile(llvm::FoldingSetNodeID &ID, NestedNameSpecifier *NNS, OverloadedOperatorKind Operator)
A structure for storing the information associated with a substituted template template parameter...
Represents a C++ template name within the type system.
bool isIdentifier() const
Determine whether this template name refers to an identifier.
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.
static StringRef getIdentifier(const Token &Tok)
NestedNameSpecifier * getQualifier() const
Return the nested name specifier that qualifies this name.
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)
static void * getAsVoidPointer(clang::TemplateName TN)
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
bool isOverloadedOperator() const
Determine whether this template name refers to an overloaded operator.
UncommonTemplateNameStorage(Kind kind, unsigned size)
void Profile(llvm::FoldingSetNodeID &ID)
static clang::TemplateName getFromVoidPointer(void *Ptr)
Represents a template argument.
Represents a template name that was expressed as a qualified name.
Dataflow Directional Tag Classes.
The base class of all kinds of template declarations (e.g., class, function, etc.).
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
SubstTemplateTemplateParmPackStorage(TemplateTemplateParmDecl *Parameter, unsigned Size, const TemplateArgument *Arguments)
const IdentifierInfo * Identifier
The identifier template name.
The parameter type of a method or function.
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.
static Decl::Kind getKind(const Decl *D)
TemplateDecl * getDecl() const
The template declaration that this qualified name refers to.
A set of overloaded template declarations.
This represents a decl that may have a name.
Implementation class used to describe either a set of overloaded template names or an already-substit...
A single template declaration.