clang 19.0.0git
ASTReaderStmt.cpp
Go to the documentation of this file.
1//===- ASTReaderStmt.cpp - Stmt/Expr Deserialization ----------------------===//
2//
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
6//
7//===----------------------------------------------------------------------===//
8//
9// Statement/expression deserialization. This implements the
10// ASTReader::ReadStmt method.
11//
12//===----------------------------------------------------------------------===//
13
17#include "clang/AST/Decl.h"
19#include "clang/AST/DeclCXX.h"
20#include "clang/AST/DeclGroup.h"
21#include "clang/AST/DeclObjC.h"
25#include "clang/AST/Expr.h"
26#include "clang/AST/ExprCXX.h"
27#include "clang/AST/ExprObjC.h"
32#include "clang/AST/Stmt.h"
33#include "clang/AST/StmtCXX.h"
34#include "clang/AST/StmtObjC.h"
38#include "clang/AST/Type.h"
42#include "clang/Basic/LLVM.h"
43#include "clang/Basic/Lambda.h"
50#include "clang/Lex/Token.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"
61#include <algorithm>
62#include <cassert>
63#include <cstdint>
64#include <optional>
65#include <string>
66
67using namespace clang;
68using namespace serialization;
69
70namespace clang {
71
72 class ASTStmtReader : public StmtVisitor<ASTStmtReader> {
74 llvm::BitstreamCursor &DeclsCursor;
75
76 std::optional<BitsUnpacker> CurrentUnpackingBits;
77
78 SourceLocation readSourceLocation() {
79 return Record.readSourceLocation();
80 }
81
82 SourceRange readSourceRange() {
83 return Record.readSourceRange();
84 }
85
86 std::string readString() {
87 return Record.readString();
88 }
89
90 TypeSourceInfo *readTypeSourceInfo() {
91 return Record.readTypeSourceInfo();
92 }
93
94 Decl *readDecl() {
95 return Record.readDecl();
96 }
97
98 template<typename T>
99 T *readDeclAs() {
100 return Record.readDeclAs<T>();
101 }
102
103 public:
104 ASTStmtReader(ASTRecordReader &Record, llvm::BitstreamCursor &Cursor)
105 : Record(Record), DeclsCursor(Cursor) {}
106
107 /// The number of record fields required for the Stmt class
108 /// itself.
109 static const unsigned NumStmtFields = 0;
110
111 /// The number of record fields required for the Expr class
112 /// itself.
113 static const unsigned NumExprFields = NumStmtFields + 2;
114
115 /// The number of bits required for the packing bits for the Expr class.
116 static const unsigned NumExprBits = 10;
117
118 /// Read and initialize a ExplicitTemplateArgumentList structure.
120 TemplateArgumentLoc *ArgsLocArray,
121 unsigned NumTemplateArgs);
122
123 void VisitStmt(Stmt *S);
124#define STMT(Type, Base) \
125 void Visit##Type(Type *);
126#include "clang/AST/StmtNodes.inc"
127 };
128
129} // namespace clang
130
132 TemplateArgumentLoc *ArgsLocArray,
133 unsigned NumTemplateArgs) {
134 SourceLocation TemplateKWLoc = readSourceLocation();
136 ArgInfo.setLAngleLoc(readSourceLocation());
137 ArgInfo.setRAngleLoc(readSourceLocation());
138 for (unsigned i = 0; i != NumTemplateArgs; ++i)
139 ArgInfo.addArgument(Record.readTemplateArgumentLoc());
140 Args.initializeFrom(TemplateKWLoc, ArgInfo, ArgsLocArray);
141}
142
144 assert(Record.getIdx() == NumStmtFields && "Incorrect statement field count");
145}
146
147void ASTStmtReader::VisitNullStmt(NullStmt *S) {
148 VisitStmt(S);
149 S->setSemiLoc(readSourceLocation());
150 S->NullStmtBits.HasLeadingEmptyMacro = Record.readInt();
151}
152
153void ASTStmtReader::VisitCompoundStmt(CompoundStmt *S) {
154 VisitStmt(S);
156 unsigned NumStmts = Record.readInt();
157 unsigned HasFPFeatures = Record.readInt();
158 assert(S->hasStoredFPFeatures() == HasFPFeatures);
159 while (NumStmts--)
160 Stmts.push_back(Record.readSubStmt());
161 S->setStmts(Stmts);
162 if (HasFPFeatures)
163 S->setStoredFPFeatures(
165 S->LBraceLoc = readSourceLocation();
166 S->RBraceLoc = readSourceLocation();
167}
168
169void ASTStmtReader::VisitSwitchCase(SwitchCase *S) {
170 VisitStmt(S);
171 Record.recordSwitchCaseID(S, Record.readInt());
172 S->setKeywordLoc(readSourceLocation());
173 S->setColonLoc(readSourceLocation());
174}
175
176void ASTStmtReader::VisitCaseStmt(CaseStmt *S) {
177 VisitSwitchCase(S);
178 bool CaseStmtIsGNURange = Record.readInt();
179 S->setLHS(Record.readSubExpr());
180 S->setSubStmt(Record.readSubStmt());
181 if (CaseStmtIsGNURange) {
182 S->setRHS(Record.readSubExpr());
183 S->setEllipsisLoc(readSourceLocation());
184 }
185}
186
187void ASTStmtReader::VisitDefaultStmt(DefaultStmt *S) {
188 VisitSwitchCase(S);
189 S->setSubStmt(Record.readSubStmt());
190}
191
192void ASTStmtReader::VisitLabelStmt(LabelStmt *S) {
193 VisitStmt(S);
194 bool IsSideEntry = Record.readInt();
195 auto *LD = readDeclAs<LabelDecl>();
196 LD->setStmt(S);
197 S->setDecl(LD);
198 S->setSubStmt(Record.readSubStmt());
199 S->setIdentLoc(readSourceLocation());
200 S->setSideEntry(IsSideEntry);
201}
202
203void ASTStmtReader::VisitAttributedStmt(AttributedStmt *S) {
204 VisitStmt(S);
205 // NumAttrs in AttributedStmt is set when creating an empty
206 // AttributedStmt in AttributedStmt::CreateEmpty, since it is needed
207 // to allocate the right amount of space for the trailing Attr *.
208 uint64_t NumAttrs = Record.readInt();
209 AttrVec Attrs;
210 Record.readAttributes(Attrs);
211 (void)NumAttrs;
212 assert(NumAttrs == S->AttributedStmtBits.NumAttrs);
213 assert(NumAttrs == Attrs.size());
214 std::copy(Attrs.begin(), Attrs.end(), S->getAttrArrayPtr());
215 S->SubStmt = Record.readSubStmt();
216 S->AttributedStmtBits.AttrLoc = readSourceLocation();
217}
218
219void ASTStmtReader::VisitIfStmt(IfStmt *S) {
220 VisitStmt(S);
221
222 CurrentUnpackingBits.emplace(Record.readInt());
223
224 bool HasElse = CurrentUnpackingBits->getNextBit();
225 bool HasVar = CurrentUnpackingBits->getNextBit();
226 bool HasInit = CurrentUnpackingBits->getNextBit();
227
228 S->setStatementKind(static_cast<IfStatementKind>(Record.readInt()));
229 S->setCond(Record.readSubExpr());
230 S->setThen(Record.readSubStmt());
231 if (HasElse)
232 S->setElse(Record.readSubStmt());
233 if (HasVar)
234 S->setConditionVariableDeclStmt(cast<DeclStmt>(Record.readSubStmt()));
235 if (HasInit)
236 S->setInit(Record.readSubStmt());
237
238 S->setIfLoc(readSourceLocation());
239 S->setLParenLoc(readSourceLocation());
240 S->setRParenLoc(readSourceLocation());
241 if (HasElse)
242 S->setElseLoc(readSourceLocation());
243}
244
245void ASTStmtReader::VisitSwitchStmt(SwitchStmt *S) {
246 VisitStmt(S);
247
248 bool HasInit = Record.readInt();
249 bool HasVar = Record.readInt();
250 bool AllEnumCasesCovered = Record.readInt();
251 if (AllEnumCasesCovered)
252 S->setAllEnumCasesCovered();
253
254 S->setCond(Record.readSubExpr());
255 S->setBody(Record.readSubStmt());
256 if (HasInit)
257 S->setInit(Record.readSubStmt());
258 if (HasVar)
259 S->setConditionVariableDeclStmt(cast<DeclStmt>(Record.readSubStmt()));
260
261 S->setSwitchLoc(readSourceLocation());
262 S->setLParenLoc(readSourceLocation());
263 S->setRParenLoc(readSourceLocation());
264
265 SwitchCase *PrevSC = nullptr;
266 for (auto E = Record.size(); Record.getIdx() != E; ) {
267 SwitchCase *SC = Record.getSwitchCaseWithID(Record.readInt());
268 if (PrevSC)
269 PrevSC->setNextSwitchCase(SC);
270 else
271 S->setSwitchCaseList(SC);
272
273 PrevSC = SC;
274 }
275}
276
277void ASTStmtReader::VisitWhileStmt(WhileStmt *S) {
278 VisitStmt(S);
279
280 bool HasVar = Record.readInt();
281
282 S->setCond(Record.readSubExpr());
283 S->setBody(Record.readSubStmt());
284 if (HasVar)
285 S->setConditionVariableDeclStmt(cast<DeclStmt>(Record.readSubStmt()));
286
287 S->setWhileLoc(readSourceLocation());
288 S->setLParenLoc(readSourceLocation());
289 S->setRParenLoc(readSourceLocation());
290}
291
292void ASTStmtReader::VisitDoStmt(DoStmt *S) {
293 VisitStmt(S);
294 S->setCond(Record.readSubExpr());
295 S->setBody(Record.readSubStmt());
296 S->setDoLoc(readSourceLocation());
297 S->setWhileLoc(readSourceLocation());
298 S->setRParenLoc(readSourceLocation());
299}
300
301void ASTStmtReader::VisitForStmt(ForStmt *S) {
302 VisitStmt(S);
303 S->setInit(Record.readSubStmt());
304 S->setCond(Record.readSubExpr());
305 S->setConditionVariableDeclStmt(cast_or_null<DeclStmt>(Record.readSubStmt()));
306 S->setInc(Record.readSubExpr());
307 S->setBody(Record.readSubStmt());
308 S->setForLoc(readSourceLocation());
309 S->setLParenLoc(readSourceLocation());
310 S->setRParenLoc(readSourceLocation());
311}
312
313void ASTStmtReader::VisitGotoStmt(GotoStmt *S) {
314 VisitStmt(S);
315 S->setLabel(readDeclAs<LabelDecl>());
316 S->setGotoLoc(readSourceLocation());
317 S->setLabelLoc(readSourceLocation());
318}
319
320void ASTStmtReader::VisitIndirectGotoStmt(IndirectGotoStmt *S) {
321 VisitStmt(S);
322 S->setGotoLoc(readSourceLocation());
323 S->setStarLoc(readSourceLocation());
324 S->setTarget(Record.readSubExpr());
325}
326
327void ASTStmtReader::VisitContinueStmt(ContinueStmt *S) {
328 VisitStmt(S);
329 S->setContinueLoc(readSourceLocation());
330}
331
332void ASTStmtReader::VisitBreakStmt(BreakStmt *S) {
333 VisitStmt(S);
334 S->setBreakLoc(readSourceLocation());
335}
336
337void ASTStmtReader::VisitReturnStmt(ReturnStmt *S) {
338 VisitStmt(S);
339
340 bool HasNRVOCandidate = Record.readInt();
341
342 S->setRetValue(Record.readSubExpr());
343 if (HasNRVOCandidate)
344 S->setNRVOCandidate(readDeclAs<VarDecl>());
345
346 S->setReturnLoc(readSourceLocation());
347}
348
349void ASTStmtReader::VisitDeclStmt(DeclStmt *S) {
350 VisitStmt(S);
351 S->setStartLoc(readSourceLocation());
352 S->setEndLoc(readSourceLocation());
353
354 if (Record.size() - Record.getIdx() == 1) {
355 // Single declaration
356 S->setDeclGroup(DeclGroupRef(readDecl()));
357 } else {
359 int N = Record.size() - Record.getIdx();
360 Decls.reserve(N);
361 for (int I = 0; I < N; ++I)
362 Decls.push_back(readDecl());
363 S->setDeclGroup(DeclGroupRef(DeclGroup::Create(Record.getContext(),
364 Decls.data(),
365 Decls.size())));
366 }
367}
368
369void ASTStmtReader::VisitAsmStmt(AsmStmt *S) {
370 VisitStmt(S);
371 S->NumOutputs = Record.readInt();
372 S->NumInputs = Record.readInt();
373 S->NumClobbers = Record.readInt();
374 S->setAsmLoc(readSourceLocation());
375 S->setVolatile(Record.readInt());
376 S->setSimple(Record.readInt());
377}
378
379void ASTStmtReader::VisitGCCAsmStmt(GCCAsmStmt *S) {
380 VisitAsmStmt(S);
381 S->NumLabels = Record.readInt();
382 S->setRParenLoc(readSourceLocation());
383 S->setAsmString(cast_or_null<StringLiteral>(Record.readSubStmt()));
384
385 unsigned NumOutputs = S->getNumOutputs();
386 unsigned NumInputs = S->getNumInputs();
387 unsigned NumClobbers = S->getNumClobbers();
388 unsigned NumLabels = S->getNumLabels();
389
390 // Outputs and inputs
394 for (unsigned I = 0, N = NumOutputs + NumInputs; I != N; ++I) {
395 Names.push_back(Record.readIdentifier());
396 Constraints.push_back(cast_or_null<StringLiteral>(Record.readSubStmt()));
397 Exprs.push_back(Record.readSubStmt());
398 }
399
400 // Constraints
402 for (unsigned I = 0; I != NumClobbers; ++I)
403 Clobbers.push_back(cast_or_null<StringLiteral>(Record.readSubStmt()));
404
405 // Labels
406 for (unsigned I = 0, N = NumLabels; I != N; ++I) {
407 Names.push_back(Record.readIdentifier());
408 Exprs.push_back(Record.readSubStmt());
409 }
410
411 S->setOutputsAndInputsAndClobbers(Record.getContext(),
412 Names.data(), Constraints.data(),
413 Exprs.data(), NumOutputs, NumInputs,
414 NumLabels,
415 Clobbers.data(), NumClobbers);
416}
417
418void ASTStmtReader::VisitMSAsmStmt(MSAsmStmt *S) {
419 VisitAsmStmt(S);
420 S->LBraceLoc = readSourceLocation();
421 S->EndLoc = readSourceLocation();
422 S->NumAsmToks = Record.readInt();
423 std::string AsmStr = readString();
424
425 // Read the tokens.
427 AsmToks.reserve(S->NumAsmToks);
428 for (unsigned i = 0, e = S->NumAsmToks; i != e; ++i) {
429 AsmToks.push_back(Record.readToken());
430 }
431
432 // The calls to reserve() for the FooData vectors are mandatory to
433 // prevent dead StringRefs in the Foo vectors.
434
435 // Read the clobbers.
436 SmallVector<std::string, 16> ClobbersData;
438 ClobbersData.reserve(S->NumClobbers);
439 Clobbers.reserve(S->NumClobbers);
440 for (unsigned i = 0, e = S->NumClobbers; i != e; ++i) {
441 ClobbersData.push_back(readString());
442 Clobbers.push_back(ClobbersData.back());
443 }
444
445 // Read the operands.
446 unsigned NumOperands = S->NumOutputs + S->NumInputs;
448 SmallVector<std::string, 16> ConstraintsData;
449 SmallVector<StringRef, 16> Constraints;
450 Exprs.reserve(NumOperands);
451 ConstraintsData.reserve(NumOperands);
452 Constraints.reserve(NumOperands);
453 for (unsigned i = 0; i != NumOperands; ++i) {
454 Exprs.push_back(cast<Expr>(Record.readSubStmt()));
455 ConstraintsData.push_back(readString());
456 Constraints.push_back(ConstraintsData.back());
457 }
458
459 S->initialize(Record.getContext(), AsmStr, AsmToks,
460 Constraints, Exprs, Clobbers);
461}
462
463void ASTStmtReader::VisitCoroutineBodyStmt(CoroutineBodyStmt *S) {
464 VisitStmt(S);
465 assert(Record.peekInt() == S->NumParams);
466 Record.skipInts(1);
467 auto *StoredStmts = S->getStoredStmts();
468 for (unsigned i = 0;
469 i < CoroutineBodyStmt::SubStmt::FirstParamMove + S->NumParams; ++i)
470 StoredStmts[i] = Record.readSubStmt();
471}
472
473void ASTStmtReader::VisitCoreturnStmt(CoreturnStmt *S) {
474 VisitStmt(S);
475 S->CoreturnLoc = Record.readSourceLocation();
476 for (auto &SubStmt: S->SubStmts)
477 SubStmt = Record.readSubStmt();
478 S->IsImplicit = Record.readInt() != 0;
479}
480
481void ASTStmtReader::VisitCoawaitExpr(CoawaitExpr *E) {
482 VisitExpr(E);
483 E->KeywordLoc = readSourceLocation();
484 for (auto &SubExpr: E->SubExprs)
485 SubExpr = Record.readSubStmt();
486 E->OpaqueValue = cast_or_null<OpaqueValueExpr>(Record.readSubStmt());
487 E->setIsImplicit(Record.readInt() != 0);
488}
489
490void ASTStmtReader::VisitCoyieldExpr(CoyieldExpr *E) {
491 VisitExpr(E);
492 E->KeywordLoc = readSourceLocation();
493 for (auto &SubExpr: E->SubExprs)
494 SubExpr = Record.readSubStmt();
495 E->OpaqueValue = cast_or_null<OpaqueValueExpr>(Record.readSubStmt());
496}
497
498void ASTStmtReader::VisitDependentCoawaitExpr(DependentCoawaitExpr *E) {
499 VisitExpr(E);
500 E->KeywordLoc = readSourceLocation();
501 for (auto &SubExpr: E->SubExprs)
502 SubExpr = Record.readSubStmt();
503}
504
505void ASTStmtReader::VisitCapturedStmt(CapturedStmt *S) {
506 VisitStmt(S);
507 Record.skipInts(1);
508 S->setCapturedDecl(readDeclAs<CapturedDecl>());
509 S->setCapturedRegionKind(static_cast<CapturedRegionKind>(Record.readInt()));
510 S->setCapturedRecordDecl(readDeclAs<RecordDecl>());
511
512 // Capture inits
513 for (CapturedStmt::capture_init_iterator I = S->capture_init_begin(),
514 E = S->capture_init_end();
515 I != E; ++I)
516 *I = Record.readSubExpr();
517
518 // Body
519 S->setCapturedStmt(Record.readSubStmt());
520 S->getCapturedDecl()->setBody(S->getCapturedStmt());
521
522 // Captures
523 for (auto &I : S->captures()) {
524 I.VarAndKind.setPointer(readDeclAs<VarDecl>());
525 I.VarAndKind.setInt(
526 static_cast<CapturedStmt::VariableCaptureKind>(Record.readInt()));
527 I.Loc = readSourceLocation();
528 }
529}
530
531void ASTStmtReader::VisitExpr(Expr *E) {
532 VisitStmt(E);
533 CurrentUnpackingBits.emplace(Record.readInt());
534 E->setDependence(static_cast<ExprDependence>(
535 CurrentUnpackingBits->getNextBits(/*Width=*/5)));
536 E->setValueKind(static_cast<ExprValueKind>(
537 CurrentUnpackingBits->getNextBits(/*Width=*/2)));
538 E->setObjectKind(static_cast<ExprObjectKind>(
539 CurrentUnpackingBits->getNextBits(/*Width=*/3)));
540
541 E->setType(Record.readType());
542 assert(Record.getIdx() == NumExprFields &&
543 "Incorrect expression field count");
544}
545
546void ASTStmtReader::VisitConstantExpr(ConstantExpr *E) {
547 VisitExpr(E);
548
549 auto StorageKind = static_cast<ConstantResultStorageKind>(Record.readInt());
550 assert(E->getResultStorageKind() == StorageKind && "Wrong ResultKind!");
551
552 E->ConstantExprBits.APValueKind = Record.readInt();
553 E->ConstantExprBits.IsUnsigned = Record.readInt();
554 E->ConstantExprBits.BitWidth = Record.readInt();
555 E->ConstantExprBits.HasCleanup = false; // Not serialized, see below.
556 E->ConstantExprBits.IsImmediateInvocation = Record.readInt();
557
558 switch (StorageKind) {
560 break;
561
563 E->Int64Result() = Record.readInt();
564 break;
565
567 E->APValueResult() = Record.readAPValue();
568 if (E->APValueResult().needsCleanup()) {
569 E->ConstantExprBits.HasCleanup = true;
570 Record.getContext().addDestruction(&E->APValueResult());
571 }
572 break;
573 }
574
575 E->setSubExpr(Record.readSubExpr());
576}
577
578void ASTStmtReader::VisitSYCLUniqueStableNameExpr(SYCLUniqueStableNameExpr *E) {
579 VisitExpr(E);
580
581 E->setLocation(readSourceLocation());
582 E->setLParenLocation(readSourceLocation());
583 E->setRParenLocation(readSourceLocation());
584
585 E->setTypeSourceInfo(Record.readTypeSourceInfo());
586}
587
588void ASTStmtReader::VisitPredefinedExpr(PredefinedExpr *E) {
589 VisitExpr(E);
590 bool HasFunctionName = Record.readInt();
591 E->PredefinedExprBits.HasFunctionName = HasFunctionName;
592 E->PredefinedExprBits.Kind = Record.readInt();
593 E->PredefinedExprBits.IsTransparent = Record.readInt();
594 E->setLocation(readSourceLocation());
595 if (HasFunctionName)
596 E->setFunctionName(cast<StringLiteral>(Record.readSubExpr()));
597}
598
599void ASTStmtReader::VisitDeclRefExpr(DeclRefExpr *E) {
600 VisitExpr(E);
601
602 CurrentUnpackingBits.emplace(Record.readInt());
603 E->DeclRefExprBits.HadMultipleCandidates = CurrentUnpackingBits->getNextBit();
604 E->DeclRefExprBits.RefersToEnclosingVariableOrCapture =
605 CurrentUnpackingBits->getNextBit();
606 E->DeclRefExprBits.NonOdrUseReason =
607 CurrentUnpackingBits->getNextBits(/*Width=*/2);
608 E->DeclRefExprBits.IsImmediateEscalating = CurrentUnpackingBits->getNextBit();
609 E->DeclRefExprBits.HasFoundDecl = CurrentUnpackingBits->getNextBit();
610 E->DeclRefExprBits.HasQualifier = CurrentUnpackingBits->getNextBit();
611 E->DeclRefExprBits.HasTemplateKWAndArgsInfo =
612 CurrentUnpackingBits->getNextBit();
613 E->DeclRefExprBits.CapturedByCopyInLambdaWithExplicitObjectParameter = false;
614 unsigned NumTemplateArgs = 0;
615 if (E->hasTemplateKWAndArgsInfo())
616 NumTemplateArgs = Record.readInt();
617
618 if (E->hasQualifier())
619 new (E->getTrailingObjects<NestedNameSpecifierLoc>())
620 NestedNameSpecifierLoc(Record.readNestedNameSpecifierLoc());
621
622 if (E->hasFoundDecl())
623 *E->getTrailingObjects<NamedDecl *>() = readDeclAs<NamedDecl>();
624
625 if (E->hasTemplateKWAndArgsInfo())
627 *E->getTrailingObjects<ASTTemplateKWAndArgsInfo>(),
628 E->getTrailingObjects<TemplateArgumentLoc>(), NumTemplateArgs);
629
630 E->D = readDeclAs<ValueDecl>();
631 E->setLocation(readSourceLocation());
632 E->DNLoc = Record.readDeclarationNameLoc(E->getDecl()->getDeclName());
633}
634
635void ASTStmtReader::VisitIntegerLiteral(IntegerLiteral *E) {
636 VisitExpr(E);
637 E->setLocation(readSourceLocation());
638 E->setValue(Record.getContext(), Record.readAPInt());
639}
640
641void ASTStmtReader::VisitFixedPointLiteral(FixedPointLiteral *E) {
642 VisitExpr(E);
643 E->setLocation(readSourceLocation());
644 E->setScale(Record.readInt());
645 E->setValue(Record.getContext(), Record.readAPInt());
646}
647
648void ASTStmtReader::VisitFloatingLiteral(FloatingLiteral *E) {
649 VisitExpr(E);
650 E->setRawSemantics(
651 static_cast<llvm::APFloatBase::Semantics>(Record.readInt()));
652 E->setExact(Record.readInt());
653 E->setValue(Record.getContext(), Record.readAPFloat(E->getSemantics()));
654 E->setLocation(readSourceLocation());
655}
656
657void ASTStmtReader::VisitImaginaryLiteral(ImaginaryLiteral *E) {
658 VisitExpr(E);
659 E->setSubExpr(Record.readSubExpr());
660}
661
662void ASTStmtReader::VisitStringLiteral(StringLiteral *E) {
663 VisitExpr(E);
664
665 // NumConcatenated, Length and CharByteWidth are set by the empty
666 // ctor since they are needed to allocate storage for the trailing objects.
667 unsigned NumConcatenated = Record.readInt();
668 unsigned Length = Record.readInt();
669 unsigned CharByteWidth = Record.readInt();
670 assert((NumConcatenated == E->getNumConcatenated()) &&
671 "Wrong number of concatenated tokens!");
672 assert((Length == E->getLength()) && "Wrong Length!");
673 assert((CharByteWidth == E->getCharByteWidth()) && "Wrong character width!");
674 E->StringLiteralBits.Kind = Record.readInt();
675 E->StringLiteralBits.IsPascal = Record.readInt();
676
677 // The character width is originally computed via mapCharByteWidth.
678 // Check that the deserialized character width is consistant with the result
679 // of calling mapCharByteWidth.
680 assert((CharByteWidth ==
681 StringLiteral::mapCharByteWidth(Record.getContext().getTargetInfo(),
682 E->getKind())) &&
683 "Wrong character width!");
684
685 // Deserialize the trailing array of SourceLocation.
686 for (unsigned I = 0; I < NumConcatenated; ++I)
687 E->setStrTokenLoc(I, readSourceLocation());
688
689 // Deserialize the trailing array of char holding the string data.
690 char *StrData = E->getStrDataAsChar();
691 for (unsigned I = 0; I < Length * CharByteWidth; ++I)
692 StrData[I] = Record.readInt();
693}
694
695void ASTStmtReader::VisitCharacterLiteral(CharacterLiteral *E) {
696 VisitExpr(E);
697 E->setValue(Record.readInt());
698 E->setLocation(readSourceLocation());
699 E->setKind(static_cast<CharacterLiteralKind>(Record.readInt()));
700}
701
702void ASTStmtReader::VisitParenExpr(ParenExpr *E) {
703 VisitExpr(E);
704 E->setLParen(readSourceLocation());
705 E->setRParen(readSourceLocation());
706 E->setSubExpr(Record.readSubExpr());
707}
708
709void ASTStmtReader::VisitParenListExpr(ParenListExpr *E) {
710 VisitExpr(E);
711 unsigned NumExprs = Record.readInt();
712 assert((NumExprs == E->getNumExprs()) && "Wrong NumExprs!");
713 for (unsigned I = 0; I != NumExprs; ++I)
714 E->getTrailingObjects<Stmt *>()[I] = Record.readSubStmt();
715 E->LParenLoc = readSourceLocation();
716 E->RParenLoc = readSourceLocation();
717}
718
719void ASTStmtReader::VisitUnaryOperator(UnaryOperator *E) {
720 VisitExpr(E);
721 bool hasFP_Features = CurrentUnpackingBits->getNextBit();
722 assert(hasFP_Features == E->hasStoredFPFeatures());
723 E->setSubExpr(Record.readSubExpr());
724 E->setOpcode(
725 (UnaryOperator::Opcode)CurrentUnpackingBits->getNextBits(/*Width=*/5));
726 E->setOperatorLoc(readSourceLocation());
727 E->setCanOverflow(CurrentUnpackingBits->getNextBit());
728 if (hasFP_Features)
729 E->setStoredFPFeatures(
731}
732
733void ASTStmtReader::VisitOffsetOfExpr(OffsetOfExpr *E) {
734 VisitExpr(E);
735 assert(E->getNumComponents() == Record.peekInt());
736 Record.skipInts(1);
737 assert(E->getNumExpressions() == Record.peekInt());
738 Record.skipInts(1);
739 E->setOperatorLoc(readSourceLocation());
740 E->setRParenLoc(readSourceLocation());
741 E->setTypeSourceInfo(readTypeSourceInfo());
742 for (unsigned I = 0, N = E->getNumComponents(); I != N; ++I) {
743 auto Kind = static_cast<OffsetOfNode::Kind>(Record.readInt());
744 SourceLocation Start = readSourceLocation();
745 SourceLocation End = readSourceLocation();
746 switch (Kind) {
748 E->setComponent(I, OffsetOfNode(Start, Record.readInt(), End));
749 break;
750
752 E->setComponent(
753 I, OffsetOfNode(Start, readDeclAs<FieldDecl>(), End));
754 break;
755
757 E->setComponent(
758 I,
759 OffsetOfNode(Start, Record.readIdentifier(), End));
760 break;
761
762 case OffsetOfNode::Base: {
763 auto *Base = new (Record.getContext()) CXXBaseSpecifier();
764 *Base = Record.readCXXBaseSpecifier();
765 E->setComponent(I, OffsetOfNode(Base));
766 break;
767 }
768 }
769 }
770
771 for (unsigned I = 0, N = E->getNumExpressions(); I != N; ++I)
772 E->setIndexExpr(I, Record.readSubExpr());
773}
774
775void ASTStmtReader::VisitUnaryExprOrTypeTraitExpr(UnaryExprOrTypeTraitExpr *E) {
776 VisitExpr(E);
777 E->setKind(static_cast<UnaryExprOrTypeTrait>(Record.readInt()));
778 if (Record.peekInt() == 0) {
779 E->setArgument(Record.readSubExpr());
780 Record.skipInts(1);
781 } else {
782 E->setArgument(readTypeSourceInfo());
783 }
784 E->setOperatorLoc(readSourceLocation());
785 E->setRParenLoc(readSourceLocation());
786}
787
790 ConstraintSatisfaction Satisfaction;
791 Satisfaction.IsSatisfied = Record.readInt();
792 Satisfaction.ContainsErrors = Record.readInt();
793 if (!Satisfaction.IsSatisfied) {
794 unsigned NumDetailRecords = Record.readInt();
795 for (unsigned i = 0; i != NumDetailRecords; ++i) {
796 Expr *ConstraintExpr = Record.readExpr();
797 if (/* IsDiagnostic */Record.readInt()) {
798 SourceLocation DiagLocation = Record.readSourceLocation();
799 std::string DiagMessage = Record.readString();
800 Satisfaction.Details.emplace_back(
801 ConstraintExpr, new (Record.getContext())
803 DiagLocation, DiagMessage});
804 } else
805 Satisfaction.Details.emplace_back(ConstraintExpr, Record.readExpr());
806 }
807 }
808 return Satisfaction;
809}
810
811void ASTStmtReader::VisitConceptSpecializationExpr(
813 VisitExpr(E);
814 E->SpecDecl = Record.readDeclAs<ImplicitConceptSpecializationDecl>();
815 if (Record.readBool())
816 E->ConceptRef = Record.readConceptReference();
817 E->Satisfaction = E->isValueDependent() ? nullptr :
820}
821
824 std::string SubstitutedEntity = Record.readString();
825 SourceLocation DiagLoc = Record.readSourceLocation();
826 std::string DiagMessage = Record.readString();
827 return new (Record.getContext())
828 concepts::Requirement::SubstitutionDiagnostic{SubstitutedEntity, DiagLoc,
829 DiagMessage};
830}
831
832void ASTStmtReader::VisitRequiresExpr(RequiresExpr *E) {
833 VisitExpr(E);
834 unsigned NumLocalParameters = Record.readInt();
835 unsigned NumRequirements = Record.readInt();
836 E->RequiresExprBits.RequiresKWLoc = Record.readSourceLocation();
837 E->RequiresExprBits.IsSatisfied = Record.readInt();
838 E->Body = Record.readDeclAs<RequiresExprBodyDecl>();
840 for (unsigned i = 0; i < NumLocalParameters; ++i)
841 LocalParameters.push_back(cast<ParmVarDecl>(Record.readDecl()));
842 std::copy(LocalParameters.begin(), LocalParameters.end(),
843 E->getTrailingObjects<ParmVarDecl *>());
845 for (unsigned i = 0; i < NumRequirements; ++i) {
846 auto RK =
847 static_cast<concepts::Requirement::RequirementKind>(Record.readInt());
848 concepts::Requirement *R = nullptr;
849 switch (RK) {
851 auto Status =
853 Record.readInt());
855 R = new (Record.getContext())
857 else
858 R = new (Record.getContext())
859 concepts::TypeRequirement(Record.readTypeSourceInfo());
860 } break;
863 auto Status =
865 Record.readInt());
867 Expr *> E;
870 } else
871 E = Record.readExpr();
872
873 std::optional<concepts::ExprRequirement::ReturnTypeRequirement> Req;
874 ConceptSpecializationExpr *SubstitutedConstraintExpr = nullptr;
875 SourceLocation NoexceptLoc;
877 Req.emplace();
878 } else {
879 NoexceptLoc = Record.readSourceLocation();
880 switch (/* returnTypeRequirementKind */Record.readInt()) {
881 case 0:
882 // No return type requirement.
883 Req.emplace();
884 break;
885 case 1: {
886 // type-constraint
887 TemplateParameterList *TPL = Record.readTemplateParameterList();
888 if (Status >=
890 SubstitutedConstraintExpr =
891 cast<ConceptSpecializationExpr>(Record.readExpr());
892 Req.emplace(TPL);
893 } break;
894 case 2:
895 // Substitution failure
897 break;
898 }
899 }
900 if (Expr *Ex = E.dyn_cast<Expr *>())
901 R = new (Record.getContext()) concepts::ExprRequirement(
902 Ex, RK == concepts::Requirement::RK_Simple, NoexceptLoc,
903 std::move(*Req), Status, SubstitutedConstraintExpr);
904 else
905 R = new (Record.getContext()) concepts::ExprRequirement(
907 RK == concepts::Requirement::RK_Simple, NoexceptLoc,
908 std::move(*Req));
909 } break;
911 bool HasInvalidConstraint = Record.readInt();
912 if (HasInvalidConstraint) {
913 std::string InvalidConstraint = Record.readString();
914 char *InvalidConstraintBuf =
915 new (Record.getContext()) char[InvalidConstraint.size()];
916 std::copy(InvalidConstraint.begin(), InvalidConstraint.end(),
917 InvalidConstraintBuf);
918 R = new (Record.getContext()) concepts::NestedRequirement(
919 Record.getContext(),
920 StringRef(InvalidConstraintBuf, InvalidConstraint.size()),
922 break;
923 }
924 Expr *E = Record.readExpr();
926 R = new (Record.getContext()) concepts::NestedRequirement(E);
927 else
928 R = new (Record.getContext())
931 } break;
932 }
933 if (!R)
934 continue;
935 Requirements.push_back(R);
936 }
937 std::copy(Requirements.begin(), Requirements.end(),
938 E->getTrailingObjects<concepts::Requirement *>());
939 E->LParenLoc = Record.readSourceLocation();
940 E->RParenLoc = Record.readSourceLocation();
941 E->RBraceLoc = Record.readSourceLocation();
942}
943
944void ASTStmtReader::VisitArraySubscriptExpr(ArraySubscriptExpr *E) {
945 VisitExpr(E);
946 E->setLHS(Record.readSubExpr());
947 E->setRHS(Record.readSubExpr());
948 E->setRBracketLoc(readSourceLocation());
949}
950
951void ASTStmtReader::VisitMatrixSubscriptExpr(MatrixSubscriptExpr *E) {
952 VisitExpr(E);
953 E->setBase(Record.readSubExpr());
954 E->setRowIdx(Record.readSubExpr());
955 E->setColumnIdx(Record.readSubExpr());
956 E->setRBracketLoc(readSourceLocation());
957}
958
959void ASTStmtReader::VisitArraySectionExpr(ArraySectionExpr *E) {
960 VisitExpr(E);
961 E->ASType = Record.readEnum<ArraySectionExpr::ArraySectionType>();
962
963 E->setBase(Record.readSubExpr());
964 E->setLowerBound(Record.readSubExpr());
965 E->setLength(Record.readSubExpr());
966
967 if (E->isOMPArraySection())
968 E->setStride(Record.readSubExpr());
969
970 E->setColonLocFirst(readSourceLocation());
971
972 if (E->isOMPArraySection())
973 E->setColonLocSecond(readSourceLocation());
974
975 E->setRBracketLoc(readSourceLocation());
976}
977
978void ASTStmtReader::VisitOMPArrayShapingExpr(OMPArrayShapingExpr *E) {
979 VisitExpr(E);
980 unsigned NumDims = Record.readInt();
981 E->setBase(Record.readSubExpr());
982 SmallVector<Expr *, 4> Dims(NumDims);
983 for (unsigned I = 0; I < NumDims; ++I)
984 Dims[I] = Record.readSubExpr();
985 E->setDimensions(Dims);
986 SmallVector<SourceRange, 4> SRs(NumDims);
987 for (unsigned I = 0; I < NumDims; ++I)
988 SRs[I] = readSourceRange();
989 E->setBracketsRanges(SRs);
990 E->setLParenLoc(readSourceLocation());
991 E->setRParenLoc(readSourceLocation());
992}
993
994void ASTStmtReader::VisitOMPIteratorExpr(OMPIteratorExpr *E) {
995 VisitExpr(E);
996 unsigned NumIters = Record.readInt();
997 E->setIteratorKwLoc(readSourceLocation());
998 E->setLParenLoc(readSourceLocation());
999 E->setRParenLoc(readSourceLocation());
1000 for (unsigned I = 0; I < NumIters; ++I) {
1001 E->setIteratorDeclaration(I, Record.readDeclRef());
1002 E->setAssignmentLoc(I, readSourceLocation());
1003 Expr *Begin = Record.readSubExpr();
1004 Expr *End = Record.readSubExpr();
1005 Expr *Step = Record.readSubExpr();
1006 SourceLocation ColonLoc = readSourceLocation();
1007 SourceLocation SecColonLoc;
1008 if (Step)
1009 SecColonLoc = readSourceLocation();
1010 E->setIteratorRange(I, Begin, ColonLoc, End, SecColonLoc, Step);
1011 // Deserialize helpers
1013 HD.CounterVD = cast_or_null<VarDecl>(Record.readDeclRef());
1014 HD.Upper = Record.readSubExpr();
1015 HD.Update = Record.readSubExpr();
1016 HD.CounterUpdate = Record.readSubExpr();
1017 E->setHelper(I, HD);
1018 }
1019}
1020
1021void ASTStmtReader::VisitCallExpr(CallExpr *E) {
1022 VisitExpr(E);
1023
1024 unsigned NumArgs = Record.readInt();
1025 CurrentUnpackingBits.emplace(Record.readInt());
1026 E->setADLCallKind(
1027 static_cast<CallExpr::ADLCallKind>(CurrentUnpackingBits->getNextBit()));
1028 bool HasFPFeatures = CurrentUnpackingBits->getNextBit();
1029 assert((NumArgs == E->getNumArgs()) && "Wrong NumArgs!");
1030 E->setRParenLoc(readSourceLocation());
1031 E->setCallee(Record.readSubExpr());
1032 for (unsigned I = 0; I != NumArgs; ++I)
1033 E->setArg(I, Record.readSubExpr());
1034
1035 if (HasFPFeatures)
1036 E->setStoredFPFeatures(
1038}
1039
1040void ASTStmtReader::VisitCXXMemberCallExpr(CXXMemberCallExpr *E) {
1041 VisitCallExpr(E);
1042}
1043
1044void ASTStmtReader::VisitMemberExpr(MemberExpr *E) {
1045 VisitExpr(E);
1046
1047 CurrentUnpackingBits.emplace(Record.readInt());
1048 bool HasQualifier = CurrentUnpackingBits->getNextBit();
1049 bool HasFoundDecl = CurrentUnpackingBits->getNextBit();
1050 bool HasTemplateInfo = CurrentUnpackingBits->getNextBit();
1051 unsigned NumTemplateArgs = Record.readInt();
1052
1053 E->Base = Record.readSubExpr();
1054 E->MemberDecl = Record.readDeclAs<ValueDecl>();
1055 E->MemberDNLoc = Record.readDeclarationNameLoc(E->MemberDecl->getDeclName());
1056 E->MemberLoc = Record.readSourceLocation();
1057 E->MemberExprBits.IsArrow = CurrentUnpackingBits->getNextBit();
1058 E->MemberExprBits.HasQualifier = HasQualifier;
1059 E->MemberExprBits.HasFoundDecl = HasFoundDecl;
1060 E->MemberExprBits.HasTemplateKWAndArgsInfo = HasTemplateInfo;
1061 E->MemberExprBits.HadMultipleCandidates = CurrentUnpackingBits->getNextBit();
1062 E->MemberExprBits.NonOdrUseReason =
1063 CurrentUnpackingBits->getNextBits(/*Width=*/2);
1064 E->MemberExprBits.OperatorLoc = Record.readSourceLocation();
1065
1066 if (HasQualifier)
1067 new (E->getTrailingObjects<NestedNameSpecifierLoc>())
1068 NestedNameSpecifierLoc(Record.readNestedNameSpecifierLoc());
1069
1070 if (HasFoundDecl) {
1071 auto *FoundD = Record.readDeclAs<NamedDecl>();
1072 auto AS = (AccessSpecifier)CurrentUnpackingBits->getNextBits(/*Width=*/2);
1073 *E->getTrailingObjects<DeclAccessPair>() = DeclAccessPair::make(FoundD, AS);
1074 }
1075
1076 if (HasTemplateInfo)
1078 *E->getTrailingObjects<ASTTemplateKWAndArgsInfo>(),
1079 E->getTrailingObjects<TemplateArgumentLoc>(), NumTemplateArgs);
1080}
1081
1082void ASTStmtReader::VisitObjCIsaExpr(ObjCIsaExpr *E) {
1083 VisitExpr(E);
1084 E->setBase(Record.readSubExpr());
1085 E->setIsaMemberLoc(readSourceLocation());
1086 E->setOpLoc(readSourceLocation());
1087 E->setArrow(Record.readInt());
1088}
1089
1090void ASTStmtReader::
1091VisitObjCIndirectCopyRestoreExpr(ObjCIndirectCopyRestoreExpr *E) {
1092 VisitExpr(E);
1093 E->Operand = Record.readSubExpr();
1094 E->setShouldCopy(Record.readInt());
1095}
1096
1097void ASTStmtReader::VisitObjCBridgedCastExpr(ObjCBridgedCastExpr *E) {
1098 VisitExplicitCastExpr(E);
1099 E->LParenLoc = readSourceLocation();
1100 E->BridgeKeywordLoc = readSourceLocation();
1101 E->Kind = Record.readInt();
1102}
1103
1104void ASTStmtReader::VisitCastExpr(CastExpr *E) {
1105 VisitExpr(E);
1106 unsigned NumBaseSpecs = Record.readInt();
1107 assert(NumBaseSpecs == E->path_size());
1108
1109 CurrentUnpackingBits.emplace(Record.readInt());
1110 E->setCastKind((CastKind)CurrentUnpackingBits->getNextBits(/*Width=*/7));
1111 unsigned HasFPFeatures = CurrentUnpackingBits->getNextBit();
1112 assert(E->hasStoredFPFeatures() == HasFPFeatures);
1113
1114 E->setSubExpr(Record.readSubExpr());
1115
1116 CastExpr::path_iterator BaseI = E->path_begin();
1117 while (NumBaseSpecs--) {
1118 auto *BaseSpec = new (Record.getContext()) CXXBaseSpecifier;
1119 *BaseSpec = Record.readCXXBaseSpecifier();
1120 *BaseI++ = BaseSpec;
1121 }
1122 if (HasFPFeatures)
1123 *E->getTrailingFPFeatures() =
1125}
1126
1127void ASTStmtReader::VisitBinaryOperator(BinaryOperator *E) {
1128 VisitExpr(E);
1129 CurrentUnpackingBits.emplace(Record.readInt());
1130 E->setOpcode(
1131 (BinaryOperator::Opcode)CurrentUnpackingBits->getNextBits(/*Width=*/6));
1132 bool hasFP_Features = CurrentUnpackingBits->getNextBit();
1133 E->setHasStoredFPFeatures(hasFP_Features);
1134 E->setLHS(Record.readSubExpr());
1135 E->setRHS(Record.readSubExpr());
1136 E->setOperatorLoc(readSourceLocation());
1137 if (hasFP_Features)
1138 E->setStoredFPFeatures(
1140}
1141
1142void ASTStmtReader::VisitCompoundAssignOperator(CompoundAssignOperator *E) {
1143 VisitBinaryOperator(E);
1144 E->setComputationLHSType(Record.readType());
1145 E->setComputationResultType(Record.readType());
1146}
1147
1148void ASTStmtReader::VisitConditionalOperator(ConditionalOperator *E) {
1149 VisitExpr(E);
1150 E->SubExprs[ConditionalOperator::COND] = Record.readSubExpr();
1151 E->SubExprs[ConditionalOperator::LHS] = Record.readSubExpr();
1152 E->SubExprs[ConditionalOperator::RHS] = Record.readSubExpr();
1153 E->QuestionLoc = readSourceLocation();
1154 E->ColonLoc = readSourceLocation();
1155}
1156
1157void
1158ASTStmtReader::VisitBinaryConditionalOperator(BinaryConditionalOperator *E) {
1159 VisitExpr(E);
1160 E->OpaqueValue = cast<OpaqueValueExpr>(Record.readSubExpr());
1161 E->SubExprs[BinaryConditionalOperator::COMMON] = Record.readSubExpr();
1162 E->SubExprs[BinaryConditionalOperator::COND] = Record.readSubExpr();
1163 E->SubExprs[BinaryConditionalOperator::LHS] = Record.readSubExpr();
1164 E->SubExprs[BinaryConditionalOperator::RHS] = Record.readSubExpr();
1165 E->QuestionLoc = readSourceLocation();
1166 E->ColonLoc = readSourceLocation();
1167}
1168
1169void ASTStmtReader::VisitImplicitCastExpr(ImplicitCastExpr *E) {
1170 VisitCastExpr(E);
1171 E->setIsPartOfExplicitCast(CurrentUnpackingBits->getNextBit());
1172}
1173
1174void ASTStmtReader::VisitExplicitCastExpr(ExplicitCastExpr *E) {
1175 VisitCastExpr(E);
1176 E->setTypeInfoAsWritten(readTypeSourceInfo());
1177}
1178
1179void ASTStmtReader::VisitCStyleCastExpr(CStyleCastExpr *E) {
1180 VisitExplicitCastExpr(E);
1181 E->setLParenLoc(readSourceLocation());
1182 E->setRParenLoc(readSourceLocation());
1183}
1184
1185void ASTStmtReader::VisitCompoundLiteralExpr(CompoundLiteralExpr *E) {
1186 VisitExpr(E);
1187 E->setLParenLoc(readSourceLocation());
1188 E->setTypeSourceInfo(readTypeSourceInfo());
1189 E->setInitializer(Record.readSubExpr());
1190 E->setFileScope(Record.readInt());
1191}
1192
1193void ASTStmtReader::VisitExtVectorElementExpr(ExtVectorElementExpr *E) {
1194 VisitExpr(E);
1195 E->setBase(Record.readSubExpr());
1196 E->setAccessor(Record.readIdentifier());
1197 E->setAccessorLoc(readSourceLocation());
1198}
1199
1200void ASTStmtReader::VisitInitListExpr(InitListExpr *E) {
1201 VisitExpr(E);
1202 if (auto *SyntForm = cast_or_null<InitListExpr>(Record.readSubStmt()))
1203 E->setSyntacticForm(SyntForm);
1204 E->setLBraceLoc(readSourceLocation());
1205 E->setRBraceLoc(readSourceLocation());
1206 bool isArrayFiller = Record.readInt();
1207 Expr *filler = nullptr;
1208 if (isArrayFiller) {
1209 filler = Record.readSubExpr();
1210 E->ArrayFillerOrUnionFieldInit = filler;
1211 } else
1212 E->ArrayFillerOrUnionFieldInit = readDeclAs<FieldDecl>();
1213 E->sawArrayRangeDesignator(Record.readInt());
1214 unsigned NumInits = Record.readInt();
1215 E->reserveInits(Record.getContext(), NumInits);
1216 if (isArrayFiller) {
1217 for (unsigned I = 0; I != NumInits; ++I) {
1218 Expr *init = Record.readSubExpr();
1219 E->updateInit(Record.getContext(), I, init ? init : filler);
1220 }
1221 } else {
1222 for (unsigned I = 0; I != NumInits; ++I)
1223 E->updateInit(Record.getContext(), I, Record.readSubExpr());
1224 }
1225}
1226
1227void ASTStmtReader::VisitDesignatedInitExpr(DesignatedInitExpr *E) {
1229
1230 VisitExpr(E);
1231 unsigned NumSubExprs = Record.readInt();
1232 assert(NumSubExprs == E->getNumSubExprs() && "Wrong number of subexprs");
1233 for (unsigned I = 0; I != NumSubExprs; ++I)
1234 E->setSubExpr(I, Record.readSubExpr());
1235 E->setEqualOrColonLoc(readSourceLocation());
1236 E->setGNUSyntax(Record.readInt());
1237
1238 SmallVector<Designator, 4> Designators;
1239 while (Record.getIdx() < Record.size()) {
1240 switch ((DesignatorTypes)Record.readInt()) {
1241 case DESIG_FIELD_DECL: {
1242 auto *Field = readDeclAs<FieldDecl>();
1243 SourceLocation DotLoc = readSourceLocation();
1244 SourceLocation FieldLoc = readSourceLocation();
1245 Designators.push_back(Designator::CreateFieldDesignator(
1246 Field->getIdentifier(), DotLoc, FieldLoc));
1247 Designators.back().setFieldDecl(Field);
1248 break;
1249 }
1250
1251 case DESIG_FIELD_NAME: {
1252 const IdentifierInfo *Name = Record.readIdentifier();
1253 SourceLocation DotLoc = readSourceLocation();
1254 SourceLocation FieldLoc = readSourceLocation();
1255 Designators.push_back(Designator::CreateFieldDesignator(Name, DotLoc,
1256 FieldLoc));
1257 break;
1258 }
1259
1260 case DESIG_ARRAY: {
1261 unsigned Index = Record.readInt();
1262 SourceLocation LBracketLoc = readSourceLocation();
1263 SourceLocation RBracketLoc = readSourceLocation();
1264 Designators.push_back(Designator::CreateArrayDesignator(Index,
1265 LBracketLoc,
1266 RBracketLoc));
1267 break;
1268 }
1269
1270 case DESIG_ARRAY_RANGE: {
1271 unsigned Index = Record.readInt();
1272 SourceLocation LBracketLoc = readSourceLocation();
1273 SourceLocation EllipsisLoc = readSourceLocation();
1274 SourceLocation RBracketLoc = readSourceLocation();
1275 Designators.push_back(Designator::CreateArrayRangeDesignator(
1276 Index, LBracketLoc, EllipsisLoc, RBracketLoc));
1277 break;
1278 }
1279 }
1280 }
1281 E->setDesignators(Record.getContext(),
1282 Designators.data(), Designators.size());
1283}
1284
1285void ASTStmtReader::VisitDesignatedInitUpdateExpr(DesignatedInitUpdateExpr *E) {
1286 VisitExpr(E);
1287 E->setBase(Record.readSubExpr());
1288 E->setUpdater(Record.readSubExpr());
1289}
1290
1291void ASTStmtReader::VisitNoInitExpr(NoInitExpr *E) {
1292 VisitExpr(E);
1293}
1294
1295void ASTStmtReader::VisitArrayInitLoopExpr(ArrayInitLoopExpr *E) {
1296 VisitExpr(E);
1297 E->SubExprs[0] = Record.readSubExpr();
1298 E->SubExprs[1] = Record.readSubExpr();
1299}
1300
1301void ASTStmtReader::VisitArrayInitIndexExpr(ArrayInitIndexExpr *E) {
1302 VisitExpr(E);
1303}
1304
1305void ASTStmtReader::VisitImplicitValueInitExpr(ImplicitValueInitExpr *E) {
1306 VisitExpr(E);
1307}
1308
1309void ASTStmtReader::VisitVAArgExpr(VAArgExpr *E) {
1310 VisitExpr(E);
1311 E->setSubExpr(Record.readSubExpr());
1312 E->setWrittenTypeInfo(readTypeSourceInfo());
1313 E->setBuiltinLoc(readSourceLocation());
1314 E->setRParenLoc(readSourceLocation());
1315 E->setIsMicrosoftABI(Record.readInt());
1316}
1317
1318void ASTStmtReader::VisitSourceLocExpr(SourceLocExpr *E) {
1319 VisitExpr(E);
1320 E->ParentContext = readDeclAs<DeclContext>();
1321 E->BuiltinLoc = readSourceLocation();
1322 E->RParenLoc = readSourceLocation();
1323 E->SourceLocExprBits.Kind = Record.readInt();
1324}
1325
1326void ASTStmtReader::VisitEmbedExpr(EmbedExpr *E) {
1327 VisitExpr(E);
1328 E->EmbedKeywordLoc = readSourceLocation();
1329 EmbedDataStorage *Data = new (Record.getContext()) EmbedDataStorage;
1330 Data->BinaryData = cast<StringLiteral>(Record.readSubStmt());
1331 E->Data = Data;
1332 E->Begin = Record.readInt();
1333 E->NumOfElements = Record.readInt();
1334}
1335
1336void ASTStmtReader::VisitAddrLabelExpr(AddrLabelExpr *E) {
1337 VisitExpr(E);
1338 E->setAmpAmpLoc(readSourceLocation());
1339 E->setLabelLoc(readSourceLocation());
1340 E->setLabel(readDeclAs<LabelDecl>());
1341}
1342
1343void ASTStmtReader::VisitStmtExpr(StmtExpr *E) {
1344 VisitExpr(E);
1345 E->setLParenLoc(readSourceLocation());
1346 E->setRParenLoc(readSourceLocation());
1347 E->setSubStmt(cast_or_null<CompoundStmt>(Record.readSubStmt()));
1348 E->StmtExprBits.TemplateDepth = Record.readInt();
1349}
1350
1351void ASTStmtReader::VisitChooseExpr(ChooseExpr *E) {
1352 VisitExpr(E);
1353 E->setCond(Record.readSubExpr());
1354 E->setLHS(Record.readSubExpr());
1355 E->setRHS(Record.readSubExpr());
1356 E->setBuiltinLoc(readSourceLocation());
1357 E->setRParenLoc(readSourceLocation());
1358 E->setIsConditionTrue(Record.readInt());
1359}
1360
1361void ASTStmtReader::VisitGNUNullExpr(GNUNullExpr *E) {
1362 VisitExpr(E);
1363 E->setTokenLocation(readSourceLocation());
1364}
1365
1366void ASTStmtReader::VisitShuffleVectorExpr(ShuffleVectorExpr *E) {
1367 VisitExpr(E);
1369 unsigned NumExprs = Record.readInt();
1370 while (NumExprs--)
1371 Exprs.push_back(Record.readSubExpr());
1372 E->setExprs(Record.getContext(), Exprs);
1373 E->setBuiltinLoc(readSourceLocation());
1374 E->setRParenLoc(readSourceLocation());
1375}
1376
1377void ASTStmtReader::VisitConvertVectorExpr(ConvertVectorExpr *E) {
1378 VisitExpr(E);
1379 E->BuiltinLoc = readSourceLocation();
1380 E->RParenLoc = readSourceLocation();
1381 E->TInfo = readTypeSourceInfo();
1382 E->SrcExpr = Record.readSubExpr();
1383}
1384
1385void ASTStmtReader::VisitBlockExpr(BlockExpr *E) {
1386 VisitExpr(E);
1387 E->setBlockDecl(readDeclAs<BlockDecl>());
1388}
1389
1390void ASTStmtReader::VisitGenericSelectionExpr(GenericSelectionExpr *E) {
1391 VisitExpr(E);
1392
1393 unsigned NumAssocs = Record.readInt();
1394 assert(NumAssocs == E->getNumAssocs() && "Wrong NumAssocs!");
1395 E->IsExprPredicate = Record.readInt();
1396 E->ResultIndex = Record.readInt();
1397 E->GenericSelectionExprBits.GenericLoc = readSourceLocation();
1398 E->DefaultLoc = readSourceLocation();
1399 E->RParenLoc = readSourceLocation();
1400
1401 Stmt **Stmts = E->getTrailingObjects<Stmt *>();
1402 // Add 1 to account for the controlling expression which is the first
1403 // expression in the trailing array of Stmt *. This is not needed for
1404 // the trailing array of TypeSourceInfo *.
1405 for (unsigned I = 0, N = NumAssocs + 1; I < N; ++I)
1406 Stmts[I] = Record.readSubExpr();
1407
1408 TypeSourceInfo **TSIs = E->getTrailingObjects<TypeSourceInfo *>();
1409 for (unsigned I = 0, N = NumAssocs; I < N; ++I)
1410 TSIs[I] = readTypeSourceInfo();
1411}
1412
1413void ASTStmtReader::VisitPseudoObjectExpr(PseudoObjectExpr *E) {
1414 VisitExpr(E);
1415 unsigned numSemanticExprs = Record.readInt();
1416 assert(numSemanticExprs + 1 == E->PseudoObjectExprBits.NumSubExprs);
1417 E->PseudoObjectExprBits.ResultIndex = Record.readInt();
1418
1419 // Read the syntactic expression.
1420 E->getSubExprsBuffer()[0] = Record.readSubExpr();
1421
1422 // Read all the semantic expressions.
1423 for (unsigned i = 0; i != numSemanticExprs; ++i) {
1424 Expr *subExpr = Record.readSubExpr();
1425 E->getSubExprsBuffer()[i+1] = subExpr;
1426 }
1427}
1428
1429void ASTStmtReader::VisitAtomicExpr(AtomicExpr *E) {
1430 VisitExpr(E);
1431 E->Op = AtomicExpr::AtomicOp(Record.readInt());
1432 E->NumSubExprs = AtomicExpr::getNumSubExprs(E->Op);
1433 for (unsigned I = 0; I != E->NumSubExprs; ++I)
1434 E->SubExprs[I] = Record.readSubExpr();
1435 E->BuiltinLoc = readSourceLocation();
1436 E->RParenLoc = readSourceLocation();
1437}
1438
1439//===----------------------------------------------------------------------===//
1440// Objective-C Expressions and Statements
1441
1442void ASTStmtReader::VisitObjCStringLiteral(ObjCStringLiteral *E) {
1443 VisitExpr(E);
1444 E->setString(cast<StringLiteral>(Record.readSubStmt()));
1445 E->setAtLoc(readSourceLocation());
1446}
1447
1448void ASTStmtReader::VisitObjCBoxedExpr(ObjCBoxedExpr *E) {
1449 VisitExpr(E);
1450 // could be one of several IntegerLiteral, FloatLiteral, etc.
1451 E->SubExpr = Record.readSubStmt();
1452 E->BoxingMethod = readDeclAs<ObjCMethodDecl>();
1453 E->Range = readSourceRange();
1454}
1455
1456void ASTStmtReader::VisitObjCArrayLiteral(ObjCArrayLiteral *E) {
1457 VisitExpr(E);
1458 unsigned NumElements = Record.readInt();
1459 assert(NumElements == E->getNumElements() && "Wrong number of elements");
1460 Expr **Elements = E->getElements();
1461 for (unsigned I = 0, N = NumElements; I != N; ++I)
1462 Elements[I] = Record.readSubExpr();
1463 E->ArrayWithObjectsMethod = readDeclAs<ObjCMethodDecl>();
1464 E->Range = readSourceRange();
1465}
1466
1467void ASTStmtReader::VisitObjCDictionaryLiteral(ObjCDictionaryLiteral *E) {
1468 VisitExpr(E);
1469 unsigned NumElements = Record.readInt();
1470 assert(NumElements == E->getNumElements() && "Wrong number of elements");
1471 bool HasPackExpansions = Record.readInt();
1472 assert(HasPackExpansions == E->HasPackExpansions &&"Pack expansion mismatch");
1473 auto *KeyValues =
1474 E->getTrailingObjects<ObjCDictionaryLiteral::KeyValuePair>();
1475 auto *Expansions =
1476 E->getTrailingObjects<ObjCDictionaryLiteral::ExpansionData>();
1477 for (unsigned I = 0; I != NumElements; ++I) {
1478 KeyValues[I].Key = Record.readSubExpr();
1479 KeyValues[I].Value = Record.readSubExpr();
1480 if (HasPackExpansions) {
1481 Expansions[I].EllipsisLoc = readSourceLocation();
1482 Expansions[I].NumExpansionsPlusOne = Record.readInt();
1483 }
1484 }
1485 E->DictWithObjectsMethod = readDeclAs<ObjCMethodDecl>();
1486 E->Range = readSourceRange();
1487}
1488
1489void ASTStmtReader::VisitObjCEncodeExpr(ObjCEncodeExpr *E) {
1490 VisitExpr(E);
1491 E->setEncodedTypeSourceInfo(readTypeSourceInfo());
1492 E->setAtLoc(readSourceLocation());
1493 E->setRParenLoc(readSourceLocation());
1494}
1495
1496void ASTStmtReader::VisitObjCSelectorExpr(ObjCSelectorExpr *E) {
1497 VisitExpr(E);
1498 E->setSelector(Record.readSelector());
1499 E->setAtLoc(readSourceLocation());
1500 E->setRParenLoc(readSourceLocation());
1501}
1502
1503void ASTStmtReader::VisitObjCProtocolExpr(ObjCProtocolExpr *E) {
1504 VisitExpr(E);
1505 E->setProtocol(readDeclAs<ObjCProtocolDecl>());
1506 E->setAtLoc(readSourceLocation());
1507 E->ProtoLoc = readSourceLocation();
1508 E->setRParenLoc(readSourceLocation());
1509}
1510
1511void ASTStmtReader::VisitObjCIvarRefExpr(ObjCIvarRefExpr *E) {
1512 VisitExpr(E);
1513 E->setDecl(readDeclAs<ObjCIvarDecl>());
1514 E->setLocation(readSourceLocation());
1515 E->setOpLoc(readSourceLocation());
1516 E->setBase(Record.readSubExpr());
1517 E->setIsArrow(Record.readInt());
1518 E->setIsFreeIvar(Record.readInt());
1519}
1520
1521void ASTStmtReader::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *E) {
1522 VisitExpr(E);
1523 unsigned MethodRefFlags = Record.readInt();
1524 bool Implicit = Record.readInt() != 0;
1525 if (Implicit) {
1526 auto *Getter = readDeclAs<ObjCMethodDecl>();
1527 auto *Setter = readDeclAs<ObjCMethodDecl>();
1528 E->setImplicitProperty(Getter, Setter, MethodRefFlags);
1529 } else {
1530 E->setExplicitProperty(readDeclAs<ObjCPropertyDecl>(), MethodRefFlags);
1531 }
1532 E->setLocation(readSourceLocation());
1533 E->setReceiverLocation(readSourceLocation());
1534 switch (Record.readInt()) {
1535 case 0:
1536 E->setBase(Record.readSubExpr());
1537 break;
1538 case 1:
1539 E->setSuperReceiver(Record.readType());
1540 break;
1541 case 2:
1542 E->setClassReceiver(readDeclAs<ObjCInterfaceDecl>());
1543 break;
1544 }
1545}
1546
1547void ASTStmtReader::VisitObjCSubscriptRefExpr(ObjCSubscriptRefExpr *E) {
1548 VisitExpr(E);
1549 E->setRBracket(readSourceLocation());
1550 E->setBaseExpr(Record.readSubExpr());
1551 E->setKeyExpr(Record.readSubExpr());
1552 E->GetAtIndexMethodDecl = readDeclAs<ObjCMethodDecl>();
1553 E->SetAtIndexMethodDecl = readDeclAs<ObjCMethodDecl>();
1554}
1555
1556void ASTStmtReader::VisitObjCMessageExpr(ObjCMessageExpr *E) {
1557 VisitExpr(E);
1558 assert(Record.peekInt() == E->getNumArgs());
1559 Record.skipInts(1);
1560 unsigned NumStoredSelLocs = Record.readInt();
1561 E->SelLocsKind = Record.readInt();
1562 E->setDelegateInitCall(Record.readInt());
1563 E->IsImplicit = Record.readInt();
1564 auto Kind = static_cast<ObjCMessageExpr::ReceiverKind>(Record.readInt());
1565 switch (Kind) {
1567 E->setInstanceReceiver(Record.readSubExpr());
1568 break;
1569
1571 E->setClassReceiver(readTypeSourceInfo());
1572 break;
1573
1576 QualType T = Record.readType();
1577 SourceLocation SuperLoc = readSourceLocation();
1578 E->setSuper(SuperLoc, T, Kind == ObjCMessageExpr::SuperInstance);
1579 break;
1580 }
1581 }
1582
1583 assert(Kind == E->getReceiverKind());
1584
1585 if (Record.readInt())
1586 E->setMethodDecl(readDeclAs<ObjCMethodDecl>());
1587 else
1588 E->setSelector(Record.readSelector());
1589
1590 E->LBracLoc = readSourceLocation();
1591 E->RBracLoc = readSourceLocation();
1592
1593 for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
1594 E->setArg(I, Record.readSubExpr());
1595
1596 SourceLocation *Locs = E->getStoredSelLocs();
1597 for (unsigned I = 0; I != NumStoredSelLocs; ++I)
1598 Locs[I] = readSourceLocation();
1599}
1600
1601void ASTStmtReader::VisitObjCForCollectionStmt(ObjCForCollectionStmt *S) {
1602 VisitStmt(S);
1603 S->setElement(Record.readSubStmt());
1604 S->setCollection(Record.readSubExpr());
1605 S->setBody(Record.readSubStmt());
1606 S->setForLoc(readSourceLocation());
1607 S->setRParenLoc(readSourceLocation());
1608}
1609
1610void ASTStmtReader::VisitObjCAtCatchStmt(ObjCAtCatchStmt *S) {
1611 VisitStmt(S);
1612 S->setCatchBody(Record.readSubStmt());
1613 S->setCatchParamDecl(readDeclAs<VarDecl>());
1614 S->setAtCatchLoc(readSourceLocation());
1615 S->setRParenLoc(readSourceLocation());
1616}
1617
1618void ASTStmtReader::VisitObjCAtFinallyStmt(ObjCAtFinallyStmt *S) {
1619 VisitStmt(S);
1620 S->setFinallyBody(Record.readSubStmt());
1621 S->setAtFinallyLoc(readSourceLocation());
1622}
1623
1624void ASTStmtReader::VisitObjCAutoreleasePoolStmt(ObjCAutoreleasePoolStmt *S) {
1625 VisitStmt(S); // FIXME: no test coverage.
1626 S->setSubStmt(Record.readSubStmt());
1627 S->setAtLoc(readSourceLocation());
1628}
1629
1630void ASTStmtReader::VisitObjCAtTryStmt(ObjCAtTryStmt *S) {
1631 VisitStmt(S);
1632 assert(Record.peekInt() == S->getNumCatchStmts());
1633 Record.skipInts(1);
1634 bool HasFinally = Record.readInt();
1635 S->setTryBody(Record.readSubStmt());
1636 for (unsigned I = 0, N = S->getNumCatchStmts(); I != N; ++I)
1637 S->setCatchStmt(I, cast_or_null<ObjCAtCatchStmt>(Record.readSubStmt()));
1638
1639 if (HasFinally)
1640 S->setFinallyStmt(Record.readSubStmt());
1641 S->setAtTryLoc(readSourceLocation());
1642}
1643
1644void ASTStmtReader::VisitObjCAtSynchronizedStmt(ObjCAtSynchronizedStmt *S) {
1645 VisitStmt(S); // FIXME: no test coverage.
1646 S->setSynchExpr(Record.readSubStmt());
1647 S->setSynchBody(Record.readSubStmt());
1648 S->setAtSynchronizedLoc(readSourceLocation());
1649}
1650
1651void ASTStmtReader::VisitObjCAtThrowStmt(ObjCAtThrowStmt *S) {
1652 VisitStmt(S); // FIXME: no test coverage.
1653 S->setThrowExpr(Record.readSubStmt());
1654 S->setThrowLoc(readSourceLocation());
1655}
1656
1657void ASTStmtReader::VisitObjCBoolLiteralExpr(ObjCBoolLiteralExpr *E) {
1658 VisitExpr(E);
1659 E->setValue(Record.readInt());
1660 E->setLocation(readSourceLocation());
1661}
1662
1663void ASTStmtReader::VisitObjCAvailabilityCheckExpr(ObjCAvailabilityCheckExpr *E) {
1664 VisitExpr(E);
1665 SourceRange R = Record.readSourceRange();
1666 E->AtLoc = R.getBegin();
1667 E->RParen = R.getEnd();
1668 E->VersionToCheck = Record.readVersionTuple();
1669}
1670
1671//===----------------------------------------------------------------------===//
1672// C++ Expressions and Statements
1673//===----------------------------------------------------------------------===//
1674
1675void ASTStmtReader::VisitCXXCatchStmt(CXXCatchStmt *S) {
1676 VisitStmt(S);
1677 S->CatchLoc = readSourceLocation();
1678 S->ExceptionDecl = readDeclAs<VarDecl>();
1679 S->HandlerBlock = Record.readSubStmt();
1680}
1681
1682void ASTStmtReader::VisitCXXTryStmt(CXXTryStmt *S) {
1683 VisitStmt(S);
1684 assert(Record.peekInt() == S->getNumHandlers() && "NumStmtFields is wrong ?");
1685 Record.skipInts(1);
1686 S->TryLoc = readSourceLocation();
1687 S->getStmts()[0] = Record.readSubStmt();
1688 for (unsigned i = 0, e = S->getNumHandlers(); i != e; ++i)
1689 S->getStmts()[i + 1] = Record.readSubStmt();
1690}
1691
1692void ASTStmtReader::VisitCXXForRangeStmt(CXXForRangeStmt *S) {
1693 VisitStmt(S);
1694 S->ForLoc = readSourceLocation();
1695 S->CoawaitLoc = readSourceLocation();
1696 S->ColonLoc = readSourceLocation();
1697 S->RParenLoc = readSourceLocation();
1698 S->setInit(Record.readSubStmt());
1699 S->setRangeStmt(Record.readSubStmt());
1700 S->setBeginStmt(Record.readSubStmt());
1701 S->setEndStmt(Record.readSubStmt());
1702 S->setCond(Record.readSubExpr());
1703 S->setInc(Record.readSubExpr());
1704 S->setLoopVarStmt(Record.readSubStmt());
1705 S->setBody(Record.readSubStmt());
1706}
1707
1708void ASTStmtReader::VisitMSDependentExistsStmt(MSDependentExistsStmt *S) {
1709 VisitStmt(S);
1710 S->KeywordLoc = readSourceLocation();
1711 S->IsIfExists = Record.readInt();
1712 S->QualifierLoc = Record.readNestedNameSpecifierLoc();
1713 S->NameInfo = Record.readDeclarationNameInfo();
1714 S->SubStmt = Record.readSubStmt();
1715}
1716
1717void ASTStmtReader::VisitCXXOperatorCallExpr(CXXOperatorCallExpr *E) {
1718 VisitCallExpr(E);
1719 E->CXXOperatorCallExprBits.OperatorKind = Record.readInt();
1720 E->Range = Record.readSourceRange();
1721}
1722
1723void ASTStmtReader::VisitCXXRewrittenBinaryOperator(
1725 VisitExpr(E);
1726 E->CXXRewrittenBinaryOperatorBits.IsReversed = Record.readInt();
1727 E->SemanticForm = Record.readSubExpr();
1728}
1729
1730void ASTStmtReader::VisitCXXConstructExpr(CXXConstructExpr *E) {
1731 VisitExpr(E);
1732
1733 unsigned NumArgs = Record.readInt();
1734 assert((NumArgs == E->getNumArgs()) && "Wrong NumArgs!");
1735
1736 E->CXXConstructExprBits.Elidable = Record.readInt();
1737 E->CXXConstructExprBits.HadMultipleCandidates = Record.readInt();
1738 E->CXXConstructExprBits.ListInitialization = Record.readInt();
1739 E->CXXConstructExprBits.StdInitListInitialization = Record.readInt();
1740 E->CXXConstructExprBits.ZeroInitialization = Record.readInt();
1741 E->CXXConstructExprBits.ConstructionKind = Record.readInt();
1742 E->CXXConstructExprBits.IsImmediateEscalating = Record.readInt();
1743 E->CXXConstructExprBits.Loc = readSourceLocation();
1744 E->Constructor = readDeclAs<CXXConstructorDecl>();
1745 E->ParenOrBraceRange = readSourceRange();
1746
1747 for (unsigned I = 0; I != NumArgs; ++I)
1748 E->setArg(I, Record.readSubExpr());
1749}
1750
1751void ASTStmtReader::VisitCXXInheritedCtorInitExpr(CXXInheritedCtorInitExpr *E) {
1752 VisitExpr(E);
1753 E->Constructor = readDeclAs<CXXConstructorDecl>();
1754 E->Loc = readSourceLocation();
1755 E->ConstructsVirtualBase = Record.readInt();
1756 E->InheritedFromVirtualBase = Record.readInt();
1757}
1758
1759void ASTStmtReader::VisitCXXTemporaryObjectExpr(CXXTemporaryObjectExpr *E) {
1760 VisitCXXConstructExpr(E);
1761 E->TSI = readTypeSourceInfo();
1762}
1763
1764void ASTStmtReader::VisitLambdaExpr(LambdaExpr *E) {
1765 VisitExpr(E);
1766 unsigned NumCaptures = Record.readInt();
1767 (void)NumCaptures;
1768 assert(NumCaptures == E->LambdaExprBits.NumCaptures);
1769 E->IntroducerRange = readSourceRange();
1770 E->LambdaExprBits.CaptureDefault = Record.readInt();
1771 E->CaptureDefaultLoc = readSourceLocation();
1772 E->LambdaExprBits.ExplicitParams = Record.readInt();
1773 E->LambdaExprBits.ExplicitResultType = Record.readInt();
1774 E->ClosingBrace = readSourceLocation();
1775
1776 // Read capture initializers.
1777 for (LambdaExpr::capture_init_iterator C = E->capture_init_begin(),
1778 CEnd = E->capture_init_end();
1779 C != CEnd; ++C)
1780 *C = Record.readSubExpr();
1781
1782 // The body will be lazily deserialized when needed from the call operator
1783 // declaration.
1784}
1785
1786void
1787ASTStmtReader::VisitCXXStdInitializerListExpr(CXXStdInitializerListExpr *E) {
1788 VisitExpr(E);
1789 E->SubExpr = Record.readSubExpr();
1790}
1791
1792void ASTStmtReader::VisitCXXNamedCastExpr(CXXNamedCastExpr *E) {
1793 VisitExplicitCastExpr(E);
1794 SourceRange R = readSourceRange();
1795 E->Loc = R.getBegin();
1796 E->RParenLoc = R.getEnd();
1797 if (CurrentUnpackingBits->getNextBit())
1798 E->AngleBrackets = readSourceRange();
1799}
1800
1801void ASTStmtReader::VisitCXXStaticCastExpr(CXXStaticCastExpr *E) {
1802 return VisitCXXNamedCastExpr(E);
1803}
1804
1805void ASTStmtReader::VisitCXXDynamicCastExpr(CXXDynamicCastExpr *E) {
1806 return VisitCXXNamedCastExpr(E);
1807}
1808
1809void ASTStmtReader::VisitCXXReinterpretCastExpr(CXXReinterpretCastExpr *E) {
1810 return VisitCXXNamedCastExpr(E);
1811}
1812
1813void ASTStmtReader::VisitCXXAddrspaceCastExpr(CXXAddrspaceCastExpr *E) {
1814 return VisitCXXNamedCastExpr(E);
1815}
1816
1817void ASTStmtReader::VisitCXXConstCastExpr(CXXConstCastExpr *E) {
1818 return VisitCXXNamedCastExpr(E);
1819}
1820
1821void ASTStmtReader::VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr *E) {
1822 VisitExplicitCastExpr(E);
1823 E->setLParenLoc(readSourceLocation());
1824 E->setRParenLoc(readSourceLocation());
1825}
1826
1827void ASTStmtReader::VisitBuiltinBitCastExpr(BuiltinBitCastExpr *E) {
1828 VisitExplicitCastExpr(E);
1829 E->KWLoc = readSourceLocation();
1830 E->RParenLoc = readSourceLocation();
1831}
1832
1833void ASTStmtReader::VisitUserDefinedLiteral(UserDefinedLiteral *E) {
1834 VisitCallExpr(E);
1835 E->UDSuffixLoc = readSourceLocation();
1836}
1837
1838void ASTStmtReader::VisitCXXBoolLiteralExpr(CXXBoolLiteralExpr *E) {
1839 VisitExpr(E);
1840 E->setValue(Record.readInt());
1841 E->setLocation(readSourceLocation());
1842}
1843
1844void ASTStmtReader::VisitCXXNullPtrLiteralExpr(CXXNullPtrLiteralExpr *E) {
1845 VisitExpr(E);
1846 E->setLocation(readSourceLocation());
1847}
1848
1849void ASTStmtReader::VisitCXXTypeidExpr(CXXTypeidExpr *E) {
1850 VisitExpr(E);
1851 E->setSourceRange(readSourceRange());
1852 if (E->isTypeOperand())
1853 E->Operand = readTypeSourceInfo();
1854 else
1855 E->Operand = Record.readSubExpr();
1856}
1857
1858void ASTStmtReader::VisitCXXThisExpr(CXXThisExpr *E) {
1859 VisitExpr(E);
1860 E->setLocation(readSourceLocation());
1861 E->setImplicit(Record.readInt());
1862 E->setCapturedByCopyInLambdaWithExplicitObjectParameter(Record.readInt());
1863}
1864
1865void ASTStmtReader::VisitCXXThrowExpr(CXXThrowExpr *E) {
1866 VisitExpr(E);
1867 E->CXXThrowExprBits.ThrowLoc = readSourceLocation();
1868 E->Operand = Record.readSubExpr();
1869 E->CXXThrowExprBits.IsThrownVariableInScope = Record.readInt();
1870}
1871
1872void ASTStmtReader::VisitCXXDefaultArgExpr(CXXDefaultArgExpr *E) {
1873 VisitExpr(E);
1874 E->Param = readDeclAs<ParmVarDecl>();
1875 E->UsedContext = readDeclAs<DeclContext>();
1876 E->CXXDefaultArgExprBits.Loc = readSourceLocation();
1877 E->CXXDefaultArgExprBits.HasRewrittenInit = Record.readInt();
1878 if (E->CXXDefaultArgExprBits.HasRewrittenInit)
1879 *E->getTrailingObjects<Expr *>() = Record.readSubExpr();
1880}
1881
1882void ASTStmtReader::VisitCXXDefaultInitExpr(CXXDefaultInitExpr *E) {
1883 VisitExpr(E);
1884 E->CXXDefaultInitExprBits.HasRewrittenInit = Record.readInt();
1885 E->Field = readDeclAs<FieldDecl>();
1886 E->UsedContext = readDeclAs<DeclContext>();
1887 E->CXXDefaultInitExprBits.Loc = readSourceLocation();
1888 if (E->CXXDefaultInitExprBits.HasRewrittenInit)
1889 *E->getTrailingObjects<Expr *>() = Record.readSubExpr();
1890}
1891
1892void ASTStmtReader::VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *E) {
1893 VisitExpr(E);
1894 E->setTemporary(Record.readCXXTemporary());
1895 E->setSubExpr(Record.readSubExpr());
1896}
1897
1898void ASTStmtReader::VisitCXXScalarValueInitExpr(CXXScalarValueInitExpr *E) {
1899 VisitExpr(E);
1900 E->TypeInfo = readTypeSourceInfo();
1901 E->CXXScalarValueInitExprBits.RParenLoc = readSourceLocation();
1902}
1903
1904void ASTStmtReader::VisitCXXNewExpr(CXXNewExpr *E) {
1905 VisitExpr(E);
1906
1907 bool IsArray = Record.readInt();
1908 bool HasInit = Record.readInt();
1909 unsigned NumPlacementArgs = Record.readInt();
1910 bool IsParenTypeId = Record.readInt();
1911
1912 E->CXXNewExprBits.IsGlobalNew = Record.readInt();
1913 E->CXXNewExprBits.ShouldPassAlignment = Record.readInt();
1914 E->CXXNewExprBits.UsualArrayDeleteWantsSize = Record.readInt();
1915 E->CXXNewExprBits.HasInitializer = Record.readInt();
1916 E->CXXNewExprBits.StoredInitializationStyle = Record.readInt();
1917
1918 assert((IsArray == E->isArray()) && "Wrong IsArray!");
1919 assert((HasInit == E->hasInitializer()) && "Wrong HasInit!");
1920 assert((NumPlacementArgs == E->getNumPlacementArgs()) &&
1921 "Wrong NumPlacementArgs!");
1922 assert((IsParenTypeId == E->isParenTypeId()) && "Wrong IsParenTypeId!");
1923 (void)IsArray;
1924 (void)HasInit;
1925 (void)NumPlacementArgs;
1926
1927 E->setOperatorNew(readDeclAs<FunctionDecl>());
1928 E->setOperatorDelete(readDeclAs<FunctionDecl>());
1929 E->AllocatedTypeInfo = readTypeSourceInfo();
1930 if (IsParenTypeId)
1931 E->getTrailingObjects<SourceRange>()[0] = readSourceRange();
1932 E->Range = readSourceRange();
1933 E->DirectInitRange = readSourceRange();
1934
1935 // Install all the subexpressions.
1936 for (CXXNewExpr::raw_arg_iterator I = E->raw_arg_begin(),
1937 N = E->raw_arg_end();
1938 I != N; ++I)
1939 *I = Record.readSubStmt();
1940}
1941
1942void ASTStmtReader::VisitCXXDeleteExpr(CXXDeleteExpr *E) {
1943 VisitExpr(E);
1944 E->CXXDeleteExprBits.GlobalDelete = Record.readInt();
1945 E->CXXDeleteExprBits.ArrayForm = Record.readInt();
1946 E->CXXDeleteExprBits.ArrayFormAsWritten = Record.readInt();
1947 E->CXXDeleteExprBits.UsualArrayDeleteWantsSize = Record.readInt();
1948 E->OperatorDelete = readDeclAs<FunctionDecl>();
1949 E->Argument = Record.readSubExpr();
1950 E->CXXDeleteExprBits.Loc = readSourceLocation();
1951}
1952
1953void ASTStmtReader::VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr *E) {
1954 VisitExpr(E);
1955
1956 E->Base = Record.readSubExpr();
1957 E->IsArrow = Record.readInt();
1958 E->OperatorLoc = readSourceLocation();
1959 E->QualifierLoc = Record.readNestedNameSpecifierLoc();
1960 E->ScopeType = readTypeSourceInfo();
1961 E->ColonColonLoc = readSourceLocation();
1962 E->TildeLoc = readSourceLocation();
1963
1964 IdentifierInfo *II = Record.readIdentifier();
1965 if (II)
1966 E->setDestroyedType(II, readSourceLocation());
1967 else
1968 E->setDestroyedType(readTypeSourceInfo());
1969}
1970
1971void ASTStmtReader::VisitExprWithCleanups(ExprWithCleanups *E) {
1972 VisitExpr(E);
1973
1974 unsigned NumObjects = Record.readInt();
1975 assert(NumObjects == E->getNumObjects());
1976 for (unsigned i = 0; i != NumObjects; ++i) {
1977 unsigned CleanupKind = Record.readInt();
1979 if (CleanupKind == COK_Block)
1980 Obj = readDeclAs<BlockDecl>();
1981 else if (CleanupKind == COK_CompoundLiteral)
1982 Obj = cast<CompoundLiteralExpr>(Record.readSubExpr());
1983 else
1984 llvm_unreachable("unexpected cleanup object type");
1985 E->getTrailingObjects<ExprWithCleanups::CleanupObject>()[i] = Obj;
1986 }
1987
1988 E->ExprWithCleanupsBits.CleanupsHaveSideEffects = Record.readInt();
1989 E->SubExpr = Record.readSubExpr();
1990}
1991
1992void ASTStmtReader::VisitCXXDependentScopeMemberExpr(
1994 VisitExpr(E);
1995
1996 CurrentUnpackingBits.emplace(Record.readInt());
1997 bool HasQualifier = CurrentUnpackingBits->getNextBit();
1998 bool HasTemplateInfo = CurrentUnpackingBits->getNextBit();
1999 unsigned NumUnqualifiedLookups = Record.readInt();
2000 unsigned NumTemplateArgs = Record.readInt();
2001 E->CXXDependentScopeMemberExprBits.HasQualifier = HasQualifier;
2002 E->CXXDependentScopeMemberExprBits.NumUnqualifiedLookups =
2003 NumUnqualifiedLookups;
2004 E->CXXDependentScopeMemberExprBits.HasTemplateKWAndArgsInfo = HasTemplateInfo;
2005
2006 E->BaseType = Record.readType();
2008 CurrentUnpackingBits->getNextBit();
2009
2010 if (CurrentUnpackingBits->getNextBit())
2011 E->Base = Record.readSubExpr();
2012 else
2013 E->Base = nullptr;
2014
2015 E->OperatorLoc = Record.readSourceLocation();
2016 E->MemberNameInfo = Record.readDeclarationNameInfo();
2017
2018 if (HasQualifier)
2019 new (E->getTrailingObjects<NestedNameSpecifierLoc>())
2020 NestedNameSpecifierLoc(Record.readNestedNameSpecifierLoc());
2021
2022 for (unsigned I = 0; I != NumUnqualifiedLookups; ++I) {
2023 auto *FoundD = Record.readDeclAs<NamedDecl>();
2024 auto AS = (AccessSpecifier)Record.readInt();
2025 E->getTrailingObjects<DeclAccessPair>()[I] =
2026 DeclAccessPair::make(FoundD, AS);
2027 }
2028
2029 if (HasTemplateInfo)
2031 *E->getTrailingObjects<ASTTemplateKWAndArgsInfo>(),
2032 E->getTrailingObjects<TemplateArgumentLoc>(), NumTemplateArgs);
2033}
2034
2035void
2036ASTStmtReader::VisitDependentScopeDeclRefExpr(DependentScopeDeclRefExpr *E) {
2037 VisitExpr(E);
2038
2039 if (CurrentUnpackingBits->getNextBit()) // HasTemplateKWAndArgsInfo
2041 *E->getTrailingObjects<ASTTemplateKWAndArgsInfo>(),
2042 E->getTrailingObjects<TemplateArgumentLoc>(),
2043 /*NumTemplateArgs=*/CurrentUnpackingBits->getNextBits(/*Width=*/16));
2044
2045 E->QualifierLoc = Record.readNestedNameSpecifierLoc();
2046 E->NameInfo = Record.readDeclarationNameInfo();
2047}
2048
2049void
2050ASTStmtReader::VisitCXXUnresolvedConstructExpr(CXXUnresolvedConstructExpr *E) {
2051 VisitExpr(E);
2052 assert(Record.peekInt() == E->getNumArgs() &&
2053 "Read wrong record during creation ?");
2054 Record.skipInts(1);
2055 for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
2056 E->setArg(I, Record.readSubExpr());
2057 E->TypeAndInitForm.setPointer(readTypeSourceInfo());
2058 E->setLParenLoc(readSourceLocation());
2059 E->setRParenLoc(readSourceLocation());
2060 E->TypeAndInitForm.setInt(Record.readInt());
2061}
2062
2063void ASTStmtReader::VisitOverloadExpr(OverloadExpr *E) {
2064 VisitExpr(E);
2065
2066 unsigned NumResults = Record.readInt();
2067 CurrentUnpackingBits.emplace(Record.readInt());
2068 bool HasTemplateKWAndArgsInfo = CurrentUnpackingBits->getNextBit();
2069 assert((E->getNumDecls() == NumResults) && "Wrong NumResults!");
2070 assert((E->hasTemplateKWAndArgsInfo() == HasTemplateKWAndArgsInfo) &&
2071 "Wrong HasTemplateKWAndArgsInfo!");
2072
2073 if (HasTemplateKWAndArgsInfo) {
2074 unsigned NumTemplateArgs = Record.readInt();
2075 ReadTemplateKWAndArgsInfo(*E->getTrailingASTTemplateKWAndArgsInfo(),
2076 E->getTrailingTemplateArgumentLoc(),
2077 NumTemplateArgs);
2078 assert((E->getNumTemplateArgs() == NumTemplateArgs) &&
2079 "Wrong NumTemplateArgs!");
2080 }
2081
2082 UnresolvedSet<8> Decls;
2083 for (unsigned I = 0; I != NumResults; ++I) {
2084 auto *D = readDeclAs<NamedDecl>();
2085 auto AS = (AccessSpecifier)Record.readInt();
2086 Decls.addDecl(D, AS);
2087 }
2088
2089 DeclAccessPair *Results = E->getTrailingResults();
2091 for (unsigned I = 0; I != NumResults; ++I) {
2092 Results[I] = (Iter + I).getPair();
2093 }
2094
2095 E->NameInfo = Record.readDeclarationNameInfo();
2096 E->QualifierLoc = Record.readNestedNameSpecifierLoc();
2097}
2098
2099void ASTStmtReader::VisitUnresolvedMemberExpr(UnresolvedMemberExpr *E) {
2100 VisitOverloadExpr(E);
2101 E->UnresolvedMemberExprBits.IsArrow = CurrentUnpackingBits->getNextBit();
2102 E->UnresolvedMemberExprBits.HasUnresolvedUsing =
2103 CurrentUnpackingBits->getNextBit();
2104
2105 if (/*!isImplicitAccess=*/CurrentUnpackingBits->getNextBit())
2106 E->Base = Record.readSubExpr();
2107 else
2108 E->Base = nullptr;
2109
2110 E->OperatorLoc = readSourceLocation();
2111
2112 E->BaseType = Record.readType();
2113}
2114
2115void ASTStmtReader::VisitUnresolvedLookupExpr(UnresolvedLookupExpr *E) {
2116 VisitOverloadExpr(E);
2117 E->UnresolvedLookupExprBits.RequiresADL = CurrentUnpackingBits->getNextBit();
2118 E->NamingClass = readDeclAs<CXXRecordDecl>();
2119}
2120
2121void ASTStmtReader::VisitTypeTraitExpr(TypeTraitExpr *E) {
2122 VisitExpr(E);
2123 E->TypeTraitExprBits.NumArgs = Record.readInt();
2124 E->TypeTraitExprBits.Kind = Record.readInt();
2125 E->TypeTraitExprBits.Value = Record.readInt();
2126 SourceRange Range = readSourceRange();
2127 E->Loc = Range.getBegin();
2128 E->RParenLoc = Range.getEnd();
2129
2130 auto **Args = E->getTrailingObjects<TypeSourceInfo *>();
2131 for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
2132 Args[I] = readTypeSourceInfo();
2133}
2134
2135void ASTStmtReader::VisitArrayTypeTraitExpr(ArrayTypeTraitExpr *E) {
2136 VisitExpr(E);
2137 E->ATT = (ArrayTypeTrait)Record.readInt();
2138 E->Value = (unsigned int)Record.readInt();
2139 SourceRange Range = readSourceRange();
2140 E->Loc = Range.getBegin();
2141 E->RParen = Range.getEnd();
2142 E->QueriedType = readTypeSourceInfo();
2143 E->Dimension = Record.readSubExpr();
2144}
2145
2146void ASTStmtReader::VisitExpressionTraitExpr(ExpressionTraitExpr *E) {
2147 VisitExpr(E);
2148 E->ET = (ExpressionTrait)Record.readInt();
2149 E->Value = (bool)Record.readInt();
2150 SourceRange Range = readSourceRange();
2151 E->QueriedExpression = Record.readSubExpr();
2152 E->Loc = Range.getBegin();
2153 E->RParen = Range.getEnd();
2154}
2155
2156void ASTStmtReader::VisitCXXNoexceptExpr(CXXNoexceptExpr *E) {
2157 VisitExpr(E);
2158 E->CXXNoexceptExprBits.Value = Record.readInt();
2159 E->Range = readSourceRange();
2160 E->Operand = Record.readSubExpr();
2161}
2162
2163void ASTStmtReader::VisitPackExpansionExpr(PackExpansionExpr *E) {
2164 VisitExpr(E);
2165 E->EllipsisLoc = readSourceLocation();
2166 E->NumExpansions = Record.readInt();
2167 E->Pattern = Record.readSubExpr();
2168}
2169
2170void ASTStmtReader::VisitSizeOfPackExpr(SizeOfPackExpr *E) {
2171 VisitExpr(E);
2172 unsigned NumPartialArgs = Record.readInt();
2173 E->OperatorLoc = readSourceLocation();
2174 E->PackLoc = readSourceLocation();
2175 E->RParenLoc = readSourceLocation();
2176 E->Pack = Record.readDeclAs<NamedDecl>();
2177 if (E->isPartiallySubstituted()) {
2178 assert(E->Length == NumPartialArgs);
2179 for (auto *I = E->getTrailingObjects<TemplateArgument>(),
2180 *E = I + NumPartialArgs;
2181 I != E; ++I)
2182 new (I) TemplateArgument(Record.readTemplateArgument());
2183 } else if (!E->isValueDependent()) {
2184 E->Length = Record.readInt();
2185 }
2186}
2187
2188void ASTStmtReader::VisitPackIndexingExpr(PackIndexingExpr *E) {
2189 VisitExpr(E);
2190 E->TransformedExpressions = Record.readInt();
2191 E->ExpandedToEmptyPack = Record.readInt();
2192 E->EllipsisLoc = readSourceLocation();
2193 E->RSquareLoc = readSourceLocation();
2194 E->SubExprs[0] = Record.readStmt();
2195 E->SubExprs[1] = Record.readStmt();
2196 auto **Exprs = E->getTrailingObjects<Expr *>();
2197 for (unsigned I = 0; I < E->TransformedExpressions; ++I)
2198 Exprs[I] = Record.readExpr();
2199}
2200
2201void ASTStmtReader::VisitSubstNonTypeTemplateParmExpr(
2203 VisitExpr(E);
2204 E->AssociatedDeclAndRef.setPointer(readDeclAs<Decl>());
2205 E->AssociatedDeclAndRef.setInt(CurrentUnpackingBits->getNextBit());
2206 E->Index = CurrentUnpackingBits->getNextBits(/*Width=*/12);
2207 if (CurrentUnpackingBits->getNextBit())
2208 E->PackIndex = Record.readInt();
2209 else
2210 E->PackIndex = 0;
2211 E->SubstNonTypeTemplateParmExprBits.NameLoc = readSourceLocation();
2212 E->Replacement = Record.readSubExpr();
2213}
2214
2215void ASTStmtReader::VisitSubstNonTypeTemplateParmPackExpr(
2217 VisitExpr(E);
2218 E->AssociatedDecl = readDeclAs<Decl>();
2219 E->Index = Record.readInt();
2220 TemplateArgument ArgPack = Record.readTemplateArgument();
2221 if (ArgPack.getKind() != TemplateArgument::Pack)
2222 return;
2223
2224 E->Arguments = ArgPack.pack_begin();
2225 E->NumArguments = ArgPack.pack_size();
2226 E->NameLoc = readSourceLocation();
2227}
2228
2229void ASTStmtReader::VisitFunctionParmPackExpr(FunctionParmPackExpr *E) {
2230 VisitExpr(E);
2231 E->NumParameters = Record.readInt();
2232 E->ParamPack = readDeclAs<ParmVarDecl>();
2233 E->NameLoc = readSourceLocation();
2234 auto **Parms = E->getTrailingObjects<VarDecl *>();
2235 for (unsigned i = 0, n = E->NumParameters; i != n; ++i)
2236 Parms[i] = readDeclAs<VarDecl>();
2237}
2238
2239void ASTStmtReader::VisitMaterializeTemporaryExpr(MaterializeTemporaryExpr *E) {
2240 VisitExpr(E);
2241 bool HasMaterialzedDecl = Record.readInt();
2242 if (HasMaterialzedDecl)
2243 E->State = cast<LifetimeExtendedTemporaryDecl>(Record.readDecl());
2244 else
2245 E->State = Record.readSubExpr();
2246}
2247
2248void ASTStmtReader::VisitCXXFoldExpr(CXXFoldExpr *E) {
2249 VisitExpr(E);
2250 E->LParenLoc = readSourceLocation();
2251 E->EllipsisLoc = readSourceLocation();
2252 E->RParenLoc = readSourceLocation();
2253 E->NumExpansions = Record.readInt();
2254 E->SubExprs[0] = Record.readSubExpr();
2255 E->SubExprs[1] = Record.readSubExpr();
2256 E->SubExprs[2] = Record.readSubExpr();
2257 E->Opcode = (BinaryOperatorKind)Record.readInt();
2258}
2259
2260void ASTStmtReader::VisitCXXParenListInitExpr(CXXParenListInitExpr *E) {
2261 VisitExpr(E);
2262 unsigned ExpectedNumExprs = Record.readInt();
2263 assert(E->NumExprs == ExpectedNumExprs &&
2264 "expected number of expressions does not equal the actual number of "
2265 "serialized expressions.");
2266 E->NumUserSpecifiedExprs = Record.readInt();
2267 E->InitLoc = readSourceLocation();
2268 E->LParenLoc = readSourceLocation();
2269 E->RParenLoc = readSourceLocation();
2270 for (unsigned I = 0; I < ExpectedNumExprs; I++)
2271 E->getTrailingObjects<Expr *>()[I] = Record.readSubExpr();
2272
2273 bool HasArrayFillerOrUnionDecl = Record.readBool();
2274 if (HasArrayFillerOrUnionDecl) {
2275 bool HasArrayFiller = Record.readBool();
2276 if (HasArrayFiller) {
2277 E->setArrayFiller(Record.readSubExpr());
2278 } else {
2279 E->setInitializedFieldInUnion(readDeclAs<FieldDecl>());
2280 }
2281 }
2282 E->updateDependence();
2283}
2284
2285void ASTStmtReader::VisitOpaqueValueExpr(OpaqueValueExpr *E) {
2286 VisitExpr(E);
2287 E->SourceExpr = Record.readSubExpr();
2288 E->OpaqueValueExprBits.Loc = readSourceLocation();
2289 E->setIsUnique(Record.readInt());
2290}
2291
2292void ASTStmtReader::VisitTypoExpr(TypoExpr *E) {
2293 llvm_unreachable("Cannot read TypoExpr nodes");
2294}
2295
2296void ASTStmtReader::VisitRecoveryExpr(RecoveryExpr *E) {
2297 VisitExpr(E);
2298 unsigned NumArgs = Record.readInt();
2299 E->BeginLoc = readSourceLocation();
2300 E->EndLoc = readSourceLocation();
2301 assert((NumArgs + 0LL ==
2302 std::distance(E->children().begin(), E->children().end())) &&
2303 "Wrong NumArgs!");
2304 (void)NumArgs;
2305 for (Stmt *&Child : E->children())
2306 Child = Record.readSubStmt();
2307}
2308
2309//===----------------------------------------------------------------------===//
2310// Microsoft Expressions and Statements
2311//===----------------------------------------------------------------------===//
2312void ASTStmtReader::VisitMSPropertyRefExpr(MSPropertyRefExpr *E) {
2313 VisitExpr(E);
2314 E->IsArrow = (Record.readInt() != 0);
2315 E->BaseExpr = Record.readSubExpr();
2316 E->QualifierLoc = Record.readNestedNameSpecifierLoc();
2317 E->MemberLoc = readSourceLocation();
2318 E->TheDecl = readDeclAs<MSPropertyDecl>();
2319}
2320
2321void ASTStmtReader::VisitMSPropertySubscriptExpr(MSPropertySubscriptExpr *E) {
2322 VisitExpr(E);
2323 E->setBase(Record.readSubExpr());
2324 E->setIdx(Record.readSubExpr());
2325 E->setRBracketLoc(readSourceLocation());
2326}
2327
2328void ASTStmtReader::VisitCXXUuidofExpr(CXXUuidofExpr *E) {
2329 VisitExpr(E);
2330 E->setSourceRange(readSourceRange());
2331 E->Guid = readDeclAs<MSGuidDecl>();
2332 if (E->isTypeOperand())
2333 E->Operand = readTypeSourceInfo();
2334 else
2335 E->Operand = Record.readSubExpr();
2336}
2337
2338void ASTStmtReader::VisitSEHLeaveStmt(SEHLeaveStmt *S) {
2339 VisitStmt(S);
2340 S->setLeaveLoc(readSourceLocation());
2341}
2342
2343void ASTStmtReader::VisitSEHExceptStmt(SEHExceptStmt *S) {
2344 VisitStmt(S);
2345 S->Loc = readSourceLocation();
2346 S->Children[SEHExceptStmt::FILTER_EXPR] = Record.readSubStmt();
2347 S->Children[SEHExceptStmt::BLOCK] = Record.readSubStmt();
2348}
2349
2350void ASTStmtReader::VisitSEHFinallyStmt(SEHFinallyStmt *S) {
2351 VisitStmt(S);
2352 S->Loc = readSourceLocation();
2353 S->Block = Record.readSubStmt();
2354}
2355
2356void ASTStmtReader::VisitSEHTryStmt(SEHTryStmt *S) {
2357 VisitStmt(S);
2358 S->IsCXXTry = Record.readInt();
2359 S->TryLoc = readSourceLocation();
2360 S->Children[SEHTryStmt::TRY] = Record.readSubStmt();
2361 S->Children[SEHTryStmt::HANDLER] = Record.readSubStmt();
2362}
2363
2364//===----------------------------------------------------------------------===//
2365// CUDA Expressions and Statements
2366//===----------------------------------------------------------------------===//
2367
2368void ASTStmtReader::VisitCUDAKernelCallExpr(CUDAKernelCallExpr *E) {
2369 VisitCallExpr(E);
2370 E->setPreArg(CUDAKernelCallExpr::CONFIG, Record.readSubExpr());
2371}
2372
2373//===----------------------------------------------------------------------===//
2374// OpenCL Expressions and Statements.
2375//===----------------------------------------------------------------------===//
2376void ASTStmtReader::VisitAsTypeExpr(AsTypeExpr *E) {
2377 VisitExpr(E);
2378 E->BuiltinLoc = readSourceLocation();
2379 E->RParenLoc = readSourceLocation();
2380 E->SrcExpr = Record.readSubExpr();
2381}
2382
2383//===----------------------------------------------------------------------===//
2384// OpenMP Directives.
2385//===----------------------------------------------------------------------===//
2386
2387void ASTStmtReader::VisitOMPCanonicalLoop(OMPCanonicalLoop *S) {
2388 VisitStmt(S);
2389 for (Stmt *&SubStmt : S->SubStmts)
2390 SubStmt = Record.readSubStmt();
2391}
2392
2393void ASTStmtReader::VisitOMPExecutableDirective(OMPExecutableDirective *E) {
2394 Record.readOMPChildren(E->Data);
2395 E->setLocStart(readSourceLocation());
2396 E->setLocEnd(readSourceLocation());
2397 E->setMappedDirective(Record.readEnum<OpenMPDirectiveKind>());
2398}
2399
2400void ASTStmtReader::VisitOMPLoopBasedDirective(OMPLoopBasedDirective *D) {
2401 VisitStmt(D);
2402 // Field CollapsedNum was read in ReadStmtFromStream.
2403 Record.skipInts(1);
2404 VisitOMPExecutableDirective(D);
2405}
2406
2407void ASTStmtReader::VisitOMPLoopDirective(OMPLoopDirective *D) {
2408 VisitOMPLoopBasedDirective(D);
2409}
2410
2411void ASTStmtReader::VisitOMPMetaDirective(OMPMetaDirective *D) {
2412 VisitStmt(D);
2413 // The NumClauses field was read in ReadStmtFromStream.
2414 Record.skipInts(1);
2415 VisitOMPExecutableDirective(D);
2416}
2417
2418void ASTStmtReader::VisitOMPParallelDirective(OMPParallelDirective *D) {
2419 VisitStmt(D);
2420 VisitOMPExecutableDirective(D);
2421 D->setHasCancel(Record.readBool());
2422}
2423
2424void ASTStmtReader::VisitOMPSimdDirective(OMPSimdDirective *D) {
2425 VisitOMPLoopDirective(D);
2426}
2427
2428void ASTStmtReader::VisitOMPLoopTransformationDirective(
2430 VisitOMPLoopBasedDirective(D);
2431 D->setNumGeneratedLoops(Record.readUInt32());
2432}
2433
2434void ASTStmtReader::VisitOMPTileDirective(OMPTileDirective *D) {
2435 VisitOMPLoopTransformationDirective(D);
2436}
2437
2438void ASTStmtReader::VisitOMPUnrollDirective(OMPUnrollDirective *D) {
2439 VisitOMPLoopTransformationDirective(D);
2440}
2441
2442void ASTStmtReader::VisitOMPForDirective(OMPForDirective *D) {
2443 VisitOMPLoopDirective(D);
2444 D->setHasCancel(Record.readBool());
2445}
2446
2447void ASTStmtReader::VisitOMPForSimdDirective(OMPForSimdDirective *D) {
2448 VisitOMPLoopDirective(D);
2449}
2450
2451void ASTStmtReader::VisitOMPSectionsDirective(OMPSectionsDirective *D) {
2452 VisitStmt(D);
2453 VisitOMPExecutableDirective(D);
2454 D->setHasCancel(Record.readBool());
2455}
2456
2457void ASTStmtReader::VisitOMPSectionDirective(OMPSectionDirective *D) {
2458 VisitStmt(D);
2459 VisitOMPExecutableDirective(D);
2460 D->setHasCancel(Record.readBool());
2461}
2462
2463void ASTStmtReader::VisitOMPScopeDirective(OMPScopeDirective *D) {
2464 VisitStmt(D);
2465 VisitOMPExecutableDirective(D);
2466}
2467
2468void ASTStmtReader::VisitOMPSingleDirective(OMPSingleDirective *D) {
2469 VisitStmt(D);
2470 VisitOMPExecutableDirective(D);
2471}
2472
2473void ASTStmtReader::VisitOMPMasterDirective(OMPMasterDirective *D) {
2474 VisitStmt(D);
2475 VisitOMPExecutableDirective(D);
2476}
2477
2478void ASTStmtReader::VisitOMPCriticalDirective(OMPCriticalDirective *D) {
2479 VisitStmt(D);
2480 VisitOMPExecutableDirective(D);
2481 D->DirName = Record.readDeclarationNameInfo();
2482}
2483
2484void ASTStmtReader::VisitOMPParallelForDirective(OMPParallelForDirective *D) {
2485 VisitOMPLoopDirective(D);
2486 D->setHasCancel(Record.readBool());
2487}
2488
2489void ASTStmtReader::VisitOMPParallelForSimdDirective(
2491 VisitOMPLoopDirective(D);
2492}
2493
2494void ASTStmtReader::VisitOMPParallelMasterDirective(
2496 VisitStmt(D);
2497 VisitOMPExecutableDirective(D);
2498}
2499
2500void ASTStmtReader::VisitOMPParallelMaskedDirective(
2502 VisitStmt(D);
2503 VisitOMPExecutableDirective(D);
2504}
2505
2506void ASTStmtReader::VisitOMPParallelSectionsDirective(
2508 VisitStmt(D);
2509 VisitOMPExecutableDirective(D);
2510 D->setHasCancel(Record.readBool());
2511}
2512
2513void ASTStmtReader::VisitOMPTaskDirective(OMPTaskDirective *D) {
2514 VisitStmt(D);
2515 VisitOMPExecutableDirective(D);
2516 D->setHasCancel(Record.readBool());
2517}
2518
2519void ASTStmtReader::VisitOMPTaskyieldDirective(OMPTaskyieldDirective *D) {
2520 VisitStmt(D);
2521 VisitOMPExecutableDirective(D);
2522}
2523
2524void ASTStmtReader::VisitOMPBarrierDirective(OMPBarrierDirective *D) {
2525 VisitStmt(D);
2526 VisitOMPExecutableDirective(D);
2527}
2528
2529void ASTStmtReader::VisitOMPTaskwaitDirective(OMPTaskwaitDirective *D) {
2530 VisitStmt(D);
2531 // The NumClauses field was read in ReadStmtFromStream.
2532 Record.skipInts(1);
2533 VisitOMPExecutableDirective(D);
2534}
2535
2536void ASTStmtReader::VisitOMPErrorDirective(OMPErrorDirective *D) {
2537 VisitStmt(D);
2538 // The NumClauses field was read in ReadStmtFromStream.
2539 Record.skipInts(1);
2540 VisitOMPExecutableDirective(D);
2541}
2542
2543void ASTStmtReader::VisitOMPTaskgroupDirective(OMPTaskgroupDirective *D) {
2544 VisitStmt(D);
2545 VisitOMPExecutableDirective(D);
2546}
2547
2548void ASTStmtReader::VisitOMPFlushDirective(OMPFlushDirective *D) {
2549 VisitStmt(D);
2550 VisitOMPExecutableDirective(D);
2551}
2552
2553void ASTStmtReader::VisitOMPDepobjDirective(OMPDepobjDirective *D) {
2554 VisitStmt(D);
2555 VisitOMPExecutableDirective(D);
2556}
2557
2558void ASTStmtReader::VisitOMPScanDirective(OMPScanDirective *D) {
2559 VisitStmt(D);
2560 VisitOMPExecutableDirective(D);
2561}
2562
2563void ASTStmtReader::VisitOMPOrderedDirective(OMPOrderedDirective *D) {
2564 VisitStmt(D);
2565 VisitOMPExecutableDirective(D);
2566}
2567
2568void ASTStmtReader::VisitOMPAtomicDirective(OMPAtomicDirective *D) {
2569 VisitStmt(D);
2570 VisitOMPExecutableDirective(D);
2571 D->Flags.IsXLHSInRHSPart = Record.readBool() ? 1 : 0;
2572 D->Flags.IsPostfixUpdate = Record.readBool() ? 1 : 0;
2573 D->Flags.IsFailOnly = Record.readBool() ? 1 : 0;
2574}
2575
2576void ASTStmtReader::VisitOMPTargetDirective(OMPTargetDirective *D) {
2577 VisitStmt(D);
2578 VisitOMPExecutableDirective(D);
2579}
2580
2581void ASTStmtReader::VisitOMPTargetDataDirective(OMPTargetDataDirective *D) {
2582 VisitStmt(D);
2583 VisitOMPExecutableDirective(D);
2584}
2585
2586void ASTStmtReader::VisitOMPTargetEnterDataDirective(
2588 VisitStmt(D);
2589 VisitOMPExecutableDirective(D);
2590}
2591
2592void ASTStmtReader::VisitOMPTargetExitDataDirective(
2594 VisitStmt(D);
2595 VisitOMPExecutableDirective(D);
2596}
2597
2598void ASTStmtReader::VisitOMPTargetParallelDirective(
2600 VisitStmt(D);
2601 VisitOMPExecutableDirective(D);
2602 D->setHasCancel(Record.readBool());
2603}
2604
2605void ASTStmtReader::VisitOMPTargetParallelForDirective(
2607 VisitOMPLoopDirective(D);
2608 D->setHasCancel(Record.readBool());
2609}
2610
2611void ASTStmtReader::VisitOMPTeamsDirective(OMPTeamsDirective *D) {
2612 VisitStmt(D);
2613 VisitOMPExecutableDirective(D);
2614}
2615
2616void ASTStmtReader::VisitOMPCancellationPointDirective(
2618 VisitStmt(D);
2619 VisitOMPExecutableDirective(D);
2620 D->setCancelRegion(Record.readEnum<OpenMPDirectiveKind>());
2621}
2622
2623void ASTStmtReader::VisitOMPCancelDirective(OMPCancelDirective *D) {
2624 VisitStmt(D);
2625 VisitOMPExecutableDirective(D);
2626 D->setCancelRegion(Record.readEnum<OpenMPDirectiveKind>());
2627}
2628
2629void ASTStmtReader::VisitOMPTaskLoopDirective(OMPTaskLoopDirective *D) {
2630 VisitOMPLoopDirective(D);
2631 D->setHasCancel(Record.readBool());
2632}
2633
2634void ASTStmtReader::VisitOMPTaskLoopSimdDirective(OMPTaskLoopSimdDirective *D) {
2635 VisitOMPLoopDirective(D);
2636}
2637
2638void ASTStmtReader::VisitOMPMasterTaskLoopDirective(
2640 VisitOMPLoopDirective(D);
2641 D->setHasCancel(Record.readBool());
2642}
2643
2644void ASTStmtReader::VisitOMPMaskedTaskLoopDirective(
2646 VisitOMPLoopDirective(D);
2647 D->setHasCancel(Record.readBool());
2648}
2649
2650void ASTStmtReader::VisitOMPMasterTaskLoopSimdDirective(
2652 VisitOMPLoopDirective(D);
2653}
2654
2655void ASTStmtReader::VisitOMPMaskedTaskLoopSimdDirective(
2657 VisitOMPLoopDirective(D);
2658}
2659
2660void ASTStmtReader::VisitOMPParallelMasterTaskLoopDirective(
2662 VisitOMPLoopDirective(D);
2663 D->setHasCancel(Record.readBool());
2664}
2665
2666void ASTStmtReader::VisitOMPParallelMaskedTaskLoopDirective(
2668 VisitOMPLoopDirective(D);
2669 D->setHasCancel(Record.readBool());
2670}
2671
2672void ASTStmtReader::VisitOMPParallelMasterTaskLoopSimdDirective(
2674 VisitOMPLoopDirective(D);
2675}
2676
2677void ASTStmtReader::VisitOMPParallelMaskedTaskLoopSimdDirective(
2679 VisitOMPLoopDirective(D);
2680}
2681
2682void ASTStmtReader::VisitOMPDistributeDirective(OMPDistributeDirective *D) {
2683 VisitOMPLoopDirective(D);
2684}
2685
2686void ASTStmtReader::VisitOMPTargetUpdateDirective(OMPTargetUpdateDirective *D) {
2687 VisitStmt(D);
2688 VisitOMPExecutableDirective(D);
2689}
2690
2691void ASTStmtReader::VisitOMPDistributeParallelForDirective(
2693 VisitOMPLoopDirective(D);
2694 D->setHasCancel(Record.readBool());
2695}
2696
2697void ASTStmtReader::VisitOMPDistributeParallelForSimdDirective(
2699 VisitOMPLoopDirective(D);
2700}
2701
2702void ASTStmtReader::VisitOMPDistributeSimdDirective(
2704 VisitOMPLoopDirective(D);
2705}
2706
2707void ASTStmtReader::VisitOMPTargetParallelForSimdDirective(
2709 VisitOMPLoopDirective(D);
2710}
2711
2712void ASTStmtReader::VisitOMPTargetSimdDirective(OMPTargetSimdDirective *D) {
2713 VisitOMPLoopDirective(D);
2714}
2715
2716void ASTStmtReader::VisitOMPTeamsDistributeDirective(
2718 VisitOMPLoopDirective(D);
2719}
2720
2721void ASTStmtReader::VisitOMPTeamsDistributeSimdDirective(
2723 VisitOMPLoopDirective(D);
2724}
2725
2726void ASTStmtReader::VisitOMPTeamsDistributeParallelForSimdDirective(
2728 VisitOMPLoopDirective(D);
2729}
2730
2731void ASTStmtReader::VisitOMPTeamsDistributeParallelForDirective(
2733 VisitOMPLoopDirective(D);
2734 D->setHasCancel(Record.readBool());
2735}
2736
2737void ASTStmtReader::VisitOMPTargetTeamsDirective(OMPTargetTeamsDirective *D) {
2738 VisitStmt(D);
2739 VisitOMPExecutableDirective(D);
2740}
2741
2742void ASTStmtReader::VisitOMPTargetTeamsDistributeDirective(
2744 VisitOMPLoopDirective(D);
2745}
2746
2747void ASTStmtReader::VisitOMPTargetTeamsDistributeParallelForDirective(
2749 VisitOMPLoopDirective(D);
2750 D->setHasCancel(Record.readBool());
2751}
2752
2753void ASTStmtReader::VisitOMPTargetTeamsDistributeParallelForSimdDirective(
2755 VisitOMPLoopDirective(D);
2756}
2757
2758void ASTStmtReader::VisitOMPTargetTeamsDistributeSimdDirective(
2760 VisitOMPLoopDirective(D);
2761}
2762
2763void ASTStmtReader::VisitOMPInteropDirective(OMPInteropDirective *D) {
2764 VisitStmt(D);
2765 VisitOMPExecutableDirective(D);
2766}
2767
2768void ASTStmtReader::VisitOMPDispatchDirective(OMPDispatchDirective *D) {
2769 VisitStmt(D);
2770 VisitOMPExecutableDirective(D);
2771 D->setTargetCallLoc(Record.readSourceLocation());
2772}
2773
2774void ASTStmtReader::VisitOMPMaskedDirective(OMPMaskedDirective *D) {
2775 VisitStmt(D);
2776 VisitOMPExecutableDirective(D);
2777}
2778
2779void ASTStmtReader::VisitOMPGenericLoopDirective(OMPGenericLoopDirective *D) {
2780 VisitOMPLoopDirective(D);
2781}
2782
2783void ASTStmtReader::VisitOMPTeamsGenericLoopDirective(
2785 VisitOMPLoopDirective(D);
2786}
2787
2788void ASTStmtReader::VisitOMPTargetTeamsGenericLoopDirective(
2790 VisitOMPLoopDirective(D);
2791 D->setCanBeParallelFor(Record.readBool());
2792}
2793
2794void ASTStmtReader::VisitOMPParallelGenericLoopDirective(
2796 VisitOMPLoopDirective(D);
2797}
2798
2799void ASTStmtReader::VisitOMPTargetParallelGenericLoopDirective(
2801 VisitOMPLoopDirective(D);
2802}
2803
2804//===----------------------------------------------------------------------===//
2805// OpenACC Constructs/Directives.
2806//===----------------------------------------------------------------------===//
2807void ASTStmtReader::VisitOpenACCConstructStmt(OpenACCConstructStmt *S) {
2808 (void)Record.readInt();
2809 S->Kind = Record.readEnum<OpenACCDirectiveKind>();
2810 S->Range = Record.readSourceRange();
2811 S->DirectiveLoc = Record.readSourceLocation();
2812 Record.readOpenACCClauseList(S->Clauses);
2813}
2814
2815void ASTStmtReader::VisitOpenACCAssociatedStmtConstruct(
2817 VisitOpenACCConstructStmt(S);
2818 S->setAssociatedStmt(Record.readSubStmt());
2819}
2820
2821void ASTStmtReader::VisitOpenACCComputeConstruct(OpenACCComputeConstruct *S) {
2822 VisitStmt(S);
2823 VisitOpenACCAssociatedStmtConstruct(S);
2824 S->findAndSetChildLoops();
2825}
2826
2827void ASTStmtReader::VisitOpenACCLoopConstruct(OpenACCLoopConstruct *S) {
2828 VisitStmt(S);
2829 VisitOpenACCAssociatedStmtConstruct(S);
2830}
2831
2832//===----------------------------------------------------------------------===//
2833// ASTReader Implementation
2834//===----------------------------------------------------------------------===//
2835
2837 switch (ReadingKind) {
2838 case Read_None:
2839 llvm_unreachable("should not call this when not reading anything");
2840 case Read_Decl:
2841 case Read_Type:
2842 return ReadStmtFromStream(F);
2843 case Read_Stmt:
2844 return ReadSubStmt();
2845 }
2846
2847 llvm_unreachable("ReadingKind not set ?");
2848}
2849
2851 return cast_or_null<Expr>(ReadStmt(F));
2852}
2853
2855 return cast_or_null<Expr>(ReadSubStmt());
2856}
2857
2858// Within the bitstream, expressions are stored in Reverse Polish
2859// Notation, with each of the subexpressions preceding the
2860// expression they are stored in. Subexpressions are stored from last to first.
2861// To evaluate expressions, we continue reading expressions and placing them on
2862// the stack, with expressions having operands removing those operands from the
2863// stack. Evaluation terminates when we see a STMT_STOP record, and
2864// the single remaining expression on the stack is our result.
2865Stmt *ASTReader::ReadStmtFromStream(ModuleFile &F) {
2866 ReadingKindTracker ReadingKind(Read_Stmt, *this);
2867 llvm::BitstreamCursor &Cursor = F.DeclsCursor;
2868
2869 // Map of offset to previously deserialized stmt. The offset points
2870 // just after the stmt record.
2871 llvm::DenseMap<uint64_t, Stmt *> StmtEntries;
2872
2873#ifndef NDEBUG
2874 unsigned PrevNumStmts = StmtStack.size();
2875#endif
2876
2877 ASTRecordReader Record(*this, F);
2878 ASTStmtReader Reader(Record, Cursor);
2880
2881 while (true) {
2883 Cursor.advanceSkippingSubblocks();
2884 if (!MaybeEntry) {
2885 Error(toString(MaybeEntry.takeError()));
2886 return nullptr;
2887 }
2888 llvm::BitstreamEntry Entry = MaybeEntry.get();
2889
2890 switch (Entry.Kind) {
2891 case llvm::BitstreamEntry::SubBlock: // Handled for us already.
2892 case llvm::BitstreamEntry::Error:
2893 Error("malformed block record in AST file");
2894 return nullptr;
2895 case llvm::BitstreamEntry::EndBlock:
2896 goto Done;
2897 case llvm::BitstreamEntry::Record:
2898 // The interesting case.
2899 break;
2900 }
2901
2902 ASTContext &Context = getContext();
2903 Stmt *S = nullptr;
2904 bool Finished = false;
2905 bool IsStmtReference = false;
2906 Expected<unsigned> MaybeStmtCode = Record.readRecord(Cursor, Entry.ID);
2907 if (!MaybeStmtCode) {
2908 Error(toString(MaybeStmtCode.takeError()));
2909 return nullptr;
2910 }
2911 switch ((StmtCode)MaybeStmtCode.get()) {
2912 case STMT_STOP:
2913 Finished = true;
2914 break;
2915
2916 case STMT_REF_PTR:
2917 IsStmtReference = true;
2918 assert(StmtEntries.contains(Record[0]) &&
2919 "No stmt was recorded for this offset reference!");
2920 S = StmtEntries[Record.readInt()];
2921 break;
2922
2923 case STMT_NULL_PTR:
2924 S = nullptr;
2925 break;
2926
2927 case STMT_NULL:
2928 S = new (Context) NullStmt(Empty);
2929 break;
2930
2931 case STMT_COMPOUND: {
2932 unsigned NumStmts = Record[ASTStmtReader::NumStmtFields];
2933 bool HasFPFeatures = Record[ASTStmtReader::NumStmtFields + 1];
2934 S = CompoundStmt::CreateEmpty(Context, NumStmts, HasFPFeatures);
2935 break;
2936 }
2937
2938 case STMT_CASE:
2940 Context,
2941 /*CaseStmtIsGNURange*/ Record[ASTStmtReader::NumStmtFields + 3]);
2942 break;
2943
2944 case STMT_DEFAULT:
2945 S = new (Context) DefaultStmt(Empty);
2946 break;
2947
2948 case STMT_LABEL:
2949 S = new (Context) LabelStmt(Empty);
2950 break;
2951
2952 case STMT_ATTRIBUTED:
2954 Context,
2956 break;
2957
2958 case STMT_IF: {
2960 bool HasElse = IfStmtBits.getNextBit();
2961 bool HasVar = IfStmtBits.getNextBit();
2962 bool HasInit = IfStmtBits.getNextBit();
2963 S = IfStmt::CreateEmpty(Context, HasElse, HasVar, HasInit);
2964 break;
2965 }
2966
2967 case STMT_SWITCH:
2969 Context,
2971 /* HasVar=*/Record[ASTStmtReader::NumStmtFields + 1]);
2972 break;
2973
2974 case STMT_WHILE:
2976 Context,
2978 break;
2979
2980 case STMT_DO:
2981 S = new (Context) DoStmt(Empty);
2982 break;
2983
2984 case STMT_FOR:
2985 S = new (Context) ForStmt(Empty);
2986 break;
2987
2988 case STMT_GOTO:
2989 S = new (Context) GotoStmt(Empty);
2990 break;
2991
2992 case STMT_INDIRECT_GOTO:
2993 S = new (Context) IndirectGotoStmt(Empty);
2994 break;
2995
2996 case STMT_CONTINUE:
2997 S = new (Context) ContinueStmt(Empty);
2998 break;
2999
3000 case STMT_BREAK:
3001 S = new (Context) BreakStmt(Empty);
3002 break;
3003
3004 case STMT_RETURN:
3006 Context, /* HasNRVOCandidate=*/Record[ASTStmtReader::NumStmtFields]);
3007 break;
3008
3009 case STMT_DECL:
3010 S = new (Context) DeclStmt(Empty);
3011 break;
3012
3013 case STMT_GCCASM:
3014 S = new (Context) GCCAsmStmt(Empty);
3015 break;
3016
3017 case STMT_MSASM:
3018 S = new (Context) MSAsmStmt(Empty);
3019 break;
3020
3021 case STMT_CAPTURED:
3024 break;
3025
3026 case EXPR_CONSTANT:
3028 Context, static_cast<ConstantResultStorageKind>(
3029 /*StorageKind=*/Record[ASTStmtReader::NumExprFields]));
3030 break;
3031
3034 break;
3035
3036 case EXPR_PREDEFINED:
3038 Context,
3039 /*HasFunctionName*/ Record[ASTStmtReader::NumExprFields]);
3040 break;
3041
3042 case EXPR_DECL_REF: {
3044 DeclRefExprBits.advance(5);
3045 bool HasFoundDecl = DeclRefExprBits.getNextBit();
3046 bool HasQualifier = DeclRefExprBits.getNextBit();
3047 bool HasTemplateKWAndArgsInfo = DeclRefExprBits.getNextBit();
3048 unsigned NumTemplateArgs = HasTemplateKWAndArgsInfo
3050 : 0;
3051 S = DeclRefExpr::CreateEmpty(Context, HasQualifier, HasFoundDecl,
3052 HasTemplateKWAndArgsInfo, NumTemplateArgs);
3053 break;
3054 }
3055
3057 S = IntegerLiteral::Create(Context, Empty);
3058 break;
3059
3061 S = FixedPointLiteral::Create(Context, Empty);
3062 break;
3063
3065 S = FloatingLiteral::Create(Context, Empty);
3066 break;
3067
3069 S = new (Context) ImaginaryLiteral(Empty);
3070 break;
3071
3074 Context,
3075 /* NumConcatenated=*/Record[ASTStmtReader::NumExprFields],
3076 /* Length=*/Record[ASTStmtReader::NumExprFields + 1],
3077 /* CharByteWidth=*/Record[ASTStmtReader::NumExprFields + 2]);
3078 break;
3079
3081 S = new (Context) CharacterLiteral(Empty);
3082 break;
3083
3084 case EXPR_PAREN:
3085 S = new (Context) ParenExpr(Empty);
3086 break;
3087
3088 case EXPR_PAREN_LIST:
3090 Context,
3091 /* NumExprs=*/Record[ASTStmtReader::NumExprFields]);
3092 break;
3093
3094 case EXPR_UNARY_OPERATOR: {
3096 UnaryOperatorBits.advance(ASTStmtReader::NumExprBits);
3097 bool HasFPFeatures = UnaryOperatorBits.getNextBit();
3098 S = UnaryOperator::CreateEmpty(Context, HasFPFeatures);
3099 break;
3100 }
3101
3102 case EXPR_OFFSETOF:
3103 S = OffsetOfExpr::CreateEmpty(Context,
3106 break;
3107
3109 S = new (Context) UnaryExprOrTypeTraitExpr(Empty);
3110 break;
3111
3113 S = new (Context) ArraySubscriptExpr(Empty);
3114 break;
3115
3117 S = new (Context) MatrixSubscriptExpr(Empty);
3118 break;
3119
3120 case EXPR_ARRAY_SECTION:
3121 S = new (Context) ArraySectionExpr(Empty);
3122 break;
3123
3127 break;
3128
3129 case EXPR_OMP_ITERATOR:
3130 S = OMPIteratorExpr::CreateEmpty(Context,
3132 break;
3133
3134 case EXPR_CALL: {
3135 auto NumArgs = Record[ASTStmtReader::NumExprFields];
3137 CallExprBits.advance(1);
3138 auto HasFPFeatures = CallExprBits.getNextBit();
3139 S = CallExpr::CreateEmpty(Context, NumArgs, HasFPFeatures, Empty);
3140 break;
3141 }
3142
3143 case EXPR_RECOVERY:
3145 Context, /*NumArgs=*/Record[ASTStmtReader::NumExprFields]);
3146 break;
3147
3148 case EXPR_MEMBER: {
3150 bool HasQualifier = ExprMemberBits.getNextBit();
3151 bool HasFoundDecl = ExprMemberBits.getNextBit();
3152 bool HasTemplateInfo = ExprMemberBits.getNextBit();
3153 unsigned NumTemplateArgs = Record[ASTStmtReader::NumExprFields + 1];
3154 S = MemberExpr::CreateEmpty(Context, HasQualifier, HasFoundDecl,
3155 HasTemplateInfo, NumTemplateArgs);
3156 break;
3157 }
3158
3159 case EXPR_BINARY_OPERATOR: {
3161 BinaryOperatorBits.advance(/*Size of opcode*/ 6);
3162 bool HasFPFeatures = BinaryOperatorBits.getNextBit();
3163 S = BinaryOperator::CreateEmpty(Context, HasFPFeatures);
3164 break;
3165 }
3166
3169 BinaryOperatorBits.advance(/*Size of opcode*/ 6);
3170 bool HasFPFeatures = BinaryOperatorBits.getNextBit();
3171 S = CompoundAssignOperator::CreateEmpty(Context, HasFPFeatures);
3172 break;
3173 }
3174
3176 S = new (Context) ConditionalOperator(Empty);
3177 break;
3178
3180 S = new (Context) BinaryConditionalOperator(Empty);
3181 break;
3182
3183 case EXPR_IMPLICIT_CAST: {
3184 unsigned PathSize = Record[ASTStmtReader::NumExprFields];
3186 CastExprBits.advance(7);
3187 bool HasFPFeatures = CastExprBits.getNextBit();
3188 S = ImplicitCastExpr::CreateEmpty(Context, PathSize, HasFPFeatures);
3189 break;
3190 }
3191
3192 case EXPR_CSTYLE_CAST: {
3193 unsigned PathSize = Record[ASTStmtReader::NumExprFields];
3195 CastExprBits.advance(7);
3196 bool HasFPFeatures = CastExprBits.getNextBit();
3197 S = CStyleCastExpr::CreateEmpty(Context, PathSize, HasFPFeatures);
3198 break;
3199 }
3200
3202 S = new (Context) CompoundLiteralExpr(Empty);
3203 break;
3204
3206 S = new (Context) ExtVectorElementExpr(Empty);
3207 break;
3208
3209 case EXPR_INIT_LIST:
3210 S = new (Context) InitListExpr(Empty);
3211 break;
3212
3216
3217 break;
3218
3220 S = new (Context) DesignatedInitUpdateExpr(Empty);
3221 break;
3222
3224 S = new (Context) ImplicitValueInitExpr(Empty);
3225 break;
3226
3227 case EXPR_NO_INIT:
3228 S = new (Context) NoInitExpr(Empty);
3229 break;
3230
3232 S = new (Context) ArrayInitLoopExpr(Empty);
3233 break;
3234
3236 S = new (Context) ArrayInitIndexExpr(Empty);
3237 break;
3238
3239 case EXPR_VA_ARG:
3240 S = new (Context) VAArgExpr(Empty);
3241 break;
3242
3243 case EXPR_SOURCE_LOC:
3244 S = new (Context) SourceLocExpr(Empty);
3245 break;
3246
3248 S = new (Context) EmbedExpr(Empty);
3249 break;
3250
3251 case EXPR_ADDR_LABEL:
3252 S = new (Context) AddrLabelExpr(Empty);
3253 break;
3254
3255 case EXPR_STMT:
3256 S = new (Context) StmtExpr(Empty);
3257 break;
3258
3259 case EXPR_CHOOSE:
3260 S = new (Context) ChooseExpr(Empty);
3261 break;
3262
3263 case EXPR_GNU_NULL:
3264 S = new (Context) GNUNullExpr(Empty);
3265 break;
3266
3268 S = new (Context) ShuffleVectorExpr(Empty);
3269 break;
3270
3272 S = new (Context) ConvertVectorExpr(Empty);
3273 break;
3274
3275 case EXPR_BLOCK:
3276 S = new (Context) BlockExpr(Empty);
3277 break;
3278
3281 Context,
3282 /*NumAssocs=*/Record[ASTStmtReader::NumExprFields]);
3283 break;
3284
3286 S = new (Context) ObjCStringLiteral(Empty);
3287 break;
3288
3290 S = new (Context) ObjCBoxedExpr(Empty);
3291 break;
3292
3296 break;
3297
3302 break;
3303
3304 case EXPR_OBJC_ENCODE:
3305 S = new (Context) ObjCEncodeExpr(Empty);
3306 break;
3307
3309 S = new (Context) ObjCSelectorExpr(Empty);
3310 break;
3311
3313 S = new (Context) ObjCProtocolExpr(Empty);
3314 break;
3315
3317 S = new (Context) ObjCIvarRefExpr(Empty);
3318 break;
3319
3321 S = new (Context) ObjCPropertyRefExpr(Empty);
3322 break;
3323
3325 S = new (Context) ObjCSubscriptRefExpr(Empty);
3326 break;
3327
3329 llvm_unreachable("mismatching AST file");
3330
3332 S = ObjCMessageExpr::CreateEmpty(Context,
3335 break;
3336
3337 case EXPR_OBJC_ISA:
3338 S = new (Context) ObjCIsaExpr(Empty);
3339 break;
3340
3342 S = new (Context) ObjCIndirectCopyRestoreExpr(Empty);
3343 break;
3344
3346 S = new (Context) ObjCBridgedCastExpr(Empty);
3347 break;
3348
3350 S = new (Context) ObjCForCollectionStmt(Empty);
3351 break;
3352
3353 case STMT_OBJC_CATCH:
3354 S = new (Context) ObjCAtCatchStmt(Empty);
3355 break;
3356
3357 case STMT_OBJC_FINALLY:
3358 S = new (Context) ObjCAtFinallyStmt(Empty);
3359 break;
3360
3361 case STMT_OBJC_AT_TRY:
3362 S = ObjCAtTryStmt::CreateEmpty(Context,
3365 break;
3366
3368 S = new (Context) ObjCAtSynchronizedStmt(Empty);
3369 break;
3370
3371 case STMT_OBJC_AT_THROW:
3372 S = new (Context) ObjCAtThrowStmt(Empty);
3373 break;
3374
3376 S = new (Context) ObjCAutoreleasePoolStmt(Empty);
3377 break;
3378
3380 S = new (Context) ObjCBoolLiteralExpr(Empty);
3381 break;
3382
3384 S = new (Context) ObjCAvailabilityCheckExpr(Empty);
3385 break;
3386
3387 case STMT_SEH_LEAVE:
3388 S = new (Context) SEHLeaveStmt(Empty);
3389 break;
3390
3391 case STMT_SEH_EXCEPT:
3392 S = new (Context) SEHExceptStmt(Empty);
3393 break;
3394
3395 case STMT_SEH_FINALLY:
3396 S = new (Context) SEHFinallyStmt(Empty);
3397 break;
3398
3399 case STMT_SEH_TRY:
3400 S = new (Context) SEHTryStmt(Empty);
3401 break;
3402
3403 case STMT_CXX_CATCH:
3404 S = new (Context) CXXCatchStmt(Empty);
3405 break;
3406
3407 case STMT_CXX_TRY:
3408 S = CXXTryStmt::Create(Context, Empty,
3409 /*numHandlers=*/Record[ASTStmtReader::NumStmtFields]);
3410 break;
3411
3412 case STMT_CXX_FOR_RANGE:
3413 S = new (Context) CXXForRangeStmt(Empty);
3414 break;
3415
3417 S = new (Context) MSDependentExistsStmt(SourceLocation(), true,
3420 nullptr);
3421 break;
3422
3424 S = OMPCanonicalLoop::createEmpty(Context);
3425 break;
3426
3430 break;
3431
3433 S =
3436 Empty);
3437 break;
3438
3440 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3441 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3442 S = OMPSimdDirective::CreateEmpty(Context, NumClauses,
3443 CollapsedNum, Empty);
3444 break;
3445 }
3446
3448 unsigned NumLoops = Record[ASTStmtReader::NumStmtFields];
3449 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3450 S = OMPTileDirective::CreateEmpty(Context, NumClauses, NumLoops);
3451 break;
3452 }
3453
3455 assert(Record[ASTStmtReader::NumStmtFields] == 1 && "Unroll directive accepts only a single loop");
3456 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3457 S = OMPUnrollDirective::CreateEmpty(Context, NumClauses);
3458 break;
3459 }
3460
3462 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3463 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3464 S = OMPForDirective::CreateEmpty(Context, NumClauses, CollapsedNum,
3465 Empty);
3466 break;
3467 }
3468
3470 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3471 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3472 S = OMPForSimdDirective::CreateEmpty(Context, NumClauses, CollapsedNum,
3473 Empty);
3474 break;
3475 }
3476
3480 break;
3481
3484 break;
3485
3489 break;
3490
3494 break;
3495
3498 break;
3499
3503 break;
3504
3506 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3507 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3508 S = OMPParallelForDirective::CreateEmpty(Context, NumClauses,
3509 CollapsedNum, Empty);
3510 break;
3511 }
3512
3514 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3515 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3516 S = OMPParallelForSimdDirective::CreateEmpty(Context, NumClauses,
3517 CollapsedNum, Empty);
3518 break;
3519 }
3520
3524 break;
3525
3529 break;
3530
3534 break;
3535
3539 break;
3540
3543 break;
3544
3547 break;
3548
3552 break;
3553
3557 break;
3558
3562 break;
3563
3567 break;
3568
3572 break;
3573
3577 break;
3578
3580 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
3581 bool HasAssociatedStmt = Record[ASTStmtReader::NumStmtFields + 2];
3582 S = OMPOrderedDirective::CreateEmpty(Context, NumClauses,
3583 !HasAssociatedStmt, Empty);
3584 break;
3585 }
3586
3590 break;
3591
3595 break;
3596
3600 break;
3601
3605 break;
3606
3610 break;
3611
3615 break;
3616
3618 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3619 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3620 S = OMPTargetParallelForDirective::CreateEmpty(Context, NumClauses,
3621 CollapsedNum, Empty);
3622 break;
3623 }
3624
3628 break;
3629
3633 break;
3634
3637 break;
3638
3642 break;
3643
3645 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3646 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3647 S = OMPTaskLoopDirective::CreateEmpty(Context, NumClauses, CollapsedNum,
3648 Empty);
3649 break;
3650 }
3651
3653 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3654 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3655 S = OMPTaskLoopSimdDirective::CreateEmpty(Context, NumClauses,
3656 CollapsedNum, Empty);
3657 break;
3658 }
3659
3661 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3662 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3663 S = OMPMasterTaskLoopDirective::CreateEmpty(Context, NumClauses,
3664 CollapsedNum, Empty);
3665 break;
3666 }
3667
3669 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3670 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3671 S = OMPMaskedTaskLoopDirective::CreateEmpty(Context, NumClauses,
3672 CollapsedNum, Empty);
3673 break;
3674 }
3675
3677 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3678 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3679 S = OMPMasterTaskLoopSimdDirective::CreateEmpty(Context, NumClauses,
3680 CollapsedNum, Empty);
3681 break;
3682 }
3683
3685 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3686 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3687 S = OMPMaskedTaskLoopSimdDirective::CreateEmpty(Context, NumClauses,
3688 CollapsedNum, Empty);
3689 break;
3690 }
3691
3693 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3694 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3696 CollapsedNum, Empty);
3697 break;
3698 }
3699
3701 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3702 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3704 CollapsedNum, Empty);
3705 break;
3706 }
3707
3709 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3710 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3712 Context, NumClauses, CollapsedNum, Empty);
3713 break;
3714 }
3715
3717 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3718 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3720 Context, NumClauses, CollapsedNum, Empty);
3721 break;
3722 }
3723
3725 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3726 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3727 S = OMPDistributeDirective::CreateEmpty(Context, NumClauses, CollapsedNum,
3728 Empty);
3729 break;
3730 }
3731
3733 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3734 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3735 S = OMPDistributeParallelForDirective::CreateEmpty(Context, NumClauses,
3736 CollapsedNum, Empty);
3737 break;
3738 }
3739
3741 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3742 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3744 CollapsedNum,
3745 Empty);
3746 break;
3747 }
3748
3750 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3751 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3752 S = OMPDistributeSimdDirective::CreateEmpty(Context, NumClauses,
3753 CollapsedNum, Empty);
3754 break;
3755 }
3756
3758 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3759 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3760 S = OMPTargetParallelForSimdDirective::CreateEmpty(Context, NumClauses,
3761 CollapsedNum, Empty);
3762 break;
3763 }
3764
3766 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3767 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3768 S = OMPTargetSimdDirective::CreateEmpty(Context, NumClauses, CollapsedNum,
3769 Empty);
3770 break;
3771 }
3772
3774 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3775 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3776 S = OMPTeamsDistributeDirective::CreateEmpty(Context, NumClauses,
3777 CollapsedNum, Empty);
3778 break;
3779 }
3780
3782 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3783 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3784 S = OMPTeamsDistributeSimdDirective::CreateEmpty(Context, NumClauses,
3785 CollapsedNum, Empty);
3786 break;
3787 }
3788
3790 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3791 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3793 Context, NumClauses, CollapsedNum, Empty);
3794 break;
3795 }
3796
3798 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3799 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3801 Context, NumClauses, CollapsedNum, Empty);
3802 break;
3803 }
3804
3808 break;
3809
3811 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3812 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3813 S = OMPTargetTeamsDistributeDirective::CreateEmpty(Context, NumClauses,
3814 CollapsedNum, Empty);
3815 break;
3816 }
3817
3819 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3820 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3822 Context, NumClauses, CollapsedNum, Empty);
3823 break;
3824 }
3825
3827 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3828 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3830 Context, NumClauses, CollapsedNum, Empty);
3831 break;
3832 }
3833
3835 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3836 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3838 Context, NumClauses, CollapsedNum, Empty);
3839 break;
3840 }
3841
3845 break;
3846
3850 break;
3851
3855 break;
3856
3858 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3859 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3860 S = OMPGenericLoopDirective::CreateEmpty(Context, NumClauses,
3861 CollapsedNum, Empty);
3862 break;
3863 }
3864
3866 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3867 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3868 S = OMPTeamsGenericLoopDirective::CreateEmpty(Context, NumClauses,
3869 CollapsedNum, Empty);
3870 break;
3871 }
3872
3874 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3875 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3877 CollapsedNum, Empty);
3878 break;
3879 }
3880
3882 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3883 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3884 S = OMPParallelGenericLoopDirective::CreateEmpty(Context, NumClauses,
3885 CollapsedNum, Empty);
3886 break;
3887 }
3888
3890 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3891 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3893 Context, NumClauses, CollapsedNum, Empty);
3894 break;
3895 }
3896
3898 auto NumArgs = Record[ASTStmtReader::NumExprFields];
3900 CallExprBits.advance(1);
3901 auto HasFPFeatures = CallExprBits.getNextBit();
3902 S = CXXOperatorCallExpr::CreateEmpty(Context, NumArgs, HasFPFeatures,
3903 Empty);
3904 break;
3905 }
3906
3907 case EXPR_CXX_MEMBER_CALL: {
3908 auto NumArgs = Record[ASTStmtReader::NumExprFields];
3910 CallExprBits.advance(1);
3911 auto HasFPFeatures = CallExprBits.getNextBit();
3912 S = CXXMemberCallExpr::CreateEmpty(Context, NumArgs, HasFPFeatures,
3913 Empty);
3914 break;
3915 }
3916
3918 S = new (Context) CXXRewrittenBinaryOperator(Empty);
3919 break;
3920
3921 case EXPR_CXX_CONSTRUCT:
3923 Context,
3924 /* NumArgs=*/Record[ASTStmtReader::NumExprFields]);
3925 break;
3926
3928 S = new (Context) CXXInheritedCtorInitExpr(Empty);
3929 break;
3930
3933 Context,
3934 /* NumArgs=*/Record[ASTStmtReader::NumExprFields]);
3935 break;
3936
3937 case EXPR_CXX_STATIC_CAST: {
3938 unsigned PathSize = Record[ASTStmtReader::NumExprFields];
3940 CastExprBits.advance(7);
3941 bool HasFPFeatures = CastExprBits.getNextBit();
3942 S = CXXStaticCastExpr::CreateEmpty(Context, PathSize, HasFPFeatures);
3943 break;
3944 }
3945
3946 case EXPR_CXX_DYNAMIC_CAST: {
3947 unsigned PathSize = Record[ASTStmtReader::NumExprFields];
3948 S = CXXDynamicCastExpr::CreateEmpty(Context, PathSize);
3949 break;
3950 }
3951
3953 unsigned PathSize = Record[ASTStmtReader::NumExprFields];
3954 S = CXXReinterpretCastExpr::CreateEmpty(Context, PathSize);
3955 break;
3956 }
3957
3959 S = CXXConstCastExpr::CreateEmpty(Context);
3960 break;
3961
3964 break;
3965
3967 unsigned PathSize = Record[ASTStmtReader::NumExprFields];
3969 CastExprBits.advance(7);
3970 bool HasFPFeatures = CastExprBits.getNextBit();
3971 S = CXXFunctionalCastExpr::CreateEmpty(Context, PathSize, HasFPFeatures);
3972 break;
3973 }
3974
3975 case EXPR_BUILTIN_BIT_CAST: {
3976#ifndef NDEBUG
3977 unsigned PathSize = Record[ASTStmtReader::NumExprFields];
3978 assert(PathSize == 0 && "Wrong PathSize!");
3979#endif
3980 S = new (Context) BuiltinBitCastExpr(Empty);
3981 break;
3982 }
3983
3985 auto NumArgs = Record[ASTStmtReader::NumExprFields];
3987 CallExprBits.advance(1);
3988 auto HasFPFeatures = CallExprBits.getNextBit();
3989 S = UserDefinedLiteral::CreateEmpty(Context, NumArgs, HasFPFeatures,
3990 Empty);
3991 break;
3992 }
3993
3995 S = new (Context) CXXStdInitializerListExpr(Empty);
3996 break;
3997
3999 S = new (Context) CXXBoolLiteralExpr(Empty);
4000 break;
4001
4003 S = new (Context) CXXNullPtrLiteralExpr(Empty);
4004 break;
4005
4007 S = new (Context) CXXTypeidExpr(Empty, true);
4008 break;
4009
4011 S = new (Context) CXXTypeidExpr(Empty, false);
4012 break;
4013
4015 S = new (Context) CXXUuidofExpr(Empty, true);
4016 break;
4017
4019 S = new (Context) MSPropertyRefExpr(Empty);
4020 break;
4021
4023 S = new (Context) MSPropertySubscriptExpr(Empty);
4024 break;
4025
4027 S = new (Context) CXXUuidofExpr(Empty, false);
4028 break;
4029
4030 case EXPR_CXX_THIS:
4031 S = CXXThisExpr::CreateEmpty(Context);
4032 break;
4033
4034 case EXPR_CXX_THROW:
4035 S = new (Context) CXXThrowExpr(Empty);
4036 break;
4037
4040 Context, /*HasRewrittenInit=*/Record[ASTStmtReader::NumExprFields]);
4041 break;
4042
4045 Context, /*HasRewrittenInit=*/Record[ASTStmtReader::NumExprFields]);
4046 break;
4047
4049 S = new (Context) CXXBindTemporaryExpr(Empty);
4050 break;
4051
4053 S = new (Context) CXXScalarValueInitExpr(Empty);
4054 break;
4055
4056 case EXPR_CXX_NEW:
4058 Context,
4060 /*HasInit=*/Record[ASTStmtReader::NumExprFields + 1],
4061 /*NumPlacementArgs=*/Record[ASTStmtReader::NumExprFields + 2],
4062 /*IsParenTypeId=*/Record[ASTStmtReader::NumExprFields + 3]);
4063 break;
4064
4065 case EXPR_CXX_DELETE:
4066 S = new (Context) CXXDeleteExpr(Empty);
4067 break;
4068
4070 S = new (Context) CXXPseudoDestructorExpr(Empty);
4071 break;
4072
4074 S = ExprWithCleanups::Create(Context, Empty,
4076 break;
4077
4079 BitsUnpacker DependentScopeMemberBits(
4081 bool HasQualifier = DependentScopeMemberBits.getNextBit();
4082 bool HasTemplateInfo = DependentScopeMemberBits.getNextBit();
4083 unsigned NumUnqualifiedLookups = Record[ASTStmtReader::NumExprFields + 1];
4084 unsigned NumTemplateArgs = Record[ASTStmtReader::NumExprFields + 2];
4085
4087 Context, HasQualifier, NumUnqualifiedLookups, HasTemplateInfo,
4088 NumTemplateArgs);
4089 break;
4090 }
4091
4093 BitsUnpacker DependentScopeDeclRefBits(
4095 DependentScopeDeclRefBits.advance(ASTStmtReader::NumExprBits);
4096 bool HasTemplateKWAndArgsInfo = DependentScopeDeclRefBits.getNextBit();
4097 unsigned NumTemplateArgs =
4098 HasTemplateKWAndArgsInfo
4099 ? DependentScopeDeclRefBits.getNextBits(/*Width=*/16)
4100 : 0;
4102 Context, HasTemplateKWAndArgsInfo, NumTemplateArgs);
4103 break;
4104 }
4105
4109 break;
4110
4112 auto NumResults = Record[ASTStmtReader::NumExprFields];
4113 BitsUnpacker OverloadExprBits(Record[ASTStmtReader::NumExprFields + 1]);
4114 auto HasTemplateKWAndArgsInfo = OverloadExprBits.getNextBit();
4115 auto NumTemplateArgs = HasTemplateKWAndArgsInfo
4117 : 0;
4119 Context, NumResults, HasTemplateKWAndArgsInfo, NumTemplateArgs);
4120 break;
4121 }
4122
4124 auto NumResults = Record[ASTStmtReader::NumExprFields];
4125 BitsUnpacker OverloadExprBits(Record[ASTStmtReader::NumExprFields + 1]);
4126 auto HasTemplateKWAndArgsInfo = OverloadExprBits.getNextBit();
4127 auto NumTemplateArgs = HasTemplateKWAndArgsInfo
4129 : 0;
4131 Context, NumResults, HasTemplateKWAndArgsInfo, NumTemplateArgs);
4132 break;
4133 }
4134
4135 case EXPR_TYPE_TRAIT:
4138 break;
4139
4141 S = new (Context) ArrayTypeTraitExpr(Empty);
4142 break;
4143
4145 S = new (Context) ExpressionTraitExpr(Empty);
4146 break;
4147
4148 case EXPR_CXX_NOEXCEPT:
4149 S = new (Context) CXXNoexceptExpr(Empty);
4150 break;
4151
4153 S = new (Context) PackExpansionExpr(Empty);
4154 break;
4155
4156 case EXPR_SIZEOF_PACK:
4158 Context,
4159 /*NumPartialArgs=*/Record[ASTStmtReader::NumExprFields]);
4160 break;
4161
4162 case EXPR_PACK_INDEXING:
4164 Context,
4165 /*TransformedExprs=*/Record[ASTStmtReader::NumExprFields]);
4166 break;
4167
4169 S = new (Context) SubstNonTypeTemplateParmExpr(Empty);
4170 break;
4171
4173 S = new (Context) SubstNonTypeTemplateParmPackExpr(Empty);
4174 break;
4175
4179 break;
4180
4182 S = new (Context) MaterializeTemporaryExpr(Empty);
4183 break;
4184
4185 case EXPR_CXX_FOLD:
4186 S = new (Context) CXXFoldExpr(Empty);
4187 break;
4188
4191 Context, /*numExprs=*/Record[ASTStmtReader::NumExprFields], Empty);
4192 break;
4193
4194 case EXPR_OPAQUE_VALUE:
4195 S = new (Context) OpaqueValueExpr(Empty);
4196 break;
4197
4198 case EXPR_CUDA_KERNEL_CALL: {
4199 auto NumArgs = Record[ASTStmtReader::NumExprFields];
4201 CallExprBits.advance(1);
4202 auto HasFPFeatures = CallExprBits.getNextBit();
4203 S = CUDAKernelCallExpr::CreateEmpty(Context, NumArgs, HasFPFeatures,
4204 Empty);
4205 break;
4206 }
4207
4208 case EXPR_ASTYPE:
4209 S = new (Context) AsTypeExpr(Empty);
4210 break;
4211
4212 case EXPR_PSEUDO_OBJECT: {
4213 unsigned numSemanticExprs = Record[ASTStmtReader::NumExprFields];
4214 S = PseudoObjectExpr::Create(Context, Empty, numSemanticExprs);
4215 break;
4216 }
4217
4218 case EXPR_ATOMIC:
4219 S = new (Context) AtomicExpr(Empty);
4220 break;
4221
4222 case EXPR_LAMBDA: {
4223 unsigned NumCaptures = Record[ASTStmtReader::NumExprFields];
4224 S = LambdaExpr::CreateDeserialized(Context, NumCaptures);
4225 break;
4226 }
4227
4228 case STMT_COROUTINE_BODY: {
4229 unsigned NumParams = Record[ASTStmtReader::NumStmtFields];
4230 S = CoroutineBodyStmt::Create(Context, Empty, NumParams);
4231 break;
4232 }
4233
4234 case STMT_CORETURN:
4235 S = new (Context) CoreturnStmt(Empty);
4236 break;
4237
4238 case EXPR_COAWAIT:
4239 S = new (Context) CoawaitExpr(Empty);
4240 break;
4241
4242 case EXPR_COYIELD:
4243 S = new (Context) CoyieldExpr(Empty);
4244 break;
4245
4247 S = new (Context) DependentCoawaitExpr(Empty);
4248 break;
4249
4251 S = new (Context) ConceptSpecializationExpr(Empty);
4252 break;
4253 }
4255 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
4256 S = OpenACCComputeConstruct::CreateEmpty(Context, NumClauses);
4257 break;
4258 }
4260 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
4261 S = OpenACCLoopConstruct::CreateEmpty(Context, NumClauses);
4262 break;
4263 }
4264 case EXPR_REQUIRES:
4265 unsigned numLocalParameters = Record[ASTStmtReader::NumExprFields];
4266 unsigned numRequirement = Record[ASTStmtReader::NumExprFields + 1];
4267 S = RequiresExpr::Create(Context, Empty, numLocalParameters,
4268 numRequirement);
4269 break;
4270 }
4271
4272 // We hit a STMT_STOP, so we're done with this expression.
4273 if (Finished)
4274 break;
4275
4276 ++NumStatementsRead;
4277
4278 if (S && !IsStmtReference) {
4279 Reader.Visit(S);
4280 StmtEntries[Cursor.GetCurrentBitNo()] = S;
4281 }
4282
4283 assert(Record.getIdx() == Record.size() &&
4284 "Invalid deserialization of statement");
4285 StmtStack.push_back(S);
4286 }
4287Done:
4288 assert(StmtStack.size() > PrevNumStmts && "Read too many sub-stmts!");
4289 assert(StmtStack.size() == PrevNumStmts + 1 && "Extra expressions on stack!");
4290 return StmtStack.pop_back_val();
4291}
This file provides AST data structures related to concepts.
Defines the clang::ASTContext interface.
static concepts::Requirement::SubstitutionDiagnostic * readSubstitutionDiagnostic(ASTRecordReader &Record)
static ConstraintSatisfaction readConstraintSatisfaction(ASTRecordReader &Record)
const Decl * D
Expr * E
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
Defines the C++ template declaration subclasses.
Defines the clang::Expr interface and subclasses for C++ expressions.
Defines enumerations for expression traits intrinsics.
unsigned Iter
Definition: HTMLLogger.cpp:154
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Defines several types used to describe C++ lambda expressions that are shared between the parser and ...
Defines the clang::LangOptions interface.
llvm::MachO::Record Record
Definition: MachO.h:31
This file defines OpenMP AST classes for clauses.
Defines some OpenMP-specific enums and functions.
Defines an enumeration for C++ overloaded operators.
static std::string toString(const clang::SanitizerSet &Sanitizers)
Produce a string containing comma-separated names of sanitizers in Sanitizers set.
SourceRange Range
Definition: SemaObjC.cpp:757
Defines the clang::SourceLocation class and associated facilities.
Defines various enumerations that describe declaration and type specifiers.
Defines the Objective-C statement AST node classes.
This file defines OpenMP AST classes for executable directives and clauses.
Defines enumerations for the type traits support.
C Language Family Type Representation.
SourceLocation Begin
__device__ int
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:186
ASTContext & getContext()
Retrieve the AST context that this AST reader supplements.
Definition: ASTReader.h:2375
Stmt * ReadSubStmt()
Reads a sub-statement operand during statement reading.
Definition: ASTReader.h:2330
Expr * ReadSubExpr()
Reads a sub-expression operand during statement reading.
Expr * ReadExpr(ModuleFile &F)
Reads an expression.
Stmt * ReadStmt(ModuleFile &F)
Reads a statement.
An object for streaming information from a record.
static const unsigned NumExprFields
The number of record fields required for the Expr class itself.
static const unsigned NumStmtFields
The number of record fields required for the Stmt class itself.
void VisitStmt(Stmt *S)
static const unsigned NumExprBits
The number of bits required for the packing bits for the Expr class.
void ReadTemplateKWAndArgsInfo(ASTTemplateKWAndArgsInfo &Args, TemplateArgumentLoc *ArgsLocArray, unsigned NumTemplateArgs)
Read and initialize a ExplicitTemplateArgumentList structure.
ASTStmtReader(ASTRecordReader &Record, llvm::BitstreamCursor &Cursor)
AddrLabelExpr - The GNU address of label extension, representing &&label.
Definition: Expr.h:4343
Represents the index of the current element of an array being initialized by an ArrayInitLoopExpr.
Definition: Expr.h:5727
Represents a loop initializing the elements of an array.
Definition: Expr.h:5674
This class represents BOTH the OpenMP Array Section and OpenACC 'subarray', with a boolean differenti...
Definition: Expr.h:6897
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
Definition: Expr.h:2669
An Embarcadero array type trait, as used in the implementation of __array_rank and __array_extent.
Definition: ExprCXX.h:2852
AsTypeExpr - Clang builtin function __builtin_astype [OpenCL 6.2.4.2] This AST node provides support ...
Definition: Expr.h:6397
AsmStmt is the base class for GCCAsmStmt and MSAsmStmt.
Definition: Stmt.h:3101
AtomicExpr - Variadic atomic builtins: __atomic_exchange, __atomic_fetch_*, __atomic_load,...
Definition: Expr.h:6600
unsigned getNumSubExprs() const
Definition: Expr.h:6675
Represents an attribute applied to a statement.
Definition: Stmt.h:2081
static AttributedStmt * CreateEmpty(const ASTContext &C, unsigned NumAttrs)
Definition: Stmt.cpp:434
BinaryConditionalOperator - The GNU extension to the conditional operator which allows the middle ope...
Definition: Expr.h:4246
A builtin binary operation expression such as "x + y" or "x <= y".
Definition: Expr.h:3845
static BinaryOperator * CreateEmpty(const ASTContext &C, bool hasFPFeatures)
Definition: Expr.cpp:4796
A simple helper class to unpack an integer to bits and consuming the bits in order.
Definition: ASTReader.h:2437
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
Definition: Expr.h:6336
BreakStmt - This represents a break.
Definition: Stmt.h:2981
Represents a C++2a __builtin_bit_cast(T, v) expression.
Definition: ExprCXX.h:5304
CStyleCastExpr - An explicit cast in C (C99 6.5.4) or a C-style cast in C++ (C++ [expr....
Definition: Expr.h:3776
static CStyleCastExpr * CreateEmpty(const ASTContext &Context, unsigned PathSize, bool HasFPFeatures)
Definition: Expr.cpp:2123
Represents a call to a CUDA kernel function.
Definition: ExprCXX.h:231
static CUDAKernelCallExpr * CreateEmpty(const ASTContext &Ctx, unsigned NumArgs, bool HasFPFeatures, EmptyShell Empty)
Definition: ExprCXX.cpp:1931
A C++ addrspace_cast expression (currently only enabled for OpenCL).
Definition: ExprCXX.h:601
static CXXAddrspaceCastExpr * CreateEmpty(const ASTContext &Context)
Definition: ExprCXX.cpp:895
Represents a base class of a C++ class.
Definition: DeclCXX.h:146
Represents binding an expression to a temporary.
Definition: ExprCXX.h:1491
A boolean literal, per ([C++ lex.bool] Boolean literals).
Definition: ExprCXX.h:720
CXXCatchStmt - This represents a C++ catch block.
Definition: StmtCXX.h:28
A C++ const_cast expression (C++ [expr.const.cast]).
Definition: ExprCXX.h:563
static CXXConstCastExpr * CreateEmpty(const ASTContext &Context)
Definition: ExprCXX.cpp:882
Represents a call to a C++ constructor.
Definition: ExprCXX.h:1546
static CXXConstructExpr * CreateEmpty(const ASTContext &Ctx, unsigned NumArgs)
Create an empty C++ construction expression.
Definition: ExprCXX.cpp:1172
A default argument (C++ [dcl.fct.default]).
Definition: ExprCXX.h:1268
static CXXDefaultArgExpr * CreateEmpty(const ASTContext &C, bool HasRewrittenInit)
Definition: ExprCXX.cpp:1009
A use of a default initializer in a constructor or in aggregate initialization.
Definition: ExprCXX.h:1375
static CXXDefaultInitExpr * CreateEmpty(const ASTContext &C, bool HasRewrittenInit)
Definition: ExprCXX.cpp:1063
Represents a delete expression for memory deallocation and destructor calls, e.g.
Definition: ExprCXX.h:2497
Represents a C++ member access expression where the actual member referenced could not be resolved be...
Definition: ExprCXX.h:3681
static CXXDependentScopeMemberExpr * CreateEmpty(const ASTContext &Ctx, bool HasQualifier, unsigned NumUnqualifiedLookups, bool HasTemplateKWAndArgsInfo, unsigned NumTemplateArgs)
Definition: ExprCXX.cpp:1561
A C++ dynamic_cast expression (C++ [expr.dynamic.cast]).
Definition: ExprCXX.h:478
static CXXDynamicCastExpr * CreateEmpty(const ASTContext &Context, unsigned pathSize)
Definition: ExprCXX.cpp:804
Represents a folding of a pack over an operator.
Definition: ExprCXX.h:4844
CXXForRangeStmt - This represents C++0x [stmt.ranged]'s ranged for statement, represented as 'for (ra...
Definition: StmtCXX.h:135
Represents an explicit C++ type conversion that uses "functional" notation (C++ [expr....
Definition: ExprCXX.h:1817
static CXXFunctionalCastExpr * CreateEmpty(const ASTContext &Context, unsigned PathSize, bool HasFPFeatures)
Definition: ExprCXX.cpp:915
Represents a call to an inherited base class constructor from an inheriting constructor.
Definition: ExprCXX.h:1737
Represents a call to a member function that may be written either with member call syntax (e....
Definition: ExprCXX.h:176
static CXXMemberCallExpr * CreateEmpty(const ASTContext &Ctx, unsigned NumArgs, bool HasFPFeatures, EmptyShell Empty)
Definition: ExprCXX.cpp:689
Abstract class common to all of the C++ "named"/"keyword" casts.
Definition: ExprCXX.h:372
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)".
Definition: ExprCXX.h:2240
static CXXNewExpr * CreateEmpty(const ASTContext &Ctx, bool IsArray, bool HasInit, unsigned NumPlacementArgs, bool IsParenTypeId)
Create an empty c++ new expression.
Definition: ExprCXX.cpp:315
Represents a C++11 noexcept expression (C++ [expr.unary.noexcept]).
Definition: ExprCXX.h:4130
The null pointer literal (C++11 [lex.nullptr])
Definition: ExprCXX.h:765
A call to an overloaded operator written using operator syntax.
Definition: ExprCXX.h:81
static CXXOperatorCallExpr * CreateEmpty(const ASTContext &Ctx, unsigned NumArgs, bool HasFPFeatures, EmptyShell Empty)
Definition: ExprCXX.cpp:624
Represents a list-initialization with parenthesis.
Definition: ExprCXX.h:4966
static CXXParenListInitExpr * CreateEmpty(ASTContext &C, unsigned numExprs, EmptyShell Empty)
Definition: ExprCXX.cpp:1953
Represents a C++ pseudo-destructor (C++ [expr.pseudo]).
Definition: ExprCXX.h:2616
A C++ reinterpret_cast expression (C++ [expr.reinterpret.cast]).
Definition: ExprCXX.h:523
static CXXReinterpretCastExpr * CreateEmpty(const ASTContext &Context, unsigned pathSize)
Definition: ExprCXX.cpp:868
A rewritten comparison expression that was originally written using operator syntax.
Definition: ExprCXX.h:283
An expression "T()" which creates a value-initialized rvalue of type T, which is a non-class type.
Definition: ExprCXX.h:2181
A C++ static_cast expression (C++ [expr.static.cast]).
Definition: ExprCXX.h:433
static CXXStaticCastExpr * CreateEmpty(const ASTContext &Context, unsigned PathSize, bool hasFPFeatures)
Definition: ExprCXX.cpp:776
Implicit construction of a std::initializer_list<T> object from an array temporary within list-initia...
Definition: ExprCXX.h:797
Represents a C++ functional cast expression that builds a temporary object.
Definition: ExprCXX.h:1885
static CXXTemporaryObjectExpr * CreateEmpty(const ASTContext &Ctx, unsigned NumArgs)
Definition: ExprCXX.cpp:1138
Represents the this expression in C++.
Definition: ExprCXX.h:1152
static CXXThisExpr * CreateEmpty(const ASTContext &Ctx)
Definition: ExprCXX.cpp:1585
A C++ throw-expression (C++ [except.throw]).
Definition: ExprCXX.h:1206
CXXTryStmt - A C++ try block, including all handlers.
Definition: StmtCXX.h:69
static CXXTryStmt * Create(const ASTContext &C, SourceLocation tryLoc, CompoundStmt *tryBlock, ArrayRef< Stmt * > handlers)
Definition: StmtCXX.cpp:25
A C++ typeid expression (C++ [expr.typeid]), which gets the type_info that corresponds to the supplie...
Definition: ExprCXX.h:845
Describes an explicit type conversion that uses functional notion but could not be resolved because o...
Definition: ExprCXX.h:3555
static CXXUnresolvedConstructExpr * CreateEmpty(const ASTContext &Context, unsigned NumArgs)
Definition: ExprCXX.cpp:1479
A Microsoft C++ __uuidof expression, which gets the _GUID that corresponds to the supplied type or ex...
Definition: ExprCXX.h:1066
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Definition: Expr.h:2825
static CallExpr * CreateEmpty(const ASTContext &Ctx, unsigned NumArgs, bool HasFPFeatures, EmptyShell Empty)
Create an empty call expression, for deserialization.
Definition: Expr.cpp:1518
This captures a statement into a function.
Definition: Stmt.h:3758
static CapturedStmt * CreateDeserialized(const ASTContext &Context, unsigned NumCaptures)
Definition: Stmt.cpp:1385
VariableCaptureKind
The different capture forms: by 'this', by reference, capture for variable-length array type etc.
Definition: Stmt.h:3762
CaseStmt - Represent a case statement.
Definition: Stmt.h:1802
static CaseStmt * CreateEmpty(const ASTContext &Ctx, bool CaseStmtIsGNURange)
Build an empty case statement.
Definition: Stmt.cpp:1231
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
Definition: Expr.h:3488
ChooseExpr - GNU builtin-in function __builtin_choose_expr.
Definition: Expr.h:4563
Represents a 'co_await' expression.
Definition: ExprCXX.h:5197
CompoundAssignOperator - For compound assignments (e.g.
Definition: Expr.h:4093
static CompoundAssignOperator * CreateEmpty(const ASTContext &C, bool hasFPFeatures)
Definition: Expr.cpp:4818
CompoundLiteralExpr - [C99 6.5.2.5].
Definition: Expr.h:3418
CompoundStmt - This represents a group of statements like { stmt stmt }.
Definition: Stmt.h:1607
static CompoundStmt * CreateEmpty(const ASTContext &C, unsigned NumStmts, bool HasFPFeatures)
Definition: Stmt.cpp:393
Represents the specialization of a concept - evaluates to a prvalue of type bool.
Definition: ExprConcepts.h:42
ConditionalOperator - The ?: ternary operator.
Definition: Expr.h:4184
ConstantExpr - An expression that occurs in a constant context and optionally the result of evaluatin...
Definition: Expr.h:1077
static ConstantExpr * CreateEmpty(const ASTContext &Context, ConstantResultStorageKind StorageKind)
Definition: Expr.cpp:367
The result of a constraint satisfaction check, containing the necessary information to diagnose an un...
Definition: ASTConcept.h:35
llvm::SmallVector< std::pair< const Expr *, Detail >, 4 > Details
Pairs of unsatisfied atomic constraint expressions along with the substituted constraint expr,...
Definition: ASTConcept.h:60
std::pair< SourceLocation, StringRef > SubstitutionDiagnostic
Definition: ASTConcept.h:50
ContinueStmt - This represents a continue.
Definition: Stmt.h:2951
ConvertVectorExpr - Clang builtin function __builtin_convertvector This AST node provides support for...
Definition: Expr.h:4504
Represents a 'co_return' statement in the C++ Coroutines TS.
Definition: StmtCXX.h:473
Represents the body of a coroutine.
Definition: StmtCXX.h:320
static CoroutineBodyStmt * Create(const ASTContext &C, CtorArgs const &Args)
Definition: StmtCXX.cpp:87
Represents a 'co_yield' expression.
Definition: ExprCXX.h:5278
A POD class for pairing a NamedDecl* with an access specifier.
static DeclAccessPair make(NamedDecl *D, AccessSpecifier AS)
static DeclGroup * Create(ASTContext &C, Decl **Decls, unsigned NumDecls)
Definition: DeclGroup.cpp:20
A reference to a declared variable, function, enum, etc.
Definition: Expr.h:1265
static DeclRefExpr * CreateEmpty(const ASTContext &Context, bool HasQualifier, bool HasFoundDecl, bool HasTemplateKWAndArgsInfo, unsigned NumTemplateArgs)
Construct an empty declaration reference expression.
Definition: Expr.cpp:529
DeclStmt - Adaptor class for mixing declarations with statements and expressions.
Definition: Stmt.h:1498
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:86
Represents a 'co_await' expression while the type of the promise is dependent.
Definition: ExprCXX.h:5229
A qualified reference to a name whose declaration cannot yet be resolved.
Definition: ExprCXX.h:3321
static DependentScopeDeclRefExpr * CreateEmpty(const ASTContext &Context, bool HasTemplateKWAndArgsInfo, unsigned NumTemplateArgs)
Definition: ExprCXX.cpp:544
Represents a single C99 designator.
Definition: Expr.h:5298
Represents a C99 designated initializer expression.
Definition: Expr.h:5255
static DesignatedInitExpr * CreateEmpty(const ASTContext &C, unsigned NumIndexExprs)
Definition: Expr.cpp:4617
Designator - A designator in a C99 designated initializer.
Definition: Designator.h:38
static Designator CreateArrayRangeDesignator(Expr *Start, Expr *End, SourceLocation LBracketLoc, SourceLocation EllipsisLoc)
Creates a GNU array-range designator.
Definition: Designator.h:172
static Designator CreateArrayDesignator(Expr *Index, SourceLocation LBracketLoc)
Creates an array designator.
Definition: Designator.h:142
static Designator CreateFieldDesignator(const IdentifierInfo *FieldName, SourceLocation DotLoc, SourceLocation FieldLoc)
Creates a field designator.
Definition: Designator.h:115
DoStmt - This represents a 'do/while' stmt.
Definition: Stmt.h:2726
Represents a reference to #emded data.
Definition: Expr.h:4838
ExplicitCastExpr - An explicit cast written in the source code.
Definition: Expr.h:3735
Represents an expression – generally a full-expression – that introduces cleanups to be run at the en...
Definition: ExprCXX.h:3472
llvm::PointerUnion< BlockDecl *, CompoundLiteralExpr * > CleanupObject
The type of objects that are kept in the cleanup.
Definition: ExprCXX.h:3478
static ExprWithCleanups * Create(const ASTContext &C, EmptyShell empty, unsigned numObjects)
Definition: ExprCXX.cpp:1444
This represents one expression.
Definition: Expr.h:110
void setType(QualType t)
Definition: Expr.h:143
bool isValueDependent() const
Determines whether the value of this expression depends on.
Definition: Expr.h:175
bool isInstantiationDependent() const
Whether this expression is instantiation-dependent, meaning that it depends in some way on.
Definition: Expr.h:221
void setValueKind(ExprValueKind Cat)
setValueKind - Set the value kind produced by this expression.
Definition: Expr.h:454
void setObjectKind(ExprObjectKind Cat)
setObjectKind - Set the object kind produced by this expression.
Definition: Expr.h:457
void setDependence(ExprDependence Deps)
Each concrete expr subclass is expected to compute its dependence and call this in the constructor.
Definition: Expr.h:135
An expression trait intrinsic.
Definition: ExprCXX.h:2923
ExtVectorElementExpr - This represents access to specific elements of a vector, and may occur on the ...
Definition: Expr.h:6276
static FPOptionsOverride getFromOpaqueInt(storage_type I)
Definition: LangOptions.h:982
static FixedPointLiteral * Create(const ASTContext &C, EmptyShell Empty)
Returns an empty fixed-point literal.
Definition: Expr.cpp:1007
static FloatingLiteral * Create(const ASTContext &C, const llvm::APFloat &V, bool isexact, QualType Type, SourceLocation L)
Definition: Expr.cpp:1078
ForStmt - This represents a 'for (init;cond;inc)' stmt.
Definition: Stmt.h:2782
Represents a reference to a function parameter pack or init-capture pack that has been substituted bu...
Definition: ExprCXX.h:4652
static FunctionParmPackExpr * CreateEmpty(const ASTContext &Context, unsigned NumParams)
Definition: ExprCXX.cpp:1815
This represents a GCC inline-assembly statement extension.
Definition: Stmt.h:3260
GNUNullExpr - Implements the GNU __null extension, which is a name for a null pointer constant that h...
Definition: Expr.h:4638
Represents a C11 generic selection.
Definition: Expr.h:5888
static GenericSelectionExpr * CreateEmpty(const ASTContext &Context, unsigned NumAssocs)
Create an empty generic selection expression for deserialization.
Definition: Expr.cpp:4551
GotoStmt - This represents a direct goto.
Definition: Stmt.h:2863
One of these records is kept for each identifier that is lexed.
IfStmt - This represents an if/then/else.
Definition: Stmt.h:2139
static IfStmt * CreateEmpty(const ASTContext &Ctx, bool HasElse, bool HasVar, bool HasInit)
Create an empty IfStmt optionally with storage for an else statement, condition variable and init exp...
Definition: Stmt.cpp:973
ImaginaryLiteral - We support imaginary integer and floating point literals, like "1....
Definition: Expr.h:1717
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
Definition: Expr.h:3660
static ImplicitCastExpr * CreateEmpty(const ASTContext &Context, unsigned PathSize, bool HasFPFeatures)
Definition: Expr.cpp:2096
Represents an implicitly-generated value initialization of an object of a given type.
Definition: Expr.h:5763
IndirectGotoStmt - This represents an indirect goto.
Definition: Stmt.h:2902
Describes an C or C++ initializer list.
Definition: Expr.h:5010
static IntegerLiteral * Create(const ASTContext &C, const llvm::APInt &V, QualType type, SourceLocation l)
Returns a new integer literal with value 'V' and type 'type'.
Definition: Expr.cpp:977
LabelStmt - Represents a label, which has a substatement.
Definition: Stmt.h:2032
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
Definition: ExprCXX.h:1954
static LambdaExpr * CreateDeserialized(const ASTContext &C, unsigned NumCaptures)
Construct a new lambda expression that will be deserialized from an external source.
Definition: ExprCXX.cpp:1311
This represents a Microsoft inline-assembly statement extension.
Definition: Stmt.h:3483
Representation of a Microsoft __if_exists or __if_not_exists statement with a dependent name.
Definition: StmtCXX.h:253
A member reference to an MSPropertyDecl.
Definition: ExprCXX.h:933
MS property subscript expression.
Definition: ExprCXX.h:1004
Represents a prvalue temporary that is written into memory so that a reference can bind to it.
Definition: ExprCXX.h:4732
MatrixSubscriptExpr - Matrix subscript expression for the MatrixType extension.
Definition: Expr.h:2747
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
Definition: Expr.h:3177
static MemberExpr * CreateEmpty(const ASTContext &Context, bool HasQualifier, bool HasFoundDecl, bool HasTemplateKWAndArgsInfo, unsigned NumTemplateArgs)
Definition: Expr.cpp:1776
This represents a decl that may have a name.
Definition: Decl.h:249
A C++ nested-name-specifier augmented with source location information.
Represents a place-holder for an object not to be initialized by anything.
Definition: Expr.h:5583
NullStmt - This is the null statement ";": C99 6.8.3p3.
Definition: Stmt.h:1570
An explicit cast in C or a C-style cast in C++, which uses the syntax ([s1][s2]......
Definition: ExprOpenMP.h:24
static OMPArrayShapingExpr * CreateEmpty(const ASTContext &Context, unsigned NumDims)
Definition: Expr.cpp:5181
This represents '#pragma omp atomic' directive.
Definition: StmtOpenMP.h:2963
static OMPAtomicDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
Definition: StmtOpenMP.cpp:935
This represents '#pragma omp barrier' directive.
Definition: StmtOpenMP.h:2641
static OMPBarrierDirective * CreateEmpty(const ASTContext &C, EmptyShell)
Creates an empty directive.
Definition: StmtOpenMP.cpp:787
This represents '#pragma omp cancel' directive.
Definition: StmtOpenMP.h:3671
static OMPCancelDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive.
Definition: StmtOpenMP.cpp:847
This represents '#pragma omp cancellation point' directive.
Definition: StmtOpenMP.h:3613
static OMPCancellationPointDirective * CreateEmpty(const ASTContext &C, EmptyShell)
Creates an empty directive.
Definition: StmtOpenMP.cpp:832
Representation of an OpenMP canonical loop.
Definition: StmtOpenMP.h:142
static OMPCanonicalLoop * createEmpty(const ASTContext &Ctx)
Create an empty OMPCanonicalLoop for deserialization.
Definition: StmtOpenMP.h:176
This represents '#pragma omp critical' directive.
Definition: StmtOpenMP.h:2092
static OMPCriticalDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive.
Definition: StmtOpenMP.cpp:592
This represents '#pragma omp depobj' directive.
Definition: StmtOpenMP.h:2857
static OMPDepobjDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
Definition: StmtOpenMP.cpp:877
This represents '#pragma omp dispatch' directive.
Definition: StmtOpenMP.h:5827
static OMPDispatchDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
This represents '#pragma omp distribute' directive.
Definition: StmtOpenMP.h:4441
static OMPDistributeDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
This represents '#pragma omp distribute parallel for' composite directive.
Definition: StmtOpenMP.h:4564
static OMPDistributeParallelForDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
This represents '#pragma omp distribute parallel for simd' composite directive.
Definition: StmtOpenMP.h:4660
static OMPDistributeParallelForSimdDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
This represents '#pragma omp distribute simd' composite directive.
Definition: StmtOpenMP.h:4725
static OMPDistributeSimdDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
This represents '#pragma omp error' directive.
Definition: StmtOpenMP.h:6311
static OMPErrorDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive.
Definition: StmtOpenMP.cpp:775
This is a basic class for representing single OpenMP executable directive.
Definition: StmtOpenMP.h:266
This represents '#pragma omp flush' directive.
Definition: StmtOpenMP.h:2805
static OMPFlushDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
Definition: StmtOpenMP.cpp:862
This represents '#pragma omp for' directive.
Definition: StmtOpenMP.h:1649
static OMPForDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
Definition: StmtOpenMP.cpp:400
This represents '#pragma omp for simd' directive.
Definition: StmtOpenMP.h:1740
static OMPForSimdDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
Definition: StmtOpenMP.cpp:487
This represents '#pragma omp loop' directive.
Definition: StmtOpenMP.h:5982
static OMPGenericLoopDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with a place for NumClauses clauses.
This represents '#pragma omp interop' directive.
Definition: StmtOpenMP.h:5774
static OMPInteropDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive.
OpenMP 5.0 [2.1.6 Iterators] Iterators are identifiers that expand to multiple values in the clause o...
Definition: ExprOpenMP.h:151