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) {
328 if (
auto *LSI = dyn_cast<sema::LambdaScopeInfo>(Func)) {
329 if (N == FunctionScopes.size()) {
330 for (
auto &Param : Unexpanded) {
331 auto *PD = dyn_cast_or_null<ParmVarDecl>(
333 if (PD && PD->getDeclContext() == LSI->CallOperator)
334 LambdaParamPackReferences.push_back(Param);
342 if (!LambdaParamPackReferences.empty()) {
343 Unexpanded = LambdaParamPackReferences;
347 LSI->ContainsUnexpandedParameterPack =
true;
354 llvm::SmallPtrSet<IdentifierInfo *, 4> NamesKnown;
356 for (
unsigned I = 0, N = Unexpanded.size(); I != N; ++I) {
360 Name = TTP->getIdentifier();
364 if (Name && NamesKnown.insert(Name).second)
365 Names.push_back(Name);
367 if (Unexpanded[I].second.isValid())
368 Locations.push_back(Unexpanded[I].second);
372 << (int)UPPC << (
int)Names.size();
373 for (
size_t I = 0, E =
std::min(Names.size(), (
size_t)2); I != E; ++I)
376 for (
unsigned I = 0, N = Locations.size(); I != N; ++I)
391 CollectUnexpandedParameterPacksVisitor(Unexpanded).TraverseTypeLoc(
393 assert(!Unexpanded.empty() &&
"Unable to find unexpanded parameter packs");
406 CollectUnexpandedParameterPacksVisitor(Unexpanded).TraverseStmt(E);
407 assert(!Unexpanded.empty() &&
"Unable to find unexpanded parameter packs");
421 CollectUnexpandedParameterPacksVisitor(Unexpanded)
423 assert(!Unexpanded.empty() &&
"Unable to find unexpanded parameter packs");
449 return DiagnoseUnexpandedParameterPack(NameInfo.
getLoc(), TSInfo, UPPC);
458 CollectUnexpandedParameterPacksVisitor(Unexpanded)
460 assert(!Unexpanded.empty() &&
"Unable to find unexpanded parameter packs");
472 CollectUnexpandedParameterPacksVisitor(Unexpanded)
473 .TraverseTemplateName(Template);
474 assert(!Unexpanded.empty() &&
"Unable to find unexpanded parameter packs");
485 CollectUnexpandedParameterPacksVisitor(Unexpanded)
486 .TraverseTemplateArgumentLoc(Arg);
487 assert(!Unexpanded.empty() &&
"Unable to find unexpanded parameter packs");
493 CollectUnexpandedParameterPacksVisitor(Unexpanded)
494 .TraverseTemplateArgument(Arg);
499 CollectUnexpandedParameterPacksVisitor(Unexpanded)
500 .TraverseTemplateArgumentLoc(Arg);
505 CollectUnexpandedParameterPacksVisitor(Unexpanded).TraverseType(T);
510 CollectUnexpandedParameterPacksVisitor(Unexpanded).TraverseTypeLoc(TL);
516 CollectUnexpandedParameterPacksVisitor(Unexpanded)
517 .TraverseNestedNameSpecifierLoc(NNS);
523 CollectUnexpandedParameterPacksVisitor(Unexpanded)
524 .TraverseDeclarationNameInfo(NameInfo);
558 Diag(EllipsisLoc, diag::err_pack_expansion_without_parameter_packs)
565 llvm_unreachable(
"Unhandled template argument kind?");
571 GetTypeFromParser(Type, &TSInfo);
579 return CreateParsedType(TSResult->
getType(), TSResult);
588 EllipsisLoc, NumExpansions);
608 Diag(EllipsisLoc, diag::err_pack_expansion_without_parameter_packs)
617 return CheckPackExpansion(Pattern, EllipsisLoc,
None);
630 Diag(EllipsisLoc, diag::err_pack_expansion_without_parameter_packs)
646 RetainExpansion =
false;
647 std::pair<IdentifierInfo *, SourceLocation> FirstPack;
648 bool HaveFirstPack =
false;
651 end = Unexpanded.end();
654 unsigned Depth = 0, Index = 0;
656 bool IsFunctionParameterPack =
false;
660 Depth = TTP->getDepth();
661 Index = TTP->getIndex();
662 Name = TTP->getIdentifier();
665 if (isa<ParmVarDecl>(ND))
666 IsFunctionParameterPack =
true;
674 unsigned NewPackSize;
675 if (IsFunctionParameterPack) {
679 llvm::PointerUnion<Decl *, DeclArgumentPack *> *Instantiation
680 = CurrentInstantiationScope->findInstantiationOf(
682 if (Instantiation->is<DeclArgumentPack *>()) {
684 NewPackSize = Instantiation->get<DeclArgumentPack *>()->size();
688 ShouldExpand =
false;
697 ShouldExpand =
false;
702 NewPackSize = TemplateArgs(Depth, Index).pack_size();
709 if (!IsFunctionParameterPack && CurrentInstantiationScope) {
711 = CurrentInstantiationScope->getPartiallySubstitutedPack()){
712 unsigned PartialDepth, PartialIndex;
714 if (PartialDepth == Depth && PartialIndex == Index)
715 RetainExpansion =
true;
719 if (!NumExpansions) {
722 NumExpansions = NewPackSize;
723 FirstPack.first = Name;
724 FirstPack.second = i->second;
725 HaveFirstPack =
true;
729 if (NewPackSize != *NumExpansions) {
734 Diag(EllipsisLoc, diag::err_pack_expansion_length_conflict)
735 << FirstPack.first << Name << *NumExpansions << NewPackSize
738 Diag(EllipsisLoc, diag::err_pack_expansion_length_conflict_multilevel)
739 << Name << *NumExpansions << NewPackSize
740 << SourceRange(i->second);
750 QualType Pattern = cast<PackExpansionType>(
T)->getPattern();
752 CollectUnexpandedParameterPacksVisitor(Unexpanded).TraverseType(Pattern);
755 for (
unsigned I = 0, N = Unexpanded.size(); I != N; ++I) {
762 Depth = TTP->getDepth();
763 Index = TTP->getIndex();
766 if (isa<ParmVarDecl>(ND)) {
770 llvm::PointerUnion<Decl *, DeclArgumentPack *> *Instantiation
771 = CurrentInstantiationScope->findInstantiationOf(
773 if (Instantiation->is<
Decl*>())
778 unsigned Size = Instantiation->get<DeclArgumentPack *>()->size();
779 assert((!Result || *Result == Size) &&
"inconsistent pack sizes");
793 unsigned Size = TemplateArgs(Depth, Index).pack_size();
794 assert((!Result || *Result == Size) &&
"inconsistent pack sizes");
846 #define GENERIC_IMAGE_TYPE(ImgType, Id) case TST_##ImgType##_t: 847 #include "clang/Basic/OpenCLImageTypes.def" 855 switch (Chunk.
Kind) {
870 for (
unsigned i = 0, e = Chunk.
Fun.
NumParams; i != e; ++i) {
873 assert(!ParamTy.isNull() &&
"Couldn't parse type?");
874 if (ParamTy->containsUnexpandedParameterPack())
return true;
911 bool ValidateCandidate(
const TypoCorrection &candidate)
override {
940 LookupResult R(*
this, &Name, NameLoc, LookupOrdinaryName);
953 llvm::make_unique<ParameterPackValidatorCCC>(),
954 CTK_ErrorRecovery)) {
955 diagnoseTypo(Corrected,
956 PDiag(diag::err_sizeof_pack_no_pack_name_suggest) << &Name,
957 PDiag(diag::note_parameter_pack_here));
958 ParameterPack = Corrected.getCorrectionDecl();
966 DiagnoseAmbiguousLookup(R);
971 Diag(NameLoc, diag::err_sizeof_pack_no_pack_name)
976 MarkAnyDeclReferenced(OpLoc, ParameterPack,
true);
993 if (!ExpansionTSInfo)
1016 = cast<PackExpansionExpr>(Argument.
getAsExpr());
1039 llvm_unreachable(
"Invalid TemplateArgument Kind!");
1054 Pack = Subst->getArgumentPack();
1061 dyn_cast<SubstNonTypeTemplateParmPackExpr>(Arg.
getAsExpr()))
1062 Pack = Subst->getArgumentPack();
1063 else if (
auto *Subst = dyn_cast<FunctionParmPackExpr>(Arg.
getAsExpr())) {
1065 if (PD->isParameterPack())
1067 return Subst->getNumExpansions();
1075 Pack = Subst->getArgumentPack();
1093 if (Elem.isPackExpansion())
1096 return Pack.pack_size();
1105 if ((OCE && OCE->isInfixBinaryOp()) || isa<BinaryOperator>(E) ||
1106 isa<AbstractConditionalOperator>(E)) {
1123 auto DiscardOperands = [&] {
1124 CorrectDelayedTyposInExpr(LHS);
1125 CorrectDelayedTyposInExpr(RHS);
1136 return Diag(EllipsisLoc,
1138 ? diag::err_fold_expression_packs_both_sides
1139 : diag::err_pack_expansion_without_parameter_packs)
1147 Expr *Pack = LHS ? LHS : RHS;
1148 assert(Pack &&
"fold expression with neither LHS nor RHS");
1151 return Diag(EllipsisLoc, diag::err_pack_expansion_without_parameter_packs)
1156 return BuildCXXFoldExpr(LParenLoc, LHS, Opc, EllipsisLoc, RHS, RParenLoc);
1164 Operator, EllipsisLoc, RHS, RParenLoc);
1181 return ActOnCXXBoolLiteral(EllipsisLoc, tok::kw_false);
1183 return ActOnCXXBoolLiteral(EllipsisLoc, tok::kw_true);
1185 ScalarType = Context.
VoidTy;
1189 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.
Represents 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.
Retains information about a function, method, or block that is currently being parsed.
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.
Represents a parameter to a function.
IdentifierInfo * getIdentifier() const
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.
Contains information about the compound statement currently being parsed.
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.
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.
__DEVICE__ int min(int __a, int __b)
SourceLocation getTemplateNameLoc() const
SmallVector< CompoundScopeInfo, 4 > CompoundScopes
The stack of currently active compound stamement scopes in the function.
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.
This represents a decl that may have 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.