22 using namespace clang;
27 Parser::ParseDeclarationStartingWithTemplate(
unsigned Context,
34 return ParseExplicitInstantiation(Context,
38 return ParseTemplateDeclarationOrSpecialization(Context, DeclEnd, AS,
60 Parser::ParseTemplateDeclarationOrSpecialization(
unsigned Context,
64 assert(Tok.
isOneOf(tok::kw_export, tok::kw_template) &&
65 "Token does not start a template declaration.");
96 bool isSpecialization =
true;
97 bool LastParamListWasEmpty =
false;
99 TemplateParameterDepthRAII CurTemplateDepthTracker(TemplateParameterDepth);
116 if (ParseTemplateParameters(CurTemplateDepthTracker.getDepth(),
117 TemplateParams, LAngleLoc, RAngleLoc)) {
124 ExprResult OptionalRequiresClauseConstraintER;
125 if (!TemplateParams.empty()) {
126 isSpecialization =
false;
127 ++CurTemplateDepthTracker;
130 OptionalRequiresClauseConstraintER =
132 if (!OptionalRequiresClauseConstraintER.
isUsable()) {
140 LastParamListWasEmpty =
true;
144 CurTemplateDepthTracker.getDepth(), ExportLoc, TemplateLoc, LAngleLoc,
145 TemplateParams, RAngleLoc, OptionalRequiresClauseConstraintER.
get()));
146 }
while (Tok.
isOneOf(tok::kw_export, tok::kw_template));
149 ParseScopeFlags TemplateScopeFlags(
this, NewFlags, isSpecialization);
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)) {
201 ParseUsingDirectiveOrDeclaration(Context, TemplateInfo, DeclEnd,
210 ParseDeclarationSpecifiers(DS, TemplateInfo, AS,
211 getDeclSpecContextFromDeclaratorContext(Context));
213 if (Tok.
is(tok::semi)) {
214 ProhibitAttributes(prefixAttrs);
219 TemplateInfo.TemplateParams ? *TemplateInfo.TemplateParams
221 TemplateInfo.Kind == ParsedTemplateInfo::ExplicitInstantiation,
223 assert(!AnonRecord &&
224 "Anonymous unions/structs should not be valid with template");
230 if (TemplateInfo.Kind == ParsedTemplateInfo::ExplicitInstantiation)
231 ProhibitAttributes(prefixAttrs);
233 DS.takeAttributesFrom(prefixAttrs);
237 ParseDeclarator(DeclaratorInfo);
239 if (!DeclaratorInfo.hasName()) {
242 if (Tok.
is(tok::semi))
247 LateParsedAttrList LateParsedAttrs(
true);
248 if (DeclaratorInfo.isFunctionDeclarator())
249 MaybeParseGNUAttributes(DeclaratorInfo, &LateParsedAttrs);
251 if (DeclaratorInfo.isFunctionDeclarator() &&
252 isStartOfFunctionDefinition(DeclaratorInfo)) {
258 Diag(Tok, diag::err_function_definition_not_allowed);
267 Diag(DS.getStorageClassSpecLoc(), diag::err_function_declared_typedef)
269 DS.ClearStorageClassSpecs();
272 if (TemplateInfo.Kind == ParsedTemplateInfo::ExplicitInstantiation) {
276 Diag(Tok, diag::err_template_defn_explicit_instantiation) << 0;
277 return ParseFunctionDefinition(DeclaratorInfo, ParsedTemplateInfo(),
282 Diag(DeclaratorInfo.getIdentifierLoc(),
283 diag::err_explicit_instantiation_with_definition)
291 LAngleLoc,
nullptr));
293 return ParseFunctionDefinition(
294 DeclaratorInfo, ParsedTemplateInfo(&FakedParamLists,
300 return ParseFunctionDefinition(DeclaratorInfo, TemplateInfo,
305 Decl *ThisDecl = ParseDeclarationAfterDeclarator(DeclaratorInfo,
308 if (Tok.
is(tok::comma)) {
309 Diag(Tok, diag::err_multiple_template_declarators)
310 << (int)TemplateInfo.Kind;
316 ExpectAndConsumeSemi(diag::err_expected_semi_declaration);
317 if (LateParsedAttrs.size() > 0)
318 ParseLexedAttributeList(LateParsedAttrs, ThisDecl,
true,
false);
319 DeclaratorInfo.complete(ThisDecl);
332 bool Parser::ParseTemplateParameters(
unsigned Depth,
344 if (!Tok.
is(tok::greater) && !Tok.
is(tok::greatergreater))
345 Failed = ParseTemplateParameterList(Depth, TemplateParams);
347 if (Tok.
is(tok::greatergreater)) {
372 Parser::ParseTemplateParameterList(
unsigned Depth,
376 = ParseTemplateParameter(Depth, TemplateParams.size())) {
377 TemplateParams.push_back(TmpParam);
381 SkipUntil(tok::comma, tok::greater, tok::greatergreater,
386 if (Tok.
is(tok::comma)) {
388 }
else if (Tok.
isOneOf(tok::greater, tok::greatergreater)) {
396 SkipUntil(tok::comma, tok::greater, tok::greatergreater,
406 bool Parser::isStartOfTemplateTypeParameter() {
407 if (Tok.
is(tok::kw_class)) {
414 case tok::greatergreater:
418 case tok::identifier:
427 switch (GetLookAheadToken(2).
getKind()) {
431 case tok::greatergreater:
439 if (Tok.
isNot(tok::kw_typename))
451 if (Next.
getKind() == tok::identifier)
452 Next = GetLookAheadToken(2);
458 case tok::greatergreater:
482 Decl *Parser::ParseTemplateParameter(
unsigned Depth,
unsigned Position) {
483 if (isStartOfTemplateTypeParameter())
484 return ParseTypeParameter(Depth, Position);
486 if (Tok.
is(tok::kw_template))
487 return ParseTemplateTemplateParameter(Depth, Position);
492 return ParseNonTypeTemplateParameter(Depth, Position);
504 Decl *Parser::ParseTypeParameter(
unsigned Depth,
unsigned Position) {
505 assert(Tok.
isOneOf(tok::kw_class, tok::kw_typename) &&
506 "A type-parameter starts with 'class' or 'typename'");
509 bool TypenameKeyword = Tok.
is(tok::kw_typename);
517 ? diag::warn_cxx98_compat_variadic_templates
518 : diag::ext_variadic_templates);
524 if (Tok.
is(tok::identifier)) {
527 }
else if (Tok.
isOneOf(tok::equal, tok::comma, tok::greater,
528 tok::greatergreater)) {
537 bool AlreadyHasEllipsis = EllipsisLoc.
isValid();
539 DiagnoseMisplacedEllipsis(EllipsisLoc, NameLoc, AlreadyHasEllipsis,
true);
551 KeyLoc, ParamName, NameLoc, Depth, Position,
552 EqualLoc, DefaultArg);
567 Parser::ParseTemplateTemplateParameter(
unsigned Depth,
unsigned Position) {
568 assert(Tok.
is(tok::kw_template) &&
"Expected 'template' keyword");
576 if (ParseTemplateParameters(Depth + 1, TemplateParams, LAngleLoc,
588 bool Replace = Tok.
isOneOf(tok::kw_typename, tok::kw_struct);
590 if (Tok.
is(tok::kw_typename)) {
593 ? diag::warn_cxx14_compat_template_template_param_typename
594 : diag::ext_template_template_param_typename)
598 }
else if (Next.
isOneOf(tok::identifier, tok::comma, tok::greater,
599 tok::greatergreater, tok::ellipsis)) {
615 ? diag::warn_cxx98_compat_variadic_templates
616 : diag::ext_variadic_templates);
621 if (Tok.
is(tok::identifier)) {
624 }
else if (Tok.
isOneOf(tok::equal, tok::comma, tok::greater,
625 tok::greatergreater)) {
634 bool AlreadyHasEllipsis = EllipsisLoc.
isValid();
636 DiagnoseMisplacedEllipsis(EllipsisLoc, NameLoc, AlreadyHasEllipsis,
true);
640 TemplateLoc, LAngleLoc,
650 DefaultArg = ParseTemplateTemplateArgument();
653 diag::err_default_template_template_parameter_not_template);
654 SkipUntil(tok::comma, tok::greater, tok::greatergreater,
660 ParamList, EllipsisLoc,
661 ParamName, NameLoc, Depth,
662 Position, EqualLoc, DefaultArg);
672 Parser::ParseNonTypeTemplateParameter(
unsigned Depth,
unsigned Position) {
677 ParseDeclarationSpecifiers(DS, ParsedTemplateInfo(),
AS_none,
682 ParseDeclarator(ParamDecl);
691 DiagnoseMisplacedEllipsisInDeclarator(EllipsisLoc, ParamDecl);
715 Depth, Position, EqualLoc,
719 void Parser::DiagnoseMisplacedEllipsis(
SourceLocation EllipsisLoc,
721 bool AlreadyHasEllipsis,
722 bool IdentifierHasName) {
724 if (!AlreadyHasEllipsis)
726 Diag(EllipsisLoc, diag::err_misplaced_ellipsis_in_declaration)
728 << !IdentifierHasName;
731 void Parser::DiagnoseMisplacedEllipsisInDeclarator(
SourceLocation EllipsisLoc,
735 if (!AlreadyHasEllipsis)
738 AlreadyHasEllipsis, D.
hasName());
756 bool Parser::ParseGreaterThanInTemplateList(
SourceLocation &RAngleLoc,
757 bool ConsumeLastToken,
758 bool ObjCGenericList) {
761 const char *ReplacementStr =
"> >";
772 if (ConsumeLastToken)
776 case tok::greatergreater:
777 RemainingToken = tok::greater;
780 case tok::greatergreatergreater:
781 RemainingToken = tok::greatergreater;
784 case tok::greaterequal:
785 RemainingToken = tok::equal;
786 ReplacementStr =
"> =";
789 case tok::greatergreaterequal:
790 RemainingToken = tok::greaterequal;
804 if (!ObjCGenericList) {
820 if ((RemainingToken == tok::greater ||
821 RemainingToken == tok::greatergreater) &&
822 (Next.
isOneOf(tok::greater, tok::greatergreater,
823 tok::greatergreatergreater, tok::equal,
824 tok::greaterequal, tok::greatergreaterequal,
826 areTokensAdjacent(Tok, Next))
829 unsigned DiagId = diag::err_two_right_angle_brackets_need_space;
831 (Tok.
is(tok::greatergreater) || Tok.
is(tok::greatergreatergreater)))
832 DiagId = diag::warn_cxx98_compat_two_right_angle_brackets;
833 else if (Tok.
is(tok::greaterequal))
834 DiagId = diag::err_right_angle_bracket_equal_needs_space;
840 if (RemainingToken == tok::equal && Next.
is(tok::equal) &&
841 areTokensAdjacent(Tok, Next)) {
859 if (ObjCGenericList && PrevTok.
getKind() == tok::greatergreater &&
861 PrevTok.
setKind(RemainingToken);
865 if (ConsumeLastToken)
871 if (!ConsumeLastToken) {
895 Parser::ParseTemplateIdAfterTemplateName(
bool ConsumeLastToken,
897 TemplateArgList &TemplateArgs,
899 assert(Tok.
is(tok::less) &&
"Must have already parsed the template-name");
908 if (Tok.
isNot(tok::greater) && Tok.
isNot(tok::greatergreater))
909 Invalid = ParseTemplateArgumentList(TemplateArgs);
913 if (ConsumeLastToken)
921 return ParseGreaterThanInTemplateList(RAngleLoc, ConsumeLastToken,
962 bool Parser::AnnotateTemplateIdToken(TemplateTy Template,
TemplateNameKind TNK,
966 bool AllowTypeAnnotation) {
968 assert(Template && Tok.
is(tok::less) &&
969 "Parser isn't at the beginning of a template-id");
976 TemplateArgList TemplateArgs;
977 bool Invalid = ParseTemplateIdAfterTemplateName(
false, LAngleLoc,
993 SS, TemplateKWLoc, Template, TemplateName.
Identifier,
994 TemplateNameLoc, LAngleLoc, TemplateArgsPtr, RAngleLoc);
1003 Tok.
setKind(tok::annot_typename);
1004 setTypeAnnotation(Tok, Type.
get());
1007 else if (TemplateKWLoc.
isValid())
1014 Tok.
setKind(tok::annot_template_id);
1027 SS, TemplateKWLoc, TemplateNameLoc, TemplateII, OpKind, Template, TNK,
1028 LAngleLoc, RAngleLoc, TemplateArgs, TemplateIds);
1057 void Parser::AnnotateTemplateIdTokenAsType(
bool IsClassName) {
1058 assert(Tok.
is(tok::annot_template_id) &&
"Requires template-id tokens");
1063 "Only works for type and dependent templates");
1066 TemplateId->NumArgs);
1070 TemplateId->TemplateKWLoc,
1071 TemplateId->Template,
1073 TemplateId->TemplateNameLoc,
1074 TemplateId->LAngleLoc,
1076 TemplateId->RAngleLoc,
1080 Tok.
setKind(tok::annot_typename);
1081 setTypeAnnotation(Tok, Type.isInvalid() ?
nullptr : Type.get());
1082 if (TemplateId->SS.isNotEmpty())
1093 return Tok.
isOneOf(tok::comma, tok::greater, tok::greatergreater);
1098 if (!Tok.
is(tok::identifier) && !Tok.
is(tok::coloncolon) &&
1099 !Tok.
is(tok::annot_cxxscope))
1114 ParseOptionalCXXScopeSpecifier(SS,
nullptr,
1119 if (SS.
isSet() && Tok.
is(tok::kw_template)) {
1124 if (Tok.
is(tok::identifier)) {
1143 }
else if (Tok.
is(tok::identifier)) {
1153 bool MemberOfUnknownSpecialization;
1158 false, Template, MemberOfUnknownSpecialization);
1193 if (isCXXTypeId(TypeIdAsTemplateArgument)) {
1201 TypeArg.
get().getAsOpaquePtr(),
1207 TentativeParsingAction TPA(*
this);
1210 = ParseTemplateTemplateArgument();
1211 if (!TemplateTemplateArgument.
isInvalid()) {
1213 return TemplateTemplateArgument;
1227 ExprArg.
get(), Loc);
1233 bool Parser::IsTemplateArgumentList(
unsigned Skip) {
1234 struct AlwaysRevertAction : TentativeParsingAction {
1235 AlwaysRevertAction(
Parser &
P) : TentativeParsingAction(P) { }
1236 ~AlwaysRevertAction() { Revert(); }
1249 if (Tok.
is(tok::greater))
1257 return Tok.
isOneOf(tok::greater, tok::comma);
1267 Parser::ParseTemplateArgumentList(TemplateArgList &TemplateArgs) {
1283 TemplateArgs.push_back(Arg);
1299 Decl *Parser::ParseExplicitInstantiation(
unsigned Context,
1308 return ParseSingleDeclarationAfterTemplate(Context,
1309 ParsedTemplateInfo(ExternLoc,
1311 ParsingTemplateParams,
1318 TemplateParams->size());
1322 R.setBegin(ExternLoc);
1327 ((
Parser *)P)->ParseLateTemplatedFuncDef(LPT);
1338 TemplateParameterDepthRAII CurTemplateDepthTracker(TemplateParameterDepth);
1350 DeclContextsToReenter.push_back(DD);
1356 DeclContextsToReenter.rbegin();
1357 for (; II != DeclContextsToReenter.rend(); ++II) {
1358 TemplateParamScopeStack.push_back(
new ParseScope(
this,
1360 unsigned NumParamLists =
1362 CurTemplateDepthTracker.addDepth(NumParamLists);
1369 assert(!LPT.
Toks.empty() &&
"Empty body!");
1373 LPT.
Toks.push_back(Tok);
1374 PP.EnterTokenStream(LPT.
Toks,
true);
1377 ConsumeAnyToken(
true);
1378 assert(Tok.
isOneOf(tok::l_brace, tok::colon, tok::kw_try) &&
1379 "Inline method not starting with '{', ':' or 'try'");
1391 if (Tok.
is(tok::kw_try)) {
1392 ParseFunctionTryBlock(LPT.
D, FnScope);
1394 if (Tok.
is(tok::colon))
1395 ParseConstructorInitializer(LPT.
D);
1399 if (Tok.
is(tok::l_brace)) {
1400 assert((!isa<FunctionTemplateDecl>(LPT.
D) ||
1401 cast<FunctionTemplateDecl>(LPT.
D)
1402 ->getTemplateParameters()
1403 ->getDepth() == TemplateParameterDepth - 1) &&
1404 "TemplateParameterDepth should be greater than the depth of "
1405 "current template being instantiated!");
1406 ParseFunctionStatementBody(LPT.
D, FnScope);
1415 TemplateParamScopeStack.rbegin();
1416 for (; I != TemplateParamScopeStack.rend(); ++
I)
1421 void Parser::LexTemplateFunctionForLateParsing(
CachedTokens &Toks) {
1423 if (!ConsumeAndStoreFunctionPrologue(Toks)) {
1425 ConsumeAndStoreUntil(tok::r_brace, Toks,
false);
1429 if (kind == tok::kw_try) {
1430 while (Tok.
is(tok::kw_catch)) {
1431 ConsumeAndStoreUntil(tok::l_brace, Toks,
false);
1432 ConsumeAndStoreUntil(tok::r_brace, Toks,
false);
unsigned getFlags() const
getFlags - Return the flags for this scope.
SourceManager & getSourceManager() const
Defines the clang::ASTContext interface.
void ReplacePreviousCachedToken(ArrayRef< Token > NewToks)
Replace token in CachedLexPos - 1 in CachedTokens by the tokens in NewToks.
IdKind getKind() const
Determine what kind of name we have.
FunctionDecl - An instance of this class is created to represent a function declaration or definition...
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...
const LangOptions & getLangOpts() const
IdentifierInfo * Identifier
When Kind == IK_Identifier, the parsed identifier, or when Kind == IK_UserLiteralId, the identifier suffix.
The name refers to a dependent template name:
Decl - This represents one declaration (or definition), e.g.
RAII object used to inform the actions that we're currently parsing a declaration.
Defines the C++ template declaration subclasses.
The base class of the type hierarchy.
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...
Parser - This implements a parser for the C family of languages.
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.
friend class ObjCDeclContextSwitch
ColonProtectionRAIIObject - This sets the Parser::ColonIsSacred bool and restores it when destroyed...
bool SkipUntil(tok::TokenKind T, SkipUntilFlags Flags=static_cast< SkipUntilFlags >(0))
SkipUntil - Read tokens until we get to the specified token, then consume it (unless StopBeforeMatch ...
Information about a template-id annotation token.
Decl * ActOnStartOfFunctionDef(Scope *S, Declarator &D, MultiTemplateParamsArg TemplateParamLists, SkipBodyInfo *SkipBody=nullptr)
RecordDecl - Represents a struct/union/class.
const Token & NextToken()
NextToken - This peeks ahead one token and returns it without consuming it.
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)
static TemplateIdAnnotation * Create(CXXScopeSpec SS, SourceLocation TemplateKWLoc, SourceLocation TemplateNameLoc, IdentifierInfo *Name, OverloadedOperatorKind OperatorKind, ParsedTemplateTy OpaqueTemplateName, TemplateNameKind TemplateKind, SourceLocation LAngleLoc, SourceLocation RAngleLoc, ArrayRef< ParsedTemplateArgument > TemplateArgs, SmallVectorImpl< TemplateIdAnnotation * > &CleanupList)
Creates a new TemplateIdAnnotation with NumArgs arguments and appends it to List. ...
One of these records is kept for each identifier that is lexed.
Decl * ActOnNonTypeTemplateParameter(Scope *S, Declarator &D, unsigned Depth, unsigned Position, SourceLocation EqualLoc, Expr *DefaultArg)
OverloadedOperatorKind Operator
The kind of overloaded operator.
struct OFI OperatorFunctionId
When Kind == IK_OperatorFunctionId, the overloaded operator that we parsed.
bool isTranslationUnit() const
Token - This structure provides full information about a lexed token.
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.
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.
tok::TokenKind getKind() const
Decl * ActOnFinishFunctionBody(Decl *Decl, Stmt *Body)
static SourceLocation AdvanceToTokenCharacter(SourceLocation TokStart, unsigned Character, const SourceManager &SM, const LangOptions &LangOpts)
AdvanceToTokenCharacter - If the current SourceLocation specifies a location at the start of a token...
detail::InMemoryDirectory::const_iterator I
Decl * ActOnTypeParameter(Scope *S, bool Typename, SourceLocation EllipsisLoc, SourceLocation KeyLoc, IdentifierInfo *ParamName, SourceLocation ParamNameLoc, unsigned Depth, unsigned Position, SourceLocation EqualLoc, ParsedType DefaultArg)
ActOnTypeParameter - Called when a C++ template type parameter (e.g., "typename T") has been parsed...
The current context is "potentially evaluated" in C++11 terms, but the expression is evaluated at com...
TemplateParameterList * ActOnTemplateParameterList(unsigned Depth, SourceLocation ExportLoc, SourceLocation TemplateLoc, SourceLocation LAngleLoc, ArrayRef< Decl * > Params, SourceLocation RAngleLoc, Expr *RequiresClause)
ActOnTemplateParameterList - Builds a TemplateParameterList, optionally constrained by RequiresClause...
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)
ParseTypeName type-name: [C99 6.7.6] specifier-qualifier-list abstract-declarator[opt].
DeclContext * getLexicalParent()
getLexicalParent - Returns the containing lexical DeclContext.
void setAnnotationValue(void *val)
Decl * ParsedFreeStandingDeclSpec(Scope *S, AccessSpecifier AS, DeclSpec &DS, RecordDecl *&AnonRecord)
ParsedFreeStandingDeclSpec - This method is invoked when a declspec with no declarator (e...
Represents a character-granular source range.
void AnnotateCachedTokens(const Token &Tok)
We notify the Preprocessor that if it is caching tokens (because backtrack is enabled) it should repl...
This file defines the classes used to store parsed information about declaration-specifiers and decla...
void SkipMalformedDecl()
SkipMalformedDecl - Read tokens until we get to some likely good stopping point for skipping past a s...
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.
bool isNot(tok::TokenKind K) const
void setEllipsisLoc(SourceLocation EL)
TemplateNameKind ActOnDependentTemplateName(Scope *S, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, UnqualifiedId &Name, ParsedType ObjectType, bool EnteringContext, TemplateTy &Template, bool AllowInjectedClassName=false)
Form a dependent template name.
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.
Stop skipping at semicolon.
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.
void setLength(unsigned Len)
bool isValid() const
Return true if this is a valid SourceLocation object.
void setAnnotationEndLoc(SourceLocation L)
Scope * getCurScope() const
TokenKind
Provides a simple uniform namespace for tokens from all C languages.
SourceLocation getBegin() const
SourceLocation getBeginLoc() const
bool is(tok::TokenKind K) const
is/isNot - Predicates to check if this token is a specific kind, as in "if (Tok.is(tok::l_brace)) {...
A template type parameter, stored as a type.
ExprResult ParseConstantExpressionInExprEvalContext(TypeCastState isTypeCast=NotTypeCast)
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)
ActOnTemplateTemplateParameter - Called when a C++ template template parameter (e.g.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
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.
ExprResult ParseConstraintExpression()
Parse a constraint-expression.
void PushDeclContext(Scope *S, DeclContext *DC)
Set the current declaration context until it gets popped.
bool hasName() const
hasName - Whether this declarator has a name, which might be an identifier (accessible via getIdentif...
The name refers to a template whose specialization produces a type.
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)
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.
bool IsPreviousCachedToken(const Token &Tok) const
Whether Tok is the most recent token (CachedLexPos - 1) in CachedTokens.
TypeResult ActOnTemplateIdType(CXXScopeSpec &SS, SourceLocation TemplateKWLoc, TemplateTy Template, IdentifierInfo *TemplateII, SourceLocation TemplateIILoc, SourceLocation LAngleLoc, ASTTemplateArgsPtr TemplateArgs, SourceLocation RAngleLoc, bool IsCtorOrDtorName=false, bool IsClassName=false)
Captures information about "declaration specifiers".
SourceLocation getIdentifierLoc() const
SourceLocation ConsumeToken()
ConsumeToken - Consume the current 'peek token' and lex the next one.
Decl * D
The template function declaration to be late parsed.
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...
bool isSet() const
Deprecated.
unsigned getLength() const
Contains a late templated function.
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.
AttributeList - Represents a syntactic attribute.
Stop skipping at specified token, but don't skip the token itself.
SourceLocation getEllipsisLoc() const
unsigned ActOnReenterTemplateScope(Scope *S, Decl *Template)
IdentifierInfo * getIdentifierInfo() const