13#ifndef LLVM_CLANG_PARSE_PARSER_H
14#define LLVM_CLANG_PARSE_PARSER_H
20#include "llvm/ADT/SmallVector.h"
21#include "llvm/Frontend/OpenMP/OMPContext.h"
22#include "llvm/Support/SaveAndRestore.h"
29 class BalancedDelimiterTracker;
30 class CorrectionCandidateCallback;
32 class DiagnosticBuilder;
35 class ParsingDeclRAIIObject;
36 class ParsingDeclSpec;
37 class ParsingDeclarator;
38 class ParsingFieldDeclarator;
39 class ColonProtectionRAIIObject;
40 class InMessageExpressionRAIIObject;
41 class PoisonSEHIdentifiersRAIIObject;
43 class ObjCTypeParamList;
44 struct OMPTraitProperty;
45 struct OMPTraitSelector;
79 unsigned short ParenCount = 0, BracketCount = 0, BraceCount = 0;
80 unsigned short MisplacedModuleBeginCount = 0;
89 enum { ScopeCacheSize = 16 };
90 unsigned NumCachedScopes;
91 Scope *ScopeCache[ScopeCacheSize];
97 *Ident___exception_code,
98 *Ident_GetExceptionCode;
101 *Ident___exception_info,
102 *Ident_GetExceptionInfo;
105 *Ident___abnormal_termination,
106 *Ident_AbnormalTermination;
152 *Ident_generated_declaration, *Ident_USR;
165 llvm::SmallDenseMap<IdentifierInfo *, tok::TokenKind> RevertibleTypeTraits;
167 std::unique_ptr<PragmaHandler> AlignHandler;
168 std::unique_ptr<PragmaHandler> GCCVisibilityHandler;
169 std::unique_ptr<PragmaHandler> OptionsHandler;
170 std::unique_ptr<PragmaHandler> PackHandler;
171 std::unique_ptr<PragmaHandler> MSStructHandler;
172 std::unique_ptr<PragmaHandler> UnusedHandler;
173 std::unique_ptr<PragmaHandler> WeakHandler;
174 std::unique_ptr<PragmaHandler> RedefineExtnameHandler;
175 std::unique_ptr<PragmaHandler> FPContractHandler;
176 std::unique_ptr<PragmaHandler> OpenCLExtensionHandler;
177 std::unique_ptr<PragmaHandler> OpenMPHandler;
178 std::unique_ptr<PragmaHandler> PCSectionHandler;
179 std::unique_ptr<PragmaHandler> MSCommentHandler;
180 std::unique_ptr<PragmaHandler> MSDetectMismatchHandler;
181 std::unique_ptr<PragmaHandler> FPEvalMethodHandler;
182 std::unique_ptr<PragmaHandler> FloatControlHandler;
183 std::unique_ptr<PragmaHandler> MSPointersToMembers;
184 std::unique_ptr<PragmaHandler> MSVtorDisp;
185 std::unique_ptr<PragmaHandler> MSInitSeg;
186 std::unique_ptr<PragmaHandler> MSDataSeg;
187 std::unique_ptr<PragmaHandler> MSBSSSeg;
188 std::unique_ptr<PragmaHandler> MSConstSeg;
189 std::unique_ptr<PragmaHandler> MSCodeSeg;
190 std::unique_ptr<PragmaHandler> MSSection;
191 std::unique_ptr<PragmaHandler> MSStrictGuardStackCheck;
192 std::unique_ptr<PragmaHandler> MSRuntimeChecks;
193 std::unique_ptr<PragmaHandler> MSIntrinsic;
194 std::unique_ptr<PragmaHandler> MSFunction;
195 std::unique_ptr<PragmaHandler> MSOptimize;
196 std::unique_ptr<PragmaHandler> MSFenvAccess;
197 std::unique_ptr<PragmaHandler> MSAllocText;
198 std::unique_ptr<PragmaHandler> CUDAForceHostDeviceHandler;
199 std::unique_ptr<PragmaHandler> OptimizeHandler;
200 std::unique_ptr<PragmaHandler> LoopHintHandler;
201 std::unique_ptr<PragmaHandler> UnrollHintHandler;
202 std::unique_ptr<PragmaHandler> NoUnrollHintHandler;
203 std::unique_ptr<PragmaHandler> UnrollAndJamHintHandler;
204 std::unique_ptr<PragmaHandler> NoUnrollAndJamHintHandler;
205 std::unique_ptr<PragmaHandler> FPHandler;
206 std::unique_ptr<PragmaHandler> STDCFenvAccessHandler;
207 std::unique_ptr<PragmaHandler> STDCFenvRoundHandler;
208 std::unique_ptr<PragmaHandler> STDCCXLIMITHandler;
209 std::unique_ptr<PragmaHandler> STDCUnknownHandler;
210 std::unique_ptr<PragmaHandler> AttributePragmaHandler;
211 std::unique_ptr<PragmaHandler> MaxTokensHerePragmaHandler;
212 std::unique_ptr<PragmaHandler> MaxTokensTotalPragmaHandler;
213 std::unique_ptr<PragmaHandler> RISCVPragmaHandler;
215 std::unique_ptr<CommentHandler> CommentSemaHandler;
221 bool GreaterThanIsOperator;
230 bool OpenMPDirectiveParsing =
false;
237 bool InMessageExpression;
242 bool CalledSignatureHelp =
false;
247 unsigned TemplateParameterDepth;
253 class TemplateParameterDepthRAII {
255 unsigned AddedLevels;
257 explicit TemplateParameterDepthRAII(
unsigned &Depth)
258 : Depth(Depth), AddedLevels(0) {}
260 ~TemplateParameterDepthRAII() {
261 Depth -= AddedLevels;
268 void addDepth(
unsigned D) {
272 void setAddedDepth(
unsigned D) {
273 Depth = Depth - AddedLevels + D;
277 unsigned getDepth()
const {
return Depth; }
278 unsigned getOriginalDepth()
const {
return Depth - AddedLevels; }
282 AttributeFactory AttrFactory;
286 SmallVector<TemplateIdAnnotation *, 16> TemplateIds;
288 void MaybeDestroyTemplateIds() {
289 if (!TemplateIds.empty() &&
291 DestroyTemplateIds();
293 void DestroyTemplateIds();
297 struct DestroyTemplateIdAnnotationsRAIIObj {
300 DestroyTemplateIdAnnotationsRAIIObj(Parser &Self) : Self(Self) {}
301 ~DestroyTemplateIdAnnotationsRAIIObj() { Self.MaybeDestroyTemplateIds(); }
305 SmallVector<IdentifierInfo *, 8> TentativelyDeclaredIdentifiers;
317 struct AngleBracketTracker {
327 SpaceBeforeLess = 0x0,
329 NoSpaceBeforeLess = 0x1,
360 if (!Locs.empty() && Locs.back().isActive(
P)) {
361 if (Locs.back().Priority <= Prio) {
363 Locs.back().LessLoc = LessLoc;
364 Locs.back().Priority = Prio;
367 Locs.push_back({TemplateName, LessLoc, Prio,
368 P.ParenCount,
P.BracketCount,
P.BraceCount});
375 void clear(Parser &
P) {
376 while (!Locs.empty() && Locs.back().isActiveOrNested(
P))
382 Loc *getCurrent(Parser &
P) {
383 if (!Locs.empty() && Locs.back().isActive(
P))
389 AngleBracketTracker AngleBrackets;
391 IdentifierInfo *getSEHExceptKeyword();
398 bool ParsingInObjCContainer;
404 bool SkipFunctionBodies;
409 SourceLocation ExprStatementTokLoc;
412 enum class ParsedStmtContext {
415 AllowDeclarationsInC = 0x1,
417 AllowStandaloneOpenMPDirectives = 0x2,
424 Compound = AllowDeclarationsInC | AllowStandaloneOpenMPDirectives,
435 Parser(Preprocessor &PP, Sema &Actions,
bool SkipFunctionBodies);
492 assert(!isTokenSpecial() &&
493 "Should consume special tokens with Consume*Token");
496 return PrevTokLocation;
502 assert(!isTokenSpecial() &&
503 "Should consume special tokens with Consume*Token");
512 Loc = PrevTokLocation;
521 return ConsumeParen();
522 if (isTokenBracket())
523 return ConsumeBracket();
525 return ConsumeBrace();
526 if (isTokenStringLiteral())
527 return ConsumeStringToken();
528 if (Tok.
is(tok::code_completion))
529 return ConsumeCodeCompletionTok ? ConsumeCodeCompletionToken()
530 : handleUnexpectedCodeCompletionToken();
532 return ConsumeAnnotationToken();
553 bool isTokenParen()
const {
554 return Tok.
isOneOf(tok::l_paren, tok::r_paren);
557 bool isTokenBracket()
const {
558 return Tok.
isOneOf(tok::l_square, tok::r_square);
561 bool isTokenBrace()
const {
562 return Tok.
isOneOf(tok::l_brace, tok::r_brace);
565 bool isTokenStringLiteral()
const {
569 bool isTokenSpecial()
const {
570 return isTokenStringLiteral() || isTokenParen() || isTokenBracket() ||
571 isTokenBrace() || Tok.
is(tok::code_completion) || Tok.
isAnnotation();
576 bool isTokenEqualOrEqualTypo();
580 void UnconsumeToken(Token &Consumed) {
587 SourceLocation ConsumeAnnotationToken() {
597 SourceLocation ConsumeParen() {
598 assert(isTokenParen() &&
"wrong consume method");
599 if (Tok.
getKind() == tok::l_paren)
601 else if (ParenCount) {
602 AngleBrackets.clear(*
this);
607 return PrevTokLocation;
612 SourceLocation ConsumeBracket() {
613 assert(isTokenBracket() &&
"wrong consume method");
614 if (Tok.
getKind() == tok::l_square)
616 else if (BracketCount) {
617 AngleBrackets.clear(*
this);
623 return PrevTokLocation;
628 SourceLocation ConsumeBrace() {
629 assert(isTokenBrace() &&
"wrong consume method");
630 if (Tok.
getKind() == tok::l_brace)
632 else if (BraceCount) {
633 AngleBrackets.clear(*
this);
639 return PrevTokLocation;
646 SourceLocation ConsumeStringToken() {
647 assert(isTokenStringLiteral() &&
648 "Should only consume string literals with this method");
651 return PrevTokLocation;
659 SourceLocation ConsumeCodeCompletionToken() {
660 assert(Tok.
is(tok::code_completion));
663 return PrevTokLocation;
671 SourceLocation handleUnexpectedCodeCompletionToken();
675 void cutOffParsing() {
686 return Kind == tok::eof ||
Kind == tok::annot_module_begin ||
687 Kind == tok::annot_module_end ||
Kind == tok::annot_module_include ||
688 Kind == tok::annot_repl_input_end;
698 void initializePragmaHandlers();
701 void resetPragmaHandlers();
704 void HandlePragmaUnused();
708 void HandlePragmaVisibility();
712 void HandlePragmaPack();
716 void HandlePragmaMSStruct();
718 void HandlePragmaMSPointersToMembers();
720 void HandlePragmaMSVtorDisp();
722 void HandlePragmaMSPragma();
723 bool HandlePragmaMSSection(StringRef PragmaName,
724 SourceLocation PragmaLocation);
725 bool HandlePragmaMSSegment(StringRef PragmaName,
726 SourceLocation PragmaLocation);
727 bool HandlePragmaMSInitSeg(StringRef PragmaName,
728 SourceLocation PragmaLocation);
729 bool HandlePragmaMSStrictGuardStackCheck(StringRef PragmaName,
730 SourceLocation PragmaLocation);
731 bool HandlePragmaMSFunction(StringRef PragmaName,
732 SourceLocation PragmaLocation);
733 bool HandlePragmaMSAllocText(StringRef PragmaName,
734 SourceLocation PragmaLocation);
735 bool HandlePragmaMSOptimize(StringRef PragmaName,
736 SourceLocation PragmaLocation);
740 void HandlePragmaAlign();
744 void HandlePragmaDump();
748 void HandlePragmaWeak();
752 void HandlePragmaWeakAlias();
756 void HandlePragmaRedefineExtname();
760 void HandlePragmaFPContract();
764 void HandlePragmaFEnvAccess();
768 void HandlePragmaFEnvRound();
772 void HandlePragmaFloatControl();
776 void HandlePragmaFP();
780 void HandlePragmaOpenCLExtension();
788 bool HandlePragmaLoopHint(LoopHint &Hint);
790 bool ParsePragmaAttributeSubjectMatchRuleSet(
792 SourceLocation &AnyLoc, SourceLocation &LastMatchRuleEndLoc);
794 void HandlePragmaAttribute();
803 const Token &GetLookAheadToken(
unsigned N) {
804 if (N == 0 || Tok.
is(tok::eof))
return Tok;
825 "produced a valid-but-null type annotation?");
829 static NamedDecl *getNonTypeAnnotation(
const Token &Tok) {
830 return static_cast<NamedDecl*
>(Tok.getAnnotationValue());
833 static void setNonTypeAnnotation(Token &Tok, NamedDecl *ND) {
834 Tok.setAnnotationValue(ND);
837 static IdentifierInfo *getIdentifierAnnotation(
const Token &Tok) {
838 return static_cast<IdentifierInfo*
>(Tok.getAnnotationValue());
841 static void setIdentifierAnnotation(Token &Tok, IdentifierInfo *ND) {
842 Tok.setAnnotationValue(ND);
847 static ExprResult getExprAnnotation(
const Token &Tok) {
848 return ExprResult::getFromOpaquePointer(Tok.getAnnotationValue());
853 static void setExprAnnotation(Token &Tok,
ExprResult ER) {
854 Tok.setAnnotationValue(ER.getAsOpaquePointer());
864 CXXScopeSpec &SS,
bool IsNewScope,
870 (Tok.is(tok::identifier) || Tok.is(tok::coloncolon) ||
871 (Tok.is(tok::annot_template_id) &&
873 Tok.is(tok::kw_decltype) || Tok.is(tok::kw___super));
880 enum AnnotatedNameKind {
894 TryAnnotateName(CorrectionCandidateCallback *CCC =
nullptr,
899 void AnnotateScopeToken(CXXScopeSpec &SS,
bool IsNewAnnotation);
904 bool TryAltiVecToken(DeclSpec &DS, SourceLocation Loc,
905 const char *&PrevSpec,
unsigned &DiagID,
910 if (Tok.getIdentifierInfo() != Ident_vector &&
911 Tok.getIdentifierInfo() != Ident_bool &&
912 Tok.getIdentifierInfo() != Ident_Bool &&
913 (!
getLangOpts().AltiVec || Tok.getIdentifierInfo() != Ident_pixel))
916 return TryAltiVecTokenOutOfLine(DS, Loc, PrevSpec, DiagID,
isInvalid);
922 bool TryAltiVecVectorToken() {
924 Tok.getIdentifierInfo() != Ident_vector)
return false;
925 return TryAltiVecVectorTokenOutOfLine();
928 bool TryAltiVecVectorTokenOutOfLine();
929 bool TryAltiVecTokenOutOfLine(DeclSpec &DS, SourceLocation Loc,
930 const char *&PrevSpec,
unsigned &DiagID,
936 bool isObjCInstancetype() {
938 if (Tok.isAnnotation())
940 if (!Ident_instancetype)
942 return Tok.getIdentifierInfo() == Ident_instancetype;
950 bool TryKeywordIdentFallback(
bool DisableKeyword);
953 TemplateIdAnnotation *takeTemplateIdAnnotation(
const Token &tok);
966 class TentativeParsingAction {
968 PreferredTypeBuilder PrevPreferredType;
970 size_t PrevTentativelyDeclaredIdentifierCount;
971 unsigned short PrevParenCount, PrevBracketCount, PrevBraceCount;
975 explicit TentativeParsingAction(Parser &p)
976 :
P(p), PrevPreferredType(
P.PreferredType) {
978 PrevTentativelyDeclaredIdentifierCount =
979 P.TentativelyDeclaredIdentifiers.size();
980 PrevParenCount =
P.ParenCount;
981 PrevBracketCount =
P.BracketCount;
982 PrevBraceCount =
P.BraceCount;
983 P.PP.EnableBacktrackAtThisPos();
987 assert(isActive &&
"Parsing action was finished!");
988 P.TentativelyDeclaredIdentifiers.resize(
989 PrevTentativelyDeclaredIdentifierCount);
990 P.PP.CommitBacktrackedTokens();
994 assert(isActive &&
"Parsing action was finished!");
996 P.PreferredType = PrevPreferredType;
998 P.TentativelyDeclaredIdentifiers.resize(
999 PrevTentativelyDeclaredIdentifierCount);
1000 P.ParenCount = PrevParenCount;
1001 P.BracketCount = PrevBracketCount;
1002 P.BraceCount = PrevBraceCount;
1005 ~TentativeParsingAction() {
1006 assert(!isActive &&
"Forgot to call Commit or Revert!");
1011 class RevertingTentativeParsingAction
1012 :
private Parser::TentativeParsingAction {
1014 RevertingTentativeParsingAction(Parser &P)
1015 : Parser::TentativeParsingAction(
P) {}
1016 ~RevertingTentativeParsingAction() { Revert(); }
1019 class UnannotatedTentativeParsingAction;
1026 ObjCContainerDecl *DC;
1027 SaveAndRestore<bool> WithinObjCContainer;
1029 explicit ObjCDeclContextSwitch(Parser &p)
1031 WithinObjCContainer(
P.ParsingInObjCContainer, DC != nullptr) {
1033 P.Actions.ActOnObjCTemporaryExitContainerContext(DC);
1035 ~ObjCDeclContextSwitch() {
1037 P.Actions.ActOnObjCReenterContainerContext(DC);
1050 unsigned Diag = diag::err_expected,
1051 StringRef DiagMsg =
"");
1058 bool ExpectAndConsumeSemi(
unsigned DiagID , StringRef TokenUsed =
"");
1061 enum ExtraSemiKind {
1062 OutsideFunction = 0,
1064 InstanceVariableList = 2,
1065 AfterMemberFunctionDefinition = 3
1077 bool expectIdentifier();
1080 enum class CompoundToken {
1095 void checkCompoundToken(SourceLocation FirstTokLoc,
1118 bool BeforeCompoundStmt =
false)
1120 if (EnteredScope && !BeforeCompoundStmt)
1123 if (BeforeCompoundStmt)
1126 this->Self =
nullptr;
1148 unsigned NumScopes = 0;
1180 class ParseScopeFlags {
1182 unsigned OldFlags = 0;
1183 ParseScopeFlags(
const ParseScopeFlags &) =
delete;
1184 void operator=(
const ParseScopeFlags &) =
delete;
1187 ParseScopeFlags(
Parser *Self,
unsigned ScopeFlags,
bool ManageFlags =
true);
1195 DiagnosticBuilder
Diag(SourceLocation Loc,
unsigned DiagID);
1196 DiagnosticBuilder
Diag(
const Token &Tok,
unsigned DiagID);
1198 return Diag(Tok, DiagID);
1219 static_cast<unsigned>(R));
1261 struct ParsingClass;
1271 class LateParsedDeclaration {
1273 virtual ~LateParsedDeclaration();
1275 virtual void ParseLexedMethodDeclarations();
1276 virtual void ParseLexedMemberInitializers();
1277 virtual void ParseLexedMethodDefs();
1278 virtual void ParseLexedAttributes();
1279 virtual void ParseLexedPragmas();
1284 class LateParsedClass :
public LateParsedDeclaration {
1286 LateParsedClass(
Parser *
P, ParsingClass *
C);
1287 ~LateParsedClass()
override;
1289 void ParseLexedMethodDeclarations()
override;
1290 void ParseLexedMemberInitializers()
override;
1291 void ParseLexedMethodDefs()
override;
1292 void ParseLexedAttributes()
override;
1293 void ParseLexedPragmas()
override;
1297 ParsingClass *Class;
1306 struct LateParsedAttribute :
public LateParsedDeclaration {
1309 IdentifierInfo &AttrName;
1310 IdentifierInfo *MacroII =
nullptr;
1311 SourceLocation AttrNameLoc;
1312 SmallVector<Decl*, 2> Decls;
1314 explicit LateParsedAttribute(Parser *
P, IdentifierInfo &Name,
1316 : Self(
P), AttrName(Name), AttrNameLoc(Loc) {}
1318 void ParseLexedAttributes()
override;
1320 void addDecl(Decl *D) { Decls.push_back(D); }
1327 class LateParsedPragma :
public LateParsedDeclaration {
1328 Parser *Self =
nullptr;
1334 : Self(
P), AS(AS) {}
1336 void takeToks(
CachedTokens &Cached) { Toks.swap(Cached); }
1340 void ParseLexedPragmas()
override;
1344 class LateParsedAttrList:
public SmallVector<LateParsedAttribute *, 2> {
1346 LateParsedAttrList(
bool PSoon =
false) : ParseSoon(PSoon) { }
1348 bool parseSoon() {
return ParseSoon; }
1357 struct LexedMethod :
public LateParsedDeclaration {
1362 explicit LexedMethod(Parser *
P, Decl *MD) : Self(
P), D(MD) {}
1364 void ParseLexedMethodDefs()
override;
1371 struct LateParsedDefaultArgument {
1372 explicit LateParsedDefaultArgument(Decl *
P,
1373 std::unique_ptr<CachedTokens> Toks =
nullptr)
1374 : Param(
P), Toks(
std::move(Toks)) { }
1383 std::unique_ptr<CachedTokens> Toks;
1390 struct LateParsedMethodDeclaration :
public LateParsedDeclaration {
1391 explicit LateParsedMethodDeclaration(Parser *
P, Decl *M)
1392 : Self(
P), Method(M), ExceptionSpecTokens(nullptr) {}
1394 void ParseLexedMethodDeclarations()
override;
1406 SmallVector<LateParsedDefaultArgument, 8> DefaultArgs;
1416 struct LateParsedMemberInitializer :
public LateParsedDeclaration {
1417 LateParsedMemberInitializer(Parser *
P, Decl *FD)
1420 void ParseLexedMemberInitializers()
override;
1438 typedef SmallVector<LateParsedDeclaration*,2> LateParsedDeclarationsContainer;
1443 struct ParsingClass {
1444 ParsingClass(Decl *TagOrTemplate,
bool TopLevelClass,
bool IsInterface)
1445 : TopLevelClass(TopLevelClass), IsInterface(IsInterface),
1446 TagOrTemplate(TagOrTemplate) {}
1450 bool TopLevelClass : 1;
1453 bool IsInterface : 1;
1456 Decl *TagOrTemplate;
1461 LateParsedDeclarationsContainer LateParsedDeclarations;
1467 std::stack<ParsingClass *> ClassStack;
1469 ParsingClass &getCurrentClass() {
1470 assert(!ClassStack.empty() &&
"No lexed method stacks!");
1471 return *ClassStack.top();
1475 class ParsingClassDefinition {
1481 ParsingClassDefinition(Parser &P, Decl *TagOrTemplate,
bool TopLevelClass,
1484 State(
P.PushParsingClass(TagOrTemplate, TopLevelClass, IsInterface)) {
1489 assert(!Popped &&
"Nested class has already been popped");
1491 P.PopParsingClass(State);
1494 ~ParsingClassDefinition() {
1496 P.PopParsingClass(State);
1503 struct ParsedTemplateInfo {
1504 ParsedTemplateInfo() :
Kind(NonTemplate), TemplateParams(nullptr) {}
1507 bool isSpecialization,
1508 bool lastParameterListWasEmpty =
false)
1509 :
Kind(isSpecialization? ExplicitSpecialization : Template),
1510 TemplateParams(TemplateParams),
1511 LastParameterListWasEmpty(lastParameterListWasEmpty) { }
1513 explicit ParsedTemplateInfo(SourceLocation ExternLoc,
1514 SourceLocation TemplateLoc)
1515 :
Kind(ExplicitInstantiation), TemplateParams(nullptr),
1516 ExternLoc(ExternLoc), TemplateLoc(TemplateLoc),
1517 LastParameterListWasEmpty(
false){ }
1526 ExplicitSpecialization,
1528 ExplicitInstantiation
1537 SourceLocation ExternLoc;
1541 SourceLocation TemplateLoc;
1544 bool LastParameterListWasEmpty;
1550 struct ReenterTemplateScopeRAII;
1551 struct ReenterClassScopeRAII;
1553 void LexTemplateFunctionForLateParsing(
CachedTokens &Toks);
1554 void ParseLateTemplatedFuncDef(LateParsedTemplate &LPT);
1556 static
void LateTemplateParserCallback(
void *
P, LateParsedTemplate &LPT);
1558 Sema::ParsingClassState
1559 PushParsingClass(Decl *TagOrTemplate,
bool TopLevelClass,
bool IsInterface);
1560 void DeallocateParsedClasses(ParsingClass *Class);
1561 void PopParsingClass(Sema::ParsingClassState);
1563 enum CachedInitKind {
1564 CIK_DefaultArgument,
1565 CIK_DefaultInitializer
1569 const ParsedAttributesView &AccessAttrs,
1570 ParsingDeclarator &D,
1571 const ParsedTemplateInfo &TemplateInfo,
1572 const VirtSpecifiers &VS,
1573 SourceLocation PureSpecLoc);
1574 void ParseCXXNonStaticMemberInitializer(Decl *VarD);
1575 void ParseLexedAttributes(ParsingClass &Class);
1576 void ParseLexedAttributeList(LateParsedAttrList &LAs, Decl *D,
1578 void ParseLexedAttribute(LateParsedAttribute &LA,
1580 void ParseLexedMethodDeclarations(ParsingClass &Class);
1581 void ParseLexedMethodDeclaration(LateParsedMethodDeclaration &LM);
1582 void ParseLexedMethodDefs(ParsingClass &Class);
1583 void ParseLexedMethodDef(LexedMethod &LM);
1584 void ParseLexedMemberInitializers(ParsingClass &Class);
1585 void ParseLexedMemberInitializer(LateParsedMemberInitializer &MI);
1586 void ParseLexedObjCMethodDefs(LexedMethod &LM,
bool parseMethod);
1587 void ParseLexedPragmas(ParsingClass &Class);
1588 void ParseLexedPragma(LateParsedPragma &LP);
1589 bool ConsumeAndStoreFunctionPrologue(
CachedTokens &Toks);
1590 bool ConsumeAndStoreInitializer(
CachedTokens &Toks, CachedInitKind CIK);
1595 bool ConsumeFinalToken =
true) {
1596 return ConsumeAndStoreUntil(T1, T1, Toks,
StopAtSemi, ConsumeFinalToken);
1601 bool ConsumeFinalToken =
true);
1605 DeclGroupPtrTy ParseExternalDeclaration(ParsedAttributes &DeclAttrs,
1606 ParsedAttributes &DeclSpecAttrs,
1607 ParsingDeclSpec *DS =
nullptr);
1608 bool isDeclarationAfterDeclarator();
1609 bool isStartOfFunctionDefinition(
const ParsingDeclarator &Declarator);
1611 ParsedAttributes &DeclAttrs, ParsedAttributes &DeclSpecAttrs,
1613 DeclGroupPtrTy ParseDeclOrFunctionDefInternal(ParsedAttributes &Attrs,
1614 ParsedAttributes &DeclSpecAttrs,
1615 ParsingDeclSpec &DS,
1618 void SkipFunctionBody();
1619 Decl *ParseFunctionDefinition(ParsingDeclarator &D,
1620 const ParsedTemplateInfo &TemplateInfo = ParsedTemplateInfo(),
1621 LateParsedAttrList *LateParsedAttrs =
nullptr);
1622 void ParseKNRParamDeclarations(Declarator &D);
1624 ExprResult ParseSimpleAsm(
bool ForAsmLabel, SourceLocation *EndLoc);
1625 ExprResult ParseAsmStringLiteral(
bool ForAsmLabel);
1629 DeclGroupPtrTy ParseObjCAtDirectives(ParsedAttributes &DeclAttrs,
1630 ParsedAttributes &DeclSpecAttrs);
1631 DeclGroupPtrTy ParseObjCAtClassDeclaration(SourceLocation atLoc);
1632 Decl *ParseObjCAtInterfaceDeclaration(SourceLocation AtLoc,
1633 ParsedAttributes &prefixAttrs);
1634 class ObjCTypeParamListScope;
1635 ObjCTypeParamList *parseObjCTypeParamList();
1636 ObjCTypeParamList *parseObjCTypeParamListOrProtocolRefs(
1637 ObjCTypeParamListScope &Scope, SourceLocation &lAngleLoc,
1638 SmallVectorImpl<IdentifierLocPair> &protocolIdents,
1639 SourceLocation &rAngleLoc,
bool mayBeProtocolList =
true);
1641 void HelperActionsForIvarDeclarations(ObjCContainerDecl *interfaceDecl,
1642 SourceLocation atLoc,
1644 SmallVectorImpl<Decl *> &AllIvarDecls,
1645 bool RBraceMissing);
1646 void ParseObjCClassInstanceVariables(ObjCContainerDecl *interfaceDecl,
1648 SourceLocation atLoc);
1649 bool ParseObjCProtocolReferences(SmallVectorImpl<Decl *> &
P,
1650 SmallVectorImpl<SourceLocation> &PLocs,
1651 bool WarnOnDeclarations,
1652 bool ForObjCContainer,
1653 SourceLocation &LAngleLoc,
1654 SourceLocation &EndProtoLoc,
1655 bool consumeLastToken);
1660 void parseObjCTypeArgsOrProtocolQualifiers(
1662 SourceLocation &typeArgsLAngleLoc,
1663 SmallVectorImpl<ParsedType> &typeArgs,
1664 SourceLocation &typeArgsRAngleLoc,
1665 SourceLocation &protocolLAngleLoc,
1666 SmallVectorImpl<Decl *> &protocols,
1667 SmallVectorImpl<SourceLocation> &protocolLocs,
1668 SourceLocation &protocolRAngleLoc,
1669 bool consumeLastToken,
1670 bool warnOnIncompleteProtocols);
1674 void parseObjCTypeArgsAndProtocolQualifiers(
1676 SourceLocation &typeArgsLAngleLoc,
1677 SmallVectorImpl<ParsedType> &typeArgs,
1678 SourceLocation &typeArgsRAngleLoc,
1679 SourceLocation &protocolLAngleLoc,
1680 SmallVectorImpl<Decl *> &protocols,
1681 SmallVectorImpl<SourceLocation> &protocolLocs,
1682 SourceLocation &protocolRAngleLoc,
1683 bool consumeLastToken);
1687 TypeResult parseObjCProtocolQualifierType(SourceLocation &rAngleLoc);
1691 TypeResult parseObjCTypeArgsAndProtocolQualifiers(SourceLocation loc,
1693 bool consumeLastToken,
1694 SourceLocation &endLoc);
1698 DeclGroupPtrTy ParseObjCAtProtocolDeclaration(SourceLocation atLoc,
1699 ParsedAttributes &prefixAttrs);
1701 struct ObjCImplParsingDataRAII {
1705 typedef SmallVector<LexedMethod*, 8> LateParsedObjCMethodContainer;
1706 LateParsedObjCMethodContainer LateParsedObjCMethods;
1708 ObjCImplParsingDataRAII(Parser &parser, Decl *D)
1709 :
P(parser), Dcl(D), HasCFunction(
false) {
1710 P.CurParsedObjCImpl =
this;
1713 ~ObjCImplParsingDataRAII();
1715 void finish(SourceRange AtEnd);
1716 bool isFinished()
const {
return Finished; }
1721 ObjCImplParsingDataRAII *CurParsedObjCImpl;
1722 void StashAwayMethodOrFunctionBodyTokens(Decl *MDecl);
1724 DeclGroupPtrTy ParseObjCAtImplementationDeclaration(SourceLocation AtLoc,
1725 ParsedAttributes &Attrs);
1727 Decl *ParseObjCAtAliasDeclaration(SourceLocation atLoc);
1728 Decl *ParseObjCPropertySynthesize(SourceLocation atLoc);
1729 Decl *ParseObjCPropertyDynamic(SourceLocation atLoc);
1731 IdentifierInfo *ParseObjCSelectorPiece(SourceLocation &MethodLocation);
1734 objc_in=0, objc_out, objc_inout, objc_oneway, objc_bycopy, objc_byref,
1735 objc_nonnull, objc_nullable, objc_null_unspecified,
1738 IdentifierInfo *ObjCTypeQuals[objc_NumQuals];
1740 bool isTokIdentifier_in()
const;
1743 ParsedAttributes *ParamAttrs);
1744 Decl *ParseObjCMethodPrototype(
1746 bool MethodDefinition =
true);
1749 bool MethodDefinition=
true);
1750 void ParseObjCPropertyAttribute(ObjCDeclSpec &DS);
1752 Decl *ParseObjCMethodDefinition();
1778 unsigned &NumLineToksConsumed,
1779 bool IsUnevaluated);
1795 enum CastParseKind {
1800 ExprResult ParseCastExpression(CastParseKind ParseKind,
1801 bool isAddressOfOperand,
1804 bool isVectorLiteral =
false,
1805 bool *NotPrimaryExpression =
nullptr);
1806 ExprResult ParseCastExpression(CastParseKind ParseKind,
1807 bool isAddressOfOperand =
false,
1809 bool isVectorLiteral =
false,
1810 bool *NotPrimaryExpression =
nullptr);
1813 bool isNotExpressionStart();
1817 bool isPostfixExpressionSuffixStart() {
1819 return (K == tok::l_square || K == tok::l_paren ||
1820 K == tok::period || K == tok::arrow ||
1821 K == tok::plusplus || K == tok::minusminus);
1824 bool diagnoseUnknownTemplateId(
ExprResult TemplateName, SourceLocation
Less);
1825 void checkPotentialAngleBracket(
ExprResult &PotentialTemplateName);
1826 bool checkPotentialAngleBracketDelimiter(
const AngleBracketTracker::Loc &,
1827 const Token &OpToken);
1828 bool checkPotentialAngleBracketDelimiter(
const Token &OpToken) {
1829 if (
auto *Info = AngleBrackets.getCurrent(*
this))
1830 return checkPotentialAngleBracketDelimiter(*Info, OpToken);
1835 ExprResult ParseUnaryExprOrTypeTraitExpression();
1837 ExprResult ParseSYCLUniqueStableNameExpression();
1839 ExprResult ParseExprAfterUnaryExprOrTypeTrait(
const Token &OpTok,
1842 SourceRange &CastRange);
1845 bool ParseExpressionList(SmallVectorImpl<Expr *> &Exprs,
1846 llvm::function_ref<
void()> ExpressionStarts =
1847 llvm::function_ref<
void()>(),
1848 bool FailImmediatelyOnInvalidExpr =
false,
1849 bool EarlyTypoCorrection =
false);
1853 bool ParseSimpleExpressionList(SmallVectorImpl<Expr *> &Exprs);
1856 enum ParenParseOption {
1863 ExprResult ParseParenExpression(ParenParseOption &ExprType,
1864 bool stopIfCastExpr,
1867 SourceLocation &RParenLoc);
1870 ParenParseOption &ExprType,
ParsedType &CastTy,
1873 SourceLocation LParenLoc,
1874 SourceLocation RParenLoc);
1876 ExprResult ParseGenericSelectionExpression();
1884 ExprResult tryParseCXXIdExpression(CXXScopeSpec &SS,
bool isAddressOfOperand,
1885 Token &Replacement);
1886 ExprResult ParseCXXIdExpression(
bool isAddressOfOperand =
false);
1888 bool areTokensAdjacent(
const Token &A,
const Token &B);
1890 void CheckForTemplateAndDigraph(Token &Next,
ParsedType ObjectTypePtr,
1891 bool EnteringContext, IdentifierInfo &II,
1894 bool ParseOptionalCXXScopeSpecifier(CXXScopeSpec &SS,
1896 bool ObjectHasErrors,
1897 bool EnteringContext,
1898 bool *MayBePseudoDestructor =
nullptr,
1899 bool IsTypename =
false,
1900 IdentifierInfo **LastII =
nullptr,
1901 bool OnlyNamespace =
false,
1902 bool InUsingDeclaration =
false);
1908 enum class LambdaIntroducerTentativeParse {
1925 ParseLambdaIntroducer(LambdaIntroducer &Intro,
1926 LambdaIntroducerTentativeParse *Tentative =
nullptr);
1927 ExprResult ParseLambdaExpressionAfterIntroducer(LambdaIntroducer &Intro);
1946 ExprResult ParseCXXPseudoDestructor(Expr *
Base, SourceLocation OpLoc,
1961 SourceRange &SpecificationRange,
1962 SmallVectorImpl<ParsedType> &DynamicExceptions,
1963 SmallVectorImpl<SourceRange> &DynamicExceptionRanges,
1969 SourceRange &SpecificationRange,
1970 SmallVectorImpl<ParsedType> &Exceptions,
1971 SmallVectorImpl<SourceRange> &Ranges);
1975 TypeResult ParseTrailingReturnType(SourceRange &Range,
1976 bool MayBeFollowedByDirectInit);
1984 ExprResult ParseCXXTypeConstructExpression(
const DeclSpec &DS);
1989 void ParseCXXSimpleTypeSpecifier(DeclSpec &DS);
1991 bool ParseCXXTypeSpecifierSeq(
1996 bool ParseExpressionListOrTypeId(SmallVectorImpl<Expr*> &Exprs,
1998 void ParseDirectNewDeclarator(Declarator &D);
1999 ExprResult ParseCXXNewExpression(
bool UseGlobal, SourceLocation Start);
2000 ExprResult ParseCXXDeleteExpression(
bool UseGlobal,
2001 SourceLocation Start);
2005 struct ForRangeInfo;
2006 Sema::ConditionResult ParseCXXCondition(
StmtResult *InitStmt,
2010 ForRangeInfo *FRI =
nullptr,
2011 bool EnterForConditionScope =
false);
2013 ParsedAttributes &Attrs);
2024 void ParseTrailingRequiresClause(Declarator &D);
2034 if (Tok.isNot(tok::l_brace))
2036 return ParseBraceInitializer();
2038 bool MayBeDesignationStart();
2040 struct DesignatorCompletionInfo {
2041 SmallVectorImpl<Expr *> &InitExprs;
2042 QualType PreferredBaseType;
2044 ExprResult ParseInitializerWithPotentialDesignator(DesignatorCompletionInfo);
2053 ExprResult ParseObjCAtExpression(SourceLocation AtLocation);
2054 ExprResult ParseObjCStringLiteral(SourceLocation AtLoc);
2055 ExprResult ParseObjCCharacterLiteral(SourceLocation AtLoc);
2056 ExprResult ParseObjCNumericLiteral(SourceLocation AtLoc);
2057 ExprResult ParseObjCBooleanLiteral(SourceLocation AtLoc,
bool ArgValue);
2058 ExprResult ParseObjCArrayLiteral(SourceLocation AtLoc);
2059 ExprResult ParseObjCDictionaryLiteral(SourceLocation AtLoc);
2060 ExprResult ParseObjCBoxedExpr(SourceLocation AtLoc);
2061 ExprResult ParseObjCEncodeExpression(SourceLocation AtLoc);
2062 ExprResult ParseObjCSelectorExpression(SourceLocation AtLoc);
2063 ExprResult ParseObjCProtocolExpression(SourceLocation AtLoc);
2064 bool isSimpleObjCMessageExpression();
2066 ExprResult ParseObjCMessageExpressionBody(SourceLocation LBracloc,
2067 SourceLocation SuperLoc,
2069 Expr *ReceiverExpr);
2070 ExprResult ParseAssignmentExprWithObjCMessageExprStart(
2071 SourceLocation LBracloc, SourceLocation SuperLoc,
2072 ParsedType ReceiverType, Expr *ReceiverExpr);
2073 bool ParseObjCXXMessageReceiver(
bool &IsExpr,
void *&TypeOrExpr);
2079 typedef SmallVector<Expr*, 12> ExprVector;
2082 ParseStatement(SourceLocation *TrailingElseLoc =
nullptr,
2083 ParsedStmtContext StmtCtx = ParsedStmtContext::SubStmt);
2085 StmtVector &Stmts, ParsedStmtContext StmtCtx,
2086 SourceLocation *TrailingElseLoc =
nullptr);
2087 StmtResult ParseStatementOrDeclarationAfterAttributes(
2088 StmtVector &Stmts, ParsedStmtContext StmtCtx,
2089 SourceLocation *TrailingElseLoc, ParsedAttributes &DeclAttrs,
2090 ParsedAttributes &DeclSpecAttrs);
2091 StmtResult ParseExprStatement(ParsedStmtContext StmtCtx);
2092 StmtResult ParseLabeledStatement(ParsedAttributes &Attrs,
2093 ParsedStmtContext StmtCtx);
2094 StmtResult ParseCaseStatement(ParsedStmtContext StmtCtx,
2095 bool MissingCase =
false,
2097 StmtResult ParseDefaultStatement(ParsedStmtContext StmtCtx);
2098 StmtResult ParseCompoundStatement(
bool isStmtExpr =
false);
2099 StmtResult ParseCompoundStatement(
bool isStmtExpr,
2100 unsigned ScopeFlags);
2101 void ParseCompoundStatementLeadingPragmas();
2102 void DiagnoseLabelAtEndOfCompoundStatement();
2104 StmtResult ParseCompoundStatementBody(
bool isStmtExpr =
false);
2105 bool ParseParenExprOrCondition(
StmtResult *InitStmt,
2106 Sema::ConditionResult &CondResult,
2108 SourceLocation &LParenLoc,
2109 SourceLocation &RParenLoc);
2110 StmtResult ParseIfStatement(SourceLocation *TrailingElseLoc);
2111 StmtResult ParseSwitchStatement(SourceLocation *TrailingElseLoc);
2112 StmtResult ParseWhileStatement(SourceLocation *TrailingElseLoc);
2114 StmtResult ParseForStatement(SourceLocation *TrailingElseLoc);
2120 StmtResult ParseMicrosoftAsmStatement(SourceLocation AsmLoc);
2122 SourceLocation *TrailingElseLoc,
2123 ParsedAttributes &Attrs);
2127 enum IfExistsBehavior {
2139 struct IfExistsCondition {
2141 SourceLocation KeywordLoc;
2154 IfExistsBehavior Behavior;
2157 bool ParseMicrosoftIfExistsCondition(IfExistsCondition&
Result);
2158 void ParseMicrosoftIfExistsStatement(
StmtVector &Stmts);
2159 void ParseMicrosoftIfExistsExternalDeclaration();
2160 void ParseMicrosoftIfExistsClassDeclaration(
DeclSpec::TST TagType,
2161 ParsedAttributes &AccessAttrs,
2163 bool ParseMicrosoftIfExistsBraceInitializer(ExprVector &InitExprs,
2165 bool ParseAsmOperandsOpt(SmallVectorImpl<IdentifierInfo *> &Names,
2166 SmallVectorImpl<Expr *> &Constraints,
2167 SmallVectorImpl<Expr *> &Exprs);
2173 StmtResult ParseCXXTryBlockCommon(SourceLocation TryLoc,
bool FnTry =
false);
2174 StmtResult ParseCXXCatchBlock(
bool FnCatch =
false);
2180 StmtResult ParseSEHExceptBlock(SourceLocation Loc);
2181 StmtResult ParseSEHFinallyBlock(SourceLocation Loc);
2187 StmtResult ParseObjCAtStatement(SourceLocation atLoc,
2188 ParsedStmtContext StmtCtx);
2189 StmtResult ParseObjCTryStmt(SourceLocation atLoc);
2190 StmtResult ParseObjCThrowStmt(SourceLocation atLoc);
2191 StmtResult ParseObjCSynchronizedStmt(SourceLocation atLoc);
2192 StmtResult ParseObjCAutoreleasePoolStmt(SourceLocation atLoc);
2201 enum class DeclSpecContext {
2206 DSC_alias_declaration,
2211 DSC_template_type_arg,
2212 DSC_objc_method_result,
2221 static bool isTypeSpecifier(DeclSpecContext DSC) {
2223 case DeclSpecContext::DSC_normal:
2224 case DeclSpecContext::DSC_template_param:
2225 case DeclSpecContext::DSC_template_arg:
2226 case DeclSpecContext::DSC_class:
2227 case DeclSpecContext::DSC_top_level:
2228 case DeclSpecContext::DSC_objc_method_result:
2229 case DeclSpecContext::DSC_condition:
2232 case DeclSpecContext::DSC_template_type_arg:
2233 case DeclSpecContext::DSC_type_specifier:
2234 case DeclSpecContext::DSC_conv_operator:
2235 case DeclSpecContext::DSC_trailing:
2236 case DeclSpecContext::DSC_alias_declaration:
2237 case DeclSpecContext::DSC_association:
2238 case DeclSpecContext::DSC_new:
2241 llvm_unreachable(
"Missing DeclSpecContext case");
2245 enum class AllowDefiningTypeSpec {
2262 static AllowDefiningTypeSpec
2263 isDefiningTypeSpecifierContext(DeclSpecContext DSC,
bool IsCPlusPlus) {
2265 case DeclSpecContext::DSC_normal:
2266 case DeclSpecContext::DSC_class:
2267 case DeclSpecContext::DSC_top_level:
2268 case DeclSpecContext::DSC_alias_declaration:
2269 case DeclSpecContext::DSC_objc_method_result:
2270 return AllowDefiningTypeSpec::Yes;
2272 case DeclSpecContext::DSC_condition:
2273 case DeclSpecContext::DSC_template_param:
2274 return AllowDefiningTypeSpec::YesButInvalid;
2276 case DeclSpecContext::DSC_template_type_arg:
2277 case DeclSpecContext::DSC_type_specifier:
2278 return AllowDefiningTypeSpec::NoButErrorRecovery;
2280 case DeclSpecContext::DSC_association:
2281 return IsCPlusPlus ? AllowDefiningTypeSpec::NoButErrorRecovery
2282 : AllowDefiningTypeSpec::Yes;
2284 case DeclSpecContext::DSC_trailing:
2285 case DeclSpecContext::DSC_conv_operator:
2286 case DeclSpecContext::DSC_template_arg:
2287 case DeclSpecContext::DSC_new:
2288 return AllowDefiningTypeSpec::No;
2290 llvm_unreachable(
"Missing DeclSpecContext case");
2294 static bool isOpaqueEnumDeclarationContext(DeclSpecContext DSC) {
2296 case DeclSpecContext::DSC_normal:
2297 case DeclSpecContext::DSC_class:
2298 case DeclSpecContext::DSC_top_level:
2301 case DeclSpecContext::DSC_alias_declaration:
2302 case DeclSpecContext::DSC_objc_method_result:
2303 case DeclSpecContext::DSC_condition:
2304 case DeclSpecContext::DSC_template_param:
2305 case DeclSpecContext::DSC_template_type_arg:
2306 case DeclSpecContext::DSC_type_specifier:
2307 case DeclSpecContext::DSC_trailing:
2308 case DeclSpecContext::DSC_association:
2309 case DeclSpecContext::DSC_conv_operator:
2310 case DeclSpecContext::DSC_template_arg:
2311 case DeclSpecContext::DSC_new:
2315 llvm_unreachable(
"Missing DeclSpecContext case");
2320 static bool isClassTemplateDeductionContext(DeclSpecContext DSC) {
2322 case DeclSpecContext::DSC_normal:
2323 case DeclSpecContext::DSC_template_param:
2324 case DeclSpecContext::DSC_template_arg:
2325 case DeclSpecContext::DSC_class:
2326 case DeclSpecContext::DSC_top_level:
2327 case DeclSpecContext::DSC_condition:
2328 case DeclSpecContext::DSC_type_specifier:
2329 case DeclSpecContext::DSC_association:
2330 case DeclSpecContext::DSC_conv_operator:
2331 case DeclSpecContext::DSC_new:
2334 case DeclSpecContext::DSC_objc_method_result:
2335 case DeclSpecContext::DSC_template_type_arg:
2336 case DeclSpecContext::DSC_trailing:
2337 case DeclSpecContext::DSC_alias_declaration:
2340 llvm_unreachable(
"Missing DeclSpecContext case");
2345 getImplicitTypenameContext(DeclSpecContext DSC) {
2347 case DeclSpecContext::DSC_class:
2348 case DeclSpecContext::DSC_top_level:
2349 case DeclSpecContext::DSC_type_specifier:
2350 case DeclSpecContext::DSC_template_type_arg:
2351 case DeclSpecContext::DSC_trailing:
2352 case DeclSpecContext::DSC_alias_declaration:
2353 case DeclSpecContext::DSC_template_param:
2354 case DeclSpecContext::DSC_new:
2357 case DeclSpecContext::DSC_normal:
2358 case DeclSpecContext::DSC_objc_method_result:
2359 case DeclSpecContext::DSC_condition:
2360 case DeclSpecContext::DSC_template_arg:
2361 case DeclSpecContext::DSC_conv_operator:
2362 case DeclSpecContext::DSC_association:
2365 llvm_unreachable(
"Missing DeclSpecContext case");
2370 struct ForRangeInit {
2371 SourceLocation ColonLoc;
2374 bool ParsedForRangeDecl() {
return !ColonLoc.
isInvalid(); }
2376 struct ForRangeInfo : ForRangeInit {
2381 SourceLocation &DeclEnd,
2382 ParsedAttributes &DeclAttrs,
2383 ParsedAttributes &DeclSpecAttrs,
2384 SourceLocation *DeclSpecStart =
nullptr);
2387 ParsedAttributes &DeclAttrs,
2388 ParsedAttributes &DeclSpecAttrs,
bool RequireSemi,
2389 ForRangeInit *FRI =
nullptr,
2390 SourceLocation *DeclSpecStart =
nullptr);
2393 ParsedAttributes &Attrs,
2394 SourceLocation *DeclEnd =
nullptr,
2395 ForRangeInit *FRI =
nullptr);
2396 Decl *ParseDeclarationAfterDeclarator(Declarator &D,
2397 const ParsedTemplateInfo &TemplateInfo = ParsedTemplateInfo());
2398 bool ParseAsmAttributesAfterDeclarator(Declarator &D);
2399 Decl *ParseDeclarationAfterDeclaratorAndAttributes(
2401 const ParsedTemplateInfo &TemplateInfo = ParsedTemplateInfo(),
2402 ForRangeInit *FRI =
nullptr);
2403 Decl *ParseFunctionStatementBody(Decl *Decl, ParseScope &BodyScope);
2404 Decl *ParseFunctionTryBlock(Decl *Decl, ParseScope &BodyScope);
2410 bool trySkippingFunctionBody();
2412 bool ParseImplicitInt(DeclSpec &DS, CXXScopeSpec *SS,
2413 const ParsedTemplateInfo &TemplateInfo,
2415 ParsedAttributes &Attrs);
2418 void ParseDeclarationSpecifiers(
2420 const ParsedTemplateInfo &TemplateInfo = ParsedTemplateInfo(),
2422 DeclSpecContext DSC = DeclSpecContext::DSC_normal,
2423 LateParsedAttrList *LateAttrs =
nullptr) {
2424 return ParseDeclarationSpecifiers(DS, TemplateInfo, AS, DSC, LateAttrs,
2425 getImplicitTypenameContext(DSC));
2427 void ParseDeclarationSpecifiers(
2428 DeclSpec &DS,
const ParsedTemplateInfo &TemplateInfo,
AccessSpecifier AS,
2429 DeclSpecContext DSC, LateParsedAttrList *LateAttrs,
2432 bool DiagnoseMissingSemiAfterTagDefinition(
2434 LateParsedAttrList *LateAttrs =
nullptr);
2436 void ParseSpecifierQualifierList(
2438 DeclSpecContext DSC = DeclSpecContext::DSC_normal) {
2439 ParseSpecifierQualifierList(DS, getImplicitTypenameContext(DSC), AS, DSC);
2442 void ParseSpecifierQualifierList(
2445 DeclSpecContext DSC = DeclSpecContext::DSC_normal);
2447 void ParseObjCTypeQualifierList(ObjCDeclSpec &DS,
2450 void ParseEnumSpecifier(SourceLocation TagLoc, DeclSpec &DS,
2451 const ParsedTemplateInfo &TemplateInfo,
2453 void ParseEnumBody(SourceLocation StartLoc, Decl *TagDecl);
2454 void ParseStructUnionBody(SourceLocation StartLoc,
DeclSpec::TST TagType,
2455 RecordDecl *TagDecl);
2457 void ParseStructDeclaration(
2458 ParsingDeclSpec &DS,
2459 llvm::function_ref<
void(ParsingFieldDeclarator &)> FieldsCallback);
2464 bool DisambiguatingWithExpression =
false);
2465 bool isTypeSpecifierQualifier();
2470 bool isKnownToBeTypeSpecifier(
const Token &Tok)
const;
2475 bool isKnownToBeDeclarationSpecifier() {
2488 bool isDeclarationStatement(
bool DisambiguatingWithExpression =
false) {
2490 return isCXXDeclarationStatement(DisambiguatingWithExpression);
2498 bool isForInitDeclaration() {
2502 return Tok.is(tok::kw_using) ||
2503 isCXXSimpleDeclaration(
true);
2508 bool isForRangeIdentifier();
2512 bool isStartOfObjCClassMessageMissingOpenBracket();
2517 bool isConstructorDeclarator(
2520 const ParsedTemplateInfo *TemplateInfo =
nullptr);
2524 enum TentativeCXXTypeIdContext {
2527 TypeIdAsTemplateArgument,
2528 TypeIdInTrailingReturnType,
2529 TypeIdAsGenericSelectionArgument,
2535 bool isTypeIdInParens(
bool &isAmbiguous) {
2537 return isCXXTypeId(TypeIdInParens, isAmbiguous);
2538 isAmbiguous =
false;
2539 return isTypeSpecifierQualifier();
2541 bool isTypeIdInParens() {
2543 return isTypeIdInParens(isAmbiguous);
2553 bool isTypeIdForGenericSelection() {
2556 return isCXXTypeId(TypeIdAsGenericSelectionArgument, isAmbiguous);
2558 return isTypeSpecifierQualifier();
2564 bool isTypeIdUnambiguously() {
2567 return isCXXTypeId(TypeIdUnambiguous, isAmbiguous);
2569 return isTypeSpecifierQualifier();
2575 bool isCXXDeclarationStatement(
bool DisambiguatingWithExpression =
false);
2582 bool isCXXSimpleDeclaration(
bool AllowForRangeDecl);
2591 bool isCXXFunctionDeclarator(
bool *IsAmbiguous =
nullptr,
2595 struct ConditionDeclarationOrInitStatementState;
2596 enum class ConditionOrInitStatement {
2606 ConditionOrInitStatement
2607 isCXXConditionDeclarationOrInitStatement(
bool CanBeInitStmt,
2608 bool CanBeForRangeDecl);
2610 bool isCXXTypeId(TentativeCXXTypeIdContext Context,
bool &isAmbiguous);
2611 bool isCXXTypeId(TentativeCXXTypeIdContext Context) {
2613 return isCXXTypeId(Context, isAmbiguous);
2618 enum class TPResult {
2619 True, False, Ambiguous,
Error
2629 bool isEnumBase(
bool AllowSemi);
2640 TPResult BracedCastResult = TPResult::False,
2641 bool *InvalidAsDeclSpec =
nullptr);
2646 bool isCXXDeclarationSpecifierAType();
2651 TPResult isTemplateArgumentList(
unsigned TokensToSkip);
2656 TPResult isExplicitBool();
2661 bool isTentativelyDeclared(IdentifierInfo *II);
2670 TPResult TryParseSimpleDeclaration(
bool AllowForRangeDecl);
2671 TPResult TryParseTypeofSpecifier();
2672 TPResult TryParseProtocolQualifiers();
2673 TPResult TryParsePtrOperatorSeq();
2674 TPResult TryParseOperatorId();
2675 TPResult TryParseInitDeclaratorList(
bool MayHaveTrailingReturnType =
false);
2676 TPResult TryParseDeclarator(
bool mayBeAbstract,
bool mayHaveIdentifier =
true,
2677 bool mayHaveDirectInit =
false,
2678 bool mayHaveTrailingReturnType =
false);
2679 TPResult TryParseParameterDeclarationClause(
2680 bool *InvalidAsDeclaration =
nullptr,
bool VersusTemplateArg =
false,
2683 TPResult TryParseFunctionDeclarator(
bool MayHaveTrailingReturnType =
false);
2684 bool NameAfterArrowIsNonType();
2685 TPResult TryParseBracketDeclarator();
2686 TPResult TryConsumeDeclarationSpecifier();
2690 bool TrySkipAttributes();
2694 void DiagnoseBitIntUse(
const Token &Tok);
2701 ParsedAttributes *Attrs =
nullptr);
2704 void ParseBlockId(SourceLocation CaretLoc);
2711 bool isAllowedCXX11AttributeSpecifier(
bool Disambiguate =
false,
2712 bool OuterMightBeMessageSend =
false) {
2713 return (Tok.isRegularKeywordAttribute() ||
2714 isCXX11AttributeSpecifier(Disambiguate, OuterMightBeMessageSend));
2719 bool CheckProhibitedCXX11Attribute() {
2720 assert(Tok.is(tok::l_square));
2723 return DiagnoseProhibitedCXX11Attribute();
2726 bool DiagnoseProhibitedCXX11Attribute();
2727 void CheckMisplacedCXX11Attribute(ParsedAttributes &Attrs,
2728 SourceLocation CorrectLocation) {
2729 if (!Tok.isRegularKeywordAttribute() &&
2730 (Tok.isNot(tok::l_square) ||
NextToken().isNot(tok::l_square)) &&
2731 Tok.isNot(tok::kw_alignas))
2733 DiagnoseMisplacedCXX11Attribute(Attrs, CorrectLocation);
2735 void DiagnoseMisplacedCXX11Attribute(ParsedAttributes &Attrs,
2736 SourceLocation CorrectLocation);
2738 void stripTypeAttributesOffDeclSpec(ParsedAttributes &Attrs, DeclSpec &DS,
2742 void ProhibitAttributes(ParsedAttributes &Attrs,
2743 SourceLocation FixItLoc = SourceLocation()) {
2744 if (Attrs.Range.isInvalid())
2746 DiagnoseProhibitedAttributes(Attrs, FixItLoc);
2750 void ProhibitAttributes(ParsedAttributesView &Attrs,
2751 SourceLocation FixItLoc = SourceLocation()) {
2752 if (Attrs.Range.isInvalid())
2754 DiagnoseProhibitedAttributes(Attrs, FixItLoc);
2755 Attrs.clearListOnly();
2757 void DiagnoseProhibitedAttributes(
const ParsedAttributesView &Attrs,
2758 SourceLocation FixItLoc);
2766 void ProhibitCXX11Attributes(ParsedAttributes &Attrs,
unsigned AttrDiagID,
2767 unsigned KeywordDiagId,
2768 bool DiagnoseEmptyAttrs =
false,
2769 bool WarnOnUnknownAttrs =
false);
2774 SourceLocation SkipCXX11Attributes();
2778 void DiagnoseAndSkipCXX11Attributes();
2782 void DiagnoseCXX11AttributeExtension(ParsedAttributes &Attrs);
2784 ExprResult ParseUnevaluatedStringInAttribute(
const IdentifierInfo &AttrName);
2788 SmallVectorImpl<Expr *> &Exprs,
2789 ParsedAttributeArgumentsProperties ArgsProperties);
2796 ParseAttributeArgsCommon(IdentifierInfo *AttrName, SourceLocation AttrNameLoc,
2797 ParsedAttributes &Attrs, SourceLocation *EndLoc,
2798 IdentifierInfo *ScopeName, SourceLocation ScopeLoc,
2799 ParsedAttr::Form Form);
2801 enum ParseAttrKindMask {
2803 PAKM_Declspec = 1 << 1,
2804 PAKM_CXX11 = 1 << 2,
2821 void ParseAttributes(
unsigned WhichAttrKinds, ParsedAttributes &Attrs,
2822 LateParsedAttrList *LateAttrs =
nullptr);
2825 bool MaybeParseAttributes(
unsigned WhichAttrKinds, ParsedAttributes &Attrs,
2826 LateParsedAttrList *LateAttrs =
nullptr) {
2827 if (Tok.isOneOf(tok::kw___attribute, tok::kw___declspec) ||
2828 isAllowedCXX11AttributeSpecifier()) {
2829 ParseAttributes(WhichAttrKinds, Attrs, LateAttrs);
2835 void MaybeParseGNUAttributes(Declarator &D,
2836 LateParsedAttrList *LateAttrs =
nullptr) {
2837 if (Tok.is(tok::kw___attribute)) {
2838 ParsedAttributes Attrs(AttrFactory);
2839 ParseGNUAttributes(Attrs, LateAttrs, &D);
2840 D.takeAttributes(Attrs);
2844 bool MaybeParseGNUAttributes(ParsedAttributes &Attrs,
2845 LateParsedAttrList *LateAttrs =
nullptr) {
2846 if (Tok.is(tok::kw___attribute)) {
2847 ParseGNUAttributes(Attrs, LateAttrs);
2853 void ParseGNUAttributes(ParsedAttributes &Attrs,
2854 LateParsedAttrList *LateAttrs =
nullptr,
2855 Declarator *D =
nullptr);
2856 void ParseGNUAttributeArgs(IdentifierInfo *AttrName,
2857 SourceLocation AttrNameLoc,
2858 ParsedAttributes &Attrs, SourceLocation *EndLoc,
2859 IdentifierInfo *ScopeName, SourceLocation ScopeLoc,
2860 ParsedAttr::Form Form, Declarator *D);
2861 IdentifierLoc *ParseIdentifierLoc();
2864 ParseClangAttributeArgs(IdentifierInfo *AttrName, SourceLocation AttrNameLoc,
2865 ParsedAttributes &Attrs, SourceLocation *EndLoc,
2866 IdentifierInfo *ScopeName, SourceLocation ScopeLoc,
2867 ParsedAttr::Form Form);
2869 void ReplayOpenMPAttributeTokens(
CachedTokens &OpenMPTokens) {
2872 if (!OpenMPTokens.empty()) {
2874 PP.EnterTokenStream(OpenMPTokens,
true,
2879 void MaybeParseCXX11Attributes(Declarator &D) {
2880 if (isAllowedCXX11AttributeSpecifier()) {
2881 ParsedAttributes Attrs(AttrFactory);
2882 ParseCXX11Attributes(Attrs);
2883 D.takeAttributes(Attrs);
2887 bool MaybeParseCXX11Attributes(ParsedAttributes &Attrs,
2888 bool OuterMightBeMessageSend =
false) {
2889 if (isAllowedCXX11AttributeSpecifier(
false, OuterMightBeMessageSend)) {
2890 ParseCXX11Attributes(Attrs);
2896 void ParseOpenMPAttributeArgs(
const IdentifierInfo *AttrName,
2899 void ParseCXX11AttributeSpecifierInternal(ParsedAttributes &Attrs,
2901 SourceLocation *EndLoc =
nullptr);
2902 void ParseCXX11AttributeSpecifier(ParsedAttributes &Attrs,
2903 SourceLocation *EndLoc =
nullptr) {
2905 ParseCXX11AttributeSpecifierInternal(Attrs, OpenMPTokens, EndLoc);
2906 ReplayOpenMPAttributeTokens(OpenMPTokens);
2908 void ParseCXX11Attributes(ParsedAttributes &attrs);
2911 bool ParseCXX11AttributeArgs(IdentifierInfo *AttrName,
2912 SourceLocation AttrNameLoc,
2913 ParsedAttributes &Attrs, SourceLocation *EndLoc,
2914 IdentifierInfo *ScopeName,
2915 SourceLocation ScopeLoc,
2918 IdentifierInfo *TryParseCXX11AttributeIdentifier(
2919 SourceLocation &Loc,
2921 const IdentifierInfo *EnclosingScope =
nullptr);
2923 void MaybeParseHLSLSemantics(Declarator &D,
2924 SourceLocation *EndLoc =
nullptr) {
2925 assert(
getLangOpts().
HLSL &&
"MaybeParseHLSLSemantics is for HLSL only");
2926 if (Tok.is(tok::colon)) {
2927 ParsedAttributes Attrs(AttrFactory);
2928 ParseHLSLSemantics(Attrs, EndLoc);
2929 D.takeAttributes(Attrs);
2933 void MaybeParseHLSLSemantics(ParsedAttributes &Attrs,
2934 SourceLocation *EndLoc =
nullptr) {
2935 assert(
getLangOpts().
HLSL &&
"MaybeParseHLSLSemantics is for HLSL only");
2937 ParseHLSLSemantics(Attrs, EndLoc);
2940 void ParseHLSLSemantics(ParsedAttributes &Attrs,
2941 SourceLocation *EndLoc =
nullptr);
2942 Decl *ParseHLSLBuffer(SourceLocation &DeclEnd);
2944 void MaybeParseMicrosoftAttributes(ParsedAttributes &Attrs) {
2946 Tok.is(tok::l_square)) {
2947 ParsedAttributes AttrsWithRange(AttrFactory);
2948 ParseMicrosoftAttributes(AttrsWithRange);
2949 Attrs.takeAllFrom(AttrsWithRange);
2952 void ParseMicrosoftUuidAttributeArgs(ParsedAttributes &Attrs);
2953 void ParseMicrosoftAttributes(ParsedAttributes &Attrs);
2954 bool MaybeParseMicrosoftDeclSpecs(ParsedAttributes &Attrs) {
2955 if (
getLangOpts().DeclSpecKeyword && Tok.is(tok::kw___declspec)) {
2956 ParseMicrosoftDeclSpecs(Attrs);
2961 void ParseMicrosoftDeclSpecs(ParsedAttributes &Attrs);
2962 bool ParseMicrosoftDeclSpecArgs(IdentifierInfo *AttrName,
2963 SourceLocation AttrNameLoc,
2964 ParsedAttributes &Attrs);
2965 void ParseMicrosoftTypeAttributes(ParsedAttributes &attrs);
2966 void ParseWebAssemblyFuncrefTypeAttribute(ParsedAttributes &Attrs);
2967 void DiagnoseAndSkipExtendedMicrosoftTypeAttributes();
2968 SourceLocation SkipExtendedMicrosoftTypeAttributes();
2969 void ParseMicrosoftInheritanceClassAttributes(ParsedAttributes &attrs);
2970 void ParseBorlandTypeAttributes(ParsedAttributes &attrs);
2971 void ParseOpenCLKernelAttributes(ParsedAttributes &attrs);
2972 void ParseOpenCLQualifiers(ParsedAttributes &Attrs);
2973 void ParseNullabilityTypeSpecifiers(ParsedAttributes &attrs);
2974 void ParseCUDAFunctionAttributes(ParsedAttributes &attrs);
2975 bool isHLSLQualifier(
const Token &Tok)
const;
2976 void ParseHLSLQualifiers(ParsedAttributes &Attrs);
2978 VersionTuple ParseVersionTuple(SourceRange &Range);
2979 void ParseAvailabilityAttribute(IdentifierInfo &Availability,
2980 SourceLocation AvailabilityLoc,
2981 ParsedAttributes &attrs,
2982 SourceLocation *endLoc,
2983 IdentifierInfo *ScopeName,
2984 SourceLocation ScopeLoc,
2985 ParsedAttr::Form Form);
2987 std::optional<AvailabilitySpec> ParseAvailabilitySpec();
2988 ExprResult ParseAvailabilityCheckExpr(SourceLocation StartLoc);
2990 void ParseExternalSourceSymbolAttribute(IdentifierInfo &ExternalSourceSymbol,
2992 ParsedAttributes &Attrs,
2993 SourceLocation *EndLoc,
2994 IdentifierInfo *ScopeName,
2995 SourceLocation ScopeLoc,
2996 ParsedAttr::Form Form);
2998 void ParseObjCBridgeRelatedAttribute(IdentifierInfo &ObjCBridgeRelated,
2999 SourceLocation ObjCBridgeRelatedLoc,
3000 ParsedAttributes &Attrs,
3001 SourceLocation *EndLoc,
3002 IdentifierInfo *ScopeName,
3003 SourceLocation ScopeLoc,
3004 ParsedAttr::Form Form);
3006 void ParseSwiftNewTypeAttribute(IdentifierInfo &AttrName,
3007 SourceLocation AttrNameLoc,
3008 ParsedAttributes &Attrs,
3009 SourceLocation *EndLoc,
3010 IdentifierInfo *ScopeName,
3011 SourceLocation ScopeLoc,
3012 ParsedAttr::Form Form);
3014 void ParseTypeTagForDatatypeAttribute(IdentifierInfo &AttrName,
3015 SourceLocation AttrNameLoc,
3016 ParsedAttributes &Attrs,
3017 SourceLocation *EndLoc,
3018 IdentifierInfo *ScopeName,
3019 SourceLocation ScopeLoc,
3020 ParsedAttr::Form Form);
3022 void ParseAttributeWithTypeArg(IdentifierInfo &AttrName,
3023 SourceLocation AttrNameLoc,
3024 ParsedAttributes &Attrs,
3025 IdentifierInfo *ScopeName,
3026 SourceLocation ScopeLoc,
3027 ParsedAttr::Form Form);
3029 void ParseTypeofSpecifier(DeclSpec &DS);
3030 SourceLocation ParseDecltypeSpecifier(DeclSpec &DS);
3031 void AnnotateExistingDecltypeSpecifier(
const DeclSpec &DS,
3032 SourceLocation StartLoc,
3033 SourceLocation EndLoc);
3034 void ParseAtomicSpecifier(DeclSpec &DS);
3036 ExprResult ParseAlignArgument(StringRef KWName, SourceLocation Start,
3037 SourceLocation &EllipsisLoc,
bool &IsType,
3039 void ParseAlignmentSpecifier(ParsedAttributes &Attrs,
3040 SourceLocation *endLoc =
nullptr);
3045 return isCXX11VirtSpecifier(Tok);
3047 void ParseOptionalCXX11VirtSpecifierSeq(VirtSpecifiers &VS,
bool IsInterface,
3048 SourceLocation FriendLoc);
3050 bool isCXX11FinalKeyword()
const;
3051 bool isClassCompatibleKeyword()
const;
3056 class DeclaratorScopeObj {
3062 DeclaratorScopeObj(Parser &p, CXXScopeSpec &ss)
3063 :
P(p), SS(ss), EnteredScope(
false), CreatedScope(
false) {}
3065 void EnterDeclaratorScope() {
3066 assert(!EnteredScope &&
"Already entered the scope!");
3067 assert(SS.isSet() &&
"C++ scope was not set!");
3069 CreatedScope =
true;
3072 if (!
P.Actions.ActOnCXXEnterDeclaratorScope(
P.getCurScope(), SS))
3073 EnteredScope =
true;
3076 ~DeclaratorScopeObj() {
3078 assert(SS.isSet() &&
"C++ scope was cleared ?");
3079 P.Actions.ActOnCXXExitDeclaratorScope(
P.getCurScope(), SS);
3087 void ParseDeclarator(Declarator &D);
3089 typedef void (Parser::*DirectDeclParseFunction)(
Declarator&);
3090 void ParseDeclaratorInternal(Declarator &D,
3091 DirectDeclParseFunction DirectDeclParser);
3093 enum AttrRequirements {
3094 AR_NoAttributesParsed = 0,
3095 AR_GNUAttributesParsedAndRejected = 1 << 0,
3096 AR_GNUAttributesParsed = 1 << 1,
3097 AR_CXX11AttributesParsed = 1 << 2,
3098 AR_DeclspecAttributesParsed = 1 << 3,
3099 AR_AllAttributesParsed = AR_GNUAttributesParsed |
3100 AR_CXX11AttributesParsed |
3101 AR_DeclspecAttributesParsed,
3102 AR_VendorAttributesParsed = AR_GNUAttributesParsed |
3103 AR_DeclspecAttributesParsed
3106 void ParseTypeQualifierListOpt(
3107 DeclSpec &DS,
unsigned AttrReqs = AR_AllAttributesParsed,
3108 bool AtomicAllowed =
true,
bool IdentifierRequired =
false,
3109 std::optional<llvm::function_ref<
void()>> CodeCompletionHandler =
3111 void ParseDirectDeclarator(Declarator &D);
3112 void ParseDecompositionDeclarator(Declarator &D);
3113 void ParseParenDeclarator(Declarator &D);
3114 void ParseFunctionDeclarator(Declarator &D, ParsedAttributes &FirstArgAttrs,
3116 bool IsAmbiguous,
bool RequiresArg =
false);
3117 void InitCXXThisScopeForDeclaratorIfRelevant(
3118 const Declarator &D,
const DeclSpec &DS,
3119 std::optional<Sema::CXXThisScopeRAII> &ThisScope);
3120 bool ParseRefQualifier(
bool &RefQualifierIsLValueRef,
3121 SourceLocation &RefQualifierLoc);
3122 bool isFunctionDeclaratorIdentifierList();
3123 void ParseFunctionDeclaratorIdentifierList(
3125 SmallVectorImpl<DeclaratorChunk::ParamInfo> &ParamInfo);
3126 void ParseParameterDeclarationClause(
3127 Declarator &D, ParsedAttributes &attrs,
3128 SmallVectorImpl<DeclaratorChunk::ParamInfo> &ParamInfo,
3129 SourceLocation &EllipsisLoc) {
3130 return ParseParameterDeclarationClause(
3131 D.getContext(), attrs, ParamInfo, EllipsisLoc,
3132 D.getCXXScopeSpec().isSet() &&
3133 D.isFunctionDeclaratorAFunctionDeclaration());
3135 void ParseParameterDeclarationClause(
3137 SmallVectorImpl<DeclaratorChunk::ParamInfo> &ParamInfo,
3138 SourceLocation &EllipsisLoc,
bool IsACXXFunctionDeclaration =
false);
3140 void ParseBracketDeclarator(Declarator &D);
3141 void ParseMisplacedBracketDeclarator(Declarator &D);
3142 bool MaybeParseTypeTransformTypeSpecifier(DeclSpec &DS);
3149 enum CXX11AttributeKind {
3151 CAK_NotAttributeSpecifier,
3153 CAK_AttributeSpecifier,
3156 CAK_InvalidAttributeSpecifier
3159 isCXX11AttributeSpecifier(
bool Disambiguate =
false,
3160 bool OuterMightBeMessageSend =
false);
3162 void DiagnoseUnexpectedNamespace(NamedDecl *Context);
3165 SourceLocation &DeclEnd,
3166 SourceLocation InlineLoc = SourceLocation());
3168 struct InnerNamespaceInfo {
3169 SourceLocation NamespaceLoc;
3170 SourceLocation InlineLoc;
3171 SourceLocation IdentLoc;
3172 IdentifierInfo *Ident;
3176 void ParseInnerNamespace(
const InnerNamespaceInfoList &InnerNSs,
3177 unsigned int index, SourceLocation &InlineLoc,
3178 ParsedAttributes &attrs,
3181 Decl *ParseExportDeclaration();
3184 SourceLocation &DeclEnd, ParsedAttributes &Attrs);
3186 SourceLocation UsingLoc,
3187 SourceLocation &DeclEnd,
3188 ParsedAttributes &attrs);
3190 struct UsingDeclarator {
3191 SourceLocation TypenameLoc;
3194 SourceLocation EllipsisLoc;
3197 TypenameLoc = EllipsisLoc = SourceLocation();
3205 const ParsedTemplateInfo &TemplateInfo,
3206 SourceLocation UsingLoc,
3207 SourceLocation &DeclEnd,
3208 ParsedAttributes &Attrs,
3210 Decl *ParseAliasDeclarationAfterDeclarator(
3211 const ParsedTemplateInfo &TemplateInfo, SourceLocation UsingLoc,
3213 ParsedAttributes &Attrs, Decl **OwnedType =
nullptr);
3215 Decl *ParseStaticAssertDeclaration(SourceLocation &DeclEnd);
3216 Decl *ParseNamespaceAlias(SourceLocation NamespaceLoc,
3217 SourceLocation AliasLoc, IdentifierInfo *Alias,
3218 SourceLocation &DeclEnd);
3222 bool isValidAfterTypeSpecifier(
bool CouldBeBitfield);
3223 void ParseClassSpecifier(
tok::TokenKind TagTokKind, SourceLocation TagLoc,
3224 DeclSpec &DS,
const ParsedTemplateInfo &TemplateInfo,
3226 DeclSpecContext DSC, ParsedAttributes &Attributes);
3227 void SkipCXXMemberSpecification(SourceLocation StartLoc,
3228 SourceLocation AttrFixitLoc,
3231 void ParseCXXMemberSpecification(SourceLocation StartLoc,
3232 SourceLocation AttrFixitLoc,
3233 ParsedAttributes &Attrs,
unsigned TagType,
3235 ExprResult ParseCXXMemberInitializer(Decl *D,
bool IsFunction,
3236 SourceLocation &EqualLoc);
3238 ParseCXXMemberDeclaratorBeforeInitializer(Declarator &DeclaratorInfo,
3241 LateParsedAttrList &LateAttrs);
3242 void MaybeParseAndDiagnoseDeclSpecAfterCXX11VirtSpecifierSeq(Declarator &D,
3243 VirtSpecifiers &VS);
3246 const ParsedTemplateInfo &TemplateInfo = ParsedTemplateInfo(),
3247 ParsingDeclRAIIObject *DiagsFromTParams =
nullptr);
3250 ParsedAttributes &AccessAttrs,
3252 void ParseConstructorInitializer(Decl *ConstructorDecl);
3254 void HandleMemberFunctionDeclDelays(Declarator& DeclaratorInfo,
3259 TypeResult ParseBaseTypeSpecifier(SourceLocation &BaseLoc,
3260 SourceLocation &EndLocation);
3261 void ParseBaseClause(Decl *ClassDecl);
3262 BaseResult ParseBaseSpecifier(Decl *ClassDecl);
3265 bool ParseUnqualifiedIdTemplateId(CXXScopeSpec &SS,
3267 bool ObjectHadErrors,
3268 SourceLocation TemplateKWLoc,
3269 IdentifierInfo *Name,
3270 SourceLocation NameLoc,
3271 bool EnteringContext,
3273 bool AssumeTemplateId);
3274 bool ParseUnqualifiedIdOperator(CXXScopeSpec &SS,
bool EnteringContext,
3283 SourceLocation Loc);
3287 void parseOMPTraitPropertyKind(OMPTraitProperty &TIProperty,
3288 llvm::omp::TraitSet Set,
3289 llvm::omp::TraitSelector Selector,
3290 llvm::StringMap<SourceLocation> &Seen);
3293 void parseOMPTraitSelectorKind(OMPTraitSelector &TISelector,
3294 llvm::omp::TraitSet Set,
3295 llvm::StringMap<SourceLocation> &Seen);
3298 void parseOMPTraitSetKind(OMPTraitSet &TISet,
3299 llvm::StringMap<SourceLocation> &Seen);
3302 void parseOMPContextProperty(OMPTraitSelector &TISelector,
3303 llvm::omp::TraitSet Set,
3304 llvm::StringMap<SourceLocation> &Seen);
3307 void parseOMPContextSelector(OMPTraitSelector &TISelector,
3308 llvm::omp::TraitSet Set,
3309 llvm::StringMap<SourceLocation> &SeenSelectors);
3312 void parseOMPContextSelectorSet(OMPTraitSet &TISet,
3313 llvm::StringMap<SourceLocation> &SeenSets);
3316 bool parseOMPContextSelectors(SourceLocation Loc, OMPTraitInfo &TI);
3319 bool parseOpenMPAppendArgs(SmallVectorImpl<OMPInteropInfo> &InteropInfos);
3323 bool parseOMPDeclareVariantMatchClause(SourceLocation Loc, OMPTraitInfo &TI,
3324 OMPTraitInfo *ParentTI);
3328 SourceLocation Loc);
3332 SourceLocation Loc);
3335 void ParseOpenMPEndAssumesDirective(SourceLocation Loc);
3343 SmallVectorImpl<clang::OMPClause *> &Clauses,
3344 SourceLocation Loc);
3347 void ParseOMPDeclareTargetClauses(Sema::DeclareTargetContextInfo &DTCI);
3352 SourceLocation Loc);
3365 SourceLocation MatchingLoc,
3366 SourceLocation FoundLoc,
3367 bool SkipUntilOpenMPEnd);
3373 Decl *TagDecl =
nullptr);
3378 void ParseOpenMPReductionInitializerForDecl(VarDecl *OmpPrivParm);
3383 TypeResult parseOpenMPDeclareMapperVarDecl(SourceRange &Range,
3384 DeclarationName &Name,
3389 bool tryParseOpenMPArrayShapingCastPart();
3398 bool ParseOpenMPSimpleVarList(
3400 const llvm::function_ref<
void(CXXScopeSpec &, DeclarationNameInfo)> &
3402 bool AllowScopeSpecifier);
3408 StmtResult ParseOpenMPDeclarativeOrExecutableDirective(
3409 ParsedStmtContext StmtCtx,
bool ReadDirectiveWithinMetadirective =
false);
3437 bool ParseOpenMPIndirectClause(Sema::DeclareTargetContextInfo &DTCI,
3452 OMPClause *ParseOpenMPSizesClause();
3460 OMPClause *ParseOpenMPClause(
OpenMPClauseKind Kind,
bool ParseOnly =
false);
3481 bool ParseOMPInteropInfo(OMPInteropInfo &InteropInfo,
OpenMPClauseKind Kind);
3489 OMPClause *ParseOpenMPInteropClause(
OpenMPClauseKind Kind,
bool ParseOnly);
3496 OMPClause *ParseOpenMPOMPXAttributesClause(
bool ParseOnly);
3503 bool IsAddressOfOperand =
false);
3507 Sema::OpenMPVarListDataTy &
Data,
3508 const LangOptions &LangOpts);
3511 SmallVectorImpl<Expr *> &Vars,
3512 Sema::OpenMPVarListDataTy &
Data);
3514 bool ObjectHadErrors,
bool EnteringContext,
3515 bool AllowDestructorName,
bool AllowConstructorName,
3516 bool AllowDeductionGuide,
3517 SourceLocation *TemplateKWLoc, UnqualifiedId &
Result);
3532 SourceLocation &DeclEnd,
3533 ParsedAttributes &AccessAttrs,
3536 SourceLocation &DeclEnd,
3537 ParsedAttributes &AccessAttrs,
3539 Decl *ParseSingleDeclarationAfterTemplate(
3541 ParsingDeclRAIIObject &DiagsFromParams, SourceLocation &DeclEnd,
3543 bool ParseTemplateParameters(MultiParseScope &TemplateScopes,
unsigned Depth,
3544 SmallVectorImpl<NamedDecl *> &TemplateParams,
3545 SourceLocation &LAngleLoc,
3546 SourceLocation &RAngleLoc);
3547 bool ParseTemplateParameterList(
unsigned Depth,
3548 SmallVectorImpl<NamedDecl*> &TemplateParams);
3549 TPResult isStartOfTemplateTypeParameter();
3550 NamedDecl *ParseTemplateParameter(
unsigned Depth,
unsigned Position);
3551 NamedDecl *ParseTypeParameter(
unsigned Depth,
unsigned Position);
3552 NamedDecl *ParseTemplateTemplateParameter(
unsigned Depth,
unsigned Position);
3553 NamedDecl *ParseNonTypeTemplateParameter(
unsigned Depth,
unsigned Position);
3554 bool isTypeConstraintAnnotation();
3555 bool TryAnnotateTypeConstraint();
3556 void DiagnoseMisplacedEllipsis(SourceLocation EllipsisLoc,
3557 SourceLocation CorrectLoc,
3558 bool AlreadyHasEllipsis,
3559 bool IdentifierHasName);
3560 void DiagnoseMisplacedEllipsisInDeclarator(SourceLocation EllipsisLoc,
3563 typedef SmallVector<ParsedTemplateArgument, 16> TemplateArgList;
3565 bool ParseGreaterThanInTemplateList(SourceLocation LAngleLoc,
3566 SourceLocation &RAngleLoc,
3567 bool ConsumeLastToken,
3568 bool ObjCGenericList);
3569 bool ParseTemplateIdAfterTemplateName(
bool ConsumeLastToken,
3570 SourceLocation &LAngleLoc,
3571 TemplateArgList &TemplateArgs,
3572 SourceLocation &RAngleLoc,
3577 SourceLocation TemplateKWLoc,
3578 UnqualifiedId &TemplateName,
3579 bool AllowTypeAnnotation =
true,
3580 bool TypeConstraint =
false);
3582 AnnotateTemplateIdTokenAsType(CXXScopeSpec &SS,
3584 bool IsClassName =
false);
3585 bool ParseTemplateArgumentList(TemplateArgList &TemplateArgs,
3586 TemplateTy Template, SourceLocation OpenLoc);
3587 ParsedTemplateArgument ParseTemplateTemplateArgument();
3588 ParsedTemplateArgument ParseTemplateArgument();
3590 SourceLocation ExternLoc,
3591 SourceLocation TemplateLoc,
3592 SourceLocation &DeclEnd,
3593 ParsedAttributes &AccessAttrs,
3597 ParseConceptDefinition(
const ParsedTemplateInfo &TemplateInfo,
3598 SourceLocation &DeclEnd);
3603 Decl *ParseModuleImport(SourceLocation AtLoc,
3605 bool parseMisplacedModuleImport();
3606 bool tryParseMisplacedModuleImport() {
3608 if (Kind == tok::annot_module_begin || Kind == tok::annot_module_end ||
3609 Kind == tok::annot_module_include)
3610 return parseMisplacedModuleImport();
3614 bool ParseModuleName(
3615 SourceLocation UseLoc,
3616 SmallVectorImpl<std::pair<IdentifierInfo *, SourceLocation>> &Path,
3630 void CodeCompleteDirective(
bool InConditional)
override;
3631 void CodeCompleteInConditionalExclusion()
override;
3632 void CodeCompleteMacroName(
bool IsDefinition)
override;
3633 void CodeCompletePreprocessorExpression()
override;
3634 void CodeCompleteMacroArgument(IdentifierInfo *Macro, MacroInfo *MacroInfo,
3635 unsigned ArgumentIndex)
override;
3636 void CodeCompleteIncludedFile(llvm::StringRef Dir,
bool IsAngled)
override;
3637 void CodeCompleteNaturalLanguage()
override;
3639 class GNUAsmQualifiers {
3640 unsigned Qualifiers = AQ_unspecified;
3649 static const char *getQualifierName(AQ Qualifier);
3650 bool setAsmQualifier(AQ Qualifier);
3651 inline bool isVolatile()
const {
return Qualifiers & AQ_volatile; };
3652 inline bool isInline()
const {
return Qualifiers & AQ_inline; };
3653 inline bool isGoto()
const {
return Qualifiers & AQ_goto; }
3655 bool isGCCAsmStatement(
const Token &TokAfterAsm)
const;
3656 bool isGNUAsmQualifier(
const Token &TokAfterAsm)
const;
3657 GNUAsmQualifiers::AQ getGNUAsmQualifier(
const Token &Tok)
const;
3658 bool parseGNUAsmQualifierListOpt(GNUAsmQualifiers &AQ);
Defines and computes precedence levels for binary/ternary operators.
Defines the clang::Preprocessor interface.
static bool isInvalid(LocType Loc, bool *Invalid)
The result of parsing/analyzing an expression, statement etc.
A factory, from which one makes pools, from which one creates individual attributes which are dealloc...
RAII class that helps handle the parsing of an open/close delimiter pair, such as braces { ....
Callback handler that receives notifications when performing code completion within the preprocessor.
ColonProtectionRAIIObject - This sets the Parser::ColonIsSacred bool and restores it when destroyed.
static const TST TST_unspecified
Decl - This represents one declaration (or definition), e.g.
A little helper class used to produce diagnostics.
Concrete class used by the front-end to report problems and issues.
This represents one expression.
One of these records is kept for each identifier that is lexed.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
ObjCContainerDecl - Represents a container for method declarations.
Wrapper for void* pointer.
static OpaquePtr getFromOpaquePtr(void *P)
RAII object that makes sure paren/bracket/brace count is correct after declaration/statement parsing,...
Introduces zero or more scopes for parsing.
MultiParseScope(Parser &Self)
void Enter(unsigned ScopeFlags)
ParseScope - Introduces a new scope for parsing.
ParseScope(Parser *Self, unsigned ScopeFlags, bool EnteredScope=true, bool BeforeCompoundStmt=false)
Parser - This implements a parser for the C family of languages.
TypeResult ParseTypeName(SourceRange *Range=nullptr, DeclaratorContext Context=DeclaratorContext::TypeName, AccessSpecifier AS=AS_none, Decl **OwnedType=nullptr, ParsedAttributes *Attrs=nullptr)
ParseTypeName type-name: [C99 6.7.6] specifier-qualifier-list abstract-declarator[opt].
DiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID)
bool TryAnnotateTypeOrScopeTokenAfterScopeSpec(CXXScopeSpec &SS, bool IsNewScope, ImplicitTypenameContext AllowImplicitTypename)
Try to annotate a type or scope token, having already parsed an optional scope specifier.
Preprocessor & getPreprocessor() const
Sema::FullExprArg FullExprArg
SourceLocation ConsumeToken()
ConsumeToken - Consume the current 'peek token' and lex the next one.
Parser(Preprocessor &PP, Sema &Actions, bool SkipFunctionBodies)
AttributeFactory & getAttrFactory()
void incrementMSManglingNumber() const
Sema & getActions() const
static TypeResult getTypeAnnotation(const Token &Tok)
getTypeAnnotation - Read a parsed type out of an annotation token.
ExprResult ParseCaseExpression(SourceLocation CaseLoc)
void EnterScope(unsigned ScopeFlags)
EnterScope - Start a new scope.
ExprResult ParseConstraintLogicalOrExpression(bool IsTrailingRequiresClause)
Parse a constraint-logical-or-expression.
ExprResult ParseMSAsmIdentifier(llvm::SmallVectorImpl< Token > &LineToks, unsigned &NumLineToksConsumed, bool IsUnevaluated)
Parse an identifier in an MS-style inline assembly block.
bool ParseUnqualifiedId(CXXScopeSpec &SS, ParsedType ObjectType, bool ObjectHadErrors, bool EnteringContext, bool AllowDestructorName, bool AllowConstructorName, bool AllowDeductionGuide, SourceLocation *TemplateKWLoc, UnqualifiedId &Result)
Parse a C++ unqualified-id (or a C identifier), which describes the name of an entity.
bool TryAnnotateOptionalCXXScopeToken(bool EnteringContext=false)
friend class ColonProtectionRAIIObject
bool SkipUntil(tok::TokenKind T1, tok::TokenKind T2, SkipUntilFlags Flags=static_cast< SkipUntilFlags >(0))
SourceLocation ConsumeAnyToken(bool ConsumeCodeCompletionTok=false)
ConsumeAnyToken - Dispatch to the right Consume* method based on the current token type.
bool ParseOpenMPVarList(OpenMPDirectiveKind DKind, OpenMPClauseKind Kind, SmallVectorImpl< Expr * > &Vars, Sema::OpenMPVarListDataTy &Data)
Parses clauses with list.
ExprResult ParseConstantExpression()
bool TryConsumeToken(tok::TokenKind Expected)
friend constexpr SkipUntilFlags operator|(SkipUntilFlags L, SkipUntilFlags R)
OpaquePtr< DeclGroupRef > DeclGroupPtrTy
Scope * getCurScope() const
SourceLocation getEndOfPreviousToken()
ExprResult ParseConstraintLogicalAndExpression(bool IsTrailingRequiresClause)
Parse a constraint-logical-and-expression.
const TargetInfo & getTargetInfo() const
OpaquePtr< TemplateName > TemplateTy
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...
const Token & getCurToken() const
IdentifierInfo * getNullabilityKeyword(NullabilityKind nullability)
Retrieve the underscored keyword (_Nonnull, _Nullable) that corresponds to the given nullability kind...
friend class ObjCDeclContextSwitch
bool SkipUntil(tok::TokenKind T1, tok::TokenKind T2, tok::TokenKind T3, SkipUntilFlags Flags=static_cast< SkipUntilFlags >(0))
void ExitScope()
ExitScope - Pop a scope off the scope stack.
ExprResult ParseAssignmentExpression(TypeCastState isTypeCast=NotTypeCast)
Parse an expr that doesn't include (top-level) commas.
ExprResult ParseOpenMPParensExpr(StringRef ClauseName, SourceLocation &RLoc, bool IsAddressOfOperand=false)
Parses simple expression in parens for single-expression clauses of OpenMP constructs.
ExprResult ParseConstantExpressionInExprEvalContext(TypeCastState isTypeCast=NotTypeCast)
SourceLocation MisleadingIndentationElseLoc
The location of the first statement inside an else that might have a missleading indentation.
const LangOptions & getLangOpts() const
ExprResult ParseExpression(TypeCastState isTypeCast=NotTypeCast)
Simple precedence-based parser for binary/ternary operators.
bool ParseFirstTopLevelDecl(DeclGroupPtrTy &Result, Sema::ModuleImportState &ImportState)
Parse the first top-level declaration in a translation unit.
bool ParseOpenMPReservedLocator(OpenMPClauseKind Kind, Sema::OpenMPVarListDataTy &Data, const LangOptions &LangOpts)
Parses a reserved locator like 'omp_all_memory'.
DiagnosticBuilder Diag(unsigned DiagID)
SmallVector< Stmt *, 32 > StmtVector
A SmallVector of statements.
bool parseMapperModifier(Sema::OpenMPVarListDataTy &Data)
Parses the mapper modifier in map, to, and from clauses.
bool parseMapTypeModifiers(Sema::OpenMPVarListDataTy &Data)
Parses map-type-modifiers in map clause.
SkipUntilFlags
Control flags for SkipUntil functions.
@ StopBeforeMatch
Stop skipping at specified token, but don't skip the token itself.
@ StopAtCodeCompletion
Stop at code completion.
@ StopAtSemi
Stop skipping at semicolon.
bool TryAnnotateTypeOrScopeToken(ImplicitTypenameContext AllowImplicitTypename=ImplicitTypenameContext::No)
TryAnnotateTypeOrScopeToken - If the current token position is on a typename (possibly qualified in C...
bool MightBeCXXScopeToken()
TypeCastState
TypeCastState - State whether an expression is or may be a type cast.
ExprResult ParseUnevaluatedStringLiteralExpression()
ExprResult ParseStringLiteralExpression(bool AllowUserDefinedLiteral=false)
ObjCContainerDecl * getObjCDeclContext() const
const Token & NextToken()
NextToken - This peeks ahead one token and returns it without consuming it.
friend class BalancedDelimiterTracker
bool TryConsumeToken(tok::TokenKind Expected, SourceLocation &Loc)
ExprResult ParseConstraintExpression()
Parse a constraint-expression.
SmallVector< TemplateParameterList *, 4 > TemplateParameterLists
void Initialize()
Initialize - Warm up the parser.
unsigned ReenterTemplateScopes(MultiParseScope &S, Decl *D)
Re-enter the template scopes for a declaration that might be a template.
bool TryAnnotateCXXScopeToken(bool EnteringContext=false)
TryAnnotateScopeToken - Like TryAnnotateTypeOrScopeToken but only annotates C++ scope specifiers and ...
Activates OpenMP parsing mode to preseve OpenMP specific annotation tokens.
Tracks expected type during expression parsing, for use in code completion.
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
void EnterToken(const Token &Tok, bool IsReinject)
Enters a token in the token stream to be lexed next.
void setCodeCompletionReached()
Note that we hit the code-completion point.
bool mightHavePendingAnnotationTokens()
Determine whether it's possible for a future call to Lex to produce an annotation token created by a ...
void Lex(Token &Result)
Lex the next token for this preprocessor.
const Token & LookAhead(unsigned N)
Peeks ahead N tokens and returns that token without consuming any tokens.
IdentifierInfo * getIdentifierInfo(StringRef Name) const
Return information about the specified preprocessor identifier token.
const TargetInfo & getTargetInfo() const
bool isCodeCompletionEnabled() const
Determine if we are performing code completion.
const LangOptions & getLangOpts() const
SourceLocation getLocForEndOfToken(SourceLocation Loc, unsigned Offset=0)
Computes the source location just past the end of the token at this source location.
Scope - A scope is a transient data structure that is used while parsing the program.
Sema - This implements semantic analysis and AST building for C.
Scope * getCurScope() const
Retrieve the parser's current scope.
void startOpenMPLoop()
If the current region is a loop-based region, mark the start of the loop construct.
ProcessingContextState ParsingClassState
IdentifierInfo * getNullabilityKeyword(NullabilityKind nullability)
Retrieve the keyword associated.
ObjCContainerDecl * getObjCDeclContext() const
ModuleImportState
An enumeration to represent the transition of states in parsing module fragments and imports.
@ NotACXX20Module
Not a C++20 TU, or an invalid state was found.
void incrementMSManglingNumber() const
Encodes a location in the source.
A trivial tuple used to represent a source range.
Exposes information about the current target.
Represents a C++ template name within the type system.
Token - This structure provides full information about a lexed token.
SourceLocation getLocation() const
Return a source location identifier for the specified offset in the current file.
void setKind(tok::TokenKind K)
SourceLocation getAnnotationEndLoc() 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)) {....
void * getAnnotationValue() const
tok::TokenKind getKind() const
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.
void setAnnotationValue(void *val)
@ Decl
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
@ LLVM_MARK_AS_BITMASK_ENUM
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
llvm::DenseMap< int, SourceRange > ParsedSubjectMatchRuleSet
bool Pop(InterpState &S, CodePtr OpPC)
bool isStringLiteral(TokenKind K)
Return true if this is a C or C++ string-literal (or C++11 user-defined-string-literal) token.
ObjCKeywordKind
Provides a namespace for Objective-C keywords which start with an '@'.
TokenKind
Provides a simple uniform namespace for tokens from all C languages.
llvm::omp::Directive OpenMPDirectiveKind
OpenMP directives.
NullabilityKind
Describes the nullability of a particular type.
llvm::omp::Clause OpenMPClauseKind
OpenMP clauses.
ActionResult< CXXCtorInitializer * > MemInitResult
@ C
Languages that the frontend can parse and compile.
@ Result
The result type of a method or function.
ActionResult< Expr * > ExprResult
ActionResult< Stmt * > StmtResult
TemplateNameKind
Specifies the kind of template name that an identifier refers to.
ActionResult< ParsedType > TypeResult
OpaquePtr< QualType > ParsedType
An opaque type for threading parsed type information through the parser.
SmallVector< Token, 4 > CachedTokens
A set of tokens that has been cached for later parsing.
ExceptionSpecificationType
The various types of exception specifications that exist in C++11.
ActionResult< CXXBaseSpecifier * > BaseResult
AccessSpecifier
A C++ access specifier (public, private, protected), plus the special value "none" which means differ...
unsigned short BracketCount
unsigned short BraceCount
AngleBracketTracker::Priority Priority
bool isActive(Parser &P) const
unsigned short ParenCount
bool isActiveOrNested(Parser &P) const