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"
29 class DependentTemplateName;
32 class NestedNameSpecifier;
34 class OverloadedTemplateStorage;
35 class AssumedTemplateStorage;
36 struct PrintingPolicy;
37 class QualifiedTemplateName;
38 class SubstTemplateTemplateParmPackStorage;
39 class SubstTemplateTemplateParmStorage;
40 class TemplateArgument;
42 class TemplateTemplateParmDecl;
43 class UsingShadowDecl;
112 return reinterpret_cast<NamedDecl **
>(
this + 1);
115 return reinterpret_cast<NamedDecl *
const *
>(
this + 1);
125 return llvm::makeArrayRef(
begin(),
end());
159 static void Profile(llvm::FoldingSetNodeID &
ID,
338 void dump(raw_ostream &OS)
const;
345 ID.AddPointer(Storage.getOpaqueValue());
359 const StreamingDiagnostic &
operator<<(
const StreamingDiagnostic &DB,
374 Parameter(parameter), Replacement(replacement) {}
380 void Profile(llvm::FoldingSetNodeID &
ID);
382 static void Profile(llvm::FoldingSetNodeID &
ID,
415 llvm::PointerIntPair<NestedNameSpecifier *, 1> Qualifier;
426 : Qualifier(NNS, TemplateKeyword ? 1 : 0), UnderlyingTemplate(Template) {
449 ID.AddBoolean(TemplateKeyword);
471 llvm::PointerIntPair<NestedNameSpecifier *, 1, bool> Qualifier;
497 CanonicalTemplateName(this) {}
499 DependentTemplateName(NestedNameSpecifier *Qualifier,
503 CanonicalTemplateName(Canon) {}
505 DependentTemplateName(NestedNameSpecifier *Qualifier,
508 CanonicalTemplateName(this) {}
510 DependentTemplateName(NestedNameSpecifier *Qualifier,
514 CanonicalTemplateName(Canon) {}
525 assert(
isIdentifier() &&
"Template name isn't an identifier?");
536 "Template name isn't an overloaded operator?");
550 ID.AddBoolean(
false);
578 static constexpr
int NumLowBitsAvailable = 0;
583 #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
static llvm::GlobalValue::DLLStorageClassTypes getStorage(CodeGenModule &CGM, StringRef Name)
@ Parameter
The parameter type of a method or function.
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,...
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.
UncommonTemplateNameStorage(Kind kind, unsigned size)
@ 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.
llvm::ArrayRef< NamedDecl * > decls() const
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
TemplateTemplateParmDecl * getParameterPack() const
Retrieve the template template parameter pack being substituted.
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.
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.
void * getAsVoidPointer() const
Retrieve the template name as a void pointer.
@ 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
SubstTemplateTemplateParmPackStorage(TemplateTemplateParmDecl *Parameter, unsigned Size, const TemplateArgument *Arguments)
@ 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)
unsigned Size
The number of stored templates or template arguments, depending on which subclass we have.
@ 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()
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...
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.
unsigned kind
All of the diagnostics that can be emitted by the frontend.
TemplateTemplateParmDecl * getParameter() const
@ 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...