19 using namespace clang;
24 NamedDecl *Parser::ParseCXXInlineMethodDef(
29 assert(Tok.
isOneOf(tok::l_brace, tok::colon, tok::kw_try, tok::equal) &&
30 "Current token not a '{', ':', '=', or 'try'!");
33 TemplateInfo.TemplateParams ? TemplateInfo.TemplateParams->data()
35 TemplateInfo.TemplateParams ? TemplateInfo.TemplateParams->size() : 0);
43 TemplateParams,
nullptr,
53 HandleMemberFunctionDeclDelays(D, FnD);
68 ? diag::warn_cxx98_compat_defaulted_deleted_function
69 : diag::ext_defaulted_deleted_function)
73 if (
auto *DeclAsFunction = dyn_cast<FunctionDecl>(FnD)) {
74 DeclAsFunction->setRangeEnd(KWEndLoc);
78 ? diag::warn_cxx98_compat_defaulted_deleted_function
79 : diag::ext_defaulted_deleted_function)
82 if (
auto *DeclAsFunction = dyn_cast<FunctionDecl>(FnD)) {
83 DeclAsFunction->setRangeEnd(KWEndLoc);
86 llvm_unreachable(
"function definition after = not 'delete' or 'default'");
89 if (Tok.
is(tok::comma)) {
90 Diag(KWLoc, diag::err_default_delete_in_multiple_declaration)
93 }
else if (ExpectAndConsume(tok::semi, diag::err_expected_after,
94 Delete ?
"delete" :
"default")) {
102 trySkippingFunctionBody()) {
113 !(FnD && FnD->getAsFunction() &&
114 FnD->getAsFunction()->getReturnType()->getContainedAutoType()) &&
116 (TemplateInfo.Kind != ParsedTemplateInfo::NonTemplate &&
117 TemplateInfo.Kind != ParsedTemplateInfo::ExplicitSpecialization)) &&
121 LexTemplateFunctionForLateParsing(Toks);
134 LexedMethod* LM =
new LexedMethod(
this, FnD);
135 getCurrentClass().LateParsedDeclarations.push_back(LM);
137 (FnD && isa<FunctionTemplateDecl>(FnD) &&
138 cast<FunctionTemplateDecl>(FnD)->isAbbreviated());
144 if (ConsumeAndStoreFunctionPrologue(Toks)) {
151 delete getCurrentClass().LateParsedDeclarations.back();
152 getCurrentClass().LateParsedDeclarations.pop_back();
156 ConsumeAndStoreUntil(tok::r_brace, Toks,
false);
160 if (kind == tok::kw_try) {
161 while (Tok.
is(tok::kw_catch)) {
162 ConsumeAndStoreUntil(tok::l_brace, Toks,
false);
163 ConsumeAndStoreUntil(tok::r_brace, Toks,
false);
176 delete getCurrentClass().LateParsedDeclarations.back();
177 getCurrentClass().LateParsedDeclarations.pop_back();
187 void Parser::ParseCXXNonStaticMemberInitializer(
Decl *VarD) {
188 assert(Tok.
isOneOf(tok::l_brace, tok::equal) &&
189 "Current token not a '{' or '='!");
191 LateParsedMemberInitializer *MI =
192 new LateParsedMemberInitializer(
this, VarD);
193 getCurrentClass().LateParsedDeclarations.push_back(MI);
197 if (kind == tok::equal) {
202 if (kind == tok::l_brace) {
208 ConsumeAndStoreUntil(tok::r_brace, Toks,
true);
211 ConsumeAndStoreInitializer(Toks, CIK_DefaultInitializer);
224 Parser::LateParsedDeclaration::~LateParsedDeclaration() {}
225 void Parser::LateParsedDeclaration::ParseLexedMethodDeclarations() {}
226 void Parser::LateParsedDeclaration::ParseLexedMemberInitializers() {}
227 void Parser::LateParsedDeclaration::ParseLexedMethodDefs() {}
228 void Parser::LateParsedDeclaration::ParseLexedPragmas() {}
230 Parser::LateParsedClass::LateParsedClass(
Parser *
P, ParsingClass *
C)
231 : Self(P),
Class(C) {}
233 Parser::LateParsedClass::~LateParsedClass() {
234 Self->DeallocateParsedClasses(Class);
237 void Parser::LateParsedClass::ParseLexedMethodDeclarations() {
238 Self->ParseLexedMethodDeclarations(*Class);
241 void Parser::LateParsedClass::ParseLexedMemberInitializers() {
242 Self->ParseLexedMemberInitializers(*Class);
245 void Parser::LateParsedClass::ParseLexedMethodDefs() {
246 Self->ParseLexedMethodDefs(*Class);
249 void Parser::LateParsedClass::ParseLexedPragmas() {
250 Self->ParseLexedPragmas(*Class);
253 void Parser::LateParsedMethodDeclaration::ParseLexedMethodDeclarations() {
254 Self->ParseLexedMethodDeclaration(*
this);
257 void Parser::LexedMethod::ParseLexedMethodDefs() {
258 Self->ParseLexedMethodDef(*
this);
261 void Parser::LateParsedMemberInitializer::ParseLexedMemberInitializers() {
262 Self->ParseLexedMemberInitializer(*
this);
265 void Parser::LateParsedPragma::ParseLexedPragmas() {
266 Self->ParseLexedPragma(*
this);
273 void Parser::ParseLexedMethodDeclarations(ParsingClass &Class) {
274 bool HasTemplateScope = !Class.TopLevelClass && Class.TemplateScope;
277 TemplateParameterDepthRAII CurTemplateDepthTracker(TemplateParameterDepth);
278 if (HasTemplateScope) {
280 ++CurTemplateDepthTracker;
285 bool HasClassScope = !Class.TopLevelClass;
290 Class.TagOrTemplate);
292 for (
size_t i = 0; i < Class.LateParsedDeclarations.size(); ++i) {
293 Class.LateParsedDeclarations[i]->ParseLexedMethodDeclarations();
298 Class.TagOrTemplate);
301 void Parser::ParseLexedMethodDeclaration(LateParsedMethodDeclaration &LM) {
304 TemplateParameterDepthRAII CurTemplateDepthTracker(TemplateParameterDepth);
305 if (LM.TemplateScope) {
307 ++CurTemplateDepthTracker;
316 for (
unsigned I = 0, N = LM.DefaultArgs.size(); I != N; ++I) {
317 auto Param = cast<ParmVarDecl>(LM.DefaultArgs[I].Param);
319 bool HasUnparsed = Param->hasUnparsedDefaultArg();
321 std::unique_ptr<CachedTokens> Toks = std::move(LM.DefaultArgs[I].Toks);
327 Token LastDefaultArgToken = Toks->back();
333 Toks->push_back(DefArgEnd);
336 Toks->push_back(Tok);
337 PP.EnterTokenStream(*Toks,
true,
true);
343 assert(Tok.
is(tok::equal) &&
"Default argument not starting with '='");
354 Diag(Tok, diag::warn_cxx98_compat_generalized_initializer_lists);
355 DefArgResult = ParseBraceInitializer();
366 assert(Toks->size() >= 3 &&
"expected a token in default arg");
369 (*Toks)[Toks->size() - 3].getLocation());
382 }
else if (HasUnparsed) {
383 assert(Param->hasInheritedDefaultArg());
384 FunctionDecl *Old = cast<FunctionDecl>(LM.Method)->getPreviousDecl();
391 Param->setDefaultArg(OldParam->
getInit());
400 Token LastExceptionSpecToken = Toks->back();
401 Token ExceptionSpecEnd;
406 Toks->push_back(ExceptionSpecEnd);
409 Toks->push_back(Tok);
410 PP.EnterTokenStream(*Toks,
true,
true);
423 = dyn_cast<FunctionTemplateDecl>(LM.Method))
424 Method = cast<CXXMethodDecl>(FunTmpl->getTemplatedDecl());
426 Method = cast<CXXMethodDecl>(LM.Method);
429 Method->getMethodQualifiers(),
440 = tryParseExceptionSpecification(
false, SpecificationRange,
442 DynamicExceptionRanges, NoexceptExpr,
443 ExceptionSpecTokens);
452 DynamicExceptionRanges,
454 NoexceptExpr.
get() :
nullptr);
466 LM.ExceptionSpecTokens =
nullptr;
469 PrototypeScope.Exit();
478 void Parser::ParseLexedMethodDefs(ParsingClass &Class) {
479 bool HasTemplateScope = !Class.TopLevelClass && Class.TemplateScope;
481 TemplateParameterDepthRAII CurTemplateDepthTracker(TemplateParameterDepth);
482 if (HasTemplateScope) {
484 ++CurTemplateDepthTracker;
486 bool HasClassScope = !Class.TopLevelClass;
490 for (
size_t i = 0; i < Class.LateParsedDeclarations.size(); ++i) {
491 Class.LateParsedDeclarations[i]->ParseLexedMethodDefs();
495 void Parser::ParseLexedMethodDef(LexedMethod &LM) {
498 TemplateParameterDepthRAII CurTemplateDepthTracker(TemplateParameterDepth);
499 if (LM.TemplateScope) {
501 ++CurTemplateDepthTracker;
506 assert(!LM.Toks.empty() &&
"Empty body!");
507 Token LastBodyToken = LM.Toks.back();
513 LM.Toks.push_back(BodyEnd);
516 LM.Toks.push_back(Tok);
517 PP.EnterTokenStream(LM.Toks,
true,
true);
521 assert(Tok.
isOneOf(tok::l_brace, tok::colon, tok::kw_try)
522 &&
"Inline method not starting with '{', ':' or 'try'");
530 if (Tok.
is(tok::kw_try)) {
531 ParseFunctionTryBlock(LM.D, FnScope);
540 if (Tok.
is(tok::colon)) {
541 ParseConstructorInitializer(LM.D);
544 if (!Tok.
is(tok::l_brace)) {
559 !isa<FunctionTemplateDecl>(LM.D) ||
560 cast<FunctionTemplateDecl>(LM.D)->getTemplateParameters()->getDepth()
561 < TemplateParameterDepth) &&
562 "TemplateParameterDepth should be greater than the depth of " 563 "current template being instantiated!");
565 ParseFunctionStatementBody(LM.D, FnScope);
573 if (
auto *FD = dyn_cast_or_null<FunctionDecl>(LM.D))
574 if (isa<CXXMethodDecl>(FD) ||
582 void Parser::ParseLexedMemberInitializers(ParsingClass &Class) {
583 bool HasTemplateScope = !Class.TopLevelClass && Class.TemplateScope;
586 TemplateParameterDepthRAII CurTemplateDepthTracker(TemplateParameterDepth);
587 if (HasTemplateScope) {
589 ++CurTemplateDepthTracker;
592 bool AlreadyHasClassScope = Class.TopLevelClass;
594 ParseScope ClassScope(
this, ScopeFlags, !AlreadyHasClassScope);
595 ParseScopeFlags ClassScopeFlags(
this, ScopeFlags, AlreadyHasClassScope);
597 if (!AlreadyHasClassScope)
599 Class.TagOrTemplate);
601 if (!Class.LateParsedDeclarations.empty()) {
610 for (
size_t i = 0; i < Class.LateParsedDeclarations.size(); ++i) {
611 Class.LateParsedDeclarations[i]->ParseLexedMemberInitializers();
615 if (!AlreadyHasClassScope)
617 Class.TagOrTemplate);
622 void Parser::ParseLexedMemberInitializer(LateParsedMemberInitializer &MI) {
623 if (!MI.Field || MI.Field->isInvalidDecl())
630 MI.Toks.push_back(Tok);
631 PP.EnterTokenStream(MI.Toks,
true,
true);
640 ExprResult Init = ParseCXXMemberInitializer(MI.Field,
false,
653 Diag(EndLoc, diag::err_expected_semi_decl_list);
665 void Parser::ParseLexedPragmas(ParsingClass &Class) {
666 bool HasTemplateScope = !Class.TopLevelClass && Class.TemplateScope;
669 TemplateParameterDepthRAII CurTemplateDepthTracker(TemplateParameterDepth);
670 if (HasTemplateScope) {
672 ++CurTemplateDepthTracker;
674 bool HasClassScope = !Class.TopLevelClass;
678 for (LateParsedDeclaration *LPD : Class.LateParsedDeclarations)
679 LPD->ParseLexedPragmas();
682 void Parser::ParseLexedPragma(LateParsedPragma &LP) {
684 PP.EnterTokenStream(LP.toks(),
true,
689 assert(Tok.
isAnnotation() &&
"Expected annotation token.");
691 case tok::annot_pragma_openmp: {
693 ParsedAttributesWithRange Attrs(AttrFactory);
694 (void)ParseOpenMPDeclarativeDirectiveWithExtDecl(AS, Attrs);
698 llvm_unreachable(
"Unexpected token.");
713 bool isFirstTokenConsumed =
true;
716 if (Tok.
is(T1) || Tok.
is(T2)) {
717 if (ConsumeFinalToken) {
726 case tok::annot_module_begin:
727 case tok::annot_module_end:
728 case tok::annot_module_include:
736 ConsumeAndStoreUntil(tok::r_paren, Toks,
false);
742 ConsumeAndStoreUntil(tok::r_square, Toks,
false);
748 ConsumeAndStoreUntil(tok::r_brace, Toks,
false);
757 if (ParenCount && !isFirstTokenConsumed)
763 if (BracketCount && !isFirstTokenConsumed)
769 if (BraceCount && !isFirstTokenConsumed)
785 isFirstTokenConsumed =
false;
795 bool Parser::ConsumeAndStoreFunctionPrologue(
CachedTokens &Toks) {
796 if (Tok.
is(tok::kw_try)) {
801 if (Tok.
isNot(tok::colon)) {
807 ConsumeAndStoreUntil(tok::l_brace, tok::r_brace, Toks,
810 if (Tok.
isNot(tok::l_brace))
831 bool MightBeTemplateArgument =
false;
835 if (Tok.
is(tok::kw_decltype)) {
838 if (Tok.
isNot(tok::l_paren))
843 if (!ConsumeAndStoreUntil(tok::r_paren, Toks,
true)) {
845 Diag(OpenLoc, diag::note_matching) << tok::l_paren;
851 if (Tok.
is(tok::coloncolon)) {
855 if (Tok.
is(tok::kw_template)) {
861 if (Tok.
is(tok::identifier)) {
867 }
while (Tok.
is(tok::coloncolon));
869 if (Tok.
is(tok::code_completion)) {
871 ConsumeCodeCompletionToken();
872 if (Tok.
isOneOf(tok::identifier, tok::coloncolon, tok::kw_decltype)) {
879 if (Tok.
is(tok::comma)) {
885 if (Tok.
is(tok::less))
886 MightBeTemplateArgument =
true;
888 if (MightBeTemplateArgument) {
895 if (!ConsumeAndStoreUntil(tok::l_paren, tok::l_brace, Toks,
902 }
else if (Tok.
isNot(tok::l_paren) && Tok.
isNot(tok::l_brace)) {
906 << tok::l_paren << tok::l_brace;
913 bool IsLParen = (kind == tok::l_paren);
919 assert(kind == tok::l_brace &&
"Must be left paren or brace here.");
926 const Token &PreviousToken = Toks[Toks.size() - 2];
927 if (!MightBeTemplateArgument &&
928 !PreviousToken.
isOneOf(tok::identifier, tok::greater,
929 tok::greatergreater)) {
935 TentativeParsingAction PA(*
this);
937 !Tok.
isOneOf(tok::comma, tok::ellipsis, tok::l_brace)) {
950 tok::TokenKind CloseKind = IsLParen ? tok::r_paren : tok::r_brace;
951 if (!ConsumeAndStoreUntil(CloseKind, Toks,
true)) {
952 Diag(Tok, diag::err_expected) << CloseKind;
953 Diag(OpenLoc, diag::note_matching) <<
kind;
958 if (Tok.
is(tok::ellipsis)) {
965 if (Tok.
is(tok::comma)) {
968 }
else if (Tok.
is(tok::l_brace)) {
986 }
else if (!MightBeTemplateArgument) {
987 return Diag(Tok.
getLocation(), diag::err_expected_either) << tok::l_brace
995 bool Parser::ConsumeAndStoreConditional(
CachedTokens &Toks) {
997 assert(Tok.
is(tok::question));
1001 while (Tok.
isNot(tok::colon)) {
1002 if (!ConsumeAndStoreUntil(tok::question, tok::colon, Toks,
1008 if (Tok.
is(tok::question) && !ConsumeAndStoreConditional(Toks))
1013 Toks.push_back(Tok);
1023 : TentativeParsingAction(Self), Self(Self), EndKind(EndKind) {
1026 TentativeParsingAction Inner(Self);
1027 Self.ConsumeAndStoreUntil(EndKind, Toks,
true,
false);
1037 auto Buffer = std::make_unique<Token[]>(Toks.size());
1038 std::copy(Toks.begin() + 1, Toks.end(), Buffer.get());
1039 Buffer[Toks.size() - 1] = Self.Tok;
1040 Self.PP.EnterTokenStream(std::move(Buffer), Toks.size(),
true,
1043 Self.Tok = Toks.front();
1059 bool Parser::ConsumeAndStoreInitializer(
CachedTokens &Toks,
1060 CachedInitKind CIK) {
1062 bool IsFirstToken =
true;
1067 unsigned AngleCount = 0;
1068 unsigned KnownTemplateCount = 0;
1071 switch (Tok.getKind()) {
1077 if (KnownTemplateCount)
1091 CIK == CIK_DefaultInitializer
1092 ? tok::semi : tok::r_paren);
1095 TPResult
Result = TPResult::Error;
1098 case CIK_DefaultInitializer:
1099 Result = TryParseInitDeclaratorList();
1102 if (Result == TPResult::Ambiguous && Tok.
isNot(tok::semi))
1103 Result = TPResult::False;
1106 case CIK_DefaultArgument:
1107 bool InvalidAsDeclaration =
false;
1108 Result = TryParseParameterDeclarationClause(
1109 &InvalidAsDeclaration,
true);
1112 if (Result == TPResult::Ambiguous && InvalidAsDeclaration)
1113 Result = TPResult::False;
1118 if (Result != TPResult::False && Result != TPResult::Error) {
1131 ++KnownTemplateCount;
1135 case tok::annot_module_begin:
1136 case tok::annot_module_end:
1137 case tok::annot_module_include:
1150 if (!ConsumeAndStoreConditional(Toks))
1154 case tok::greatergreatergreater:
1157 if (AngleCount) --AngleCount;
1158 if (KnownTemplateCount) --KnownTemplateCount;
1160 case tok::greatergreater:
1163 if (AngleCount) --AngleCount;
1164 if (KnownTemplateCount) --KnownTemplateCount;
1167 if (AngleCount) --AngleCount;
1168 if (KnownTemplateCount) --KnownTemplateCount;
1171 case tok::kw_template:
1175 Toks.push_back(Tok);
1177 if (Tok.
is(tok::identifier)) {
1178 Toks.push_back(Tok);
1180 if (Tok.
is(tok::less)) {
1182 ++KnownTemplateCount;
1183 Toks.push_back(Tok);
1189 case tok::kw_operator:
1192 Toks.push_back(Tok);
1194 switch (Tok.getKind()) {
1196 case tok::greatergreatergreater:
1197 case tok::greatergreater:
1200 Toks.push_back(Tok);
1210 Toks.push_back(Tok);
1212 ConsumeAndStoreUntil(tok::r_paren, Toks,
false);
1216 Toks.push_back(Tok);
1218 ConsumeAndStoreUntil(tok::r_square, Toks,
false);
1222 Toks.push_back(Tok);
1224 ConsumeAndStoreUntil(tok::r_brace, Toks,
false);
1234 if (CIK == CIK_DefaultArgument)
1236 if (ParenCount && !IsFirstToken)
1238 Toks.push_back(Tok);
1242 if (BracketCount && !IsFirstToken)
1244 Toks.push_back(Tok);
1248 if (BraceCount && !IsFirstToken)
1250 Toks.push_back(Tok);
1254 case tok::code_completion:
1255 Toks.push_back(Tok);
1256 ConsumeCodeCompletionToken();
1259 case tok::string_literal:
1260 case tok::wide_string_literal:
1261 case tok::utf8_string_literal:
1262 case tok::utf16_string_literal:
1263 case tok::utf32_string_literal:
1264 Toks.push_back(Tok);
1265 ConsumeStringToken();
1268 if (CIK == CIK_DefaultInitializer)
1273 Toks.push_back(Tok);
1277 IsFirstToken =
false;
void ActOnFinishDelayedMemberInitializers(Decl *Record)
Represents a function declaration or definition.
bool hasErrorOccurred() const
SourceLocation getLocWithOffset(int Offset) const
Return a source location with the specified offset from this SourceLocation.
This is a scope that corresponds to the parameters within a function prototype.
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)) {...
void ActOnStartDelayedCXXMethodDeclaration(Scope *S, Decl *Method)
ActOnStartDelayedCXXMethodDeclaration - We have completed parsing a top-level (non-nested) C++ class...
Decl - This represents one declaration (or definition), e.g.
void ProcessDeclAttributeList(Scope *S, Decl *D, const ParsedAttributesView &AL, bool IncludeCXX11Attributes=true)
Defines the C++ template declaration subclasses.
bool isTemplateParamScope() const
isTemplateParamScope - Return true if this scope is a C++ template parameter scope.
This indicates that the scope corresponds to a function, which means that labels are set here...
void ActOnFinishDelayedCXXMethodDeclaration(Scope *S, Decl *Method)
ActOnFinishDelayedCXXMethodDeclaration - We have finished processing the delayed method declaration f...
bool isFunctionDeclarator(unsigned &idx) const
isFunctionDeclarator - This method returns true if the declarator is a function declarator (looking t...
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 ActOnStartDelayedMemberDeclarations(Scope *S, Decl *Record)
RAII object used to temporarily allow the C++ 'this' expression to be used, with the given qualifiers...
RAII object that makes sure paren/bracket/brace count is correct after declaration/statement parsing...
bool canSkipFunctionBody(Decl *D)
Determine whether we can skip parsing the body of a function definition, assuming we don't care about...
bool isAnnotation() const
Return true if this is any of tok::annot_* kind tokens.
Represents a parameter to a function.
void MarkAsLateParsedTemplate(FunctionDecl *FD, Decl *FnD, CachedTokens &Toks)
tok::TokenKind getKind() 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 ...
The collection of all-type qualifiers we support.
Decl * ActOnStartOfFunctionDef(Scope *S, Declarator &D, MultiTemplateParamsArg TemplateParamLists, SkipBodyInfo *SkipBody=nullptr)
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)
void setUninstantiatedDefaultArg(Expr *arg)
This declaration is a friend function.
Token - This structure provides full information about a lexed token.
bool isInIdentifierNamespace(unsigned NS) const
void setKind(tok::TokenKind K)
RAII class used to indicate that we are performing provisional semantic analysis to determine the val...
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...
const ParsingDeclSpec & getDeclSpec() const
Scope - A scope is a transient data structure that is used while parsing the program.
bool hasUnparsedDefaultArg() const
Determines whether this parameter has a default argument that has not yet been parsed.
SourceLocation ConsumeAnyToken(bool ConsumeCodeCompletionTok=false)
ConsumeAnyToken - Dispatch to the right Consume* method based on the current token type...
Decl * ActOnFinishFunctionBody(Decl *Decl, Stmt *Body)
DiagnosticsEngine & getDiagnostics() const
bool hasConstexprSpecifier() const
A class for parsing a declarator.
UnannotatedTentativeParsingAction(Parser &Self, tok::TokenKind EndKind)
The current expression is potentially evaluated, but any declarations referenced inside that expressi...
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...
void setEofData(const void *D)
SourceLocation getLocation() const
Return a source location identifier for the specified offset in the current file. ...
void ActOnFinishCXXInClassMemberInitializer(Decl *VarDecl, SourceLocation EqualLoc, Expr *Init)
This is invoked after parsing an in-class initializer for a non-static C++ class member, and after instantiating an in-class initializer in a class template.
void ActOnDelayedCXXMethodParameter(Scope *S, Decl *Param)
ActOnDelayedCXXMethodParameter - We've already started a delayed C++ method declaration.
This is a compound statement scope.
void SetDeclDeleted(Decl *dcl, SourceLocation DelLoc)
bool isDependentContext() const
Determines whether this context is dependent on a template parameter.
bool isFriendSpecified() const
The result type of a method or function.
const LangOptions & getLangOpts() const
This is a scope that corresponds to the parameters within a function prototype for a function declara...
void CheckForFunctionRedefinition(FunctionDecl *FD, const FunctionDecl *EffectiveDefinition=nullptr, SkipBodyInfo *SkipBody=nullptr)
Decl * ActOnSkippedFunctionBody(Decl *Decl)
void ActOnStartCXXInClassMemberInitializer()
Enter a new C++ default initializer scope.
Stop skipping at semicolon.
ActionResult - This structure is used while parsing/acting on expressions, stmts, etc...
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 ActOnFinishDelayedMemberDeclarations(Scope *S, Decl *Record)
FunctionDefinitionKind getFunctionDefinitionKind() const
Represents a static or instance method of a struct/union/class.
void SetDeclDefaulted(Decl *dcl, SourceLocation DefaultLoc)
A tentative parsing action that can also revert token annotations.
const void * getEofData() const
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).
TokenKind
Provides a simple uniform namespace for tokens from all C languages.
Represents a C++11 virt-specifier-seq.
void EnterToken(const Token &Tok, bool IsReinject)
Enters a token in the token stream to be lexed next.
bool hasUninstantiatedDefaultArg() const
Scope * getCurScope() const
void ActOnFinishInlineFunctionDef(FunctionDecl *D)
The scope of a struct/union/class definition.
bool isNot(tok::TokenKind K) const
Dataflow Directional Tag Classes.
bool isValid() const
Return true if this is a valid SourceLocation object.
void ActOnParamDefaultArgument(Decl *param, SourceLocation EqualLoc, Expr *defarg)
ActOnParamDefaultArgument - Check whether the default argument provided for a function parameter is w...
const Expr * getInit() const
This is a scope that corresponds to the template parameters of a C++ template.
void setWillHaveBody(bool V=true)
bool isOneOf(tok::TokenKind K1, tok::TokenKind K2) const
Expr * getUninstantiatedDefaultArg()
DiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID)
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.
ExprResult ParseAssignmentExpression(TypeCastState isTypeCast=NotTypeCast)
Parse an expr that doesn't include (top-level) commas.
ExceptionSpecificationType
The various types of exception specifications that exist in C++11.
This is a scope that can contain a declaration.
void ActOnParamDefaultArgumentError(Decl *param, SourceLocation EqualLoc)
ActOnParamDefaultArgumentError - Parsing or semantic analysis of the default argument for the paramet...
SourceLocation ConsumeToken()
ConsumeToken - Consume the current 'peek token' and lex the next one.
void ActOnPureSpecifier(Decl *D, SourceLocation PureSpecLoc)
DeclContext * CurContext
CurContext - This is the current declaration context of parsing.
unsigned kind
All of the diagnostics that can be emitted by the frontend.
void setLocation(SourceLocation L)
A trivial tuple used to represent a source range.
This represents a decl that may have a name.
ParsedAttributes - A collection of parsed attributes.
Declaration of a template function.
bool IsInsideALocalClassWithinATemplateFunction()
void startToken()
Reset all flags to cleared.
Stop skipping at specified token, but don't skip the token itself.
NamedDecl * ActOnFriendFunctionDecl(Scope *S, Declarator &D, MultiTemplateParamsArg TemplateParams)
unsigned ActOnReenterTemplateScope(Scope *S, Decl *Template)
SourceLocation getEndLoc() const