23 using namespace clang;
31 class CollectUnexpandedParameterPacksVisitor :
39 bool InLambda =
false;
40 unsigned DepthLimit = (unsigned)-1;
43 if (
auto *PVD = dyn_cast<ParmVarDecl>(ND)) {
47 auto *FD = dyn_cast<
FunctionDecl>(PVD->getDeclContext());
49 if (FTD && FTD->getTemplateParameters()->getDepth() >= DepthLimit)
54 Unexpanded.push_back({ND, Loc});
59 Unexpanded.push_back({T, Loc});
63 explicit CollectUnexpandedParameterPacksVisitor(
65 : Unexpanded(Unexpanded) {}
67 bool shouldWalkTypesOfTypeLocs()
const {
return false; }
103 if (
auto *TTP = dyn_cast_or_null<TemplateTemplateParmDecl>(
105 if (TTP->isParameterPack())
109 return inherited::TraverseTemplateName(Template);
123 TraverseStmt(Element.
Key);
124 TraverseStmt(Element.
Value);
134 bool TraverseStmt(
Stmt *S) {
135 Expr *E = dyn_cast_or_null<Expr>(S);
137 return inherited::TraverseStmt(S);
146 return inherited::TraverseType(T);
153 bool TraverseTypeLoc(
TypeLoc TL) {
157 return inherited::TraverseTypeLoc(TL);
163 bool TraverseDecl(
Decl *D) {
170 return inherited::TraverseDecl(D);
174 bool TraverseAttr(
Attr *A) {
178 return inherited::TraverseAttr(A);
186 bool TraverseCXXFoldExpr(
CXXFoldExpr *E) {
return true; }
195 return inherited::TraverseUnresolvedUsingValueDecl(D);
203 return inherited::TraverseUnresolvedUsingTypenameDecl(D);
211 return inherited::TraverseTemplateArgument(Arg);
219 return inherited::TraverseTemplateArgumentLoc(ArgLoc);
227 return inherited::TraverseCXXBaseSpecifier(Base);
235 return inherited::TraverseConstructorInitializer(Init);
249 bool WasInLambda = InLambda;
250 unsigned OldDepthLimit = DepthLimit;
254 DepthLimit = TPL->getDepth();
256 inherited::TraverseLambdaExpr(Lambda);
258 InLambda = WasInLambda;
259 DepthLimit = OldDepthLimit;
269 return inherited::TraverseLambdaCapture(Lambda, C, Init);
282 for (
auto *SI : FunctionScopes)
283 if (isa<sema::LambdaScopeInfo>(SI))
294 if (Unexpanded.empty())
303 for (
unsigned N = FunctionScopes.size(); N; --N) {
315 if (
auto *LSI = dyn_cast<sema::LambdaScopeInfo>(Func)) {
316 if (N == FunctionScopes.size()) {
317 for (
auto &Param : Unexpanded) {
318 auto *PD = dyn_cast_or_null<ParmVarDecl>(
320 if (PD && PD->getDeclContext() == LSI->CallOperator)
321 LambdaParamPackReferences.push_back(Param);
329 if (!LambdaParamPackReferences.empty()) {
330 Unexpanded = LambdaParamPackReferences;
334 LSI->ContainsUnexpandedParameterPack =
true;
341 llvm::SmallPtrSet<IdentifierInfo *, 4> NamesKnown;
343 for (
unsigned I = 0, N = Unexpanded.size(); I != N; ++I) {
347 Name = TTP->getIdentifier();
351 if (Name && NamesKnown.insert(Name).second)
352 Names.push_back(Name);
354 if (Unexpanded[I].second.isValid())
355 Locations.push_back(Unexpanded[I].second);
359 << (int)UPPC << (
int)Names.size();
360 for (
size_t I = 0, E =
std::min(Names.size(), (
size_t)2); I != E; ++I)
363 for (
unsigned I = 0, N = Locations.size(); I != N; ++I)
378 CollectUnexpandedParameterPacksVisitor(Unexpanded).TraverseTypeLoc(
380 assert(!Unexpanded.empty() &&
"Unable to find unexpanded parameter packs");
393 CollectUnexpandedParameterPacksVisitor(Unexpanded).TraverseStmt(E);
394 assert(!Unexpanded.empty() &&
"Unable to find unexpanded parameter packs");
408 CollectUnexpandedParameterPacksVisitor(Unexpanded)
410 assert(!Unexpanded.empty() &&
"Unable to find unexpanded parameter packs");
436 return DiagnoseUnexpandedParameterPack(NameInfo.
getLoc(), TSInfo, UPPC);
445 CollectUnexpandedParameterPacksVisitor(Unexpanded)
447 assert(!Unexpanded.empty() &&
"Unable to find unexpanded parameter packs");
459 CollectUnexpandedParameterPacksVisitor(Unexpanded)
460 .TraverseTemplateName(Template);
461 assert(!Unexpanded.empty() &&
"Unable to find unexpanded parameter packs");
472 CollectUnexpandedParameterPacksVisitor(Unexpanded)
473 .TraverseTemplateArgumentLoc(Arg);
474 assert(!Unexpanded.empty() &&
"Unable to find unexpanded parameter packs");
480 CollectUnexpandedParameterPacksVisitor(Unexpanded)
481 .TraverseTemplateArgument(Arg);
486 CollectUnexpandedParameterPacksVisitor(Unexpanded)
487 .TraverseTemplateArgumentLoc(Arg);
492 CollectUnexpandedParameterPacksVisitor(Unexpanded).TraverseType(T);
497 CollectUnexpandedParameterPacksVisitor(Unexpanded).TraverseTypeLoc(TL);
503 CollectUnexpandedParameterPacksVisitor(Unexpanded)
504 .TraverseNestedNameSpecifierLoc(NNS);
510 CollectUnexpandedParameterPacksVisitor(Unexpanded)
511 .TraverseDeclarationNameInfo(NameInfo);
545 Diag(EllipsisLoc, diag::err_pack_expansion_without_parameter_packs)
552 llvm_unreachable(
"Unhandled template argument kind?");
558 GetTypeFromParser(Type, &TSInfo);
566 return CreateParsedType(TSResult->
getType(), TSResult);
575 EllipsisLoc, NumExpansions);
595 Diag(EllipsisLoc, diag::err_pack_expansion_without_parameter_packs)
604 return CheckPackExpansion(Pattern, EllipsisLoc,
None);
617 Diag(EllipsisLoc, diag::err_pack_expansion_without_parameter_packs)
633 RetainExpansion =
false;
634 std::pair<IdentifierInfo *, SourceLocation> FirstPack;
635 bool HaveFirstPack =
false;
640 end = Unexpanded.end();
643 unsigned Depth = 0, Index = 0;
645 bool IsFunctionParameterPack =
false;
649 Depth = TTP->getDepth();
650 Index = TTP->getIndex();
651 Name = TTP->getIdentifier();
654 if (isa<ParmVarDecl>(ND))
655 IsFunctionParameterPack =
true;
663 unsigned NewPackSize;
664 if (IsFunctionParameterPack) {
668 llvm::PointerUnion<Decl *, DeclArgumentPack *> *Instantiation
669 = CurrentInstantiationScope->findInstantiationOf(
671 if (Instantiation->is<DeclArgumentPack *>()) {
673 NewPackSize = Instantiation->get<DeclArgumentPack *>()->size();
677 ShouldExpand =
false;
686 ShouldExpand =
false;
691 NewPackSize = TemplateArgs(Depth, Index).pack_size();
698 if (!IsFunctionParameterPack && CurrentInstantiationScope) {
700 = CurrentInstantiationScope->getPartiallySubstitutedPack()){
701 unsigned PartialDepth, PartialIndex;
703 if (PartialDepth == Depth && PartialIndex == Index) {
704 RetainExpansion =
true;
706 NumPartialExpansions = NewPackSize;
707 PartiallySubstitutedPackLoc = i->second;
713 if (!NumExpansions) {
716 NumExpansions = NewPackSize;
717 FirstPack.first = Name;
718 FirstPack.second = i->second;
719 HaveFirstPack =
true;
723 if (NewPackSize != *NumExpansions) {
728 Diag(EllipsisLoc, diag::err_pack_expansion_length_conflict)
729 << FirstPack.first << Name << *NumExpansions << NewPackSize
732 Diag(EllipsisLoc, diag::err_pack_expansion_length_conflict_multilevel)
733 << Name << *NumExpansions << NewPackSize
734 << SourceRange(i->second);
748 if (NumPartialExpansions) {
749 if (NumExpansions && *NumExpansions < *NumPartialExpansions) {
751 CurrentInstantiationScope->getPartiallySubstitutedPack();
752 Diag(EllipsisLoc, diag::err_pack_expansion_length_conflict_partial)
753 << PartialPack << *NumPartialExpansions << *NumExpansions
758 NumExpansions = NumPartialExpansions;
766 QualType Pattern = cast<PackExpansionType>(T)->getPattern();
768 CollectUnexpandedParameterPacksVisitor(Unexpanded).TraverseType(Pattern);
771 for (
unsigned I = 0, N = Unexpanded.size(); I != N; ++I) {
778 Depth = TTP->getDepth();
779 Index = TTP->getIndex();
782 if (isa<ParmVarDecl>(ND)) {
786 llvm::PointerUnion<Decl *, DeclArgumentPack *> *Instantiation
787 = CurrentInstantiationScope->findInstantiationOf(
789 if (Instantiation->is<
Decl*>())
794 unsigned Size = Instantiation->get<DeclArgumentPack *>()->size();
795 assert((!Result || *Result == Size) &&
"inconsistent pack sizes");
809 unsigned Size = TemplateArgs(Depth, Index).pack_size();
810 assert((!Result || *Result == Size) &&
"inconsistent pack sizes");
865 #define GENERIC_IMAGE_TYPE(ImgType, Id) case TST_##ImgType##_t: 866 #include "clang/Basic/OpenCLImageTypes.def" 874 switch (Chunk.
Kind) {
889 for (
unsigned i = 0, e = Chunk.
Fun.
NumParams; i != e; ++i) {
892 assert(!ParamTy.isNull() &&
"Couldn't parse type?");
893 if (ParamTy->containsUnexpandedParameterPack())
return true;
930 bool ValidateCandidate(
const TypoCorrection &candidate)
override {
959 LookupResult R(*
this, &Name, NameLoc, LookupOrdinaryName);
972 llvm::make_unique<ParameterPackValidatorCCC>(),
973 CTK_ErrorRecovery)) {
974 diagnoseTypo(Corrected,
975 PDiag(diag::err_sizeof_pack_no_pack_name_suggest) << &Name,
976 PDiag(diag::note_parameter_pack_here));
977 ParameterPack = Corrected.getCorrectionDecl();
985 DiagnoseAmbiguousLookup(R);
990 Diag(NameLoc, diag::err_sizeof_pack_no_pack_name)
995 MarkAnyDeclReferenced(OpLoc, ParameterPack,
true);
1012 if (!ExpansionTSInfo)
1035 = cast<PackExpansionExpr>(Argument.
getAsExpr());
1058 llvm_unreachable(
"Invalid TemplateArgument Kind!");
1073 Pack = Subst->getArgumentPack();
1080 dyn_cast<SubstNonTypeTemplateParmPackExpr>(Arg.
getAsExpr()))
1081 Pack = Subst->getArgumentPack();
1082 else if (
auto *Subst = dyn_cast<FunctionParmPackExpr>(Arg.
getAsExpr())) {
1084 if (PD->isParameterPack())
1086 return Subst->getNumExpansions();
1094 Pack = Subst->getArgumentPack();
1112 if (Elem.isPackExpansion())
1115 return Pack.pack_size();
1124 if ((OCE && OCE->isInfixBinaryOp()) || isa<BinaryOperator>(E) ||
1125 isa<AbstractConditionalOperator>(E)) {
1142 auto DiscardOperands = [&] {
1143 CorrectDelayedTyposInExpr(LHS);
1144 CorrectDelayedTyposInExpr(RHS);
1155 return Diag(EllipsisLoc,
1157 ? diag::err_fold_expression_packs_both_sides
1158 : diag::err_pack_expansion_without_parameter_packs)
1166 Expr *Pack = LHS ? LHS : RHS;
1167 assert(Pack &&
"fold expression with neither LHS nor RHS");
1170 return Diag(EllipsisLoc, diag::err_pack_expansion_without_parameter_packs)
1175 return BuildCXXFoldExpr(LParenLoc, LHS, Opc, EllipsisLoc, RHS, RParenLoc);
1183 Operator, EllipsisLoc, RHS, RParenLoc);
1200 return ActOnCXXBoolLiteral(EllipsisLoc, tok::kw_false);
1202 return ActOnCXXBoolLiteral(EllipsisLoc, tok::kw_true);
1204 ScalarType = Context.
VoidTy;
1208 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.
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.
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
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...
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.
Represents a C++ nested-name-specifier or a global scope specifier.
enum clang::DeclaratorChunk::@196 Kind
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.
std::pair< unsigned, unsigned > getDepthAndIndex(NamedDecl *ND)
Retrieve the depth and index of a template parameter.
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
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.
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...
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...
bool isComputedNoexcept(ExceptionSpecificationType ESpecType)
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)
SourceLocation getLocStart() const LLVM_READONLY
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.
SourceLocation getLocEnd() const LLVM_READONLY
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 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.