23 using namespace clang;
28 Parser::ParseDeclarationStartingWithTemplate(
unsigned Context,
35 return ParseExplicitInstantiation(Context,
39 return ParseTemplateDeclarationOrSpecialization(Context, DeclEnd, AS,
61 Parser::ParseTemplateDeclarationOrSpecialization(
unsigned Context,
65 assert(Tok.
isOneOf(tok::kw_export, tok::kw_template) &&
66 "Token does not start a template declaration.");
97 bool isSpecialization =
true;
98 bool LastParamListWasEmpty =
false;
100 TemplateParameterDepthRAII CurTemplateDepthTracker(TemplateParameterDepth);
117 if (ParseTemplateParameters(CurTemplateDepthTracker.getDepth(),
118 TemplateParams, LAngleLoc, RAngleLoc)) {
125 ParamLists.push_back(
128 TemplateLoc, LAngleLoc,
129 TemplateParams.data(),
130 TemplateParams.size(), RAngleLoc));
132 if (!TemplateParams.empty()) {
133 isSpecialization =
false;
134 ++CurTemplateDepthTracker;
147 LastParamListWasEmpty =
true;
149 }
while (Tok.
isOneOf(tok::kw_export, tok::kw_template));
152 return ParseSingleDeclarationAfterTemplate(Context,
153 ParsedTemplateInfo(&ParamLists,
155 LastParamListWasEmpty),
156 ParsingTemplateParams,
157 DeclEnd, AS, AccessAttrs);
171 Parser::ParseSingleDeclarationAfterTemplate(
173 const ParsedTemplateInfo &TemplateInfo,
178 assert(TemplateInfo.Kind != ParsedTemplateInfo::NonTemplate &&
179 "Template information required");
181 if (Tok.
is(tok::kw_static_assert)) {
184 << TemplateInfo.getSourceRange();
186 return ParseStaticAssertDeclaration(DeclEnd);
191 ParseCXXClassMemberDeclaration(AS, AccessAttrs, TemplateInfo,
196 ParsedAttributesWithRange prefixAttrs(AttrFactory);
197 MaybeParseCXX11Attributes(prefixAttrs);
199 if (Tok.
is(tok::kw_using))
200 return ParseUsingDirectiveOrDeclaration(Context, TemplateInfo, DeclEnd,
207 ParseDeclarationSpecifiers(DS, TemplateInfo, AS,
208 getDeclSpecContextFromDeclaratorContext(Context));
210 if (Tok.
is(tok::semi)) {
211 ProhibitAttributes(prefixAttrs);
215 TemplateInfo.TemplateParams ? *TemplateInfo.TemplateParams
217 TemplateInfo.Kind == ParsedTemplateInfo::ExplicitInstantiation);
223 if (TemplateInfo.Kind == ParsedTemplateInfo::ExplicitInstantiation)
224 ProhibitAttributes(prefixAttrs);
226 DS.takeAttributesFrom(prefixAttrs);
230 ParseDeclarator(DeclaratorInfo);
232 if (!DeclaratorInfo.hasName()) {
235 if (Tok.
is(tok::semi))
240 LateParsedAttrList LateParsedAttrs(
true);
241 if (DeclaratorInfo.isFunctionDeclarator())
242 MaybeParseGNUAttributes(DeclaratorInfo, &LateParsedAttrs);
244 if (DeclaratorInfo.isFunctionDeclarator() &&
245 isStartOfFunctionDefinition(DeclaratorInfo)) {
251 Diag(Tok, diag::err_function_definition_not_allowed);
260 Diag(DS.getStorageClassSpecLoc(), diag::err_function_declared_typedef)
262 DS.ClearStorageClassSpecs();
265 if (TemplateInfo.Kind == ParsedTemplateInfo::ExplicitInstantiation) {
269 Diag(Tok, diag::err_template_defn_explicit_instantiation) << 0;
270 return ParseFunctionDefinition(DeclaratorInfo, ParsedTemplateInfo(),
275 Diag(DeclaratorInfo.getIdentifierLoc(),
276 diag::err_explicit_instantiation_with_definition)
283 0,
SourceLocation(), TemplateInfo.TemplateLoc, LAngleLoc,
nullptr,
286 return ParseFunctionDefinition(
287 DeclaratorInfo, ParsedTemplateInfo(&FakedParamLists,
293 return ParseFunctionDefinition(DeclaratorInfo, TemplateInfo,
298 Decl *ThisDecl = ParseDeclarationAfterDeclarator(DeclaratorInfo,
301 if (Tok.
is(tok::comma)) {
302 Diag(Tok, diag::err_multiple_template_declarators)
303 << (int)TemplateInfo.Kind;
309 ExpectAndConsumeSemi(diag::err_expected_semi_declaration);
310 if (LateParsedAttrs.size() > 0)
311 ParseLexedAttributeList(LateParsedAttrs, ThisDecl,
true,
false);
312 DeclaratorInfo.complete(ThisDecl);
325 bool Parser::ParseTemplateParameters(
unsigned Depth,
337 if (!Tok.
is(tok::greater) && !Tok.
is(tok::greatergreater))
338 Failed = ParseTemplateParameterList(Depth, TemplateParams);
340 if (Tok.
is(tok::greatergreater)) {
365 Parser::ParseTemplateParameterList(
unsigned Depth,
369 = ParseTemplateParameter(Depth, TemplateParams.size())) {
370 TemplateParams.push_back(TmpParam);
374 SkipUntil(tok::comma, tok::greater, tok::greatergreater,
379 if (Tok.
is(tok::comma)) {
381 }
else if (Tok.
isOneOf(tok::greater, tok::greatergreater)) {
389 SkipUntil(tok::comma, tok::greater, tok::greatergreater,
399 bool Parser::isStartOfTemplateTypeParameter() {
400 if (Tok.
is(tok::kw_class)) {
407 case tok::greatergreater:
411 case tok::identifier:
420 switch (GetLookAheadToken(2).
getKind()) {
424 case tok::greatergreater:
432 if (Tok.
isNot(tok::kw_typename))
444 if (Next.
getKind() == tok::identifier)
445 Next = GetLookAheadToken(2);
451 case tok::greatergreater:
475 Decl *Parser::ParseTemplateParameter(
unsigned Depth,
unsigned Position) {
476 if (isStartOfTemplateTypeParameter())
477 return ParseTypeParameter(Depth, Position);
479 if (Tok.
is(tok::kw_template))
480 return ParseTemplateTemplateParameter(Depth, Position);
485 return ParseNonTypeTemplateParameter(Depth, Position);
497 Decl *Parser::ParseTypeParameter(
unsigned Depth,
unsigned Position) {
498 assert(Tok.
isOneOf(tok::kw_class, tok::kw_typename) &&
499 "A type-parameter starts with 'class' or 'typename'");
502 bool TypenameKeyword = Tok.
is(tok::kw_typename);
510 ? diag::warn_cxx98_compat_variadic_templates
511 : diag::ext_variadic_templates);
517 if (Tok.
is(tok::identifier)) {
520 }
else if (Tok.
isOneOf(tok::equal, tok::comma, tok::greater,
521 tok::greatergreater)) {
530 bool AlreadyHasEllipsis = EllipsisLoc.
isValid();
532 DiagnoseMisplacedEllipsis(EllipsisLoc, NameLoc, AlreadyHasEllipsis,
true);
544 KeyLoc, ParamName, NameLoc, Depth, Position,
545 EqualLoc, DefaultArg);
560 Parser::ParseTemplateTemplateParameter(
unsigned Depth,
unsigned Position) {
561 assert(Tok.
is(tok::kw_template) &&
"Expected 'template' keyword");
569 if (ParseTemplateParameters(Depth + 1, TemplateParams, LAngleLoc,
581 bool Replace = Tok.
isOneOf(tok::kw_typename, tok::kw_struct);
583 if (Tok.
is(tok::kw_typename)) {
586 ? diag::warn_cxx14_compat_template_template_param_typename
587 : diag::ext_template_template_param_typename)
591 }
else if (Next.
isOneOf(tok::identifier, tok::comma, tok::greater,
592 tok::greatergreater, tok::ellipsis)) {
608 ? diag::warn_cxx98_compat_variadic_templates
609 : diag::ext_variadic_templates);
614 if (Tok.
is(tok::identifier)) {
617 }
else if (Tok.
isOneOf(tok::equal, tok::comma, tok::greater,
618 tok::greatergreater)) {
627 bool AlreadyHasEllipsis = EllipsisLoc.
isValid();
629 DiagnoseMisplacedEllipsis(EllipsisLoc, NameLoc, AlreadyHasEllipsis,
true);
633 TemplateLoc, LAngleLoc,
634 TemplateParams.data(),
635 TemplateParams.size(),
644 DefaultArg = ParseTemplateTemplateArgument();
647 diag::err_default_template_template_parameter_not_template);
648 SkipUntil(tok::comma, tok::greater, tok::greatergreater,
654 ParamList, EllipsisLoc,
655 ParamName, NameLoc, Depth,
656 Position, EqualLoc, DefaultArg);
666 Parser::ParseNonTypeTemplateParameter(
unsigned Depth,
unsigned Position) {
671 ParseDeclarationSpecifiers(DS);
675 ParseDeclarator(ParamDecl);
684 DiagnoseMisplacedEllipsisInDeclarator(EllipsisLoc, ParamDecl);
707 Depth, Position, EqualLoc,
711 void Parser::DiagnoseMisplacedEllipsis(
SourceLocation EllipsisLoc,
713 bool AlreadyHasEllipsis,
714 bool IdentifierHasName) {
716 if (!AlreadyHasEllipsis)
718 Diag(EllipsisLoc, diag::err_misplaced_ellipsis_in_declaration)
720 << !IdentifierHasName;
723 void Parser::DiagnoseMisplacedEllipsisInDeclarator(
SourceLocation EllipsisLoc,
727 if (!AlreadyHasEllipsis)
730 AlreadyHasEllipsis, D.
hasName());
748 bool Parser::ParseGreaterThanInTemplateList(
SourceLocation &RAngleLoc,
749 bool ConsumeLastToken,
750 bool ObjCGenericList) {
753 const char *ReplacementStr =
"> >";
764 if (ConsumeLastToken)
768 case tok::greatergreater:
769 RemainingToken = tok::greater;
772 case tok::greatergreatergreater:
773 RemainingToken = tok::greatergreater;
776 case tok::greaterequal:
777 RemainingToken = tok::equal;
778 ReplacementStr =
"> =";
781 case tok::greatergreaterequal:
782 RemainingToken = tok::greaterequal;
796 if (!ObjCGenericList) {
812 if ((RemainingToken == tok::greater ||
813 RemainingToken == tok::greatergreater) &&
814 (Next.
isOneOf(tok::greater, tok::greatergreater,
815 tok::greatergreatergreater, tok::equal,
816 tok::greaterequal, tok::greatergreaterequal,
818 areTokensAdjacent(Tok, Next))
821 unsigned DiagId = diag::err_two_right_angle_brackets_need_space;
823 (Tok.
is(tok::greatergreater) || Tok.
is(tok::greatergreatergreater)))
824 DiagId = diag::warn_cxx98_compat_two_right_angle_brackets;
825 else if (Tok.
is(tok::greaterequal))
826 DiagId = diag::err_right_angle_bracket_equal_needs_space;
831 if (RemainingToken == tok::equal && Next.
is(tok::equal) &&
832 areTokensAdjacent(Tok, Next)) {
847 if (!ConsumeLastToken) {
878 Parser::ParseTemplateIdAfterTemplateName(TemplateTy Template,
881 bool ConsumeLastToken,
883 TemplateArgList &TemplateArgs,
885 assert(Tok.
is(tok::less) &&
"Must have already parsed the template-name");
891 bool Invalid =
false;
894 if (Tok.
isNot(tok::greater) && Tok.
isNot(tok::greatergreater))
895 Invalid = ParseTemplateArgumentList(TemplateArgs);
899 if (ConsumeLastToken)
907 return ParseGreaterThanInTemplateList(RAngleLoc, ConsumeLastToken,
948 bool Parser::AnnotateTemplateIdToken(TemplateTy Template,
TemplateNameKind TNK,
952 bool AllowTypeAnnotation) {
954 assert(Template && Tok.
is(tok::less) &&
955 "Parser isn't at the beginning of a template-id");
962 TemplateArgList TemplateArgs;
963 bool Invalid = ParseTemplateIdAfterTemplateName(Template,
965 SS,
false, LAngleLoc,
982 Template, TemplateNameLoc,
983 LAngleLoc, TemplateArgsPtr, RAngleLoc);
991 Tok.
setKind(tok::annot_typename);
992 setTypeAnnotation(Tok, Type.
get());
995 else if (TemplateKWLoc.
isValid())
1002 Tok.
setKind(tok::annot_template_id);
1010 TemplateId->
Name =
nullptr;
1013 TemplateId->
SS = SS;
1016 TemplateId->
Kind = TNK;
1020 for (
unsigned Arg = 0, ArgEnd = TemplateArgs.size(); Arg != ArgEnd; ++Arg)
1044 void Parser::AnnotateTemplateIdTokenAsType() {
1045 assert(Tok.
is(tok::annot_template_id) &&
"Requires template-id tokens");
1050 "Only works for type and dependent templates");
1053 TemplateId->NumArgs);
1057 TemplateId->TemplateKWLoc,
1058 TemplateId->Template,
1059 TemplateId->TemplateNameLoc,
1060 TemplateId->LAngleLoc,
1062 TemplateId->RAngleLoc);
1064 Tok.
setKind(tok::annot_typename);
1065 setTypeAnnotation(Tok, Type.isInvalid() ?
ParsedType() : Type.get());
1066 if (TemplateId->SS.isNotEmpty())
1077 return Tok.
isOneOf(tok::comma, tok::greater, tok::greatergreater);
1082 if (!Tok.
is(tok::identifier) && !Tok.
is(tok::coloncolon) &&
1083 !Tok.
is(tok::annot_cxxscope))
1098 ParseOptionalCXXScopeSpecifier(SS,
ParsedType(),
1103 if (SS.
isSet() && Tok.
is(tok::kw_template)) {
1108 if (Tok.
is(tok::identifier)) {
1122 SS, TemplateKWLoc, Name,
1128 }
else if (Tok.
is(tok::identifier)) {
1138 bool MemberOfUnknownSpecialization;
1145 MemberOfUnknownSpecialization);
1174 if (isCXXTypeId(TypeIdAsTemplateArgument)) {
1182 TypeArg.
get().getAsOpaquePtr(),
1188 TentativeParsingAction TPA(*
this);
1191 = ParseTemplateTemplateArgument();
1192 if (!TemplateTemplateArgument.
isInvalid()) {
1194 return TemplateTemplateArgument;
1208 ExprArg.
get(), Loc);
1214 bool Parser::IsTemplateArgumentList(
unsigned Skip) {
1215 struct AlwaysRevertAction : TentativeParsingAction {
1216 AlwaysRevertAction(
Parser &
P) : TentativeParsingAction(P) { }
1217 ~AlwaysRevertAction() { Revert(); }
1230 if (Tok.
is(tok::greater))
1238 return Tok.
isOneOf(tok::greater, tok::comma);
1248 Parser::ParseTemplateArgumentList(TemplateArgList &TemplateArgs) {
1265 TemplateArgs.push_back(Arg);
1281 Decl *Parser::ParseExplicitInstantiation(
unsigned Context,
1290 return ParseSingleDeclarationAfterTemplate(Context,
1291 ParsedTemplateInfo(ExternLoc,
1293 ParsingTemplateParams,
1297 SourceRange Parser::ParsedTemplateInfo::getSourceRange()
const {
1300 TemplateParams->size());
1304 R.setBegin(ExternLoc);
1309 ((
Parser *)P)->ParseLateTemplatedFuncDef(LPT);
1320 TemplateParameterDepthRAII CurTemplateDepthTracker(TemplateParameterDepth);
1332 DeclContextsToReenter.push_back(DD);
1338 DeclContextsToReenter.rbegin();
1339 for (; II != DeclContextsToReenter.rend(); ++II) {
1340 TemplateParamScopeStack.push_back(
new ParseScope(
this,
1342 unsigned NumParamLists =
1344 CurTemplateDepthTracker.addDepth(NumParamLists);
1351 assert(!LPT.
Toks.empty() &&
"Empty body!");
1355 LPT.
Toks.push_back(Tok);
1359 ConsumeAnyToken(
true);
1360 assert(Tok.
isOneOf(tok::l_brace, tok::colon, tok::kw_try) &&
1361 "Inline method not starting with '{', ':' or 'try'");
1373 if (Tok.
is(tok::kw_try)) {
1374 ParseFunctionTryBlock(LPT.
D, FnScope);
1376 if (Tok.
is(tok::colon))
1377 ParseConstructorInitializer(LPT.
D);
1381 if (Tok.
is(tok::l_brace)) {
1382 assert((!isa<FunctionTemplateDecl>(LPT.
D) ||
1383 cast<FunctionTemplateDecl>(LPT.
D)
1384 ->getTemplateParameters()
1385 ->getDepth() == TemplateParameterDepth - 1) &&
1386 "TemplateParameterDepth should be greater than the depth of "
1387 "current template being instantiated!");
1388 ParseFunctionStatementBody(LPT.
D, FnScope);
1397 TemplateParamScopeStack.rbegin();
1398 for (; I != TemplateParamScopeStack.rend(); ++I)
1403 void Parser::LexTemplateFunctionForLateParsing(
CachedTokens &Toks) {
1405 if (!ConsumeAndStoreFunctionPrologue(Toks)) {
1407 ConsumeAndStoreUntil(tok::r_brace, Toks,
false);
1411 if (kind == tok::kw_try) {
1412 while (Tok.
is(tok::kw_catch)) {
1413 ConsumeAndStoreUntil(tok::l_brace, Toks,
false);
1414 ConsumeAndStoreUntil(tok::r_brace, Toks,
false);
SourceManager & getSourceManager() const
Defines the clang::ASTContext interface.
IdKind getKind() const
Determine what kind of name we have.
Scope * getCurScope() const
Retrieve the parser's current scope.
SourceRange getSourceRange() const LLVM_READONLY
Return the source range that covers this unqualified-id.
SourceLocation StartLocation
The location of the first token that describes this unqualified-id, which will be the location of the...
IdentifierInfo * Name
FIXME: Temporarily stores the name of a specialization.
const LangOptions & getLangOpts() const
SourceLocation TemplateNameLoc
IdentifierInfo * Identifier
When Kind == IK_Identifier, the parsed identifier, or when Kind == IK_UserLiteralId, the identifier suffix.
RAII object used to inform the actions that we're currently parsing a declaration. This is active when parsing a variable's initializer, but not when parsing the body of a class or function definition.
Defines the C++ template declaration subclasses.
This indicates that the scope corresponds to a function, which means that labels are set here...
AccessSpecifier
A C++ access specifier (public, private, protected), plus the special value "none" which means differ...
TemplateNameKind Kind
The kind of template that Template refers to.
void ActOnDefaultCtorInitializers(Decl *CDtorDecl)
RAII object that enters a new expression evaluation context.
void EnterToken(const Token &Tok)
Enters a token in the token stream to be lexed next.
Information about one declarator, including the parsed type information and the identifier.
Stores a list of template parameters for a TemplateDecl and its derived classes.
TemplateParameterList * ActOnTemplateParameterList(unsigned Depth, SourceLocation ExportLoc, SourceLocation TemplateLoc, SourceLocation LAngleLoc, Decl **Params, unsigned NumParams, SourceLocation RAngleLoc)
friend class ObjCDeclContextSwitch
bool SkipUntil(tok::TokenKind T, SkipUntilFlags Flags=static_cast< SkipUntilFlags >(0))
Information about a template-id annotation token.
const Token & NextToken()
SourceLocation getLocForEndOfToken(SourceLocation Loc, unsigned Offset=0)
Computes the source location just past the end of the token at this source location.
bool TryConsumeToken(tok::TokenKind Expected)
OpaquePtr< QualType > ParsedType
Decl * ActOnNonTypeTemplateParameter(Scope *S, Declarator &D, unsigned Depth, unsigned Position, SourceLocation EqualLoc, Expr *DefaultArg)
OverloadedOperatorKind Operator
The kind of overloaded operator.
TypeResult ActOnTemplateIdType(CXXScopeSpec &SS, SourceLocation TemplateKWLoc, TemplateTy Template, SourceLocation TemplateLoc, SourceLocation LAngleLoc, ASTTemplateArgsPtr TemplateArgs, SourceLocation RAngleLoc, bool IsCtorOrDtorName=false)
struct OFI OperatorFunctionId
When Kind == IK_OperatorFunctionId, the overloaded operator that we parsed.
bool isTranslationUnit() const
A non-type template parameter, stored as an expression.
void setKind(tok::TokenKind K)
Represents a C++ unqualified-id that has been parsed.
SourceLocation getLocWithOffset(int Offset) const
Return a source location with the specified offset from this SourceLocation.
ParsedTemplateArgument * getTemplateArgs()
Retrieves a pointer to the template arguments.
Represents a C++ nested-name-specifier or a global scope specifier.
tok::TokenKind getKind() const
Decl * ActOnFinishFunctionBody(Decl *Decl, Stmt *Body)
static SourceLocation AdvanceToTokenCharacter(SourceLocation TokStart, unsigned Character, const SourceManager &SM, const LangOptions &LangOpts)
Decl * ActOnTypeParameter(Scope *S, bool Typename, SourceLocation EllipsisLoc, SourceLocation KeyLoc, IdentifierInfo *ParamName, SourceLocation ParamNameLoc, unsigned Depth, unsigned Position, SourceLocation EqualLoc, ParsedType DefaultArg)
SourceLocation TemplateKWLoc
Decl * ActOnStartOfFunctionDef(Scope *S, Declarator &D)
A class for parsing a declarator.
TypeResult ParseTypeName(SourceRange *Range=nullptr, Declarator::TheContext Context=Declarator::TypeNameContext, AccessSpecifier AS=AS_none, Decl **OwnedType=nullptr, ParsedAttributes *Attrs=nullptr)
DeclContext * getLexicalParent()
void setAnnotationValue(void *val)
Represents a character-granular source range.
void AnnotateCachedTokens(const Token &Tok)
This file defines the classes used to store parsed information about declaration-specifiers and decla...
TranslationUnitDecl * getTranslationUnitDecl() const
OpaquePtr< TemplateName > TemplateTy
static bool isEndOfTemplateArgument(Token Tok)
Determine whether the given token can end a template argument.
Represents a C++ template name within the type system.
SourceLocation getLocation() const
Return a source location identifier for the specified offset in the current file. ...
TemplateNameKind
Specifies the kind of template name that an identifier refers to. Be careful when changing this: this...
bool isNot(tok::TokenKind K) const
void setEllipsisLoc(SourceLocation EL)
DeclContext * getContainingDC(DeclContext *DC)
TemplateNameKind isTemplateName(Scope *S, CXXScopeSpec &SS, bool hasTemplateKeyword, UnqualifiedId &Name, ParsedType ObjectType, bool EnteringContext, TemplateTy &Template, bool &MemberOfUnknownSpecialization)
The result type of a method or function.
ParsedTemplateArgument ActOnPackExpansion(const ParsedTemplateArgument &Arg, SourceLocation EllipsisLoc)
Invoked when parsing a template argument followed by an ellipsis, which creates a pack expansion...
RAII object that makes '>' behave either as an operator or as the closing angle bracket for a temp...
static CharSourceRange getCharRange(SourceRange R)
A class for parsing a DeclSpec.
Represents the parsed form of a C++ template argument.
FunctionDecl * getAsFunction() LLVM_READONLY
Returns the function itself, or the templated function if this is a function template.
Encodes a location in the source. The SourceManager can decode this to get at the full include stack...
void setLength(unsigned Len)
bool isValid() const
Return true if this is a valid SourceLocation object.
void setAnnotationEndLoc(SourceLocation L)
Scope * getCurScope() const
void EnterTokenStream(const Token *Toks, unsigned NumToks, bool DisableMacroExpansion, bool OwnsTokens)
Add a "macro" context to the top of the include stack, which will cause the lexer to start returning ...
TokenKind
Provides a simple uniform namespace for tokens from all C languages.
SourceLocation getBegin() const
SourceLocation getBeginLoc() const
bool is(tok::TokenKind K) const
A template type parameter, stored as a type.
void UnmarkAsLateParsedTemplate(FunctionDecl *FD)
Decl * ActOnTemplateTemplateParameter(Scope *S, SourceLocation TmpLoc, TemplateParameterList *Params, SourceLocation EllipsisLoc, IdentifierInfo *ParamName, SourceLocation ParamNameLoc, unsigned Depth, unsigned Position, SourceLocation EqualLoc, ParsedTemplateArgument DefaultArg)
CXXScopeSpec SS
The nested-name-specifier that precedes the template name.
static FixItHint CreateRemoval(CharSourceRange RemoveRange)
Create a code modification hint that removes the given source range.
This is a scope that corresponds to the template parameters of a C++ template. Template parameter sco...
ExprResult ParseConstraintExpression()
Parse a constraint-expression.
void PushDeclContext(Scope *S, DeclContext *DC)
Set the current declaration context until it gets popped.
static const TST TST_unspecified
Not an overloaded operator.
bool isNotEmpty() const
A scope specifier is present, but may be valid or invalid.
bool isOneOf(tok::TokenKind K1, tok::TokenKind K2) const
DiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID)
OverloadedOperatorKind Operator
FIXME: Temporarily stores the overloaded operator kind.
bool isInvalid() const
Determine whether the given template argument is invalid.
SourceRange getTemplateParamsRange(TemplateParameterList const *const *Params, unsigned NumParams)
Retrieves the range of the given template parameter lists.
ExprResult ParseAssignmentExpression(TypeCastState isTypeCast=NotTypeCast)
Parse an expr that doesn't include (top-level) commas.
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.
A template-id, e.g., f<int>.
SmallVector< TemplateParameterList *, 4 > TemplateParameterLists
This is a scope that can contain a declaration. Some scopes just contain loop constructs but don't co...
Decl * ParsedFreeStandingDeclSpec(Scope *S, AccessSpecifier AS, DeclSpec &DS)
ExprResult ParseConstantExpression(TypeCastState isTypeCast=NotTypeCast)
TemplateNameKind ActOnDependentTemplateName(Scope *S, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, UnqualifiedId &Name, ParsedType ObjectType, bool EnteringContext, TemplateTy &Template)
Form a dependent template name.
Captures information about "declaration specifiers".
SourceLocation getIdentifierLoc() const
SourceLocation ConsumeToken()
static TemplateIdAnnotation * Allocate(unsigned NumArgs, SmallVectorImpl< TemplateIdAnnotation * > &List)
Creates a new TemplateIdAnnotation with NumArgs arguments and appends it to List. ...
Decl * D
The template function declaration to be late parsed.
The current context is "potentially evaluated" in C++11 terms, but the expression is evaluated at com...
ExprResult CorrectDelayedTyposInExpr(Expr *E, VarDecl *InitDecl=nullptr, llvm::function_ref< ExprResult(Expr *)> Filter=[](Expr *E) -> ExprResult{return E;})
Process any TypoExprs in the given Expr and its children, generating diagnostics as appropriate and r...
unsigned kind
All of the diagnostics that can be emitted by the frontend.
static FixItHint CreateReplacement(CharSourceRange RemoveRange, StringRef Code)
Create a code modification hint that replaces the given source range with the given code string...
unsigned getLength() const
The current expression and its subexpressions occur within an unevaluated operand (C++11 [expr]p7)...
Contains a late templated function. Will be parsed at the end of the translation unit, used by Sema & Parser.
Annotates a diagnostic with some code that should be inserted, removed, or replaced to fix the proble...
void setLocation(SourceLocation L)
A trivial tuple used to represent a source range.
void setIdentifier(const IdentifierInfo *Id, SourceLocation IdLoc)
Specify that this unqualified-id was parsed as an identifier.
ParsedTemplateTy Template
Stop skipping at specified token, but don't skip the token itself.
SourceLocation getEllipsisLoc() const
unsigned ActOnReenterTemplateScope(Scope *S, Decl *Template)
IdentifierInfo * getIdentifierInfo() const