BalancedDelimiterTracker;
34 classCorrectionCandidateCallback;
36 classDiagnosticBuilder;
39 classParsingDeclRAIIObject;
40 classParsingDeclSpec;
41 classParsingDeclarator;
42 classParsingFieldDeclarator;
43 classColonProtectionRAIIObject;
44 classInMessageExpressionRAIIObject;
45 classPoisonSEHIdentifiersRAIIObject;
48 classObjCTypeParamList;
49 structOMPTraitProperty;
50 structOMPTraitSelector;
85 unsigned shortParenCount = 0, BracketCount = 0, BraceCount = 0;
86 unsigned shortMisplacedModuleBeginCount = 0;
95 enum{ ScopeCacheSize = 16 };
96 unsignedNumCachedScopes;
97 Scope*ScopeCache[ScopeCacheSize];
103*Ident___exception_code,
104*Ident_GetExceptionCode;
107*Ident___exception_info,
108*Ident_GetExceptionInfo;
111*Ident___abnormal_termination,
112*Ident_AbnormalTermination;
161*Ident_generated_declaration, *Ident_USR;
174llvm::SmallDenseMap<IdentifierInfo *, tok::TokenKind> RevertibleTypeTraits;
176std::unique_ptr<PragmaHandler> AlignHandler;
177std::unique_ptr<PragmaHandler> GCCVisibilityHandler;
178std::unique_ptr<PragmaHandler> OptionsHandler;
179std::unique_ptr<PragmaHandler> PackHandler;
180std::unique_ptr<PragmaHandler> MSStructHandler;
181std::unique_ptr<PragmaHandler> UnusedHandler;
182std::unique_ptr<PragmaHandler> WeakHandler;
183std::unique_ptr<PragmaHandler> RedefineExtnameHandler;
184std::unique_ptr<PragmaHandler> FPContractHandler;
185std::unique_ptr<PragmaHandler> OpenCLExtensionHandler;
186std::unique_ptr<PragmaHandler> OpenMPHandler;
187std::unique_ptr<PragmaHandler> OpenACCHandler;
188std::unique_ptr<PragmaHandler> PCSectionHandler;
189std::unique_ptr<PragmaHandler> MSCommentHandler;
190std::unique_ptr<PragmaHandler> MSDetectMismatchHandler;
191std::unique_ptr<PragmaHandler> FPEvalMethodHandler;
192std::unique_ptr<PragmaHandler> FloatControlHandler;
193std::unique_ptr<PragmaHandler> MSPointersToMembers;
194std::unique_ptr<PragmaHandler> MSVtorDisp;
195std::unique_ptr<PragmaHandler> MSInitSeg;
196std::unique_ptr<PragmaHandler> MSDataSeg;
197std::unique_ptr<PragmaHandler> MSBSSSeg;
198std::unique_ptr<PragmaHandler> MSConstSeg;
199std::unique_ptr<PragmaHandler> MSCodeSeg;
200std::unique_ptr<PragmaHandler> MSSection;
201std::unique_ptr<PragmaHandler> MSStrictGuardStackCheck;
202std::unique_ptr<PragmaHandler> MSRuntimeChecks;
203std::unique_ptr<PragmaHandler> MSIntrinsic;
204std::unique_ptr<PragmaHandler> MSFunction;
205std::unique_ptr<PragmaHandler> MSOptimize;
206std::unique_ptr<PragmaHandler> MSFenvAccess;
207std::unique_ptr<PragmaHandler> MSAllocText;
208std::unique_ptr<PragmaHandler> CUDAForceHostDeviceHandler;
209std::unique_ptr<PragmaHandler> OptimizeHandler;
210std::unique_ptr<PragmaHandler> LoopHintHandler;
211std::unique_ptr<PragmaHandler> UnrollHintHandler;
212std::unique_ptr<PragmaHandler> NoUnrollHintHandler;
213std::unique_ptr<PragmaHandler> UnrollAndJamHintHandler;
214std::unique_ptr<PragmaHandler> NoUnrollAndJamHintHandler;
215std::unique_ptr<PragmaHandler> FPHandler;
216std::unique_ptr<PragmaHandler> STDCFenvAccessHandler;
217std::unique_ptr<PragmaHandler> STDCFenvRoundHandler;
218std::unique_ptr<PragmaHandler> STDCCXLIMITHandler;
219std::unique_ptr<PragmaHandler> STDCUnknownHandler;
220std::unique_ptr<PragmaHandler> AttributePragmaHandler;
221std::unique_ptr<PragmaHandler> MaxTokensHerePragmaHandler;
222std::unique_ptr<PragmaHandler> MaxTokensTotalPragmaHandler;
223std::unique_ptr<PragmaHandler> RISCVPragmaHandler;
225std::unique_ptr<CommentHandler> CommentSemaHandler;
231 boolGreaterThanIsOperator;
240 boolOpenMPDirectiveParsing =
false;
243 boolOpenACCDirectiveParsing =
false;
247 boolAllowOpenACCArraySections =
false;
251 classOpenACCArraySectionRAII {
255OpenACCArraySectionRAII(
Parser&P) :
P(
P) {
256assert(!
P.AllowOpenACCArraySections);
257 P.AllowOpenACCArraySections =
true;
259~OpenACCArraySectionRAII() {
260assert(
P.AllowOpenACCArraySections);
261 P.AllowOpenACCArraySections =
false;
270 boolInMessageExpression;
275 boolCalledSignatureHelp =
false;
280 unsignedTemplateParameterDepth;
286 classTemplateParameterDepthRAII {
288 unsignedAddedLevels;
290 explicitTemplateParameterDepthRAII(
unsigned&Depth)
291: Depth(Depth), AddedLevels(0) {}
293~TemplateParameterDepthRAII() {
294Depth -= AddedLevels;
301 voidaddDepth(
unsigned D) {
305 voidsetAddedDepth(
unsigned D) {
306Depth = Depth - AddedLevels +
D;
310 unsignedgetDepth()
const{
returnDepth; }
311 unsignedgetOriginalDepth()
const{
returnDepth - AddedLevels; }
315AttributeFactory AttrFactory;
319SmallVector<TemplateIdAnnotation *, 16> TemplateIds;
325 boolDelayTemplateIdDestruction =
false;
327 voidMaybeDestroyTemplateIds() {
328 if(DelayTemplateIdDestruction)
330 if(!TemplateIds.empty() &&
332DestroyTemplateIds();
334 voidDestroyTemplateIds();
338 structDestroyTemplateIdAnnotationsRAIIObj {
341DestroyTemplateIdAnnotationsRAIIObj(Parser &Self) : Self(Self) {}
342~DestroyTemplateIdAnnotationsRAIIObj() { Self.MaybeDestroyTemplateIds(); }
345 structDelayTemplateIdDestructionRAII {
347 boolPrevDelayTemplateIdDestruction;
349DelayTemplateIdDestructionRAII(Parser &Self,
350 boolDelayTemplateIdDestruction) noexcept
352PrevDelayTemplateIdDestruction(Self.DelayTemplateIdDestruction) {
353Self.DelayTemplateIdDestruction = DelayTemplateIdDestruction;
356~DelayTemplateIdDestructionRAII() noexcept {
357Self.DelayTemplateIdDestruction = PrevDelayTemplateIdDestruction;
362SmallVector<const IdentifierInfo *, 8> TentativelyDeclaredIdentifiers;
374 structAngleBracketTracker {
384SpaceBeforeLess = 0x0,
386NoSpaceBeforeLess = 0x1,
417 if(!Locs.empty() && Locs.back().isActive(
P)) {
418 if(Locs.back().Priority <= Prio) {
420Locs.back().LessLoc = LessLoc;
421Locs.back().Priority = Prio;
424Locs.push_back({TemplateName, LessLoc, Prio,
425 P.ParenCount,
P.BracketCount,
P.BraceCount});
432 voidclear(Parser &
P) {
433 while(!Locs.empty() && Locs.back().isActiveOrNested(
P))
439 Loc*getCurrent(Parser &
P) {
440 if(!Locs.empty() && Locs.back().isActive(
P))
446AngleBracketTracker AngleBrackets;
448IdentifierInfo *getSEHExceptKeyword();
455 boolParsingInObjCContainer;
461 boolSkipFunctionBodies;
466SourceLocation ExprStatementTokLoc;
469 enum classParsedStmtContext {
472AllowDeclarationsInC = 0x1,
474AllowStandaloneOpenMPDirectives = 0x2,
481Compound = AllowDeclarationsInC | AllowStandaloneOpenMPDirectives,
492 Parser(Preprocessor &PP, Sema &Actions,
boolSkipFunctionBodies);
549assert(!isTokenSpecial() &&
550 "Should consume special tokens with Consume*Token");
553 returnPrevTokLocation;
559assert(!isTokenSpecial() &&
560 "Should consume special tokens with Consume*Token");
569 Loc= PrevTokLocation;
578 returnConsumeParen();
579 if(isTokenBracket())
580 returnConsumeBracket();
582 returnConsumeBrace();
583 if(isTokenStringLiteral())
584 returnConsumeStringToken();
585 if(Tok.
is(tok::code_completion))
586 returnConsumeCodeCompletionTok ? ConsumeCodeCompletionToken()
587: handleUnexpectedCodeCompletionToken();
589 returnConsumeAnnotationToken();
610 boolisTokenParen()
const{
611 returnTok.
isOneOf(tok::l_paren, tok::r_paren);
614 boolisTokenBracket()
const{
615 returnTok.
isOneOf(tok::l_square, tok::r_square);
618 boolisTokenBrace()
const{
619 returnTok.
isOneOf(tok::l_brace, tok::r_brace);
622 boolisTokenStringLiteral()
const{
626 boolisTokenSpecial()
const{
627 returnisTokenStringLiteral() || isTokenParen() || isTokenBracket() ||
628isTokenBrace() || Tok.
is(tok::code_completion) || Tok.
isAnnotation();
633 boolisTokenEqualOrEqualTypo();
637 voidUnconsumeToken(Token &Consumed) {
644SourceLocation ConsumeAnnotationToken() {
645assert(Tok.
isAnnotation() &&
"wrong consume method");
654SourceLocation ConsumeParen() {
655assert(isTokenParen() &&
"wrong consume method");
656 if(Tok.
getKind() == tok::l_paren)
658 else if(ParenCount) {
659AngleBrackets.clear(*
this);
664 returnPrevTokLocation;
669SourceLocation ConsumeBracket() {
670assert(isTokenBracket() &&
"wrong consume method");
671 if(Tok.
getKind() == tok::l_square)
673 else if(BracketCount) {
674AngleBrackets.clear(*
this);
680 returnPrevTokLocation;
685SourceLocation ConsumeBrace() {
686assert(isTokenBrace() &&
"wrong consume method");
687 if(Tok.
getKind() == tok::l_brace)
689 else if(BraceCount) {
690AngleBrackets.clear(*
this);
696 returnPrevTokLocation;
703SourceLocation ConsumeStringToken() {
704assert(isTokenStringLiteral() &&
705 "Should only consume string literals with this method");
708 returnPrevTokLocation;
716SourceLocation ConsumeCodeCompletionToken() {
717assert(Tok.
is(tok::code_completion));
720 returnPrevTokLocation;
728SourceLocation handleUnexpectedCodeCompletionToken();
732 voidcutOffParsing() {
743 return Kind== tok::eof ||
Kind== tok::annot_module_begin ||
744 Kind== tok::annot_module_end ||
Kind== tok::annot_module_include ||
745 Kind== tok::annot_repl_input_end;
755 voidinitializePragmaHandlers();
758 voidresetPragmaHandlers();
761 voidHandlePragmaUnused();
765 voidHandlePragmaVisibility();
769 voidHandlePragmaPack();
773 voidHandlePragmaMSStruct();
775 voidHandlePragmaMSPointersToMembers();
777 voidHandlePragmaMSVtorDisp();
779 voidHandlePragmaMSPragma();
780 boolHandlePragmaMSSection(StringRef PragmaName,
781SourceLocation PragmaLocation);
782 boolHandlePragmaMSSegment(StringRef PragmaName,
783SourceLocation PragmaLocation);
784 boolHandlePragmaMSInitSeg(StringRef PragmaName,
785SourceLocation PragmaLocation);
786 boolHandlePragmaMSStrictGuardStackCheck(StringRef PragmaName,
787SourceLocation PragmaLocation);
788 boolHandlePragmaMSFunction(StringRef PragmaName,
789SourceLocation PragmaLocation);
790 boolHandlePragmaMSAllocText(StringRef PragmaName,
791SourceLocation PragmaLocation);
792 boolHandlePragmaMSOptimize(StringRef PragmaName,
793SourceLocation PragmaLocation);
797 voidHandlePragmaAlign();
801 voidHandlePragmaDump();
805 voidHandlePragmaWeak();
809 voidHandlePragmaWeakAlias();
813 voidHandlePragmaRedefineExtname();
817 voidHandlePragmaFPContract();
821 voidHandlePragmaFEnvAccess();
825 voidHandlePragmaFEnvRound();
829 voidHandlePragmaCXLimitedRange();
833 voidHandlePragmaFloatControl();
837 voidHandlePragmaFP();
841 voidHandlePragmaOpenCLExtension();
849 boolHandlePragmaLoopHint(LoopHint &Hint);
851 boolParsePragmaAttributeSubjectMatchRuleSet(
853SourceLocation &AnyLoc, SourceLocation &LastMatchRuleEndLoc);
855 voidHandlePragmaAttribute();
864 constToken &GetLookAheadToken(
unsignedN) {
865 if(N == 0 || Tok.
is(tok::eof))
returnTok;
885assert((
T.isInvalid() ||
T.get()) &&
886 "produced a valid-but-null type annotation?");
890 staticNamedDecl *getNonTypeAnnotation(
constToken &Tok) {
891 return static_cast<NamedDecl*
>(Tok.getAnnotationValue());
894 static voidsetNonTypeAnnotation(Token &Tok, NamedDecl *ND) {
895Tok.setAnnotationValue(ND);
898 staticIdentifierInfo *getIdentifierAnnotation(
constToken &Tok) {
899 return static_cast<IdentifierInfo*
>(Tok.getAnnotationValue());
902 static voidsetIdentifierAnnotation(Token &Tok, IdentifierInfo *ND) {
903Tok.setAnnotationValue(ND);
908 static ExprResultgetExprAnnotation(
constToken &Tok) {
909 returnExprResult::getFromOpaquePointer(Tok.getAnnotationValue());
914 static voidsetExprAnnotation(Token &Tok,
ExprResultER) {
915Tok.setAnnotationValue(ER.getAsOpaquePointer());
925CXXScopeSpec &SS,
boolIsNewScope,
931(Tok.is(tok::identifier) || Tok.is(tok::coloncolon) ||
932(Tok.is(tok::annot_template_id) &&
934Tok.is(tok::kw_decltype) || Tok.is(tok::kw___super));
941 enumAnnotatedNameKind {
955TryAnnotateName(CorrectionCandidateCallback *CCC =
nullptr,
960 voidAnnotateScopeToken(CXXScopeSpec &SS,
boolIsNewAnnotation);
965 boolTryAltiVecToken(DeclSpec &DS, SourceLocation
Loc,
966 const char*&PrevSpec,
unsigned&DiagID,
971 if(Tok.getIdentifierInfo() != Ident_vector &&
972Tok.getIdentifierInfo() != Ident_bool &&
973Tok.getIdentifierInfo() != Ident_Bool &&
974(!
getLangOpts().AltiVec || Tok.getIdentifierInfo() != Ident_pixel))
977 returnTryAltiVecTokenOutOfLine(DS,
Loc, PrevSpec, DiagID,
isInvalid);
983 boolTryAltiVecVectorToken() {
985Tok.getIdentifierInfo() != Ident_vector)
return false;
986 returnTryAltiVecVectorTokenOutOfLine();
989 boolTryAltiVecVectorTokenOutOfLine();
990 boolTryAltiVecTokenOutOfLine(DeclSpec &DS, SourceLocation
Loc,
991 const char*&PrevSpec,
unsigned&DiagID,
997 boolisObjCInstancetype() {
999 if(Tok.isAnnotation())
1001 if(!Ident_instancetype)
1003 returnTok.getIdentifierInfo() == Ident_instancetype;
1011 boolTryKeywordIdentFallback(
boolDisableKeyword);
1014TemplateIdAnnotation *takeTemplateIdAnnotation(
constToken &tok);
1029 classTentativeParsingAction {
1031PreferredTypeBuilder PrevPreferredType;
1033 size_tPrevTentativelyDeclaredIdentifierCount;
1034 unsigned shortPrevParenCount, PrevBracketCount, PrevBraceCount;
1038 explicitTentativeParsingAction(Parser &p,
boolUnannotated =
false)
1039:
P(p), PrevPreferredType(
P.PreferredType) {
1041PrevTentativelyDeclaredIdentifierCount =
1042 P.TentativelyDeclaredIdentifiers.size();
1043PrevParenCount =
P.ParenCount;
1044PrevBracketCount =
P.BracketCount;
1045PrevBraceCount =
P.BraceCount;
1046 P.PP.EnableBacktrackAtThisPos(Unannotated);
1050assert(isActive &&
"Parsing action was finished!");
1051 P.TentativelyDeclaredIdentifiers.resize(
1052PrevTentativelyDeclaredIdentifierCount);
1053 P.PP.CommitBacktrackedTokens();
1057assert(isActive &&
"Parsing action was finished!");
1059 P.PreferredType = PrevPreferredType;
1061 P.TentativelyDeclaredIdentifiers.resize(
1062PrevTentativelyDeclaredIdentifierCount);
1063 P.ParenCount = PrevParenCount;
1064 P.BracketCount = PrevBracketCount;
1065 P.BraceCount = PrevBraceCount;
1068~TentativeParsingAction() {
1069assert(!isActive &&
"Forgot to call Commit or Revert!");
1074 classRevertingTentativeParsingAction
1075:
privateParser::TentativeParsingAction {
1077 usingTentativeParsingAction::TentativeParsingAction;
1079~RevertingTentativeParsingAction() { Revert(); }
1087ObjCContainerDecl *DC;
1088SaveAndRestore<bool> WithinObjCContainer;
1090 explicitObjCDeclContextSwitch(Parser &p)
1092WithinObjCContainer(
P.ParsingInObjCContainer, DC != nullptr) {
1094 P.Actions.ObjC().ActOnObjCTemporaryExitContainerContext(DC);
1096~ObjCDeclContextSwitch() {
1098 P.Actions.ObjC().ActOnObjCReenterContainerContext(DC);
1111 unsigned Diag= diag::err_expected,
1112StringRef DiagMsg =
"");
1119 boolExpectAndConsumeSemi(
unsignedDiagID , StringRef TokenUsed =
"");
1122 enumExtraSemiKind {
1123OutsideFunction = 0,
1125InstanceVariableList = 2,
1126AfterMemberFunctionDefinition = 3
1138 boolexpectIdentifier();
1141 enum classCompoundToken {
1156 voidcheckCompoundToken(SourceLocation FirstTokLoc,
1159 voiddiagnoseUseOfC11Keyword(
constToken &Tok);
1174 voidoperator=(
const ParseScope&) =
delete;
1181 boolBeforeCompoundStmt =
false)
1183 if(EnteredScope && !BeforeCompoundStmt)
1184Self->EnterScope(ScopeFlags);
1186 if(BeforeCompoundStmt)
1187Self->incrementMSManglingNumber();
1189this->Self =
nullptr;
1211 unsignedNumScopes = 0;
1218Self.EnterScope(ScopeFlags);
1243 classParseScopeFlags {
1245 unsignedOldFlags = 0;
1246ParseScopeFlags(
constParseScopeFlags &) =
delete;
1247 voidoperator=(
constParseScopeFlags &) =
delete;
1250ParseScopeFlags(
Parser*
Self,
unsignedScopeFlags,
boolManageFlags =
true);
1258DiagnosticBuilder
Diag(SourceLocation
Loc,
unsignedDiagID);
1259DiagnosticBuilder
Diag(
constToken &Tok,
unsignedDiagID);
1261 return Diag(Tok, DiagID);
1282 static_cast<unsigned>(R));
1324 structParsingClass;
1334 classLateParsedDeclaration {
1336 virtual~LateParsedDeclaration();
1338 virtual voidParseLexedMethodDeclarations();
1339 virtual voidParseLexedMemberInitializers();
1340 virtual voidParseLexedMethodDefs();
1341 virtual voidParseLexedAttributes();
1342 virtual voidParseLexedPragmas();
1347 classLateParsedClass :
publicLateParsedDeclaration {
1349LateParsedClass(
Parser*
P, ParsingClass *
C);
1350~LateParsedClass()
override;
1352 voidParseLexedMethodDeclarations()
override;
1353 voidParseLexedMemberInitializers()
override;
1354 voidParseLexedMethodDefs()
override;
1355 voidParseLexedAttributes()
override;
1356 voidParseLexedPragmas()
override;
1359LateParsedClass(
constLateParsedClass &) =
delete;
1360LateParsedClass &operator=(
constLateParsedClass &) =
delete;
1364ParsingClass *
Class;
1373 structLateParsedAttribute :
publicLateParsedDeclaration {
1376IdentifierInfo &AttrName;
1377IdentifierInfo *MacroII =
nullptr;
1378SourceLocation AttrNameLoc;
1379SmallVector<Decl*, 2> Decls;
1381 explicitLateParsedAttribute(Parser *
P, IdentifierInfo &Name,
1382SourceLocation
Loc)
1383: Self(
P), AttrName(Name), AttrNameLoc(
Loc) {}
1385 voidParseLexedAttributes()
override;
1387 voidaddDecl(Decl *
D) { Decls.push_back(
D); }
1394 classLateParsedPragma :
publicLateParsedDeclaration {
1395Parser *Self =
nullptr;
1401: Self(
P), AS(AS) {}
1403 voidtakeToks(
CachedTokens&Cached) { Toks.swap(Cached); }
1407 voidParseLexedPragmas()
override;
1411 classLateParsedAttrList:
publicSmallVector<LateParsedAttribute *, 2> {
1413LateParsedAttrList(
boolPSoon =
false,
1414 boolLateAttrParseExperimentalExtOnly =
false)
1416LateAttrParseExperimentalExtOnly(LateAttrParseExperimentalExtOnly) {}
1418 boolparseSoon() {
returnParseSoon; }
1421 boollateAttrParseExperimentalExtOnly() {
1422 returnLateAttrParseExperimentalExtOnly;
1427 boolLateAttrParseExperimentalExtOnly;
1433 structLexedMethod :
publicLateParsedDeclaration {
1438 explicitLexedMethod(Parser *
P, Decl *MD) : Self(
P),
D(MD) {}
1440 voidParseLexedMethodDefs()
override;
1447 structLateParsedDefaultArgument {
1448 explicitLateParsedDefaultArgument(Decl *
P,
1449std::unique_ptr<CachedTokens> Toks =
nullptr)
1450: Param(
P), Toks(
std::move(Toks)) { }
1459std::unique_ptr<CachedTokens> Toks;
1466 structLateParsedMethodDeclaration :
publicLateParsedDeclaration {
1467 explicitLateParsedMethodDeclaration(Parser *
P, Decl *M)
1468: Self(
P), Method(M), ExceptionSpecTokens(nullptr) {}
1470 voidParseLexedMethodDeclarations()
override;
1482SmallVector<LateParsedDefaultArgument, 8> DefaultArgs;
1492 structLateParsedMemberInitializer :
publicLateParsedDeclaration {
1493LateParsedMemberInitializer(Parser *
P, Decl *FD)
1494: Self(
P),
Field(FD) { }
1496 voidParseLexedMemberInitializers()
override;
1514 typedefSmallVector<LateParsedDeclaration*,2> LateParsedDeclarationsContainer;
1519 structParsingClass {
1520ParsingClass(Decl *TagOrTemplate,
boolTopLevelClass,
boolIsInterface)
1521: TopLevelClass(TopLevelClass), IsInterface(IsInterface),
1522TagOrTemplate(TagOrTemplate) {}
1526 boolTopLevelClass : 1;
1529 boolIsInterface : 1;
1532 Decl*TagOrTemplate;
1537LateParsedDeclarationsContainer LateParsedDeclarations;
1543std::stack<ParsingClass *> ClassStack;
1545ParsingClass &getCurrentClass() {
1546assert(!ClassStack.empty() &&
"No lexed method stacks!");
1547 return*ClassStack.top();
1551 classParsingClassDefinition {
1557ParsingClassDefinition(Parser &P, Decl *TagOrTemplate,
boolTopLevelClass,
1560State(
P.PushParsingClass(TagOrTemplate, TopLevelClass, IsInterface)) {
1565assert(!Popped &&
"Nested class has already been popped");
1567 P.PopParsingClass(State);
1570~ParsingClassDefinition() {
1572 P.PopParsingClass(State);
1579 structParsedTemplateInfo {
1580ParsedTemplateInfo() :
Kind(NonTemplate), TemplateParams(nullptr) {}
1583 boolisSpecialization,
1584 boollastParameterListWasEmpty =
false)
1585:
Kind(isSpecialization? ExplicitSpecialization : Template),
1586TemplateParams(TemplateParams),
1587LastParameterListWasEmpty(lastParameterListWasEmpty) { }
1589 explicitParsedTemplateInfo(SourceLocation ExternLoc,
1590SourceLocation TemplateLoc)
1591:
Kind(ExplicitInstantiation), TemplateParams(nullptr),
1592ExternLoc(ExternLoc), TemplateLoc(TemplateLoc),
1593LastParameterListWasEmpty(
false){ }
1602ExplicitSpecialization,
1604ExplicitInstantiation
1613SourceLocation ExternLoc;
1617SourceLocation TemplateLoc;
1620 boolLastParameterListWasEmpty;
1626struct ReenterTemplateScopeRAII;
1627struct ReenterClassScopeRAII;
1629 voidLexTemplateFunctionForLateParsing(
CachedTokens&Toks);
1630 voidParseLateTemplatedFuncDef(LateParsedTemplate &LPT);
1632static
voidLateTemplateParserCallback(
void*
P, LateParsedTemplate &LPT);
1634Sema::ParsingClassState
1635PushParsingClass(Decl *TagOrTemplate,
boolTopLevelClass,
boolIsInterface);
1636 voidDeallocateParsedClasses(ParsingClass *
Class);
1637 voidPopParsingClass(Sema::ParsingClassState);
1639enum CachedInitKind {
1640CIK_DefaultArgument,
1641CIK_DefaultInitializer
1645 constParsedAttributesView &AccessAttrs,
1646ParsingDeclarator &
D,
1647 constParsedTemplateInfo &TemplateInfo,
1648 constVirtSpecifiers &VS,
1649SourceLocation PureSpecLoc);
1650StringLiteral *ParseCXXDeletedFunctionMessage();
1651 voidSkipDeletedFunctionBody();
1652 voidParseCXXNonStaticMemberInitializer(Decl *VarD);
1653 voidParseLexedAttributes(ParsingClass &
Class);
1654 voidParseLexedAttributeList(LateParsedAttrList &LAs, Decl *
D,
1656 voidParseLexedCAttributeList(LateParsedAttrList &LA,
bool EnterScope,
1657ParsedAttributes *OutAttrs =
nullptr);
1658 voidParseLexedAttribute(LateParsedAttribute &LA,
1660 voidParseLexedCAttribute(LateParsedAttribute &LA,
bool EnterScope,
1661ParsedAttributes *OutAttrs =
nullptr);
1662 voidParseLexedMethodDeclarations(ParsingClass &
Class);
1663 voidParseLexedMethodDeclaration(LateParsedMethodDeclaration &LM);
1664 voidParseLexedMethodDefs(ParsingClass &
Class);
1665 voidParseLexedMethodDef(LexedMethod &LM);
1666 voidParseLexedMemberInitializers(ParsingClass &
Class);
1667 voidParseLexedMemberInitializer(LateParsedMemberInitializer &MI);
1668 voidParseLexedObjCMethodDefs(LexedMethod &LM,
boolparseMethod);
1669 voidParseLexedPragmas(ParsingClass &
Class);
1670 voidParseLexedPragma(LateParsedPragma &LP);
1671 boolConsumeAndStoreFunctionPrologue(
CachedTokens&Toks);
1672 boolConsumeAndStoreInitializer(
CachedTokens&Toks, CachedInitKind CIK);
1677 boolConsumeFinalToken =
true) {
1678 returnConsumeAndStoreUntil(T1, T1, Toks,
StopAtSemi, ConsumeFinalToken);
1683 boolConsumeFinalToken =
true);
1687 DeclGroupPtrTyParseExternalDeclaration(ParsedAttributes &DeclAttrs,
1688ParsedAttributes &DeclSpecAttrs,
1689ParsingDeclSpec *DS =
nullptr);
1690 boolisDeclarationAfterDeclarator();
1691 boolisStartOfFunctionDefinition(
constParsingDeclarator &Declarator);
1693ParsedAttributes &DeclAttrs, ParsedAttributes &DeclSpecAttrs,
1695 DeclGroupPtrTyParseDeclOrFunctionDefInternal(ParsedAttributes &Attrs,
1696ParsedAttributes &DeclSpecAttrs,
1697ParsingDeclSpec &DS,
1700 voidSkipFunctionBody();
1701 Decl*ParseFunctionDefinition(ParsingDeclarator &
D,
1702 constParsedTemplateInfo &TemplateInfo = ParsedTemplateInfo(),
1703LateParsedAttrList *LateParsedAttrs =
nullptr);
1704 voidParseKNRParamDeclarations(Declarator &
D);
1706 ExprResultParseSimpleAsm(
boolForAsmLabel, SourceLocation *EndLoc);
1707 ExprResultParseAsmStringLiteral(
boolForAsmLabel);
1711 DeclGroupPtrTyParseObjCAtDirectives(ParsedAttributes &DeclAttrs,
1712ParsedAttributes &DeclSpecAttrs);
1713 DeclGroupPtrTyParseObjCAtClassDeclaration(SourceLocation atLoc);
1714 Decl*ParseObjCAtInterfaceDeclaration(SourceLocation AtLoc,
1715ParsedAttributes &prefixAttrs);
1716 classObjCTypeParamListScope;
1717ObjCTypeParamList *parseObjCTypeParamList();
1718ObjCTypeParamList *parseObjCTypeParamListOrProtocolRefs(
1719ObjCTypeParamListScope &Scope, SourceLocation &lAngleLoc,
1720SmallVectorImpl<IdentifierLocPair> &protocolIdents,
1721SourceLocation &rAngleLoc,
boolmayBeProtocolList =
true);
1723 voidHelperActionsForIvarDeclarations(ObjCContainerDecl *interfaceDecl,
1724SourceLocation atLoc,
1726SmallVectorImpl<Decl *> &AllIvarDecls,
1727 boolRBraceMissing);
1728 voidParseObjCClassInstanceVariables(ObjCContainerDecl *interfaceDecl,
1730SourceLocation atLoc);
1731 boolParseObjCProtocolReferences(SmallVectorImpl<Decl *> &
P,
1732SmallVectorImpl<SourceLocation> &PLocs,
1733 boolWarnOnDeclarations,
1734 boolForObjCContainer,
1735SourceLocation &LAngleLoc,
1736SourceLocation &EndProtoLoc,
1737 boolconsumeLastToken);
1742 voidparseObjCTypeArgsOrProtocolQualifiers(
1744SourceLocation &typeArgsLAngleLoc,
1745SmallVectorImpl<ParsedType> &typeArgs,
1746SourceLocation &typeArgsRAngleLoc,
1747SourceLocation &protocolLAngleLoc,
1748SmallVectorImpl<Decl *> &protocols,
1749SmallVectorImpl<SourceLocation> &protocolLocs,
1750SourceLocation &protocolRAngleLoc,
1751 boolconsumeLastToken,
1752 boolwarnOnIncompleteProtocols);
1756 voidparseObjCTypeArgsAndProtocolQualifiers(
1758SourceLocation &typeArgsLAngleLoc,
1759SmallVectorImpl<ParsedType> &typeArgs,
1760SourceLocation &typeArgsRAngleLoc,
1761SourceLocation &protocolLAngleLoc,
1762SmallVectorImpl<Decl *> &protocols,
1763SmallVectorImpl<SourceLocation> &protocolLocs,
1764SourceLocation &protocolRAngleLoc,
1765 boolconsumeLastToken);
1769 TypeResultparseObjCProtocolQualifierType(SourceLocation &rAngleLoc);
1773 TypeResultparseObjCTypeArgsAndProtocolQualifiers(SourceLocation loc,
1775 boolconsumeLastToken,
1776SourceLocation &endLoc);
1780 DeclGroupPtrTyParseObjCAtProtocolDeclaration(SourceLocation atLoc,
1781ParsedAttributes &prefixAttrs);
1783 structObjCImplParsingDataRAII {
1787 typedefSmallVector<LexedMethod*, 8> LateParsedObjCMethodContainer;
1788LateParsedObjCMethodContainer LateParsedObjCMethods;
1790ObjCImplParsingDataRAII(Parser &parser, Decl *
D)
1791:
P(parser), Dcl(
D), HasCFunction(
false) {
1792 P.CurParsedObjCImpl =
this;
1795~ObjCImplParsingDataRAII();
1797 voidfinish(SourceRange AtEnd);
1798 boolisFinished()
const{
returnFinished; }
1803ObjCImplParsingDataRAII *CurParsedObjCImpl;
1804 voidStashAwayMethodOrFunctionBodyTokens(Decl *MDecl);
1806 DeclGroupPtrTyParseObjCAtImplementationDeclaration(SourceLocation AtLoc,
1807ParsedAttributes &Attrs);
1809 Decl*ParseObjCAtAliasDeclaration(SourceLocation atLoc);
1810 Decl*ParseObjCPropertySynthesize(SourceLocation atLoc);
1811 Decl*ParseObjCPropertyDynamic(SourceLocation atLoc);
1813IdentifierInfo *ParseObjCSelectorPiece(SourceLocation &MethodLocation);
1816objc_in=0, objc_out, objc_inout, objc_oneway, objc_bycopy, objc_byref,
1817objc_nonnull, objc_nullable, objc_null_unspecified,
1820IdentifierInfo *ObjCTypeQuals[objc_NumQuals];
1822 boolisTokIdentifier_in()
const;
1825ParsedAttributes *ParamAttrs);
1826 Decl*ParseObjCMethodPrototype(
1828 boolMethodDefinition =
true);
1831 boolMethodDefinition=
true);
1832 voidParseObjCPropertyAttribute(ObjCDeclSpec &DS);
1834 Decl*ParseObjCMethodDefinition();
1862 unsigned&NumLineToksConsumed,
1863 boolIsUnevaluated);
1879 enumCastParseKind {
1888 ExprResultParseCastExpression(CastParseKind ParseKind,
1889 boolisAddressOfOperand,
1892 boolisVectorLiteral =
false,
1893 bool*NotPrimaryExpression =
nullptr);
1894 ExprResultParseCastExpression(CastParseKind ParseKind,
1895 boolisAddressOfOperand =
false,
1897 boolisVectorLiteral =
false,
1898 bool*NotPrimaryExpression =
nullptr);
1901 boolisNotExpressionStart();
1905 boolisPostfixExpressionSuffixStart() {
1907 return(K == tok::l_square || K == tok::l_paren ||
1908K == tok::period || K == tok::arrow ||
1909K == tok::plusplus || K == tok::minusminus);
1912 booldiagnoseUnknownTemplateId(
ExprResultTemplateName, SourceLocation
Less);
1913 voidcheckPotentialAngleBracket(
ExprResult&PotentialTemplateName);
1914 boolcheckPotentialAngleBracketDelimiter(
constAngleBracketTracker::Loc &,
1915 constToken &OpToken);
1916 boolcheckPotentialAngleBracketDelimiter(
constToken &OpToken) {
1917 if(
auto*Info = AngleBrackets.getCurrent(*
this))
1918 returncheckPotentialAngleBracketDelimiter(*Info, OpToken);
1923 ExprResultParseUnaryExprOrTypeTraitExpression();
1925 ExprResultParseSYCLUniqueStableNameExpression();
1927 ExprResultParseExprAfterUnaryExprOrTypeTrait(
constToken &OpTok,
1930SourceRange &CastRange);
1933 boolParseExpressionList(SmallVectorImpl<Expr *> &Exprs,
1934llvm::function_ref<
void()> ExpressionStarts =
1935llvm::function_ref<
void()>(),
1936 boolFailImmediatelyOnInvalidExpr =
false,
1937 boolEarlyTypoCorrection =
false,
1938 bool*HasTrailingComma =
nullptr);
1942 boolParseSimpleExpressionList(SmallVectorImpl<Expr *> &Exprs);
1945 enumParenParseOption {
1952 ExprResultParseParenExpression(ParenParseOption &ExprType,
1953 boolstopIfCastExpr,
1956SourceLocation &RParenLoc);
1959ParenParseOption &ExprType,
ParsedType&CastTy,
1962SourceLocation LParenLoc,
1963SourceLocation RParenLoc);
1965 ExprResultParseGenericSelectionExpression();
1973 ExprResulttryParseCXXIdExpression(CXXScopeSpec &SS,
boolisAddressOfOperand,
1974Token &Replacement);
1979 ExprResultParseCXXIdExpression(
boolisAddressOfOperand =
false);
1981 boolareTokensAdjacent(
constToken &A,
constToken &B);
1983 voidCheckForTemplateAndDigraph(Token &Next,
ParsedTypeObjectTypePtr,
1984 boolEnteringContext, IdentifierInfo &II,
1987 boolParseOptionalCXXScopeSpecifier(
1988CXXScopeSpec &SS,
ParsedTypeObjectType,
boolObjectHasErrors,
1989 boolEnteringContext,
bool*MayBePseudoDestructor =
nullptr,
1990 boolIsTypename =
false,
constIdentifierInfo **LastII =
nullptr,
1991 boolOnlyNamespace =
false,
boolInUsingDeclaration =
false,
1992 boolDisambiguation =
false);
1998 enum classLambdaIntroducerTentativeParse {
2015ParseLambdaIntroducer(LambdaIntroducer &Intro,
2016LambdaIntroducerTentativeParse *Tentative =
nullptr);
2017 ExprResultParseLambdaExpressionAfterIntroducer(LambdaIntroducer &Intro);
2036 ExprResultParseCXXPseudoDestructor(Expr *
Base, SourceLocation OpLoc,
2051SourceRange &SpecificationRange,
2052SmallVectorImpl<ParsedType> &DynamicExceptions,
2053SmallVectorImpl<SourceRange> &DynamicExceptionRanges,
2059SourceRange &SpecificationRange,
2060SmallVectorImpl<ParsedType> &Exceptions,
2061SmallVectorImpl<SourceRange> &Ranges);
2066 boolMayBeFollowedByDirectInit);
2074 ExprResultParseCXXTypeConstructExpression(
constDeclSpec &DS);
2079 voidParseCXXSimpleTypeSpecifier(DeclSpec &DS);
2081 boolParseCXXTypeSpecifierSeq(
2086 boolParseExpressionListOrTypeId(SmallVectorImpl<Expr*> &Exprs,
2088 voidParseDirectNewDeclarator(Declarator &
D);
2089 ExprResultParseCXXNewExpression(
boolUseGlobal, SourceLocation Start);
2090 ExprResultParseCXXDeleteExpression(
boolUseGlobal,
2091SourceLocation Start);
2095 structForRangeInfo;
2096Sema::ConditionResult ParseCXXCondition(
StmtResult*InitStmt,
2097SourceLocation
Loc,
2100ForRangeInfo *FRI =
nullptr,
2101 boolEnterForConditionScope =
false);
2103ParsedAttributes &Attrs);
2114 voidParseTrailingRequiresClause(Declarator &
D);
2124 if(Tok.isNot(tok::l_brace))
2126 returnParseBraceInitializer();
2128 boolMayBeDesignationStart();
2130 structDesignatorCompletionInfo {
2131SmallVectorImpl<Expr *> &InitExprs;
2132QualType PreferredBaseType;
2134 ExprResultParseInitializerWithPotentialDesignator(DesignatorCompletionInfo);
2136 voidinjectEmbedTokens();
2145 ExprResultParseObjCAtExpression(SourceLocation AtLocation);
2146 ExprResultParseObjCStringLiteral(SourceLocation AtLoc);
2147 ExprResultParseObjCCharacterLiteral(SourceLocation AtLoc);
2148 ExprResultParseObjCNumericLiteral(SourceLocation AtLoc);
2149 ExprResultParseObjCBooleanLiteral(SourceLocation AtLoc,
boolArgValue);
2150 ExprResultParseObjCArrayLiteral(SourceLocation AtLoc);
2151 ExprResultParseObjCDictionaryLiteral(SourceLocation AtLoc);
2152 ExprResultParseObjCBoxedExpr(SourceLocation AtLoc);
2153 ExprResultParseObjCEncodeExpression(SourceLocation AtLoc);
2154 ExprResultParseObjCSelectorExpression(SourceLocation AtLoc);
2155 ExprResultParseObjCProtocolExpression(SourceLocation AtLoc);
2156 boolisSimpleObjCMessageExpression();
2158 ExprResultParseObjCMessageExpressionBody(SourceLocation LBracloc,
2159SourceLocation SuperLoc,
2161Expr *ReceiverExpr);
2162 ExprResultParseAssignmentExprWithObjCMessageExprStart(
2163SourceLocation LBracloc, SourceLocation SuperLoc,
2164 ParsedTypeReceiverType, Expr *ReceiverExpr);
2165 boolParseObjCXXMessageReceiver(
bool&IsExpr,
void*&TypeOrExpr);
2171 typedefSmallVector<Expr*, 12> ExprVector;
2174ParseStatement(SourceLocation *TrailingElseLoc =
nullptr,
2175ParsedStmtContext StmtCtx = ParsedStmtContext::SubStmt);
2177 StmtVector&Stmts, ParsedStmtContext StmtCtx,
2178SourceLocation *TrailingElseLoc =
nullptr);
2179 StmtResultParseStatementOrDeclarationAfterAttributes(
2180 StmtVector&Stmts, ParsedStmtContext StmtCtx,
2181SourceLocation *TrailingElseLoc, ParsedAttributes &DeclAttrs,
2182ParsedAttributes &DeclSpecAttrs);
2183 StmtResultParseExprStatement(ParsedStmtContext StmtCtx);
2184 StmtResultParseLabeledStatement(ParsedAttributes &Attrs,
2185ParsedStmtContext StmtCtx);
2186 StmtResultParseCaseStatement(ParsedStmtContext StmtCtx,
2187 boolMissingCase =
false,
2189 StmtResultParseDefaultStatement(ParsedStmtContext StmtCtx);
2190 StmtResultParseCompoundStatement(
boolisStmtExpr =
false);
2191 StmtResultParseCompoundStatement(
boolisStmtExpr,
2192 unsignedScopeFlags);
2193 voidParseCompoundStatementLeadingPragmas();
2194 voidDiagnoseLabelAtEndOfCompoundStatement();
2196 StmtResultParseCompoundStatementBody(
boolisStmtExpr =
false);
2197 boolParseParenExprOrCondition(
StmtResult*InitStmt,
2198Sema::ConditionResult &CondResult,
2200SourceLocation &LParenLoc,
2201SourceLocation &RParenLoc);
2202 StmtResultParseIfStatement(SourceLocation *TrailingElseLoc);
2203 StmtResultParseSwitchStatement(SourceLocation *TrailingElseLoc);
2204 StmtResultParseWhileStatement(SourceLocation *TrailingElseLoc);
2206 StmtResultParseForStatement(SourceLocation *TrailingElseLoc);
2212 StmtResultParseMicrosoftAsmStatement(SourceLocation AsmLoc);
2214SourceLocation *TrailingElseLoc,
2215ParsedAttributes &Attrs);
2219 enumIfExistsBehavior {
2231 structIfExistsCondition {
2233SourceLocation KeywordLoc;
2246IfExistsBehavior Behavior;
2249 boolParseMicrosoftIfExistsCondition(IfExistsCondition&
Result);
2250 voidParseMicrosoftIfExistsStatement(
StmtVector&Stmts);
2251 voidParseMicrosoftIfExistsExternalDeclaration();
2252 voidParseMicrosoftIfExistsClassDeclaration(
DeclSpec::TSTTagType,
2253ParsedAttributes &AccessAttrs,
2255 boolParseMicrosoftIfExistsBraceInitializer(ExprVector &InitExprs,
2257 boolParseAsmOperandsOpt(SmallVectorImpl<IdentifierInfo *> &Names,
2258SmallVectorImpl<Expr *> &Constraints,
2259SmallVectorImpl<Expr *> &Exprs);
2265 StmtResultParseCXXTryBlockCommon(SourceLocation TryLoc,
boolFnTry =
false);
2266 StmtResultParseCXXCatchBlock(
boolFnCatch =
false);
2279 StmtResultParseObjCAtStatement(SourceLocation atLoc,
2280ParsedStmtContext StmtCtx);
2281 StmtResultParseObjCTryStmt(SourceLocation atLoc);
2282 StmtResultParseObjCThrowStmt(SourceLocation atLoc);
2283 StmtResultParseObjCSynchronizedStmt(SourceLocation atLoc);
2284 StmtResultParseObjCAutoreleasePoolStmt(SourceLocation atLoc);
2293 enum classDeclSpecContext {
2298DSC_alias_declaration,
2303DSC_template_type_arg,
2304DSC_objc_method_result,
2313 static boolisTypeSpecifier(DeclSpecContext DSC) {
2315 caseDeclSpecContext::DSC_normal:
2316 caseDeclSpecContext::DSC_template_param:
2317 caseDeclSpecContext::DSC_template_arg:
2318 caseDeclSpecContext::DSC_class:
2319 caseDeclSpecContext::DSC_top_level:
2320 caseDeclSpecContext::DSC_objc_method_result:
2321 caseDeclSpecContext::DSC_condition:
2324 caseDeclSpecContext::DSC_template_type_arg:
2325 caseDeclSpecContext::DSC_type_specifier:
2326 caseDeclSpecContext::DSC_conv_operator:
2327 caseDeclSpecContext::DSC_trailing:
2328 caseDeclSpecContext::DSC_alias_declaration:
2329 caseDeclSpecContext::DSC_association:
2330 caseDeclSpecContext::DSC_new:
2333llvm_unreachable(
"Missing DeclSpecContext case");
2337 enum classAllowDefiningTypeSpec {
2354 staticAllowDefiningTypeSpec
2355isDefiningTypeSpecifierContext(DeclSpecContext DSC,
boolIsCPlusPlus) {
2357 caseDeclSpecContext::DSC_normal:
2358 caseDeclSpecContext::DSC_class:
2359 caseDeclSpecContext::DSC_top_level:
2360 caseDeclSpecContext::DSC_alias_declaration:
2361 caseDeclSpecContext::DSC_objc_method_result:
2362 returnAllowDefiningTypeSpec::Yes;
2364 caseDeclSpecContext::DSC_condition:
2365 caseDeclSpecContext::DSC_template_param:
2366 returnAllowDefiningTypeSpec::YesButInvalid;
2368 caseDeclSpecContext::DSC_template_type_arg:
2369 caseDeclSpecContext::DSC_type_specifier:
2370 returnAllowDefiningTypeSpec::NoButErrorRecovery;
2372 caseDeclSpecContext::DSC_association:
2373 returnIsCPlusPlus ? AllowDefiningTypeSpec::NoButErrorRecovery
2374: AllowDefiningTypeSpec::Yes;
2376 caseDeclSpecContext::DSC_trailing:
2377 caseDeclSpecContext::DSC_conv_operator:
2378 caseDeclSpecContext::DSC_template_arg:
2379 caseDeclSpecContext::DSC_new:
2380 returnAllowDefiningTypeSpec::No;
2382llvm_unreachable(
"Missing DeclSpecContext case");
2386 static boolisOpaqueEnumDeclarationContext(DeclSpecContext DSC) {
2388 caseDeclSpecContext::DSC_normal:
2389 caseDeclSpecContext::DSC_class:
2390 caseDeclSpecContext::DSC_top_level:
2393 caseDeclSpecContext::DSC_alias_declaration:
2394 caseDeclSpecContext::DSC_objc_method_result:
2395 caseDeclSpecContext::DSC_condition:
2396 caseDeclSpecContext::DSC_template_param:
2397 caseDeclSpecContext::DSC_template_type_arg:
2398 caseDeclSpecContext::DSC_type_specifier:
2399 caseDeclSpecContext::DSC_trailing:
2400 caseDeclSpecContext::DSC_association:
2401 caseDeclSpecContext::DSC_conv_operator:
2402 caseDeclSpecContext::DSC_template_arg:
2403 caseDeclSpecContext::DSC_new:
2407llvm_unreachable(
"Missing DeclSpecContext case");
2412 static boolisClassTemplateDeductionContext(DeclSpecContext DSC) {
2414 caseDeclSpecContext::DSC_normal:
2415 caseDeclSpecContext::DSC_template_param:
2416 caseDeclSpecContext::DSC_template_arg:
2417 caseDeclSpecContext::DSC_class:
2418 caseDeclSpecContext::DSC_top_level:
2419 caseDeclSpecContext::DSC_condition:
2420 caseDeclSpecContext::DSC_type_specifier:
2421 caseDeclSpecContext::DSC_association:
2422 caseDeclSpecContext::DSC_conv_operator:
2423 caseDeclSpecContext::DSC_new:
2426 caseDeclSpecContext::DSC_objc_method_result:
2427 caseDeclSpecContext::DSC_template_type_arg:
2428 caseDeclSpecContext::DSC_trailing:
2429 caseDeclSpecContext::DSC_alias_declaration:
2432llvm_unreachable(
"Missing DeclSpecContext case");
2437getImplicitTypenameContext(DeclSpecContext DSC) {
2439 caseDeclSpecContext::DSC_class:
2440 caseDeclSpecContext::DSC_top_level:
2441 caseDeclSpecContext::DSC_type_specifier:
2442 caseDeclSpecContext::DSC_template_type_arg:
2443 caseDeclSpecContext::DSC_trailing:
2444 caseDeclSpecContext::DSC_alias_declaration:
2445 caseDeclSpecContext::DSC_template_param:
2446 caseDeclSpecContext::DSC_new:
2449 caseDeclSpecContext::DSC_normal:
2450 caseDeclSpecContext::DSC_objc_method_result:
2451 caseDeclSpecContext::DSC_condition:
2452 caseDeclSpecContext::DSC_template_arg:
2453 caseDeclSpecContext::DSC_conv_operator:
2454 caseDeclSpecContext::DSC_association:
2457llvm_unreachable(
"Missing DeclSpecContext case");
2462 structForRangeInit {
2463SourceLocation ColonLoc;
2465SmallVector<MaterializeTemporaryExpr *, 8> LifetimeExtendTemps;
2466 boolParsedForRangeDecl() {
return!ColonLoc.
isInvalid(); }
2468 structForRangeInfo : ForRangeInit {
2473SourceLocation &DeclEnd,
2474ParsedAttributes &DeclAttrs,
2475ParsedAttributes &DeclSpecAttrs,
2476SourceLocation *DeclSpecStart =
nullptr);
2479ParsedAttributes &DeclAttrs,
2480ParsedAttributes &DeclSpecAttrs,
boolRequireSemi,
2481ForRangeInit *FRI =
nullptr,
2482SourceLocation *DeclSpecStart =
nullptr);
2485ParsedAttributes &Attrs,
2486ParsedTemplateInfo &TemplateInfo,
2487SourceLocation *DeclEnd =
nullptr,
2488ForRangeInit *FRI =
nullptr);
2489 Decl*ParseDeclarationAfterDeclarator(Declarator &
D,
2490 constParsedTemplateInfo &TemplateInfo = ParsedTemplateInfo());
2491 boolParseAsmAttributesAfterDeclarator(Declarator &
D);
2492 Decl*ParseDeclarationAfterDeclaratorAndAttributes(
2494 constParsedTemplateInfo &TemplateInfo = ParsedTemplateInfo(),
2495ForRangeInit *FRI =
nullptr);
2496 Decl*ParseFunctionStatementBody(Decl *Decl, ParseScope &BodyScope);
2497 Decl*ParseFunctionTryBlock(Decl *Decl, ParseScope &BodyScope);
2503 booltrySkippingFunctionBody();
2505 boolParseImplicitInt(DeclSpec &DS, CXXScopeSpec *SS,
2507DeclSpecContext DSC, ParsedAttributes &Attrs);
2511ParseDeclarationSpecifiers(DeclSpec &DS, ParsedTemplateInfo &TemplateInfo,
2513DeclSpecContext DSC = DeclSpecContext::DSC_normal,
2514LateParsedAttrList *LateAttrs =
nullptr) {
2515 returnParseDeclarationSpecifiers(DS, TemplateInfo, AS, DSC, LateAttrs,
2516getImplicitTypenameContext(DSC));
2519ParseDeclarationSpecifiers(DeclSpec &DS, ParsedTemplateInfo &TemplateInfo,
2521LateParsedAttrList *LateAttrs,
2524SourceLocation ParsePackIndexingType(DeclSpec &DS);
2525 voidAnnotateExistingIndexedTypeNamePack(
ParsedType T,
2526SourceLocation StartLoc,
2527SourceLocation EndLoc);
2529 boolDiagnoseMissingSemiAfterTagDefinition(
2531LateParsedAttrList *LateAttrs =
nullptr);
2533 voidParseSpecifierQualifierList(
2535DeclSpecContext DSC = DeclSpecContext::DSC_normal) {
2536ParseSpecifierQualifierList(DS, getImplicitTypenameContext(DSC), AS, DSC);
2539 voidParseSpecifierQualifierList(
2542DeclSpecContext DSC = DeclSpecContext::DSC_normal);
2544 voidParseObjCTypeQualifierList(ObjCDeclSpec &DS,
2547 voidParseEnumSpecifier(SourceLocation TagLoc, DeclSpec &DS,
2548 constParsedTemplateInfo &TemplateInfo,
2550 voidParseEnumBody(SourceLocation StartLoc, Decl *TagDecl);
2551 voidParseStructUnionBody(SourceLocation StartLoc,
DeclSpec::TSTTagType,
2552RecordDecl *TagDecl);
2554 voidParseStructDeclaration(
2555ParsingDeclSpec &DS,
2556llvm::function_ref<Decl *(ParsingFieldDeclarator &)> FieldsCallback,
2557LateParsedAttrList *LateFieldAttrs =
nullptr);
2562 boolDisambiguatingWithExpression =
false);
2563 boolisTypeSpecifierQualifier();
2568 boolisKnownToBeTypeSpecifier(
constToken &Tok)
const;
2573 boolisKnownToBeDeclarationSpecifier() {
2586 boolisDeclarationStatement(
boolDisambiguatingWithExpression =
false) {
2588 returnisCXXDeclarationStatement(DisambiguatingWithExpression);
2596 boolisForInitDeclaration() {
2600 returnTok.is(tok::kw_using) ||
2601isCXXSimpleDeclaration(
true);
2606 boolisForRangeIdentifier();
2610 boolisStartOfObjCClassMessageMissingOpenBracket();
2615 boolisConstructorDeclarator(
2618 constParsedTemplateInfo *TemplateInfo =
nullptr);
2622 enumTentativeCXXTypeIdContext {
2625TypeIdAsTemplateArgument,
2626TypeIdInTrailingReturnType,
2627TypeIdAsGenericSelectionArgument,
2633 boolisTypeIdInParens(
bool&isAmbiguous) {
2635 returnisCXXTypeId(TypeIdInParens, isAmbiguous);
2636isAmbiguous =
false;
2637 returnisTypeSpecifierQualifier();
2639 boolisTypeIdInParens() {
2641 returnisTypeIdInParens(isAmbiguous);
2651 boolisTypeIdForGenericSelection() {
2654 returnisCXXTypeId(TypeIdAsGenericSelectionArgument, isAmbiguous);
2656 returnisTypeSpecifierQualifier();
2662 boolisTypeIdUnambiguously() {
2665 returnisCXXTypeId(TypeIdUnambiguous, isAmbiguous);
2667 returnisTypeSpecifierQualifier();
2673 boolisCXXDeclarationStatement(
boolDisambiguatingWithExpression =
false);
2680 boolisCXXSimpleDeclaration(
boolAllowForRangeDecl);
2689 boolisCXXFunctionDeclarator(
bool*IsAmbiguous =
nullptr,
2693 structConditionDeclarationOrInitStatementState;
2694 enum classConditionOrInitStatement {
2704ConditionOrInitStatement
2705isCXXConditionDeclarationOrInitStatement(
boolCanBeInitStmt,
2706 boolCanBeForRangeDecl);
2708 boolisCXXTypeId(TentativeCXXTypeIdContext Context,
bool&isAmbiguous);
2709 boolisCXXTypeId(TentativeCXXTypeIdContext Context) {
2711 returnisCXXTypeId(Context, isAmbiguous);
2716 enum classTPResult {
2727 boolisEnumBase(
boolAllowSemi);
2738TPResult BracedCastResult = TPResult::False,
2739 bool*InvalidAsDeclSpec =
nullptr);
2744 boolisCXXDeclarationSpecifierAType();
2749TPResult isTemplateArgumentList(
unsignedTokensToSkip);
2754TPResult isExplicitBool();
2759 boolisTentativelyDeclared(IdentifierInfo *II);
2768TPResult TryParseSimpleDeclaration(
boolAllowForRangeDecl);
2769TPResult TryParseTypeofSpecifier();
2770TPResult TryParseProtocolQualifiers();
2771TPResult TryParsePtrOperatorSeq();
2772TPResult TryParseOperatorId();
2773TPResult TryParseInitDeclaratorList(
boolMayHaveTrailingReturnType =
false);
2774TPResult TryParseDeclarator(
boolmayBeAbstract,
boolmayHaveIdentifier =
true,
2775 boolmayHaveDirectInit =
false,
2776 boolmayHaveTrailingReturnType =
false);
2777TPResult TryParseParameterDeclarationClause(
2778 bool*InvalidAsDeclaration =
nullptr,
boolVersusTemplateArg =
false,
2781TPResult TryParseFunctionDeclarator(
boolMayHaveTrailingReturnType =
false);
2782 boolNameAfterArrowIsNonType();
2783TPResult TryParseBracketDeclarator();
2784TPResult TryConsumeDeclarationSpecifier();
2788 boolTrySkipAttributes();
2792 voidDiagnoseBitIntUse(
constToken &Tok);
2799ParsedAttributes *Attrs =
nullptr);
2802 voidParseBlockId(SourceLocation CaretLoc);
2809 boolisAllowedCXX11AttributeSpecifier(
boolDisambiguate =
false,
2810 boolOuterMightBeMessageSend =
false) {
2811 return(Tok.isRegularKeywordAttribute() ||
2812isCXX11AttributeSpecifier(Disambiguate, OuterMightBeMessageSend));
2817 boolCheckProhibitedCXX11Attribute() {
2818assert(Tok.is(tok::l_square));
2821 returnDiagnoseProhibitedCXX11Attribute();
2824 boolDiagnoseProhibitedCXX11Attribute();
2825 voidCheckMisplacedCXX11Attribute(ParsedAttributes &Attrs,
2826SourceLocation CorrectLocation) {
2827 if(!Tok.isRegularKeywordAttribute() &&
2828(Tok.isNot(tok::l_square) ||
NextToken().isNot(tok::l_square)) &&
2829Tok.isNot(tok::kw_alignas))
2831DiagnoseMisplacedCXX11Attribute(Attrs, CorrectLocation);
2833 voidDiagnoseMisplacedCXX11Attribute(ParsedAttributes &Attrs,
2834SourceLocation CorrectLocation);
2836 voidstripTypeAttributesOffDeclSpec(ParsedAttributes &Attrs, DeclSpec &DS,
2840 voidProhibitAttributes(ParsedAttributes &Attrs,
2841SourceLocation FixItLoc = SourceLocation()) {
2842 if(Attrs.Range.isInvalid())
2844DiagnoseProhibitedAttributes(Attrs, FixItLoc);
2848 voidProhibitAttributes(ParsedAttributesView &Attrs,
2849SourceLocation FixItLoc = SourceLocation()) {
2850 if(Attrs.Range.isInvalid())
2852DiagnoseProhibitedAttributes(Attrs, FixItLoc);
2853Attrs.clearListOnly();
2855 voidDiagnoseProhibitedAttributes(
constParsedAttributesView &Attrs,
2856SourceLocation FixItLoc);
2864 voidProhibitCXX11Attributes(ParsedAttributes &Attrs,
unsignedAttrDiagID,
2865 unsignedKeywordDiagId,
2866 boolDiagnoseEmptyAttrs =
false,
2867 boolWarnOnUnknownAttrs =
false);
2872SourceLocation SkipCXX11Attributes();
2876 voidDiagnoseAndSkipCXX11Attributes();
2880 voidDiagnoseCXX11AttributeExtension(ParsedAttributes &Attrs);
2882 ExprResultParseUnevaluatedStringInAttribute(
constIdentifierInfo &AttrName);
2886SmallVectorImpl<Expr *> &Exprs,
2887ParsedAttributeArgumentsProperties ArgsProperties);
2894ParseAttributeArgsCommon(IdentifierInfo *AttrName, SourceLocation AttrNameLoc,
2895ParsedAttributes &Attrs, SourceLocation *EndLoc,
2896IdentifierInfo *ScopeName, SourceLocation ScopeLoc,
2897ParsedAttr::Form Form);
2899 enumParseAttrKindMask {
2901PAKM_Declspec = 1 << 1,
2902PAKM_CXX11 = 1 << 2,
2919 voidParseAttributes(
unsignedWhichAttrKinds, ParsedAttributes &Attrs,
2920LateParsedAttrList *LateAttrs =
nullptr);
2923 boolMaybeParseAttributes(
unsignedWhichAttrKinds, ParsedAttributes &Attrs,
2924LateParsedAttrList *LateAttrs =
nullptr) {
2925 if(Tok.isOneOf(tok::kw___attribute, tok::kw___declspec) ||
2926isAllowedCXX11AttributeSpecifier()) {
2927ParseAttributes(WhichAttrKinds, Attrs, LateAttrs);
2933 voidMaybeParseGNUAttributes(Declarator &
D,
2934LateParsedAttrList *LateAttrs =
nullptr) {
2935 if(Tok.is(tok::kw___attribute)) {
2936ParsedAttributes Attrs(AttrFactory);
2937ParseGNUAttributes(Attrs, LateAttrs, &
D);
2938 D.takeAttributes(Attrs);
2942 boolMaybeParseGNUAttributes(ParsedAttributes &Attrs,
2943LateParsedAttrList *LateAttrs =
nullptr) {
2944 if(Tok.is(tok::kw___attribute)) {
2945ParseGNUAttributes(Attrs, LateAttrs);
2951 boolParseSingleGNUAttribute(ParsedAttributes &Attrs, SourceLocation &EndLoc,
2952LateParsedAttrList *LateAttrs =
nullptr,
2953Declarator *
D=
nullptr);
2954 voidParseGNUAttributes(ParsedAttributes &Attrs,
2955LateParsedAttrList *LateAttrs =
nullptr,
2956Declarator *
D=
nullptr);
2957 voidParseGNUAttributeArgs(IdentifierInfo *AttrName,
2958SourceLocation AttrNameLoc,
2959ParsedAttributes &Attrs, SourceLocation *EndLoc,
2960IdentifierInfo *ScopeName, SourceLocation ScopeLoc,
2961ParsedAttr::Form Form, Declarator *
D);
2962IdentifierLoc *ParseIdentifierLoc();
2965ParseClangAttributeArgs(IdentifierInfo *AttrName, SourceLocation AttrNameLoc,
2966ParsedAttributes &Attrs, SourceLocation *EndLoc,
2967IdentifierInfo *ScopeName, SourceLocation ScopeLoc,
2968ParsedAttr::Form Form);
2970 voidReplayOpenMPAttributeTokens(
CachedTokens&OpenMPTokens) {
2973 if(!OpenMPTokens.empty()) {
2975PP.EnterTokenStream(OpenMPTokens,
true,
2980 voidMaybeParseCXX11Attributes(Declarator &
D) {
2981 if(isAllowedCXX11AttributeSpecifier()) {
2982ParsedAttributes Attrs(AttrFactory);
2983ParseCXX11Attributes(Attrs);
2984 D.takeAttributes(Attrs);
2988 boolMaybeParseCXX11Attributes(ParsedAttributes &Attrs,
2989 boolOuterMightBeMessageSend =
false) {
2990 if(isAllowedCXX11AttributeSpecifier(
false, OuterMightBeMessageSend)) {
2991ParseCXX11Attributes(Attrs);
2997 voidParseOpenMPAttributeArgs(
constIdentifierInfo *AttrName,
3000 voidParseCXX11AttributeSpecifierInternal(ParsedAttributes &Attrs,
3002SourceLocation *EndLoc =
nullptr);
3003 voidParseCXX11AttributeSpecifier(ParsedAttributes &Attrs,
3004SourceLocation *EndLoc =
nullptr) {
3006ParseCXX11AttributeSpecifierInternal(Attrs, OpenMPTokens, EndLoc);
3007ReplayOpenMPAttributeTokens(OpenMPTokens);
3009 voidParseCXX11Attributes(ParsedAttributes &attrs);
3012 boolParseCXX11AttributeArgs(IdentifierInfo *AttrName,
3013SourceLocation AttrNameLoc,
3014ParsedAttributes &Attrs, SourceLocation *EndLoc,
3015IdentifierInfo *ScopeName,
3016SourceLocation ScopeLoc,
3020 boolParseCXXAssumeAttributeArg(ParsedAttributes &Attrs,
3021IdentifierInfo *AttrName,
3022SourceLocation AttrNameLoc,
3023SourceLocation *EndLoc,
3024ParsedAttr::Form Form);
3026IdentifierInfo *TryParseCXX11AttributeIdentifier(
3027SourceLocation &
Loc,
3030 constIdentifierInfo *EnclosingScope =
nullptr);
3032 boolMaybeParseHLSLAnnotations(Declarator &
D,
3033SourceLocation *EndLoc =
nullptr,
3034 boolCouldBeBitField =
false) {
3035assert(
getLangOpts().
HLSL&&
"MaybeParseHLSLAnnotations is for HLSL only");
3036 if(Tok.is(tok::colon)) {
3037ParsedAttributes Attrs(AttrFactory);
3038ParseHLSLAnnotations(Attrs, EndLoc, CouldBeBitField);
3039 D.takeAttributes(Attrs);
3045 voidMaybeParseHLSLAnnotations(ParsedAttributes &Attrs,
3046SourceLocation *EndLoc =
nullptr) {
3047assert(
getLangOpts().
HLSL&&
"MaybeParseHLSLAnnotations is for HLSL only");
3048 if(Tok.is(tok::colon))
3049ParseHLSLAnnotations(Attrs, EndLoc);
3052 voidParseHLSLAnnotations(ParsedAttributes &Attrs,
3053SourceLocation *EndLoc =
nullptr,
3054 boolCouldBeBitField =
false);
3055 Decl*ParseHLSLBuffer(SourceLocation &DeclEnd);
3057 voidMaybeParseMicrosoftAttributes(ParsedAttributes &Attrs) {
3059Tok.is(tok::l_square)) {
3060ParsedAttributes AttrsWithRange(AttrFactory);
3061ParseMicrosoftAttributes(AttrsWithRange);
3062Attrs.takeAllFrom(AttrsWithRange);
3065 voidParseMicrosoftUuidAttributeArgs(ParsedAttributes &Attrs);
3066 voidParseMicrosoftAttributes(ParsedAttributes &Attrs);
3067 boolMaybeParseMicrosoftDeclSpecs(ParsedAttributes &Attrs) {
3068 if(
getLangOpts().DeclSpecKeyword && Tok.is(tok::kw___declspec)) {
3069ParseMicrosoftDeclSpecs(Attrs);
3074 voidParseMicrosoftDeclSpecs(ParsedAttributes &Attrs);
3075 boolParseMicrosoftDeclSpecArgs(IdentifierInfo *AttrName,
3076SourceLocation AttrNameLoc,
3077ParsedAttributes &Attrs);
3078 voidParseMicrosoftTypeAttributes(ParsedAttributes &attrs);
3079 voidParseWebAssemblyFuncrefTypeAttribute(ParsedAttributes &Attrs);
3080 voidDiagnoseAndSkipExtendedMicrosoftTypeAttributes();
3081SourceLocation SkipExtendedMicrosoftTypeAttributes();
3082 voidParseMicrosoftInheritanceClassAttributes(ParsedAttributes &attrs);
3083 voidParseNullabilityClassAttributes(ParsedAttributes &attrs);
3084 voidParseBorlandTypeAttributes(ParsedAttributes &attrs);
3085 voidParseOpenCLKernelAttributes(ParsedAttributes &attrs);
3086 voidParseOpenCLQualifiers(ParsedAttributes &Attrs);
3087 voidParseNullabilityTypeSpecifiers(ParsedAttributes &attrs);
3088 voidParseCUDAFunctionAttributes(ParsedAttributes &attrs);
3089 boolisHLSLQualifier(
constToken &Tok)
const;
3090 voidParseHLSLQualifiers(ParsedAttributes &Attrs);
3092VersionTuple ParseVersionTuple(SourceRange &
Range);
3093 voidParseAvailabilityAttribute(IdentifierInfo &Availability,
3094SourceLocation AvailabilityLoc,
3095ParsedAttributes &attrs,
3096SourceLocation *endLoc,
3097IdentifierInfo *ScopeName,
3098SourceLocation ScopeLoc,
3099ParsedAttr::Form Form);
3101std::optional<AvailabilitySpec> ParseAvailabilitySpec();
3102 ExprResultParseAvailabilityCheckExpr(SourceLocation StartLoc);
3104 voidParseExternalSourceSymbolAttribute(IdentifierInfo &ExternalSourceSymbol,
3105SourceLocation
Loc,
3106ParsedAttributes &Attrs,
3107SourceLocation *EndLoc,
3108IdentifierInfo *ScopeName,
3109SourceLocation ScopeLoc,
3110ParsedAttr::Form Form);
3112 voidParseObjCBridgeRelatedAttribute(IdentifierInfo &ObjCBridgeRelated,
3113SourceLocation ObjCBridgeRelatedLoc,
3114ParsedAttributes &Attrs,
3115SourceLocation *EndLoc,
3116IdentifierInfo *ScopeName,
3117SourceLocation ScopeLoc,
3118ParsedAttr::Form Form);
3120 voidParseSwiftNewTypeAttribute(IdentifierInfo &AttrName,
3121SourceLocation AttrNameLoc,
3122ParsedAttributes &Attrs,
3123SourceLocation *EndLoc,
3124IdentifierInfo *ScopeName,
3125SourceLocation ScopeLoc,
3126ParsedAttr::Form Form);
3128 voidParseTypeTagForDatatypeAttribute(IdentifierInfo &AttrName,
3129SourceLocation AttrNameLoc,
3130ParsedAttributes &Attrs,
3131SourceLocation *EndLoc,
3132IdentifierInfo *ScopeName,
3133SourceLocation ScopeLoc,
3134ParsedAttr::Form Form);
3136 voidParseAttributeWithTypeArg(IdentifierInfo &AttrName,
3137SourceLocation AttrNameLoc,
3138ParsedAttributes &Attrs,
3139IdentifierInfo *ScopeName,
3140SourceLocation ScopeLoc,
3141ParsedAttr::Form Form);
3143 voidDistributeCLateParsedAttrs(Decl *Dcl, LateParsedAttrList *LateAttrs);
3145 voidParseBoundsAttribute(IdentifierInfo &AttrName,
3146SourceLocation AttrNameLoc, ParsedAttributes &Attrs,
3147IdentifierInfo *ScopeName, SourceLocation ScopeLoc,
3148ParsedAttr::Form Form);
3150 voidParseTypeofSpecifier(DeclSpec &DS);
3151SourceLocation ParseDecltypeSpecifier(DeclSpec &DS);
3152 voidAnnotateExistingDecltypeSpecifier(
constDeclSpec &DS,
3153SourceLocation StartLoc,
3154SourceLocation EndLoc);
3155 voidParseAtomicSpecifier(DeclSpec &DS);
3157 ExprResultParseAlignArgument(StringRef KWName, SourceLocation Start,
3158SourceLocation &EllipsisLoc,
bool&IsType,
3160 voidParseAlignmentSpecifier(ParsedAttributes &Attrs,
3161SourceLocation *endLoc =
nullptr);
3166 returnisCXX11VirtSpecifier(Tok);
3168 voidParseOptionalCXX11VirtSpecifierSeq(VirtSpecifiers &VS,
boolIsInterface,
3169SourceLocation FriendLoc);
3171 boolisCXX11FinalKeyword()
const;
3172 boolisClassCompatibleKeyword()
const;
3177 classDeclaratorScopeObj {
3183DeclaratorScopeObj(Parser &p, CXXScopeSpec &ss)
3184:
P(p), SS(ss), EnteredScope(
false), CreatedScope(
false) {}
3186 voidEnterDeclaratorScope() {
3187assert(!EnteredScope &&
"Already entered the scope!");
3188assert(SS.isSet() &&
"C++ scope was not set!");
3190CreatedScope =
true;
3193 if(!
P.Actions.ActOnCXXEnterDeclaratorScope(
P.getCurScope(), SS))
3194EnteredScope =
true;
3197~DeclaratorScopeObj() {
3199assert(SS.isSet() &&
"C++ scope was cleared ?");
3200 P.Actions.ActOnCXXExitDeclaratorScope(
P.getCurScope(), SS);
3208 voidParseDeclarator(Declarator &
D);
3210 typedefvoid (Parser::*DirectDeclParseFunction)(
Declarator&);
3211 voidParseDeclaratorInternal(Declarator &
D,
3212DirectDeclParseFunction DirectDeclParser);
3214 enumAttrRequirements {
3215AR_NoAttributesParsed = 0,
3216AR_GNUAttributesParsedAndRejected = 1 << 0,
3217AR_GNUAttributesParsed = 1 << 1,
3218AR_CXX11AttributesParsed = 1 << 2,
3219AR_DeclspecAttributesParsed = 1 << 3,
3220AR_AllAttributesParsed = AR_GNUAttributesParsed |
3221AR_CXX11AttributesParsed |
3222AR_DeclspecAttributesParsed,
3223AR_VendorAttributesParsed = AR_GNUAttributesParsed |
3224AR_DeclspecAttributesParsed
3227 voidParseTypeQualifierListOpt(
3228DeclSpec &DS,
unsignedAttrReqs = AR_AllAttributesParsed,
3229 boolAtomicAllowed =
true,
boolIdentifierRequired =
false,
3230std::optional<llvm::function_ref<
void()>> CodeCompletionHandler =
3232 voidParseDirectDeclarator(Declarator &
D);
3233 voidParseDecompositionDeclarator(Declarator &
D);
3234 voidParseParenDeclarator(Declarator &
D);
3235 voidParseFunctionDeclarator(Declarator &
D, ParsedAttributes &FirstArgAttrs,
3237 boolIsAmbiguous,
boolRequiresArg =
false);
3238 voidInitCXXThisScopeForDeclaratorIfRelevant(
3239 constDeclarator &
D,
constDeclSpec &DS,
3240std::optional<Sema::CXXThisScopeRAII> &ThisScope);
3241 boolParseRefQualifier(
bool&RefQualifierIsLValueRef,
3242SourceLocation &RefQualifierLoc);
3243 boolisFunctionDeclaratorIdentifierList();
3244 voidParseFunctionDeclaratorIdentifierList(
3246SmallVectorImpl<DeclaratorChunk::ParamInfo> &ParamInfo);
3247 voidParseParameterDeclarationClause(
3248Declarator &
D, ParsedAttributes &attrs,
3249SmallVectorImpl<DeclaratorChunk::ParamInfo> &ParamInfo,
3250SourceLocation &EllipsisLoc) {
3251 returnParseParameterDeclarationClause(
3252 D.getContext(), attrs, ParamInfo, EllipsisLoc,
3253 D.getCXXScopeSpec().isSet() &&
3254 D.isFunctionDeclaratorAFunctionDeclaration());
3256 voidParseParameterDeclarationClause(
3258SmallVectorImpl<DeclaratorChunk::ParamInfo> &ParamInfo,
3259SourceLocation &EllipsisLoc,
boolIsACXXFunctionDeclaration =
false);
3261 voidParseBracketDeclarator(Declarator &
D);
3262 voidParseMisplacedBracketDeclarator(Declarator &
D);
3263 boolMaybeParseTypeTransformTypeSpecifier(DeclSpec &DS);
3270 enumCXX11AttributeKind {
3272CAK_NotAttributeSpecifier,
3274CAK_AttributeSpecifier,
3277CAK_InvalidAttributeSpecifier
3280isCXX11AttributeSpecifier(
boolDisambiguate =
false,
3281 boolOuterMightBeMessageSend =
false);
3283 voidDiagnoseUnexpectedNamespace(NamedDecl *Context);
3286SourceLocation &DeclEnd,
3287SourceLocation InlineLoc = SourceLocation());
3289 structInnerNamespaceInfo {
3290SourceLocation NamespaceLoc;
3291SourceLocation InlineLoc;
3292SourceLocation IdentLoc;
3293IdentifierInfo *Ident;
3297 voidParseInnerNamespace(
constInnerNamespaceInfoList &InnerNSs,
3298 unsigned intindex, SourceLocation &InlineLoc,
3299ParsedAttributes &attrs,
3302 Decl*ParseExportDeclaration();
3305SourceLocation &DeclEnd, ParsedAttributes &Attrs);
3307SourceLocation UsingLoc,
3308SourceLocation &DeclEnd,
3309ParsedAttributes &attrs);
3311 structUsingDeclarator {
3312SourceLocation TypenameLoc;
3315SourceLocation EllipsisLoc;
3318TypenameLoc = EllipsisLoc = SourceLocation();
3326 constParsedTemplateInfo &TemplateInfo,
3327SourceLocation UsingLoc,
3328SourceLocation &DeclEnd,
3329ParsedAttributes &Attrs,
3331 Decl*ParseAliasDeclarationAfterDeclarator(
3332 constParsedTemplateInfo &TemplateInfo, SourceLocation UsingLoc,
3334ParsedAttributes &Attrs, Decl **OwnedType =
nullptr);
3336 Decl*ParseStaticAssertDeclaration(SourceLocation &DeclEnd);
3337 Decl*ParseNamespaceAlias(SourceLocation NamespaceLoc,
3338SourceLocation AliasLoc, IdentifierInfo *Alias,
3339SourceLocation &DeclEnd);
3343 boolisValidAfterTypeSpecifier(
boolCouldBeBitfield);
3344 voidParseClassSpecifier(
tok::TokenKindTagTokKind, SourceLocation TagLoc,
3345DeclSpec &DS, ParsedTemplateInfo &TemplateInfo,
3347DeclSpecContext DSC, ParsedAttributes &Attributes);
3348 voidSkipCXXMemberSpecification(SourceLocation StartLoc,
3349SourceLocation AttrFixitLoc,
3352 voidParseCXXMemberSpecification(SourceLocation StartLoc,
3353SourceLocation AttrFixitLoc,
3354ParsedAttributes &Attrs,
unsignedTagType,
3356 ExprResultParseCXXMemberInitializer(Decl *
D,
boolIsFunction,
3357SourceLocation &EqualLoc);
3359ParseCXXMemberDeclaratorBeforeInitializer(Declarator &DeclaratorInfo,
3362LateParsedAttrList &LateAttrs);
3363 voidMaybeParseAndDiagnoseDeclSpecAfterCXX11VirtSpecifierSeq(Declarator &
D,
3364VirtSpecifiers &VS);
3367ParsedTemplateInfo &TemplateInfo,
3368ParsingDeclRAIIObject *DiagsFromTParams =
nullptr);
3371ParsedAttributes &AccessAttrs,
3373 voidParseConstructorInitializer(Decl *ConstructorDecl);
3375 voidHandleMemberFunctionDeclDelays(Declarator& DeclaratorInfo,
3380 TypeResultParseBaseTypeSpecifier(SourceLocation &BaseLoc,
3381SourceLocation &EndLocation);
3382 voidParseBaseClause(Decl *ClassDecl);
3383 BaseResultParseBaseSpecifier(Decl *ClassDecl);
3386 boolParseUnqualifiedIdTemplateId(CXXScopeSpec &SS,
3388 boolObjectHadErrors,
3389SourceLocation TemplateKWLoc,
3390IdentifierInfo *Name,
3391SourceLocation NameLoc,
3392 boolEnteringContext,
3393UnqualifiedId &
Id,
3394 boolAssumeTemplateId);
3395 boolParseUnqualifiedIdOperator(CXXScopeSpec &SS,
boolEnteringContext,
3397UnqualifiedId &
Result);
3404SourceLocation
Loc);
3408 voidparseOMPTraitPropertyKind(OMPTraitProperty &TIProperty,
3409llvm::omp::TraitSet
Set,
3410llvm::omp::TraitSelector Selector,
3411llvm::StringMap<SourceLocation> &Seen);
3414 voidparseOMPTraitSelectorKind(OMPTraitSelector &TISelector,
3415llvm::omp::TraitSet
Set,
3416llvm::StringMap<SourceLocation> &Seen);
3419 voidparseOMPTraitSetKind(OMPTraitSet &TISet,
3420llvm::StringMap<SourceLocation> &Seen);
3423 voidparseOMPContextProperty(OMPTraitSelector &TISelector,
3424llvm::omp::TraitSet
Set,
3425llvm::StringMap<SourceLocation> &Seen);
3428 voidparseOMPContextSelector(OMPTraitSelector &TISelector,
3429llvm::omp::TraitSet
Set,
3430llvm::StringMap<SourceLocation> &SeenSelectors);
3433 voidparseOMPContextSelectorSet(OMPTraitSet &TISet,
3434llvm::StringMap<SourceLocation> &SeenSets);
3437 boolparseOMPContextSelectors(SourceLocation
Loc, OMPTraitInfo &TI);
3440 boolparseOpenMPAppendArgs(SmallVectorImpl<OMPInteropInfo> &InteropInfos);
3444 boolparseOMPDeclareVariantMatchClause(SourceLocation
Loc, OMPTraitInfo &TI,
3445OMPTraitInfo *ParentTI);
3449SourceLocation
Loc);
3453SourceLocation
Loc);
3456 voidParseOpenMPEndAssumesDirective(SourceLocation
Loc);
3464SmallVectorImpl<clang::OMPClause *> &Clauses,
3465SourceLocation
Loc);
3468 voidParseOMPDeclareTargetClauses(SemaOpenMP::DeclareTargetContextInfo &DTCI);
3473SourceLocation
Loc);
3486SourceLocation MatchingLoc,
3487SourceLocation FoundLoc,
3488 boolSkipUntilOpenMPEnd);
3494Decl *TagDecl =
nullptr);
3499 voidParseOpenMPReductionInitializerForDecl(VarDecl *OmpPrivParm);
3505DeclarationName &Name,
3510 booltryParseOpenMPArrayShapingCastPart();
3519 boolParseOpenMPSimpleVarList(
3521 constllvm::function_ref<
void(CXXScopeSpec &, DeclarationNameInfo)> &
3523 boolAllowScopeSpecifier);
3529 StmtResultParseOpenMPDeclarativeOrExecutableDirective(
3530ParsedStmtContext StmtCtx,
boolReadDirectiveWithinMetadirective =
false);
3540ParseOpenMPExecutableDirective(ParsedStmtContext StmtCtx,
3542 boolReadDirectiveWithinMetadirective);
3551 StmtResultParseOpenMPInformationalDirective(
3553 boolReadDirectiveWithinMetadirective);
3578OMPClause *ParseOpenMPSimpleClause(
OpenMPClauseKindKind,
boolParseOnly);
3582 boolParseOpenMPIndirectClause(SemaOpenMP::DeclareTargetContextInfo &DTCI,
3597OMPClause *ParseOpenMPSizesClause();
3600OMPClause *ParseOpenMPPermutationClause();
3608OMPClause *ParseOpenMPClause(
OpenMPClauseKindKind,
boolParseOnly =
false);
3629SourceLocation &ClauseNameLoc,
3630SourceLocation &OpenLoc,
3631SourceLocation &CloseLoc,
3632SmallVectorImpl<Expr *> &Exprs,
3633 boolReqIntConst =
false);
3646 boolParseOMPInteropInfo(OMPInteropInfo &InteropInfo,
OpenMPClauseKindKind);
3654OMPClause *ParseOpenMPInteropClause(
OpenMPClauseKindKind,
boolParseOnly);
3661OMPClause *ParseOpenMPOMPXAttributesClause(
boolParseOnly);
3668 boolIsAddressOfOperand =
false);
3672SemaOpenMP::OpenMPVarListDataTy &
Data,
3673 constLangOptions &LangOpts);
3676SmallVectorImpl<Expr *> &Vars,
3677SemaOpenMP::OpenMPVarListDataTy &
Data);
3679 boolObjectHadErrors,
boolEnteringContext,
3680 boolAllowDestructorName,
boolAllowConstructorName,
3681 boolAllowDeductionGuide,
3682SourceLocation *TemplateKWLoc, UnqualifiedId &
Result);
3705 structOpenACCDirectiveParseInfo {
3707SourceLocation StartLoc;
3708SourceLocation DirLoc;
3709SourceLocation LParenLoc;
3710SourceLocation RParenLoc;
3711SourceLocation EndLoc;
3712SourceLocation MiscLoc;
3713SmallVector<Expr *> Exprs;
3714SmallVector<OpenACCClause *> Clauses;
3719 structOpenACCWaitParseInfo {
3720 boolFailed =
false;
3721Expr *DevNumExpr =
nullptr;
3722SourceLocation QueuesLoc;
3723SmallVector<Expr *> QueueIdExprs;
3725SmallVector<Expr *> getAllExprs() {
3726SmallVector<Expr *> Out;
3727Out.push_back(DevNumExpr);
3728Out.insert(Out.end(), QueueIdExprs.begin(), QueueIdExprs.end());
3735 enum classOpenACCParseCanContinue { Cannot = 0, Can = 1 };
3741 usingOpenACCClauseParseResult =
3742llvm::PointerIntPair<OpenACCClause *, 1, OpenACCParseCanContinue>;
3744OpenACCClauseParseResult OpenACCCanContinue();
3745OpenACCClauseParseResult OpenACCCannotContinue();
3746OpenACCClauseParseResult OpenACCSuccess(OpenACCClause *Clause);
3750OpenACCDirectiveParseInfo ParseOpenACCDirective();
3754 voidParseOpenACCCacheVarList();
3756 usingOpenACCVarParseResult = std::pair<ExprResult, OpenACCParseCanContinue>;
3763OpenACCClauseParseResult
3764ParseOpenACCClauseParams(ArrayRef<const OpenACCClause *> ExistingClauses,
3766SourceLocation ClauseLoc);
3769OpenACCClauseParseResult
3770ParseOpenACCClause(ArrayRef<const OpenACCClause *> ExistingClauses,
3773SmallVector<OpenACCClause *>
3775OpenACCWaitParseInfo ParseOpenACCWaitArgument(SourceLocation
Loc,
3784 usingOpenACCIntExprParseResult =
3785std::pair<ExprResult, OpenACCParseCanContinue>;
3790SourceLocation
Loc);
3794SourceLocation
Loc,
3797 boolParseOpenACCDeviceTypeList(
3803SourceLocation
Loc);
3812 boolParseOpenACCGangArgList(SourceLocation GangLoc,
3816 usingOpenACCGangArgRes = std::pair<OpenACCGangKind, ExprResult>;
3820OpenACCGangArgRes ParseOpenACCGangArg(SourceLocation GangLoc);
3831SourceLocation &DeclEnd,
3832ParsedAttributes &AccessAttrs);
3838ParsingDeclRAIIObject &DiagsFromParams, SourceLocation &DeclEnd,
3840 boolParseTemplateParameters(MultiParseScope &TemplateScopes,
unsignedDepth,
3841SmallVectorImpl<NamedDecl *> &TemplateParams,
3842SourceLocation &LAngleLoc,
3843SourceLocation &RAngleLoc);
3844 boolParseTemplateParameterList(
unsignedDepth,
3845SmallVectorImpl<NamedDecl*> &TemplateParams);
3846TPResult isStartOfTemplateTypeParameter();
3847NamedDecl *ParseTemplateParameter(
unsignedDepth,
unsignedPosition);
3848NamedDecl *ParseTypeParameter(
unsignedDepth,
unsignedPosition);
3849NamedDecl *ParseTemplateTemplateParameter(
unsignedDepth,
unsignedPosition);
3850NamedDecl *ParseNonTypeTemplateParameter(
unsignedDepth,
unsignedPosition);
3851 boolisTypeConstraintAnnotation();
3852 boolTryAnnotateTypeConstraint();
3853 voidDiagnoseMisplacedEllipsis(SourceLocation EllipsisLoc,
3854SourceLocation CorrectLoc,
3855 boolAlreadyHasEllipsis,
3856 boolIdentifierHasName);
3857 voidDiagnoseMisplacedEllipsisInDeclarator(SourceLocation EllipsisLoc,
3860 typedefSmallVector<ParsedTemplateArgument, 16> TemplateArgList;
3862 boolParseGreaterThanInTemplateList(SourceLocation LAngleLoc,
3863SourceLocation &RAngleLoc,
3864 boolConsumeLastToken,
3865 boolObjCGenericList);
3866 boolParseTemplateIdAfterTemplateName(
boolConsumeLastToken,
3867SourceLocation &LAngleLoc,
3868TemplateArgList &TemplateArgs,
3869SourceLocation &RAngleLoc,
3874SourceLocation TemplateKWLoc,
3875UnqualifiedId &TemplateName,
3876 boolAllowTypeAnnotation =
true,
3877 boolTypeConstraint =
false);
3879AnnotateTemplateIdTokenAsType(CXXScopeSpec &SS,
3881 boolIsClassName =
false);
3882 boolParseTemplateArgumentList(TemplateArgList &TemplateArgs,
3883 TemplateTyTemplate, SourceLocation OpenLoc);
3884ParsedTemplateArgument ParseTemplateTemplateArgument();
3885ParsedTemplateArgument ParseTemplateArgument();
3887SourceLocation ExternLoc,
3888SourceLocation TemplateLoc,
3889SourceLocation &DeclEnd,
3890ParsedAttributes &AccessAttrs,
3894ParseConceptDefinition(
constParsedTemplateInfo &TemplateInfo,
3895SourceLocation &DeclEnd);
3906 TypeResultParseTypeFromString(StringRef TypeStr, StringRef Context,
3907SourceLocation IncludeLoc);
3912 Decl*ParseModuleImport(SourceLocation AtLoc,
3914 boolparseMisplacedModuleImport();
3915 booltryParseMisplacedModuleImport() {
3917 if(Kind == tok::annot_module_begin || Kind == tok::annot_module_end ||
3918Kind == tok::annot_module_include)
3919 returnparseMisplacedModuleImport();
3923 boolParseModuleName(
3924SourceLocation UseLoc,
3925SmallVectorImpl<std::pair<IdentifierInfo *, SourceLocation>> &
Path,
3937 ExprResultParseBuiltinPtrauthTypeDiscriminator();
3941 voidCodeCompleteDirective(
boolInConditional)
override;
3942 voidCodeCompleteInConditionalExclusion()
override;
3943 voidCodeCompleteMacroName(
boolIsDefinition)
override;
3944 voidCodeCompletePreprocessorExpression()
override;
3945 voidCodeCompleteMacroArgument(IdentifierInfo *Macro, MacroInfo *MacroInfo,
3946 unsignedArgumentIndex)
override;
3947 voidCodeCompleteIncludedFile(llvm::StringRef Dir,
boolIsAngled)
override;
3948 voidCodeCompleteNaturalLanguage()
override;
3950 classGNUAsmQualifiers {
3951 unsignedQualifiers = AQ_unspecified;
3960 static const char*getQualifierName(AQ Qualifier);
3961 boolsetAsmQualifier(AQ Qualifier);
3962 inline boolisVolatile()
const{
returnQualifiers & AQ_volatile; };
3963 inline boolisInline()
const{
returnQualifiers & AQ_inline; };
3964 inline boolisGoto()
const{
returnQualifiers & AQ_goto; }
3966 boolisGCCAsmStatement(
constToken &TokAfterAsm)
const;
3967 boolisGNUAsmQualifier(
constToken &TokAfterAsm)
const;
3968GNUAsmQualifiers::AQ getGNUAsmQualifier(
constToken &Tok)
const;
3969 boolparseGNUAsmQualifierListOpt(GNUAsmQualifiers &AQ);
enum clang::sema::@1704::IndirectLocalPathEntry::EntryKind Kind
@ LLVM_MARK_AS_BITMASK_ENUM
Defines some OpenACC-specific enums and functions.
Defines and computes precedence levels for binary/ternary operators.
Defines the clang::Preprocessor interface.
This file declares facilities that support code completion.
This file declares semantic analysis for Objective-C.
This file declares semantic analysis for OpenMP constructs and clauses.
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.
bool ParseOpenMPVarList(OpenMPDirectiveKind DKind, OpenMPClauseKind Kind, SmallVectorImpl< Expr * > &Vars, SemaOpenMP::OpenMPVarListDataTy &Data)
Parses clauses with list.
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
bool parseMapTypeModifiers(SemaOpenMP::OpenMPVarListDataTy &Data)
Parses map-type-modifiers in map clause.
Sema::FullExprArg FullExprArg
SourceLocation ConsumeToken()
ConsumeToken - Consume the current 'peek token' and lex the next one.
DeclGroupPtrTy ParseOpenACCDirectiveDecl()
Placeholder for now, should just ignore the directives after emitting a diagnostic.
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.
bool parseMapperModifier(SemaOpenMP::OpenMPVarListDataTy &Data)
Parses the mapper modifier in map, to, and from clauses.
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.
ExprResult ParseConstantExpression()
StmtResult ParseOpenACCDirectiveStmt()
ExprResult ParseConditionalExpression()
bool TryConsumeToken(tok::TokenKind Expected)
friend constexpr SkipUntilFlags operator|(SkipUntilFlags L, SkipUntilFlags R)
OpaquePtr< DeclGroupRef > DeclGroupPtrTy
Scope * getCurScope() const
SourceLocation getEndOfPreviousToken()
ExprResult ParseArrayBoundExpression()
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.
DiagnosticBuilder Diag(unsigned DiagID)
SmallVector< Stmt *, 32 > StmtVector
A SmallVector of statements.
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)
bool ParseOpenMPReservedLocator(OpenMPClauseKind Kind, SemaOpenMP::OpenMPVarListDataTy &Data, const LangOptions &LangOpts)
Parses a reserved locator like 'omp_all_memory'.
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 OpenACC parsing mode to preseve OpenACC specific annotation tokens.
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.
ObjCContainerDecl * getObjCDeclContext() const
void startOpenMPLoop()
If the current region is a loop-based region, mark the start of the loop construct.
Sema - This implements semantic analysis and AST building for C.
Scope * getCurScope() const
Retrieve the parser's current scope.
ProcessingContextState ParsingClassState
IdentifierInfo * getNullabilityKeyword(NullabilityKind nullability)
Retrieve the keyword associated.
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 ...
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.
The JSON file list parser is used to communicate input to InstallAPI.
llvm::omp::Directive OpenMPDirectiveKind
OpenMP directives.
NullabilityKind
Describes the nullability of a particular type.
OpenACCClauseKind
Represents the kind of an OpenACC clause.
@ Self
'self' clause, allowed on Compute and Combined Constructs, plus 'update'.
llvm::omp::Clause OpenMPClauseKind
OpenMP clauses.
ActionResult< CXXCtorInitializer * > MemInitResult
@ 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.
const FunctionProtoType * T
@ Incomplete
Template argument deduction did not deduce a value for every template parameter.
SmallVector< Token, 4 > CachedTokens
A set of tokens that has been cached for later parsing.
@ Class
The "class" keyword introduces the elaborated-type-specifier.
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
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4