13#ifndef LLVM_CLANG_AST_TEMPLATENAME_H
14#define LLVM_CLANG_AST_TEMPLATENAME_H
21#include "llvm/ADT/FoldingSet.h"
22#include "llvm/ADT/PointerIntPair.h"
23#include "llvm/ADT/PointerUnion.h"
24#include "llvm/Support/PointerLikeTypeTraits.h"
32class DependentTemplateName;
35class NestedNameSpecifier;
37class OverloadedTemplateStorage;
38class AssumedTemplateStorage;
39class DeducedTemplateStorage;
41class QualifiedTemplateName;
42class SubstTemplateTemplateParmPackStorage;
43class SubstTemplateTemplateParmStorage;
44class TemplateArgument;
46class TemplateTemplateParmDecl;
62 LLVM_PREFERRED_TYPE(
Kind)
125 return reinterpret_cast<NamedDecl **
>(
this + 1);
128 return reinterpret_cast<NamedDecl *
const *
>(
this + 1);
132 unsigned size()
const {
return Bits.Data; }
151 public llvm::FoldingSetNode {
153 llvm::PointerIntPair<Decl *, 1, bool> AssociatedDeclAndFinal;
157 Decl *AssociatedDecl,
unsigned Index,
162 Decl *getAssociatedDecl()
const;
169 bool getFinal()
const;
178 void Profile(llvm::FoldingSetNodeID &
ID,
ASTContext &Context);
180 static void Profile(llvm::FoldingSetNodeID &
ID,
ASTContext &Context,
182 unsigned Index,
bool Final);
191 operator bool()
const {
return !Args.empty(); }
298 TemplateDecl *getAsTemplateDecl(
bool IgnoreDeduced =
false)
const;
303 std::pair<TemplateDecl *, DefaultArguments>
304 getTemplateDeclAndDefaultArgs()
const;
332 getAsSubstTemplateTemplateParmPack()
const;
344 std::tuple<NestedNameSpecifier, bool> getQualifierAndTemplateKeyword()
const;
347 return std::get<0>(getQualifierAndTemplateKeyword());
357 std::optional<TemplateName> desugar(
bool IgnoreDeduced)
const;
361 TemplateNameDependence getDependence()
const;
364 bool isDependent()
const;
368 bool isInstantiationDependent()
const;
372 bool containsUnexpandedParameterPack()
const;
384 Qualified Qual = Qualified::AsWritten)
const;
394 ID.AddPointer(Storage.getOpaqueValue());
412const StreamingDiagnostic &
operator<<(
const StreamingDiagnostic &DB,
422 Decl *AssociatedDecl;
425 Decl *AssociatedDecl,
unsigned Index,
428 SubstTemplateTemplateParm, Index,
429 ((PackIndex.toInternalRepresentation()) << 1) | Final),
430 Replacement(Replacement), AssociatedDecl(AssociatedDecl) {
431 assert(AssociatedDecl !=
nullptr);
448 return UnsignedOrNone::fromInternalRepresentation(Bits.Data >> 1);
454 void Profile(llvm::FoldingSetNodeID &
ID);
456 static void Profile(llvm::FoldingSetNodeID &
ID,
TemplateName Replacement,
457 Decl *AssociatedDecl,
unsigned Index,
462 public llvm::FoldingSetNode {
479 void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context)
const;
481 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
514 llvm::PointerIntPair<NestedNameSpecifier, 1, bool> Qualifier;
525 : Qualifier(NNS, TemplateKeyword ? 1 : 0), UnderlyingTemplate(
Template) {
526 assert(UnderlyingTemplate.
getKind() == TemplateName::Template ||
527 UnderlyingTemplate.
getKind() == TemplateName::UsingTemplate);
542 Profile(
ID, getQualifier(), hasTemplateKeyword(), UnderlyingTemplate);
548 ID.AddBoolean(TemplateKeyword);
572 void Profile(llvm::FoldingSetNodeID &
ID)
const;
575 return PtrOrOp ==
Other.PtrOrOp;
596 llvm::PointerIntPair<NestedNameSpecifier, 1, bool> Qualifier;
604 bool HasTemplateKeyword);
614 TemplateNameDependence getDependence()
const;
617 Profile(
ID, getQualifier(), getName(), hasTemplateKeyword());
622 bool HasTemplateKeyword) {
624 ID.AddBoolean(HasTemplateKeyword);
632 public llvm::FoldingSetNode {
634 using DependentTemplateStorage::DependentTemplateStorage;
655 static constexpr int NumLowBitsAvailable = 0;
static llvm::GlobalValue::DLLStorageClassTypes getStorage(CodeGenModule &CGM, StringRef Name)
static void dump(llvm::raw_ostream &OS, StringRef FunctionName, ArrayRef< CounterExpression > Expressions, ArrayRef< CounterMappingRegion > Regions)
static Decl::Kind getKind(const Decl *D)
static void print(llvm::raw_ostream &OS, const T &V, ASTContext &ASTCtx, QualType Ty)
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Defines an enumeration for C++ overloaded operators.
Defines clang::UnsignedOrNone.
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.
TemplateName getUnderlying() const
DefaultArguments getDefaultArguments() const
Represents a dependent template name that cannot be resolved prior to template instantiation.
void Profile(llvm::FoldingSetNodeID &ID) const
IdentifierOrOverloadedOperator getName() const
NestedNameSpecifier getQualifier() const
Return the nested name specifier that qualifies this name.
static void Profile(llvm::FoldingSetNodeID &ID, NestedNameSpecifier NNS, IdentifierOrOverloadedOperator Name, bool HasTemplateKeyword)
bool hasTemplateKeyword() const
Was this template name was preceeded by the template keyword?
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>::".
void Profile(llvm::FoldingSetNodeID &ID) const
A structure for storing the information associated with an overloaded template name.
llvm::ArrayRef< NamedDecl * > decls() const
NamedDecl *const * iterator
Represents a template name as written in source code.
NestedNameSpecifier getQualifier() const
Return the nested name specifier that qualifies this 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.
bool hasTemplateKeyword() const
Whether the template name was prefixed by the "template" keyword.
A structure for storing an already-substituted template template parameter pack.
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
UnsignedOrNone getPackIndex() 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.
bool operator==(TemplateName Other) const
Structural equality.
NestedNameSpecifier getQualifier() const
static TemplateName getFromVoidPointer(void *Ptr)
Build a template name from a void pointer.
bool operator!=(TemplateName Other) const
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,...
@ DeducedTemplate
A template name that refers to another TemplateName with deduced default arguments.
@ 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.
void Profile(llvm::FoldingSetNodeID &ID)
TemplateName getUnderlying() const
void dump(raw_ostream &OS, const ASTContext &Context) const
Debugging aid that dumps the template name.
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()
DeducedTemplateStorage * getAsDeducedTemplateName()
OverloadedTemplateStorage * getAsOverloadedStorage()
Represents a shadow declaration implicitly introduced into a scope by a (resolved) using-declaration ...
std::variant< struct RequiresDecl, struct HeaderDecl, struct UmbrellaDirDecl, struct ModuleDecl, struct ExcludeDecl, struct ExportDecl, struct ExportAsDecl, struct ExternModuleDecl, struct UseDecl, struct LinkDecl, struct ConfigMacrosDecl, struct ConflictDecl > Decl
All declarations that can appear in a module declaration.
The JSON file list parser is used to communicate input to InstallAPI.
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
@ OO_None
Not an overloaded operator.
@ NUM_OVERLOADED_OPERATORS
bool operator==(const CallGraphNode::CallRecord &LHS, const CallGraphNode::CallRecord &RHS)
const StreamingDiagnostic & operator<<(const StreamingDiagnostic &DB, const ASTContext::SectionInfo &Section)
Insertion operator for diagnostics.
@ Template
We are parsing a template declaration.
@ Other
Other implicit parameter.
Diagnostic wrappers for TextAPI types for error reporting.
__UINTPTR_TYPE__ uintptr_t
An unsigned integer type with the property that any valid pointer to void can be converted to this ty...
ArrayRef< TemplateArgument > Args
IdentifierOrOverloadedOperator()=default
const IdentifierInfo * getIdentifier() const
Returns the identifier to which this template name refers.
bool operator==(const IdentifierOrOverloadedOperator &Other) const
OverloadedOperatorKind getOperator() const
Return the overloaded operator to which this template name refers.
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)