14#ifndef LLVM_CLANG_SEMA_PARSEDTEMPLATE_H
15#define LLVM_CLANG_SEMA_PARSEDTEMPLATE_H
22#include "llvm/ADT/SmallVector.h"
51 : Kind(Kind), Arg(Arg),
Loc(
Loc) { }
66 Arg(
Template.getAsOpaquePtr()), SS(SS), Loc(TemplateLoc) {}
76 assert(Kind ==
Type &&
"Not a template type argument");
82 assert(Kind ==
NonType &&
"Not a non-type template argument");
83 return static_cast<Expr*
>(Arg);
88 assert(Kind ==
Template &&
"Not a template template argument");
99 "Only template template arguments can have a scope specifier");
107 "Only template template arguments can have an ellipsis");
150 :
private llvm::TrailingObjects<TemplateIdAnnotation,
151 ParsedTemplateArgument> {
193 return getTrailingObjects<ParsedTemplateArgument>();
206 totalSizeToAlloc<ParsedTemplateArgument>(TemplateArgs.size())))
208 OperatorKind, OpaqueTemplateName, TemplateKind,
210 CleanupList.push_back(TemplateId);
217 A.~ParsedTemplateArgument();
252 std::uninitialized_copy(TemplateArgs.begin(), TemplateArgs.end(),
255 ~TemplateIdAnnotation() =
default;
Defines an enumeration for C++ overloaded operators.
Defines the clang::SourceLocation class and associated facilities.
Defines the clang::TemplateNameKind enum.
Represents a C++ nested-name-specifier or a global scope specifier.
This represents one expression.
One of these records is kept for each identifier that is lexed.
static OpaquePtr getFromOpaquePtr(void *P)
Represents the parsed form of a C++ template argument.
ParsedTemplateArgument(KindType Kind, void *Arg, SourceLocation Loc)
Create a template type argument or non-type template argument.
ParsedTemplateArgument()
Build an empty template argument.
KindType getKind() const
Determine what kind of template argument we have.
SourceLocation getLocation() const
Retrieve the location of the template argument.
ParsedTemplateTy getAsTemplate() const
Retrieve the template template argument's template name.
ParsedTemplateArgument getTemplatePackExpansion(SourceLocation EllipsisLoc) const
Retrieve a pack expansion of the given template template argument.
ParsedType getAsType() const
Retrieve the template type argument's type.
KindType
Describes the kind of template argument that was parsed.
@ Type
A template type parameter, stored as a type.
@ Template
A template template argument, stored as a template name.
@ NonType
A non-type template parameter, stored as an expression.
bool isInvalid() const
Determine whether the given template argument is invalid.
SourceLocation getEllipsisLoc() const
Retrieve the location of the ellipsis that makes a template template argument into a pack expansion.
Expr * getAsExpr() const
Retrieve the non-type template argument's expression.
ParsedTemplateArgument(const CXXScopeSpec &SS, ParsedTemplateTy Template, SourceLocation TemplateLoc)
Create a template template argument.
const CXXScopeSpec & getScopeSpec() const
Retrieve the nested-name-specifier that precedes the template name in a template template argument.
Encodes a location in the source.
The base class of the type hierarchy.
The JSON file list parser is used to communicate input to InstallAPI.
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
SourceRange getTemplateParamsRange(TemplateParameterList const *const *Params, unsigned NumParams)
Retrieves the range of the given template parameter lists.
TemplateNameKind
Specifies the kind of template name that an identifier refers to.
@ TNK_Type_template
The name refers to a template whose specialization produces a type.
@ TNK_Dependent_template_name
The name refers to a dependent template name:
@ TNK_Non_template
The name does not refer to a template.
@ TNK_Undeclared_template
Lookup for the name failed, but we're assuming it was a template name anyway.
Information about a template-id annotation token.
bool hasInvalidName() const
const IdentifierInfo * Name
FIXME: Temporarily stores the name of a specialization.
TemplateNameKind Kind
The kind of template that Template refers to.
unsigned NumArgs
NumArgs - The number of template arguments.
SourceLocation TemplateNameLoc
TemplateNameLoc - The location of the template name within the source.
ParsedTemplateArgument * getTemplateArgs()
Retrieves a pointer to the template arguments.
SourceLocation RAngleLoc
The location of the '>' after the template argument list.
SourceLocation LAngleLoc
The location of the '<' before the template argument list.
bool hasInvalidArgs() const
bool ArgsInvalid
Whether an error was encountered in the template arguments.
OverloadedOperatorKind Operator
FIXME: Temporarily stores the overloaded operator kind.
SourceLocation TemplateKWLoc
TemplateKWLoc - The location of the template keyword.
bool mightBeType() const
Determine whether this might be a type template.
ParsedTemplateTy Template
The declaration of the template corresponding to the template-name.
static TemplateIdAnnotation * Create(SourceLocation TemplateKWLoc, SourceLocation TemplateNameLoc, const IdentifierInfo *Name, OverloadedOperatorKind OperatorKind, ParsedTemplateTy OpaqueTemplateName, TemplateNameKind TemplateKind, SourceLocation LAngleLoc, SourceLocation RAngleLoc, ArrayRef< ParsedTemplateArgument > TemplateArgs, bool ArgsInvalid, SmallVectorImpl< TemplateIdAnnotation * > &CleanupList)
Creates a new TemplateIdAnnotation with NumArgs arguments and appends it to List.