23 using namespace clang;
30 static std::pair<unsigned, unsigned>
33 return std::make_pair(TTP->getDepth(), TTP->getIndex());
36 return std::make_pair(NTTP->getDepth(), NTTP->getIndex());
44 class CollectUnexpandedParameterPacksVisitor :
52 bool InLambda =
false;
53 unsigned DepthLimit = (unsigned)-1;
56 if (
auto *PVD = dyn_cast<ParmVarDecl>(ND)) {
60 auto *FD = dyn_cast<
FunctionDecl>(PVD->getDeclContext());
62 if (FTD && FTD->getTemplateParameters()->getDepth() >= DepthLimit)
67 Unexpanded.push_back({ND, Loc});
72 Unexpanded.push_back({T, Loc});
76 explicit CollectUnexpandedParameterPacksVisitor(
78 : Unexpanded(Unexpanded) {}
80 bool shouldWalkTypesOfTypeLocs()
const {
return false; }
116 if (
auto *TTP = dyn_cast_or_null<TemplateTemplateParmDecl>(
118 if (TTP->isParameterPack())
122 return inherited::TraverseTemplateName(Template);
136 TraverseStmt(Element.
Key);
137 TraverseStmt(Element.
Value);
147 bool TraverseStmt(
Stmt *S) {
148 Expr *E = dyn_cast_or_null<Expr>(S);
150 return inherited::TraverseStmt(S);
159 return inherited::TraverseType(T);
166 bool TraverseTypeLoc(
TypeLoc TL) {
170 return inherited::TraverseTypeLoc(TL);
176 bool TraverseDecl(
Decl *D) {
183 return inherited::TraverseDecl(D);
187 bool TraverseAttr(
Attr *A) {
191 return inherited::TraverseAttr(A);
199 bool TraverseCXXFoldExpr(
CXXFoldExpr *E) {
return true; }
208 return inherited::TraverseUnresolvedUsingValueDecl(D);
216 return inherited::TraverseUnresolvedUsingTypenameDecl(D);
224 return inherited::TraverseTemplateArgument(Arg);
232 return inherited::TraverseTemplateArgumentLoc(ArgLoc);
240 return inherited::TraverseCXXBaseSpecifier(Base);
248 return inherited::TraverseConstructorInitializer(Init);
262 bool WasInLambda = InLambda;
263 unsigned OldDepthLimit = DepthLimit;
267 DepthLimit = TPL->getDepth();
269 inherited::TraverseLambdaExpr(Lambda);
271 InLambda = WasInLambda;
272 DepthLimit = OldDepthLimit;
282 return inherited::TraverseLambdaCapture(Lambda, C, Init);
295 for (
auto *SI : FunctionScopes)
296 if (isa<sema::LambdaScopeInfo>(SI))
307 if (Unexpanded.empty())
316 for (
unsigned N = FunctionScopes.size(); N; --N) {
318 dyn_cast<sema::LambdaScopeInfo>(FunctionScopes[N-1])) {
319 if (N == FunctionScopes.size()) {
320 for (
auto &Param : Unexpanded) {
321 auto *PD = dyn_cast_or_null<ParmVarDecl>(
323 if (PD && PD->getDeclContext() == LSI->CallOperator)
324 LambdaParamPackReferences.push_back(Param);
332 if (!LambdaParamPackReferences.empty()) {
333 Unexpanded = LambdaParamPackReferences;
337 LSI->ContainsUnexpandedParameterPack =
true;
344 llvm::SmallPtrSet<IdentifierInfo *, 4> NamesKnown;
346 for (
unsigned I = 0, N = Unexpanded.size(); I != N; ++I) {
350 Name = TTP->getIdentifier();
354 if (Name && NamesKnown.insert(Name).second)
355 Names.push_back(Name);
357 if (Unexpanded[I].second.isValid())
358 Locations.push_back(Unexpanded[I].second);
362 << (int)UPPC << (
int)Names.size();
363 for (
size_t I = 0, E =
std::min(Names.size(), (
size_t)2); I != E; ++I)
366 for (
unsigned I = 0, N = Locations.size(); I != N; ++I)
381 CollectUnexpandedParameterPacksVisitor(Unexpanded).TraverseTypeLoc(
383 assert(!Unexpanded.empty() &&
"Unable to find unexpanded parameter packs");
396 CollectUnexpandedParameterPacksVisitor(Unexpanded).TraverseStmt(E);
397 assert(!Unexpanded.empty() &&
"Unable to find unexpanded parameter packs");
411 CollectUnexpandedParameterPacksVisitor(Unexpanded)
413 assert(!Unexpanded.empty() &&
"Unable to find unexpanded parameter packs");
439 return DiagnoseUnexpandedParameterPack(NameInfo.
getLoc(), TSInfo, UPPC);
448 CollectUnexpandedParameterPacksVisitor(Unexpanded)
450 assert(!Unexpanded.empty() &&
"Unable to find unexpanded parameter packs");
462 CollectUnexpandedParameterPacksVisitor(Unexpanded)
463 .TraverseTemplateName(Template);
464 assert(!Unexpanded.empty() &&
"Unable to find unexpanded parameter packs");
475 CollectUnexpandedParameterPacksVisitor(Unexpanded)
476 .TraverseTemplateArgumentLoc(Arg);
477 assert(!Unexpanded.empty() &&
"Unable to find unexpanded parameter packs");
483 CollectUnexpandedParameterPacksVisitor(Unexpanded)
484 .TraverseTemplateArgument(Arg);
489 CollectUnexpandedParameterPacksVisitor(Unexpanded)
490 .TraverseTemplateArgumentLoc(Arg);
495 CollectUnexpandedParameterPacksVisitor(Unexpanded).TraverseType(T);
500 CollectUnexpandedParameterPacksVisitor(Unexpanded).TraverseTypeLoc(TL);
506 CollectUnexpandedParameterPacksVisitor(Unexpanded)
507 .TraverseNestedNameSpecifierLoc(NNS);
513 CollectUnexpandedParameterPacksVisitor(Unexpanded)
514 .TraverseDeclarationNameInfo(NameInfo);
548 Diag(EllipsisLoc, diag::err_pack_expansion_without_parameter_packs)
555 llvm_unreachable(
"Unhandled template argument kind?");
561 GetTypeFromParser(Type, &TSInfo);
569 return CreateParsedType(TSResult->
getType(), TSResult);
578 EllipsisLoc, NumExpansions);
598 Diag(EllipsisLoc, diag::err_pack_expansion_without_parameter_packs)
607 return CheckPackExpansion(Pattern, EllipsisLoc,
None);
620 Diag(EllipsisLoc, diag::err_pack_expansion_without_parameter_packs)
636 RetainExpansion =
false;
637 std::pair<IdentifierInfo *, SourceLocation> FirstPack;
638 bool HaveFirstPack =
false;
641 end = Unexpanded.end();
644 unsigned Depth = 0, Index = 0;
646 bool IsFunctionParameterPack =
false;
650 Depth = TTP->getDepth();
651 Index = TTP->getIndex();
652 Name = TTP->getIdentifier();
655 if (isa<ParmVarDecl>(ND))
656 IsFunctionParameterPack =
true;
664 unsigned NewPackSize;
665 if (IsFunctionParameterPack) {
669 llvm::PointerUnion<Decl *, DeclArgumentPack *> *Instantiation
670 = CurrentInstantiationScope->findInstantiationOf(
672 if (Instantiation->is<DeclArgumentPack *>()) {
674 NewPackSize = Instantiation->get<DeclArgumentPack *>()->size();
678 ShouldExpand =
false;
687 ShouldExpand =
false;
692 NewPackSize = TemplateArgs(Depth, Index).pack_size();
699 if (!IsFunctionParameterPack && CurrentInstantiationScope) {
701 = CurrentInstantiationScope->getPartiallySubstitutedPack()){
702 unsigned PartialDepth, PartialIndex;
704 if (PartialDepth == Depth && PartialIndex == Index)
705 RetainExpansion =
true;
709 if (!NumExpansions) {
712 NumExpansions = NewPackSize;
713 FirstPack.first = Name;
714 FirstPack.second = i->second;
715 HaveFirstPack =
true;
719 if (NewPackSize != *NumExpansions) {
724 Diag(EllipsisLoc, diag::err_pack_expansion_length_conflict)
725 << FirstPack.first << Name << *NumExpansions << NewPackSize
728 Diag(EllipsisLoc, diag::err_pack_expansion_length_conflict_multilevel)
729 << Name << *NumExpansions << NewPackSize
730 << SourceRange(i->second);
740 QualType Pattern = cast<PackExpansionType>(
T)->getPattern();
742 CollectUnexpandedParameterPacksVisitor(Unexpanded).TraverseType(Pattern);
745 for (
unsigned I = 0, N = Unexpanded.size(); I != N; ++I) {
752 Depth = TTP->getDepth();
753 Index = TTP->getIndex();
756 if (isa<ParmVarDecl>(ND)) {
760 llvm::PointerUnion<Decl *, DeclArgumentPack *> *Instantiation
761 = CurrentInstantiationScope->findInstantiationOf(
763 if (Instantiation->is<
Decl*>())
768 unsigned Size = Instantiation->get<DeclArgumentPack *>()->size();
769 assert((!Result || *Result == Size) &&
"inconsistent pack sizes");
783 unsigned Size = TemplateArgs(Depth, Index).pack_size();
784 assert((!Result || *Result == Size) &&
"inconsistent pack sizes");
836 #define GENERIC_IMAGE_TYPE(ImgType, Id) case TST_##ImgType##_t: 837 #include "clang/Basic/OpenCLImageTypes.def" 845 switch (Chunk.
Kind) {
860 for (
unsigned i = 0, e = Chunk.
Fun.
NumParams; i != e; ++i) {
863 assert(!ParamTy.isNull() &&
"Couldn't parse type?");
864 if (ParamTy->containsUnexpandedParameterPack())
return true;
901 bool ValidateCandidate(
const TypoCorrection &candidate)
override {
930 LookupResult R(*
this, &Name, NameLoc, LookupOrdinaryName);
943 llvm::make_unique<ParameterPackValidatorCCC>(),
944 CTK_ErrorRecovery)) {
945 diagnoseTypo(Corrected,
946 PDiag(diag::err_sizeof_pack_no_pack_name_suggest) << &Name,
947 PDiag(diag::note_parameter_pack_here));
948 ParameterPack = Corrected.getCorrectionDecl();
956 DiagnoseAmbiguousLookup(R);
961 Diag(NameLoc, diag::err_sizeof_pack_no_pack_name)
966 MarkAnyDeclReferenced(OpLoc, ParameterPack,
true);
983 if (!ExpansionTSInfo)
1006 = cast<PackExpansionExpr>(Argument.
getAsExpr());
1029 llvm_unreachable(
"Invalid TemplateArgument Kind!");
1044 Pack = Subst->getArgumentPack();
1051 dyn_cast<SubstNonTypeTemplateParmPackExpr>(Arg.
getAsExpr()))
1052 Pack = Subst->getArgumentPack();
1053 else if (
auto *Subst = dyn_cast<FunctionParmPackExpr>(Arg.
getAsExpr())) {
1055 if (PD->isParameterPack())
1057 return Subst->getNumExpansions();
1065 Pack = Subst->getArgumentPack();
1083 if (Elem.isPackExpansion())
1086 return Pack.pack_size();
1095 if ((OCE && OCE->isInfixBinaryOp()) || isa<BinaryOperator>(E) ||
1096 isa<AbstractConditionalOperator>(E)) {
1113 auto DiscardOperands = [&] {
1114 CorrectDelayedTyposInExpr(LHS);
1115 CorrectDelayedTyposInExpr(RHS);
1126 return Diag(EllipsisLoc,
1128 ? diag::err_fold_expression_packs_both_sides
1129 : diag::err_pack_expansion_without_parameter_packs)
1137 Expr *Pack = LHS ? LHS : RHS;
1138 assert(Pack &&
"fold expression with neither LHS nor RHS");
1141 return Diag(EllipsisLoc, diag::err_pack_expansion_without_parameter_packs)
1146 return BuildCXXFoldExpr(LParenLoc, LHS, Opc, EllipsisLoc, RHS, RParenLoc);
1154 Operator, EllipsisLoc, RHS, RParenLoc);
1171 return ActOnCXXBoolLiteral(EllipsisLoc, tok::kw_false);
1173 return ActOnCXXBoolLiteral(EllipsisLoc, tok::kw_true);
1175 ScalarType = Context.
VoidTy;
1179 return Diag(EllipsisLoc, diag::err_fold_expression_empty)
ParsedType getTrailingReturnType() const
Get the trailing-return-type for this function declarator.
A call to an overloaded operator written using operator syntax.
SourceLocation getLoc() const
getLoc - Returns the main location of the declaration name.
An instance of this class is created to represent a function declaration or definition.
Name lookup found a set of overloaded functions that met the criteria.
UnexpandedParameterPackContext
The context in which an unexpanded parameter pack is being diagnosed.
static DiagnosticBuilder Diag(DiagnosticsEngine *Diags, const LangOptions &Features, FullSourceLoc TokLoc, const char *TokBegin, const char *TokRangeBegin, const char *TokRangeEnd, unsigned DiagID)
Produce a diagnostic highlighting some portion of a literal.
ObjCDictionaryElement getKeyValueElement(unsigned Index) const
const TypeClass * getTypePtr() const
A (possibly-)qualified type.
Simple class containing the result of Sema::CorrectTypo.
const TypeClass * getTypePtr() const
__SIZE_TYPE__ size_t
The unsigned integer type of the result of the sizeof operator.
const DeclaratorChunk & getTypeObject(unsigned i) const
Return the specified TypeInfo from this declarator.
static std::pair< unsigned, unsigned > getDepthAndIndex(NamedDecl *ND)
Retrieve the depth and index of a parameter pack.
NestedNameSpecifierLoc getTemplateQualifierLoc() const
Stmt - This represents one statement.
The template argument is an expression, and we've not resolved it to one of the other forms yet...
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID)
Emit a diagnostic.
Decl - This represents one declaration (or definition), e.g.
Expr * getAsExpr() const
Retrieve the non-type template argument's expression.
bool isPackExpansion() const
Determine whether this is a pack expansion.
The base class of the type hierarchy.
One instance of this struct is used for each type in a declarator that is parsed. ...
The template argument is a declaration that was provided for a pointer, reference, or pointer to member non-type template parameter.
A container of type source information.
bool isPackExpansion() const
Determine whether this capture is a pack expansion, which captures a function parameter pack...
Describes the capture of a variable or of this, or of a C++1y init-capture.
bool isPackExpansion() const
Determine whether this initializer is a pack expansion.
unsigned getDepth() const
Get the nesting depth of the template parameter.
Information about one declarator, including the parsed type information and the identifier.
QualType getCXXNameType() const
getCXXNameType - If this name is one of the C++ names (of a constructor, destructor, or conversion function), return the type associated with that name.
const T * getAs() const
Member-template getAs<specific type>'.
Represents an empty template argument, e.g., one that has not been deduced.
void setBegin(SourceLocation b)
bool isParameterPack() const
Whether this declaration is a parameter pack.
unsigned getNumExceptions() const
Get the number of dynamic exception specifications.
ParmVarDecl - Represents a parameter to a function.
IdentifierInfo * getIdentifier() const
getIdentifier - Get the identifier that names this declaration, if there is one.
Base wrapper for a particular "section" of type source info.
Expr * IgnoreImpCasts() LLVM_READONLY
IgnoreImpCasts - Skip past any implicit casts which might surround this expression.
Expr * NoexceptExpr
Pointer to the expression in the noexcept-specifier of this function, if it has one.
One of these records is kept for each identifier that is lexed.
Name lookup results in an ambiguity; use getAmbiguityKind to figure out what kind of ambiguity we hav...
TemplateArgument getPackExpansionPattern() const
When the template argument is a pack expansion, returns the pattern of the pack expansion.
An element in an Objective-C dictionary literal.
Expr * getAsExpr() const
Retrieve the template argument as an expression.
A C++ nested-name-specifier augmented with source location information.
TypeSourceInfo * getTypeSourceInfo() const
The template argument is an integral value stored in an llvm::APSInt that was provided for an integra...
TemplateDecl * getAsTemplateDecl() const
Retrieve the underlying template declaration that this template name refers to, if known...
Base class for callback objects used by Sema::CorrectTypo to check the validity of a potential typo c...
TypeSourceInfo * getTypeSourceInfo(ASTContext &Context, QualType T)
Creates a TypeSourceInfo for the given type.
SubstTemplateTemplateParmPackStorage * getAsSubstTemplateTemplateParmPack() const
Retrieve the substituted template template parameter pack, if known.
SourceLocation getLocation() const
Retrieve the location of the template argument.
SourceLocation getLocation() const
Fetches the primary location of the argument.
const DeclarationNameInfo & getLookupNameInfo() const
Gets the name info to look up.
Optional< unsigned > getNumTemplateExpansions() const
Retrieve the number of expansions that a template template argument expansion will produce...
Represents the result of substituting a set of types for a template type parameter pack...
A non-type template parameter, stored as an expression.
bool CheckParameterPacksForExpansion(SourceLocation EllipsisLoc, SourceRange PatternRange, ArrayRef< UnexpandedParameterPack > Unexpanded, const MultiLevelTemplateArgumentList &TemplateArgs, bool &ShouldExpand, bool &RetainExpansion, Optional< unsigned > &NumExpansions)
Determine whether we could expand a pack expansion with the given set of parameter packs into separat...
LookupResultKind getResultKind() const
ParsedType getAsType() const
Retrieve the template type argument's type.
No entity found met the criteria within the current instantiation,, but there were dependent base cla...
StringRef getOpcodeStr() const
Represents the results of name lookup.
bool DiagnoseUnexpandedParameterPacks(SourceLocation Loc, UnexpandedParameterPackContext UPPC, ArrayRef< UnexpandedParameterPack > Unexpanded)
Diagnose unexpanded parameter packs.
FunctionTemplateDecl * getDescribedFunctionTemplate() const
Retrieves the function template that is described by this function declaration.
unsigned getNumTypeObjects() const
Return the number of types applied to this declarator.
bool containsUnexpandedParameterPack() const
Whether this type is or contains an unexpanded parameter pack, used to support C++0x variadic templat...
enum clang::DeclaratorChunk::@198 Kind
SourceLocation getTemplateEllipsisLoc() const
ExprResult ActOnCXXFoldExpr(SourceLocation LParenLoc, Expr *LHS, tok::TokenKind Operator, SourceLocation EllipsisLoc, Expr *RHS, SourceLocation RParenLoc)
Handle a C++1z fold-expression: ( expr op ... op expr ).
Scope - A scope is a transient data structure that is used while parsing the program.
unsigned getIndex() const
Get the index of the template parameter within its parameter list.
Represents a C++ nested-name-specifier or a global scope specifier.
Optional< unsigned > getFullyPackExpandedSize(TemplateArgument Arg)
Given a template argument that contains an unexpanded parameter pack, but which has already been subs...
Expr * Key
The key for the dictionary element.
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
A class that does preorder or postorder depth-first traversal on the entire Clang AST and visits each...
NameKind getNameKind() const
getNameKind - Determine what kind of name this is.
TyLocType push(QualType T)
Pushes space for a new TypeLoc of the given type.
Sema - This implements semantic analysis and AST building for C.
bool containsUnexpandedParameterPack() const
Determines whether this template name contains an unexpanded parameter pack (for C++0x variadic templ...
A little helper class used to produce diagnostics.
SourceLocation getLocEnd() const LLVM_READONLY
unsigned NumParams
NumParams - This is the number of formal parameters specified by the declarator.
SourceLocation getLocation() const
SourceRange getRange() const
TypeSourceInfo * getTrivialTypeSourceInfo(QualType T, SourceLocation Loc=SourceLocation()) const
Allocate a TypeSourceInfo where all locations have been initialized to a given location, which defaults to the empty location.
TST getTypeSpecType() const
An expression "T()" which creates a value-initialized rvalue of type T, which is a non-class type...
TypeSourceInfo * CheckPackExpansion(TypeSourceInfo *Pattern, SourceLocation EllipsisLoc, Optional< unsigned > NumExpansions)
Construct a pack expansion type from the pattern of the pack expansion.
Expr - This represents one expression.
bool containsUnexpandedParameterPacks(Declarator &D)
Determine whether the given declarator contains any unexpanded parameter packs.
bool isPackExpansion() const
const FunctionProtoType * T
Declaration of a template type parameter.
The template argument is a null pointer or null pointer to member that was provided for a non-type te...
bool isPackExpansion() const
Determine whether this is a pack expansion.
ObjCDictionaryLiteral - AST node to represent objective-c dictionary literals; as in:"name" : NSUserN...
SourceLocation getBeginLoc() const
SourceLocation getEllipsisLoc() const
TypeSourceInfo * getNamedTypeInfo() const
getNamedTypeInfo - Returns the source type info associated to the name.
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
Represents a C++ template name within the type system.
char __ovld __cnfn min(char x, char y)
Returns y if y < x, otherwise it returns x.
Defines the clang::TypeLoc interface and its subclasses.
void setEllipsisLoc(SourceLocation Loc)
Represents a folding of a pack over an operator.
Data structure that captures multiple levels of template argument lists for use in template instantia...
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
bool isPackExpansion() const
Determine whether this template argument is a pack expansion.
The result type of a method or function.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
ParsedTemplateArgument ActOnPackExpansion(const ParsedTemplateArgument &Arg, SourceLocation EllipsisLoc)
Invoked when parsing a template argument followed by an ellipsis, which creates a pack expansion...
static StringRef getIdentifier(const Token &Tok)
TypeAndRange * Exceptions
Pointer to a new[]'d array of TypeAndRange objects that contain the types in the function's dynamic e...
NestedNameSpecifier * getScopeRep() const
Retrieve the representation of the nested-name-specifier.
QualType getPackExpansionType(QualType Pattern, Optional< unsigned > NumExpansions)
const CXXScopeSpec & getScopeSpec() const
Retrieve the nested-name-specifier that precedes the template name in a template template argument...
static bool DiagnoseUnexpandedParameterPacks(Sema &S, TemplateTemplateParmDecl *TTP)
Check for unexpanded parameter packs within the template parameters of a template template parameter...
bool containsUnexpandedParameterPack() const
Whether this nested-name-specifier contains an unexpanded parameter pack (for C++11 variadic template...
TypeLoc getPatternLoc() const
ActionResult - This structure is used while parsing/acting on expressions, stmts, etc...
Represents the parsed form of a C++ template argument.
Encodes a location in the source.
A structure for storing an already-substituted template template parameter pack.
unsigned getNumElements() const
getNumElements - Return number of elements of objective-c dictionary literal.
DeclarationName getName() const
getName - Returns the embedded declaration name.
SourceLocation getEllipsisLoc() const
Retrieve the location of the ellipsis that describes this pack expansion.
static SizeOfPackExpr * Create(ASTContext &Context, SourceLocation OperatorLoc, NamedDecl *Pack, SourceLocation PackLoc, SourceLocation RParenLoc, Optional< unsigned > Length=None, ArrayRef< TemplateArgument > PartialArgs=None)
Represents a dependent using declaration which was not marked with typename.
KindType getKind() const
Determine what kind of template argument we have.
bool isPackExpansion() const
Determine whether this base specifier is a pack expansion.
bool isParameterPack() const
Name lookup found an unresolvable value declaration and cannot yet complete.
MemberPointerTypeInfo Mem
TokenKind
Provides a simple uniform namespace for tokens from all C languages.
bool hasTrailingReturnType() const
Determine whether this function declarator had a trailing-return-type.
No entity found met the criteria.
A template type parameter, stored as a type.
bool hasTemplateArgument(unsigned Depth, unsigned Index) const
Determine whether there is a non-NULL template argument at the given depth and index.
Optional< unsigned > getNumExpansions() const
Retrieve the number of expansions that this pack expansion will generate, if known.
SourceLocation getExprLoc() const LLVM_READONLY
getExprLoc - Return the preferred location for the arrow when diagnosing a problem with a generic exp...
Expr * Value
The value of the dictionary element.
Represents a pack expansion of types.
ArrayRef< TemplateArgument > pack_elements() const
Iterator range referencing all of the elements of a template argument pack.
Represents a template argument.
void collectUnexpandedParameterPacks(TemplateArgument Arg, SmallVectorImpl< UnexpandedParameterPack > &Unexpanded)
Collect the set of unexpanded parameter packs within the given template argument. ...
bool isNull() const
Determine whether this template name is NULL.
Dataflow Directional Tag Classes.
bool containsUnexpandedParameterPack() const
Whether this template argument contains an unexpanded parameter pack.
ParsedTemplateTy getAsTemplate() const
Retrieve the template template argument's template name.
const TemplateArgument & getArgument() const
QualType getType() const
Get the type for which this source info wrapper provides information.
The template argument is a pack expansion of a template name that was provided for a template templat...
bool isInvalid() const
Determine whether the given template argument is invalid.
Represents a dependent using declaration which was marked with typename.
NamedDecl * getCorrectionDecl() const
Gets the pointer to the declaration of the typo correction.
NamedDecl * getFoundDecl() const
Fetch the unique decl found by this lookup.
Represents a C++11 pack expansion that produces a sequence of expressions.
static void CheckFoldOperand(Sema &S, Expr *E)
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspnd...
TemplateParameterList * getTemplateParameterList() const
If this is a generic lambda expression, retrieve the template parameter list associated with it...
ExprResult BuildEmptyCXXFoldExpr(SourceLocation EllipsisLoc, BinaryOperatorKind Operator)
bool isNull() const
Determine whether this template argument has no value.
bool isValid() const
A scope specifier is present, and it refers to a real scope.
SourceRange getSourceRange() const LLVM_READONLY
Get the full source range.
Name lookup found a single declaration that met the criteria.
Location wrapper for a TemplateArgument.
ParsedTemplateArgument getTemplatePackExpansion(SourceLocation EllipsisLoc) const
Retrieve a pack expansion of the given template template argument.
ExprResult BuildCXXFoldExpr(SourceLocation LParenLoc, Expr *LHS, BinaryOperatorKind Operator, SourceLocation EllipsisLoc, Expr *RHS, SourceLocation RParenLoc)
Represents a C++ base or member initializer.
unsigned getNumLevels() const
Determine the number of levels in this template argument list.
The template argument is a type.
static FixItHint CreateInsertion(SourceLocation InsertionLoc, StringRef Code, bool BeforePreviousInsertions=false)
Create a code modification hint that inserts the given code string at a specific location.
ExceptionSpecificationType getExceptionSpecType() const
Get the type of exception specification this function has.
Sema::LookupNameKind getLookupKind() const
Gets the kind of lookup to perform.
The template argument is actually a parameter pack.
Represents a base class of a C++ class.
bool isUnexpandedParameterPackPermitted()
Determine whether an unexpanded parameter pack might be permitted in this location.
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
ArgKind getKind() const
Return the kind of stored template argument.
unsigned getDepth() const
bool DiagnoseUnexpandedParameterPack(SourceLocation Loc, TypeSourceInfo *T, UnexpandedParameterPackContext UPPC)
If the given type contains an unexpanded parameter pack, diagnose the error.
Captures information about "declaration specifiers".
The template argument is a template name that was provided for a template template parameter...
Expr * NumElts
This is the size of the array, or null if [] or [*] was specified.
bool isPackExpansion() const
Determines whether this dictionary element is a pack expansion.
const DeclSpec & getDeclSpec() const
getDeclSpec - Return the declaration-specifier that this declarator was declared with.
bool containsUnexpandedParameterPack() const
Whether this expression contains an unexpanded parameter pack (for C++11 variadic templates)...
Optional< unsigned > getNumExpansions() const
Determine the number of expansions that will be produced when this pack expansion is instantiated...
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
ParsedType getRepAsType() const
SourceLocation getNameLoc() const
Expr * getPattern()
Retrieve the pattern of the pack expansion.
QualType getAsType() const
Retrieve the type for a type template argument.
A reference to a declared variable, function, enum, etc.
Optional< unsigned > getNumArgumentsInExpansion(QualType T, const MultiLevelTemplateArgumentList &TemplateArgs)
Determine the number of arguments in the given pack expansion type.
SourceLocation getTemplateNameLoc() const
TemplateArgumentLoc getTemplateArgumentPackExpansionPattern(TemplateArgumentLoc OrigLoc, SourceLocation &Ellipsis, Optional< unsigned > &NumExpansions) const
Returns the pattern of the pack expansion for a template argument.
Wrapper for template type parameters.
A trivial tuple used to represent a source range.
NamedDecl - This represents a decl with a name.
Expr * getRepAsExpr() const
T castAs() const
Convert to the specified TypeLoc type, asserting that this TypeLoc is of the desired type...
A template template argument, stored as a template name.
TemplateName getAsTemplate() const
Retrieve the template name for a template name argument.
void pushFullCopy(TypeLoc L)
Pushes a copy of the given TypeLoc onto this builder.
ExprResult ActOnSizeofParameterPackExpr(Scope *S, SourceLocation OpLoc, IdentifierInfo &Name, SourceLocation NameLoc, SourceLocation RParenLoc)
Called when an expression computing the size of a parameter pack is parsed.
SourceLocation getLocStart() const LLVM_READONLY
SourceLocation getBegin() const
ParamInfo * Params
Params - This is a pointer to a new[]'d array of ParamInfo objects that describe the parameters speci...
Attr - This represents one attribute.
QualType getType() const
Return the type wrapped by this type source info.