53 #include "llvm/ADT/BitmaskEnum.h"
54 #include "llvm/ADT/DenseMap.h"
55 #include "llvm/ADT/SmallString.h"
56 #include "llvm/ADT/SmallVector.h"
57 #include "llvm/ADT/StringRef.h"
58 #include "llvm/Bitstream/BitstreamReader.h"
59 #include "llvm/Support/Casting.h"
60 #include "llvm/Support/ErrorHandling.h"
66 using namespace clang;
67 using namespace serialization;
73 llvm::BitstreamCursor &DeclsCursor;
102 : Record(Record), DeclsCursor(
Cursor) {}
106 static const unsigned NumStmtFields = 0;
110 static const unsigned NumExprFields = NumStmtFields + 4;
115 unsigned NumTemplateArgs);
119 unsigned NumTemplateArgs);
121 void VisitStmt(
Stmt *S);
122 #define STMT(Type, Base) \
123 void Visit##Type(Type *);
124 #include "clang/AST/StmtNodes.inc"
131 unsigned NumTemplateArgs) {
136 for (
unsigned i = 0; i != NumTemplateArgs; ++i)
137 ArgInfo.
addArgument(Record.readTemplateArgumentLoc());
142 assert(Record.getIdx() == NumStmtFields &&
"Incorrect statement field count");
145 void ASTStmtReader::VisitNullStmt(
NullStmt *S) {
147 S->setSemiLoc(readSourceLocation());
148 S->NullStmtBits.HasLeadingEmptyMacro = Record.readInt();
151 void ASTStmtReader::VisitCompoundStmt(
CompoundStmt *S) {
154 unsigned NumStmts = Record.readInt();
156 Stmts.push_back(Record.readSubStmt());
158 S->CompoundStmtBits.LBraceLoc = readSourceLocation();
159 S->RBraceLoc = readSourceLocation();
162 void ASTStmtReader::VisitSwitchCase(
SwitchCase *S) {
164 Record.recordSwitchCaseID(S, Record.readInt());
165 S->setKeywordLoc(readSourceLocation());
166 S->setColonLoc(readSourceLocation());
169 void ASTStmtReader::VisitCaseStmt(
CaseStmt *S) {
171 bool CaseStmtIsGNURange = Record.readInt();
172 S->setLHS(Record.readSubExpr());
173 S->setSubStmt(Record.readSubStmt());
174 if (CaseStmtIsGNURange) {
175 S->setRHS(Record.readSubExpr());
176 S->setEllipsisLoc(readSourceLocation());
180 void ASTStmtReader::VisitDefaultStmt(
DefaultStmt *S) {
182 S->setSubStmt(Record.readSubStmt());
185 void ASTStmtReader::VisitLabelStmt(
LabelStmt *S) {
187 bool IsSideEntry = Record.readInt();
188 auto *LD = readDeclAs<LabelDecl>();
191 S->setSubStmt(Record.readSubStmt());
192 S->setIdentLoc(readSourceLocation());
193 S->setSideEntry(IsSideEntry);
201 uint64_t NumAttrs = Record.readInt();
203 Record.readAttributes(Attrs);
205 assert(NumAttrs == S->AttributedStmtBits.NumAttrs);
206 assert(NumAttrs == Attrs.size());
207 std::copy(Attrs.begin(), Attrs.end(), S->getAttrArrayPtr());
208 S->SubStmt = Record.readSubStmt();
209 S->AttributedStmtBits.AttrLoc = readSourceLocation();
212 void ASTStmtReader::VisitIfStmt(
IfStmt *S) {
215 bool HasElse = Record.readInt();
216 bool HasVar = Record.readInt();
217 bool HasInit = Record.readInt();
220 S->setCond(Record.readSubExpr());
221 S->setThen(Record.readSubStmt());
223 S->setElse(Record.readSubStmt());
225 S->setConditionVariable(Record.getContext(), readDeclAs<VarDecl>());
227 S->setInit(Record.readSubStmt());
229 S->setIfLoc(readSourceLocation());
230 S->setLParenLoc(readSourceLocation());
231 S->setRParenLoc(readSourceLocation());
233 S->setElseLoc(readSourceLocation());
236 void ASTStmtReader::VisitSwitchStmt(
SwitchStmt *S) {
239 bool HasInit = Record.readInt();
240 bool HasVar = Record.readInt();
241 bool AllEnumCasesCovered = Record.readInt();
242 if (AllEnumCasesCovered)
243 S->setAllEnumCasesCovered();
245 S->setCond(Record.readSubExpr());
246 S->setBody(Record.readSubStmt());
248 S->setInit(Record.readSubStmt());
250 S->setConditionVariable(Record.getContext(), readDeclAs<VarDecl>());
252 S->setSwitchLoc(readSourceLocation());
253 S->setLParenLoc(readSourceLocation());
254 S->setRParenLoc(readSourceLocation());
257 for (
auto E = Record.size(); Record.getIdx() != E; ) {
258 SwitchCase *SC = Record.getSwitchCaseWithID(Record.readInt());
262 S->setSwitchCaseList(SC);
268 void ASTStmtReader::VisitWhileStmt(
WhileStmt *S) {
271 bool HasVar = Record.readInt();
273 S->setCond(Record.readSubExpr());
274 S->setBody(Record.readSubStmt());
276 S->setConditionVariable(Record.getContext(), readDeclAs<VarDecl>());
278 S->setWhileLoc(readSourceLocation());
279 S->setLParenLoc(readSourceLocation());
280 S->setRParenLoc(readSourceLocation());
283 void ASTStmtReader::VisitDoStmt(
DoStmt *S) {
285 S->setCond(Record.readSubExpr());
286 S->setBody(Record.readSubStmt());
287 S->setDoLoc(readSourceLocation());
288 S->setWhileLoc(readSourceLocation());
289 S->setRParenLoc(readSourceLocation());
292 void ASTStmtReader::VisitForStmt(
ForStmt *S) {
294 S->setInit(Record.readSubStmt());
295 S->setCond(Record.readSubExpr());
296 S->setConditionVariable(Record.getContext(), readDeclAs<VarDecl>());
297 S->setInc(Record.readSubExpr());
298 S->setBody(Record.readSubStmt());
299 S->setForLoc(readSourceLocation());
300 S->setLParenLoc(readSourceLocation());
301 S->setRParenLoc(readSourceLocation());
304 void ASTStmtReader::VisitGotoStmt(
GotoStmt *S) {
306 S->setLabel(readDeclAs<LabelDecl>());
307 S->setGotoLoc(readSourceLocation());
308 S->setLabelLoc(readSourceLocation());
313 S->setGotoLoc(readSourceLocation());
314 S->setStarLoc(readSourceLocation());
315 S->setTarget(Record.readSubExpr());
318 void ASTStmtReader::VisitContinueStmt(
ContinueStmt *S) {
320 S->setContinueLoc(readSourceLocation());
323 void ASTStmtReader::VisitBreakStmt(
BreakStmt *S) {
325 S->setBreakLoc(readSourceLocation());
328 void ASTStmtReader::VisitReturnStmt(
ReturnStmt *S) {
331 bool HasNRVOCandidate = Record.readInt();
333 S->setRetValue(Record.readSubExpr());
334 if (HasNRVOCandidate)
335 S->setNRVOCandidate(readDeclAs<VarDecl>());
337 S->setReturnLoc(readSourceLocation());
340 void ASTStmtReader::VisitDeclStmt(
DeclStmt *S) {
342 S->setStartLoc(readSourceLocation());
343 S->setEndLoc(readSourceLocation());
345 if (Record.size() - Record.getIdx() == 1) {
350 int N = Record.size() - Record.getIdx();
352 for (
int I = 0; I < N; ++I)
353 Decls.push_back(readDecl());
360 void ASTStmtReader::VisitAsmStmt(
AsmStmt *S) {
362 S->NumOutputs = Record.readInt();
363 S->NumInputs = Record.readInt();
364 S->NumClobbers = Record.readInt();
365 S->setAsmLoc(readSourceLocation());
366 S->setVolatile(Record.readInt());
367 S->setSimple(Record.readInt());
370 void ASTStmtReader::VisitGCCAsmStmt(
GCCAsmStmt *S) {
372 S->NumLabels = Record.readInt();
373 S->setRParenLoc(readSourceLocation());
374 S->setAsmString(cast_or_null<StringLiteral>(Record.readSubStmt()));
376 unsigned NumOutputs = S->getNumOutputs();
377 unsigned NumInputs = S->getNumInputs();
378 unsigned NumClobbers = S->getNumClobbers();
379 unsigned NumLabels = S->getNumLabels();
385 for (
unsigned I = 0, N = NumOutputs + NumInputs; I != N; ++I) {
386 Names.push_back(Record.readIdentifier());
387 Constraints.push_back(cast_or_null<StringLiteral>(Record.readSubStmt()));
388 Exprs.push_back(Record.readSubStmt());
393 for (
unsigned I = 0; I != NumClobbers; ++I)
394 Clobbers.push_back(cast_or_null<StringLiteral>(Record.readSubStmt()));
397 for (
unsigned I = 0, N = NumLabels; I != N; ++I)
398 Exprs.push_back(Record.readSubStmt());
400 S->setOutputsAndInputsAndClobbers(Record.getContext(),
401 Names.data(), Constraints.data(),
402 Exprs.data(), NumOutputs, NumInputs,
404 Clobbers.data(), NumClobbers);
407 void ASTStmtReader::VisitMSAsmStmt(
MSAsmStmt *S) {
409 S->LBraceLoc = readSourceLocation();
410 S->EndLoc = readSourceLocation();
411 S->NumAsmToks = Record.readInt();
416 AsmToks.reserve(S->NumAsmToks);
417 for (
unsigned i = 0, e = S->NumAsmToks; i != e; ++i) {
418 AsmToks.push_back(Record.readToken());
427 ClobbersData.reserve(S->NumClobbers);
428 Clobbers.reserve(S->NumClobbers);
429 for (
unsigned i = 0, e = S->NumClobbers; i != e; ++i) {
430 ClobbersData.push_back(readString());
431 Clobbers.push_back(ClobbersData.back());
435 unsigned NumOperands = S->NumOutputs + S->NumInputs;
439 Exprs.reserve(NumOperands);
440 ConstraintsData.reserve(NumOperands);
441 Constraints.reserve(NumOperands);
442 for (
unsigned i = 0; i != NumOperands; ++i) {
443 Exprs.push_back(cast<Expr>(Record.readSubStmt()));
444 ConstraintsData.push_back(readString());
445 Constraints.push_back(ConstraintsData.back());
448 S->initialize(Record.getContext(), AsmStr, AsmToks,
449 Constraints, Exprs, Clobbers);
454 assert(Record.peekInt() == S->NumParams);
456 auto *StoredStmts = S->getStoredStmts();
458 i < CoroutineBodyStmt::SubStmt::FirstParamMove + S->NumParams; ++i)
459 StoredStmts[i] = Record.readSubStmt();
462 void ASTStmtReader::VisitCoreturnStmt(
CoreturnStmt *S) {
464 S->CoreturnLoc = Record.readSourceLocation();
465 for (
auto &SubStmt: S->SubStmts)
466 SubStmt = Record.readSubStmt();
467 S->IsImplicit = Record.readInt() != 0;
470 void ASTStmtReader::VisitCoawaitExpr(
CoawaitExpr *E) {
472 E->KeywordLoc = readSourceLocation();
473 for (
auto &SubExpr: E->SubExprs)
474 SubExpr = Record.readSubStmt();
475 E->OpaqueValue = cast_or_null<OpaqueValueExpr>(Record.readSubStmt());
479 void ASTStmtReader::VisitCoyieldExpr(
CoyieldExpr *E) {
481 E->KeywordLoc = readSourceLocation();
482 for (
auto &SubExpr: E->SubExprs)
483 SubExpr = Record.readSubStmt();
484 E->OpaqueValue = cast_or_null<OpaqueValueExpr>(Record.readSubStmt());
489 E->KeywordLoc = readSourceLocation();
490 for (
auto &SubExpr: E->SubExprs)
491 SubExpr = Record.readSubStmt();
494 void ASTStmtReader::VisitCapturedStmt(
CapturedStmt *S) {
497 S->setCapturedDecl(readDeclAs<CapturedDecl>());
499 S->setCapturedRecordDecl(readDeclAs<RecordDecl>());
503 E = S->capture_init_end();
505 *I = Record.readSubExpr();
508 S->setCapturedStmt(Record.readSubStmt());
509 S->getCapturedDecl()->setBody(S->getCapturedStmt());
512 for (
auto &I : S->captures()) {
513 I.VarAndKind.setPointer(readDeclAs<VarDecl>());
516 I.Loc = readSourceLocation();
520 void ASTStmtReader::VisitExpr(
Expr *E) {
526 assert(Record.getIdx() == NumExprFields &&
527 "Incorrect expression field count");
530 void ASTStmtReader::VisitConstantExpr(
ConstantExpr *E) {
533 auto StorageKind = Record.readInt();
534 assert(E->
ConstantExprBits.ResultKind == StorageKind &&
"Wrong ResultKind!");
542 switch (StorageKind) {
547 E->Int64Result() = Record.readInt();
551 E->APValueResult() = Record.readAPValue();
554 Record.getContext().addDestruction(&E->APValueResult());
558 llvm_unreachable(
"unexpected ResultKind!");
567 E->setLocation(readSourceLocation());
568 E->setLParenLocation(readSourceLocation());
569 E->setRParenLocation(readSourceLocation());
571 E->setTypeSourceInfo(Record.readTypeSourceInfo());
576 bool HasFunctionName = Record.readInt();
581 E->setFunctionName(cast<StringLiteral>(Record.readSubExpr()));
584 void ASTStmtReader::VisitDeclRefExpr(
DeclRefExpr *E) {
591 E->
DeclRefExprBits.RefersToEnclosingVariableOrCapture = Record.readInt();
593 unsigned NumTemplateArgs = 0;
595 NumTemplateArgs = Record.readInt();
601 if (E->hasFoundDecl())
602 *E->getTrailingObjects<
NamedDecl *>() = readDeclAs<NamedDecl>();
605 ReadTemplateKWAndArgsInfo(
609 E->D = readDeclAs<ValueDecl>();
617 E->
setValue(Record.getContext(), Record.readAPInt());
624 E->
setValue(Record.getContext(), Record.readAPInt());
630 static_cast<llvm::APFloatBase::Semantics
>(Record.readInt()));
646 unsigned NumConcatenated = Record.readInt();
647 unsigned Length = Record.readInt();
648 unsigned CharByteWidth = Record.readInt();
650 "Wrong number of concatenated tokens!");
651 assert((Length == E->
getLength()) &&
"Wrong Length!");
652 assert((CharByteWidth == E->
getCharByteWidth()) &&
"Wrong character width!");
659 assert((CharByteWidth ==
660 StringLiteral::mapCharByteWidth(Record.getContext().getTargetInfo(),
662 "Wrong character width!");
665 for (
unsigned I = 0; I < NumConcatenated; ++I)
666 E->setStrTokenLoc(I, readSourceLocation());
669 char *StrData = E->getStrDataAsChar();
670 for (
unsigned I = 0; I < Length * CharByteWidth; ++I)
671 StrData[I] = Record.readInt();
681 void ASTStmtReader::VisitParenExpr(
ParenExpr *E) {
690 unsigned NumExprs = Record.readInt();
691 assert((NumExprs == E->
getNumExprs()) &&
"Wrong NumExprs!");
692 for (
unsigned I = 0; I != NumExprs; ++I)
693 E->getTrailingObjects<
Stmt *>()[I] = Record.readSubStmt();
694 E->LParenLoc = readSourceLocation();
695 E->RParenLoc = readSourceLocation();
700 bool hasFP_Features = Record.readInt();
711 void ASTStmtReader::VisitOffsetOfExpr(
OffsetOfExpr *E) {
742 *
Base = Record.readCXXBaseSpecifier();
756 if (Record.peekInt() == 0) {
771 unsigned NumDetailRecords = Record.
readInt();
772 for (
unsigned i = 0; i != NumDetailRecords; ++i) {
777 Satisfaction.
Details.emplace_back(
780 DiagLocation, DiagMessage});
788 void ASTStmtReader::VisitConceptSpecializationExpr(
791 unsigned NumTemplateArgs = Record.readInt();
799 for (
unsigned I = 0; I < NumTemplateArgs; ++I)
800 Args.push_back(Record.readTemplateArgument());
817 void ASTStmtReader::VisitRequiresExpr(
RequiresExpr *E) {
819 unsigned NumLocalParameters = Record.readInt();
820 unsigned NumRequirements = Record.readInt();
825 for (
unsigned i = 0; i < NumLocalParameters; ++i)
826 LocalParameters.push_back(cast<ParmVarDecl>(Record.readDecl()));
827 std::copy(LocalParameters.begin(), LocalParameters.end(),
830 for (
unsigned i = 0; i < NumRequirements; ++i) {
840 R =
new (Record.getContext())
843 R =
new (Record.getContext())
856 E = Record.readExpr();
864 NoexceptLoc = Record.readSourceLocation();
865 switch (Record.readInt()) {
875 SubstitutedConstraintExpr =
876 cast<ConceptSpecializationExpr>(Record.readExpr());
885 if (
Expr *Ex = E.dyn_cast<
Expr *>())
888 std::move(*Req), Status, SubstitutedConstraintExpr);
896 if (Record.readInt()) {
901 Expr *E = Record.readExpr();
905 R =
new (Record.getContext())
912 Requirements.push_back(R);
914 std::copy(Requirements.begin(), Requirements.end(),
916 E->RBraceLoc = Record.readSourceLocation();
921 E->
setLHS(Record.readSubExpr());
922 E->
setRHS(Record.readSubExpr());
928 E->
setBase(Record.readSubExpr());
936 E->
setBase(Record.readSubExpr());
947 unsigned NumDims = Record.readInt();
948 E->setBase(Record.readSubExpr());
950 for (
unsigned I = 0; I < NumDims; ++I)
951 Dims[I] = Record.readSubExpr();
952 E->setDimensions(Dims);
954 for (
unsigned I = 0; I < NumDims; ++I)
955 SRs[I] = readSourceRange();
956 E->setBracketsRanges(SRs);
963 unsigned NumIters = Record.readInt();
967 for (
unsigned I = 0; I < NumIters; ++I) {
968 E->setIteratorDeclaration(I, Record.readDeclRef());
969 E->setAssignmentLoc(I, readSourceLocation());
971 Expr *
End = Record.readSubExpr();
972 Expr *Step = Record.readSubExpr();
976 SecColonLoc = readSourceLocation();
977 E->setIteratorRange(I,
Begin, ColonLoc,
End, SecColonLoc, Step);
980 HD.
CounterVD = cast_or_null<VarDecl>(Record.readDeclRef());
981 HD.
Upper = Record.readSubExpr();
982 HD.
Update = Record.readSubExpr();
988 void ASTStmtReader::VisitCallExpr(
CallExpr *E) {
990 unsigned NumArgs = Record.readInt();
991 bool HasFPFeatures = Record.readInt();
992 assert((NumArgs == E->
getNumArgs()) &&
"Wrong NumArgs!");
995 for (
unsigned I = 0; I != NumArgs; ++I)
996 E->
setArg(I, Record.readSubExpr());
1007 void ASTStmtReader::VisitMemberExpr(
MemberExpr *E) {
1010 bool HasQualifier = Record.readInt();
1011 bool HasFoundDecl = Record.readInt();
1012 bool HasTemplateInfo = Record.readInt();
1013 unsigned NumTemplateArgs = Record.readInt();
1015 E->Base = Record.readSubExpr();
1016 E->MemberDecl = Record.readDeclAs<
ValueDecl>();
1017 E->MemberDNLoc = Record.readDeclarationNameLoc(E->MemberDecl->
getDeclName());
1018 E->MemberLoc = Record.readSourceLocation();
1020 E->
MemberExprBits.HasQualifierOrFoundDecl = HasQualifier || HasFoundDecl;
1026 if (HasQualifier || HasFoundDecl) {
1029 auto *FoundD = Record.readDeclAs<
NamedDecl>();
1040 QualifierLoc = Record.readNestedNameSpecifierLoc();
1045 if (HasTemplateInfo)
1046 ReadTemplateKWAndArgsInfo(
1051 void ASTStmtReader::VisitObjCIsaExpr(
ObjCIsaExpr *E) {
1053 E->
setBase(Record.readSubExpr());
1059 void ASTStmtReader::
1062 E->Operand = Record.readSubExpr();
1063 E->setShouldCopy(Record.readInt());
1067 VisitExplicitCastExpr(E);
1068 E->LParenLoc = readSourceLocation();
1069 E->BridgeKeywordLoc = readSourceLocation();
1070 E->Kind = Record.readInt();
1073 void ASTStmtReader::VisitCastExpr(
CastExpr *E) {
1075 unsigned NumBaseSpecs = Record.readInt();
1077 unsigned HasFPFeatures = Record.readInt();
1082 while (NumBaseSpecs--) {
1084 *BaseSpec = Record.readCXXBaseSpecifier();
1085 *BaseI++ = BaseSpec;
1093 bool hasFP_Features;
1097 E->
setLHS(Record.readSubExpr());
1098 E->
setRHS(Record.readSubExpr());
1106 VisitBinaryOperator(E);
1113 E->SubExprs[ConditionalOperator::COND] = Record.readSubExpr();
1114 E->SubExprs[ConditionalOperator::LHS] = Record.readSubExpr();
1115 E->SubExprs[ConditionalOperator::RHS] = Record.readSubExpr();
1116 E->QuestionLoc = readSourceLocation();
1117 E->ColonLoc = readSourceLocation();
1123 E->OpaqueValue = cast<OpaqueValueExpr>(Record.readSubExpr());
1124 E->SubExprs[BinaryConditionalOperator::COMMON] = Record.readSubExpr();
1125 E->SubExprs[BinaryConditionalOperator::COND] = Record.readSubExpr();
1126 E->SubExprs[BinaryConditionalOperator::LHS] = Record.readSubExpr();
1127 E->SubExprs[BinaryConditionalOperator::RHS] = Record.readSubExpr();
1128 E->QuestionLoc = readSourceLocation();
1129 E->ColonLoc = readSourceLocation();
1143 VisitExplicitCastExpr(E);
1158 E->
setBase(Record.readSubExpr());
1163 void ASTStmtReader::VisitInitListExpr(
InitListExpr *E) {
1165 if (
auto *SyntForm = cast_or_null<InitListExpr>(Record.readSubStmt()))
1169 bool isArrayFiller = Record.readInt();
1170 Expr *filler =
nullptr;
1171 if (isArrayFiller) {
1172 filler = Record.readSubExpr();
1173 E->ArrayFillerOrUnionFieldInit = filler;
1175 E->ArrayFillerOrUnionFieldInit = readDeclAs<FieldDecl>();
1177 unsigned NumInits = Record.readInt();
1179 if (isArrayFiller) {
1180 for (
unsigned I = 0; I != NumInits; ++I) {
1181 Expr *init = Record.readSubExpr();
1182 E->
updateInit(Record.getContext(), I, init ? init : filler);
1185 for (
unsigned I = 0; I != NumInits; ++I)
1186 E->
updateInit(Record.getContext(), I, Record.readSubExpr());
1194 unsigned NumSubExprs = Record.readInt();
1195 assert(NumSubExprs == E->
getNumSubExprs() &&
"Wrong number of subexprs");
1196 for (
unsigned I = 0; I != NumSubExprs; ++I)
1202 while (Record.getIdx() < Record.size()) {
1205 auto *
Field = readDeclAs<FieldDecl>();
1210 Designators.back().setField(Field);
1218 Designators.push_back(
Designator(Name, DotLoc, FieldLoc));
1223 unsigned Index = Record.readInt();
1226 Designators.push_back(
Designator(Index, LBracketLoc, RBracketLoc));
1231 unsigned Index = Record.readInt();
1235 Designators.push_back(
Designator(Index, LBracketLoc, EllipsisLoc,
1242 Designators.data(), Designators.size());
1247 E->
setBase(Record.readSubExpr());
1251 void ASTStmtReader::VisitNoInitExpr(
NoInitExpr *E) {
1257 E->SubExprs[0] = Record.readSubExpr();
1258 E->SubExprs[1] = Record.readSubExpr();
1269 void ASTStmtReader::VisitVAArgExpr(
VAArgExpr *E) {
1280 E->ParentContext = readDeclAs<DeclContext>();
1281 E->BuiltinLoc = readSourceLocation();
1282 E->RParenLoc = readSourceLocation();
1291 E->
setLabel(readDeclAs<LabelDecl>());
1294 void ASTStmtReader::VisitStmtExpr(
StmtExpr *E) {
1298 E->
setSubStmt(cast_or_null<CompoundStmt>(Record.readSubStmt()));
1302 void ASTStmtReader::VisitChooseExpr(
ChooseExpr *E) {
1304 E->
setCond(Record.readSubExpr());
1305 E->
setLHS(Record.readSubExpr());
1306 E->
setRHS(Record.readSubExpr());
1312 void ASTStmtReader::VisitGNUNullExpr(
GNUNullExpr *E) {
1320 unsigned NumExprs = Record.readInt();
1322 Exprs.push_back(Record.readSubExpr());
1323 E->
setExprs(Record.getContext(), Exprs);
1330 E->BuiltinLoc = readSourceLocation();
1331 E->RParenLoc = readSourceLocation();
1332 E->TInfo = readTypeSourceInfo();
1333 E->SrcExpr = Record.readSubExpr();
1336 void ASTStmtReader::VisitBlockExpr(
BlockExpr *E) {
1344 unsigned NumAssocs = Record.readInt();
1345 assert(NumAssocs == E->
getNumAssocs() &&
"Wrong NumAssocs!");
1346 E->ResultIndex = Record.readInt();
1348 E->DefaultLoc = readSourceLocation();
1349 E->RParenLoc = readSourceLocation();
1351 Stmt **Stmts = E->getTrailingObjects<
Stmt *>();
1355 for (
unsigned I = 0, N = NumAssocs + 1; I < N; ++I)
1356 Stmts[I] = Record.readSubExpr();
1359 for (
unsigned I = 0, N = NumAssocs; I < N; ++I)
1360 TSIs[I] = readTypeSourceInfo();
1365 unsigned numSemanticExprs = Record.readInt();
1370 E->getSubExprsBuffer()[0] = Record.readSubExpr();
1373 for (
unsigned i = 0; i != numSemanticExprs; ++i) {
1374 Expr *subExpr = Record.readSubExpr();
1375 E->getSubExprsBuffer()[i+1] = subExpr;
1379 void ASTStmtReader::VisitAtomicExpr(
AtomicExpr *E) {
1383 for (
unsigned I = 0; I != E->NumSubExprs; ++I)
1384 E->SubExprs[I] = Record.readSubExpr();
1385 E->BuiltinLoc = readSourceLocation();
1386 E->RParenLoc = readSourceLocation();
1394 E->
setString(cast<StringLiteral>(Record.readSubStmt()));
1401 E->SubExpr = Record.readSubStmt();
1402 E->BoxingMethod = readDeclAs<ObjCMethodDecl>();
1403 E->Range = readSourceRange();
1408 unsigned NumElements = Record.readInt();
1409 assert(NumElements == E->
getNumElements() &&
"Wrong number of elements");
1411 for (
unsigned I = 0, N = NumElements; I != N; ++I)
1412 Elements[I] = Record.readSubExpr();
1413 E->ArrayWithObjectsMethod = readDeclAs<ObjCMethodDecl>();
1414 E->Range = readSourceRange();
1419 unsigned NumElements = Record.readInt();
1420 assert(NumElements == E->
getNumElements() &&
"Wrong number of elements");
1421 bool HasPackExpansions = Record.readInt();
1422 assert(HasPackExpansions == E->HasPackExpansions &&
"Pack expansion mismatch");
1427 for (
unsigned I = 0; I != NumElements; ++I) {
1428 KeyValues[I].Key = Record.readSubExpr();
1429 KeyValues[I].Value = Record.readSubExpr();
1430 if (HasPackExpansions) {
1431 Expansions[I].EllipsisLoc = readSourceLocation();
1432 Expansions[I].NumExpansionsPlusOne = Record.readInt();
1435 E->DictWithObjectsMethod = readDeclAs<ObjCMethodDecl>();
1436 E->Range = readSourceRange();
1457 E->ProtoLoc = readSourceLocation();
1463 E->
setDecl(readDeclAs<ObjCIvarDecl>());
1466 E->
setBase(Record.readSubExpr());
1473 unsigned MethodRefFlags = Record.readInt();
1474 bool Implicit = Record.readInt() != 0;
1476 auto *Getter = readDeclAs<ObjCMethodDecl>();
1477 auto *Setter = readDeclAs<ObjCMethodDecl>();
1478 E->setImplicitProperty(Getter, Setter, MethodRefFlags);
1480 E->setExplicitProperty(readDeclAs<ObjCPropertyDecl>(), MethodRefFlags);
1482 E->setLocation(readSourceLocation());
1483 E->setReceiverLocation(readSourceLocation());
1484 switch (Record.readInt()) {
1486 E->setBase(Record.readSubExpr());
1489 E->setSuperReceiver(Record.readType());
1492 E->setClassReceiver(readDeclAs<ObjCInterfaceDecl>());
1502 E->GetAtIndexMethodDecl = readDeclAs<ObjCMethodDecl>();
1503 E->SetAtIndexMethodDecl = readDeclAs<ObjCMethodDecl>();
1510 unsigned NumStoredSelLocs = Record.readInt();
1511 E->SelLocsKind = Record.readInt();
1513 E->IsImplicit = Record.readInt();
1535 if (Record.readInt())
1540 E->LBracLoc = readSourceLocation();
1541 E->RBracLoc = readSourceLocation();
1543 for (
unsigned I = 0, N = E->
getNumArgs(); I != N; ++I)
1544 E->
setArg(I, Record.readSubExpr());
1547 for (
unsigned I = 0; I != NumStoredSelLocs; ++I)
1548 Locs[I] = readSourceLocation();
1553 S->setElement(Record.readSubStmt());
1554 S->setCollection(Record.readSubExpr());
1555 S->setBody(Record.readSubStmt());
1556 S->setForLoc(readSourceLocation());
1557 S->setRParenLoc(readSourceLocation());
1562 S->setCatchBody(Record.readSubStmt());
1563 S->setCatchParamDecl(readDeclAs<VarDecl>());
1564 S->setAtCatchLoc(readSourceLocation());
1565 S->setRParenLoc(readSourceLocation());
1570 S->setFinallyBody(Record.readSubStmt());
1571 S->setAtFinallyLoc(readSourceLocation());
1576 S->setSubStmt(Record.readSubStmt());
1577 S->setAtLoc(readSourceLocation());
1582 assert(Record.peekInt() == S->getNumCatchStmts());
1584 bool HasFinally = Record.readInt();
1585 S->setTryBody(Record.readSubStmt());
1586 for (
unsigned I = 0, N = S->getNumCatchStmts(); I != N; ++I)
1587 S->setCatchStmt(I, cast_or_null<ObjCAtCatchStmt>(Record.readSubStmt()));
1590 S->setFinallyStmt(Record.readSubStmt());
1591 S->setAtTryLoc(readSourceLocation());
1596 S->setSynchExpr(Record.readSubStmt());
1597 S->setSynchBody(Record.readSubStmt());
1598 S->setAtSynchronizedLoc(readSourceLocation());
1603 S->setThrowExpr(Record.readSubStmt());
1604 S->setThrowLoc(readSourceLocation());
1618 E->VersionToCheck = Record.readVersionTuple();
1625 void ASTStmtReader::VisitCXXCatchStmt(
CXXCatchStmt *S) {
1627 S->CatchLoc = readSourceLocation();
1628 S->ExceptionDecl = readDeclAs<VarDecl>();
1629 S->HandlerBlock = Record.readSubStmt();
1632 void ASTStmtReader::VisitCXXTryStmt(
CXXTryStmt *S) {
1634 assert(Record.peekInt() == S->getNumHandlers() &&
"NumStmtFields is wrong ?");
1636 S->TryLoc = readSourceLocation();
1637 S->getStmts()[0] = Record.readSubStmt();
1638 for (
unsigned i = 0, e = S->getNumHandlers(); i != e; ++i)
1639 S->getStmts()[i + 1] = Record.readSubStmt();
1644 S->ForLoc = readSourceLocation();
1645 S->CoawaitLoc = readSourceLocation();
1646 S->ColonLoc = readSourceLocation();
1647 S->RParenLoc = readSourceLocation();
1648 S->setInit(Record.readSubStmt());
1649 S->setRangeStmt(Record.readSubStmt());
1650 S->setBeginStmt(Record.readSubStmt());
1651 S->setEndStmt(Record.readSubStmt());
1652 S->setCond(Record.readSubExpr());
1653 S->setInc(Record.readSubExpr());
1654 S->setLoopVarStmt(Record.readSubStmt());
1655 S->setBody(Record.readSubStmt());
1660 S->KeywordLoc = readSourceLocation();
1661 S->IsIfExists = Record.readInt();
1662 S->QualifierLoc = Record.readNestedNameSpecifierLoc();
1663 S->NameInfo = Record.readDeclarationNameInfo();
1664 S->SubStmt = Record.readSubStmt();
1670 E->Range = Record.readSourceRange();
1673 void ASTStmtReader::VisitCXXRewrittenBinaryOperator(
1677 E->SemanticForm = Record.readSubExpr();
1683 unsigned NumArgs = Record.readInt();
1684 assert((NumArgs == E->
getNumArgs()) &&
"Wrong NumArgs!");
1693 E->Constructor = readDeclAs<CXXConstructorDecl>();
1694 E->ParenOrBraceRange = readSourceRange();
1696 for (
unsigned I = 0; I != NumArgs; ++I)
1697 E->
setArg(I, Record.readSubExpr());
1702 E->Constructor = readDeclAs<CXXConstructorDecl>();
1703 E->Loc = readSourceLocation();
1704 E->ConstructsVirtualBase = Record.readInt();
1705 E->InheritedFromVirtualBase = Record.readInt();
1709 VisitCXXConstructExpr(E);
1710 E->TSI = readTypeSourceInfo();
1713 void ASTStmtReader::VisitLambdaExpr(
LambdaExpr *E) {
1715 unsigned NumCaptures = Record.readInt();
1718 E->IntroducerRange = readSourceRange();
1720 E->CaptureDefaultLoc = readSourceLocation();
1723 E->ClosingBrace = readSourceLocation();
1729 *
C = Record.readSubExpr();
1738 E->SubExpr = Record.readSubExpr();
1742 VisitExplicitCastExpr(E);
1745 E->RParenLoc = R.
getEnd();
1746 R = readSourceRange();
1747 E->AngleBrackets = R;
1751 return VisitCXXNamedCastExpr(E);
1755 return VisitCXXNamedCastExpr(E);
1759 return VisitCXXNamedCastExpr(E);
1763 return VisitCXXNamedCastExpr(E);
1767 return VisitCXXNamedCastExpr(E);
1771 VisitExplicitCastExpr(E);
1777 VisitExplicitCastExpr(E);
1778 E->KWLoc = readSourceLocation();
1779 E->RParenLoc = readSourceLocation();
1784 E->UDSuffixLoc = readSourceLocation();
1802 E->Operand = readTypeSourceInfo();
1804 E->Operand = Record.readSubExpr();
1807 void ASTStmtReader::VisitCXXThisExpr(
CXXThisExpr *E) {
1813 void ASTStmtReader::VisitCXXThrowExpr(
CXXThrowExpr *E) {
1816 E->Operand = Record.readSubExpr();
1822 E->Param = readDeclAs<ParmVarDecl>();
1823 E->UsedContext = readDeclAs<DeclContext>();
1829 E->Field = readDeclAs<FieldDecl>();
1830 E->UsedContext = readDeclAs<DeclContext>();
1842 E->TypeInfo = readTypeSourceInfo();
1846 void ASTStmtReader::VisitCXXNewExpr(
CXXNewExpr *E) {
1849 bool IsArray = Record.readInt();
1850 bool HasInit = Record.readInt();
1851 unsigned NumPlacementArgs = Record.readInt();
1852 bool IsParenTypeId = Record.readInt();
1859 assert((IsArray == E->
isArray()) &&
"Wrong IsArray!");
1862 "Wrong NumPlacementArgs!");
1863 assert((IsParenTypeId == E->
isParenTypeId()) &&
"Wrong IsParenTypeId!");
1866 (void)NumPlacementArgs;
1870 E->AllocatedTypeInfo = readTypeSourceInfo();
1872 E->getTrailingObjects<
SourceRange>()[0] = readSourceRange();
1873 E->Range = readSourceRange();
1874 E->DirectInitRange = readSourceRange();
1880 *I = Record.readSubStmt();
1889 E->OperatorDelete = readDeclAs<FunctionDecl>();
1890 E->Argument = Record.readSubExpr();
1897 E->Base = Record.readSubExpr();
1898 E->IsArrow = Record.readInt();
1899 E->OperatorLoc = readSourceLocation();
1900 E->QualifierLoc = Record.readNestedNameSpecifierLoc();
1901 E->ScopeType = readTypeSourceInfo();
1902 E->ColonColonLoc = readSourceLocation();
1903 E->TildeLoc = readSourceLocation();
1915 unsigned NumObjects = Record.readInt();
1917 for (
unsigned i = 0; i != NumObjects; ++i) {
1921 Obj = readDeclAs<BlockDecl>();
1923 Obj = cast<CompoundLiteralExpr>(Record.readSubExpr());
1925 llvm_unreachable(
"unexpected cleanup object type");
1930 E->
SubExpr = Record.readSubExpr();
1933 void ASTStmtReader::VisitCXXDependentScopeMemberExpr(
1937 bool HasTemplateKWAndArgsInfo = Record.readInt();
1938 unsigned NumTemplateArgs = Record.readInt();
1939 bool HasFirstQualifierFoundInScope = Record.readInt();
1941 assert((HasTemplateKWAndArgsInfo == E->hasTemplateKWAndArgsInfo()) &&
1942 "Wrong HasTemplateKWAndArgsInfo!");
1944 (HasFirstQualifierFoundInScope == E->hasFirstQualifierFoundInScope()) &&
1945 "Wrong HasFirstQualifierFoundInScope!");
1947 if (HasTemplateKWAndArgsInfo)
1948 ReadTemplateKWAndArgsInfo(
1953 "Wrong NumTemplateArgs!");
1957 E->BaseType = Record.readType();
1958 E->QualifierLoc = Record.readNestedNameSpecifierLoc();
1959 E->Base = Record.readSubExpr();
1961 if (HasFirstQualifierFoundInScope)
1962 *E->getTrailingObjects<
NamedDecl *>() = readDeclAs<NamedDecl>();
1964 E->MemberNameInfo = Record.readDeclarationNameInfo();
1971 if (Record.readInt())
1972 ReadTemplateKWAndArgsInfo(
1977 E->QualifierLoc = Record.readNestedNameSpecifierLoc();
1978 E->NameInfo = Record.readDeclarationNameInfo();
1984 assert(Record.peekInt() == E->
getNumArgs() &&
1985 "Read wrong record during creation ?");
1987 for (
unsigned I = 0, N = E->
getNumArgs(); I != N; ++I)
1988 E->
setArg(I, Record.readSubExpr());
1989 E->TSI = readTypeSourceInfo();
1994 void ASTStmtReader::VisitOverloadExpr(
OverloadExpr *E) {
1997 unsigned NumResults = Record.readInt();
1998 bool HasTemplateKWAndArgsInfo = Record.readInt();
1999 assert((E->
getNumDecls() == NumResults) &&
"Wrong NumResults!");
2001 "Wrong HasTemplateKWAndArgsInfo!");
2003 if (HasTemplateKWAndArgsInfo) {
2004 unsigned NumTemplateArgs = Record.readInt();
2009 "Wrong NumTemplateArgs!");
2013 for (
unsigned I = 0; I != NumResults; ++I) {
2014 auto *D = readDeclAs<NamedDecl>();
2021 for (
unsigned I = 0; I != NumResults; ++I) {
2022 Results[I] = (Iter + I).getPair();
2025 E->NameInfo = Record.readDeclarationNameInfo();
2026 E->QualifierLoc = Record.readNestedNameSpecifierLoc();
2030 VisitOverloadExpr(E);
2033 E->Base = Record.readSubExpr();
2034 E->BaseType = Record.readType();
2035 E->OperatorLoc = readSourceLocation();
2039 VisitOverloadExpr(E);
2042 E->NamingClass = readDeclAs<CXXRecordDecl>();
2051 E->Loc =
Range.getBegin();
2052 E->RParenLoc =
Range.getEnd();
2055 for (
unsigned I = 0, N = E->
getNumArgs(); I != N; ++I)
2056 Args[I] = readTypeSourceInfo();
2062 E->Value = (
unsigned int)Record.readInt();
2064 E->Loc =
Range.getBegin();
2065 E->RParen =
Range.getEnd();
2066 E->QueriedType = readTypeSourceInfo();
2067 E->Dimension = Record.readSubExpr();
2073 E->Value = (
bool)Record.readInt();
2075 E->QueriedExpression = Record.readSubExpr();
2076 E->Loc =
Range.getBegin();
2077 E->RParen =
Range.getEnd();
2083 E->Range = readSourceRange();
2084 E->Operand = Record.readSubExpr();
2089 E->EllipsisLoc = readSourceLocation();
2090 E->NumExpansions = Record.readInt();
2091 E->Pattern = Record.readSubExpr();
2096 unsigned NumPartialArgs = Record.readInt();
2097 E->OperatorLoc = readSourceLocation();
2098 E->PackLoc = readSourceLocation();
2099 E->RParenLoc = readSourceLocation();
2100 E->Pack = Record.readDeclAs<
NamedDecl>();
2102 assert(E->Length == NumPartialArgs);
2104 *E = I + NumPartialArgs;
2108 E->Length = Record.readInt();
2112 void ASTStmtReader::VisitSubstNonTypeTemplateParmExpr(
2115 E->ParamAndRef.setPointer(readDeclAs<NonTypeTemplateParmDecl>());
2116 E->ParamAndRef.setInt(Record.readInt());
2118 E->Replacement = Record.readSubExpr();
2121 void ASTStmtReader::VisitSubstNonTypeTemplateParmPackExpr(
2124 E->Param = readDeclAs<NonTypeTemplateParmDecl>();
2131 E->NameLoc = readSourceLocation();
2136 E->NumParameters = Record.readInt();
2137 E->ParamPack = readDeclAs<ParmVarDecl>();
2138 E->NameLoc = readSourceLocation();
2139 auto **Parms = E->getTrailingObjects<
VarDecl *>();
2140 for (
unsigned i = 0, n = E->NumParameters; i != n; ++i)
2141 Parms[i] = readDeclAs<VarDecl>();
2146 bool HasMaterialzedDecl = Record.readInt();
2147 if (HasMaterialzedDecl)
2148 E->State = cast<LifetimeExtendedTemporaryDecl>(Record.readDecl());
2150 E->State = Record.readSubExpr();
2153 void ASTStmtReader::VisitCXXFoldExpr(
CXXFoldExpr *E) {
2155 E->LParenLoc = readSourceLocation();
2156 E->EllipsisLoc = readSourceLocation();
2157 E->RParenLoc = readSourceLocation();
2158 E->NumExpansions = Record.readInt();
2159 E->SubExprs[0] = Record.readSubExpr();
2160 E->SubExprs[1] = Record.readSubExpr();
2161 E->SubExprs[2] = Record.readSubExpr();
2167 E->SourceExpr = Record.readSubExpr();
2172 void ASTStmtReader::VisitTypoExpr(
TypoExpr *E) {
2173 llvm_unreachable(
"Cannot read TypoExpr nodes");
2176 void ASTStmtReader::VisitRecoveryExpr(
RecoveryExpr *E) {
2178 unsigned NumArgs = Record.readInt();
2179 E->BeginLoc = readSourceLocation();
2180 E->EndLoc = readSourceLocation();
2181 assert((NumArgs + 0LL ==
2186 Child = Record.readSubStmt();
2194 E->IsArrow = (Record.readInt() != 0);
2195 E->BaseExpr = Record.readSubExpr();
2196 E->QualifierLoc = Record.readNestedNameSpecifierLoc();
2197 E->MemberLoc = readSourceLocation();
2198 E->TheDecl = readDeclAs<MSPropertyDecl>();
2203 E->setBase(Record.readSubExpr());
2204 E->setIdx(Record.readSubExpr());
2211 E->Guid = readDeclAs<MSGuidDecl>();
2213 E->Operand = readTypeSourceInfo();
2215 E->Operand = Record.readSubExpr();
2218 void ASTStmtReader::VisitSEHLeaveStmt(
SEHLeaveStmt *S) {
2220 S->setLeaveLoc(readSourceLocation());
2225 S->Loc = readSourceLocation();
2226 S->Children[SEHExceptStmt::FILTER_EXPR] = Record.readSubStmt();
2227 S->Children[SEHExceptStmt::BLOCK] = Record.readSubStmt();
2232 S->Loc = readSourceLocation();
2233 S->Block = Record.readSubStmt();
2236 void ASTStmtReader::VisitSEHTryStmt(
SEHTryStmt *S) {
2238 S->IsCXXTry = Record.readInt();
2239 S->TryLoc = readSourceLocation();
2240 S->Children[SEHTryStmt::TRY] = Record.readSubStmt();
2241 S->Children[SEHTryStmt::HANDLER] = Record.readSubStmt();
2250 E->
setPreArg(CUDAKernelCallExpr::CONFIG, Record.readSubExpr());
2256 void ASTStmtReader::VisitAsTypeExpr(
AsTypeExpr *E) {
2258 E->BuiltinLoc = readSourceLocation();
2259 E->RParenLoc = readSourceLocation();
2260 E->SrcExpr = Record.readSubExpr();
2269 for (
Stmt *&SubStmt : S->SubStmts)
2270 SubStmt = Record.readSubStmt();
2274 Record.readOMPChildren(E->
Data);
2283 VisitOMPExecutableDirective(D);
2287 VisitOMPLoopBasedDirective(D);
2294 VisitOMPExecutableDirective(D);
2299 VisitOMPExecutableDirective(D);
2300 D->setHasCancel(Record.readBool());
2304 VisitOMPLoopDirective(D);
2307 void ASTStmtReader::VisitOMPLoopTransformationDirective(
2309 VisitOMPLoopBasedDirective(D);
2314 VisitOMPLoopTransformationDirective(D);
2318 VisitOMPLoopTransformationDirective(D);
2322 VisitOMPLoopDirective(D);
2323 D->setHasCancel(Record.readBool());
2327 VisitOMPLoopDirective(D);
2332 VisitOMPExecutableDirective(D);
2333 D->setHasCancel(Record.readBool());
2338 VisitOMPExecutableDirective(D);
2344 VisitOMPExecutableDirective(D);
2349 VisitOMPExecutableDirective(D);
2354 VisitOMPExecutableDirective(D);
2355 D->DirName = Record.readDeclarationNameInfo();
2359 VisitOMPLoopDirective(D);
2360 D->setHasCancel(Record.readBool());
2363 void ASTStmtReader::VisitOMPParallelForSimdDirective(
2365 VisitOMPLoopDirective(D);
2368 void ASTStmtReader::VisitOMPParallelMasterDirective(
2371 VisitOMPExecutableDirective(D);
2374 void ASTStmtReader::VisitOMPParallelSectionsDirective(
2377 VisitOMPExecutableDirective(D);
2378 D->setHasCancel(Record.readBool());
2383 VisitOMPExecutableDirective(D);
2384 D->setHasCancel(Record.readBool());
2389 VisitOMPExecutableDirective(D);
2394 VisitOMPExecutableDirective(D);
2401 VisitOMPExecutableDirective(D);
2406 VisitOMPExecutableDirective(D);
2411 VisitOMPExecutableDirective(D);
2416 VisitOMPExecutableDirective(D);
2421 VisitOMPExecutableDirective(D);
2426 VisitOMPExecutableDirective(D);
2431 VisitOMPExecutableDirective(D);
2432 D->Flags.IsXLHSInRHSPart = Record.readBool() ? 1 : 0;
2433 D->Flags.IsPostfixUpdate = Record.readBool() ? 1 : 0;
2438 VisitOMPExecutableDirective(D);
2443 VisitOMPExecutableDirective(D);
2446 void ASTStmtReader::VisitOMPTargetEnterDataDirective(
2449 VisitOMPExecutableDirective(D);
2452 void ASTStmtReader::VisitOMPTargetExitDataDirective(
2455 VisitOMPExecutableDirective(D);
2458 void ASTStmtReader::VisitOMPTargetParallelDirective(
2461 VisitOMPExecutableDirective(D);
2462 D->setHasCancel(Record.readBool());
2465 void ASTStmtReader::VisitOMPTargetParallelForDirective(
2467 VisitOMPLoopDirective(D);
2468 D->setHasCancel(Record.readBool());
2473 VisitOMPExecutableDirective(D);
2476 void ASTStmtReader::VisitOMPCancellationPointDirective(
2479 VisitOMPExecutableDirective(D);
2485 VisitOMPExecutableDirective(D);
2490 VisitOMPLoopDirective(D);
2491 D->setHasCancel(Record.readBool());
2495 VisitOMPLoopDirective(D);
2498 void ASTStmtReader::VisitOMPMasterTaskLoopDirective(
2500 VisitOMPLoopDirective(D);
2501 D->setHasCancel(Record.readBool());
2504 void ASTStmtReader::VisitOMPMasterTaskLoopSimdDirective(
2506 VisitOMPLoopDirective(D);
2509 void ASTStmtReader::VisitOMPParallelMasterTaskLoopDirective(
2511 VisitOMPLoopDirective(D);
2512 D->setHasCancel(Record.readBool());
2515 void ASTStmtReader::VisitOMPParallelMasterTaskLoopSimdDirective(
2517 VisitOMPLoopDirective(D);
2521 VisitOMPLoopDirective(D);
2526 VisitOMPExecutableDirective(D);
2529 void ASTStmtReader::VisitOMPDistributeParallelForDirective(
2531 VisitOMPLoopDirective(D);
2532 D->setHasCancel(Record.readBool());
2535 void ASTStmtReader::VisitOMPDistributeParallelForSimdDirective(
2537 VisitOMPLoopDirective(D);
2540 void ASTStmtReader::VisitOMPDistributeSimdDirective(
2542 VisitOMPLoopDirective(D);
2545 void ASTStmtReader::VisitOMPTargetParallelForSimdDirective(
2547 VisitOMPLoopDirective(D);
2551 VisitOMPLoopDirective(D);
2554 void ASTStmtReader::VisitOMPTeamsDistributeDirective(
2556 VisitOMPLoopDirective(D);
2559 void ASTStmtReader::VisitOMPTeamsDistributeSimdDirective(
2561 VisitOMPLoopDirective(D);
2564 void ASTStmtReader::VisitOMPTeamsDistributeParallelForSimdDirective(
2566 VisitOMPLoopDirective(D);
2569 void ASTStmtReader::VisitOMPTeamsDistributeParallelForDirective(
2571 VisitOMPLoopDirective(D);
2572 D->setHasCancel(Record.readBool());
2577 VisitOMPExecutableDirective(D);
2580 void ASTStmtReader::VisitOMPTargetTeamsDistributeDirective(
2582 VisitOMPLoopDirective(D);
2585 void ASTStmtReader::VisitOMPTargetTeamsDistributeParallelForDirective(
2587 VisitOMPLoopDirective(D);
2588 D->setHasCancel(Record.readBool());
2591 void ASTStmtReader::VisitOMPTargetTeamsDistributeParallelForSimdDirective(
2593 VisitOMPLoopDirective(D);
2596 void ASTStmtReader::VisitOMPTargetTeamsDistributeSimdDirective(
2598 VisitOMPLoopDirective(D);
2603 VisitOMPExecutableDirective(D);
2608 VisitOMPExecutableDirective(D);
2609 D->setTargetCallLoc(Record.readSourceLocation());
2614 VisitOMPExecutableDirective(D);
2618 VisitOMPLoopDirective(D);
2621 void ASTStmtReader::VisitOMPTeamsGenericLoopDirective(
2623 VisitOMPLoopDirective(D);
2626 void ASTStmtReader::VisitOMPTargetTeamsGenericLoopDirective(
2628 VisitOMPLoopDirective(D);
2631 void ASTStmtReader::VisitOMPParallelGenericLoopDirective(
2633 VisitOMPLoopDirective(D);
2636 void ASTStmtReader::VisitOMPTargetParallelGenericLoopDirective(
2638 VisitOMPLoopDirective(D);
2646 switch (ReadingKind) {
2648 llvm_unreachable(
"should not call this when not reading anything");
2651 return ReadStmtFromStream(F);
2653 return ReadSubStmt();
2656 llvm_unreachable(
"ReadingKind not set ?");
2660 return cast_or_null<Expr>(ReadStmt(F));
2664 return cast_or_null<Expr>(ReadSubStmt());
2675 ReadingKindTracker ReadingKind(Read_Stmt, *
this);
2680 llvm::DenseMap<uint64_t, Stmt *> StmtEntries;
2683 unsigned PrevNumStmts = StmtStack.size();
2692 Cursor.advanceSkippingSubblocks();
2697 llvm::BitstreamEntry Entry = MaybeEntry.get();
2699 switch (Entry.Kind) {
2700 case llvm::BitstreamEntry::SubBlock:
2702 Error(
"malformed block record in AST file");
2704 case llvm::BitstreamEntry::EndBlock:
2706 case llvm::BitstreamEntry::Record:
2713 bool Finished =
false;
2714 bool IsStmtReference =
false;
2716 if (!MaybeStmtCode) {
2720 switch ((
StmtCode)MaybeStmtCode.get()) {
2726 IsStmtReference =
true;
2727 assert(StmtEntries.find(Record[0]) != StmtEntries.end() &&
2728 "No stmt was recorded for this offset reference!");
2729 S = StmtEntries[Record.readInt()];
2787 S =
new (Context)
DoStmt(Empty);
2791 S =
new (Context)
ForStmt(Empty);
3107 llvm_unreachable(
"mismatching AST file");
3221 CollapsedNum, Empty);
3282 CollapsedNum, Empty);
3290 CollapsedNum, Empty);
3346 !HasAssociatedStmt, Empty);
3384 CollapsedNum, Empty);
3419 CollapsedNum, Empty);
3427 CollapsedNum, Empty);
3435 CollapsedNum, Empty);
3443 CollapsedNum, Empty);
3451 Context, NumClauses, CollapsedNum, Empty);
3467 CollapsedNum, Empty);
3484 CollapsedNum, Empty);
3492 CollapsedNum, Empty);
3508 CollapsedNum, Empty);
3516 CollapsedNum, Empty);
3524 Context, NumClauses, CollapsedNum, Empty);
3532 Context, NumClauses, CollapsedNum, Empty);
3545 CollapsedNum, Empty);
3553 Context, NumClauses, CollapsedNum, Empty);
3561 Context, NumClauses, CollapsedNum, Empty);
3569 Context, NumClauses, CollapsedNum, Empty);
3592 CollapsedNum, Empty);
3600 CollapsedNum, Empty);
3608 CollapsedNum, Empty);
3616 CollapsedNum, Empty);
3624 Context, NumClauses, CollapsedNum, Empty);
3947 ++NumStatementsRead;
3949 if (S && !IsStmtReference) {
3951 StmtEntries[
Cursor.GetCurrentBitNo()] = S;
3954 assert(Record.getIdx() == Record.size() &&
3955 "Invalid deserialization of statement");
3956 StmtStack.push_back(S);
3959 assert(StmtStack.size() > PrevNumStmts &&
"Read too many sub-stmts!");
3960 assert(StmtStack.size() == PrevNumStmts + 1 &&
"Extra expressions on stack!");
3961 return StmtStack.pop_back_val();