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"
30class DependentTemplateName;
33class NestedNameSpecifier;
35class OverloadedTemplateStorage;
36class AssumedTemplateStorage;
38class QualifiedTemplateName;
39class SubstTemplateTemplateParmPackStorage;
40class SubstTemplateTemplateParmStorage;
41class TemplateArgument;
43class TemplateTemplateParmDecl;
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;
354 void Profile(llvm::FoldingSetNodeID &ID);
367const StreamingDiagnostic &
operator<<(
const StreamingDiagnostic &DB,
377 Decl *AssociatedDecl;
380 Decl *AssociatedDecl,
unsigned Index,
381 std::optional<unsigned> PackIndex)
383 PackIndex ? *PackIndex + 1 : 0),
384 Replacement(Replacement), AssociatedDecl(AssociatedDecl) {
385 assert(AssociatedDecl !=
nullptr);
406 void Profile(llvm::FoldingSetNodeID &ID);
409 Decl *AssociatedDecl,
unsigned Index,
410 std::optional<unsigned> PackIndex);
441 llvm::PointerIntPair<NestedNameSpecifier *, 1> Qualifier;
452 : Qualifier(NNS, TemplateKeyword ? 1 : 0), UnderlyingTemplate(Template) {
475 ID.AddBoolean(TemplateKeyword);
497 llvm::PointerIntPair<NestedNameSpecifier *, 1, bool> Qualifier;
523 CanonicalTemplateName(this) {}
525 DependentTemplateName(NestedNameSpecifier *Qualifier,
529 CanonicalTemplateName(Canon) {}
531 DependentTemplateName(NestedNameSpecifier *Qualifier,
534 CanonicalTemplateName(this) {}
536 DependentTemplateName(NestedNameSpecifier *Qualifier,
540 CanonicalTemplateName(Canon) {}
551 assert(
isIdentifier() &&
"Template name isn't an identifier?");
562 "Template name isn't an overloaded operator?");
576 ID.AddBoolean(
false);
604 static constexpr int NumLowBitsAvailable = 0;
static llvm::GlobalValue::DLLStorageClassTypes getStorage(CodeGenModule &CGM, StringRef Name)
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
A structure for storing the information associated with a name that has been assumed to be a template...
Decl - This represents one declaration (or definition), e.g.
Represents a dependent template name that cannot be resolved prior to template instantiation.
OverloadedOperatorKind Operator
The overloaded operator name.
OverloadedOperatorKind getOperator() const
Return the overloaded operator to which this template name refers.
bool isIdentifier() const
Determine whether this template name refers to an identifier.
static void Profile(llvm::FoldingSetNodeID &ID, NestedNameSpecifier *NNS, OverloadedOperatorKind Operator)
NestedNameSpecifier * getQualifier() const
Return the nested name specifier that qualifies this name.
static void Profile(llvm::FoldingSetNodeID &ID, NestedNameSpecifier *NNS, const IdentifierInfo *Identifier)
const IdentifierInfo * getIdentifier() const
Returns the identifier to which this template name refers.
const IdentifierInfo * Identifier
The identifier template name.
void Profile(llvm::FoldingSetNodeID &ID)
bool isOverloadedOperator() const
Determine whether this template name refers to an overloaded operator.
One of these records is kept for each identifier that is lexed.
This represents a decl that may have a name.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
A structure for storing the information associated with an overloaded template name.
llvm::ArrayRef< NamedDecl * > decls() const
NamedDecl *const * iterator
Represents a template name that was expressed as a qualified name.
static void Profile(llvm::FoldingSetNodeID &ID, NestedNameSpecifier *NNS, bool TemplateKeyword, TemplateName TN)
void Profile(llvm::FoldingSetNodeID &ID)
TemplateName getUnderlyingTemplate() const
Return the underlying template name.
NestedNameSpecifier * getQualifier() const
Return the nested name specifier that qualifies this name.
bool hasTemplateKeyword() const
Whether the template name was prefixed by the "template" keyword.
A structure for storing an already-substituted template template parameter pack.
Decl * getAssociatedDecl() const
A template-like entity which owns the whole pattern being substituted.
void Profile(llvm::FoldingSetNodeID &ID, ASTContext &Context)
TemplateTemplateParmDecl * getParameterPack() const
Retrieve the template template parameter pack being substituted.
TemplateArgument getArgumentPack() const
Retrieve the template template argument pack with which this parameter was substituted.
unsigned getIndex() const
Returns the index of the replaced parameter in the associated declaration.
A structure for storing the information associated with a substituted template template parameter.
TemplateName getReplacement() const
std::optional< unsigned > getPackIndex() const
void Profile(llvm::FoldingSetNodeID &ID)
TemplateTemplateParmDecl * getParameter() const
unsigned getIndex() const
Returns the index of the replaced parameter in the associated declaration.
Decl * getAssociatedDecl() const
A template-like entity which owns the whole pattern being substituted.
Represents a template argument.
The base class of all kinds of template declarations (e.g., class, function, etc.).
Represents a C++ template name within the type system.
TemplateNameDependence getDependence() const
bool isNull() const
Determine whether this template name is NULL.
TemplateDecl * getAsTemplateDecl() const
Retrieve the underlying template declaration that this template name refers to, if known.
DependentTemplateName * getAsDependentTemplateName() const
Retrieve the underlying dependent template name structure, if any.
QualifiedTemplateName * getAsQualifiedTemplateName() const
Retrieve the underlying qualified template name structure, if any.
void dump() const
Debugging aid that dumps the template name to standard error.
void Profile(llvm::FoldingSetNodeID &ID)
void print(raw_ostream &OS, const PrintingPolicy &Policy, Qualified Qual=Qualified::AsWritten) const
Print the template name.
OverloadedTemplateStorage * getAsOverloadedTemplate() const
Retrieve the underlying, overloaded function template declarations that this template name refers to,...
bool containsUnexpandedParameterPack() const
Determines whether this template name contains an unexpanded parameter pack (for C++0x variadic templ...
AssumedTemplateStorage * getAsAssumedTemplateName() const
Retrieve information on a name that has been assumed to be a template-name in order to permit a call ...
static TemplateName getFromVoidPointer(void *Ptr)
Build a template name from a void pointer.
void * getAsVoidPointer() const
Retrieve the template name as a void pointer.
@ UsingTemplate
A template name that refers to a template declaration found through a specific using shadow declarati...
@ OverloadedTemplate
A set of overloaded template declarations.
@ Template
A single template declaration.
@ DependentTemplate
A dependent template name that has not been resolved to a template (or set of templates).
@ SubstTemplateTemplateParm
A template template parameter that has been substituted for some other template name.
@ SubstTemplateTemplateParmPack
A template template parameter pack that has been substituted for a template template argument pack,...
@ QualifiedTemplate
A qualified template name, where the qualification is kept to describe the source code as written.
@ AssumedTemplate
An unqualified-id that has been assumed to name a function template that will be found by ADL.
UsingShadowDecl * getAsUsingShadowDecl() const
Retrieve the using shadow declaration through which the underlying template declaration is introduced...
SubstTemplateTemplateParmPackStorage * getAsSubstTemplateTemplateParmPack() const
Retrieve the substituted template template parameter pack, if known.
TemplateName getUnderlying() const
bool isDependent() const
Determines whether this is a dependent template name.
SubstTemplateTemplateParmStorage * getAsSubstTemplateTemplateParm() const
Retrieve the substituted template template parameter, if known.
bool isInstantiationDependent() const
Determines whether this is a template name that somehow depends on a template parameter.
TemplateName getNameToSubstitute() const
Get the template name to substitute when this template name is used as a template template argument.
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
Implementation class used to describe either a set of overloaded template names or an already-substit...
SubstTemplateTemplateParmPackStorage * getAsSubstTemplateTemplateParmPack()
UncommonTemplateNameStorage(Kind Kind, unsigned Index, unsigned Data)
@ SubstTemplateTemplateParm
@ SubstTemplateTemplateParmPack
SubstTemplateTemplateParmStorage * getAsSubstTemplateTemplateParm()
AssumedTemplateStorage * getAsAssumedTemplateName()
OverloadedTemplateStorage * getAsOverloadedStorage()
Represents a shadow declaration implicitly introduced into a scope by a (resolved) using-declaration ...
@ Decl
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
const StreamingDiagnostic & operator<<(const StreamingDiagnostic &DB, const ASTContext::SectionInfo &Section)
Insertion operator for diagnostics.
YAML serialization mapping.
Describes how types, statements, expressions, and declarations should be printed.
unsigned Data
The pack index, or the number of stored templates or template arguments, depending on which subclass ...
static void * getAsVoidPointer(clang::TemplateName TN)
static clang::TemplateName getFromVoidPointer(void *Ptr)