13 #ifndef LLVM_CLANG_AST_TEMPLATENAME_H 14 #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 class AssumedTemplateStorage;
35 class PartialDiagnostic;
36 struct PrintingPolicy;
37 class QualifiedTemplateName;
38 class SubstTemplateTemplateParmPackStorage;
39 class SubstTemplateTemplateParmStorage;
40 class TemplateArgument;
42 class TemplateTemplateParmDecl;
111 return reinterpret_cast<NamedDecl **
>(
this + 1);
114 return reinterpret_cast<NamedDecl *
const *
>(
this + 1);
124 return llvm::makeArrayRef(begin(), end());
145 Parameter(Parameter), Arguments(Arguments) {}
156 void Profile(llvm::FoldingSetNodeID &
ID,
ASTContext &Context);
158 static void Profile(llvm::FoldingSetNodeID &ID,
253 TemplateDecl *getAsTemplateDecl()
const;
285 QualifiedTemplateName *getAsQualifiedTemplateName()
const;
289 DependentTemplateName *getAsDependentTemplateName()
const;
299 bool isDependent()
const;
303 bool isInstantiationDependent()
const;
307 bool containsUnexpandedParameterPack()
const;
318 bool SuppressNNS =
false)
const;
321 void dump(raw_ostream &OS)
const;
328 ID.AddPointer(Storage.getOpaqueValue());
359 Parameter(parameter), Replacement(replacement) {}
365 void Profile(llvm::FoldingSetNodeID &
ID);
367 static void Profile(llvm::FoldingSetNodeID &ID,
400 llvm::PointerIntPair<NestedNameSpecifier *, 1> Qualifier;
408 : Qualifier(NNS, TemplateKeyword? 1 : 0), Template(Template) {}
427 Profile(ID, getQualifier(), hasTemplateKeyword(), getTemplateDecl());
433 ID.AddBoolean(TemplateKeyword);
434 ID.AddPointer(Template);
455 llvm::PointerIntPair<NestedNameSpecifier *, 1, bool> Qualifier;
480 : Qualifier(Qualifier,
false), Identifier(Identifier),
481 CanonicalTemplateName(this) {}
486 : Qualifier(Qualifier,
false),
Identifier(Identifier),
487 CanonicalTemplateName(Canon) {}
491 : Qualifier(Qualifier,
true), Operator(Operator),
492 CanonicalTemplateName(
this) {}
497 : Qualifier(Qualifier,
true), Operator(Operator),
498 CanonicalTemplateName(Canon) {}
509 assert(isIdentifier() &&
"Template name isn't an identifier?");
519 assert(isOverloadedOperator() &&
520 "Template name isn't an overloaded operator?");
528 Profile(ID, getQualifier(), getOperator());
534 ID.AddBoolean(
false);
535 ID.AddPointer(Identifier);
542 ID.AddInteger(Operator);
562 enum { NumLowBitsAvailable = 0 };
567 #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.
Specialize PointerLikeTypeTraits to allow LazyGenerationalUpdatePtr to be placed into a PointerUnion...
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. ...
void print(llvm::raw_ostream &OS, const Pointer &P, ASTContext &Ctx, QualType Ty)
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...
An unqualified-id that has been assumed to name a function template that will be found by ADL...
SubstTemplateTemplateParmPackStorage * getAsSubstTemplateTemplateParmPack()
TemplateTemplateParmDecl * getParameter() const
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)
llvm::ArrayRef< NamedDecl * > decls() const
Represents a template argument.
Represents a template name that was expressed as a qualified name.
Dataflow Directional Tag Classes.
AssumedTemplateStorage * getAsAssumedTemplateName()
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.
A structure for storing the information associated with a name that has been assumed to be a template...
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.