22 using namespace clang;
30 class CollectUnexpandedParameterPacksVisitor :
38 bool InLambda =
false;
39 unsigned DepthLimit = (unsigned)-1;
42 if (
auto *VD = dyn_cast<VarDecl>(ND)) {
48 if (FTD && FTD->getTemplateParameters()->getDepth() >= DepthLimit)
53 Unexpanded.push_back({ND, Loc});
58 Unexpanded.push_back({T, Loc});
62 explicit CollectUnexpandedParameterPacksVisitor(
64 : Unexpanded(Unexpanded) {}
66 bool shouldWalkTypesOfTypeLocs()
const {
return false; }
102 if (
auto *TTP = dyn_cast_or_null<TemplateTemplateParmDecl>(
104 if (TTP->isParameterPack())
108 return inherited::TraverseTemplateName(Template);
122 TraverseStmt(Element.
Key);
123 TraverseStmt(Element.
Value);
133 bool TraverseStmt(
Stmt *S) {
134 Expr *E = dyn_cast_or_null<Expr>(S);
136 return inherited::TraverseStmt(S);
145 return inherited::TraverseType(T);
152 bool TraverseTypeLoc(
TypeLoc TL) {
156 return inherited::TraverseTypeLoc(TL);
162 bool TraverseDecl(
Decl *D) {
169 return inherited::TraverseDecl(D);
173 bool TraverseAttr(
Attr *A) {
177 return inherited::TraverseAttr(A);
185 bool TraverseCXXFoldExpr(
CXXFoldExpr *E) {
return true; }
194 return inherited::TraverseUnresolvedUsingValueDecl(D);
202 return inherited::TraverseUnresolvedUsingTypenameDecl(D);
210 return inherited::TraverseTemplateArgument(Arg);
218 return inherited::TraverseTemplateArgumentLoc(ArgLoc);
226 return inherited::TraverseCXXBaseSpecifier(Base);
234 return inherited::TraverseConstructorInitializer(Init);
248 bool WasInLambda = InLambda;
249 unsigned OldDepthLimit = DepthLimit;
253 DepthLimit = TPL->getDepth();
255 inherited::TraverseLambdaExpr(Lambda);
257 InLambda = WasInLambda;
258 DepthLimit = OldDepthLimit;
268 return inherited::TraverseLambdaCapture(Lambda, C, Init);
281 for (
auto *SI : FunctionScopes)
282 if (isa<sema::LambdaScopeInfo>(SI))
293 if (Unexpanded.empty())
302 if (
auto *LSI = getEnclosingLambda()) {
303 for (
auto &Pack : Unexpanded) {
304 auto DeclaresThisPack = [&](
NamedDecl *LocalPack) {
311 if (std::find_if(LSI->LocalPacks.begin(), LSI->LocalPacks.end(),
312 DeclaresThisPack) != LSI->LocalPacks.end())
313 LambdaParamPackReferences.push_back(Pack);
316 if (LambdaParamPackReferences.empty()) {
328 bool EnclosingStmtExpr =
false;
329 for (
unsigned N = FunctionScopes.size(); N; --N) {
334 EnclosingStmtExpr =
true;
343 if (!EnclosingStmtExpr) {
344 LSI->ContainsUnexpandedParameterPack =
true;
348 Unexpanded = LambdaParamPackReferences;
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);
612 Diag(EllipsisLoc, diag::err_pack_expansion_without_parameter_packs)
621 return CheckPackExpansion(Pattern, EllipsisLoc,
None);
634 Diag(EllipsisLoc, diag::err_pack_expansion_without_parameter_packs)
636 CorrectDelayedTyposInExpr(Pattern);
651 RetainExpansion =
false;
652 std::pair<IdentifierInfo *, SourceLocation> FirstPack;
653 bool HaveFirstPack =
false;
658 end = Unexpanded.end();
661 unsigned Depth = 0, Index = 0;
663 bool IsVarDeclPack =
false;
667 Depth = TTP->getDepth();
668 Index = TTP->getIndex();
669 Name = TTP->getIdentifier();
672 if (isa<VarDecl>(ND))
673 IsVarDeclPack =
true;
681 unsigned NewPackSize;
686 llvm::PointerUnion<Decl *, DeclArgumentPack *> *Instantiation
687 = CurrentInstantiationScope->findInstantiationOf(
689 if (Instantiation->is<DeclArgumentPack *>()) {
691 NewPackSize = Instantiation->get<DeclArgumentPack *>()->size();
695 ShouldExpand =
false;
704 ShouldExpand =
false;
709 NewPackSize = TemplateArgs(Depth, Index).pack_size();
716 if (!IsVarDeclPack && CurrentInstantiationScope) {
718 = CurrentInstantiationScope->getPartiallySubstitutedPack()){
719 unsigned PartialDepth, PartialIndex;
721 if (PartialDepth == Depth && PartialIndex == Index) {
722 RetainExpansion =
true;
724 NumPartialExpansions = NewPackSize;
725 PartiallySubstitutedPackLoc = i->second;
731 if (!NumExpansions) {
734 NumExpansions = NewPackSize;
735 FirstPack.first = Name;
736 FirstPack.second = i->second;
737 HaveFirstPack =
true;
741 if (NewPackSize != *NumExpansions) {
746 Diag(EllipsisLoc, diag::err_pack_expansion_length_conflict)
747 << FirstPack.first << Name << *NumExpansions << NewPackSize
750 Diag(EllipsisLoc, diag::err_pack_expansion_length_conflict_multilevel)
751 << Name << *NumExpansions << NewPackSize
752 << SourceRange(i->second);
766 if (NumPartialExpansions) {
767 if (NumExpansions && *NumExpansions < *NumPartialExpansions) {
769 CurrentInstantiationScope->getPartiallySubstitutedPack();
770 Diag(EllipsisLoc, diag::err_pack_expansion_length_conflict_partial)
771 << PartialPack << *NumPartialExpansions << *NumExpansions
776 NumExpansions = NumPartialExpansions;
784 QualType Pattern = cast<PackExpansionType>(T)->getPattern();
786 CollectUnexpandedParameterPacksVisitor(Unexpanded).TraverseType(Pattern);
789 for (
unsigned I = 0, N = Unexpanded.size(); I != N; ++I) {
796 Depth = TTP->getDepth();
797 Index = TTP->getIndex();
800 if (isa<VarDecl>(ND)) {
804 llvm::PointerUnion<Decl *, DeclArgumentPack *> *Instantiation
805 = CurrentInstantiationScope->findInstantiationOf(
807 if (Instantiation->is<
Decl*>())
812 unsigned Size = Instantiation->get<DeclArgumentPack *>()->size();
813 assert((!Result || *Result == Size) &&
"inconsistent pack sizes");
827 unsigned Size = TemplateArgs(Depth, Index).pack_size();
828 assert((!Result || *Result == Size) &&
"inconsistent pack sizes");
883 #define GENERIC_IMAGE_TYPE(ImgType, Id) case TST_##ImgType##_t: 884 #include "clang/Basic/OpenCLImageTypes.def" 892 switch (Chunk.
Kind) {
907 for (
unsigned i = 0, e = Chunk.
Fun.
NumParams; i != e; ++i) {
910 assert(!ParamTy.isNull() &&
"Couldn't parse type?");
911 if (ParamTy->containsUnexpandedParameterPack())
return true;
941 if (TRC->containsUnexpandedParameterPack())
952 bool ValidateCandidate(
const TypoCorrection &candidate)
override {
957 std::unique_ptr<CorrectionCandidateCallback> clone()
override {
958 return std::make_unique<ParameterPackValidatorCCC>(*this);
985 LookupResult R(*
this, &Name, NameLoc, LookupOrdinaryName);
996 ParameterPackValidatorCCC CCC{};
999 CCC, CTK_ErrorRecovery)) {
1000 diagnoseTypo(Corrected,
1001 PDiag(diag::err_sizeof_pack_no_pack_name_suggest) << &Name,
1002 PDiag(diag::note_parameter_pack_here));
1003 ParameterPack = Corrected.getCorrectionDecl();
1012 DiagnoseAmbiguousLookup(R);
1017 Diag(NameLoc, diag::err_sizeof_pack_no_pack_name)
1022 MarkAnyDeclReferenced(OpLoc, ParameterPack,
true);
1039 if (!ExpansionTSInfo)
1062 = cast<PackExpansionExpr>(Argument.
getAsExpr());
1085 llvm_unreachable(
"Invalid TemplateArgument Kind!");
1100 Pack = Subst->getArgumentPack();
1107 dyn_cast<SubstNonTypeTemplateParmPackExpr>(Arg.
getAsExpr()))
1108 Pack = Subst->getArgumentPack();
1109 else if (
auto *Subst = dyn_cast<FunctionParmPackExpr>(Arg.
getAsExpr())) {
1111 if (PD->isParameterPack())
1113 return Subst->getNumExpansions();
1121 Pack = Subst->getArgumentPack();
1139 if (Elem.isPackExpansion())
1142 return Pack.pack_size();
1151 if ((OCE && OCE->isInfixBinaryOp()) || isa<BinaryOperator>(E) ||
1152 isa<AbstractConditionalOperator>(E)) {
1169 auto DiscardOperands = [&] {
1170 CorrectDelayedTyposInExpr(LHS);
1171 CorrectDelayedTyposInExpr(RHS);
1182 return Diag(EllipsisLoc,
1184 ? diag::err_fold_expression_packs_both_sides
1185 : diag::err_pack_expansion_without_parameter_packs)
1193 Expr *Pack = LHS ? LHS : RHS;
1194 assert(Pack &&
"fold expression with neither LHS nor RHS");
1197 return Diag(EllipsisLoc, diag::err_pack_expansion_without_parameter_packs)
1202 return BuildCXXFoldExpr(LParenLoc, LHS, Opc, EllipsisLoc, RHS, RParenLoc,
1212 Operator, EllipsisLoc, RHS, RParenLoc,
1230 return ActOnCXXBoolLiteral(EllipsisLoc, tok::kw_false);
1232 return ActOnCXXBoolLiteral(EllipsisLoc, tok::kw_true);
1234 ScalarType = Context.
VoidTy;
1238 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
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...
const Type * getTypeForDecl() const
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.
Represents a variable declaration or definition.
Information about one declarator, including the parsed type information and the identifier.
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 * NoexceptExpr
Pointer to the expression in the noexcept-specifier of this function, if it has one.
ExprResult BuildCXXFoldExpr(SourceLocation LParenLoc, Expr *LHS, BinaryOperatorKind Operator, SourceLocation EllipsisLoc, Expr *RHS, SourceLocation RParenLoc, Optional< unsigned > NumExpansions)
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.
SourceLocation getBeginLoc() const LLVM_READONLY
NameKind getNameKind() const
Determine what kind of name this is.
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...
__SIZE_TYPE__ size_t
The unsigned integer type of the result of the sizeof operator.
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.
bool declaresSameEntity(const Decl *D1, const Decl *D2)
Determine whether two declarations declare the same entity.
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...
Expr * IgnoreImpCasts() LLVM_READONLY
Skip past any implicit casts which might surround this expression until reaching a fixed point...
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.
QualType getCXXNameType() const
If this name is one of the C++ names (of a constructor, destructor, or conversion function)...
This represents one expression.
bool containsUnexpandedParameterPacks(Declarator &D)
Determine whether the given declarator contains any unexpanded parameter packs.
bool isPackExpansion() const
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.
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)
SourceLocation getEndLoc() const LLVM_READONLY
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.
enum clang::DeclaratorChunk::@219 Kind
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.
DeducedType * getContainedDeducedType() const
Get the DeducedType whose type will be deduced for a variable with an initializer of this type...
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.
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
Expr * getTrailingRequiresClause()
Sets a trailing requires clause for this declarator.
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
__DEVICE__ int min(int __a, int __b)
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
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.