26NamedDecl *Parser::ParseCXXInlineMethodDef(
31 assert(Tok.
isOneOf(tok::l_brace, tok::colon, tok::kw_try, tok::equal) &&
32 "Current token not a '{', ':', '=', or 'try'!");
35 TemplateInfo.TemplateParams ? TemplateInfo.TemplateParams->data()
37 TemplateInfo.TemplateParams ? TemplateInfo.TemplateParams->size() : 0);
45 TemplateParams,
nullptr,
55 HandleMemberFunctionDeclDelays(D, FnD);
70 ? diag::warn_cxx98_compat_defaulted_deleted_function
71 : diag::ext_defaulted_deleted_function)
75 if (
auto *DeclAsFunction = dyn_cast<FunctionDecl>(FnD)) {
76 DeclAsFunction->setRangeEnd(KWEndLoc);
80 ? diag::warn_cxx98_compat_defaulted_deleted_function
81 : diag::ext_defaulted_deleted_function)
84 if (
auto *DeclAsFunction = dyn_cast<FunctionDecl>(FnD)) {
85 DeclAsFunction->setRangeEnd(KWEndLoc);
88 llvm_unreachable(
"function definition after = not 'delete' or 'default'");
91 if (Tok.
is(tok::comma)) {
92 Diag(KWLoc, diag::err_default_delete_in_multiple_declaration)
95 }
else if (ExpectAndConsume(tok::semi, diag::err_expected_after,
96 Delete ?
"delete" :
"default")) {
104 trySkippingFunctionBody()) {
118 (TemplateInfo.Kind != ParsedTemplateInfo::NonTemplate &&
119 TemplateInfo.Kind != ParsedTemplateInfo::ExplicitSpecialization)) &&
123 LexTemplateFunctionForLateParsing(Toks);
136 LexedMethod* LM =
new LexedMethod(
this, FnD);
137 getCurrentClass().LateParsedDeclarations.push_back(LM);
143 if (ConsumeAndStoreFunctionPrologue(Toks)) {
150 llvm::any_of(Toks, [](
const Token &Tok) {
151 return Tok.is(tok::code_completion);
164 delete getCurrentClass().LateParsedDeclarations.back();
165 getCurrentClass().LateParsedDeclarations.pop_back();
169 ConsumeAndStoreUntil(tok::r_brace, Toks,
false);
173 if (kind == tok::kw_try) {
174 while (Tok.
is(tok::kw_catch)) {
175 ConsumeAndStoreUntil(tok::l_brace, Toks,
false);
176 ConsumeAndStoreUntil(tok::r_brace, Toks,
false);
189 delete getCurrentClass().LateParsedDeclarations.back();
190 getCurrentClass().LateParsedDeclarations.pop_back();
200void Parser::ParseCXXNonStaticMemberInitializer(
Decl *VarD) {
201 assert(Tok.
isOneOf(tok::l_brace, tok::equal) &&
202 "Current token not a '{' or '='!");
204 LateParsedMemberInitializer *MI =
205 new LateParsedMemberInitializer(
this, VarD);
206 getCurrentClass().LateParsedDeclarations.push_back(MI);
210 if (kind == tok::equal) {
215 if (kind == tok::l_brace) {
221 ConsumeAndStoreUntil(tok::r_brace, Toks,
true);
224 ConsumeAndStoreInitializer(Toks, CIK_DefaultInitializer);
237Parser::LateParsedDeclaration::~LateParsedDeclaration() {}
238void Parser::LateParsedDeclaration::ParseLexedMethodDeclarations() {}
239void Parser::LateParsedDeclaration::ParseLexedMemberInitializers() {}
240void Parser::LateParsedDeclaration::ParseLexedMethodDefs() {}
241void Parser::LateParsedDeclaration::ParseLexedAttributes() {}
242void Parser::LateParsedDeclaration::ParseLexedPragmas() {}
244Parser::LateParsedClass::LateParsedClass(
Parser *
P, ParsingClass *
C)
247Parser::LateParsedClass::~LateParsedClass() {
248 Self->DeallocateParsedClasses(Class);
251void Parser::LateParsedClass::ParseLexedMethodDeclarations() {
252 Self->ParseLexedMethodDeclarations(*Class);
255void Parser::LateParsedClass::ParseLexedMemberInitializers() {
256 Self->ParseLexedMemberInitializers(*Class);
259void Parser::LateParsedClass::ParseLexedMethodDefs() {
260 Self->ParseLexedMethodDefs(*Class);
263void Parser::LateParsedClass::ParseLexedAttributes() {
264 Self->ParseLexedAttributes(*Class);
267void Parser::LateParsedClass::ParseLexedPragmas() {
268 Self->ParseLexedPragmas(*Class);
271void Parser::LateParsedMethodDeclaration::ParseLexedMethodDeclarations() {
272 Self->ParseLexedMethodDeclaration(*
this);
275void Parser::LexedMethod::ParseLexedMethodDefs() {
276 Self->ParseLexedMethodDef(*
this);
279void Parser::LateParsedMemberInitializer::ParseLexedMemberInitializers() {
280 Self->ParseLexedMemberInitializer(*
this);
283void Parser::LateParsedAttribute::ParseLexedAttributes() {
284 Self->ParseLexedAttribute(*
this,
true,
false);
287void Parser::LateParsedPragma::ParseLexedPragmas() {
288 Self->ParseLexedPragma(*
this);
313 !
Class.TopLevelClass),
316 if (
Class.TopLevelClass)
322 Class.TagOrTemplate);
325 if (
Class.TopLevelClass)
329 Class.TagOrTemplate);
337void Parser::ParseLexedMethodDeclarations(ParsingClass &Class) {
338 ReenterClassScopeRAII InClassScope(*
this, Class);
340 for (LateParsedDeclaration *LateD : Class.LateParsedDeclarations)
341 LateD->ParseLexedMethodDeclarations();
344void Parser::ParseLexedMethodDeclaration(LateParsedMethodDeclaration &LM) {
346 ReenterTemplateScopeRAII InFunctionTemplateScope(*
this, LM.Method);
356 for (
unsigned I = 0, N = LM.DefaultArgs.size(); I != N; ++I) {
357 auto Param = cast<ParmVarDecl>(LM.DefaultArgs[I].Param);
359 bool HasUnparsed = Param->hasUnparsedDefaultArg();
361 std::unique_ptr<CachedTokens> Toks = std::move(LM.DefaultArgs[I].Toks);
367 Token LastDefaultArgToken = Toks->back();
373 Toks->push_back(DefArgEnd);
376 Toks->push_back(Tok);
377 PP.EnterTokenStream(*Toks,
true,
true);
383 assert(Tok.
is(tok::equal) &&
"Default argument not starting with '='");
394 Diag(Tok, diag::warn_cxx98_compat_generalized_initializer_lists);
395 DefArgResult = ParseBraceInitializer();
407 assert(Toks->size() >= 3 &&
"expected a token in default arg");
410 (*Toks)[Toks->size() - 3].getLocation());
418 while (Tok.
isNot(tok::eof))
423 }
else if (HasUnparsed) {
424 assert(Param->hasInheritedDefaultArg());
426 if (
const auto *FunTmpl = dyn_cast<FunctionTemplateDecl>(LM.Method))
435 Param->setUninstantiatedDefaultArg(
438 Param->setDefaultArg(OldParam->
getInit());
448 Token LastExceptionSpecToken = Toks->back();
449 Token ExceptionSpecEnd;
451 ExceptionSpecEnd.
setKind(tok::eof);
454 Toks->push_back(ExceptionSpecEnd);
457 Toks->push_back(Tok);
458 PP.EnterTokenStream(*Toks,
true,
true);
471 = dyn_cast<FunctionTemplateDecl>(LM.Method))
472 Method = dyn_cast<CXXMethodDecl>(FunTmpl->getTemplatedDecl());
474 Method = dyn_cast<CXXMethodDecl>(LM.Method);
477 Actions, Method ? Method->
getParent() :
nullptr,
489 = tryParseExceptionSpecification(
false, SpecificationRange,
491 DynamicExceptionRanges, NoexceptExpr,
492 ExceptionSpecTokens);
501 DynamicExceptionRanges,
503 NoexceptExpr.
get() :
nullptr);
507 while (Tok.
isNot(tok::eof))
515 LM.ExceptionSpecTokens =
nullptr;
518 InFunctionTemplateScope.Scopes.Exit();
527void Parser::ParseLexedMethodDefs(ParsingClass &Class) {
528 ReenterClassScopeRAII InClassScope(*
this, Class);
530 for (LateParsedDeclaration *D :
Class.LateParsedDeclarations)
531 D->ParseLexedMethodDefs();
534void Parser::ParseLexedMethodDef(LexedMethod &LM) {
536 ReenterTemplateScopeRAII InFunctionTemplateScope(*
this, LM.D);
540 assert(!LM.Toks.empty() &&
"Empty body!");
541 Token LastBodyToken = LM.Toks.back();
547 LM.Toks.push_back(BodyEnd);
550 LM.Toks.push_back(Tok);
551 PP.EnterTokenStream(LM.Toks,
true,
true);
555 assert(Tok.
isOneOf(tok::l_brace, tok::colon, tok::kw_try)
556 &&
"Inline method not starting with '{', ':' or 'try'");
564 if (Tok.
is(tok::kw_try)) {
565 ParseFunctionTryBlock(LM.D, FnScope);
567 while (Tok.
isNot(tok::eof))
574 if (Tok.
is(tok::colon)) {
575 ParseConstructorInitializer(LM.D);
578 if (!Tok.
is(tok::l_brace)) {
582 while (Tok.
isNot(tok::eof))
593 !isa<FunctionTemplateDecl>(LM.D) ||
594 cast<FunctionTemplateDecl>(LM.D)->getTemplateParameters()->getDepth()
595 < TemplateParameterDepth) &&
596 "TemplateParameterDepth should be greater than the depth of "
597 "current template being instantiated!");
599 ParseFunctionStatementBody(LM.D, FnScope);
601 while (Tok.
isNot(tok::eof))
607 if (
auto *FD = dyn_cast_or_null<FunctionDecl>(LM.D))
608 if (isa<CXXMethodDecl>(FD) ||
616void Parser::ParseLexedMemberInitializers(ParsingClass &Class) {
617 ReenterClassScopeRAII InClassScope(*
this, Class);
619 if (!
Class.LateParsedDeclarations.empty()) {
629 for (LateParsedDeclaration *D :
Class.LateParsedDeclarations)
630 D->ParseLexedMemberInitializers();
636void Parser::ParseLexedMemberInitializer(LateParsedMemberInitializer &MI) {
637 if (!MI.Field || MI.Field->isInvalidDecl())
644 MI.Toks.push_back(Tok);
645 PP.EnterTokenStream(MI.Toks,
true,
true);
659 ExprResult Init = ParseCXXMemberInitializer(MI.Field,
false,
666 if (Tok.
isNot(tok::eof)) {
667 if (!Init.isInvalid()) {
672 Diag(EndLoc, diag::err_expected_semi_decl_list);
676 while (Tok.
isNot(tok::eof))
686void Parser::ParseLexedAttributes(ParsingClass &Class) {
687 ReenterClassScopeRAII InClassScope(*
this, Class);
689 for (LateParsedDeclaration *LateD :
Class.LateParsedDeclarations)
690 LateD->ParseLexedAttributes();
694void Parser::ParseLexedAttributeList(LateParsedAttrList &LAs,
Decl *D,
695 bool EnterScope,
bool OnDefinition) {
696 assert(LAs.parseSoon() &&
697 "Attribute list should be marked for immediate parsing.");
698 for (
unsigned i = 0, ni = LAs.size(); i < ni; ++i) {
701 ParseLexedAttribute(*LAs[i],
EnterScope, OnDefinition);
712void Parser::ParseLexedAttribute(LateParsedAttribute &LA,
713 bool EnterScope,
bool OnDefinition) {
721 LA.Toks.push_back(AttrEnd);
725 LA.Toks.push_back(Tok);
726 PP.EnterTokenStream(LA.Toks,
true,
true);
732 if (LA.Decls.size() > 0) {
733 Decl *D = LA.Decls[0];
741 if (LA.Decls.size() == 1) {
743 ReenterTemplateScopeRAII InDeclScope(*
this, D,
EnterScope);
753 ParseGNUAttributeArgs(&LA.AttrName, LA.AttrNameLoc, Attrs,
nullptr,
762 ParseGNUAttributeArgs(&LA.AttrName, LA.AttrNameLoc, Attrs,
nullptr,
767 Diag(Tok, diag::warn_attribute_no_decl) << LA.AttrName.getName();
770 if (OnDefinition && !Attrs.empty() && !Attrs.begin()->isCXX11Attribute() &&
771 Attrs.begin()->isKnownToGCC())
772 Diag(Tok, diag::warn_attribute_on_function_definition)
775 for (
unsigned i = 0, ni = LA.Decls.size(); i < ni; ++i)
780 while (Tok.
isNot(tok::eof))
787void Parser::ParseLexedPragmas(ParsingClass &Class) {
788 ReenterClassScopeRAII InClassScope(*
this, Class);
790 for (LateParsedDeclaration *D :
Class.LateParsedDeclarations)
791 D->ParseLexedPragmas();
794void Parser::ParseLexedPragma(LateParsedPragma &LP) {
796 PP.EnterTokenStream(LP.toks(),
true,
801 assert(Tok.
isAnnotation() &&
"Expected annotation token.");
803 case tok::annot_attr_openmp:
804 case tok::annot_pragma_openmp: {
807 (void)ParseOpenMPDeclarativeDirectiveWithExtDecl(AS, Attrs);
811 llvm_unreachable(
"Unexpected token.");
823 bool StopAtSemi,
bool ConsumeFinalToken) {
826 bool isFirstTokenConsumed =
true;
829 if (Tok.
is(T1) || Tok.
is(T2)) {
830 if (ConsumeFinalToken) {
839 case tok::annot_module_begin:
840 case tok::annot_module_end:
841 case tok::annot_module_include:
842 case tok::annot_repl_input_end:
850 ConsumeAndStoreUntil(tok::r_paren, Toks,
false);
856 ConsumeAndStoreUntil(tok::r_square, Toks,
false);
862 ConsumeAndStoreUntil(tok::r_brace, Toks,
false);
871 if (ParenCount && !isFirstTokenConsumed)
877 if (BracketCount && !isFirstTokenConsumed)
883 if (BraceCount && !isFirstTokenConsumed)
899 isFirstTokenConsumed =
false;
909bool Parser::ConsumeAndStoreFunctionPrologue(
CachedTokens &Toks) {
910 if (Tok.
is(tok::kw_try)) {
915 if (Tok.
isNot(tok::colon)) {
921 ConsumeAndStoreUntil(tok::l_brace, tok::r_brace, Toks,
924 if (Tok.
isNot(tok::l_brace))
945 bool MightBeTemplateArgument =
false;
949 if (Tok.
is(tok::kw_decltype)) {
952 if (Tok.
isNot(tok::l_paren))
957 if (!ConsumeAndStoreUntil(tok::r_paren, Toks,
true)) {
959 Diag(OpenLoc, diag::note_matching) << tok::l_paren;
965 if (Tok.
is(tok::coloncolon)) {
969 if (Tok.
is(tok::kw_template)) {
975 if (Tok.
is(tok::identifier)) {
981 }
while (Tok.
is(tok::coloncolon));
983 if (Tok.
is(tok::code_completion)) {
985 ConsumeCodeCompletionToken();
986 if (Tok.
isOneOf(tok::identifier, tok::coloncolon, tok::kw_decltype)) {
993 if (Tok.
is(tok::comma)) {
999 if (Tok.
is(tok::less))
1000 MightBeTemplateArgument =
true;
1002 if (MightBeTemplateArgument) {
1009 if (!ConsumeAndStoreUntil(tok::l_paren, tok::l_brace, Toks,
1016 }
else if (Tok.
isNot(tok::l_paren) && Tok.
isNot(tok::l_brace)) {
1020 << tok::l_paren << tok::l_brace;
1026 Toks.push_back(Tok);
1027 bool IsLParen = (
kind == tok::l_paren);
1033 assert(kind == tok::l_brace &&
"Must be left paren or brace here.");
1040 const Token &PreviousToken = Toks[Toks.size() - 2];
1041 if (!MightBeTemplateArgument &&
1042 !PreviousToken.
isOneOf(tok::identifier, tok::greater,
1043 tok::greatergreater)) {
1049 TentativeParsingAction PA(*
this);
1051 !Tok.
isOneOf(tok::comma, tok::ellipsis, tok::l_brace)) {
1064 tok::TokenKind CloseKind = IsLParen ? tok::r_paren : tok::r_brace;
1065 if (!ConsumeAndStoreUntil(CloseKind, Toks,
true)) {
1066 Diag(Tok, diag::err_expected) << CloseKind;
1067 Diag(OpenLoc, diag::note_matching) <<
kind;
1072 if (Tok.
is(tok::ellipsis)) {
1073 Toks.push_back(Tok);
1079 if (Tok.
is(tok::comma)) {
1080 Toks.push_back(Tok);
1082 }
else if (Tok.
is(tok::l_brace)) {
1097 Toks.push_back(Tok);
1100 }
else if (!MightBeTemplateArgument) {
1101 return Diag(Tok.
getLocation(), diag::err_expected_either) << tok::l_brace
1109bool Parser::ConsumeAndStoreConditional(
CachedTokens &Toks) {
1111 assert(Tok.
is(tok::question));
1112 Toks.push_back(Tok);
1115 while (Tok.
isNot(tok::colon)) {
1116 if (!ConsumeAndStoreUntil(tok::question, tok::colon, Toks,
1122 if (Tok.
is(tok::question) && !ConsumeAndStoreConditional(Toks))
1127 Toks.push_back(Tok);
1137 : TentativeParsingAction(Self), Self(Self), EndKind(EndKind) {
1140 TentativeParsingAction Inner(Self);
1141 Self.ConsumeAndStoreUntil(EndKind, Toks,
true,
false);
1151 auto Buffer = std::make_unique<Token[]>(Toks.size());
1152 std::copy(Toks.begin() + 1, Toks.end(), Buffer.get());
1153 Buffer[Toks.size() - 1] = Self.Tok;
1154 Self.PP.EnterTokenStream(std::move(Buffer), Toks.size(),
true,
1157 Self.Tok = Toks.front();
1173bool Parser::ConsumeAndStoreInitializer(
CachedTokens &Toks,
1174 CachedInitKind CIK) {
1176 bool IsFirstToken =
true;
1181 unsigned AngleCount = 0;
1182 unsigned KnownTemplateCount = 0;
1191 if (KnownTemplateCount)
1204 UnannotatedTentativeParsingAction PA(*
this,
1205 CIK == CIK_DefaultInitializer
1206 ? tok::semi : tok::r_paren);
1209 TPResult
Result = TPResult::Error;
1212 case CIK_DefaultInitializer:
1213 Result = TryParseInitDeclaratorList();
1216 if (
Result == TPResult::Ambiguous && Tok.
isNot(tok::semi))
1217 Result = TPResult::False;
1220 case CIK_DefaultArgument:
1221 bool InvalidAsDeclaration =
false;
1222 Result = TryParseParameterDeclarationClause(
1223 &InvalidAsDeclaration,
true);
1226 if (
Result == TPResult::Ambiguous && InvalidAsDeclaration)
1227 Result = TPResult::False;
1234 PA.RevertAnnotations();
1237 if (
Result != TPResult::False &&
Result != TPResult::Error)
1242 ++KnownTemplateCount;
1246 case tok::annot_module_begin:
1247 case tok::annot_module_end:
1248 case tok::annot_module_include:
1249 case tok::annot_repl_input_end:
1262 if (!ConsumeAndStoreConditional(Toks))
1266 case tok::greatergreatergreater:
1269 if (AngleCount) --AngleCount;
1270 if (KnownTemplateCount) --KnownTemplateCount;
1272 case tok::greatergreater:
1275 if (AngleCount) --AngleCount;
1276 if (KnownTemplateCount) --KnownTemplateCount;
1279 if (AngleCount) --AngleCount;
1280 if (KnownTemplateCount) --KnownTemplateCount;
1283 case tok::kw_template:
1287 Toks.push_back(Tok);
1289 if (Tok.
is(tok::identifier)) {
1290 Toks.push_back(Tok);
1292 if (Tok.
is(tok::less)) {
1294 ++KnownTemplateCount;
1295 Toks.push_back(Tok);
1301 case tok::kw_operator:
1304 Toks.push_back(Tok);
1308 case tok::greatergreatergreater:
1309 case tok::greatergreater:
1312 Toks.push_back(Tok);
1322 Toks.push_back(Tok);
1324 ConsumeAndStoreUntil(tok::r_paren, Toks,
false);
1328 Toks.push_back(Tok);
1330 ConsumeAndStoreUntil(tok::r_square, Toks,
false);
1334 Toks.push_back(Tok);
1336 ConsumeAndStoreUntil(tok::r_brace, Toks,
false);
1346 if (CIK == CIK_DefaultArgument)
1348 if (ParenCount && !IsFirstToken)
1350 Toks.push_back(Tok);
1354 if (BracketCount && !IsFirstToken)
1356 Toks.push_back(Tok);
1360 if (BraceCount && !IsFirstToken)
1362 Toks.push_back(Tok);
1366 case tok::code_completion:
1367 Toks.push_back(Tok);
1368 ConsumeCodeCompletionToken();
1371 case tok::string_literal:
1372 case tok::wide_string_literal:
1373 case tok::utf8_string_literal:
1374 case tok::utf16_string_literal:
1375 case tok::utf32_string_literal:
1376 Toks.push_back(Tok);
1377 ConsumeStringToken();
1380 if (CIK == CIK_DefaultInitializer)
1385 Toks.push_back(Tok);
1389 IsFirstToken =
false;
Defines the C++ template declaration subclasses.
A tentative parsing action that can also revert token annotations.
UnannotatedTentativeParsingAction(Parser &Self, tok::TokenKind EndKind)
Represents a static or instance method of a struct/union/class.
const CXXRecordDecl * getParent() const
Return the parent of this method declaration, which is the class in which this method is defined.
Qualifiers getMethodQualifiers() const
bool isDependentContext() const
Determines whether this context is dependent on a template parameter.
FriendSpecified isFriendSpecified() const
bool hasConstexprSpecifier() const
Decl - This represents one declaration (or definition), e.g.
bool isFunctionOrFunctionTemplate() const
Whether this declaration is a function or function template.
bool isInIdentifierNamespace(unsigned NS) const
FunctionDecl * getAsFunction() LLVM_READONLY
Returns the function itself, or the templated function if this is a function template.
@ IDNS_OrdinaryFriend
This declaration is a friend function.
DeclContext * getDeclContext()
bool isFunctionDeclarator(unsigned &idx) const
isFunctionDeclarator - This method returns true if the declarator is a function declarator (looking t...
FunctionDefinitionKind getFunctionDefinitionKind() const
bool hasErrorOccurred() const
RAII object that enters a new expression evaluation context.
Represents a function declaration or definition.
const ParmVarDecl * getParamDecl(unsigned i) const
QualType getReturnType() const
void setWillHaveBody(bool V=true)
Declaration of a template function.
This represents a decl that may have a name.
bool isCXXInstanceMember() const
Determine whether the given declaration is an instance member of a C++ class.
RAII object that makes sure paren/bracket/brace count is correct after declaration/statement parsing,...
Represents a parameter to a function.
bool hasUnparsedDefaultArg() const
Determines whether this parameter has a default argument that has not yet been parsed.
bool hasUninstantiatedDefaultArg() const
Expr * getUninstantiatedDefaultArg()
ParsedAttributes - A collection of parsed attributes.
Introduces zero or more scopes for parsing.
void Enter(unsigned ScopeFlags)
Parser - This implements a parser for the C family of languages.
DiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID)
SourceLocation ConsumeToken()
ConsumeToken - Consume the current 'peek token' and lex the next one.
void EnterScope(unsigned ScopeFlags)
EnterScope - Start a new scope.
SourceLocation ConsumeAnyToken(bool ConsumeCodeCompletionTok=false)
ConsumeAnyToken - Dispatch to the right Consume* method based on the current token type.
bool TryConsumeToken(tok::TokenKind Expected)
Scope * getCurScope() const
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 ...
void SkipMalformedDecl()
SkipMalformedDecl - Read tokens until we get to some likely good stopping point for skipping past a s...
ExprResult ParseAssignmentExpression(TypeCastState isTypeCast=NotTypeCast)
Parse an expr that doesn't include (top-level) commas.
const LangOptions & getLangOpts() const
@ StopBeforeMatch
Stop skipping at specified token, but don't skip the token itself.
@ StopAtSemi
Stop skipping at semicolon.
unsigned ReenterTemplateScopes(MultiParseScope &S, Decl *D)
Re-enter the template scopes for a declaration that might be a template.
A class for parsing a declarator.
const ParsingDeclSpec & getDeclSpec() const
void EnterToken(const Token &Tok, bool IsReinject)
Enters a token in the token stream to be lexed next.
bool isCodeCompletionEnabled() const
Determine if we are performing code completion.
SourceLocation getLocForEndOfToken(SourceLocation Loc, unsigned Offset=0)
Computes the source location just past the end of the token at this source location.
The collection of all-type qualifiers we support.
Represents a struct/union/class.
decl_type * getPreviousDecl()
Return the previous declaration of this declaration or NULL if this is the first declaration.
Scope - A scope is a transient data structure that is used while parsing the program.
@ FunctionPrototypeScope
This is a scope that corresponds to the parameters within a function prototype.
@ CompoundStmtScope
This is a compound statement scope.
@ ClassScope
The scope of a struct/union/class definition.
@ FunctionDeclarationScope
This is a scope that corresponds to the parameters within a function prototype for a function declara...
@ FnScope
This indicates that the scope corresponds to a function, which means that labels are set here.
@ DeclScope
This is a scope that can contain a declaration.
RAII object used to temporarily allow the C++ 'this' expression to be used, with the given qualifiers...
RAII class used to indicate that we are performing provisional semantic analysis to determine the val...
Decl * ActOnSkippedFunctionBody(Decl *Decl)
void ActOnParamDefaultArgumentError(Decl *param, SourceLocation EqualLoc, Expr *DefaultArg)
ActOnParamDefaultArgumentError - Parsing or semantic analysis of the default argument for the paramet...
void ActOnFinishDelayedMemberInitializers(Decl *Record)
void ActOnExitFunctionContext()
NamedDecl * ActOnCXXMemberDeclarator(Scope *S, AccessSpecifier AS, Declarator &D, MultiTemplateParamsArg TemplateParameterLists, Expr *BitfieldWidth, const VirtSpecifiers &VS, InClassInitStyle InitStyle)
ActOnCXXMemberDeclarator - This is invoked when a C++ class member declarator is parsed.
bool IsInsideALocalClassWithinATemplateFunction()
void ActOnReenterFunctionContext(Scope *S, Decl *D)
Push the parameters of D, which must be a function, into scope.
void ActOnParamDefaultArgument(Decl *param, SourceLocation EqualLoc, Expr *defarg)
ActOnParamDefaultArgument - Check whether the default argument provided for a function parameter is w...
void ActOnFinishDelayedCXXMethodDeclaration(Scope *S, Decl *Method)
ActOnFinishDelayedCXXMethodDeclaration - We have finished processing the delayed method declaration f...
DiagnosticsEngine & getDiagnostics() const
NamedDecl * ActOnFriendFunctionDecl(Scope *S, Declarator &D, MultiTemplateParamsArg TemplateParams)
void MarkAsLateParsedTemplate(FunctionDecl *FD, Decl *FnD, CachedTokens &Toks)
void ActOnStartCXXInClassMemberInitializer()
Enter a new C++ default initializer scope.
void ActOnFinishDelayedMemberDeclarations(Scope *S, Decl *Record)
void SetDeclDefaulted(Decl *dcl, SourceLocation DefaultLoc)
Decl * ActOnStartOfFunctionDef(Scope *S, Declarator &D, MultiTemplateParamsArg TemplateParamLists, SkipBodyInfo *SkipBody=nullptr, FnBodyKind BodyKind=FnBodyKind::Other)
void ProcessDeclAttributeList(Scope *S, Decl *D, const ParsedAttributesView &AttrList, const ProcessDeclAttributeOptions &Options=ProcessDeclAttributeOptions())
ProcessDeclAttributeList - Apply all the decl attributes in the specified attribute list to the speci...
void CheckForFunctionRedefinition(FunctionDecl *FD, const FunctionDecl *EffectiveDefinition=nullptr, SkipBodyInfo *SkipBody=nullptr)
void ActOnFinishInlineFunctionDef(FunctionDecl *D)
DeclContext * CurContext
CurContext - This is the current declaration context of parsing.
bool canSkipFunctionBody(Decl *D)
Determine whether we can skip parsing the body of a function definition, assuming we don't care about...
void actOnDelayedExceptionSpecification(Decl *Method, ExceptionSpecificationType EST, SourceRange SpecificationRange, ArrayRef< ParsedType > DynamicExceptions, ArrayRef< SourceRange > DynamicExceptionRanges, Expr *NoexceptExpr)
Add an exception-specification to the given member function (or member function template).
void ActOnFinishCXXInClassMemberInitializer(Decl *VarDecl, SourceLocation EqualLoc, Expr *Init)
This is invoked after parsing an in-class initializer for a non-static C++ class member,...
Decl * ActOnFinishFunctionBody(Decl *Decl, Stmt *Body)
void ActOnDefaultCtorInitializers(Decl *CDtorDecl)
@ PotentiallyEvaluatedIfUsed
The current expression is potentially evaluated, but any declarations referenced inside that expressi...
void ActOnStartDelayedCXXMethodDeclaration(Scope *S, Decl *Method)
ActOnStartDelayedCXXMethodDeclaration - We have completed parsing a top-level (non-nested) C++ class,...
void ActOnFinishDelayedAttribute(Scope *S, Decl *D, ParsedAttributes &Attrs)
ActOnFinishDelayedAttribute - Invoked when we have finished parsing an attribute for which parsing is...
void SetDeclDeleted(Decl *dcl, SourceLocation DelLoc)
void ActOnPureSpecifier(Decl *D, SourceLocation PureSpecLoc)
void ActOnStartDelayedMemberDeclarations(Scope *S, Decl *Record)
void ActOnDelayedCXXMethodParameter(Scope *S, Decl *Param)
ActOnDelayedCXXMethodParameter - We've already started a delayed C++ method declaration.
ExprResult CorrectDelayedTyposInExpr(Expr *E, VarDecl *InitDecl=nullptr, bool RecoverUncorrectedTypos=false, 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...
Encodes a location in the source.
bool isValid() const
Return true if this is a valid SourceLocation object.
SourceLocation getLocWithOffset(IntTy Offset) const
Return a source location with the specified offset from this SourceLocation.
A trivial tuple used to represent a source range.
Token - This structure provides full information about a lexed token.
SourceLocation getEndLoc() const
SourceLocation getLocation() const
Return a source location identifier for the specified offset in the current file.
void setKind(tok::TokenKind K)
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)) {....
tok::TokenKind getKind() const
void setEofData(const void *D)
void setLocation(SourceLocation L)
bool isOneOf(tok::TokenKind K1, tok::TokenKind K2) const
bool isNot(tok::TokenKind K) const
bool isAnnotation() const
Return true if this is any of tok::annot_* kind tokens.
const void * getEofData() const
void startToken()
Reset all flags to cleared.
AutoType * getContainedAutoType() const
Get the AutoType whose type will be deduced for a variable with an initializer of this type.
const Expr * getInit() const
Represents a C++11 virt-specifier-seq.
unsigned kind
All of the diagnostics that can be emitted by the frontend.
TokenKind
Provides a simple uniform namespace for tokens from all C languages.
@ ICIS_NoInit
No in-class initializer.
@ C
Languages that the frontend can parse and compile.
@ Result
The result type of a method or function.
ExceptionSpecificationType
The various types of exception specifications that exist in C++11.
AccessSpecifier
A C++ access specifier (public, private, protected), plus the special value "none" which means differ...
Utility to re-enter a class scope while parsing its late-parsed components.
ReenterClassScopeRAII(Parser &P, ParsingClass &Class)
Utility to re-enter a possibly-templated scope while parsing its late-parsed components.
ReenterTemplateScopeRAII(Parser &P, Decl *MaybeTemplated, bool Enter=true)
TemplateParameterDepthRAII CurTemplateDepthTracker