Go to the documentation of this file.
13 #ifndef LLVM_CLANG_AST_TEMPLATENAME_H
14 #define LLVM_CLANG_AST_TEMPLATENAME_H
19 #include "llvm/ADT/FoldingSet.h"
20 #include "llvm/ADT/PointerIntPair.h"
21 #include "llvm/ADT/PointerUnion.h"
22 #include "llvm/Support/PointerLikeTypeTraits.h"
30 class DependentTemplateName;
33 class NestedNameSpecifier;
35 class OverloadedTemplateStorage;
36 class AssumedTemplateStorage;
37 struct PrintingPolicy;
38 class QualifiedTemplateName;
39 class SubstTemplateTemplateParmPackStorage;
40 class SubstTemplateTemplateParmStorage;
41 class TemplateArgument;
43 class TemplateTemplateParmDecl;
44 class UsingShadowDecl;
115 return reinterpret_cast<NamedDecl **
>(
this + 1);
118 return reinterpret_cast<NamedDecl *
const *
>(
this + 1);
141 public llvm::FoldingSetNode {
143 llvm::PointerIntPair<Decl *, 1, bool> AssociatedDeclAndFinal;
147 Decl *AssociatedDecl,
unsigned Index,
172 unsigned Index,
bool Final);
348 void dump(raw_ostream &OS)
const;
355 ID.AddPointer(Storage.getOpaqueValue());
369 const StreamingDiagnostic &
operator<<(
const StreamingDiagnostic &DB,
379 Decl *AssociatedDecl;
382 Decl *AssociatedDecl,
unsigned Index,
383 std::optional<unsigned> PackIndex)
385 PackIndex ? *PackIndex + 1 : 0),
386 Replacement(Replacement), AssociatedDecl(AssociatedDecl) {
387 assert(AssociatedDecl !=
nullptr);
408 void Profile(llvm::FoldingSetNodeID &
ID);
411 Decl *AssociatedDecl,
unsigned Index,
412 std::optional<unsigned> PackIndex);
443 llvm::PointerIntPair<NestedNameSpecifier *, 1> Qualifier;
454 : Qualifier(NNS, TemplateKeyword ? 1 : 0), UnderlyingTemplate(Template) {
477 ID.AddBoolean(TemplateKeyword);
499 llvm::PointerIntPair<NestedNameSpecifier *, 1, bool> Qualifier;
525 CanonicalTemplateName(this) {}
527 DependentTemplateName(NestedNameSpecifier *Qualifier,
531 CanonicalTemplateName(Canon) {}
533 DependentTemplateName(NestedNameSpecifier *Qualifier,
536 CanonicalTemplateName(this) {}
538 DependentTemplateName(NestedNameSpecifier *Qualifier,
542 CanonicalTemplateName(Canon) {}
553 assert(
isIdentifier() &&
"Template name isn't an identifier?");
564 "Template name isn't an overloaded operator?");
578 ID.AddBoolean(
false);
606 static constexpr
int NumLowBitsAvailable = 0;
611 #endif // LLVM_CLANG_AST_TEMPLATENAME_H
bool isOverloadedOperator() const
Determine whether this template name refers to an overloaded operator.
TemplateArgument getArgumentPack() const
Retrieve the template template argument pack with which this parameter was substituted.
YAML serialization mapping.
bool isInstantiationDependent() const
Determines whether this is a template name that somehow depends on a template parameter.
SubstTemplateTemplateParmStorage * getAsSubstTemplateTemplateParm() const
Retrieve the substituted template template parameter, if known.
@ SubstTemplateTemplateParm
Decl * getAssociatedDecl() const
A template-like entity which owns the whole pattern being substituted.
static llvm::GlobalValue::DLLStorageClassTypes getStorage(CodeGenModule &CGM, StringRef Name)
bool containsUnexpandedParameterPack() const
Determines whether this template name contains an unexpanded parameter pack (for C++0x variadic templ...
static clang::TemplateName getFromVoidPointer(void *Ptr)
AssumedTemplateStorage * getAsAssumedTemplateName()
This represents a decl that may have a name.
static void Profile(llvm::FoldingSetNodeID &ID, NestedNameSpecifier *NNS, OverloadedOperatorKind Operator)
TemplateDecl * getAsTemplateDecl() const
Retrieve the underlying template declaration that this template name refers to, if known.
NestedNameSpecifier * getQualifier() const
Return the nested name specifier that qualifies this name.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
A structure for storing the information associated with an overloaded template name.
Represents a shadow declaration implicitly introduced into a scope by a (resolved) using-declaration ...
TemplateNameDependence getDependence() const
static void Profile(llvm::FoldingSetNodeID &ID, NestedNameSpecifier *NNS, bool TemplateKeyword, TemplateName TN)
OverloadedTemplateStorage * getAsOverloadedTemplate() const
Retrieve the underlying, overloaded function template declarations that this template name refers to,...
TemplateTemplateParmDecl * getParameter() const
Describes how types, statements, expressions, and declarations should be printed.
OverloadedTemplateStorage * getAsOverloadedStorage()
TemplateName getNameToSubstitute() const
Get the template name to substitute when this template name is used as a template template argument.
@ Decl
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
void Profile(llvm::FoldingSetNodeID &ID)
bool isDependent() const
Determines whether this is a dependent template name.
unsigned getIndex() const
Returns the index of the replaced parameter in the associated declaration.
llvm::ArrayRef< NamedDecl * > decls() const
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
bool isIdentifier() const
Determine whether this template name refers to an identifier.
TemplateName getUnderlying() const
OverloadedOperatorKind Operator
The overloaded operator name.
Represents a template argument.
std::optional< unsigned > getPackIndex() const
UncommonTemplateNameStorage(Kind Kind, unsigned Index, unsigned Data)
AssumedTemplateStorage * getAsAssumedTemplateName() const
Retrieve information on a name that has been assumed to be a template-name in order to permit a call ...
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
TemplateName getUnderlyingTemplate() const
Return the underlying template name.
@ Template
A single template declaration.
UsingShadowDecl * getAsUsingShadowDecl() const
Retrieve the using shadow declaration through which the underlying template declaration is introduced...
@ SubstTemplateTemplateParmPack
A template template parameter pack that has been substituted for a template template argument pack,...
A structure for storing an already-substituted template template parameter pack.
const StreamingDiagnostic & operator<<(const StreamingDiagnostic &DB, const ASTContext::SectionInfo &Section)
Insertion operator for diagnostics.
bool hasTemplateKeyword() const
Whether the template name was prefixed by the "template" keyword.
bool isNull() const
Determine whether this template name is NULL.
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
static void Profile(llvm::FoldingSetNodeID &ID, NestedNameSpecifier *NNS, const IdentifierInfo *Identifier)
Implementation class used to describe either a set of overloaded template names or an already-substit...
Represents a dependent template name that cannot be resolved prior to template instantiation.
@ SubstTemplateTemplateParmPack
QualifiedTemplateName * getAsQualifiedTemplateName() const
Retrieve the underlying qualified template name structure, if any.
TemplateTemplateParmDecl * getParameterPack() const
Retrieve the template template parameter pack being substituted.
void * getAsVoidPointer() const
Retrieve the template name as a void pointer.
unsigned Data
The pack index, or the number of stored templates or template arguments, depending on which subclass ...
@ QualifiedTemplate
A qualified template name, where the qualification is kept to describe the source code as written.
Represents a C++ template name within the type system.
The base class of all kinds of template declarations (e.g., class, function, etc.).
Decl - This represents one declaration (or definition), e.g.
void dump() const
Debugging aid that dumps the template name to standard error.
const IdentifierInfo * getIdentifier() const
Returns the identifier to which this template name refers.
static void * getAsVoidPointer(clang::TemplateName TN)
Represents a template name that was expressed as a qualified name.
SubstTemplateTemplateParmPackStorage * getAsSubstTemplateTemplateParmPack()
static TemplateName getFromVoidPointer(void *Ptr)
Build a template name from a void pointer.
One of these records is kept for each identifier that is lexed.
NamedDecl *const * iterator
@ SubstTemplateTemplateParm
A template template parameter that has been substituted for some other template name.
void print(raw_ostream &OS, const PrintingPolicy &Policy, Qualified Qual=Qualified::AsWritten) const
Print the template name.
A structure for storing the information associated with a substituted template template parameter.
void Profile(llvm::FoldingSetNodeID &ID)
SubstTemplateTemplateParmPackStorage(ArrayRef< TemplateArgument > ArgPack, Decl *AssociatedDecl, unsigned Index, bool Final)
@ AssumedTemplate
An unqualified-id that has been assumed to name a function template that will be found by ADL.
DependentTemplateName * getAsDependentTemplateName() const
Retrieve the underlying dependent template name structure, if any.
void Profile(llvm::FoldingSetNodeID &ID, ASTContext &Context)
@ OverloadedTemplate
A set of overloaded template declarations.
SubstTemplateTemplateParmStorage * getAsSubstTemplateTemplateParm()
Decl * getAssociatedDecl() const
A template-like entity which owns the whole pattern being substituted.
void Profile(llvm::FoldingSetNodeID &ID)
SubstTemplateTemplateParmPackStorage * getAsSubstTemplateTemplateParmPack() const
Retrieve the substituted template template parameter pack, if known.
A structure for storing the information associated with a name that has been assumed to be a template...
unsigned getIndex() const
Returns the index of the replaced parameter in the associated declaration.
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.
TemplateName getReplacement() const
void Profile(llvm::FoldingSetNodeID &ID)
const IdentifierInfo * Identifier
The identifier template name.
@ DependentTemplate
A dependent template name that has not been resolved to a template (or set of templates).
@ UsingTemplate
A template name that refers to a template declaration found through a specific using shadow declarati...