1 //===- ASTReaderStmt.cpp - Stmt/Expr Deserialization ----------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // Statement/expression deserialization. This implements the
10 // ASTReader::ReadStmt method.
12 //===----------------------------------------------------------------------===//
14 #include "clang/AST/ASTConcept.h"
15 #include "clang/AST/ASTContext.h"
16 #include "clang/AST/AttrIterator.h"
17 #include "clang/AST/Decl.h"
18 #include "clang/AST/DeclAccessPair.h"
19 #include "clang/AST/DeclCXX.h"
20 #include "clang/AST/DeclGroup.h"
21 #include "clang/AST/DeclObjC.h"
22 #include "clang/AST/DeclTemplate.h"
23 #include "clang/AST/DeclarationName.h"
24 #include "clang/AST/DependenceFlags.h"
25 #include "clang/AST/Expr.h"
26 #include "clang/AST/ExprCXX.h"
27 #include "clang/AST/ExprObjC.h"
28 #include "clang/AST/ExprOpenMP.h"
29 #include "clang/AST/NestedNameSpecifier.h"
30 #include "clang/AST/OpenMPClause.h"
31 #include "clang/AST/OperationKinds.h"
32 #include "clang/AST/Stmt.h"
33 #include "clang/AST/StmtCXX.h"
34 #include "clang/AST/StmtObjC.h"
35 #include "clang/AST/StmtOpenMP.h"
36 #include "clang/AST/StmtVisitor.h"
37 #include "clang/AST/TemplateBase.h"
38 #include "clang/AST/Type.h"
39 #include "clang/AST/UnresolvedSet.h"
40 #include "clang/Basic/CapturedStmt.h"
41 #include "clang/Basic/ExpressionTraits.h"
42 #include "clang/Basic/LLVM.h"
43 #include "clang/Basic/Lambda.h"
44 #include "clang/Basic/LangOptions.h"
45 #include "clang/Basic/OpenMPKinds.h"
46 #include "clang/Basic/OperatorKinds.h"
47 #include "clang/Basic/SourceLocation.h"
48 #include "clang/Basic/Specifiers.h"
49 #include "clang/Basic/TypeTraits.h"
50 #include "clang/Lex/Token.h"
51 #include "clang/Serialization/ASTBitCodes.h"
52 #include "clang/Serialization/ASTRecordReader.h"
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"
67 using namespace clang
;
68 using namespace serialization
;
72 class ASTStmtReader
: public StmtVisitor
<ASTStmtReader
> {
73 ASTRecordReader
&Record
;
74 llvm::BitstreamCursor
&DeclsCursor
;
76 SourceLocation
readSourceLocation() {
77 return Record
.readSourceLocation();
80 SourceRange
readSourceRange() {
81 return Record
.readSourceRange();
84 std::string
readString() {
85 return Record
.readString();
88 TypeSourceInfo
*readTypeSourceInfo() {
89 return Record
.readTypeSourceInfo();
93 return Record
.readDecl();
98 return Record
.readDeclAs
<T
>();
102 ASTStmtReader(ASTRecordReader
&Record
, llvm::BitstreamCursor
&Cursor
)
103 : Record(Record
), DeclsCursor(Cursor
) {}
105 /// The number of record fields required for the Stmt class
107 static const unsigned NumStmtFields
= 0;
109 /// The number of record fields required for the Expr class
111 static const unsigned NumExprFields
= NumStmtFields
+ 4;
113 /// Read and initialize a ExplicitTemplateArgumentList structure.
114 void ReadTemplateKWAndArgsInfo(ASTTemplateKWAndArgsInfo
&Args
,
115 TemplateArgumentLoc
*ArgsLocArray
,
116 unsigned NumTemplateArgs
);
118 void VisitStmt(Stmt
*S
);
119 #define STMT(Type, Base) \
120 void Visit##Type(Type *);
121 #include "clang/AST/StmtNodes.inc"
126 void ASTStmtReader::ReadTemplateKWAndArgsInfo(ASTTemplateKWAndArgsInfo
&Args
,
127 TemplateArgumentLoc
*ArgsLocArray
,
128 unsigned NumTemplateArgs
) {
129 SourceLocation TemplateKWLoc
= readSourceLocation();
130 TemplateArgumentListInfo ArgInfo
;
131 ArgInfo
.setLAngleLoc(readSourceLocation());
132 ArgInfo
.setRAngleLoc(readSourceLocation());
133 for (unsigned i
= 0; i
!= NumTemplateArgs
; ++i
)
134 ArgInfo
.addArgument(Record
.readTemplateArgumentLoc());
135 Args
.initializeFrom(TemplateKWLoc
, ArgInfo
, ArgsLocArray
);
138 void ASTStmtReader::VisitStmt(Stmt
*S
) {
139 assert(Record
.getIdx() == NumStmtFields
&& "Incorrect statement field count");
142 void ASTStmtReader::VisitNullStmt(NullStmt
*S
) {
144 S
->setSemiLoc(readSourceLocation());
145 S
->NullStmtBits
.HasLeadingEmptyMacro
= Record
.readInt();
148 void ASTStmtReader::VisitCompoundStmt(CompoundStmt
*S
) {
150 SmallVector
<Stmt
*, 16> Stmts
;
151 unsigned NumStmts
= Record
.readInt();
152 unsigned HasFPFeatures
= Record
.readInt();
153 assert(S
->hasStoredFPFeatures() == HasFPFeatures
);
155 Stmts
.push_back(Record
.readSubStmt());
158 S
->setStoredFPFeatures(
159 FPOptionsOverride::getFromOpaqueInt(Record
.readInt()));
160 S
->LBraceLoc
= readSourceLocation();
161 S
->RBraceLoc
= readSourceLocation();
164 void ASTStmtReader::VisitSwitchCase(SwitchCase
*S
) {
166 Record
.recordSwitchCaseID(S
, Record
.readInt());
167 S
->setKeywordLoc(readSourceLocation());
168 S
->setColonLoc(readSourceLocation());
171 void ASTStmtReader::VisitCaseStmt(CaseStmt
*S
) {
173 bool CaseStmtIsGNURange
= Record
.readInt();
174 S
->setLHS(Record
.readSubExpr());
175 S
->setSubStmt(Record
.readSubStmt());
176 if (CaseStmtIsGNURange
) {
177 S
->setRHS(Record
.readSubExpr());
178 S
->setEllipsisLoc(readSourceLocation());
182 void ASTStmtReader::VisitDefaultStmt(DefaultStmt
*S
) {
184 S
->setSubStmt(Record
.readSubStmt());
187 void ASTStmtReader::VisitLabelStmt(LabelStmt
*S
) {
189 bool IsSideEntry
= Record
.readInt();
190 auto *LD
= readDeclAs
<LabelDecl
>();
193 S
->setSubStmt(Record
.readSubStmt());
194 S
->setIdentLoc(readSourceLocation());
195 S
->setSideEntry(IsSideEntry
);
198 void ASTStmtReader::VisitAttributedStmt(AttributedStmt
*S
) {
200 // NumAttrs in AttributedStmt is set when creating an empty
201 // AttributedStmt in AttributedStmt::CreateEmpty, since it is needed
202 // to allocate the right amount of space for the trailing Attr *.
203 uint64_t NumAttrs
= Record
.readInt();
205 Record
.readAttributes(Attrs
);
207 assert(NumAttrs
== S
->AttributedStmtBits
.NumAttrs
);
208 assert(NumAttrs
== Attrs
.size());
209 std::copy(Attrs
.begin(), Attrs
.end(), S
->getAttrArrayPtr());
210 S
->SubStmt
= Record
.readSubStmt();
211 S
->AttributedStmtBits
.AttrLoc
= readSourceLocation();
214 void ASTStmtReader::VisitIfStmt(IfStmt
*S
) {
217 bool HasElse
= Record
.readInt();
218 bool HasVar
= Record
.readInt();
219 bool HasInit
= Record
.readInt();
221 S
->setStatementKind(static_cast<IfStatementKind
>(Record
.readInt()));
222 S
->setCond(Record
.readSubExpr());
223 S
->setThen(Record
.readSubStmt());
225 S
->setElse(Record
.readSubStmt());
227 S
->setConditionVariableDeclStmt(cast
<DeclStmt
>(Record
.readSubStmt()));
229 S
->setInit(Record
.readSubStmt());
231 S
->setIfLoc(readSourceLocation());
232 S
->setLParenLoc(readSourceLocation());
233 S
->setRParenLoc(readSourceLocation());
235 S
->setElseLoc(readSourceLocation());
238 void ASTStmtReader::VisitSwitchStmt(SwitchStmt
*S
) {
241 bool HasInit
= Record
.readInt();
242 bool HasVar
= Record
.readInt();
243 bool AllEnumCasesCovered
= Record
.readInt();
244 if (AllEnumCasesCovered
)
245 S
->setAllEnumCasesCovered();
247 S
->setCond(Record
.readSubExpr());
248 S
->setBody(Record
.readSubStmt());
250 S
->setInit(Record
.readSubStmt());
252 S
->setConditionVariableDeclStmt(cast
<DeclStmt
>(Record
.readSubStmt()));
254 S
->setSwitchLoc(readSourceLocation());
255 S
->setLParenLoc(readSourceLocation());
256 S
->setRParenLoc(readSourceLocation());
258 SwitchCase
*PrevSC
= nullptr;
259 for (auto E
= Record
.size(); Record
.getIdx() != E
; ) {
260 SwitchCase
*SC
= Record
.getSwitchCaseWithID(Record
.readInt());
262 PrevSC
->setNextSwitchCase(SC
);
264 S
->setSwitchCaseList(SC
);
270 void ASTStmtReader::VisitWhileStmt(WhileStmt
*S
) {
273 bool HasVar
= Record
.readInt();
275 S
->setCond(Record
.readSubExpr());
276 S
->setBody(Record
.readSubStmt());
278 S
->setConditionVariableDeclStmt(cast
<DeclStmt
>(Record
.readSubStmt()));
280 S
->setWhileLoc(readSourceLocation());
281 S
->setLParenLoc(readSourceLocation());
282 S
->setRParenLoc(readSourceLocation());
285 void ASTStmtReader::VisitDoStmt(DoStmt
*S
) {
287 S
->setCond(Record
.readSubExpr());
288 S
->setBody(Record
.readSubStmt());
289 S
->setDoLoc(readSourceLocation());
290 S
->setWhileLoc(readSourceLocation());
291 S
->setRParenLoc(readSourceLocation());
294 void ASTStmtReader::VisitForStmt(ForStmt
*S
) {
296 S
->setInit(Record
.readSubStmt());
297 S
->setCond(Record
.readSubExpr());
298 S
->setConditionVariableDeclStmt(cast_or_null
<DeclStmt
>(Record
.readSubStmt()));
299 S
->setInc(Record
.readSubExpr());
300 S
->setBody(Record
.readSubStmt());
301 S
->setForLoc(readSourceLocation());
302 S
->setLParenLoc(readSourceLocation());
303 S
->setRParenLoc(readSourceLocation());
306 void ASTStmtReader::VisitGotoStmt(GotoStmt
*S
) {
308 S
->setLabel(readDeclAs
<LabelDecl
>());
309 S
->setGotoLoc(readSourceLocation());
310 S
->setLabelLoc(readSourceLocation());
313 void ASTStmtReader::VisitIndirectGotoStmt(IndirectGotoStmt
*S
) {
315 S
->setGotoLoc(readSourceLocation());
316 S
->setStarLoc(readSourceLocation());
317 S
->setTarget(Record
.readSubExpr());
320 void ASTStmtReader::VisitContinueStmt(ContinueStmt
*S
) {
322 S
->setContinueLoc(readSourceLocation());
325 void ASTStmtReader::VisitBreakStmt(BreakStmt
*S
) {
327 S
->setBreakLoc(readSourceLocation());
330 void ASTStmtReader::VisitReturnStmt(ReturnStmt
*S
) {
333 bool HasNRVOCandidate
= Record
.readInt();
335 S
->setRetValue(Record
.readSubExpr());
336 if (HasNRVOCandidate
)
337 S
->setNRVOCandidate(readDeclAs
<VarDecl
>());
339 S
->setReturnLoc(readSourceLocation());
342 void ASTStmtReader::VisitDeclStmt(DeclStmt
*S
) {
344 S
->setStartLoc(readSourceLocation());
345 S
->setEndLoc(readSourceLocation());
347 if (Record
.size() - Record
.getIdx() == 1) {
348 // Single declaration
349 S
->setDeclGroup(DeclGroupRef(readDecl()));
351 SmallVector
<Decl
*, 16> Decls
;
352 int N
= Record
.size() - Record
.getIdx();
354 for (int I
= 0; I
< N
; ++I
)
355 Decls
.push_back(readDecl());
356 S
->setDeclGroup(DeclGroupRef(DeclGroup::Create(Record
.getContext(),
362 void ASTStmtReader::VisitAsmStmt(AsmStmt
*S
) {
364 S
->NumOutputs
= Record
.readInt();
365 S
->NumInputs
= Record
.readInt();
366 S
->NumClobbers
= Record
.readInt();
367 S
->setAsmLoc(readSourceLocation());
368 S
->setVolatile(Record
.readInt());
369 S
->setSimple(Record
.readInt());
372 void ASTStmtReader::VisitGCCAsmStmt(GCCAsmStmt
*S
) {
374 S
->NumLabels
= Record
.readInt();
375 S
->setRParenLoc(readSourceLocation());
376 S
->setAsmString(cast_or_null
<StringLiteral
>(Record
.readSubStmt()));
378 unsigned NumOutputs
= S
->getNumOutputs();
379 unsigned NumInputs
= S
->getNumInputs();
380 unsigned NumClobbers
= S
->getNumClobbers();
381 unsigned NumLabels
= S
->getNumLabels();
383 // Outputs and inputs
384 SmallVector
<IdentifierInfo
*, 16> Names
;
385 SmallVector
<StringLiteral
*, 16> Constraints
;
386 SmallVector
<Stmt
*, 16> Exprs
;
387 for (unsigned I
= 0, N
= NumOutputs
+ NumInputs
; I
!= N
; ++I
) {
388 Names
.push_back(Record
.readIdentifier());
389 Constraints
.push_back(cast_or_null
<StringLiteral
>(Record
.readSubStmt()));
390 Exprs
.push_back(Record
.readSubStmt());
394 SmallVector
<StringLiteral
*, 16> Clobbers
;
395 for (unsigned I
= 0; I
!= NumClobbers
; ++I
)
396 Clobbers
.push_back(cast_or_null
<StringLiteral
>(Record
.readSubStmt()));
399 for (unsigned I
= 0, N
= NumLabels
; I
!= N
; ++I
) {
400 Names
.push_back(Record
.readIdentifier());
401 Exprs
.push_back(Record
.readSubStmt());
404 S
->setOutputsAndInputsAndClobbers(Record
.getContext(),
405 Names
.data(), Constraints
.data(),
406 Exprs
.data(), NumOutputs
, NumInputs
,
408 Clobbers
.data(), NumClobbers
);
411 void ASTStmtReader::VisitMSAsmStmt(MSAsmStmt
*S
) {
413 S
->LBraceLoc
= readSourceLocation();
414 S
->EndLoc
= readSourceLocation();
415 S
->NumAsmToks
= Record
.readInt();
416 std::string AsmStr
= readString();
419 SmallVector
<Token
, 16> AsmToks
;
420 AsmToks
.reserve(S
->NumAsmToks
);
421 for (unsigned i
= 0, e
= S
->NumAsmToks
; i
!= e
; ++i
) {
422 AsmToks
.push_back(Record
.readToken());
425 // The calls to reserve() for the FooData vectors are mandatory to
426 // prevent dead StringRefs in the Foo vectors.
428 // Read the clobbers.
429 SmallVector
<std::string
, 16> ClobbersData
;
430 SmallVector
<StringRef
, 16> Clobbers
;
431 ClobbersData
.reserve(S
->NumClobbers
);
432 Clobbers
.reserve(S
->NumClobbers
);
433 for (unsigned i
= 0, e
= S
->NumClobbers
; i
!= e
; ++i
) {
434 ClobbersData
.push_back(readString());
435 Clobbers
.push_back(ClobbersData
.back());
438 // Read the operands.
439 unsigned NumOperands
= S
->NumOutputs
+ S
->NumInputs
;
440 SmallVector
<Expr
*, 16> Exprs
;
441 SmallVector
<std::string
, 16> ConstraintsData
;
442 SmallVector
<StringRef
, 16> Constraints
;
443 Exprs
.reserve(NumOperands
);
444 ConstraintsData
.reserve(NumOperands
);
445 Constraints
.reserve(NumOperands
);
446 for (unsigned i
= 0; i
!= NumOperands
; ++i
) {
447 Exprs
.push_back(cast
<Expr
>(Record
.readSubStmt()));
448 ConstraintsData
.push_back(readString());
449 Constraints
.push_back(ConstraintsData
.back());
452 S
->initialize(Record
.getContext(), AsmStr
, AsmToks
,
453 Constraints
, Exprs
, Clobbers
);
456 void ASTStmtReader::VisitCoroutineBodyStmt(CoroutineBodyStmt
*S
) {
458 assert(Record
.peekInt() == S
->NumParams
);
460 auto *StoredStmts
= S
->getStoredStmts();
462 i
< CoroutineBodyStmt::SubStmt::FirstParamMove
+ S
->NumParams
; ++i
)
463 StoredStmts
[i
] = Record
.readSubStmt();
466 void ASTStmtReader::VisitCoreturnStmt(CoreturnStmt
*S
) {
468 S
->CoreturnLoc
= Record
.readSourceLocation();
469 for (auto &SubStmt
: S
->SubStmts
)
470 SubStmt
= Record
.readSubStmt();
471 S
->IsImplicit
= Record
.readInt() != 0;
474 void ASTStmtReader::VisitCoawaitExpr(CoawaitExpr
*E
) {
476 E
->KeywordLoc
= readSourceLocation();
477 for (auto &SubExpr
: E
->SubExprs
)
478 SubExpr
= Record
.readSubStmt();
479 E
->OpaqueValue
= cast_or_null
<OpaqueValueExpr
>(Record
.readSubStmt());
480 E
->setIsImplicit(Record
.readInt() != 0);
483 void ASTStmtReader::VisitCoyieldExpr(CoyieldExpr
*E
) {
485 E
->KeywordLoc
= readSourceLocation();
486 for (auto &SubExpr
: E
->SubExprs
)
487 SubExpr
= Record
.readSubStmt();
488 E
->OpaqueValue
= cast_or_null
<OpaqueValueExpr
>(Record
.readSubStmt());
491 void ASTStmtReader::VisitDependentCoawaitExpr(DependentCoawaitExpr
*E
) {
493 E
->KeywordLoc
= readSourceLocation();
494 for (auto &SubExpr
: E
->SubExprs
)
495 SubExpr
= Record
.readSubStmt();
498 void ASTStmtReader::VisitCapturedStmt(CapturedStmt
*S
) {
501 S
->setCapturedDecl(readDeclAs
<CapturedDecl
>());
502 S
->setCapturedRegionKind(static_cast<CapturedRegionKind
>(Record
.readInt()));
503 S
->setCapturedRecordDecl(readDeclAs
<RecordDecl
>());
506 for (CapturedStmt::capture_init_iterator I
= S
->capture_init_begin(),
507 E
= S
->capture_init_end();
509 *I
= Record
.readSubExpr();
512 S
->setCapturedStmt(Record
.readSubStmt());
513 S
->getCapturedDecl()->setBody(S
->getCapturedStmt());
516 for (auto &I
: S
->captures()) {
517 I
.VarAndKind
.setPointer(readDeclAs
<VarDecl
>());
519 static_cast<CapturedStmt::VariableCaptureKind
>(Record
.readInt()));
520 I
.Loc
= readSourceLocation();
524 void ASTStmtReader::VisitExpr(Expr
*E
) {
526 E
->setType(Record
.readType());
527 E
->setDependence(static_cast<ExprDependence
>(Record
.readInt()));
528 E
->setValueKind(static_cast<ExprValueKind
>(Record
.readInt()));
529 E
->setObjectKind(static_cast<ExprObjectKind
>(Record
.readInt()));
530 assert(Record
.getIdx() == NumExprFields
&&
531 "Incorrect expression field count");
534 void ASTStmtReader::VisitConstantExpr(ConstantExpr
*E
) {
537 auto StorageKind
= static_cast<ConstantResultStorageKind
>(Record
.readInt());
538 assert(E
->getResultStorageKind() == StorageKind
&& "Wrong ResultKind!");
540 E
->ConstantExprBits
.APValueKind
= Record
.readInt();
541 E
->ConstantExprBits
.IsUnsigned
= Record
.readInt();
542 E
->ConstantExprBits
.BitWidth
= Record
.readInt();
543 E
->ConstantExprBits
.HasCleanup
= false; // Not serialized, see below.
544 E
->ConstantExprBits
.IsImmediateInvocation
= Record
.readInt();
546 switch (StorageKind
) {
547 case ConstantResultStorageKind::None
:
550 case ConstantResultStorageKind::Int64
:
551 E
->Int64Result() = Record
.readInt();
554 case ConstantResultStorageKind::APValue
:
555 E
->APValueResult() = Record
.readAPValue();
556 if (E
->APValueResult().needsCleanup()) {
557 E
->ConstantExprBits
.HasCleanup
= true;
558 Record
.getContext().addDestruction(&E
->APValueResult());
563 E
->setSubExpr(Record
.readSubExpr());
566 void ASTStmtReader::VisitSYCLUniqueStableNameExpr(SYCLUniqueStableNameExpr
*E
) {
569 E
->setLocation(readSourceLocation());
570 E
->setLParenLocation(readSourceLocation());
571 E
->setRParenLocation(readSourceLocation());
573 E
->setTypeSourceInfo(Record
.readTypeSourceInfo());
576 void ASTStmtReader::VisitPredefinedExpr(PredefinedExpr
*E
) {
578 bool HasFunctionName
= Record
.readInt();
579 E
->PredefinedExprBits
.HasFunctionName
= HasFunctionName
;
580 E
->PredefinedExprBits
.Kind
= Record
.readInt();
581 E
->PredefinedExprBits
.IsTransparent
= Record
.readInt();
582 E
->setLocation(readSourceLocation());
584 E
->setFunctionName(cast
<StringLiteral
>(Record
.readSubExpr()));
587 void ASTStmtReader::VisitDeclRefExpr(DeclRefExpr
*E
) {
590 E
->DeclRefExprBits
.HasQualifier
= Record
.readInt();
591 E
->DeclRefExprBits
.HasFoundDecl
= Record
.readInt();
592 E
->DeclRefExprBits
.HasTemplateKWAndArgsInfo
= Record
.readInt();
593 E
->DeclRefExprBits
.HadMultipleCandidates
= Record
.readInt();
594 E
->DeclRefExprBits
.RefersToEnclosingVariableOrCapture
= Record
.readInt();
595 E
->DeclRefExprBits
.NonOdrUseReason
= Record
.readInt();
596 E
->DeclRefExprBits
.IsImmediateEscalating
= Record
.readInt();
597 E
->DeclRefExprBits
.CapturedByCopyInLambdaWithExplicitObjectParameter
= false;
598 unsigned NumTemplateArgs
= 0;
599 if (E
->hasTemplateKWAndArgsInfo())
600 NumTemplateArgs
= Record
.readInt();
602 if (E
->hasQualifier())
603 new (E
->getTrailingObjects
<NestedNameSpecifierLoc
>())
604 NestedNameSpecifierLoc(Record
.readNestedNameSpecifierLoc());
606 if (E
->hasFoundDecl())
607 *E
->getTrailingObjects
<NamedDecl
*>() = readDeclAs
<NamedDecl
>();
609 if (E
->hasTemplateKWAndArgsInfo())
610 ReadTemplateKWAndArgsInfo(
611 *E
->getTrailingObjects
<ASTTemplateKWAndArgsInfo
>(),
612 E
->getTrailingObjects
<TemplateArgumentLoc
>(), NumTemplateArgs
);
614 E
->D
= readDeclAs
<ValueDecl
>();
615 E
->setLocation(readSourceLocation());
616 E
->DNLoc
= Record
.readDeclarationNameLoc(E
->getDecl()->getDeclName());
619 void ASTStmtReader::VisitIntegerLiteral(IntegerLiteral
*E
) {
621 E
->setLocation(readSourceLocation());
622 E
->setValue(Record
.getContext(), Record
.readAPInt());
625 void ASTStmtReader::VisitFixedPointLiteral(FixedPointLiteral
*E
) {
627 E
->setLocation(readSourceLocation());
628 E
->setScale(Record
.readInt());
629 E
->setValue(Record
.getContext(), Record
.readAPInt());
632 void ASTStmtReader::VisitFloatingLiteral(FloatingLiteral
*E
) {
635 static_cast<llvm::APFloatBase::Semantics
>(Record
.readInt()));
636 E
->setExact(Record
.readInt());
637 E
->setValue(Record
.getContext(), Record
.readAPFloat(E
->getSemantics()));
638 E
->setLocation(readSourceLocation());
641 void ASTStmtReader::VisitImaginaryLiteral(ImaginaryLiteral
*E
) {
643 E
->setSubExpr(Record
.readSubExpr());
646 void ASTStmtReader::VisitStringLiteral(StringLiteral
*E
) {
649 // NumConcatenated, Length and CharByteWidth are set by the empty
650 // ctor since they are needed to allocate storage for the trailing objects.
651 unsigned NumConcatenated
= Record
.readInt();
652 unsigned Length
= Record
.readInt();
653 unsigned CharByteWidth
= Record
.readInt();
654 assert((NumConcatenated
== E
->getNumConcatenated()) &&
655 "Wrong number of concatenated tokens!");
656 assert((Length
== E
->getLength()) && "Wrong Length!");
657 assert((CharByteWidth
== E
->getCharByteWidth()) && "Wrong character width!");
658 E
->StringLiteralBits
.Kind
= Record
.readInt();
659 E
->StringLiteralBits
.IsPascal
= Record
.readInt();
661 // The character width is originally computed via mapCharByteWidth.
662 // Check that the deserialized character width is consistant with the result
663 // of calling mapCharByteWidth.
664 assert((CharByteWidth
==
665 StringLiteral::mapCharByteWidth(Record
.getContext().getTargetInfo(),
667 "Wrong character width!");
669 // Deserialize the trailing array of SourceLocation.
670 for (unsigned I
= 0; I
< NumConcatenated
; ++I
)
671 E
->setStrTokenLoc(I
, readSourceLocation());
673 // Deserialize the trailing array of char holding the string data.
674 char *StrData
= E
->getStrDataAsChar();
675 for (unsigned I
= 0; I
< Length
* CharByteWidth
; ++I
)
676 StrData
[I
] = Record
.readInt();
679 void ASTStmtReader::VisitCharacterLiteral(CharacterLiteral
*E
) {
681 E
->setValue(Record
.readInt());
682 E
->setLocation(readSourceLocation());
683 E
->setKind(static_cast<CharacterLiteralKind
>(Record
.readInt()));
686 void ASTStmtReader::VisitParenExpr(ParenExpr
*E
) {
688 E
->setLParen(readSourceLocation());
689 E
->setRParen(readSourceLocation());
690 E
->setSubExpr(Record
.readSubExpr());
693 void ASTStmtReader::VisitParenListExpr(ParenListExpr
*E
) {
695 unsigned NumExprs
= Record
.readInt();
696 assert((NumExprs
== E
->getNumExprs()) && "Wrong NumExprs!");
697 for (unsigned I
= 0; I
!= NumExprs
; ++I
)
698 E
->getTrailingObjects
<Stmt
*>()[I
] = Record
.readSubStmt();
699 E
->LParenLoc
= readSourceLocation();
700 E
->RParenLoc
= readSourceLocation();
703 void ASTStmtReader::VisitUnaryOperator(UnaryOperator
*E
) {
705 bool hasFP_Features
= Record
.readInt();
706 assert(hasFP_Features
== E
->hasStoredFPFeatures());
707 E
->setSubExpr(Record
.readSubExpr());
708 E
->setOpcode((UnaryOperator::Opcode
)Record
.readInt());
709 E
->setOperatorLoc(readSourceLocation());
710 E
->setCanOverflow(Record
.readInt());
712 E
->setStoredFPFeatures(
713 FPOptionsOverride::getFromOpaqueInt(Record
.readInt()));
716 void ASTStmtReader::VisitOffsetOfExpr(OffsetOfExpr
*E
) {
718 assert(E
->getNumComponents() == Record
.peekInt());
720 assert(E
->getNumExpressions() == Record
.peekInt());
722 E
->setOperatorLoc(readSourceLocation());
723 E
->setRParenLoc(readSourceLocation());
724 E
->setTypeSourceInfo(readTypeSourceInfo());
725 for (unsigned I
= 0, N
= E
->getNumComponents(); I
!= N
; ++I
) {
726 auto Kind
= static_cast<OffsetOfNode::Kind
>(Record
.readInt());
727 SourceLocation Start
= readSourceLocation();
728 SourceLocation End
= readSourceLocation();
730 case OffsetOfNode::Array
:
731 E
->setComponent(I
, OffsetOfNode(Start
, Record
.readInt(), End
));
734 case OffsetOfNode::Field
:
736 I
, OffsetOfNode(Start
, readDeclAs
<FieldDecl
>(), End
));
739 case OffsetOfNode::Identifier
:
742 OffsetOfNode(Start
, Record
.readIdentifier(), End
));
745 case OffsetOfNode::Base
: {
746 auto *Base
= new (Record
.getContext()) CXXBaseSpecifier();
747 *Base
= Record
.readCXXBaseSpecifier();
748 E
->setComponent(I
, OffsetOfNode(Base
));
754 for (unsigned I
= 0, N
= E
->getNumExpressions(); I
!= N
; ++I
)
755 E
->setIndexExpr(I
, Record
.readSubExpr());
758 void ASTStmtReader::VisitUnaryExprOrTypeTraitExpr(UnaryExprOrTypeTraitExpr
*E
) {
760 E
->setKind(static_cast<UnaryExprOrTypeTrait
>(Record
.readInt()));
761 if (Record
.peekInt() == 0) {
762 E
->setArgument(Record
.readSubExpr());
765 E
->setArgument(readTypeSourceInfo());
767 E
->setOperatorLoc(readSourceLocation());
768 E
->setRParenLoc(readSourceLocation());
771 static ConstraintSatisfaction
772 readConstraintSatisfaction(ASTRecordReader
&Record
) {
773 ConstraintSatisfaction Satisfaction
;
774 Satisfaction
.IsSatisfied
= Record
.readInt();
775 Satisfaction
.ContainsErrors
= Record
.readInt();
776 if (!Satisfaction
.IsSatisfied
) {
777 unsigned NumDetailRecords
= Record
.readInt();
778 for (unsigned i
= 0; i
!= NumDetailRecords
; ++i
) {
779 Expr
*ConstraintExpr
= Record
.readExpr();
780 if (/* IsDiagnostic */Record
.readInt()) {
781 SourceLocation DiagLocation
= Record
.readSourceLocation();
782 std::string DiagMessage
= Record
.readString();
783 Satisfaction
.Details
.emplace_back(
784 ConstraintExpr
, new (Record
.getContext())
785 ConstraintSatisfaction::SubstitutionDiagnostic
{
786 DiagLocation
, DiagMessage
});
788 Satisfaction
.Details
.emplace_back(ConstraintExpr
, Record
.readExpr());
794 void ASTStmtReader::VisitConceptSpecializationExpr(
795 ConceptSpecializationExpr
*E
) {
797 E
->SpecDecl
= Record
.readDeclAs
<ImplicitConceptSpecializationDecl
>();
798 if (Record
.readBool())
799 E
->ConceptRef
= Record
.readConceptReference();
800 E
->Satisfaction
= E
->isValueDependent() ? nullptr :
801 ASTConstraintSatisfaction::Create(Record
.getContext(),
802 readConstraintSatisfaction(Record
));
805 static concepts::Requirement::SubstitutionDiagnostic
*
806 readSubstitutionDiagnostic(ASTRecordReader
&Record
) {
807 std::string SubstitutedEntity
= Record
.readString();
808 SourceLocation DiagLoc
= Record
.readSourceLocation();
809 std::string DiagMessage
= Record
.readString();
810 return new (Record
.getContext())
811 concepts::Requirement::SubstitutionDiagnostic
{SubstitutedEntity
, DiagLoc
,
815 void ASTStmtReader::VisitRequiresExpr(RequiresExpr
*E
) {
817 unsigned NumLocalParameters
= Record
.readInt();
818 unsigned NumRequirements
= Record
.readInt();
819 E
->RequiresExprBits
.RequiresKWLoc
= Record
.readSourceLocation();
820 E
->RequiresExprBits
.IsSatisfied
= Record
.readInt();
821 E
->Body
= Record
.readDeclAs
<RequiresExprBodyDecl
>();
822 llvm::SmallVector
<ParmVarDecl
*, 4> LocalParameters
;
823 for (unsigned i
= 0; i
< NumLocalParameters
; ++i
)
824 LocalParameters
.push_back(cast
<ParmVarDecl
>(Record
.readDecl()));
825 std::copy(LocalParameters
.begin(), LocalParameters
.end(),
826 E
->getTrailingObjects
<ParmVarDecl
*>());
827 llvm::SmallVector
<concepts::Requirement
*, 4> Requirements
;
828 for (unsigned i
= 0; i
< NumRequirements
; ++i
) {
830 static_cast<concepts::Requirement::RequirementKind
>(Record
.readInt());
831 concepts::Requirement
*R
= nullptr;
833 case concepts::Requirement::RK_Type
: {
835 static_cast<concepts::TypeRequirement::SatisfactionStatus
>(
837 if (Status
== concepts::TypeRequirement::SS_SubstitutionFailure
)
838 R
= new (Record
.getContext())
839 concepts::TypeRequirement(readSubstitutionDiagnostic(Record
));
841 R
= new (Record
.getContext())
842 concepts::TypeRequirement(Record
.readTypeSourceInfo());
844 case concepts::Requirement::RK_Simple
:
845 case concepts::Requirement::RK_Compound
: {
847 static_cast<concepts::ExprRequirement::SatisfactionStatus
>(
849 llvm::PointerUnion
<concepts::Requirement::SubstitutionDiagnostic
*,
851 if (Status
== concepts::ExprRequirement::SS_ExprSubstitutionFailure
) {
852 E
= readSubstitutionDiagnostic(Record
);
854 E
= Record
.readExpr();
856 std::optional
<concepts::ExprRequirement::ReturnTypeRequirement
> Req
;
857 ConceptSpecializationExpr
*SubstitutedConstraintExpr
= nullptr;
858 SourceLocation NoexceptLoc
;
859 if (RK
== concepts::Requirement::RK_Simple
) {
862 NoexceptLoc
= Record
.readSourceLocation();
863 switch (/* returnTypeRequirementKind */Record
.readInt()) {
865 // No return type requirement.
870 TemplateParameterList
*TPL
= Record
.readTemplateParameterList();
872 concepts::ExprRequirement::SS_ConstraintsNotSatisfied
)
873 SubstitutedConstraintExpr
=
874 cast
<ConceptSpecializationExpr
>(Record
.readExpr());
878 // Substitution failure
879 Req
.emplace(readSubstitutionDiagnostic(Record
));
883 if (Expr
*Ex
= E
.dyn_cast
<Expr
*>())
884 R
= new (Record
.getContext()) concepts::ExprRequirement(
885 Ex
, RK
== concepts::Requirement::RK_Simple
, NoexceptLoc
,
886 std::move(*Req
), Status
, SubstitutedConstraintExpr
);
888 R
= new (Record
.getContext()) concepts::ExprRequirement(
889 E
.get
<concepts::Requirement::SubstitutionDiagnostic
*>(),
890 RK
== concepts::Requirement::RK_Simple
, NoexceptLoc
,
893 case concepts::Requirement::RK_Nested
: {
894 bool HasInvalidConstraint
= Record
.readInt();
895 if (HasInvalidConstraint
) {
896 std::string InvalidConstraint
= Record
.readString();
897 char *InvalidConstraintBuf
=
898 new (Record
.getContext()) char[InvalidConstraint
.size()];
899 std::copy(InvalidConstraint
.begin(), InvalidConstraint
.end(),
900 InvalidConstraintBuf
);
901 R
= new (Record
.getContext()) concepts::NestedRequirement(
903 StringRef(InvalidConstraintBuf
, InvalidConstraint
.size()),
904 readConstraintSatisfaction(Record
));
907 Expr
*E
= Record
.readExpr();
908 if (E
->isInstantiationDependent())
909 R
= new (Record
.getContext()) concepts::NestedRequirement(E
);
911 R
= new (Record
.getContext())
912 concepts::NestedRequirement(Record
.getContext(), E
,
913 readConstraintSatisfaction(Record
));
918 Requirements
.push_back(R
);
920 std::copy(Requirements
.begin(), Requirements
.end(),
921 E
->getTrailingObjects
<concepts::Requirement
*>());
922 E
->LParenLoc
= Record
.readSourceLocation();
923 E
->RParenLoc
= Record
.readSourceLocation();
924 E
->RBraceLoc
= Record
.readSourceLocation();
927 void ASTStmtReader::VisitArraySubscriptExpr(ArraySubscriptExpr
*E
) {
929 E
->setLHS(Record
.readSubExpr());
930 E
->setRHS(Record
.readSubExpr());
931 E
->setRBracketLoc(readSourceLocation());
934 void ASTStmtReader::VisitMatrixSubscriptExpr(MatrixSubscriptExpr
*E
) {
936 E
->setBase(Record
.readSubExpr());
937 E
->setRowIdx(Record
.readSubExpr());
938 E
->setColumnIdx(Record
.readSubExpr());
939 E
->setRBracketLoc(readSourceLocation());
942 void ASTStmtReader::VisitOMPArraySectionExpr(OMPArraySectionExpr
*E
) {
944 E
->setBase(Record
.readSubExpr());
945 E
->setLowerBound(Record
.readSubExpr());
946 E
->setLength(Record
.readSubExpr());
947 E
->setStride(Record
.readSubExpr());
948 E
->setColonLocFirst(readSourceLocation());
949 E
->setColonLocSecond(readSourceLocation());
950 E
->setRBracketLoc(readSourceLocation());
953 void ASTStmtReader::VisitOMPArrayShapingExpr(OMPArrayShapingExpr
*E
) {
955 unsigned NumDims
= Record
.readInt();
956 E
->setBase(Record
.readSubExpr());
957 SmallVector
<Expr
*, 4> Dims(NumDims
);
958 for (unsigned I
= 0; I
< NumDims
; ++I
)
959 Dims
[I
] = Record
.readSubExpr();
960 E
->setDimensions(Dims
);
961 SmallVector
<SourceRange
, 4> SRs(NumDims
);
962 for (unsigned I
= 0; I
< NumDims
; ++I
)
963 SRs
[I
] = readSourceRange();
964 E
->setBracketsRanges(SRs
);
965 E
->setLParenLoc(readSourceLocation());
966 E
->setRParenLoc(readSourceLocation());
969 void ASTStmtReader::VisitOMPIteratorExpr(OMPIteratorExpr
*E
) {
971 unsigned NumIters
= Record
.readInt();
972 E
->setIteratorKwLoc(readSourceLocation());
973 E
->setLParenLoc(readSourceLocation());
974 E
->setRParenLoc(readSourceLocation());
975 for (unsigned I
= 0; I
< NumIters
; ++I
) {
976 E
->setIteratorDeclaration(I
, Record
.readDeclRef());
977 E
->setAssignmentLoc(I
, readSourceLocation());
978 Expr
*Begin
= Record
.readSubExpr();
979 Expr
*End
= Record
.readSubExpr();
980 Expr
*Step
= Record
.readSubExpr();
981 SourceLocation ColonLoc
= readSourceLocation();
982 SourceLocation SecColonLoc
;
984 SecColonLoc
= readSourceLocation();
985 E
->setIteratorRange(I
, Begin
, ColonLoc
, End
, SecColonLoc
, Step
);
986 // Deserialize helpers
987 OMPIteratorHelperData HD
;
988 HD
.CounterVD
= cast_or_null
<VarDecl
>(Record
.readDeclRef());
989 HD
.Upper
= Record
.readSubExpr();
990 HD
.Update
= Record
.readSubExpr();
991 HD
.CounterUpdate
= Record
.readSubExpr();
996 void ASTStmtReader::VisitCallExpr(CallExpr
*E
) {
998 unsigned NumArgs
= Record
.readInt();
999 bool HasFPFeatures
= Record
.readInt();
1000 assert((NumArgs
== E
->getNumArgs()) && "Wrong NumArgs!");
1001 E
->setRParenLoc(readSourceLocation());
1002 E
->setCallee(Record
.readSubExpr());
1003 for (unsigned I
= 0; I
!= NumArgs
; ++I
)
1004 E
->setArg(I
, Record
.readSubExpr());
1005 E
->setADLCallKind(static_cast<CallExpr::ADLCallKind
>(Record
.readInt()));
1007 E
->setStoredFPFeatures(
1008 FPOptionsOverride::getFromOpaqueInt(Record
.readInt()));
1011 void ASTStmtReader::VisitCXXMemberCallExpr(CXXMemberCallExpr
*E
) {
1015 void ASTStmtReader::VisitMemberExpr(MemberExpr
*E
) {
1018 bool HasQualifier
= Record
.readInt();
1019 bool HasFoundDecl
= Record
.readInt();
1020 bool HasTemplateInfo
= Record
.readInt();
1021 unsigned NumTemplateArgs
= Record
.readInt();
1023 E
->Base
= Record
.readSubExpr();
1024 E
->MemberDecl
= Record
.readDeclAs
<ValueDecl
>();
1025 E
->MemberDNLoc
= Record
.readDeclarationNameLoc(E
->MemberDecl
->getDeclName());
1026 E
->MemberLoc
= Record
.readSourceLocation();
1027 E
->MemberExprBits
.IsArrow
= Record
.readInt();
1028 E
->MemberExprBits
.HasQualifierOrFoundDecl
= HasQualifier
|| HasFoundDecl
;
1029 E
->MemberExprBits
.HasTemplateKWAndArgsInfo
= HasTemplateInfo
;
1030 E
->MemberExprBits
.HadMultipleCandidates
= Record
.readInt();
1031 E
->MemberExprBits
.NonOdrUseReason
= Record
.readInt();
1032 E
->MemberExprBits
.OperatorLoc
= Record
.readSourceLocation();
1034 if (HasQualifier
|| HasFoundDecl
) {
1035 DeclAccessPair FoundDecl
;
1037 auto *FoundD
= Record
.readDeclAs
<NamedDecl
>();
1038 auto AS
= (AccessSpecifier
)Record
.readInt();
1039 FoundDecl
= DeclAccessPair::make(FoundD
, AS
);
1041 FoundDecl
= DeclAccessPair::make(E
->MemberDecl
,
1042 E
->MemberDecl
->getAccess());
1044 E
->getTrailingObjects
<MemberExprNameQualifier
>()->FoundDecl
= FoundDecl
;
1046 NestedNameSpecifierLoc QualifierLoc
;
1048 QualifierLoc
= Record
.readNestedNameSpecifierLoc();
1049 E
->getTrailingObjects
<MemberExprNameQualifier
>()->QualifierLoc
=
1053 if (HasTemplateInfo
)
1054 ReadTemplateKWAndArgsInfo(
1055 *E
->getTrailingObjects
<ASTTemplateKWAndArgsInfo
>(),
1056 E
->getTrailingObjects
<TemplateArgumentLoc
>(), NumTemplateArgs
);
1059 void ASTStmtReader::VisitObjCIsaExpr(ObjCIsaExpr
*E
) {
1061 E
->setBase(Record
.readSubExpr());
1062 E
->setIsaMemberLoc(readSourceLocation());
1063 E
->setOpLoc(readSourceLocation());
1064 E
->setArrow(Record
.readInt());
1067 void ASTStmtReader::
1068 VisitObjCIndirectCopyRestoreExpr(ObjCIndirectCopyRestoreExpr
*E
) {
1070 E
->Operand
= Record
.readSubExpr();
1071 E
->setShouldCopy(Record
.readInt());
1074 void ASTStmtReader::VisitObjCBridgedCastExpr(ObjCBridgedCastExpr
*E
) {
1075 VisitExplicitCastExpr(E
);
1076 E
->LParenLoc
= readSourceLocation();
1077 E
->BridgeKeywordLoc
= readSourceLocation();
1078 E
->Kind
= Record
.readInt();
1081 void ASTStmtReader::VisitCastExpr(CastExpr
*E
) {
1083 unsigned NumBaseSpecs
= Record
.readInt();
1084 assert(NumBaseSpecs
== E
->path_size());
1085 unsigned HasFPFeatures
= Record
.readInt();
1086 assert(E
->hasStoredFPFeatures() == HasFPFeatures
);
1087 E
->setSubExpr(Record
.readSubExpr());
1088 E
->setCastKind((CastKind
)Record
.readInt());
1089 CastExpr::path_iterator BaseI
= E
->path_begin();
1090 while (NumBaseSpecs
--) {
1091 auto *BaseSpec
= new (Record
.getContext()) CXXBaseSpecifier
;
1092 *BaseSpec
= Record
.readCXXBaseSpecifier();
1093 *BaseI
++ = BaseSpec
;
1096 *E
->getTrailingFPFeatures() =
1097 FPOptionsOverride::getFromOpaqueInt(Record
.readInt());
1100 void ASTStmtReader::VisitBinaryOperator(BinaryOperator
*E
) {
1101 bool hasFP_Features
;
1103 E
->setHasStoredFPFeatures(hasFP_Features
= Record
.readInt());
1104 E
->setOpcode((BinaryOperator::Opcode
)Record
.readInt());
1105 E
->setLHS(Record
.readSubExpr());
1106 E
->setRHS(Record
.readSubExpr());
1107 E
->setOperatorLoc(readSourceLocation());
1109 E
->setStoredFPFeatures(
1110 FPOptionsOverride::getFromOpaqueInt(Record
.readInt()));
1113 void ASTStmtReader::VisitCompoundAssignOperator(CompoundAssignOperator
*E
) {
1114 VisitBinaryOperator(E
);
1115 E
->setComputationLHSType(Record
.readType());
1116 E
->setComputationResultType(Record
.readType());
1119 void ASTStmtReader::VisitConditionalOperator(ConditionalOperator
*E
) {
1121 E
->SubExprs
[ConditionalOperator::COND
] = Record
.readSubExpr();
1122 E
->SubExprs
[ConditionalOperator::LHS
] = Record
.readSubExpr();
1123 E
->SubExprs
[ConditionalOperator::RHS
] = Record
.readSubExpr();
1124 E
->QuestionLoc
= readSourceLocation();
1125 E
->ColonLoc
= readSourceLocation();
1129 ASTStmtReader::VisitBinaryConditionalOperator(BinaryConditionalOperator
*E
) {
1131 E
->OpaqueValue
= cast
<OpaqueValueExpr
>(Record
.readSubExpr());
1132 E
->SubExprs
[BinaryConditionalOperator::COMMON
] = Record
.readSubExpr();
1133 E
->SubExprs
[BinaryConditionalOperator::COND
] = Record
.readSubExpr();
1134 E
->SubExprs
[BinaryConditionalOperator::LHS
] = Record
.readSubExpr();
1135 E
->SubExprs
[BinaryConditionalOperator::RHS
] = Record
.readSubExpr();
1136 E
->QuestionLoc
= readSourceLocation();
1137 E
->ColonLoc
= readSourceLocation();
1140 void ASTStmtReader::VisitImplicitCastExpr(ImplicitCastExpr
*E
) {
1142 E
->setIsPartOfExplicitCast(Record
.readInt());
1145 void ASTStmtReader::VisitExplicitCastExpr(ExplicitCastExpr
*E
) {
1147 E
->setTypeInfoAsWritten(readTypeSourceInfo());
1150 void ASTStmtReader::VisitCStyleCastExpr(CStyleCastExpr
*E
) {
1151 VisitExplicitCastExpr(E
);
1152 E
->setLParenLoc(readSourceLocation());
1153 E
->setRParenLoc(readSourceLocation());
1156 void ASTStmtReader::VisitCompoundLiteralExpr(CompoundLiteralExpr
*E
) {
1158 E
->setLParenLoc(readSourceLocation());
1159 E
->setTypeSourceInfo(readTypeSourceInfo());
1160 E
->setInitializer(Record
.readSubExpr());
1161 E
->setFileScope(Record
.readInt());
1164 void ASTStmtReader::VisitExtVectorElementExpr(ExtVectorElementExpr
*E
) {
1166 E
->setBase(Record
.readSubExpr());
1167 E
->setAccessor(Record
.readIdentifier());
1168 E
->setAccessorLoc(readSourceLocation());
1171 void ASTStmtReader::VisitInitListExpr(InitListExpr
*E
) {
1173 if (auto *SyntForm
= cast_or_null
<InitListExpr
>(Record
.readSubStmt()))
1174 E
->setSyntacticForm(SyntForm
);
1175 E
->setLBraceLoc(readSourceLocation());
1176 E
->setRBraceLoc(readSourceLocation());
1177 bool isArrayFiller
= Record
.readInt();
1178 Expr
*filler
= nullptr;
1179 if (isArrayFiller
) {
1180 filler
= Record
.readSubExpr();
1181 E
->ArrayFillerOrUnionFieldInit
= filler
;
1183 E
->ArrayFillerOrUnionFieldInit
= readDeclAs
<FieldDecl
>();
1184 E
->sawArrayRangeDesignator(Record
.readInt());
1185 unsigned NumInits
= Record
.readInt();
1186 E
->reserveInits(Record
.getContext(), NumInits
);
1187 if (isArrayFiller
) {
1188 for (unsigned I
= 0; I
!= NumInits
; ++I
) {
1189 Expr
*init
= Record
.readSubExpr();
1190 E
->updateInit(Record
.getContext(), I
, init
? init
: filler
);
1193 for (unsigned I
= 0; I
!= NumInits
; ++I
)
1194 E
->updateInit(Record
.getContext(), I
, Record
.readSubExpr());
1198 void ASTStmtReader::VisitDesignatedInitExpr(DesignatedInitExpr
*E
) {
1199 using Designator
= DesignatedInitExpr::Designator
;
1202 unsigned NumSubExprs
= Record
.readInt();
1203 assert(NumSubExprs
== E
->getNumSubExprs() && "Wrong number of subexprs");
1204 for (unsigned I
= 0; I
!= NumSubExprs
; ++I
)
1205 E
->setSubExpr(I
, Record
.readSubExpr());
1206 E
->setEqualOrColonLoc(readSourceLocation());
1207 E
->setGNUSyntax(Record
.readInt());
1209 SmallVector
<Designator
, 4> Designators
;
1210 while (Record
.getIdx() < Record
.size()) {
1211 switch ((DesignatorTypes
)Record
.readInt()) {
1212 case DESIG_FIELD_DECL
: {
1213 auto *Field
= readDeclAs
<FieldDecl
>();
1214 SourceLocation DotLoc
= readSourceLocation();
1215 SourceLocation FieldLoc
= readSourceLocation();
1216 Designators
.push_back(Designator::CreateFieldDesignator(
1217 Field
->getIdentifier(), DotLoc
, FieldLoc
));
1218 Designators
.back().setFieldDecl(Field
);
1222 case DESIG_FIELD_NAME
: {
1223 const IdentifierInfo
*Name
= Record
.readIdentifier();
1224 SourceLocation DotLoc
= readSourceLocation();
1225 SourceLocation FieldLoc
= readSourceLocation();
1226 Designators
.push_back(Designator::CreateFieldDesignator(Name
, DotLoc
,
1232 unsigned Index
= Record
.readInt();
1233 SourceLocation LBracketLoc
= readSourceLocation();
1234 SourceLocation RBracketLoc
= readSourceLocation();
1235 Designators
.push_back(Designator::CreateArrayDesignator(Index
,
1241 case DESIG_ARRAY_RANGE
: {
1242 unsigned Index
= Record
.readInt();
1243 SourceLocation LBracketLoc
= readSourceLocation();
1244 SourceLocation EllipsisLoc
= readSourceLocation();
1245 SourceLocation RBracketLoc
= readSourceLocation();
1246 Designators
.push_back(Designator::CreateArrayRangeDesignator(
1247 Index
, LBracketLoc
, EllipsisLoc
, RBracketLoc
));
1252 E
->setDesignators(Record
.getContext(),
1253 Designators
.data(), Designators
.size());
1256 void ASTStmtReader::VisitDesignatedInitUpdateExpr(DesignatedInitUpdateExpr
*E
) {
1258 E
->setBase(Record
.readSubExpr());
1259 E
->setUpdater(Record
.readSubExpr());
1262 void ASTStmtReader::VisitNoInitExpr(NoInitExpr
*E
) {
1266 void ASTStmtReader::VisitArrayInitLoopExpr(ArrayInitLoopExpr
*E
) {
1268 E
->SubExprs
[0] = Record
.readSubExpr();
1269 E
->SubExprs
[1] = Record
.readSubExpr();
1272 void ASTStmtReader::VisitArrayInitIndexExpr(ArrayInitIndexExpr
*E
) {
1276 void ASTStmtReader::VisitImplicitValueInitExpr(ImplicitValueInitExpr
*E
) {
1280 void ASTStmtReader::VisitVAArgExpr(VAArgExpr
*E
) {
1282 E
->setSubExpr(Record
.readSubExpr());
1283 E
->setWrittenTypeInfo(readTypeSourceInfo());
1284 E
->setBuiltinLoc(readSourceLocation());
1285 E
->setRParenLoc(readSourceLocation());
1286 E
->setIsMicrosoftABI(Record
.readInt());
1289 void ASTStmtReader::VisitSourceLocExpr(SourceLocExpr
*E
) {
1291 E
->ParentContext
= readDeclAs
<DeclContext
>();
1292 E
->BuiltinLoc
= readSourceLocation();
1293 E
->RParenLoc
= readSourceLocation();
1294 E
->SourceLocExprBits
.Kind
= Record
.readInt();
1297 void ASTStmtReader::VisitAddrLabelExpr(AddrLabelExpr
*E
) {
1299 E
->setAmpAmpLoc(readSourceLocation());
1300 E
->setLabelLoc(readSourceLocation());
1301 E
->setLabel(readDeclAs
<LabelDecl
>());
1304 void ASTStmtReader::VisitStmtExpr(StmtExpr
*E
) {
1306 E
->setLParenLoc(readSourceLocation());
1307 E
->setRParenLoc(readSourceLocation());
1308 E
->setSubStmt(cast_or_null
<CompoundStmt
>(Record
.readSubStmt()));
1309 E
->StmtExprBits
.TemplateDepth
= Record
.readInt();
1312 void ASTStmtReader::VisitChooseExpr(ChooseExpr
*E
) {
1314 E
->setCond(Record
.readSubExpr());
1315 E
->setLHS(Record
.readSubExpr());
1316 E
->setRHS(Record
.readSubExpr());
1317 E
->setBuiltinLoc(readSourceLocation());
1318 E
->setRParenLoc(readSourceLocation());
1319 E
->setIsConditionTrue(Record
.readInt());
1322 void ASTStmtReader::VisitGNUNullExpr(GNUNullExpr
*E
) {
1324 E
->setTokenLocation(readSourceLocation());
1327 void ASTStmtReader::VisitShuffleVectorExpr(ShuffleVectorExpr
*E
) {
1329 SmallVector
<Expr
*, 16> Exprs
;
1330 unsigned NumExprs
= Record
.readInt();
1332 Exprs
.push_back(Record
.readSubExpr());
1333 E
->setExprs(Record
.getContext(), Exprs
);
1334 E
->setBuiltinLoc(readSourceLocation());
1335 E
->setRParenLoc(readSourceLocation());
1338 void ASTStmtReader::VisitConvertVectorExpr(ConvertVectorExpr
*E
) {
1340 E
->BuiltinLoc
= readSourceLocation();
1341 E
->RParenLoc
= readSourceLocation();
1342 E
->TInfo
= readTypeSourceInfo();
1343 E
->SrcExpr
= Record
.readSubExpr();
1346 void ASTStmtReader::VisitBlockExpr(BlockExpr
*E
) {
1348 E
->setBlockDecl(readDeclAs
<BlockDecl
>());
1351 void ASTStmtReader::VisitGenericSelectionExpr(GenericSelectionExpr
*E
) {
1354 unsigned NumAssocs
= Record
.readInt();
1355 assert(NumAssocs
== E
->getNumAssocs() && "Wrong NumAssocs!");
1356 E
->IsExprPredicate
= Record
.readInt();
1357 E
->ResultIndex
= Record
.readInt();
1358 E
->GenericSelectionExprBits
.GenericLoc
= readSourceLocation();
1359 E
->DefaultLoc
= readSourceLocation();
1360 E
->RParenLoc
= readSourceLocation();
1362 Stmt
**Stmts
= E
->getTrailingObjects
<Stmt
*>();
1363 // Add 1 to account for the controlling expression which is the first
1364 // expression in the trailing array of Stmt *. This is not needed for
1365 // the trailing array of TypeSourceInfo *.
1366 for (unsigned I
= 0, N
= NumAssocs
+ 1; I
< N
; ++I
)
1367 Stmts
[I
] = Record
.readSubExpr();
1369 TypeSourceInfo
**TSIs
= E
->getTrailingObjects
<TypeSourceInfo
*>();
1370 for (unsigned I
= 0, N
= NumAssocs
; I
< N
; ++I
)
1371 TSIs
[I
] = readTypeSourceInfo();
1374 void ASTStmtReader::VisitPseudoObjectExpr(PseudoObjectExpr
*E
) {
1376 unsigned numSemanticExprs
= Record
.readInt();
1377 assert(numSemanticExprs
+ 1 == E
->PseudoObjectExprBits
.NumSubExprs
);
1378 E
->PseudoObjectExprBits
.ResultIndex
= Record
.readInt();
1380 // Read the syntactic expression.
1381 E
->getSubExprsBuffer()[0] = Record
.readSubExpr();
1383 // Read all the semantic expressions.
1384 for (unsigned i
= 0; i
!= numSemanticExprs
; ++i
) {
1385 Expr
*subExpr
= Record
.readSubExpr();
1386 E
->getSubExprsBuffer()[i
+1] = subExpr
;
1390 void ASTStmtReader::VisitAtomicExpr(AtomicExpr
*E
) {
1392 E
->Op
= AtomicExpr::AtomicOp(Record
.readInt());
1393 E
->NumSubExprs
= AtomicExpr::getNumSubExprs(E
->Op
);
1394 for (unsigned I
= 0; I
!= E
->NumSubExprs
; ++I
)
1395 E
->SubExprs
[I
] = Record
.readSubExpr();
1396 E
->BuiltinLoc
= readSourceLocation();
1397 E
->RParenLoc
= readSourceLocation();
1400 //===----------------------------------------------------------------------===//
1401 // Objective-C Expressions and Statements
1403 void ASTStmtReader::VisitObjCStringLiteral(ObjCStringLiteral
*E
) {
1405 E
->setString(cast
<StringLiteral
>(Record
.readSubStmt()));
1406 E
->setAtLoc(readSourceLocation());
1409 void ASTStmtReader::VisitObjCBoxedExpr(ObjCBoxedExpr
*E
) {
1411 // could be one of several IntegerLiteral, FloatLiteral, etc.
1412 E
->SubExpr
= Record
.readSubStmt();
1413 E
->BoxingMethod
= readDeclAs
<ObjCMethodDecl
>();
1414 E
->Range
= readSourceRange();
1417 void ASTStmtReader::VisitObjCArrayLiteral(ObjCArrayLiteral
*E
) {
1419 unsigned NumElements
= Record
.readInt();
1420 assert(NumElements
== E
->getNumElements() && "Wrong number of elements");
1421 Expr
**Elements
= E
->getElements();
1422 for (unsigned I
= 0, N
= NumElements
; I
!= N
; ++I
)
1423 Elements
[I
] = Record
.readSubExpr();
1424 E
->ArrayWithObjectsMethod
= readDeclAs
<ObjCMethodDecl
>();
1425 E
->Range
= readSourceRange();
1428 void ASTStmtReader::VisitObjCDictionaryLiteral(ObjCDictionaryLiteral
*E
) {
1430 unsigned NumElements
= Record
.readInt();
1431 assert(NumElements
== E
->getNumElements() && "Wrong number of elements");
1432 bool HasPackExpansions
= Record
.readInt();
1433 assert(HasPackExpansions
== E
->HasPackExpansions
&&"Pack expansion mismatch");
1435 E
->getTrailingObjects
<ObjCDictionaryLiteral::KeyValuePair
>();
1437 E
->getTrailingObjects
<ObjCDictionaryLiteral::ExpansionData
>();
1438 for (unsigned I
= 0; I
!= NumElements
; ++I
) {
1439 KeyValues
[I
].Key
= Record
.readSubExpr();
1440 KeyValues
[I
].Value
= Record
.readSubExpr();
1441 if (HasPackExpansions
) {
1442 Expansions
[I
].EllipsisLoc
= readSourceLocation();
1443 Expansions
[I
].NumExpansionsPlusOne
= Record
.readInt();
1446 E
->DictWithObjectsMethod
= readDeclAs
<ObjCMethodDecl
>();
1447 E
->Range
= readSourceRange();
1450 void ASTStmtReader::VisitObjCEncodeExpr(ObjCEncodeExpr
*E
) {
1452 E
->setEncodedTypeSourceInfo(readTypeSourceInfo());
1453 E
->setAtLoc(readSourceLocation());
1454 E
->setRParenLoc(readSourceLocation());
1457 void ASTStmtReader::VisitObjCSelectorExpr(ObjCSelectorExpr
*E
) {
1459 E
->setSelector(Record
.readSelector());
1460 E
->setAtLoc(readSourceLocation());
1461 E
->setRParenLoc(readSourceLocation());
1464 void ASTStmtReader::VisitObjCProtocolExpr(ObjCProtocolExpr
*E
) {
1466 E
->setProtocol(readDeclAs
<ObjCProtocolDecl
>());
1467 E
->setAtLoc(readSourceLocation());
1468 E
->ProtoLoc
= readSourceLocation();
1469 E
->setRParenLoc(readSourceLocation());
1472 void ASTStmtReader::VisitObjCIvarRefExpr(ObjCIvarRefExpr
*E
) {
1474 E
->setDecl(readDeclAs
<ObjCIvarDecl
>());
1475 E
->setLocation(readSourceLocation());
1476 E
->setOpLoc(readSourceLocation());
1477 E
->setBase(Record
.readSubExpr());
1478 E
->setIsArrow(Record
.readInt());
1479 E
->setIsFreeIvar(Record
.readInt());
1482 void ASTStmtReader::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr
*E
) {
1484 unsigned MethodRefFlags
= Record
.readInt();
1485 bool Implicit
= Record
.readInt() != 0;
1487 auto *Getter
= readDeclAs
<ObjCMethodDecl
>();
1488 auto *Setter
= readDeclAs
<ObjCMethodDecl
>();
1489 E
->setImplicitProperty(Getter
, Setter
, MethodRefFlags
);
1491 E
->setExplicitProperty(readDeclAs
<ObjCPropertyDecl
>(), MethodRefFlags
);
1493 E
->setLocation(readSourceLocation());
1494 E
->setReceiverLocation(readSourceLocation());
1495 switch (Record
.readInt()) {
1497 E
->setBase(Record
.readSubExpr());
1500 E
->setSuperReceiver(Record
.readType());
1503 E
->setClassReceiver(readDeclAs
<ObjCInterfaceDecl
>());
1508 void ASTStmtReader::VisitObjCSubscriptRefExpr(ObjCSubscriptRefExpr
*E
) {
1510 E
->setRBracket(readSourceLocation());
1511 E
->setBaseExpr(Record
.readSubExpr());
1512 E
->setKeyExpr(Record
.readSubExpr());
1513 E
->GetAtIndexMethodDecl
= readDeclAs
<ObjCMethodDecl
>();
1514 E
->SetAtIndexMethodDecl
= readDeclAs
<ObjCMethodDecl
>();
1517 void ASTStmtReader::VisitObjCMessageExpr(ObjCMessageExpr
*E
) {
1519 assert(Record
.peekInt() == E
->getNumArgs());
1521 unsigned NumStoredSelLocs
= Record
.readInt();
1522 E
->SelLocsKind
= Record
.readInt();
1523 E
->setDelegateInitCall(Record
.readInt());
1524 E
->IsImplicit
= Record
.readInt();
1525 auto Kind
= static_cast<ObjCMessageExpr::ReceiverKind
>(Record
.readInt());
1527 case ObjCMessageExpr::Instance
:
1528 E
->setInstanceReceiver(Record
.readSubExpr());
1531 case ObjCMessageExpr::Class
:
1532 E
->setClassReceiver(readTypeSourceInfo());
1535 case ObjCMessageExpr::SuperClass
:
1536 case ObjCMessageExpr::SuperInstance
: {
1537 QualType T
= Record
.readType();
1538 SourceLocation SuperLoc
= readSourceLocation();
1539 E
->setSuper(SuperLoc
, T
, Kind
== ObjCMessageExpr::SuperInstance
);
1544 assert(Kind
== E
->getReceiverKind());
1546 if (Record
.readInt())
1547 E
->setMethodDecl(readDeclAs
<ObjCMethodDecl
>());
1549 E
->setSelector(Record
.readSelector());
1551 E
->LBracLoc
= readSourceLocation();
1552 E
->RBracLoc
= readSourceLocation();
1554 for (unsigned I
= 0, N
= E
->getNumArgs(); I
!= N
; ++I
)
1555 E
->setArg(I
, Record
.readSubExpr());
1557 SourceLocation
*Locs
= E
->getStoredSelLocs();
1558 for (unsigned I
= 0; I
!= NumStoredSelLocs
; ++I
)
1559 Locs
[I
] = readSourceLocation();
1562 void ASTStmtReader::VisitObjCForCollectionStmt(ObjCForCollectionStmt
*S
) {
1564 S
->setElement(Record
.readSubStmt());
1565 S
->setCollection(Record
.readSubExpr());
1566 S
->setBody(Record
.readSubStmt());
1567 S
->setForLoc(readSourceLocation());
1568 S
->setRParenLoc(readSourceLocation());
1571 void ASTStmtReader::VisitObjCAtCatchStmt(ObjCAtCatchStmt
*S
) {
1573 S
->setCatchBody(Record
.readSubStmt());
1574 S
->setCatchParamDecl(readDeclAs
<VarDecl
>());
1575 S
->setAtCatchLoc(readSourceLocation());
1576 S
->setRParenLoc(readSourceLocation());
1579 void ASTStmtReader::VisitObjCAtFinallyStmt(ObjCAtFinallyStmt
*S
) {
1581 S
->setFinallyBody(Record
.readSubStmt());
1582 S
->setAtFinallyLoc(readSourceLocation());
1585 void ASTStmtReader::VisitObjCAutoreleasePoolStmt(ObjCAutoreleasePoolStmt
*S
) {
1586 VisitStmt(S
); // FIXME: no test coverage.
1587 S
->setSubStmt(Record
.readSubStmt());
1588 S
->setAtLoc(readSourceLocation());
1591 void ASTStmtReader::VisitObjCAtTryStmt(ObjCAtTryStmt
*S
) {
1593 assert(Record
.peekInt() == S
->getNumCatchStmts());
1595 bool HasFinally
= Record
.readInt();
1596 S
->setTryBody(Record
.readSubStmt());
1597 for (unsigned I
= 0, N
= S
->getNumCatchStmts(); I
!= N
; ++I
)
1598 S
->setCatchStmt(I
, cast_or_null
<ObjCAtCatchStmt
>(Record
.readSubStmt()));
1601 S
->setFinallyStmt(Record
.readSubStmt());
1602 S
->setAtTryLoc(readSourceLocation());
1605 void ASTStmtReader::VisitObjCAtSynchronizedStmt(ObjCAtSynchronizedStmt
*S
) {
1606 VisitStmt(S
); // FIXME: no test coverage.
1607 S
->setSynchExpr(Record
.readSubStmt());
1608 S
->setSynchBody(Record
.readSubStmt());
1609 S
->setAtSynchronizedLoc(readSourceLocation());
1612 void ASTStmtReader::VisitObjCAtThrowStmt(ObjCAtThrowStmt
*S
) {
1613 VisitStmt(S
); // FIXME: no test coverage.
1614 S
->setThrowExpr(Record
.readSubStmt());
1615 S
->setThrowLoc(readSourceLocation());
1618 void ASTStmtReader::VisitObjCBoolLiteralExpr(ObjCBoolLiteralExpr
*E
) {
1620 E
->setValue(Record
.readInt());
1621 E
->setLocation(readSourceLocation());
1624 void ASTStmtReader::VisitObjCAvailabilityCheckExpr(ObjCAvailabilityCheckExpr
*E
) {
1626 SourceRange R
= Record
.readSourceRange();
1627 E
->AtLoc
= R
.getBegin();
1628 E
->RParen
= R
.getEnd();
1629 E
->VersionToCheck
= Record
.readVersionTuple();
1632 //===----------------------------------------------------------------------===//
1633 // C++ Expressions and Statements
1634 //===----------------------------------------------------------------------===//
1636 void ASTStmtReader::VisitCXXCatchStmt(CXXCatchStmt
*S
) {
1638 S
->CatchLoc
= readSourceLocation();
1639 S
->ExceptionDecl
= readDeclAs
<VarDecl
>();
1640 S
->HandlerBlock
= Record
.readSubStmt();
1643 void ASTStmtReader::VisitCXXTryStmt(CXXTryStmt
*S
) {
1645 assert(Record
.peekInt() == S
->getNumHandlers() && "NumStmtFields is wrong ?");
1647 S
->TryLoc
= readSourceLocation();
1648 S
->getStmts()[0] = Record
.readSubStmt();
1649 for (unsigned i
= 0, e
= S
->getNumHandlers(); i
!= e
; ++i
)
1650 S
->getStmts()[i
+ 1] = Record
.readSubStmt();
1653 void ASTStmtReader::VisitCXXForRangeStmt(CXXForRangeStmt
*S
) {
1655 S
->ForLoc
= readSourceLocation();
1656 S
->CoawaitLoc
= readSourceLocation();
1657 S
->ColonLoc
= readSourceLocation();
1658 S
->RParenLoc
= readSourceLocation();
1659 S
->setInit(Record
.readSubStmt());
1660 S
->setRangeStmt(Record
.readSubStmt());
1661 S
->setBeginStmt(Record
.readSubStmt());
1662 S
->setEndStmt(Record
.readSubStmt());
1663 S
->setCond(Record
.readSubExpr());
1664 S
->setInc(Record
.readSubExpr());
1665 S
->setLoopVarStmt(Record
.readSubStmt());
1666 S
->setBody(Record
.readSubStmt());
1669 void ASTStmtReader::VisitMSDependentExistsStmt(MSDependentExistsStmt
*S
) {
1671 S
->KeywordLoc
= readSourceLocation();
1672 S
->IsIfExists
= Record
.readInt();
1673 S
->QualifierLoc
= Record
.readNestedNameSpecifierLoc();
1674 S
->NameInfo
= Record
.readDeclarationNameInfo();
1675 S
->SubStmt
= Record
.readSubStmt();
1678 void ASTStmtReader::VisitCXXOperatorCallExpr(CXXOperatorCallExpr
*E
) {
1680 E
->CXXOperatorCallExprBits
.OperatorKind
= Record
.readInt();
1681 E
->Range
= Record
.readSourceRange();
1684 void ASTStmtReader::VisitCXXRewrittenBinaryOperator(
1685 CXXRewrittenBinaryOperator
*E
) {
1687 E
->CXXRewrittenBinaryOperatorBits
.IsReversed
= Record
.readInt();
1688 E
->SemanticForm
= Record
.readSubExpr();
1691 void ASTStmtReader::VisitCXXConstructExpr(CXXConstructExpr
*E
) {
1694 unsigned NumArgs
= Record
.readInt();
1695 assert((NumArgs
== E
->getNumArgs()) && "Wrong NumArgs!");
1697 E
->CXXConstructExprBits
.Elidable
= Record
.readInt();
1698 E
->CXXConstructExprBits
.HadMultipleCandidates
= Record
.readInt();
1699 E
->CXXConstructExprBits
.ListInitialization
= Record
.readInt();
1700 E
->CXXConstructExprBits
.StdInitListInitialization
= Record
.readInt();
1701 E
->CXXConstructExprBits
.ZeroInitialization
= Record
.readInt();
1702 E
->CXXConstructExprBits
.ConstructionKind
= Record
.readInt();
1703 E
->CXXConstructExprBits
.IsImmediateEscalating
= Record
.readInt();
1704 E
->CXXConstructExprBits
.Loc
= readSourceLocation();
1705 E
->Constructor
= readDeclAs
<CXXConstructorDecl
>();
1706 E
->ParenOrBraceRange
= readSourceRange();
1708 for (unsigned I
= 0; I
!= NumArgs
; ++I
)
1709 E
->setArg(I
, Record
.readSubExpr());
1712 void ASTStmtReader::VisitCXXInheritedCtorInitExpr(CXXInheritedCtorInitExpr
*E
) {
1714 E
->Constructor
= readDeclAs
<CXXConstructorDecl
>();
1715 E
->Loc
= readSourceLocation();
1716 E
->ConstructsVirtualBase
= Record
.readInt();
1717 E
->InheritedFromVirtualBase
= Record
.readInt();
1720 void ASTStmtReader::VisitCXXTemporaryObjectExpr(CXXTemporaryObjectExpr
*E
) {
1721 VisitCXXConstructExpr(E
);
1722 E
->TSI
= readTypeSourceInfo();
1725 void ASTStmtReader::VisitLambdaExpr(LambdaExpr
*E
) {
1727 unsigned NumCaptures
= Record
.readInt();
1729 assert(NumCaptures
== E
->LambdaExprBits
.NumCaptures
);
1730 E
->IntroducerRange
= readSourceRange();
1731 E
->LambdaExprBits
.CaptureDefault
= Record
.readInt();
1732 E
->CaptureDefaultLoc
= readSourceLocation();
1733 E
->LambdaExprBits
.ExplicitParams
= Record
.readInt();
1734 E
->LambdaExprBits
.ExplicitResultType
= Record
.readInt();
1735 E
->ClosingBrace
= readSourceLocation();
1737 // Read capture initializers.
1738 for (LambdaExpr::capture_init_iterator C
= E
->capture_init_begin(),
1739 CEnd
= E
->capture_init_end();
1741 *C
= Record
.readSubExpr();
1743 // The body will be lazily deserialized when needed from the call operator
1748 ASTStmtReader::VisitCXXStdInitializerListExpr(CXXStdInitializerListExpr
*E
) {
1750 E
->SubExpr
= Record
.readSubExpr();
1753 void ASTStmtReader::VisitCXXNamedCastExpr(CXXNamedCastExpr
*E
) {
1754 VisitExplicitCastExpr(E
);
1755 SourceRange R
= readSourceRange();
1756 E
->Loc
= R
.getBegin();
1757 E
->RParenLoc
= R
.getEnd();
1758 R
= readSourceRange();
1759 E
->AngleBrackets
= R
;
1762 void ASTStmtReader::VisitCXXStaticCastExpr(CXXStaticCastExpr
*E
) {
1763 return VisitCXXNamedCastExpr(E
);
1766 void ASTStmtReader::VisitCXXDynamicCastExpr(CXXDynamicCastExpr
*E
) {
1767 return VisitCXXNamedCastExpr(E
);
1770 void ASTStmtReader::VisitCXXReinterpretCastExpr(CXXReinterpretCastExpr
*E
) {
1771 return VisitCXXNamedCastExpr(E
);
1774 void ASTStmtReader::VisitCXXAddrspaceCastExpr(CXXAddrspaceCastExpr
*E
) {
1775 return VisitCXXNamedCastExpr(E
);
1778 void ASTStmtReader::VisitCXXConstCastExpr(CXXConstCastExpr
*E
) {
1779 return VisitCXXNamedCastExpr(E
);
1782 void ASTStmtReader::VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr
*E
) {
1783 VisitExplicitCastExpr(E
);
1784 E
->setLParenLoc(readSourceLocation());
1785 E
->setRParenLoc(readSourceLocation());
1788 void ASTStmtReader::VisitBuiltinBitCastExpr(BuiltinBitCastExpr
*E
) {
1789 VisitExplicitCastExpr(E
);
1790 E
->KWLoc
= readSourceLocation();
1791 E
->RParenLoc
= readSourceLocation();
1794 void ASTStmtReader::VisitUserDefinedLiteral(UserDefinedLiteral
*E
) {
1796 E
->UDSuffixLoc
= readSourceLocation();
1799 void ASTStmtReader::VisitCXXBoolLiteralExpr(CXXBoolLiteralExpr
*E
) {
1801 E
->setValue(Record
.readInt());
1802 E
->setLocation(readSourceLocation());
1805 void ASTStmtReader::VisitCXXNullPtrLiteralExpr(CXXNullPtrLiteralExpr
*E
) {
1807 E
->setLocation(readSourceLocation());
1810 void ASTStmtReader::VisitCXXTypeidExpr(CXXTypeidExpr
*E
) {
1812 E
->setSourceRange(readSourceRange());
1813 if (E
->isTypeOperand())
1814 E
->Operand
= readTypeSourceInfo();
1816 E
->Operand
= Record
.readSubExpr();
1819 void ASTStmtReader::VisitCXXThisExpr(CXXThisExpr
*E
) {
1821 E
->setLocation(readSourceLocation());
1822 E
->setImplicit(Record
.readInt());
1825 void ASTStmtReader::VisitCXXThrowExpr(CXXThrowExpr
*E
) {
1827 E
->CXXThrowExprBits
.ThrowLoc
= readSourceLocation();
1828 E
->Operand
= Record
.readSubExpr();
1829 E
->CXXThrowExprBits
.IsThrownVariableInScope
= Record
.readInt();
1832 void ASTStmtReader::VisitCXXDefaultArgExpr(CXXDefaultArgExpr
*E
) {
1834 E
->Param
= readDeclAs
<ParmVarDecl
>();
1835 E
->UsedContext
= readDeclAs
<DeclContext
>();
1836 E
->CXXDefaultArgExprBits
.Loc
= readSourceLocation();
1837 E
->CXXDefaultArgExprBits
.HasRewrittenInit
= Record
.readInt();
1838 if (E
->CXXDefaultArgExprBits
.HasRewrittenInit
)
1839 *E
->getTrailingObjects
<Expr
*>() = Record
.readSubExpr();
1842 void ASTStmtReader::VisitCXXDefaultInitExpr(CXXDefaultInitExpr
*E
) {
1844 E
->CXXDefaultInitExprBits
.HasRewrittenInit
= Record
.readInt();
1845 E
->Field
= readDeclAs
<FieldDecl
>();
1846 E
->UsedContext
= readDeclAs
<DeclContext
>();
1847 E
->CXXDefaultInitExprBits
.Loc
= readSourceLocation();
1848 if (E
->CXXDefaultInitExprBits
.HasRewrittenInit
)
1849 *E
->getTrailingObjects
<Expr
*>() = Record
.readSubExpr();
1852 void ASTStmtReader::VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr
*E
) {
1854 E
->setTemporary(Record
.readCXXTemporary());
1855 E
->setSubExpr(Record
.readSubExpr());
1858 void ASTStmtReader::VisitCXXScalarValueInitExpr(CXXScalarValueInitExpr
*E
) {
1860 E
->TypeInfo
= readTypeSourceInfo();
1861 E
->CXXScalarValueInitExprBits
.RParenLoc
= readSourceLocation();
1864 void ASTStmtReader::VisitCXXNewExpr(CXXNewExpr
*E
) {
1867 bool IsArray
= Record
.readInt();
1868 bool HasInit
= Record
.readInt();
1869 unsigned NumPlacementArgs
= Record
.readInt();
1870 bool IsParenTypeId
= Record
.readInt();
1872 E
->CXXNewExprBits
.IsGlobalNew
= Record
.readInt();
1873 E
->CXXNewExprBits
.ShouldPassAlignment
= Record
.readInt();
1874 E
->CXXNewExprBits
.UsualArrayDeleteWantsSize
= Record
.readInt();
1875 E
->CXXNewExprBits
.StoredInitializationStyle
= Record
.readInt();
1877 assert((IsArray
== E
->isArray()) && "Wrong IsArray!");
1878 assert((HasInit
== E
->hasInitializer()) && "Wrong HasInit!");
1879 assert((NumPlacementArgs
== E
->getNumPlacementArgs()) &&
1880 "Wrong NumPlacementArgs!");
1881 assert((IsParenTypeId
== E
->isParenTypeId()) && "Wrong IsParenTypeId!");
1884 (void)NumPlacementArgs
;
1886 E
->setOperatorNew(readDeclAs
<FunctionDecl
>());
1887 E
->setOperatorDelete(readDeclAs
<FunctionDecl
>());
1888 E
->AllocatedTypeInfo
= readTypeSourceInfo();
1890 E
->getTrailingObjects
<SourceRange
>()[0] = readSourceRange();
1891 E
->Range
= readSourceRange();
1892 E
->DirectInitRange
= readSourceRange();
1894 // Install all the subexpressions.
1895 for (CXXNewExpr::raw_arg_iterator I
= E
->raw_arg_begin(),
1896 N
= E
->raw_arg_end();
1898 *I
= Record
.readSubStmt();
1901 void ASTStmtReader::VisitCXXDeleteExpr(CXXDeleteExpr
*E
) {
1903 E
->CXXDeleteExprBits
.GlobalDelete
= Record
.readInt();
1904 E
->CXXDeleteExprBits
.ArrayForm
= Record
.readInt();
1905 E
->CXXDeleteExprBits
.ArrayFormAsWritten
= Record
.readInt();
1906 E
->CXXDeleteExprBits
.UsualArrayDeleteWantsSize
= Record
.readInt();
1907 E
->OperatorDelete
= readDeclAs
<FunctionDecl
>();
1908 E
->Argument
= Record
.readSubExpr();
1909 E
->CXXDeleteExprBits
.Loc
= readSourceLocation();
1912 void ASTStmtReader::VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr
*E
) {
1915 E
->Base
= Record
.readSubExpr();
1916 E
->IsArrow
= Record
.readInt();
1917 E
->OperatorLoc
= readSourceLocation();
1918 E
->QualifierLoc
= Record
.readNestedNameSpecifierLoc();
1919 E
->ScopeType
= readTypeSourceInfo();
1920 E
->ColonColonLoc
= readSourceLocation();
1921 E
->TildeLoc
= readSourceLocation();
1923 IdentifierInfo
*II
= Record
.readIdentifier();
1925 E
->setDestroyedType(II
, readSourceLocation());
1927 E
->setDestroyedType(readTypeSourceInfo());
1930 void ASTStmtReader::VisitExprWithCleanups(ExprWithCleanups
*E
) {
1933 unsigned NumObjects
= Record
.readInt();
1934 assert(NumObjects
== E
->getNumObjects());
1935 for (unsigned i
= 0; i
!= NumObjects
; ++i
) {
1936 unsigned CleanupKind
= Record
.readInt();
1937 ExprWithCleanups::CleanupObject Obj
;
1938 if (CleanupKind
== COK_Block
)
1939 Obj
= readDeclAs
<BlockDecl
>();
1940 else if (CleanupKind
== COK_CompoundLiteral
)
1941 Obj
= cast
<CompoundLiteralExpr
>(Record
.readSubExpr());
1943 llvm_unreachable("unexpected cleanup object type");
1944 E
->getTrailingObjects
<ExprWithCleanups::CleanupObject
>()[i
] = Obj
;
1947 E
->ExprWithCleanupsBits
.CleanupsHaveSideEffects
= Record
.readInt();
1948 E
->SubExpr
= Record
.readSubExpr();
1951 void ASTStmtReader::VisitCXXDependentScopeMemberExpr(
1952 CXXDependentScopeMemberExpr
*E
) {
1955 bool HasTemplateKWAndArgsInfo
= Record
.readInt();
1956 unsigned NumTemplateArgs
= Record
.readInt();
1957 bool HasFirstQualifierFoundInScope
= Record
.readInt();
1959 assert((HasTemplateKWAndArgsInfo
== E
->hasTemplateKWAndArgsInfo()) &&
1960 "Wrong HasTemplateKWAndArgsInfo!");
1962 (HasFirstQualifierFoundInScope
== E
->hasFirstQualifierFoundInScope()) &&
1963 "Wrong HasFirstQualifierFoundInScope!");
1965 if (HasTemplateKWAndArgsInfo
)
1966 ReadTemplateKWAndArgsInfo(
1967 *E
->getTrailingObjects
<ASTTemplateKWAndArgsInfo
>(),
1968 E
->getTrailingObjects
<TemplateArgumentLoc
>(), NumTemplateArgs
);
1970 assert((NumTemplateArgs
== E
->getNumTemplateArgs()) &&
1971 "Wrong NumTemplateArgs!");
1973 E
->CXXDependentScopeMemberExprBits
.IsArrow
= Record
.readInt();
1974 E
->CXXDependentScopeMemberExprBits
.OperatorLoc
= readSourceLocation();
1975 E
->BaseType
= Record
.readType();
1976 E
->QualifierLoc
= Record
.readNestedNameSpecifierLoc();
1977 E
->Base
= Record
.readSubExpr();
1979 if (HasFirstQualifierFoundInScope
)
1980 *E
->getTrailingObjects
<NamedDecl
*>() = readDeclAs
<NamedDecl
>();
1982 E
->MemberNameInfo
= Record
.readDeclarationNameInfo();
1986 ASTStmtReader::VisitDependentScopeDeclRefExpr(DependentScopeDeclRefExpr
*E
) {
1989 if (Record
.readInt()) // HasTemplateKWAndArgsInfo
1990 ReadTemplateKWAndArgsInfo(
1991 *E
->getTrailingObjects
<ASTTemplateKWAndArgsInfo
>(),
1992 E
->getTrailingObjects
<TemplateArgumentLoc
>(),
1993 /*NumTemplateArgs=*/Record
.readInt());
1995 E
->QualifierLoc
= Record
.readNestedNameSpecifierLoc();
1996 E
->NameInfo
= Record
.readDeclarationNameInfo();
2000 ASTStmtReader::VisitCXXUnresolvedConstructExpr(CXXUnresolvedConstructExpr
*E
) {
2002 assert(Record
.peekInt() == E
->getNumArgs() &&
2003 "Read wrong record during creation ?");
2005 for (unsigned I
= 0, N
= E
->getNumArgs(); I
!= N
; ++I
)
2006 E
->setArg(I
, Record
.readSubExpr());
2007 E
->TypeAndInitForm
.setPointer(readTypeSourceInfo());
2008 E
->setLParenLoc(readSourceLocation());
2009 E
->setRParenLoc(readSourceLocation());
2010 E
->TypeAndInitForm
.setInt(Record
.readInt());
2013 void ASTStmtReader::VisitOverloadExpr(OverloadExpr
*E
) {
2016 unsigned NumResults
= Record
.readInt();
2017 bool HasTemplateKWAndArgsInfo
= Record
.readInt();
2018 assert((E
->getNumDecls() == NumResults
) && "Wrong NumResults!");
2019 assert((E
->hasTemplateKWAndArgsInfo() == HasTemplateKWAndArgsInfo
) &&
2020 "Wrong HasTemplateKWAndArgsInfo!");
2022 if (HasTemplateKWAndArgsInfo
) {
2023 unsigned NumTemplateArgs
= Record
.readInt();
2024 ReadTemplateKWAndArgsInfo(*E
->getTrailingASTTemplateKWAndArgsInfo(),
2025 E
->getTrailingTemplateArgumentLoc(),
2027 assert((E
->getNumTemplateArgs() == NumTemplateArgs
) &&
2028 "Wrong NumTemplateArgs!");
2031 UnresolvedSet
<8> Decls
;
2032 for (unsigned I
= 0; I
!= NumResults
; ++I
) {
2033 auto *D
= readDeclAs
<NamedDecl
>();
2034 auto AS
= (AccessSpecifier
)Record
.readInt();
2035 Decls
.addDecl(D
, AS
);
2038 DeclAccessPair
*Results
= E
->getTrailingResults();
2039 UnresolvedSetIterator Iter
= Decls
.begin();
2040 for (unsigned I
= 0; I
!= NumResults
; ++I
) {
2041 Results
[I
] = (Iter
+ I
).getPair();
2044 E
->NameInfo
= Record
.readDeclarationNameInfo();
2045 E
->QualifierLoc
= Record
.readNestedNameSpecifierLoc();
2048 void ASTStmtReader::VisitUnresolvedMemberExpr(UnresolvedMemberExpr
*E
) {
2049 VisitOverloadExpr(E
);
2050 E
->UnresolvedMemberExprBits
.IsArrow
= Record
.readInt();
2051 E
->UnresolvedMemberExprBits
.HasUnresolvedUsing
= Record
.readInt();
2052 E
->Base
= Record
.readSubExpr();
2053 E
->BaseType
= Record
.readType();
2054 E
->OperatorLoc
= readSourceLocation();
2057 void ASTStmtReader::VisitUnresolvedLookupExpr(UnresolvedLookupExpr
*E
) {
2058 VisitOverloadExpr(E
);
2059 E
->UnresolvedLookupExprBits
.RequiresADL
= Record
.readInt();
2060 E
->UnresolvedLookupExprBits
.Overloaded
= Record
.readInt();
2061 E
->NamingClass
= readDeclAs
<CXXRecordDecl
>();
2064 void ASTStmtReader::VisitTypeTraitExpr(TypeTraitExpr
*E
) {
2066 E
->TypeTraitExprBits
.NumArgs
= Record
.readInt();
2067 E
->TypeTraitExprBits
.Kind
= Record
.readInt();
2068 E
->TypeTraitExprBits
.Value
= Record
.readInt();
2069 SourceRange Range
= readSourceRange();
2070 E
->Loc
= Range
.getBegin();
2071 E
->RParenLoc
= Range
.getEnd();
2073 auto **Args
= E
->getTrailingObjects
<TypeSourceInfo
*>();
2074 for (unsigned I
= 0, N
= E
->getNumArgs(); I
!= N
; ++I
)
2075 Args
[I
] = readTypeSourceInfo();
2078 void ASTStmtReader::VisitArrayTypeTraitExpr(ArrayTypeTraitExpr
*E
) {
2080 E
->ATT
= (ArrayTypeTrait
)Record
.readInt();
2081 E
->Value
= (unsigned int)Record
.readInt();
2082 SourceRange Range
= readSourceRange();
2083 E
->Loc
= Range
.getBegin();
2084 E
->RParen
= Range
.getEnd();
2085 E
->QueriedType
= readTypeSourceInfo();
2086 E
->Dimension
= Record
.readSubExpr();
2089 void ASTStmtReader::VisitExpressionTraitExpr(ExpressionTraitExpr
*E
) {
2091 E
->ET
= (ExpressionTrait
)Record
.readInt();
2092 E
->Value
= (bool)Record
.readInt();
2093 SourceRange Range
= readSourceRange();
2094 E
->QueriedExpression
= Record
.readSubExpr();
2095 E
->Loc
= Range
.getBegin();
2096 E
->RParen
= Range
.getEnd();
2099 void ASTStmtReader::VisitCXXNoexceptExpr(CXXNoexceptExpr
*E
) {
2101 E
->CXXNoexceptExprBits
.Value
= Record
.readInt();
2102 E
->Range
= readSourceRange();
2103 E
->Operand
= Record
.readSubExpr();
2106 void ASTStmtReader::VisitPackExpansionExpr(PackExpansionExpr
*E
) {
2108 E
->EllipsisLoc
= readSourceLocation();
2109 E
->NumExpansions
= Record
.readInt();
2110 E
->Pattern
= Record
.readSubExpr();
2113 void ASTStmtReader::VisitSizeOfPackExpr(SizeOfPackExpr
*E
) {
2115 unsigned NumPartialArgs
= Record
.readInt();
2116 E
->OperatorLoc
= readSourceLocation();
2117 E
->PackLoc
= readSourceLocation();
2118 E
->RParenLoc
= readSourceLocation();
2119 E
->Pack
= Record
.readDeclAs
<NamedDecl
>();
2120 if (E
->isPartiallySubstituted()) {
2121 assert(E
->Length
== NumPartialArgs
);
2122 for (auto *I
= E
->getTrailingObjects
<TemplateArgument
>(),
2123 *E
= I
+ NumPartialArgs
;
2125 new (I
) TemplateArgument(Record
.readTemplateArgument());
2126 } else if (!E
->isValueDependent()) {
2127 E
->Length
= Record
.readInt();
2131 void ASTStmtReader::VisitSubstNonTypeTemplateParmExpr(
2132 SubstNonTypeTemplateParmExpr
*E
) {
2134 E
->AssociatedDeclAndRef
.setPointer(readDeclAs
<Decl
>());
2135 E
->AssociatedDeclAndRef
.setInt(Record
.readInt());
2136 E
->Index
= Record
.readInt();
2137 E
->PackIndex
= Record
.readInt();
2138 E
->SubstNonTypeTemplateParmExprBits
.NameLoc
= readSourceLocation();
2139 E
->Replacement
= Record
.readSubExpr();
2142 void ASTStmtReader::VisitSubstNonTypeTemplateParmPackExpr(
2143 SubstNonTypeTemplateParmPackExpr
*E
) {
2145 E
->AssociatedDecl
= readDeclAs
<Decl
>();
2146 E
->Index
= Record
.readInt();
2147 TemplateArgument ArgPack
= Record
.readTemplateArgument();
2148 if (ArgPack
.getKind() != TemplateArgument::Pack
)
2151 E
->Arguments
= ArgPack
.pack_begin();
2152 E
->NumArguments
= ArgPack
.pack_size();
2153 E
->NameLoc
= readSourceLocation();
2156 void ASTStmtReader::VisitFunctionParmPackExpr(FunctionParmPackExpr
*E
) {
2158 E
->NumParameters
= Record
.readInt();
2159 E
->ParamPack
= readDeclAs
<ParmVarDecl
>();
2160 E
->NameLoc
= readSourceLocation();
2161 auto **Parms
= E
->getTrailingObjects
<VarDecl
*>();
2162 for (unsigned i
= 0, n
= E
->NumParameters
; i
!= n
; ++i
)
2163 Parms
[i
] = readDeclAs
<VarDecl
>();
2166 void ASTStmtReader::VisitMaterializeTemporaryExpr(MaterializeTemporaryExpr
*E
) {
2168 bool HasMaterialzedDecl
= Record
.readInt();
2169 if (HasMaterialzedDecl
)
2170 E
->State
= cast
<LifetimeExtendedTemporaryDecl
>(Record
.readDecl());
2172 E
->State
= Record
.readSubExpr();
2175 void ASTStmtReader::VisitCXXFoldExpr(CXXFoldExpr
*E
) {
2177 E
->LParenLoc
= readSourceLocation();
2178 E
->EllipsisLoc
= readSourceLocation();
2179 E
->RParenLoc
= readSourceLocation();
2180 E
->NumExpansions
= Record
.readInt();
2181 E
->SubExprs
[0] = Record
.readSubExpr();
2182 E
->SubExprs
[1] = Record
.readSubExpr();
2183 E
->SubExprs
[2] = Record
.readSubExpr();
2184 E
->Opcode
= (BinaryOperatorKind
)Record
.readInt();
2187 void ASTStmtReader::VisitCXXParenListInitExpr(CXXParenListInitExpr
*E
) {
2189 unsigned ExpectedNumExprs
= Record
.readInt();
2190 assert(E
->NumExprs
== ExpectedNumExprs
&&
2191 "expected number of expressions does not equal the actual number of "
2192 "serialized expressions.");
2193 E
->NumUserSpecifiedExprs
= Record
.readInt();
2194 E
->InitLoc
= readSourceLocation();
2195 E
->LParenLoc
= readSourceLocation();
2196 E
->RParenLoc
= readSourceLocation();
2197 for (unsigned I
= 0; I
< ExpectedNumExprs
; I
++)
2198 E
->getTrailingObjects
<Expr
*>()[I
] = Record
.readSubExpr();
2200 bool HasArrayFillerOrUnionDecl
= Record
.readBool();
2201 if (HasArrayFillerOrUnionDecl
) {
2202 bool HasArrayFiller
= Record
.readBool();
2203 if (HasArrayFiller
) {
2204 E
->setArrayFiller(Record
.readSubExpr());
2206 E
->setInitializedFieldInUnion(readDeclAs
<FieldDecl
>());
2209 E
->updateDependence();
2212 void ASTStmtReader::VisitOpaqueValueExpr(OpaqueValueExpr
*E
) {
2214 E
->SourceExpr
= Record
.readSubExpr();
2215 E
->OpaqueValueExprBits
.Loc
= readSourceLocation();
2216 E
->setIsUnique(Record
.readInt());
2219 void ASTStmtReader::VisitTypoExpr(TypoExpr
*E
) {
2220 llvm_unreachable("Cannot read TypoExpr nodes");
2223 void ASTStmtReader::VisitRecoveryExpr(RecoveryExpr
*E
) {
2225 unsigned NumArgs
= Record
.readInt();
2226 E
->BeginLoc
= readSourceLocation();
2227 E
->EndLoc
= readSourceLocation();
2228 assert((NumArgs
+ 0LL ==
2229 std::distance(E
->children().begin(), E
->children().end())) &&
2232 for (Stmt
*&Child
: E
->children())
2233 Child
= Record
.readSubStmt();
2236 //===----------------------------------------------------------------------===//
2237 // Microsoft Expressions and Statements
2238 //===----------------------------------------------------------------------===//
2239 void ASTStmtReader::VisitMSPropertyRefExpr(MSPropertyRefExpr
*E
) {
2241 E
->IsArrow
= (Record
.readInt() != 0);
2242 E
->BaseExpr
= Record
.readSubExpr();
2243 E
->QualifierLoc
= Record
.readNestedNameSpecifierLoc();
2244 E
->MemberLoc
= readSourceLocation();
2245 E
->TheDecl
= readDeclAs
<MSPropertyDecl
>();
2248 void ASTStmtReader::VisitMSPropertySubscriptExpr(MSPropertySubscriptExpr
*E
) {
2250 E
->setBase(Record
.readSubExpr());
2251 E
->setIdx(Record
.readSubExpr());
2252 E
->setRBracketLoc(readSourceLocation());
2255 void ASTStmtReader::VisitCXXUuidofExpr(CXXUuidofExpr
*E
) {
2257 E
->setSourceRange(readSourceRange());
2258 E
->Guid
= readDeclAs
<MSGuidDecl
>();
2259 if (E
->isTypeOperand())
2260 E
->Operand
= readTypeSourceInfo();
2262 E
->Operand
= Record
.readSubExpr();
2265 void ASTStmtReader::VisitSEHLeaveStmt(SEHLeaveStmt
*S
) {
2267 S
->setLeaveLoc(readSourceLocation());
2270 void ASTStmtReader::VisitSEHExceptStmt(SEHExceptStmt
*S
) {
2272 S
->Loc
= readSourceLocation();
2273 S
->Children
[SEHExceptStmt::FILTER_EXPR
] = Record
.readSubStmt();
2274 S
->Children
[SEHExceptStmt::BLOCK
] = Record
.readSubStmt();
2277 void ASTStmtReader::VisitSEHFinallyStmt(SEHFinallyStmt
*S
) {
2279 S
->Loc
= readSourceLocation();
2280 S
->Block
= Record
.readSubStmt();
2283 void ASTStmtReader::VisitSEHTryStmt(SEHTryStmt
*S
) {
2285 S
->IsCXXTry
= Record
.readInt();
2286 S
->TryLoc
= readSourceLocation();
2287 S
->Children
[SEHTryStmt::TRY
] = Record
.readSubStmt();
2288 S
->Children
[SEHTryStmt::HANDLER
] = Record
.readSubStmt();
2291 //===----------------------------------------------------------------------===//
2292 // CUDA Expressions and Statements
2293 //===----------------------------------------------------------------------===//
2295 void ASTStmtReader::VisitCUDAKernelCallExpr(CUDAKernelCallExpr
*E
) {
2297 E
->setPreArg(CUDAKernelCallExpr::CONFIG
, Record
.readSubExpr());
2300 //===----------------------------------------------------------------------===//
2301 // OpenCL Expressions and Statements.
2302 //===----------------------------------------------------------------------===//
2303 void ASTStmtReader::VisitAsTypeExpr(AsTypeExpr
*E
) {
2305 E
->BuiltinLoc
= readSourceLocation();
2306 E
->RParenLoc
= readSourceLocation();
2307 E
->SrcExpr
= Record
.readSubExpr();
2310 //===----------------------------------------------------------------------===//
2311 // OpenMP Directives.
2312 //===----------------------------------------------------------------------===//
2314 void ASTStmtReader::VisitOMPCanonicalLoop(OMPCanonicalLoop
*S
) {
2316 for (Stmt
*&SubStmt
: S
->SubStmts
)
2317 SubStmt
= Record
.readSubStmt();
2320 void ASTStmtReader::VisitOMPExecutableDirective(OMPExecutableDirective
*E
) {
2321 Record
.readOMPChildren(E
->Data
);
2322 E
->setLocStart(readSourceLocation());
2323 E
->setLocEnd(readSourceLocation());
2324 E
->setMappedDirective(Record
.readEnum
<OpenMPDirectiveKind
>());
2327 void ASTStmtReader::VisitOMPLoopBasedDirective(OMPLoopBasedDirective
*D
) {
2329 // Field CollapsedNum was read in ReadStmtFromStream.
2331 VisitOMPExecutableDirective(D
);
2334 void ASTStmtReader::VisitOMPLoopDirective(OMPLoopDirective
*D
) {
2335 VisitOMPLoopBasedDirective(D
);
2338 void ASTStmtReader::VisitOMPMetaDirective(OMPMetaDirective
*D
) {
2340 // The NumClauses field was read in ReadStmtFromStream.
2342 VisitOMPExecutableDirective(D
);
2345 void ASTStmtReader::VisitOMPParallelDirective(OMPParallelDirective
*D
) {
2347 VisitOMPExecutableDirective(D
);
2348 D
->setHasCancel(Record
.readBool());
2351 void ASTStmtReader::VisitOMPSimdDirective(OMPSimdDirective
*D
) {
2352 VisitOMPLoopDirective(D
);
2355 void ASTStmtReader::VisitOMPLoopTransformationDirective(
2356 OMPLoopTransformationDirective
*D
) {
2357 VisitOMPLoopBasedDirective(D
);
2358 D
->setNumGeneratedLoops(Record
.readUInt32());
2361 void ASTStmtReader::VisitOMPTileDirective(OMPTileDirective
*D
) {
2362 VisitOMPLoopTransformationDirective(D
);
2365 void ASTStmtReader::VisitOMPUnrollDirective(OMPUnrollDirective
*D
) {
2366 VisitOMPLoopTransformationDirective(D
);
2369 void ASTStmtReader::VisitOMPForDirective(OMPForDirective
*D
) {
2370 VisitOMPLoopDirective(D
);
2371 D
->setHasCancel(Record
.readBool());
2374 void ASTStmtReader::VisitOMPForSimdDirective(OMPForSimdDirective
*D
) {
2375 VisitOMPLoopDirective(D
);
2378 void ASTStmtReader::VisitOMPSectionsDirective(OMPSectionsDirective
*D
) {
2380 VisitOMPExecutableDirective(D
);
2381 D
->setHasCancel(Record
.readBool());
2384 void ASTStmtReader::VisitOMPSectionDirective(OMPSectionDirective
*D
) {
2386 VisitOMPExecutableDirective(D
);
2387 D
->setHasCancel(Record
.readBool());
2390 void ASTStmtReader::VisitOMPScopeDirective(OMPScopeDirective
*D
) {
2392 VisitOMPExecutableDirective(D
);
2395 void ASTStmtReader::VisitOMPSingleDirective(OMPSingleDirective
*D
) {
2397 VisitOMPExecutableDirective(D
);
2400 void ASTStmtReader::VisitOMPMasterDirective(OMPMasterDirective
*D
) {
2402 VisitOMPExecutableDirective(D
);
2405 void ASTStmtReader::VisitOMPCriticalDirective(OMPCriticalDirective
*D
) {
2407 VisitOMPExecutableDirective(D
);
2408 D
->DirName
= Record
.readDeclarationNameInfo();
2411 void ASTStmtReader::VisitOMPParallelForDirective(OMPParallelForDirective
*D
) {
2412 VisitOMPLoopDirective(D
);
2413 D
->setHasCancel(Record
.readBool());
2416 void ASTStmtReader::VisitOMPParallelForSimdDirective(
2417 OMPParallelForSimdDirective
*D
) {
2418 VisitOMPLoopDirective(D
);
2421 void ASTStmtReader::VisitOMPParallelMasterDirective(
2422 OMPParallelMasterDirective
*D
) {
2424 VisitOMPExecutableDirective(D
);
2427 void ASTStmtReader::VisitOMPParallelMaskedDirective(
2428 OMPParallelMaskedDirective
*D
) {
2430 VisitOMPExecutableDirective(D
);
2433 void ASTStmtReader::VisitOMPParallelSectionsDirective(
2434 OMPParallelSectionsDirective
*D
) {
2436 VisitOMPExecutableDirective(D
);
2437 D
->setHasCancel(Record
.readBool());
2440 void ASTStmtReader::VisitOMPTaskDirective(OMPTaskDirective
*D
) {
2442 VisitOMPExecutableDirective(D
);
2443 D
->setHasCancel(Record
.readBool());
2446 void ASTStmtReader::VisitOMPTaskyieldDirective(OMPTaskyieldDirective
*D
) {
2448 VisitOMPExecutableDirective(D
);
2451 void ASTStmtReader::VisitOMPBarrierDirective(OMPBarrierDirective
*D
) {
2453 VisitOMPExecutableDirective(D
);
2456 void ASTStmtReader::VisitOMPTaskwaitDirective(OMPTaskwaitDirective
*D
) {
2458 // The NumClauses field was read in ReadStmtFromStream.
2460 VisitOMPExecutableDirective(D
);
2463 void ASTStmtReader::VisitOMPErrorDirective(OMPErrorDirective
*D
) {
2465 // The NumClauses field was read in ReadStmtFromStream.
2467 VisitOMPExecutableDirective(D
);
2470 void ASTStmtReader::VisitOMPTaskgroupDirective(OMPTaskgroupDirective
*D
) {
2472 VisitOMPExecutableDirective(D
);
2475 void ASTStmtReader::VisitOMPFlushDirective(OMPFlushDirective
*D
) {
2477 VisitOMPExecutableDirective(D
);
2480 void ASTStmtReader::VisitOMPDepobjDirective(OMPDepobjDirective
*D
) {
2482 VisitOMPExecutableDirective(D
);
2485 void ASTStmtReader::VisitOMPScanDirective(OMPScanDirective
*D
) {
2487 VisitOMPExecutableDirective(D
);
2490 void ASTStmtReader::VisitOMPOrderedDirective(OMPOrderedDirective
*D
) {
2492 VisitOMPExecutableDirective(D
);
2495 void ASTStmtReader::VisitOMPAtomicDirective(OMPAtomicDirective
*D
) {
2497 VisitOMPExecutableDirective(D
);
2498 D
->Flags
.IsXLHSInRHSPart
= Record
.readBool() ? 1 : 0;
2499 D
->Flags
.IsPostfixUpdate
= Record
.readBool() ? 1 : 0;
2500 D
->Flags
.IsFailOnly
= Record
.readBool() ? 1 : 0;
2503 void ASTStmtReader::VisitOMPTargetDirective(OMPTargetDirective
*D
) {
2505 VisitOMPExecutableDirective(D
);
2508 void ASTStmtReader::VisitOMPTargetDataDirective(OMPTargetDataDirective
*D
) {
2510 VisitOMPExecutableDirective(D
);
2513 void ASTStmtReader::VisitOMPTargetEnterDataDirective(
2514 OMPTargetEnterDataDirective
*D
) {
2516 VisitOMPExecutableDirective(D
);
2519 void ASTStmtReader::VisitOMPTargetExitDataDirective(
2520 OMPTargetExitDataDirective
*D
) {
2522 VisitOMPExecutableDirective(D
);
2525 void ASTStmtReader::VisitOMPTargetParallelDirective(
2526 OMPTargetParallelDirective
*D
) {
2528 VisitOMPExecutableDirective(D
);
2529 D
->setHasCancel(Record
.readBool());
2532 void ASTStmtReader::VisitOMPTargetParallelForDirective(
2533 OMPTargetParallelForDirective
*D
) {
2534 VisitOMPLoopDirective(D
);
2535 D
->setHasCancel(Record
.readBool());
2538 void ASTStmtReader::VisitOMPTeamsDirective(OMPTeamsDirective
*D
) {
2540 VisitOMPExecutableDirective(D
);
2543 void ASTStmtReader::VisitOMPCancellationPointDirective(
2544 OMPCancellationPointDirective
*D
) {
2546 VisitOMPExecutableDirective(D
);
2547 D
->setCancelRegion(Record
.readEnum
<OpenMPDirectiveKind
>());
2550 void ASTStmtReader::VisitOMPCancelDirective(OMPCancelDirective
*D
) {
2552 VisitOMPExecutableDirective(D
);
2553 D
->setCancelRegion(Record
.readEnum
<OpenMPDirectiveKind
>());
2556 void ASTStmtReader::VisitOMPTaskLoopDirective(OMPTaskLoopDirective
*D
) {
2557 VisitOMPLoopDirective(D
);
2558 D
->setHasCancel(Record
.readBool());
2561 void ASTStmtReader::VisitOMPTaskLoopSimdDirective(OMPTaskLoopSimdDirective
*D
) {
2562 VisitOMPLoopDirective(D
);
2565 void ASTStmtReader::VisitOMPMasterTaskLoopDirective(
2566 OMPMasterTaskLoopDirective
*D
) {
2567 VisitOMPLoopDirective(D
);
2568 D
->setHasCancel(Record
.readBool());
2571 void ASTStmtReader::VisitOMPMaskedTaskLoopDirective(
2572 OMPMaskedTaskLoopDirective
*D
) {
2573 VisitOMPLoopDirective(D
);
2574 D
->setHasCancel(Record
.readBool());
2577 void ASTStmtReader::VisitOMPMasterTaskLoopSimdDirective(
2578 OMPMasterTaskLoopSimdDirective
*D
) {
2579 VisitOMPLoopDirective(D
);
2582 void ASTStmtReader::VisitOMPMaskedTaskLoopSimdDirective(
2583 OMPMaskedTaskLoopSimdDirective
*D
) {
2584 VisitOMPLoopDirective(D
);
2587 void ASTStmtReader::VisitOMPParallelMasterTaskLoopDirective(
2588 OMPParallelMasterTaskLoopDirective
*D
) {
2589 VisitOMPLoopDirective(D
);
2590 D
->setHasCancel(Record
.readBool());
2593 void ASTStmtReader::VisitOMPParallelMaskedTaskLoopDirective(
2594 OMPParallelMaskedTaskLoopDirective
*D
) {
2595 VisitOMPLoopDirective(D
);
2596 D
->setHasCancel(Record
.readBool());
2599 void ASTStmtReader::VisitOMPParallelMasterTaskLoopSimdDirective(
2600 OMPParallelMasterTaskLoopSimdDirective
*D
) {
2601 VisitOMPLoopDirective(D
);
2604 void ASTStmtReader::VisitOMPParallelMaskedTaskLoopSimdDirective(
2605 OMPParallelMaskedTaskLoopSimdDirective
*D
) {
2606 VisitOMPLoopDirective(D
);
2609 void ASTStmtReader::VisitOMPDistributeDirective(OMPDistributeDirective
*D
) {
2610 VisitOMPLoopDirective(D
);
2613 void ASTStmtReader::VisitOMPTargetUpdateDirective(OMPTargetUpdateDirective
*D
) {
2615 VisitOMPExecutableDirective(D
);
2618 void ASTStmtReader::VisitOMPDistributeParallelForDirective(
2619 OMPDistributeParallelForDirective
*D
) {
2620 VisitOMPLoopDirective(D
);
2621 D
->setHasCancel(Record
.readBool());
2624 void ASTStmtReader::VisitOMPDistributeParallelForSimdDirective(
2625 OMPDistributeParallelForSimdDirective
*D
) {
2626 VisitOMPLoopDirective(D
);
2629 void ASTStmtReader::VisitOMPDistributeSimdDirective(
2630 OMPDistributeSimdDirective
*D
) {
2631 VisitOMPLoopDirective(D
);
2634 void ASTStmtReader::VisitOMPTargetParallelForSimdDirective(
2635 OMPTargetParallelForSimdDirective
*D
) {
2636 VisitOMPLoopDirective(D
);
2639 void ASTStmtReader::VisitOMPTargetSimdDirective(OMPTargetSimdDirective
*D
) {
2640 VisitOMPLoopDirective(D
);
2643 void ASTStmtReader::VisitOMPTeamsDistributeDirective(
2644 OMPTeamsDistributeDirective
*D
) {
2645 VisitOMPLoopDirective(D
);
2648 void ASTStmtReader::VisitOMPTeamsDistributeSimdDirective(
2649 OMPTeamsDistributeSimdDirective
*D
) {
2650 VisitOMPLoopDirective(D
);
2653 void ASTStmtReader::VisitOMPTeamsDistributeParallelForSimdDirective(
2654 OMPTeamsDistributeParallelForSimdDirective
*D
) {
2655 VisitOMPLoopDirective(D
);
2658 void ASTStmtReader::VisitOMPTeamsDistributeParallelForDirective(
2659 OMPTeamsDistributeParallelForDirective
*D
) {
2660 VisitOMPLoopDirective(D
);
2661 D
->setHasCancel(Record
.readBool());
2664 void ASTStmtReader::VisitOMPTargetTeamsDirective(OMPTargetTeamsDirective
*D
) {
2666 VisitOMPExecutableDirective(D
);
2669 void ASTStmtReader::VisitOMPTargetTeamsDistributeDirective(
2670 OMPTargetTeamsDistributeDirective
*D
) {
2671 VisitOMPLoopDirective(D
);
2674 void ASTStmtReader::VisitOMPTargetTeamsDistributeParallelForDirective(
2675 OMPTargetTeamsDistributeParallelForDirective
*D
) {
2676 VisitOMPLoopDirective(D
);
2677 D
->setHasCancel(Record
.readBool());
2680 void ASTStmtReader::VisitOMPTargetTeamsDistributeParallelForSimdDirective(
2681 OMPTargetTeamsDistributeParallelForSimdDirective
*D
) {
2682 VisitOMPLoopDirective(D
);
2685 void ASTStmtReader::VisitOMPTargetTeamsDistributeSimdDirective(
2686 OMPTargetTeamsDistributeSimdDirective
*D
) {
2687 VisitOMPLoopDirective(D
);
2690 void ASTStmtReader::VisitOMPInteropDirective(OMPInteropDirective
*D
) {
2692 VisitOMPExecutableDirective(D
);
2695 void ASTStmtReader::VisitOMPDispatchDirective(OMPDispatchDirective
*D
) {
2697 VisitOMPExecutableDirective(D
);
2698 D
->setTargetCallLoc(Record
.readSourceLocation());
2701 void ASTStmtReader::VisitOMPMaskedDirective(OMPMaskedDirective
*D
) {
2703 VisitOMPExecutableDirective(D
);
2706 void ASTStmtReader::VisitOMPGenericLoopDirective(OMPGenericLoopDirective
*D
) {
2707 VisitOMPLoopDirective(D
);
2710 void ASTStmtReader::VisitOMPTeamsGenericLoopDirective(
2711 OMPTeamsGenericLoopDirective
*D
) {
2712 VisitOMPLoopDirective(D
);
2715 void ASTStmtReader::VisitOMPTargetTeamsGenericLoopDirective(
2716 OMPTargetTeamsGenericLoopDirective
*D
) {
2717 VisitOMPLoopDirective(D
);
2720 void ASTStmtReader::VisitOMPParallelGenericLoopDirective(
2721 OMPParallelGenericLoopDirective
*D
) {
2722 VisitOMPLoopDirective(D
);
2725 void ASTStmtReader::VisitOMPTargetParallelGenericLoopDirective(
2726 OMPTargetParallelGenericLoopDirective
*D
) {
2727 VisitOMPLoopDirective(D
);
2730 //===----------------------------------------------------------------------===//
2731 // ASTReader Implementation
2732 //===----------------------------------------------------------------------===//
2734 Stmt
*ASTReader::ReadStmt(ModuleFile
&F
) {
2735 switch (ReadingKind
) {
2737 llvm_unreachable("should not call this when not reading anything");
2740 return ReadStmtFromStream(F
);
2742 return ReadSubStmt();
2745 llvm_unreachable("ReadingKind not set ?");
2748 Expr
*ASTReader::ReadExpr(ModuleFile
&F
) {
2749 return cast_or_null
<Expr
>(ReadStmt(F
));
2752 Expr
*ASTReader::ReadSubExpr() {
2753 return cast_or_null
<Expr
>(ReadSubStmt());
2756 // Within the bitstream, expressions are stored in Reverse Polish
2757 // Notation, with each of the subexpressions preceding the
2758 // expression they are stored in. Subexpressions are stored from last to first.
2759 // To evaluate expressions, we continue reading expressions and placing them on
2760 // the stack, with expressions having operands removing those operands from the
2761 // stack. Evaluation terminates when we see a STMT_STOP record, and
2762 // the single remaining expression on the stack is our result.
2763 Stmt
*ASTReader::ReadStmtFromStream(ModuleFile
&F
) {
2764 ReadingKindTracker
ReadingKind(Read_Stmt
, *this);
2765 llvm::BitstreamCursor
&Cursor
= F
.DeclsCursor
;
2767 // Map of offset to previously deserialized stmt. The offset points
2768 // just after the stmt record.
2769 llvm::DenseMap
<uint64_t, Stmt
*> StmtEntries
;
2772 unsigned PrevNumStmts
= StmtStack
.size();
2775 ASTRecordReader
Record(*this, F
);
2776 ASTStmtReader
Reader(Record
, Cursor
);
2777 Stmt::EmptyShell Empty
;
2780 llvm::Expected
<llvm::BitstreamEntry
> MaybeEntry
=
2781 Cursor
.advanceSkippingSubblocks();
2783 Error(toString(MaybeEntry
.takeError()));
2786 llvm::BitstreamEntry Entry
= MaybeEntry
.get();
2788 switch (Entry
.Kind
) {
2789 case llvm::BitstreamEntry::SubBlock
: // Handled for us already.
2790 case llvm::BitstreamEntry::Error
:
2791 Error("malformed block record in AST file");
2793 case llvm::BitstreamEntry::EndBlock
:
2795 case llvm::BitstreamEntry::Record
:
2796 // The interesting case.
2800 ASTContext
&Context
= getContext();
2802 bool Finished
= false;
2803 bool IsStmtReference
= false;
2804 Expected
<unsigned> MaybeStmtCode
= Record
.readRecord(Cursor
, Entry
.ID
);
2805 if (!MaybeStmtCode
) {
2806 Error(toString(MaybeStmtCode
.takeError()));
2809 switch ((StmtCode
)MaybeStmtCode
.get()) {
2815 IsStmtReference
= true;
2816 assert(StmtEntries
.contains(Record
[0]) &&
2817 "No stmt was recorded for this offset reference!");
2818 S
= StmtEntries
[Record
.readInt()];
2826 S
= new (Context
) NullStmt(Empty
);
2830 S
= CompoundStmt::CreateEmpty(
2831 Context
, /*NumStmts=*/Record
[ASTStmtReader::NumStmtFields
],
2832 /*HasFPFeatures=*/Record
[ASTStmtReader::NumStmtFields
+ 1]);
2836 S
= CaseStmt::CreateEmpty(
2838 /*CaseStmtIsGNURange*/ Record
[ASTStmtReader::NumStmtFields
+ 3]);
2842 S
= new (Context
) DefaultStmt(Empty
);
2846 S
= new (Context
) LabelStmt(Empty
);
2849 case STMT_ATTRIBUTED
:
2850 S
= AttributedStmt::CreateEmpty(
2852 /*NumAttrs*/Record
[ASTStmtReader::NumStmtFields
]);
2856 S
= IfStmt::CreateEmpty(
2858 /* HasElse=*/Record
[ASTStmtReader::NumStmtFields
],
2859 /* HasVar=*/Record
[ASTStmtReader::NumStmtFields
+ 1],
2860 /* HasInit=*/Record
[ASTStmtReader::NumStmtFields
+ 2]);
2864 S
= SwitchStmt::CreateEmpty(
2866 /* HasInit=*/Record
[ASTStmtReader::NumStmtFields
],
2867 /* HasVar=*/Record
[ASTStmtReader::NumStmtFields
+ 1]);
2871 S
= WhileStmt::CreateEmpty(
2873 /* HasVar=*/Record
[ASTStmtReader::NumStmtFields
]);
2877 S
= new (Context
) DoStmt(Empty
);
2881 S
= new (Context
) ForStmt(Empty
);
2885 S
= new (Context
) GotoStmt(Empty
);
2888 case STMT_INDIRECT_GOTO
:
2889 S
= new (Context
) IndirectGotoStmt(Empty
);
2893 S
= new (Context
) ContinueStmt(Empty
);
2897 S
= new (Context
) BreakStmt(Empty
);
2901 S
= ReturnStmt::CreateEmpty(
2902 Context
, /* HasNRVOCandidate=*/Record
[ASTStmtReader::NumStmtFields
]);
2906 S
= new (Context
) DeclStmt(Empty
);
2910 S
= new (Context
) GCCAsmStmt(Empty
);
2914 S
= new (Context
) MSAsmStmt(Empty
);
2918 S
= CapturedStmt::CreateDeserialized(
2919 Context
, Record
[ASTStmtReader::NumStmtFields
]);
2923 S
= ConstantExpr::CreateEmpty(
2924 Context
, static_cast<ConstantResultStorageKind
>(
2925 /*StorageKind=*/Record
[ASTStmtReader::NumExprFields
]));
2928 case EXPR_SYCL_UNIQUE_STABLE_NAME
:
2929 S
= SYCLUniqueStableNameExpr::CreateEmpty(Context
);
2932 case EXPR_PREDEFINED
:
2933 S
= PredefinedExpr::CreateEmpty(
2935 /*HasFunctionName*/ Record
[ASTStmtReader::NumExprFields
]);
2939 S
= DeclRefExpr::CreateEmpty(
2941 /*HasQualifier=*/Record
[ASTStmtReader::NumExprFields
],
2942 /*HasFoundDecl=*/Record
[ASTStmtReader::NumExprFields
+ 1],
2943 /*HasTemplateKWAndArgsInfo=*/Record
[ASTStmtReader::NumExprFields
+ 2],
2944 /*NumTemplateArgs=*/
2945 Record
[ASTStmtReader::NumExprFields
+ 2]
2946 ? Record
[ASTStmtReader::NumExprFields
+ 7]
2950 case EXPR_INTEGER_LITERAL
:
2951 S
= IntegerLiteral::Create(Context
, Empty
);
2954 case EXPR_FIXEDPOINT_LITERAL
:
2955 S
= FixedPointLiteral::Create(Context
, Empty
);
2958 case EXPR_FLOATING_LITERAL
:
2959 S
= FloatingLiteral::Create(Context
, Empty
);
2962 case EXPR_IMAGINARY_LITERAL
:
2963 S
= new (Context
) ImaginaryLiteral(Empty
);
2966 case EXPR_STRING_LITERAL
:
2967 S
= StringLiteral::CreateEmpty(
2969 /* NumConcatenated=*/Record
[ASTStmtReader::NumExprFields
],
2970 /* Length=*/Record
[ASTStmtReader::NumExprFields
+ 1],
2971 /* CharByteWidth=*/Record
[ASTStmtReader::NumExprFields
+ 2]);
2974 case EXPR_CHARACTER_LITERAL
:
2975 S
= new (Context
) CharacterLiteral(Empty
);
2979 S
= new (Context
) ParenExpr(Empty
);
2982 case EXPR_PAREN_LIST
:
2983 S
= ParenListExpr::CreateEmpty(
2985 /* NumExprs=*/Record
[ASTStmtReader::NumExprFields
]);
2988 case EXPR_UNARY_OPERATOR
:
2989 S
= UnaryOperator::CreateEmpty(Context
,
2990 Record
[ASTStmtReader::NumExprFields
]);
2994 S
= OffsetOfExpr::CreateEmpty(Context
,
2995 Record
[ASTStmtReader::NumExprFields
],
2996 Record
[ASTStmtReader::NumExprFields
+ 1]);
2999 case EXPR_SIZEOF_ALIGN_OF
:
3000 S
= new (Context
) UnaryExprOrTypeTraitExpr(Empty
);
3003 case EXPR_ARRAY_SUBSCRIPT
:
3004 S
= new (Context
) ArraySubscriptExpr(Empty
);
3007 case EXPR_MATRIX_SUBSCRIPT
:
3008 S
= new (Context
) MatrixSubscriptExpr(Empty
);
3011 case EXPR_OMP_ARRAY_SECTION
:
3012 S
= new (Context
) OMPArraySectionExpr(Empty
);
3015 case EXPR_OMP_ARRAY_SHAPING
:
3016 S
= OMPArrayShapingExpr::CreateEmpty(
3017 Context
, Record
[ASTStmtReader::NumExprFields
]);
3020 case EXPR_OMP_ITERATOR
:
3021 S
= OMPIteratorExpr::CreateEmpty(Context
,
3022 Record
[ASTStmtReader::NumExprFields
]);
3026 S
= CallExpr::CreateEmpty(
3027 Context
, /*NumArgs=*/Record
[ASTStmtReader::NumExprFields
],
3028 /*HasFPFeatures=*/Record
[ASTStmtReader::NumExprFields
+ 1], Empty
);
3032 S
= RecoveryExpr::CreateEmpty(
3033 Context
, /*NumArgs=*/Record
[ASTStmtReader::NumExprFields
]);
3037 S
= MemberExpr::CreateEmpty(Context
, Record
[ASTStmtReader::NumExprFields
],
3038 Record
[ASTStmtReader::NumExprFields
+ 1],
3039 Record
[ASTStmtReader::NumExprFields
+ 2],
3040 Record
[ASTStmtReader::NumExprFields
+ 3]);
3043 case EXPR_BINARY_OPERATOR
:
3044 S
= BinaryOperator::CreateEmpty(Context
,
3045 Record
[ASTStmtReader::NumExprFields
]);
3048 case EXPR_COMPOUND_ASSIGN_OPERATOR
:
3049 S
= CompoundAssignOperator::CreateEmpty(
3050 Context
, Record
[ASTStmtReader::NumExprFields
]);
3053 case EXPR_CONDITIONAL_OPERATOR
:
3054 S
= new (Context
) ConditionalOperator(Empty
);
3057 case EXPR_BINARY_CONDITIONAL_OPERATOR
:
3058 S
= new (Context
) BinaryConditionalOperator(Empty
);
3061 case EXPR_IMPLICIT_CAST
:
3062 S
= ImplicitCastExpr::CreateEmpty(
3064 /*PathSize*/ Record
[ASTStmtReader::NumExprFields
],
3065 /*HasFPFeatures*/ Record
[ASTStmtReader::NumExprFields
+ 1]);
3068 case EXPR_CSTYLE_CAST
:
3069 S
= CStyleCastExpr::CreateEmpty(
3071 /*PathSize*/ Record
[ASTStmtReader::NumExprFields
],
3072 /*HasFPFeatures*/ Record
[ASTStmtReader::NumExprFields
+ 1]);
3075 case EXPR_COMPOUND_LITERAL
:
3076 S
= new (Context
) CompoundLiteralExpr(Empty
);
3079 case EXPR_EXT_VECTOR_ELEMENT
:
3080 S
= new (Context
) ExtVectorElementExpr(Empty
);
3083 case EXPR_INIT_LIST
:
3084 S
= new (Context
) InitListExpr(Empty
);
3087 case EXPR_DESIGNATED_INIT
:
3088 S
= DesignatedInitExpr::CreateEmpty(Context
,
3089 Record
[ASTStmtReader::NumExprFields
] - 1);
3093 case EXPR_DESIGNATED_INIT_UPDATE
:
3094 S
= new (Context
) DesignatedInitUpdateExpr(Empty
);
3097 case EXPR_IMPLICIT_VALUE_INIT
:
3098 S
= new (Context
) ImplicitValueInitExpr(Empty
);
3102 S
= new (Context
) NoInitExpr(Empty
);
3105 case EXPR_ARRAY_INIT_LOOP
:
3106 S
= new (Context
) ArrayInitLoopExpr(Empty
);
3109 case EXPR_ARRAY_INIT_INDEX
:
3110 S
= new (Context
) ArrayInitIndexExpr(Empty
);
3114 S
= new (Context
) VAArgExpr(Empty
);
3117 case EXPR_SOURCE_LOC
:
3118 S
= new (Context
) SourceLocExpr(Empty
);
3121 case EXPR_ADDR_LABEL
:
3122 S
= new (Context
) AddrLabelExpr(Empty
);
3126 S
= new (Context
) StmtExpr(Empty
);
3130 S
= new (Context
) ChooseExpr(Empty
);
3134 S
= new (Context
) GNUNullExpr(Empty
);
3137 case EXPR_SHUFFLE_VECTOR
:
3138 S
= new (Context
) ShuffleVectorExpr(Empty
);
3141 case EXPR_CONVERT_VECTOR
:
3142 S
= new (Context
) ConvertVectorExpr(Empty
);
3146 S
= new (Context
) BlockExpr(Empty
);
3149 case EXPR_GENERIC_SELECTION
:
3150 S
= GenericSelectionExpr::CreateEmpty(
3152 /*NumAssocs=*/Record
[ASTStmtReader::NumExprFields
]);
3155 case EXPR_OBJC_STRING_LITERAL
:
3156 S
= new (Context
) ObjCStringLiteral(Empty
);
3159 case EXPR_OBJC_BOXED_EXPRESSION
:
3160 S
= new (Context
) ObjCBoxedExpr(Empty
);
3163 case EXPR_OBJC_ARRAY_LITERAL
:
3164 S
= ObjCArrayLiteral::CreateEmpty(Context
,
3165 Record
[ASTStmtReader::NumExprFields
]);
3168 case EXPR_OBJC_DICTIONARY_LITERAL
:
3169 S
= ObjCDictionaryLiteral::CreateEmpty(Context
,
3170 Record
[ASTStmtReader::NumExprFields
],
3171 Record
[ASTStmtReader::NumExprFields
+ 1]);
3174 case EXPR_OBJC_ENCODE
:
3175 S
= new (Context
) ObjCEncodeExpr(Empty
);
3178 case EXPR_OBJC_SELECTOR_EXPR
:
3179 S
= new (Context
) ObjCSelectorExpr(Empty
);
3182 case EXPR_OBJC_PROTOCOL_EXPR
:
3183 S
= new (Context
) ObjCProtocolExpr(Empty
);
3186 case EXPR_OBJC_IVAR_REF_EXPR
:
3187 S
= new (Context
) ObjCIvarRefExpr(Empty
);
3190 case EXPR_OBJC_PROPERTY_REF_EXPR
:
3191 S
= new (Context
) ObjCPropertyRefExpr(Empty
);
3194 case EXPR_OBJC_SUBSCRIPT_REF_EXPR
:
3195 S
= new (Context
) ObjCSubscriptRefExpr(Empty
);
3198 case EXPR_OBJC_KVC_REF_EXPR
:
3199 llvm_unreachable("mismatching AST file");
3201 case EXPR_OBJC_MESSAGE_EXPR
:
3202 S
= ObjCMessageExpr::CreateEmpty(Context
,
3203 Record
[ASTStmtReader::NumExprFields
],
3204 Record
[ASTStmtReader::NumExprFields
+ 1]);
3208 S
= new (Context
) ObjCIsaExpr(Empty
);
3211 case EXPR_OBJC_INDIRECT_COPY_RESTORE
:
3212 S
= new (Context
) ObjCIndirectCopyRestoreExpr(Empty
);
3215 case EXPR_OBJC_BRIDGED_CAST
:
3216 S
= new (Context
) ObjCBridgedCastExpr(Empty
);
3219 case STMT_OBJC_FOR_COLLECTION
:
3220 S
= new (Context
) ObjCForCollectionStmt(Empty
);
3223 case STMT_OBJC_CATCH
:
3224 S
= new (Context
) ObjCAtCatchStmt(Empty
);
3227 case STMT_OBJC_FINALLY
:
3228 S
= new (Context
) ObjCAtFinallyStmt(Empty
);
3231 case STMT_OBJC_AT_TRY
:
3232 S
= ObjCAtTryStmt::CreateEmpty(Context
,
3233 Record
[ASTStmtReader::NumStmtFields
],
3234 Record
[ASTStmtReader::NumStmtFields
+ 1]);
3237 case STMT_OBJC_AT_SYNCHRONIZED
:
3238 S
= new (Context
) ObjCAtSynchronizedStmt(Empty
);
3241 case STMT_OBJC_AT_THROW
:
3242 S
= new (Context
) ObjCAtThrowStmt(Empty
);
3245 case STMT_OBJC_AUTORELEASE_POOL
:
3246 S
= new (Context
) ObjCAutoreleasePoolStmt(Empty
);
3249 case EXPR_OBJC_BOOL_LITERAL
:
3250 S
= new (Context
) ObjCBoolLiteralExpr(Empty
);
3253 case EXPR_OBJC_AVAILABILITY_CHECK
:
3254 S
= new (Context
) ObjCAvailabilityCheckExpr(Empty
);
3257 case STMT_SEH_LEAVE
:
3258 S
= new (Context
) SEHLeaveStmt(Empty
);
3261 case STMT_SEH_EXCEPT
:
3262 S
= new (Context
) SEHExceptStmt(Empty
);
3265 case STMT_SEH_FINALLY
:
3266 S
= new (Context
) SEHFinallyStmt(Empty
);
3270 S
= new (Context
) SEHTryStmt(Empty
);
3273 case STMT_CXX_CATCH
:
3274 S
= new (Context
) CXXCatchStmt(Empty
);
3278 S
= CXXTryStmt::Create(Context
, Empty
,
3279 /*numHandlers=*/Record
[ASTStmtReader::NumStmtFields
]);
3282 case STMT_CXX_FOR_RANGE
:
3283 S
= new (Context
) CXXForRangeStmt(Empty
);
3286 case STMT_MS_DEPENDENT_EXISTS
:
3287 S
= new (Context
) MSDependentExistsStmt(SourceLocation(), true,
3288 NestedNameSpecifierLoc(),
3289 DeclarationNameInfo(),
3293 case STMT_OMP_CANONICAL_LOOP
:
3294 S
= OMPCanonicalLoop::createEmpty(Context
);
3297 case STMT_OMP_META_DIRECTIVE
:
3298 S
= OMPMetaDirective::CreateEmpty(
3299 Context
, Record
[ASTStmtReader::NumStmtFields
], Empty
);
3302 case STMT_OMP_PARALLEL_DIRECTIVE
:
3304 OMPParallelDirective::CreateEmpty(Context
,
3305 Record
[ASTStmtReader::NumStmtFields
],
3309 case STMT_OMP_SIMD_DIRECTIVE
: {
3310 unsigned CollapsedNum
= Record
[ASTStmtReader::NumStmtFields
];
3311 unsigned NumClauses
= Record
[ASTStmtReader::NumStmtFields
+ 1];
3312 S
= OMPSimdDirective::CreateEmpty(Context
, NumClauses
,
3313 CollapsedNum
, Empty
);
3317 case STMT_OMP_TILE_DIRECTIVE
: {
3318 unsigned NumLoops
= Record
[ASTStmtReader::NumStmtFields
];
3319 unsigned NumClauses
= Record
[ASTStmtReader::NumStmtFields
+ 1];
3320 S
= OMPTileDirective::CreateEmpty(Context
, NumClauses
, NumLoops
);
3324 case STMT_OMP_UNROLL_DIRECTIVE
: {
3325 assert(Record
[ASTStmtReader::NumStmtFields
] == 1 && "Unroll directive accepts only a single loop");
3326 unsigned NumClauses
= Record
[ASTStmtReader::NumStmtFields
+ 1];
3327 S
= OMPUnrollDirective::CreateEmpty(Context
, NumClauses
);
3331 case STMT_OMP_FOR_DIRECTIVE
: {
3332 unsigned CollapsedNum
= Record
[ASTStmtReader::NumStmtFields
];
3333 unsigned NumClauses
= Record
[ASTStmtReader::NumStmtFields
+ 1];
3334 S
= OMPForDirective::CreateEmpty(Context
, NumClauses
, CollapsedNum
,
3339 case STMT_OMP_FOR_SIMD_DIRECTIVE
: {
3340 unsigned CollapsedNum
= Record
[ASTStmtReader::NumStmtFields
];
3341 unsigned NumClauses
= Record
[ASTStmtReader::NumStmtFields
+ 1];
3342 S
= OMPForSimdDirective::CreateEmpty(Context
, NumClauses
, CollapsedNum
,
3347 case STMT_OMP_SECTIONS_DIRECTIVE
:
3348 S
= OMPSectionsDirective::CreateEmpty(
3349 Context
, Record
[ASTStmtReader::NumStmtFields
], Empty
);
3352 case STMT_OMP_SECTION_DIRECTIVE
:
3353 S
= OMPSectionDirective::CreateEmpty(Context
, Empty
);
3356 case STMT_OMP_SCOPE_DIRECTIVE
:
3357 S
= OMPScopeDirective::CreateEmpty(
3358 Context
, Record
[ASTStmtReader::NumStmtFields
], Empty
);
3361 case STMT_OMP_SINGLE_DIRECTIVE
:
3362 S
= OMPSingleDirective::CreateEmpty(
3363 Context
, Record
[ASTStmtReader::NumStmtFields
], Empty
);
3366 case STMT_OMP_MASTER_DIRECTIVE
:
3367 S
= OMPMasterDirective::CreateEmpty(Context
, Empty
);
3370 case STMT_OMP_CRITICAL_DIRECTIVE
:
3371 S
= OMPCriticalDirective::CreateEmpty(
3372 Context
, Record
[ASTStmtReader::NumStmtFields
], Empty
);
3375 case STMT_OMP_PARALLEL_FOR_DIRECTIVE
: {
3376 unsigned CollapsedNum
= Record
[ASTStmtReader::NumStmtFields
];
3377 unsigned NumClauses
= Record
[ASTStmtReader::NumStmtFields
+ 1];
3378 S
= OMPParallelForDirective::CreateEmpty(Context
, NumClauses
,
3379 CollapsedNum
, Empty
);
3383 case STMT_OMP_PARALLEL_FOR_SIMD_DIRECTIVE
: {
3384 unsigned CollapsedNum
= Record
[ASTStmtReader::NumStmtFields
];
3385 unsigned NumClauses
= Record
[ASTStmtReader::NumStmtFields
+ 1];
3386 S
= OMPParallelForSimdDirective::CreateEmpty(Context
, NumClauses
,
3387 CollapsedNum
, Empty
);
3391 case STMT_OMP_PARALLEL_MASTER_DIRECTIVE
:
3392 S
= OMPParallelMasterDirective::CreateEmpty(
3393 Context
, Record
[ASTStmtReader::NumStmtFields
], Empty
);
3396 case STMT_OMP_PARALLEL_MASKED_DIRECTIVE
:
3397 S
= OMPParallelMaskedDirective::CreateEmpty(
3398 Context
, Record
[ASTStmtReader::NumStmtFields
], Empty
);
3401 case STMT_OMP_PARALLEL_SECTIONS_DIRECTIVE
:
3402 S
= OMPParallelSectionsDirective::CreateEmpty(
3403 Context
, Record
[ASTStmtReader::NumStmtFields
], Empty
);
3406 case STMT_OMP_TASK_DIRECTIVE
:
3407 S
= OMPTaskDirective::CreateEmpty(
3408 Context
, Record
[ASTStmtReader::NumStmtFields
], Empty
);
3411 case STMT_OMP_TASKYIELD_DIRECTIVE
:
3412 S
= OMPTaskyieldDirective::CreateEmpty(Context
, Empty
);
3415 case STMT_OMP_BARRIER_DIRECTIVE
:
3416 S
= OMPBarrierDirective::CreateEmpty(Context
, Empty
);
3419 case STMT_OMP_TASKWAIT_DIRECTIVE
:
3420 S
= OMPTaskwaitDirective::CreateEmpty(
3421 Context
, Record
[ASTStmtReader::NumStmtFields
], Empty
);
3424 case STMT_OMP_ERROR_DIRECTIVE
:
3425 S
= OMPErrorDirective::CreateEmpty(
3426 Context
, Record
[ASTStmtReader::NumStmtFields
], Empty
);
3429 case STMT_OMP_TASKGROUP_DIRECTIVE
:
3430 S
= OMPTaskgroupDirective::CreateEmpty(
3431 Context
, Record
[ASTStmtReader::NumStmtFields
], Empty
);
3434 case STMT_OMP_FLUSH_DIRECTIVE
:
3435 S
= OMPFlushDirective::CreateEmpty(
3436 Context
, Record
[ASTStmtReader::NumStmtFields
], Empty
);
3439 case STMT_OMP_DEPOBJ_DIRECTIVE
:
3440 S
= OMPDepobjDirective::CreateEmpty(
3441 Context
, Record
[ASTStmtReader::NumStmtFields
], Empty
);
3444 case STMT_OMP_SCAN_DIRECTIVE
:
3445 S
= OMPScanDirective::CreateEmpty(
3446 Context
, Record
[ASTStmtReader::NumStmtFields
], Empty
);
3449 case STMT_OMP_ORDERED_DIRECTIVE
: {
3450 unsigned NumClauses
= Record
[ASTStmtReader::NumStmtFields
];
3451 bool HasAssociatedStmt
= Record
[ASTStmtReader::NumStmtFields
+ 2];
3452 S
= OMPOrderedDirective::CreateEmpty(Context
, NumClauses
,
3453 !HasAssociatedStmt
, Empty
);
3457 case STMT_OMP_ATOMIC_DIRECTIVE
:
3458 S
= OMPAtomicDirective::CreateEmpty(
3459 Context
, Record
[ASTStmtReader::NumStmtFields
], Empty
);
3462 case STMT_OMP_TARGET_DIRECTIVE
:
3463 S
= OMPTargetDirective::CreateEmpty(
3464 Context
, Record
[ASTStmtReader::NumStmtFields
], Empty
);
3467 case STMT_OMP_TARGET_DATA_DIRECTIVE
:
3468 S
= OMPTargetDataDirective::CreateEmpty(
3469 Context
, Record
[ASTStmtReader::NumStmtFields
], Empty
);
3472 case STMT_OMP_TARGET_ENTER_DATA_DIRECTIVE
:
3473 S
= OMPTargetEnterDataDirective::CreateEmpty(
3474 Context
, Record
[ASTStmtReader::NumStmtFields
], Empty
);
3477 case STMT_OMP_TARGET_EXIT_DATA_DIRECTIVE
:
3478 S
= OMPTargetExitDataDirective::CreateEmpty(
3479 Context
, Record
[ASTStmtReader::NumStmtFields
], Empty
);
3482 case STMT_OMP_TARGET_PARALLEL_DIRECTIVE
:
3483 S
= OMPTargetParallelDirective::CreateEmpty(
3484 Context
, Record
[ASTStmtReader::NumStmtFields
], Empty
);
3487 case STMT_OMP_TARGET_PARALLEL_FOR_DIRECTIVE
: {
3488 unsigned CollapsedNum
= Record
[ASTStmtReader::NumStmtFields
];
3489 unsigned NumClauses
= Record
[ASTStmtReader::NumStmtFields
+ 1];
3490 S
= OMPTargetParallelForDirective::CreateEmpty(Context
, NumClauses
,
3491 CollapsedNum
, Empty
);
3495 case STMT_OMP_TARGET_UPDATE_DIRECTIVE
:
3496 S
= OMPTargetUpdateDirective::CreateEmpty(
3497 Context
, Record
[ASTStmtReader::NumStmtFields
], Empty
);
3500 case STMT_OMP_TEAMS_DIRECTIVE
:
3501 S
= OMPTeamsDirective::CreateEmpty(
3502 Context
, Record
[ASTStmtReader::NumStmtFields
], Empty
);
3505 case STMT_OMP_CANCELLATION_POINT_DIRECTIVE
:
3506 S
= OMPCancellationPointDirective::CreateEmpty(Context
, Empty
);
3509 case STMT_OMP_CANCEL_DIRECTIVE
:
3510 S
= OMPCancelDirective::CreateEmpty(
3511 Context
, Record
[ASTStmtReader::NumStmtFields
], Empty
);
3514 case STMT_OMP_TASKLOOP_DIRECTIVE
: {
3515 unsigned CollapsedNum
= Record
[ASTStmtReader::NumStmtFields
];
3516 unsigned NumClauses
= Record
[ASTStmtReader::NumStmtFields
+ 1];
3517 S
= OMPTaskLoopDirective::CreateEmpty(Context
, NumClauses
, CollapsedNum
,
3522 case STMT_OMP_TASKLOOP_SIMD_DIRECTIVE
: {
3523 unsigned CollapsedNum
= Record
[ASTStmtReader::NumStmtFields
];
3524 unsigned NumClauses
= Record
[ASTStmtReader::NumStmtFields
+ 1];
3525 S
= OMPTaskLoopSimdDirective::CreateEmpty(Context
, NumClauses
,
3526 CollapsedNum
, Empty
);
3530 case STMT_OMP_MASTER_TASKLOOP_DIRECTIVE
: {
3531 unsigned CollapsedNum
= Record
[ASTStmtReader::NumStmtFields
];
3532 unsigned NumClauses
= Record
[ASTStmtReader::NumStmtFields
+ 1];
3533 S
= OMPMasterTaskLoopDirective::CreateEmpty(Context
, NumClauses
,
3534 CollapsedNum
, Empty
);
3538 case STMT_OMP_MASKED_TASKLOOP_DIRECTIVE
: {
3539 unsigned CollapsedNum
= Record
[ASTStmtReader::NumStmtFields
];
3540 unsigned NumClauses
= Record
[ASTStmtReader::NumStmtFields
+ 1];
3541 S
= OMPMaskedTaskLoopDirective::CreateEmpty(Context
, NumClauses
,
3542 CollapsedNum
, Empty
);
3546 case STMT_OMP_MASTER_TASKLOOP_SIMD_DIRECTIVE
: {
3547 unsigned CollapsedNum
= Record
[ASTStmtReader::NumStmtFields
];
3548 unsigned NumClauses
= Record
[ASTStmtReader::NumStmtFields
+ 1];
3549 S
= OMPMasterTaskLoopSimdDirective::CreateEmpty(Context
, NumClauses
,
3550 CollapsedNum
, Empty
);
3554 case STMT_OMP_MASKED_TASKLOOP_SIMD_DIRECTIVE
: {
3555 unsigned CollapsedNum
= Record
[ASTStmtReader::NumStmtFields
];
3556 unsigned NumClauses
= Record
[ASTStmtReader::NumStmtFields
+ 1];
3557 S
= OMPMaskedTaskLoopSimdDirective::CreateEmpty(Context
, NumClauses
,
3558 CollapsedNum
, Empty
);
3562 case STMT_OMP_PARALLEL_MASTER_TASKLOOP_DIRECTIVE
: {
3563 unsigned CollapsedNum
= Record
[ASTStmtReader::NumStmtFields
];
3564 unsigned NumClauses
= Record
[ASTStmtReader::NumStmtFields
+ 1];
3565 S
= OMPParallelMasterTaskLoopDirective::CreateEmpty(Context
, NumClauses
,
3566 CollapsedNum
, Empty
);
3570 case STMT_OMP_PARALLEL_MASKED_TASKLOOP_DIRECTIVE
: {
3571 unsigned CollapsedNum
= Record
[ASTStmtReader::NumStmtFields
];
3572 unsigned NumClauses
= Record
[ASTStmtReader::NumStmtFields
+ 1];
3573 S
= OMPParallelMaskedTaskLoopDirective::CreateEmpty(Context
, NumClauses
,
3574 CollapsedNum
, Empty
);
3578 case STMT_OMP_PARALLEL_MASTER_TASKLOOP_SIMD_DIRECTIVE
: {
3579 unsigned CollapsedNum
= Record
[ASTStmtReader::NumStmtFields
];
3580 unsigned NumClauses
= Record
[ASTStmtReader::NumStmtFields
+ 1];
3581 S
= OMPParallelMasterTaskLoopSimdDirective::CreateEmpty(
3582 Context
, NumClauses
, CollapsedNum
, Empty
);
3586 case STMT_OMP_PARALLEL_MASKED_TASKLOOP_SIMD_DIRECTIVE
: {
3587 unsigned CollapsedNum
= Record
[ASTStmtReader::NumStmtFields
];
3588 unsigned NumClauses
= Record
[ASTStmtReader::NumStmtFields
+ 1];
3589 S
= OMPParallelMaskedTaskLoopSimdDirective::CreateEmpty(
3590 Context
, NumClauses
, CollapsedNum
, Empty
);
3594 case STMT_OMP_DISTRIBUTE_DIRECTIVE
: {
3595 unsigned CollapsedNum
= Record
[ASTStmtReader::NumStmtFields
];
3596 unsigned NumClauses
= Record
[ASTStmtReader::NumStmtFields
+ 1];
3597 S
= OMPDistributeDirective::CreateEmpty(Context
, NumClauses
, CollapsedNum
,
3602 case STMT_OMP_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE
: {
3603 unsigned CollapsedNum
= Record
[ASTStmtReader::NumStmtFields
];
3604 unsigned NumClauses
= Record
[ASTStmtReader::NumStmtFields
+ 1];
3605 S
= OMPDistributeParallelForDirective::CreateEmpty(Context
, NumClauses
,
3606 CollapsedNum
, Empty
);
3610 case STMT_OMP_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE
: {
3611 unsigned CollapsedNum
= Record
[ASTStmtReader::NumStmtFields
];
3612 unsigned NumClauses
= Record
[ASTStmtReader::NumStmtFields
+ 1];
3613 S
= OMPDistributeParallelForSimdDirective::CreateEmpty(Context
, NumClauses
,
3619 case STMT_OMP_DISTRIBUTE_SIMD_DIRECTIVE
: {
3620 unsigned CollapsedNum
= Record
[ASTStmtReader::NumStmtFields
];
3621 unsigned NumClauses
= Record
[ASTStmtReader::NumStmtFields
+ 1];
3622 S
= OMPDistributeSimdDirective::CreateEmpty(Context
, NumClauses
,
3623 CollapsedNum
, Empty
);
3627 case STMT_OMP_TARGET_PARALLEL_FOR_SIMD_DIRECTIVE
: {
3628 unsigned CollapsedNum
= Record
[ASTStmtReader::NumStmtFields
];
3629 unsigned NumClauses
= Record
[ASTStmtReader::NumStmtFields
+ 1];
3630 S
= OMPTargetParallelForSimdDirective::CreateEmpty(Context
, NumClauses
,
3631 CollapsedNum
, Empty
);
3635 case STMT_OMP_TARGET_SIMD_DIRECTIVE
: {
3636 unsigned CollapsedNum
= Record
[ASTStmtReader::NumStmtFields
];
3637 unsigned NumClauses
= Record
[ASTStmtReader::NumStmtFields
+ 1];
3638 S
= OMPTargetSimdDirective::CreateEmpty(Context
, NumClauses
, CollapsedNum
,
3643 case STMT_OMP_TEAMS_DISTRIBUTE_DIRECTIVE
: {
3644 unsigned CollapsedNum
= Record
[ASTStmtReader::NumStmtFields
];
3645 unsigned NumClauses
= Record
[ASTStmtReader::NumStmtFields
+ 1];
3646 S
= OMPTeamsDistributeDirective::CreateEmpty(Context
, NumClauses
,
3647 CollapsedNum
, Empty
);
3651 case STMT_OMP_TEAMS_DISTRIBUTE_SIMD_DIRECTIVE
: {
3652 unsigned CollapsedNum
= Record
[ASTStmtReader::NumStmtFields
];
3653 unsigned NumClauses
= Record
[ASTStmtReader::NumStmtFields
+ 1];
3654 S
= OMPTeamsDistributeSimdDirective::CreateEmpty(Context
, NumClauses
,
3655 CollapsedNum
, Empty
);
3659 case STMT_OMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE
: {
3660 unsigned CollapsedNum
= Record
[ASTStmtReader::NumStmtFields
];
3661 unsigned NumClauses
= Record
[ASTStmtReader::NumStmtFields
+ 1];
3662 S
= OMPTeamsDistributeParallelForSimdDirective::CreateEmpty(
3663 Context
, NumClauses
, CollapsedNum
, Empty
);
3667 case STMT_OMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE
: {
3668 unsigned CollapsedNum
= Record
[ASTStmtReader::NumStmtFields
];
3669 unsigned NumClauses
= Record
[ASTStmtReader::NumStmtFields
+ 1];
3670 S
= OMPTeamsDistributeParallelForDirective::CreateEmpty(
3671 Context
, NumClauses
, CollapsedNum
, Empty
);
3675 case STMT_OMP_TARGET_TEAMS_DIRECTIVE
:
3676 S
= OMPTargetTeamsDirective::CreateEmpty(
3677 Context
, Record
[ASTStmtReader::NumStmtFields
], Empty
);
3680 case STMT_OMP_TARGET_TEAMS_DISTRIBUTE_DIRECTIVE
: {
3681 unsigned CollapsedNum
= Record
[ASTStmtReader::NumStmtFields
];
3682 unsigned NumClauses
= Record
[ASTStmtReader::NumStmtFields
+ 1];
3683 S
= OMPTargetTeamsDistributeDirective::CreateEmpty(Context
, NumClauses
,
3684 CollapsedNum
, Empty
);
3688 case STMT_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE
: {
3689 unsigned CollapsedNum
= Record
[ASTStmtReader::NumStmtFields
];
3690 unsigned NumClauses
= Record
[ASTStmtReader::NumStmtFields
+ 1];
3691 S
= OMPTargetTeamsDistributeParallelForDirective::CreateEmpty(
3692 Context
, NumClauses
, CollapsedNum
, Empty
);
3696 case STMT_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE
: {
3697 unsigned CollapsedNum
= Record
[ASTStmtReader::NumStmtFields
];
3698 unsigned NumClauses
= Record
[ASTStmtReader::NumStmtFields
+ 1];
3699 S
= OMPTargetTeamsDistributeParallelForSimdDirective::CreateEmpty(
3700 Context
, NumClauses
, CollapsedNum
, Empty
);
3704 case STMT_OMP_TARGET_TEAMS_DISTRIBUTE_SIMD_DIRECTIVE
: {
3705 unsigned CollapsedNum
= Record
[ASTStmtReader::NumStmtFields
];
3706 unsigned NumClauses
= Record
[ASTStmtReader::NumStmtFields
+ 1];
3707 S
= OMPTargetTeamsDistributeSimdDirective::CreateEmpty(
3708 Context
, NumClauses
, CollapsedNum
, Empty
);
3712 case STMT_OMP_INTEROP_DIRECTIVE
:
3713 S
= OMPInteropDirective::CreateEmpty(
3714 Context
, Record
[ASTStmtReader::NumStmtFields
], Empty
);
3717 case STMT_OMP_DISPATCH_DIRECTIVE
:
3718 S
= OMPDispatchDirective::CreateEmpty(
3719 Context
, Record
[ASTStmtReader::NumStmtFields
], Empty
);
3722 case STMT_OMP_MASKED_DIRECTIVE
:
3723 S
= OMPMaskedDirective::CreateEmpty(
3724 Context
, Record
[ASTStmtReader::NumStmtFields
], Empty
);
3727 case STMT_OMP_GENERIC_LOOP_DIRECTIVE
: {
3728 unsigned CollapsedNum
= Record
[ASTStmtReader::NumStmtFields
];
3729 unsigned NumClauses
= Record
[ASTStmtReader::NumStmtFields
+ 1];
3730 S
= OMPGenericLoopDirective::CreateEmpty(Context
, NumClauses
,
3731 CollapsedNum
, Empty
);
3735 case STMT_OMP_TEAMS_GENERIC_LOOP_DIRECTIVE
: {
3736 unsigned CollapsedNum
= Record
[ASTStmtReader::NumStmtFields
];
3737 unsigned NumClauses
= Record
[ASTStmtReader::NumStmtFields
+ 1];
3738 S
= OMPTeamsGenericLoopDirective::CreateEmpty(Context
, NumClauses
,
3739 CollapsedNum
, Empty
);
3743 case STMT_OMP_TARGET_TEAMS_GENERIC_LOOP_DIRECTIVE
: {
3744 unsigned CollapsedNum
= Record
[ASTStmtReader::NumStmtFields
];
3745 unsigned NumClauses
= Record
[ASTStmtReader::NumStmtFields
+ 1];
3746 S
= OMPTargetTeamsGenericLoopDirective::CreateEmpty(Context
, NumClauses
,
3747 CollapsedNum
, Empty
);
3751 case STMT_OMP_PARALLEL_GENERIC_LOOP_DIRECTIVE
: {
3752 unsigned CollapsedNum
= Record
[ASTStmtReader::NumStmtFields
];
3753 unsigned NumClauses
= Record
[ASTStmtReader::NumStmtFields
+ 1];
3754 S
= OMPParallelGenericLoopDirective::CreateEmpty(Context
, NumClauses
,
3755 CollapsedNum
, Empty
);
3759 case STMT_OMP_TARGET_PARALLEL_GENERIC_LOOP_DIRECTIVE
: {
3760 unsigned CollapsedNum
= Record
[ASTStmtReader::NumStmtFields
];
3761 unsigned NumClauses
= Record
[ASTStmtReader::NumStmtFields
+ 1];
3762 S
= OMPTargetParallelGenericLoopDirective::CreateEmpty(
3763 Context
, NumClauses
, CollapsedNum
, Empty
);
3767 case EXPR_CXX_OPERATOR_CALL
:
3768 S
= CXXOperatorCallExpr::CreateEmpty(
3769 Context
, /*NumArgs=*/Record
[ASTStmtReader::NumExprFields
],
3770 /*HasFPFeatures=*/Record
[ASTStmtReader::NumExprFields
+ 1], Empty
);
3773 case EXPR_CXX_MEMBER_CALL
:
3774 S
= CXXMemberCallExpr::CreateEmpty(
3775 Context
, /*NumArgs=*/Record
[ASTStmtReader::NumExprFields
],
3776 /*HasFPFeatures=*/Record
[ASTStmtReader::NumExprFields
+ 1], Empty
);
3779 case EXPR_CXX_REWRITTEN_BINARY_OPERATOR
:
3780 S
= new (Context
) CXXRewrittenBinaryOperator(Empty
);
3783 case EXPR_CXX_CONSTRUCT
:
3784 S
= CXXConstructExpr::CreateEmpty(
3786 /* NumArgs=*/Record
[ASTStmtReader::NumExprFields
]);
3789 case EXPR_CXX_INHERITED_CTOR_INIT
:
3790 S
= new (Context
) CXXInheritedCtorInitExpr(Empty
);
3793 case EXPR_CXX_TEMPORARY_OBJECT
:
3794 S
= CXXTemporaryObjectExpr::CreateEmpty(
3796 /* NumArgs=*/Record
[ASTStmtReader::NumExprFields
]);
3799 case EXPR_CXX_STATIC_CAST
:
3800 S
= CXXStaticCastExpr::CreateEmpty(
3802 /*PathSize*/ Record
[ASTStmtReader::NumExprFields
],
3803 /*HasFPFeatures*/ Record
[ASTStmtReader::NumExprFields
+ 1]);
3806 case EXPR_CXX_DYNAMIC_CAST
:
3807 S
= CXXDynamicCastExpr::CreateEmpty(Context
,
3808 /*PathSize*/ Record
[ASTStmtReader::NumExprFields
]);
3811 case EXPR_CXX_REINTERPRET_CAST
:
3812 S
= CXXReinterpretCastExpr::CreateEmpty(Context
,
3813 /*PathSize*/ Record
[ASTStmtReader::NumExprFields
]);
3816 case EXPR_CXX_CONST_CAST
:
3817 S
= CXXConstCastExpr::CreateEmpty(Context
);
3820 case EXPR_CXX_ADDRSPACE_CAST
:
3821 S
= CXXAddrspaceCastExpr::CreateEmpty(Context
);
3824 case EXPR_CXX_FUNCTIONAL_CAST
:
3825 S
= CXXFunctionalCastExpr::CreateEmpty(
3827 /*PathSize*/ Record
[ASTStmtReader::NumExprFields
],
3828 /*HasFPFeatures*/ Record
[ASTStmtReader::NumExprFields
+ 1]);
3831 case EXPR_BUILTIN_BIT_CAST
:
3832 assert(Record
[ASTStmtReader::NumExprFields
] == 0 && "Wrong PathSize!");
3833 S
= new (Context
) BuiltinBitCastExpr(Empty
);
3836 case EXPR_USER_DEFINED_LITERAL
:
3837 S
= UserDefinedLiteral::CreateEmpty(
3838 Context
, /*NumArgs=*/Record
[ASTStmtReader::NumExprFields
],
3839 /*HasFPFeatures=*/Record
[ASTStmtReader::NumExprFields
+ 1], Empty
);
3842 case EXPR_CXX_STD_INITIALIZER_LIST
:
3843 S
= new (Context
) CXXStdInitializerListExpr(Empty
);
3846 case EXPR_CXX_BOOL_LITERAL
:
3847 S
= new (Context
) CXXBoolLiteralExpr(Empty
);
3850 case EXPR_CXX_NULL_PTR_LITERAL
:
3851 S
= new (Context
) CXXNullPtrLiteralExpr(Empty
);
3854 case EXPR_CXX_TYPEID_EXPR
:
3855 S
= new (Context
) CXXTypeidExpr(Empty
, true);
3858 case EXPR_CXX_TYPEID_TYPE
:
3859 S
= new (Context
) CXXTypeidExpr(Empty
, false);
3862 case EXPR_CXX_UUIDOF_EXPR
:
3863 S
= new (Context
) CXXUuidofExpr(Empty
, true);
3866 case EXPR_CXX_PROPERTY_REF_EXPR
:
3867 S
= new (Context
) MSPropertyRefExpr(Empty
);
3870 case EXPR_CXX_PROPERTY_SUBSCRIPT_EXPR
:
3871 S
= new (Context
) MSPropertySubscriptExpr(Empty
);
3874 case EXPR_CXX_UUIDOF_TYPE
:
3875 S
= new (Context
) CXXUuidofExpr(Empty
, false);
3879 S
= CXXThisExpr::CreateEmpty(Context
);
3882 case EXPR_CXX_THROW
:
3883 S
= new (Context
) CXXThrowExpr(Empty
);
3886 case EXPR_CXX_DEFAULT_ARG
:
3887 S
= CXXDefaultArgExpr::CreateEmpty(
3888 Context
, /*HasRewrittenInit=*/Record
[ASTStmtReader::NumExprFields
]);
3891 case EXPR_CXX_DEFAULT_INIT
:
3892 S
= CXXDefaultInitExpr::CreateEmpty(
3893 Context
, /*HasRewrittenInit=*/Record
[ASTStmtReader::NumExprFields
]);
3896 case EXPR_CXX_BIND_TEMPORARY
:
3897 S
= new (Context
) CXXBindTemporaryExpr(Empty
);
3900 case EXPR_CXX_SCALAR_VALUE_INIT
:
3901 S
= new (Context
) CXXScalarValueInitExpr(Empty
);
3905 S
= CXXNewExpr::CreateEmpty(
3907 /*IsArray=*/Record
[ASTStmtReader::NumExprFields
],
3908 /*HasInit=*/Record
[ASTStmtReader::NumExprFields
+ 1],
3909 /*NumPlacementArgs=*/Record
[ASTStmtReader::NumExprFields
+ 2],
3910 /*IsParenTypeId=*/Record
[ASTStmtReader::NumExprFields
+ 3]);
3913 case EXPR_CXX_DELETE
:
3914 S
= new (Context
) CXXDeleteExpr(Empty
);
3917 case EXPR_CXX_PSEUDO_DESTRUCTOR
:
3918 S
= new (Context
) CXXPseudoDestructorExpr(Empty
);
3921 case EXPR_EXPR_WITH_CLEANUPS
:
3922 S
= ExprWithCleanups::Create(Context
, Empty
,
3923 Record
[ASTStmtReader::NumExprFields
]);
3926 case EXPR_CXX_DEPENDENT_SCOPE_MEMBER
:
3927 S
= CXXDependentScopeMemberExpr::CreateEmpty(
3929 /*HasTemplateKWAndArgsInfo=*/Record
[ASTStmtReader::NumExprFields
],
3930 /*NumTemplateArgs=*/Record
[ASTStmtReader::NumExprFields
+ 1],
3931 /*HasFirstQualifierFoundInScope=*/
3932 Record
[ASTStmtReader::NumExprFields
+ 2]);
3935 case EXPR_CXX_DEPENDENT_SCOPE_DECL_REF
:
3936 S
= DependentScopeDeclRefExpr::CreateEmpty(Context
,
3937 /*HasTemplateKWAndArgsInfo=*/Record
[ASTStmtReader::NumExprFields
],
3938 /*NumTemplateArgs=*/Record
[ASTStmtReader::NumExprFields
]
3939 ? Record
[ASTStmtReader::NumExprFields
+ 1]
3943 case EXPR_CXX_UNRESOLVED_CONSTRUCT
:
3944 S
= CXXUnresolvedConstructExpr::CreateEmpty(Context
,
3945 /*NumArgs=*/Record
[ASTStmtReader::NumExprFields
]);
3948 case EXPR_CXX_UNRESOLVED_MEMBER
:
3949 S
= UnresolvedMemberExpr::CreateEmpty(
3951 /*NumResults=*/Record
[ASTStmtReader::NumExprFields
],
3952 /*HasTemplateKWAndArgsInfo=*/Record
[ASTStmtReader::NumExprFields
+ 1],
3953 /*NumTemplateArgs=*/
3954 Record
[ASTStmtReader::NumExprFields
+ 1]
3955 ? Record
[ASTStmtReader::NumExprFields
+ 2]
3959 case EXPR_CXX_UNRESOLVED_LOOKUP
:
3960 S
= UnresolvedLookupExpr::CreateEmpty(
3962 /*NumResults=*/Record
[ASTStmtReader::NumExprFields
],
3963 /*HasTemplateKWAndArgsInfo=*/Record
[ASTStmtReader::NumExprFields
+ 1],
3964 /*NumTemplateArgs=*/
3965 Record
[ASTStmtReader::NumExprFields
+ 1]
3966 ? Record
[ASTStmtReader::NumExprFields
+ 2]
3970 case EXPR_TYPE_TRAIT
:
3971 S
= TypeTraitExpr::CreateDeserialized(Context
,
3972 Record
[ASTStmtReader::NumExprFields
]);
3975 case EXPR_ARRAY_TYPE_TRAIT
:
3976 S
= new (Context
) ArrayTypeTraitExpr(Empty
);
3979 case EXPR_CXX_EXPRESSION_TRAIT
:
3980 S
= new (Context
) ExpressionTraitExpr(Empty
);
3983 case EXPR_CXX_NOEXCEPT
:
3984 S
= new (Context
) CXXNoexceptExpr(Empty
);
3987 case EXPR_PACK_EXPANSION
:
3988 S
= new (Context
) PackExpansionExpr(Empty
);
3991 case EXPR_SIZEOF_PACK
:
3992 S
= SizeOfPackExpr::CreateDeserialized(
3994 /*NumPartialArgs=*/Record
[ASTStmtReader::NumExprFields
]);
3997 case EXPR_SUBST_NON_TYPE_TEMPLATE_PARM
:
3998 S
= new (Context
) SubstNonTypeTemplateParmExpr(Empty
);
4001 case EXPR_SUBST_NON_TYPE_TEMPLATE_PARM_PACK
:
4002 S
= new (Context
) SubstNonTypeTemplateParmPackExpr(Empty
);
4005 case EXPR_FUNCTION_PARM_PACK
:
4006 S
= FunctionParmPackExpr::CreateEmpty(Context
,
4007 Record
[ASTStmtReader::NumExprFields
]);
4010 case EXPR_MATERIALIZE_TEMPORARY
:
4011 S
= new (Context
) MaterializeTemporaryExpr(Empty
);
4015 S
= new (Context
) CXXFoldExpr(Empty
);
4018 case EXPR_CXX_PAREN_LIST_INIT
:
4019 S
= CXXParenListInitExpr::CreateEmpty(
4020 Context
, /*numExprs=*/Record
[ASTStmtReader::NumExprFields
], Empty
);
4023 case EXPR_OPAQUE_VALUE
:
4024 S
= new (Context
) OpaqueValueExpr(Empty
);
4027 case EXPR_CUDA_KERNEL_CALL
:
4028 S
= CUDAKernelCallExpr::CreateEmpty(
4029 Context
, /*NumArgs=*/Record
[ASTStmtReader::NumExprFields
],
4030 /*HasFPFeatures=*/Record
[ASTStmtReader::NumExprFields
+ 1], Empty
);
4034 S
= new (Context
) AsTypeExpr(Empty
);
4037 case EXPR_PSEUDO_OBJECT
: {
4038 unsigned numSemanticExprs
= Record
[ASTStmtReader::NumExprFields
];
4039 S
= PseudoObjectExpr::Create(Context
, Empty
, numSemanticExprs
);
4044 S
= new (Context
) AtomicExpr(Empty
);
4048 unsigned NumCaptures
= Record
[ASTStmtReader::NumExprFields
];
4049 S
= LambdaExpr::CreateDeserialized(Context
, NumCaptures
);
4053 case STMT_COROUTINE_BODY
: {
4054 unsigned NumParams
= Record
[ASTStmtReader::NumStmtFields
];
4055 S
= CoroutineBodyStmt::Create(Context
, Empty
, NumParams
);
4060 S
= new (Context
) CoreturnStmt(Empty
);
4064 S
= new (Context
) CoawaitExpr(Empty
);
4068 S
= new (Context
) CoyieldExpr(Empty
);
4071 case EXPR_DEPENDENT_COAWAIT
:
4072 S
= new (Context
) DependentCoawaitExpr(Empty
);
4075 case EXPR_CONCEPT_SPECIALIZATION
: {
4076 S
= new (Context
) ConceptSpecializationExpr(Empty
);
4081 unsigned numLocalParameters
= Record
[ASTStmtReader::NumExprFields
];
4082 unsigned numRequirement
= Record
[ASTStmtReader::NumExprFields
+ 1];
4083 S
= RequiresExpr::Create(Context
, Empty
, numLocalParameters
,
4088 // We hit a STMT_STOP, so we're done with this expression.
4092 ++NumStatementsRead
;
4094 if (S
&& !IsStmtReference
) {
4096 StmtEntries
[Cursor
.GetCurrentBitNo()] = S
;
4099 assert(Record
.getIdx() == Record
.size() &&
4100 "Invalid deserialization of statement");
4101 StmtStack
.push_back(S
);
4104 assert(StmtStack
.size() > PrevNumStmts
&& "Read too many sub-stmts!");
4105 assert(StmtStack
.size() == PrevNumStmts
+ 1 && "Extra expressions on stack!");
4106 return StmtStack
.pop_back_val();