clang 20.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 const ASTContext &C = Record.getContext();
794 if (!Satisfaction.IsSatisfied) {
795 unsigned NumDetailRecords = Record.readInt();
796 for (unsigned i = 0; i != NumDetailRecords; ++i) {
797 if (/* IsDiagnostic */Record.readInt()) {
798 SourceLocation DiagLocation = Record.readSourceLocation();
799 StringRef DiagMessage = C.backupStr(Record.readString());
800
801 Satisfaction.Details.emplace_back(
803 DiagLocation, DiagMessage));
804 } else
805 Satisfaction.Details.emplace_back(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 const ASTContext &C = Record.getContext();
825 StringRef SubstitutedEntity = C.backupStr(Record.readString());
826 SourceLocation DiagLoc = Record.readSourceLocation();
827 StringRef DiagMessage = C.backupStr(Record.readString());
828
829 return new (Record.getContext())
830 concepts::Requirement::SubstitutionDiagnostic{SubstitutedEntity, DiagLoc,
831 DiagMessage};
832}
833
834void ASTStmtReader::VisitRequiresExpr(RequiresExpr *E) {
835 VisitExpr(E);
836 unsigned NumLocalParameters = Record.readInt();
837 unsigned NumRequirements = Record.readInt();
838 E->RequiresExprBits.RequiresKWLoc = Record.readSourceLocation();
839 E->RequiresExprBits.IsSatisfied = Record.readInt();
840 E->Body = Record.readDeclAs<RequiresExprBodyDecl>();
842 for (unsigned i = 0; i < NumLocalParameters; ++i)
843 LocalParameters.push_back(cast<ParmVarDecl>(Record.readDecl()));
844 std::copy(LocalParameters.begin(), LocalParameters.end(),
845 E->getTrailingObjects<ParmVarDecl *>());
847 for (unsigned i = 0; i < NumRequirements; ++i) {
848 auto RK =
849 static_cast<concepts::Requirement::RequirementKind>(Record.readInt());
850 concepts::Requirement *R = nullptr;
851 switch (RK) {
853 auto Status =
855 Record.readInt());
857 R = new (Record.getContext())
859 else
860 R = new (Record.getContext())
861 concepts::TypeRequirement(Record.readTypeSourceInfo());
862 } break;
865 auto Status =
867 Record.readInt());
869 Expr *> E;
872 } else
873 E = Record.readExpr();
874
875 std::optional<concepts::ExprRequirement::ReturnTypeRequirement> Req;
876 ConceptSpecializationExpr *SubstitutedConstraintExpr = nullptr;
877 SourceLocation NoexceptLoc;
879 Req.emplace();
880 } else {
881 NoexceptLoc = Record.readSourceLocation();
882 switch (/* returnTypeRequirementKind */Record.readInt()) {
883 case 0:
884 // No return type requirement.
885 Req.emplace();
886 break;
887 case 1: {
888 // type-constraint
889 TemplateParameterList *TPL = Record.readTemplateParameterList();
890 if (Status >=
892 SubstitutedConstraintExpr =
893 cast<ConceptSpecializationExpr>(Record.readExpr());
894 Req.emplace(TPL);
895 } break;
896 case 2:
897 // Substitution failure
899 break;
900 }
901 }
902 if (Expr *Ex = E.dyn_cast<Expr *>())
903 R = new (Record.getContext()) concepts::ExprRequirement(
904 Ex, RK == concepts::Requirement::RK_Simple, NoexceptLoc,
905 std::move(*Req), Status, SubstitutedConstraintExpr);
906 else
907 R = new (Record.getContext()) concepts::ExprRequirement(
909 RK == concepts::Requirement::RK_Simple, NoexceptLoc,
910 std::move(*Req));
911 } break;
913 ASTContext &C = Record.getContext();
914 bool HasInvalidConstraint = Record.readInt();
915 if (HasInvalidConstraint) {
916 StringRef InvalidConstraint = C.backupStr(Record.readString());
918 Record.getContext(), InvalidConstraint,
920 break;
921 }
922 Expr *E = Record.readExpr();
925 else
928 } break;
929 }
930 if (!R)
931 continue;
932 Requirements.push_back(R);
933 }
934 std::copy(Requirements.begin(), Requirements.end(),
935 E->getTrailingObjects<concepts::Requirement *>());
936 E->LParenLoc = Record.readSourceLocation();
937 E->RParenLoc = Record.readSourceLocation();
938 E->RBraceLoc = Record.readSourceLocation();
939}
940
941void ASTStmtReader::VisitArraySubscriptExpr(ArraySubscriptExpr *E) {
942 VisitExpr(E);
943 E->setLHS(Record.readSubExpr());
944 E->setRHS(Record.readSubExpr());
945 E->setRBracketLoc(readSourceLocation());
946}
947
948void ASTStmtReader::VisitMatrixSubscriptExpr(MatrixSubscriptExpr *E) {
949 VisitExpr(E);
950 E->setBase(Record.readSubExpr());
951 E->setRowIdx(Record.readSubExpr());
952 E->setColumnIdx(Record.readSubExpr());
953 E->setRBracketLoc(readSourceLocation());
954}
955
956void ASTStmtReader::VisitArraySectionExpr(ArraySectionExpr *E) {
957 VisitExpr(E);
958 E->ASType = Record.readEnum<ArraySectionExpr::ArraySectionType>();
959
960 E->setBase(Record.readSubExpr());
961 E->setLowerBound(Record.readSubExpr());
962 E->setLength(Record.readSubExpr());
963
964 if (E->isOMPArraySection())
965 E->setStride(Record.readSubExpr());
966
967 E->setColonLocFirst(readSourceLocation());
968
969 if (E->isOMPArraySection())
970 E->setColonLocSecond(readSourceLocation());
971
972 E->setRBracketLoc(readSourceLocation());
973}
974
975void ASTStmtReader::VisitOMPArrayShapingExpr(OMPArrayShapingExpr *E) {
976 VisitExpr(E);
977 unsigned NumDims = Record.readInt();
978 E->setBase(Record.readSubExpr());
979 SmallVector<Expr *, 4> Dims(NumDims);
980 for (unsigned I = 0; I < NumDims; ++I)
981 Dims[I] = Record.readSubExpr();
982 E->setDimensions(Dims);
983 SmallVector<SourceRange, 4> SRs(NumDims);
984 for (unsigned I = 0; I < NumDims; ++I)
985 SRs[I] = readSourceRange();
986 E->setBracketsRanges(SRs);
987 E->setLParenLoc(readSourceLocation());
988 E->setRParenLoc(readSourceLocation());
989}
990
991void ASTStmtReader::VisitOMPIteratorExpr(OMPIteratorExpr *E) {
992 VisitExpr(E);
993 unsigned NumIters = Record.readInt();
994 E->setIteratorKwLoc(readSourceLocation());
995 E->setLParenLoc(readSourceLocation());
996 E->setRParenLoc(readSourceLocation());
997 for (unsigned I = 0; I < NumIters; ++I) {
998 E->setIteratorDeclaration(I, Record.readDeclRef());
999 E->setAssignmentLoc(I, readSourceLocation());
1000 Expr *Begin = Record.readSubExpr();
1001 Expr *End = Record.readSubExpr();
1002 Expr *Step = Record.readSubExpr();
1003 SourceLocation ColonLoc = readSourceLocation();
1004 SourceLocation SecColonLoc;
1005 if (Step)
1006 SecColonLoc = readSourceLocation();
1007 E->setIteratorRange(I, Begin, ColonLoc, End, SecColonLoc, Step);
1008 // Deserialize helpers
1010 HD.CounterVD = cast_or_null<VarDecl>(Record.readDeclRef());
1011 HD.Upper = Record.readSubExpr();
1012 HD.Update = Record.readSubExpr();
1013 HD.CounterUpdate = Record.readSubExpr();
1014 E->setHelper(I, HD);
1015 }
1016}
1017
1018void ASTStmtReader::VisitCallExpr(CallExpr *E) {
1019 VisitExpr(E);
1020
1021 unsigned NumArgs = Record.readInt();
1022 CurrentUnpackingBits.emplace(Record.readInt());
1023 E->setADLCallKind(
1024 static_cast<CallExpr::ADLCallKind>(CurrentUnpackingBits->getNextBit()));
1025 bool HasFPFeatures = CurrentUnpackingBits->getNextBit();
1026 assert((NumArgs == E->getNumArgs()) && "Wrong NumArgs!");
1027 E->setRParenLoc(readSourceLocation());
1028 E->setCallee(Record.readSubExpr());
1029 for (unsigned I = 0; I != NumArgs; ++I)
1030 E->setArg(I, Record.readSubExpr());
1031
1032 if (HasFPFeatures)
1033 E->setStoredFPFeatures(
1035}
1036
1037void ASTStmtReader::VisitCXXMemberCallExpr(CXXMemberCallExpr *E) {
1038 VisitCallExpr(E);
1039}
1040
1041void ASTStmtReader::VisitMemberExpr(MemberExpr *E) {
1042 VisitExpr(E);
1043
1044 CurrentUnpackingBits.emplace(Record.readInt());
1045 bool HasQualifier = CurrentUnpackingBits->getNextBit();
1046 bool HasFoundDecl = CurrentUnpackingBits->getNextBit();
1047 bool HasTemplateInfo = CurrentUnpackingBits->getNextBit();
1048 unsigned NumTemplateArgs = Record.readInt();
1049
1050 E->Base = Record.readSubExpr();
1051 E->MemberDecl = Record.readDeclAs<ValueDecl>();
1052 E->MemberDNLoc = Record.readDeclarationNameLoc(E->MemberDecl->getDeclName());
1053 E->MemberLoc = Record.readSourceLocation();
1054 E->MemberExprBits.IsArrow = CurrentUnpackingBits->getNextBit();
1055 E->MemberExprBits.HasQualifier = HasQualifier;
1056 E->MemberExprBits.HasFoundDecl = HasFoundDecl;
1057 E->MemberExprBits.HasTemplateKWAndArgsInfo = HasTemplateInfo;
1058 E->MemberExprBits.HadMultipleCandidates = CurrentUnpackingBits->getNextBit();
1059 E->MemberExprBits.NonOdrUseReason =
1060 CurrentUnpackingBits->getNextBits(/*Width=*/2);
1061 E->MemberExprBits.OperatorLoc = Record.readSourceLocation();
1062
1063 if (HasQualifier)
1064 new (E->getTrailingObjects<NestedNameSpecifierLoc>())
1065 NestedNameSpecifierLoc(Record.readNestedNameSpecifierLoc());
1066
1067 if (HasFoundDecl) {
1068 auto *FoundD = Record.readDeclAs<NamedDecl>();
1069 auto AS = (AccessSpecifier)CurrentUnpackingBits->getNextBits(/*Width=*/2);
1070 *E->getTrailingObjects<DeclAccessPair>() = DeclAccessPair::make(FoundD, AS);
1071 }
1072
1073 if (HasTemplateInfo)
1075 *E->getTrailingObjects<ASTTemplateKWAndArgsInfo>(),
1076 E->getTrailingObjects<TemplateArgumentLoc>(), NumTemplateArgs);
1077}
1078
1079void ASTStmtReader::VisitObjCIsaExpr(ObjCIsaExpr *E) {
1080 VisitExpr(E);
1081 E->setBase(Record.readSubExpr());
1082 E->setIsaMemberLoc(readSourceLocation());
1083 E->setOpLoc(readSourceLocation());
1084 E->setArrow(Record.readInt());
1085}
1086
1087void ASTStmtReader::
1088VisitObjCIndirectCopyRestoreExpr(ObjCIndirectCopyRestoreExpr *E) {
1089 VisitExpr(E);
1090 E->Operand = Record.readSubExpr();
1091 E->setShouldCopy(Record.readInt());
1092}
1093
1094void ASTStmtReader::VisitObjCBridgedCastExpr(ObjCBridgedCastExpr *E) {
1095 VisitExplicitCastExpr(E);
1096 E->LParenLoc = readSourceLocation();
1097 E->BridgeKeywordLoc = readSourceLocation();
1098 E->Kind = Record.readInt();
1099}
1100
1101void ASTStmtReader::VisitCastExpr(CastExpr *E) {
1102 VisitExpr(E);
1103 unsigned NumBaseSpecs = Record.readInt();
1104 assert(NumBaseSpecs == E->path_size());
1105
1106 CurrentUnpackingBits.emplace(Record.readInt());
1107 E->setCastKind((CastKind)CurrentUnpackingBits->getNextBits(/*Width=*/7));
1108 unsigned HasFPFeatures = CurrentUnpackingBits->getNextBit();
1109 assert(E->hasStoredFPFeatures() == HasFPFeatures);
1110
1111 E->setSubExpr(Record.readSubExpr());
1112
1113 CastExpr::path_iterator BaseI = E->path_begin();
1114 while (NumBaseSpecs--) {
1115 auto *BaseSpec = new (Record.getContext()) CXXBaseSpecifier;
1116 *BaseSpec = Record.readCXXBaseSpecifier();
1117 *BaseI++ = BaseSpec;
1118 }
1119 if (HasFPFeatures)
1120 *E->getTrailingFPFeatures() =
1122}
1123
1124void ASTStmtReader::VisitBinaryOperator(BinaryOperator *E) {
1125 VisitExpr(E);
1126 CurrentUnpackingBits.emplace(Record.readInt());
1127 E->setOpcode(
1128 (BinaryOperator::Opcode)CurrentUnpackingBits->getNextBits(/*Width=*/6));
1129 bool hasFP_Features = CurrentUnpackingBits->getNextBit();
1130 E->setHasStoredFPFeatures(hasFP_Features);
1131 E->setExcludedOverflowPattern(CurrentUnpackingBits->getNextBit());
1132 E->setLHS(Record.readSubExpr());
1133 E->setRHS(Record.readSubExpr());
1134 E->setOperatorLoc(readSourceLocation());
1135 if (hasFP_Features)
1136 E->setStoredFPFeatures(
1138}
1139
1140void ASTStmtReader::VisitCompoundAssignOperator(CompoundAssignOperator *E) {
1141 VisitBinaryOperator(E);
1142 E->setComputationLHSType(Record.readType());
1143 E->setComputationResultType(Record.readType());
1144}
1145
1146void ASTStmtReader::VisitConditionalOperator(ConditionalOperator *E) {
1147 VisitExpr(E);
1148 E->SubExprs[ConditionalOperator::COND] = Record.readSubExpr();
1149 E->SubExprs[ConditionalOperator::LHS] = Record.readSubExpr();
1150 E->SubExprs[ConditionalOperator::RHS] = Record.readSubExpr();
1151 E->QuestionLoc = readSourceLocation();
1152 E->ColonLoc = readSourceLocation();
1153}
1154
1155void
1156ASTStmtReader::VisitBinaryConditionalOperator(BinaryConditionalOperator *E) {
1157 VisitExpr(E);
1158 E->OpaqueValue = cast<OpaqueValueExpr>(Record.readSubExpr());
1159 E->SubExprs[BinaryConditionalOperator::COMMON] = Record.readSubExpr();
1160 E->SubExprs[BinaryConditionalOperator::COND] = Record.readSubExpr();
1161 E->SubExprs[BinaryConditionalOperator::LHS] = Record.readSubExpr();
1162 E->SubExprs[BinaryConditionalOperator::RHS] = Record.readSubExpr();
1163 E->QuestionLoc = readSourceLocation();
1164 E->ColonLoc = readSourceLocation();
1165}
1166
1167void ASTStmtReader::VisitImplicitCastExpr(ImplicitCastExpr *E) {
1168 VisitCastExpr(E);
1169 E->setIsPartOfExplicitCast(CurrentUnpackingBits->getNextBit());
1170}
1171
1172void ASTStmtReader::VisitExplicitCastExpr(ExplicitCastExpr *E) {
1173 VisitCastExpr(E);
1174 E->setTypeInfoAsWritten(readTypeSourceInfo());
1175}
1176
1177void ASTStmtReader::VisitCStyleCastExpr(CStyleCastExpr *E) {
1178 VisitExplicitCastExpr(E);
1179 E->setLParenLoc(readSourceLocation());
1180 E->setRParenLoc(readSourceLocation());
1181}
1182
1183void ASTStmtReader::VisitCompoundLiteralExpr(CompoundLiteralExpr *E) {
1184 VisitExpr(E);
1185 E->setLParenLoc(readSourceLocation());
1186 E->setTypeSourceInfo(readTypeSourceInfo());
1187 E->setInitializer(Record.readSubExpr());
1188 E->setFileScope(Record.readInt());
1189}
1190
1191void ASTStmtReader::VisitExtVectorElementExpr(ExtVectorElementExpr *E) {
1192 VisitExpr(E);
1193 E->setBase(Record.readSubExpr());
1194 E->setAccessor(Record.readIdentifier());
1195 E->setAccessorLoc(readSourceLocation());
1196}
1197
1198void ASTStmtReader::VisitInitListExpr(InitListExpr *E) {
1199 VisitExpr(E);
1200 if (auto *SyntForm = cast_or_null<InitListExpr>(Record.readSubStmt()))
1201 E->setSyntacticForm(SyntForm);
1202 E->setLBraceLoc(readSourceLocation());
1203 E->setRBraceLoc(readSourceLocation());
1204 bool isArrayFiller = Record.readInt();
1205 Expr *filler = nullptr;
1206 if (isArrayFiller) {
1207 filler = Record.readSubExpr();
1208 E->ArrayFillerOrUnionFieldInit = filler;
1209 } else
1210 E->ArrayFillerOrUnionFieldInit = readDeclAs<FieldDecl>();
1211 E->sawArrayRangeDesignator(Record.readInt());
1212 unsigned NumInits = Record.readInt();
1213 E->reserveInits(Record.getContext(), NumInits);
1214 if (isArrayFiller) {
1215 for (unsigned I = 0; I != NumInits; ++I) {
1216 Expr *init = Record.readSubExpr();
1217 E->updateInit(Record.getContext(), I, init ? init : filler);
1218 }
1219 } else {
1220 for (unsigned I = 0; I != NumInits; ++I)
1221 E->updateInit(Record.getContext(), I, Record.readSubExpr());
1222 }
1223}
1224
1225void ASTStmtReader::VisitDesignatedInitExpr(DesignatedInitExpr *E) {
1227
1228 VisitExpr(E);
1229 unsigned NumSubExprs = Record.readInt();
1230 assert(NumSubExprs == E->getNumSubExprs() && "Wrong number of subexprs");
1231 for (unsigned I = 0; I != NumSubExprs; ++I)
1232 E->setSubExpr(I, Record.readSubExpr());
1233 E->setEqualOrColonLoc(readSourceLocation());
1234 E->setGNUSyntax(Record.readInt());
1235
1236 SmallVector<Designator, 4> Designators;
1237 while (Record.getIdx() < Record.size()) {
1238 switch ((DesignatorTypes)Record.readInt()) {
1239 case DESIG_FIELD_DECL: {
1240 auto *Field = readDeclAs<FieldDecl>();
1241 SourceLocation DotLoc = readSourceLocation();
1242 SourceLocation FieldLoc = readSourceLocation();
1243 Designators.push_back(Designator::CreateFieldDesignator(
1244 Field->getIdentifier(), DotLoc, FieldLoc));
1245 Designators.back().setFieldDecl(Field);
1246 break;
1247 }
1248
1249 case DESIG_FIELD_NAME: {
1250 const IdentifierInfo *Name = Record.readIdentifier();
1251 SourceLocation DotLoc = readSourceLocation();
1252 SourceLocation FieldLoc = readSourceLocation();
1253 Designators.push_back(Designator::CreateFieldDesignator(Name, DotLoc,
1254 FieldLoc));
1255 break;
1256 }
1257
1258 case DESIG_ARRAY: {
1259 unsigned Index = Record.readInt();
1260 SourceLocation LBracketLoc = readSourceLocation();
1261 SourceLocation RBracketLoc = readSourceLocation();
1262 Designators.push_back(Designator::CreateArrayDesignator(Index,
1263 LBracketLoc,
1264 RBracketLoc));
1265 break;
1266 }
1267
1268 case DESIG_ARRAY_RANGE: {
1269 unsigned Index = Record.readInt();
1270 SourceLocation LBracketLoc = readSourceLocation();
1271 SourceLocation EllipsisLoc = readSourceLocation();
1272 SourceLocation RBracketLoc = readSourceLocation();
1273 Designators.push_back(Designator::CreateArrayRangeDesignator(
1274 Index, LBracketLoc, EllipsisLoc, RBracketLoc));
1275 break;
1276 }
1277 }
1278 }
1279 E->setDesignators(Record.getContext(),
1280 Designators.data(), Designators.size());
1281}
1282
1283void ASTStmtReader::VisitDesignatedInitUpdateExpr(DesignatedInitUpdateExpr *E) {
1284 VisitExpr(E);
1285 E->setBase(Record.readSubExpr());
1286 E->setUpdater(Record.readSubExpr());
1287}
1288
1289void ASTStmtReader::VisitNoInitExpr(NoInitExpr *E) {
1290 VisitExpr(E);
1291}
1292
1293void ASTStmtReader::VisitArrayInitLoopExpr(ArrayInitLoopExpr *E) {
1294 VisitExpr(E);
1295 E->SubExprs[0] = Record.readSubExpr();
1296 E->SubExprs[1] = Record.readSubExpr();
1297}
1298
1299void ASTStmtReader::VisitArrayInitIndexExpr(ArrayInitIndexExpr *E) {
1300 VisitExpr(E);
1301}
1302
1303void ASTStmtReader::VisitImplicitValueInitExpr(ImplicitValueInitExpr *E) {
1304 VisitExpr(E);
1305}
1306
1307void ASTStmtReader::VisitVAArgExpr(VAArgExpr *E) {
1308 VisitExpr(E);
1309 E->setSubExpr(Record.readSubExpr());
1310 E->setWrittenTypeInfo(readTypeSourceInfo());
1311 E->setBuiltinLoc(readSourceLocation());
1312 E->setRParenLoc(readSourceLocation());
1313 E->setIsMicrosoftABI(Record.readInt());
1314}
1315
1316void ASTStmtReader::VisitSourceLocExpr(SourceLocExpr *E) {
1317 VisitExpr(E);
1318 E->ParentContext = readDeclAs<DeclContext>();
1319 E->BuiltinLoc = readSourceLocation();
1320 E->RParenLoc = readSourceLocation();
1321 E->SourceLocExprBits.Kind = Record.readInt();
1322}
1323
1324void ASTStmtReader::VisitEmbedExpr(EmbedExpr *E) {
1325 VisitExpr(E);
1326 E->EmbedKeywordLoc = readSourceLocation();
1327 EmbedDataStorage *Data = new (Record.getContext()) EmbedDataStorage;
1328 Data->BinaryData = cast<StringLiteral>(Record.readSubStmt());
1329 E->Data = Data;
1330 E->Begin = Record.readInt();
1331 E->NumOfElements = Record.readInt();
1332}
1333
1334void ASTStmtReader::VisitAddrLabelExpr(AddrLabelExpr *E) {
1335 VisitExpr(E);
1336 E->setAmpAmpLoc(readSourceLocation());
1337 E->setLabelLoc(readSourceLocation());
1338 E->setLabel(readDeclAs<LabelDecl>());
1339}
1340
1341void ASTStmtReader::VisitStmtExpr(StmtExpr *E) {
1342 VisitExpr(E);
1343 E->setLParenLoc(readSourceLocation());
1344 E->setRParenLoc(readSourceLocation());
1345 E->setSubStmt(cast_or_null<CompoundStmt>(Record.readSubStmt()));
1346 E->StmtExprBits.TemplateDepth = Record.readInt();
1347}
1348
1349void ASTStmtReader::VisitChooseExpr(ChooseExpr *E) {
1350 VisitExpr(E);
1351 E->setCond(Record.readSubExpr());
1352 E->setLHS(Record.readSubExpr());
1353 E->setRHS(Record.readSubExpr());
1354 E->setBuiltinLoc(readSourceLocation());
1355 E->setRParenLoc(readSourceLocation());
1356 E->setIsConditionTrue(Record.readInt());
1357}
1358
1359void ASTStmtReader::VisitGNUNullExpr(GNUNullExpr *E) {
1360 VisitExpr(E);
1361 E->setTokenLocation(readSourceLocation());
1362}
1363
1364void ASTStmtReader::VisitShuffleVectorExpr(ShuffleVectorExpr *E) {
1365 VisitExpr(E);
1367 unsigned NumExprs = Record.readInt();
1368 while (NumExprs--)
1369 Exprs.push_back(Record.readSubExpr());
1370 E->setExprs(Record.getContext(), Exprs);
1371 E->setBuiltinLoc(readSourceLocation());
1372 E->setRParenLoc(readSourceLocation());
1373}
1374
1375void ASTStmtReader::VisitConvertVectorExpr(ConvertVectorExpr *E) {
1376 VisitExpr(E);
1377 E->BuiltinLoc = readSourceLocation();
1378 E->RParenLoc = readSourceLocation();
1379 E->TInfo = readTypeSourceInfo();
1380 E->SrcExpr = Record.readSubExpr();
1381}
1382
1383void ASTStmtReader::VisitBlockExpr(BlockExpr *E) {
1384 VisitExpr(E);
1385 E->setBlockDecl(readDeclAs<BlockDecl>());
1386}
1387
1388void ASTStmtReader::VisitGenericSelectionExpr(GenericSelectionExpr *E) {
1389 VisitExpr(E);
1390
1391 unsigned NumAssocs = Record.readInt();
1392 assert(NumAssocs == E->getNumAssocs() && "Wrong NumAssocs!");
1393 E->IsExprPredicate = Record.readInt();
1394 E->ResultIndex = Record.readInt();
1395 E->GenericSelectionExprBits.GenericLoc = readSourceLocation();
1396 E->DefaultLoc = readSourceLocation();
1397 E->RParenLoc = readSourceLocation();
1398
1399 Stmt **Stmts = E->getTrailingObjects<Stmt *>();
1400 // Add 1 to account for the controlling expression which is the first
1401 // expression in the trailing array of Stmt *. This is not needed for
1402 // the trailing array of TypeSourceInfo *.
1403 for (unsigned I = 0, N = NumAssocs + 1; I < N; ++I)
1404 Stmts[I] = Record.readSubExpr();
1405
1406 TypeSourceInfo **TSIs = E->getTrailingObjects<TypeSourceInfo *>();
1407 for (unsigned I = 0, N = NumAssocs; I < N; ++I)
1408 TSIs[I] = readTypeSourceInfo();
1409}
1410
1411void ASTStmtReader::VisitPseudoObjectExpr(PseudoObjectExpr *E) {
1412 VisitExpr(E);
1413 unsigned numSemanticExprs = Record.readInt();
1414 assert(numSemanticExprs + 1 == E->PseudoObjectExprBits.NumSubExprs);
1415 E->PseudoObjectExprBits.ResultIndex = Record.readInt();
1416
1417 // Read the syntactic expression.
1418 E->getSubExprsBuffer()[0] = Record.readSubExpr();
1419
1420 // Read all the semantic expressions.
1421 for (unsigned i = 0; i != numSemanticExprs; ++i) {
1422 Expr *subExpr = Record.readSubExpr();
1423 E->getSubExprsBuffer()[i+1] = subExpr;
1424 }
1425}
1426
1427void ASTStmtReader::VisitAtomicExpr(AtomicExpr *E) {
1428 VisitExpr(E);
1429 E->Op = AtomicExpr::AtomicOp(Record.readInt());
1430 E->NumSubExprs = AtomicExpr::getNumSubExprs(E->Op);
1431 for (unsigned I = 0; I != E->NumSubExprs; ++I)
1432 E->SubExprs[I] = Record.readSubExpr();
1433 E->BuiltinLoc = readSourceLocation();
1434 E->RParenLoc = readSourceLocation();
1435}
1436
1437//===----------------------------------------------------------------------===//
1438// Objective-C Expressions and Statements
1439
1440void ASTStmtReader::VisitObjCStringLiteral(ObjCStringLiteral *E) {
1441 VisitExpr(E);
1442 E->setString(cast<StringLiteral>(Record.readSubStmt()));
1443 E->setAtLoc(readSourceLocation());
1444}
1445
1446void ASTStmtReader::VisitObjCBoxedExpr(ObjCBoxedExpr *E) {
1447 VisitExpr(E);
1448 // could be one of several IntegerLiteral, FloatLiteral, etc.
1449 E->SubExpr = Record.readSubStmt();
1450 E->BoxingMethod = readDeclAs<ObjCMethodDecl>();
1451 E->Range = readSourceRange();
1452}
1453
1454void ASTStmtReader::VisitObjCArrayLiteral(ObjCArrayLiteral *E) {
1455 VisitExpr(E);
1456 unsigned NumElements = Record.readInt();
1457 assert(NumElements == E->getNumElements() && "Wrong number of elements");
1458 Expr **Elements = E->getElements();
1459 for (unsigned I = 0, N = NumElements; I != N; ++I)
1460 Elements[I] = Record.readSubExpr();
1461 E->ArrayWithObjectsMethod = readDeclAs<ObjCMethodDecl>();
1462 E->Range = readSourceRange();
1463}
1464
1465void ASTStmtReader::VisitObjCDictionaryLiteral(ObjCDictionaryLiteral *E) {
1466 VisitExpr(E);
1467 unsigned NumElements = Record.readInt();
1468 assert(NumElements == E->getNumElements() && "Wrong number of elements");
1469 bool HasPackExpansions = Record.readInt();
1470 assert(HasPackExpansions == E->HasPackExpansions &&"Pack expansion mismatch");
1471 auto *KeyValues =
1472 E->getTrailingObjects<ObjCDictionaryLiteral::KeyValuePair>();
1473 auto *Expansions =
1474 E->getTrailingObjects<ObjCDictionaryLiteral::ExpansionData>();
1475 for (unsigned I = 0; I != NumElements; ++I) {
1476 KeyValues[I].Key = Record.readSubExpr();
1477 KeyValues[I].Value = Record.readSubExpr();
1478 if (HasPackExpansions) {
1479 Expansions[I].EllipsisLoc = readSourceLocation();
1480 Expansions[I].NumExpansionsPlusOne = Record.readInt();
1481 }
1482 }
1483 E->DictWithObjectsMethod = readDeclAs<ObjCMethodDecl>();
1484 E->Range = readSourceRange();
1485}
1486
1487void ASTStmtReader::VisitObjCEncodeExpr(ObjCEncodeExpr *E) {
1488 VisitExpr(E);
1489 E->setEncodedTypeSourceInfo(readTypeSourceInfo());
1490 E->setAtLoc(readSourceLocation());
1491 E->setRParenLoc(readSourceLocation());
1492}
1493
1494void ASTStmtReader::VisitObjCSelectorExpr(ObjCSelectorExpr *E) {
1495 VisitExpr(E);
1496 E->setSelector(Record.readSelector());
1497 E->setAtLoc(readSourceLocation());
1498 E->setRParenLoc(readSourceLocation());
1499}
1500
1501void ASTStmtReader::VisitObjCProtocolExpr(ObjCProtocolExpr *E) {
1502 VisitExpr(E);
1503 E->setProtocol(readDeclAs<ObjCProtocolDecl>());
1504 E->setAtLoc(readSourceLocation());
1505 E->ProtoLoc = readSourceLocation();
1506 E->setRParenLoc(readSourceLocation());
1507}
1508
1509void ASTStmtReader::VisitObjCIvarRefExpr(ObjCIvarRefExpr *E) {
1510 VisitExpr(E);
1511 E->setDecl(readDeclAs<ObjCIvarDecl>());
1512 E->setLocation(readSourceLocation());
1513 E->setOpLoc(readSourceLocation());
1514 E->setBase(Record.readSubExpr());
1515 E->setIsArrow(Record.readInt());
1516 E->setIsFreeIvar(Record.readInt());
1517}
1518
1519void ASTStmtReader::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *E) {
1520 VisitExpr(E);
1521 unsigned MethodRefFlags = Record.readInt();
1522 bool Implicit = Record.readInt() != 0;
1523 if (Implicit) {
1524 auto *Getter = readDeclAs<ObjCMethodDecl>();
1525 auto *Setter = readDeclAs<ObjCMethodDecl>();
1526 E->setImplicitProperty(Getter, Setter, MethodRefFlags);
1527 } else {
1528 E->setExplicitProperty(readDeclAs<ObjCPropertyDecl>(), MethodRefFlags);
1529 }
1530 E->setLocation(readSourceLocation());
1531 E->setReceiverLocation(readSourceLocation());
1532 switch (Record.readInt()) {
1533 case 0:
1534 E->setBase(Record.readSubExpr());
1535 break;
1536 case 1:
1537 E->setSuperReceiver(Record.readType());
1538 break;
1539 case 2:
1540 E->setClassReceiver(readDeclAs<ObjCInterfaceDecl>());
1541 break;
1542 }
1543}
1544
1545void ASTStmtReader::VisitObjCSubscriptRefExpr(ObjCSubscriptRefExpr *E) {
1546 VisitExpr(E);
1547 E->setRBracket(readSourceLocation());
1548 E->setBaseExpr(Record.readSubExpr());
1549 E->setKeyExpr(Record.readSubExpr());
1550 E->GetAtIndexMethodDecl = readDeclAs<ObjCMethodDecl>();
1551 E->SetAtIndexMethodDecl = readDeclAs<ObjCMethodDecl>();
1552}
1553
1554void ASTStmtReader::VisitObjCMessageExpr(ObjCMessageExpr *E) {
1555 VisitExpr(E);
1556 assert(Record.peekInt() == E->getNumArgs());
1557 Record.skipInts(1);
1558 unsigned NumStoredSelLocs = Record.readInt();
1559 E->SelLocsKind = Record.readInt();
1560 E->setDelegateInitCall(Record.readInt());
1561 E->IsImplicit = Record.readInt();
1562 auto Kind = static_cast<ObjCMessageExpr::ReceiverKind>(Record.readInt());
1563 switch (Kind) {
1565 E->setInstanceReceiver(Record.readSubExpr());
1566 break;
1567
1569 E->setClassReceiver(readTypeSourceInfo());
1570 break;
1571
1574 QualType T = Record.readType();
1575 SourceLocation SuperLoc = readSourceLocation();
1576 E->setSuper(SuperLoc, T, Kind == ObjCMessageExpr::SuperInstance);
1577 break;
1578 }
1579 }
1580
1581 assert(Kind == E->getReceiverKind());
1582
1583 if (Record.readInt())
1584 E->setMethodDecl(readDeclAs<ObjCMethodDecl>());
1585 else
1586 E->setSelector(Record.readSelector());
1587
1588 E->LBracLoc = readSourceLocation();
1589 E->RBracLoc = readSourceLocation();
1590
1591 for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
1592 E->setArg(I, Record.readSubExpr());
1593
1594 SourceLocation *Locs = E->getStoredSelLocs();
1595 for (unsigned I = 0; I != NumStoredSelLocs; ++I)
1596 Locs[I] = readSourceLocation();
1597}
1598
1599void ASTStmtReader::VisitObjCForCollectionStmt(ObjCForCollectionStmt *S) {
1600 VisitStmt(S);
1601 S->setElement(Record.readSubStmt());
1602 S->setCollection(Record.readSubExpr());
1603 S->setBody(Record.readSubStmt());
1604 S->setForLoc(readSourceLocation());
1605 S->setRParenLoc(readSourceLocation());
1606}
1607
1608void ASTStmtReader::VisitObjCAtCatchStmt(ObjCAtCatchStmt *S) {
1609 VisitStmt(S);
1610 S->setCatchBody(Record.readSubStmt());
1611 S->setCatchParamDecl(readDeclAs<VarDecl>());
1612 S->setAtCatchLoc(readSourceLocation());
1613 S->setRParenLoc(readSourceLocation());
1614}
1615
1616void ASTStmtReader::VisitObjCAtFinallyStmt(ObjCAtFinallyStmt *S) {
1617 VisitStmt(S);
1618 S->setFinallyBody(Record.readSubStmt());
1619 S->setAtFinallyLoc(readSourceLocation());
1620}
1621
1622void ASTStmtReader::VisitObjCAutoreleasePoolStmt(ObjCAutoreleasePoolStmt *S) {
1623 VisitStmt(S); // FIXME: no test coverage.
1624 S->setSubStmt(Record.readSubStmt());
1625 S->setAtLoc(readSourceLocation());
1626}
1627
1628void ASTStmtReader::VisitObjCAtTryStmt(ObjCAtTryStmt *S) {
1629 VisitStmt(S);
1630 assert(Record.peekInt() == S->getNumCatchStmts());
1631 Record.skipInts(1);
1632 bool HasFinally = Record.readInt();
1633 S->setTryBody(Record.readSubStmt());
1634 for (unsigned I = 0, N = S->getNumCatchStmts(); I != N; ++I)
1635 S->setCatchStmt(I, cast_or_null<ObjCAtCatchStmt>(Record.readSubStmt()));
1636
1637 if (HasFinally)
1638 S->setFinallyStmt(Record.readSubStmt());
1639 S->setAtTryLoc(readSourceLocation());
1640}
1641
1642void ASTStmtReader::VisitObjCAtSynchronizedStmt(ObjCAtSynchronizedStmt *S) {
1643 VisitStmt(S); // FIXME: no test coverage.
1644 S->setSynchExpr(Record.readSubStmt());
1645 S->setSynchBody(Record.readSubStmt());
1646 S->setAtSynchronizedLoc(readSourceLocation());
1647}
1648
1649void ASTStmtReader::VisitObjCAtThrowStmt(ObjCAtThrowStmt *S) {
1650 VisitStmt(S); // FIXME: no test coverage.
1651 S->setThrowExpr(Record.readSubStmt());
1652 S->setThrowLoc(readSourceLocation());
1653}
1654
1655void ASTStmtReader::VisitObjCBoolLiteralExpr(ObjCBoolLiteralExpr *E) {
1656 VisitExpr(E);
1657 E->setValue(Record.readInt());
1658 E->setLocation(readSourceLocation());
1659}
1660
1661void ASTStmtReader::VisitObjCAvailabilityCheckExpr(ObjCAvailabilityCheckExpr *E) {
1662 VisitExpr(E);
1663 SourceRange R = Record.readSourceRange();
1664 E->AtLoc = R.getBegin();
1665 E->RParen = R.getEnd();
1666 E->VersionToCheck = Record.readVersionTuple();
1667}
1668
1669//===----------------------------------------------------------------------===//
1670// C++ Expressions and Statements
1671//===----------------------------------------------------------------------===//
1672
1673void ASTStmtReader::VisitCXXCatchStmt(CXXCatchStmt *S) {
1674 VisitStmt(S);
1675 S->CatchLoc = readSourceLocation();
1676 S->ExceptionDecl = readDeclAs<VarDecl>();
1677 S->HandlerBlock = Record.readSubStmt();
1678}
1679
1680void ASTStmtReader::VisitCXXTryStmt(CXXTryStmt *S) {
1681 VisitStmt(S);
1682 assert(Record.peekInt() == S->getNumHandlers() && "NumStmtFields is wrong ?");
1683 Record.skipInts(1);
1684 S->TryLoc = readSourceLocation();
1685 S->getStmts()[0] = Record.readSubStmt();
1686 for (unsigned i = 0, e = S->getNumHandlers(); i != e; ++i)
1687 S->getStmts()[i + 1] = Record.readSubStmt();
1688}
1689
1690void ASTStmtReader::VisitCXXForRangeStmt(CXXForRangeStmt *S) {
1691 VisitStmt(S);
1692 S->ForLoc = readSourceLocation();
1693 S->CoawaitLoc = readSourceLocation();
1694 S->ColonLoc = readSourceLocation();
1695 S->RParenLoc = readSourceLocation();
1696 S->setInit(Record.readSubStmt());
1697 S->setRangeStmt(Record.readSubStmt());
1698 S->setBeginStmt(Record.readSubStmt());
1699 S->setEndStmt(Record.readSubStmt());
1700 S->setCond(Record.readSubExpr());
1701 S->setInc(Record.readSubExpr());
1702 S->setLoopVarStmt(Record.readSubStmt());
1703 S->setBody(Record.readSubStmt());
1704}
1705
1706void ASTStmtReader::VisitMSDependentExistsStmt(MSDependentExistsStmt *S) {
1707 VisitStmt(S);
1708 S->KeywordLoc = readSourceLocation();
1709 S->IsIfExists = Record.readInt();
1710 S->QualifierLoc = Record.readNestedNameSpecifierLoc();
1711 S->NameInfo = Record.readDeclarationNameInfo();
1712 S->SubStmt = Record.readSubStmt();
1713}
1714
1715void ASTStmtReader::VisitCXXOperatorCallExpr(CXXOperatorCallExpr *E) {
1716 VisitCallExpr(E);
1717 E->CXXOperatorCallExprBits.OperatorKind = Record.readInt();
1718 E->Range = Record.readSourceRange();
1719}
1720
1721void ASTStmtReader::VisitCXXRewrittenBinaryOperator(
1723 VisitExpr(E);
1724 E->CXXRewrittenBinaryOperatorBits.IsReversed = Record.readInt();
1725 E->SemanticForm = Record.readSubExpr();
1726}
1727
1728void ASTStmtReader::VisitCXXConstructExpr(CXXConstructExpr *E) {
1729 VisitExpr(E);
1730
1731 unsigned NumArgs = Record.readInt();
1732 assert((NumArgs == E->getNumArgs()) && "Wrong NumArgs!");
1733
1734 E->CXXConstructExprBits.Elidable = Record.readInt();
1735 E->CXXConstructExprBits.HadMultipleCandidates = Record.readInt();
1736 E->CXXConstructExprBits.ListInitialization = Record.readInt();
1737 E->CXXConstructExprBits.StdInitListInitialization = Record.readInt();
1738 E->CXXConstructExprBits.ZeroInitialization = Record.readInt();
1739 E->CXXConstructExprBits.ConstructionKind = Record.readInt();
1740 E->CXXConstructExprBits.IsImmediateEscalating = Record.readInt();
1741 E->CXXConstructExprBits.Loc = readSourceLocation();
1742 E->Constructor = readDeclAs<CXXConstructorDecl>();
1743 E->ParenOrBraceRange = readSourceRange();
1744
1745 for (unsigned I = 0; I != NumArgs; ++I)
1746 E->setArg(I, Record.readSubExpr());
1747}
1748
1749void ASTStmtReader::VisitCXXInheritedCtorInitExpr(CXXInheritedCtorInitExpr *E) {
1750 VisitExpr(E);
1751 E->Constructor = readDeclAs<CXXConstructorDecl>();
1752 E->Loc = readSourceLocation();
1753 E->ConstructsVirtualBase = Record.readInt();
1754 E->InheritedFromVirtualBase = Record.readInt();
1755}
1756
1757void ASTStmtReader::VisitCXXTemporaryObjectExpr(CXXTemporaryObjectExpr *E) {
1758 VisitCXXConstructExpr(E);
1759 E->TSI = readTypeSourceInfo();
1760}
1761
1762void ASTStmtReader::VisitLambdaExpr(LambdaExpr *E) {
1763 VisitExpr(E);
1764 unsigned NumCaptures = Record.readInt();
1765 (void)NumCaptures;
1766 assert(NumCaptures == E->LambdaExprBits.NumCaptures);
1767 E->IntroducerRange = readSourceRange();
1768 E->LambdaExprBits.CaptureDefault = Record.readInt();
1769 E->CaptureDefaultLoc = readSourceLocation();
1770 E->LambdaExprBits.ExplicitParams = Record.readInt();
1771 E->LambdaExprBits.ExplicitResultType = Record.readInt();
1772 E->ClosingBrace = readSourceLocation();
1773
1774 // Read capture initializers.
1775 for (LambdaExpr::capture_init_iterator C = E->capture_init_begin(),
1776 CEnd = E->capture_init_end();
1777 C != CEnd; ++C)
1778 *C = Record.readSubExpr();
1779
1780 // The body will be lazily deserialized when needed from the call operator
1781 // declaration.
1782}
1783
1784void
1785ASTStmtReader::VisitCXXStdInitializerListExpr(CXXStdInitializerListExpr *E) {
1786 VisitExpr(E);
1787 E->SubExpr = Record.readSubExpr();
1788}
1789
1790void ASTStmtReader::VisitCXXNamedCastExpr(CXXNamedCastExpr *E) {
1791 VisitExplicitCastExpr(E);
1792 SourceRange R = readSourceRange();
1793 E->Loc = R.getBegin();
1794 E->RParenLoc = R.getEnd();
1795 if (CurrentUnpackingBits->getNextBit())
1796 E->AngleBrackets = readSourceRange();
1797}
1798
1799void ASTStmtReader::VisitCXXStaticCastExpr(CXXStaticCastExpr *E) {
1800 return VisitCXXNamedCastExpr(E);
1801}
1802
1803void ASTStmtReader::VisitCXXDynamicCastExpr(CXXDynamicCastExpr *E) {
1804 return VisitCXXNamedCastExpr(E);
1805}
1806
1807void ASTStmtReader::VisitCXXReinterpretCastExpr(CXXReinterpretCastExpr *E) {
1808 return VisitCXXNamedCastExpr(E);
1809}
1810
1811void ASTStmtReader::VisitCXXAddrspaceCastExpr(CXXAddrspaceCastExpr *E) {
1812 return VisitCXXNamedCastExpr(E);
1813}
1814
1815void ASTStmtReader::VisitCXXConstCastExpr(CXXConstCastExpr *E) {
1816 return VisitCXXNamedCastExpr(E);
1817}
1818
1819void ASTStmtReader::VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr *E) {
1820 VisitExplicitCastExpr(E);
1821 E->setLParenLoc(readSourceLocation());
1822 E->setRParenLoc(readSourceLocation());
1823}
1824
1825void ASTStmtReader::VisitBuiltinBitCastExpr(BuiltinBitCastExpr *E) {
1826 VisitExplicitCastExpr(E);
1827 E->KWLoc = readSourceLocation();
1828 E->RParenLoc = readSourceLocation();
1829}
1830
1831void ASTStmtReader::VisitUserDefinedLiteral(UserDefinedLiteral *E) {
1832 VisitCallExpr(E);
1833 E->UDSuffixLoc = readSourceLocation();
1834}
1835
1836void ASTStmtReader::VisitCXXBoolLiteralExpr(CXXBoolLiteralExpr *E) {
1837 VisitExpr(E);
1838 E->setValue(Record.readInt());
1839 E->setLocation(readSourceLocation());
1840}
1841
1842void ASTStmtReader::VisitCXXNullPtrLiteralExpr(CXXNullPtrLiteralExpr *E) {
1843 VisitExpr(E);
1844 E->setLocation(readSourceLocation());
1845}
1846
1847void ASTStmtReader::VisitCXXTypeidExpr(CXXTypeidExpr *E) {
1848 VisitExpr(E);
1849 E->setSourceRange(readSourceRange());
1850 if (E->isTypeOperand())
1851 E->Operand = readTypeSourceInfo();
1852 else
1853 E->Operand = Record.readSubExpr();
1854}
1855
1856void ASTStmtReader::VisitCXXThisExpr(CXXThisExpr *E) {
1857 VisitExpr(E);
1858 E->setLocation(readSourceLocation());
1859 E->setImplicit(Record.readInt());
1860 E->setCapturedByCopyInLambdaWithExplicitObjectParameter(Record.readInt());
1861}
1862
1863void ASTStmtReader::VisitCXXThrowExpr(CXXThrowExpr *E) {
1864 VisitExpr(E);
1865 E->CXXThrowExprBits.ThrowLoc = readSourceLocation();
1866 E->Operand = Record.readSubExpr();
1867 E->CXXThrowExprBits.IsThrownVariableInScope = Record.readInt();
1868}
1869
1870void ASTStmtReader::VisitCXXDefaultArgExpr(CXXDefaultArgExpr *E) {
1871 VisitExpr(E);
1872 E->Param = readDeclAs<ParmVarDecl>();
1873 E->UsedContext = readDeclAs<DeclContext>();
1874 E->CXXDefaultArgExprBits.Loc = readSourceLocation();
1875 E->CXXDefaultArgExprBits.HasRewrittenInit = Record.readInt();
1876 if (E->CXXDefaultArgExprBits.HasRewrittenInit)
1877 *E->getTrailingObjects<Expr *>() = Record.readSubExpr();
1878}
1879
1880void ASTStmtReader::VisitCXXDefaultInitExpr(CXXDefaultInitExpr *E) {
1881 VisitExpr(E);
1882 E->CXXDefaultInitExprBits.HasRewrittenInit = Record.readInt();
1883 E->Field = readDeclAs<FieldDecl>();
1884 E->UsedContext = readDeclAs<DeclContext>();
1885 E->CXXDefaultInitExprBits.Loc = readSourceLocation();
1886 if (E->CXXDefaultInitExprBits.HasRewrittenInit)
1887 *E->getTrailingObjects<Expr *>() = Record.readSubExpr();
1888}
1889
1890void ASTStmtReader::VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *E) {
1891 VisitExpr(E);
1892 E->setTemporary(Record.readCXXTemporary());
1893 E->setSubExpr(Record.readSubExpr());
1894}
1895
1896void ASTStmtReader::VisitCXXScalarValueInitExpr(CXXScalarValueInitExpr *E) {
1897 VisitExpr(E);
1898 E->TypeInfo = readTypeSourceInfo();
1899 E->CXXScalarValueInitExprBits.RParenLoc = readSourceLocation();
1900}
1901
1902void ASTStmtReader::VisitCXXNewExpr(CXXNewExpr *E) {
1903 VisitExpr(E);
1904
1905 bool IsArray = Record.readInt();
1906 bool HasInit = Record.readInt();
1907 unsigned NumPlacementArgs = Record.readInt();
1908 bool IsParenTypeId = Record.readInt();
1909
1910 E->CXXNewExprBits.IsGlobalNew = Record.readInt();
1911 E->CXXNewExprBits.ShouldPassAlignment = Record.readInt();
1912 E->CXXNewExprBits.UsualArrayDeleteWantsSize = Record.readInt();
1913 E->CXXNewExprBits.HasInitializer = Record.readInt();
1914 E->CXXNewExprBits.StoredInitializationStyle = Record.readInt();
1915
1916 assert((IsArray == E->isArray()) && "Wrong IsArray!");
1917 assert((HasInit == E->hasInitializer()) && "Wrong HasInit!");
1918 assert((NumPlacementArgs == E->getNumPlacementArgs()) &&
1919 "Wrong NumPlacementArgs!");
1920 assert((IsParenTypeId == E->isParenTypeId()) && "Wrong IsParenTypeId!");
1921 (void)IsArray;
1922 (void)HasInit;
1923 (void)NumPlacementArgs;
1924
1925 E->setOperatorNew(readDeclAs<FunctionDecl>());
1926 E->setOperatorDelete(readDeclAs<FunctionDecl>());
1927 E->AllocatedTypeInfo = readTypeSourceInfo();
1928 if (IsParenTypeId)
1929 E->getTrailingObjects<SourceRange>()[0] = readSourceRange();
1930 E->Range = readSourceRange();
1931 E->DirectInitRange = readSourceRange();
1932
1933 // Install all the subexpressions.
1934 for (CXXNewExpr::raw_arg_iterator I = E->raw_arg_begin(),
1935 N = E->raw_arg_end();
1936 I != N; ++I)
1937 *I = Record.readSubStmt();
1938}
1939
1940void ASTStmtReader::VisitCXXDeleteExpr(CXXDeleteExpr *E) {
1941 VisitExpr(E);
1942 E->CXXDeleteExprBits.GlobalDelete = Record.readInt();
1943 E->CXXDeleteExprBits.ArrayForm = Record.readInt();
1944 E->CXXDeleteExprBits.ArrayFormAsWritten = Record.readInt();
1945 E->CXXDeleteExprBits.UsualArrayDeleteWantsSize = Record.readInt();
1946 E->OperatorDelete = readDeclAs<FunctionDecl>();
1947 E->Argument = Record.readSubExpr();
1948 E->CXXDeleteExprBits.Loc = readSourceLocation();
1949}
1950
1951void ASTStmtReader::VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr *E) {
1952 VisitExpr(E);
1953
1954 E->Base = Record.readSubExpr();
1955 E->IsArrow = Record.readInt();
1956 E->OperatorLoc = readSourceLocation();
1957 E->QualifierLoc = Record.readNestedNameSpecifierLoc();
1958 E->ScopeType = readTypeSourceInfo();
1959 E->ColonColonLoc = readSourceLocation();
1960 E->TildeLoc = readSourceLocation();
1961
1962 IdentifierInfo *II = Record.readIdentifier();
1963 if (II)
1964 E->setDestroyedType(II, readSourceLocation());
1965 else
1966 E->setDestroyedType(readTypeSourceInfo());
1967}
1968
1969void ASTStmtReader::VisitExprWithCleanups(ExprWithCleanups *E) {
1970 VisitExpr(E);
1971
1972 unsigned NumObjects = Record.readInt();
1973 assert(NumObjects == E->getNumObjects());
1974 for (unsigned i = 0; i != NumObjects; ++i) {
1975 unsigned CleanupKind = Record.readInt();
1977 if (CleanupKind == COK_Block)
1978 Obj = readDeclAs<BlockDecl>();
1979 else if (CleanupKind == COK_CompoundLiteral)
1980 Obj = cast<CompoundLiteralExpr>(Record.readSubExpr());
1981 else
1982 llvm_unreachable("unexpected cleanup object type");
1983 E->getTrailingObjects<ExprWithCleanups::CleanupObject>()[i] = Obj;
1984 }
1985
1986 E->ExprWithCleanupsBits.CleanupsHaveSideEffects = Record.readInt();
1987 E->SubExpr = Record.readSubExpr();
1988}
1989
1990void ASTStmtReader::VisitCXXDependentScopeMemberExpr(
1992 VisitExpr(E);
1993
1994 unsigned NumTemplateArgs = Record.readInt();
1995 CurrentUnpackingBits.emplace(Record.readInt());
1996 bool HasTemplateKWAndArgsInfo = CurrentUnpackingBits->getNextBit();
1997 bool HasFirstQualifierFoundInScope = CurrentUnpackingBits->getNextBit();
1998
1999 assert((HasTemplateKWAndArgsInfo == E->hasTemplateKWAndArgsInfo()) &&
2000 "Wrong HasTemplateKWAndArgsInfo!");
2001 assert(
2002 (HasFirstQualifierFoundInScope == E->hasFirstQualifierFoundInScope()) &&
2003 "Wrong HasFirstQualifierFoundInScope!");
2004
2005 if (HasTemplateKWAndArgsInfo)
2007 *E->getTrailingObjects<ASTTemplateKWAndArgsInfo>(),
2008 E->getTrailingObjects<TemplateArgumentLoc>(), NumTemplateArgs);
2009
2010 assert((NumTemplateArgs == E->getNumTemplateArgs()) &&
2011 "Wrong NumTemplateArgs!");
2012
2014 CurrentUnpackingBits->getNextBit();
2015
2016 E->BaseType = Record.readType();
2017 E->QualifierLoc = Record.readNestedNameSpecifierLoc();
2018 // not ImplicitAccess
2019 if (CurrentUnpackingBits->getNextBit())
2020 E->Base = Record.readSubExpr();
2021 else
2022 E->Base = nullptr;
2023
2024 E->CXXDependentScopeMemberExprBits.OperatorLoc = readSourceLocation();
2025
2026 if (HasFirstQualifierFoundInScope)
2027 *E->getTrailingObjects<NamedDecl *>() = readDeclAs<NamedDecl>();
2028
2029 E->MemberNameInfo = Record.readDeclarationNameInfo();
2030}
2031
2032void
2033ASTStmtReader::VisitDependentScopeDeclRefExpr(DependentScopeDeclRefExpr *E) {
2034 VisitExpr(E);
2035
2036 if (CurrentUnpackingBits->getNextBit()) // HasTemplateKWAndArgsInfo
2038 *E->getTrailingObjects<ASTTemplateKWAndArgsInfo>(),
2039 E->getTrailingObjects<TemplateArgumentLoc>(),
2040 /*NumTemplateArgs=*/CurrentUnpackingBits->getNextBits(/*Width=*/16));
2041
2042 E->QualifierLoc = Record.readNestedNameSpecifierLoc();
2043 E->NameInfo = Record.readDeclarationNameInfo();
2044}
2045
2046void
2047ASTStmtReader::VisitCXXUnresolvedConstructExpr(CXXUnresolvedConstructExpr *E) {
2048 VisitExpr(E);
2049 assert(Record.peekInt() == E->getNumArgs() &&
2050 "Read wrong record during creation ?");
2051 Record.skipInts(1);
2052 for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
2053 E->setArg(I, Record.readSubExpr());
2054 E->TypeAndInitForm.setPointer(readTypeSourceInfo());
2055 E->setLParenLoc(readSourceLocation());
2056 E->setRParenLoc(readSourceLocation());
2057 E->TypeAndInitForm.setInt(Record.readInt());
2058}
2059
2060void ASTStmtReader::VisitOverloadExpr(OverloadExpr *E) {
2061 VisitExpr(E);
2062
2063 unsigned NumResults = Record.readInt();
2064 CurrentUnpackingBits.emplace(Record.readInt());
2065 bool HasTemplateKWAndArgsInfo = CurrentUnpackingBits->getNextBit();
2066 assert((E->getNumDecls() == NumResults) && "Wrong NumResults!");
2067 assert((E->hasTemplateKWAndArgsInfo() == HasTemplateKWAndArgsInfo) &&
2068 "Wrong HasTemplateKWAndArgsInfo!");
2069
2070 if (HasTemplateKWAndArgsInfo) {
2071 unsigned NumTemplateArgs = Record.readInt();
2072 ReadTemplateKWAndArgsInfo(*E->getTrailingASTTemplateKWAndArgsInfo(),
2073 E->getTrailingTemplateArgumentLoc(),
2074 NumTemplateArgs);
2075 assert((E->getNumTemplateArgs() == NumTemplateArgs) &&
2076 "Wrong NumTemplateArgs!");
2077 }
2078
2079 UnresolvedSet<8> Decls;
2080 for (unsigned I = 0; I != NumResults; ++I) {
2081 auto *D = readDeclAs<NamedDecl>();
2082 auto AS = (AccessSpecifier)Record.readInt();
2083 Decls.addDecl(D, AS);
2084 }
2085
2086 DeclAccessPair *Results = E->getTrailingResults();
2088 for (unsigned I = 0; I != NumResults; ++I) {
2089 Results[I] = (Iter + I).getPair();
2090 }
2091
2092 E->NameInfo = Record.readDeclarationNameInfo();
2093 E->QualifierLoc = Record.readNestedNameSpecifierLoc();
2094}
2095
2096void ASTStmtReader::VisitUnresolvedMemberExpr(UnresolvedMemberExpr *E) {
2097 VisitOverloadExpr(E);
2098 E->UnresolvedMemberExprBits.IsArrow = CurrentUnpackingBits->getNextBit();
2099 E->UnresolvedMemberExprBits.HasUnresolvedUsing =
2100 CurrentUnpackingBits->getNextBit();
2101
2102 if (/*!isImplicitAccess=*/CurrentUnpackingBits->getNextBit())
2103 E->Base = Record.readSubExpr();
2104 else
2105 E->Base = nullptr;
2106
2107 E->OperatorLoc = readSourceLocation();
2108
2109 E->BaseType = Record.readType();
2110}
2111
2112void ASTStmtReader::VisitUnresolvedLookupExpr(UnresolvedLookupExpr *E) {
2113 VisitOverloadExpr(E);
2114 E->UnresolvedLookupExprBits.RequiresADL = CurrentUnpackingBits->getNextBit();
2115 E->NamingClass = readDeclAs<CXXRecordDecl>();
2116}
2117
2118void ASTStmtReader::VisitTypeTraitExpr(TypeTraitExpr *E) {
2119 VisitExpr(E);
2120 E->TypeTraitExprBits.NumArgs = Record.readInt();
2121 E->TypeTraitExprBits.Kind = Record.readInt();
2122 E->TypeTraitExprBits.Value = Record.readInt();
2123 SourceRange Range = readSourceRange();
2124 E->Loc = Range.getBegin();
2125 E->RParenLoc = Range.getEnd();
2126
2127 auto **Args = E->getTrailingObjects<TypeSourceInfo *>();
2128 for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
2129 Args[I] = readTypeSourceInfo();
2130}
2131
2132void ASTStmtReader::VisitArrayTypeTraitExpr(ArrayTypeTraitExpr *E) {
2133 VisitExpr(E);
2134 E->ATT = (ArrayTypeTrait)Record.readInt();
2135 E->Value = (unsigned int)Record.readInt();
2136 SourceRange Range = readSourceRange();
2137 E->Loc = Range.getBegin();
2138 E->RParen = Range.getEnd();
2139 E->QueriedType = readTypeSourceInfo();
2140 E->Dimension = Record.readSubExpr();
2141}
2142
2143void ASTStmtReader::VisitExpressionTraitExpr(ExpressionTraitExpr *E) {
2144 VisitExpr(E);
2145 E->ET = (ExpressionTrait)Record.readInt();
2146 E->Value = (bool)Record.readInt();
2147 SourceRange Range = readSourceRange();
2148 E->QueriedExpression = Record.readSubExpr();
2149 E->Loc = Range.getBegin();
2150 E->RParen = Range.getEnd();
2151}
2152
2153void ASTStmtReader::VisitCXXNoexceptExpr(CXXNoexceptExpr *E) {
2154 VisitExpr(E);
2155 E->CXXNoexceptExprBits.Value = Record.readInt();
2156 E->Range = readSourceRange();
2157 E->Operand = Record.readSubExpr();
2158}
2159
2160void ASTStmtReader::VisitPackExpansionExpr(PackExpansionExpr *E) {
2161 VisitExpr(E);
2162 E->EllipsisLoc = readSourceLocation();
2163 E->NumExpansions = Record.readInt();
2164 E->Pattern = Record.readSubExpr();
2165}
2166
2167void ASTStmtReader::VisitSizeOfPackExpr(SizeOfPackExpr *E) {
2168 VisitExpr(E);
2169 unsigned NumPartialArgs = Record.readInt();
2170 E->OperatorLoc = readSourceLocation();
2171 E->PackLoc = readSourceLocation();
2172 E->RParenLoc = readSourceLocation();
2173 E->Pack = Record.readDeclAs<NamedDecl>();
2174 if (E->isPartiallySubstituted()) {
2175 assert(E->Length == NumPartialArgs);
2176 for (auto *I = E->getTrailingObjects<TemplateArgument>(),
2177 *E = I + NumPartialArgs;
2178 I != E; ++I)
2179 new (I) TemplateArgument(Record.readTemplateArgument());
2180 } else if (!E->isValueDependent()) {
2181 E->Length = Record.readInt();
2182 }
2183}
2184
2185void ASTStmtReader::VisitPackIndexingExpr(PackIndexingExpr *E) {
2186 VisitExpr(E);
2187 E->TransformedExpressions = Record.readInt();
2188 E->ExpandedToEmptyPack = Record.readInt();
2189 E->EllipsisLoc = readSourceLocation();
2190 E->RSquareLoc = readSourceLocation();
2191 E->SubExprs[0] = Record.readStmt();
2192 E->SubExprs[1] = Record.readStmt();
2193 auto **Exprs = E->getTrailingObjects<Expr *>();
2194 for (unsigned I = 0; I < E->TransformedExpressions; ++I)
2195 Exprs[I] = Record.readExpr();
2196}
2197
2198void ASTStmtReader::VisitSubstNonTypeTemplateParmExpr(
2200 VisitExpr(E);
2201 E->AssociatedDeclAndRef.setPointer(readDeclAs<Decl>());
2202 E->AssociatedDeclAndRef.setInt(CurrentUnpackingBits->getNextBit());
2203 E->Index = CurrentUnpackingBits->getNextBits(/*Width=*/12);
2204 if (CurrentUnpackingBits->getNextBit())
2205 E->PackIndex = Record.readInt();
2206 else
2207 E->PackIndex = 0;
2208 E->SubstNonTypeTemplateParmExprBits.NameLoc = readSourceLocation();
2209 E->Replacement = Record.readSubExpr();
2210}
2211
2212void ASTStmtReader::VisitSubstNonTypeTemplateParmPackExpr(
2214 VisitExpr(E);
2215 E->AssociatedDecl = readDeclAs<Decl>();
2216 E->Index = Record.readInt();
2217 TemplateArgument ArgPack = Record.readTemplateArgument();
2218 if (ArgPack.getKind() != TemplateArgument::Pack)
2219 return;
2220
2221 E->Arguments = ArgPack.pack_begin();
2222 E->NumArguments = ArgPack.pack_size();
2223 E->NameLoc = readSourceLocation();
2224}
2225
2226void ASTStmtReader::VisitFunctionParmPackExpr(FunctionParmPackExpr *E) {
2227 VisitExpr(E);
2228 E->NumParameters = Record.readInt();
2229 E->ParamPack = readDeclAs<ParmVarDecl>();
2230 E->NameLoc = readSourceLocation();
2231 auto **Parms = E->getTrailingObjects<VarDecl *>();
2232 for (unsigned i = 0, n = E->NumParameters; i != n; ++i)
2233 Parms[i] = readDeclAs<VarDecl>();
2234}
2235
2236void ASTStmtReader::VisitMaterializeTemporaryExpr(MaterializeTemporaryExpr *E) {
2237 VisitExpr(E);
2238 bool HasMaterialzedDecl = Record.readInt();
2239 if (HasMaterialzedDecl)
2240 E->State = cast<LifetimeExtendedTemporaryDecl>(Record.readDecl());
2241 else
2242 E->State = Record.readSubExpr();
2243}
2244
2245void ASTStmtReader::VisitCXXFoldExpr(CXXFoldExpr *E) {
2246 VisitExpr(E);
2247 E->LParenLoc = readSourceLocation();
2248 E->EllipsisLoc = readSourceLocation();
2249 E->RParenLoc = readSourceLocation();
2250 E->NumExpansions = Record.readInt();
2251 E->SubExprs[0] = Record.readSubExpr();
2252 E->SubExprs[1] = Record.readSubExpr();
2253 E->SubExprs[2] = Record.readSubExpr();
2254 E->Opcode = (BinaryOperatorKind)Record.readInt();
2255}
2256
2257void ASTStmtReader::VisitCXXParenListInitExpr(CXXParenListInitExpr *E) {
2258 VisitExpr(E);
2259 unsigned ExpectedNumExprs = Record.readInt();
2260 assert(E->NumExprs == ExpectedNumExprs &&
2261 "expected number of expressions does not equal the actual number of "
2262 "serialized expressions.");
2263 E->NumUserSpecifiedExprs = Record.readInt();
2264 E->InitLoc = readSourceLocation();
2265 E->LParenLoc = readSourceLocation();
2266 E->RParenLoc = readSourceLocation();
2267 for (unsigned I = 0; I < ExpectedNumExprs; I++)
2268 E->getTrailingObjects<Expr *>()[I] = Record.readSubExpr();
2269
2270 bool HasArrayFillerOrUnionDecl = Record.readBool();
2271 if (HasArrayFillerOrUnionDecl) {
2272 bool HasArrayFiller = Record.readBool();
2273 if (HasArrayFiller) {
2274 E->setArrayFiller(Record.readSubExpr());
2275 } else {
2276 E->setInitializedFieldInUnion(readDeclAs<FieldDecl>());
2277 }
2278 }
2279 E->updateDependence();
2280}
2281
2282void ASTStmtReader::VisitOpaqueValueExpr(OpaqueValueExpr *E) {
2283 VisitExpr(E);
2284 E->SourceExpr = Record.readSubExpr();
2285 E->OpaqueValueExprBits.Loc = readSourceLocation();
2286 E->setIsUnique(Record.readInt());
2287}
2288
2289void ASTStmtReader::VisitTypoExpr(TypoExpr *E) {
2290 llvm_unreachable("Cannot read TypoExpr nodes");
2291}
2292
2293void ASTStmtReader::VisitRecoveryExpr(RecoveryExpr *E) {
2294 VisitExpr(E);
2295 unsigned NumArgs = Record.readInt();
2296 E->BeginLoc = readSourceLocation();
2297 E->EndLoc = readSourceLocation();
2298 assert((NumArgs + 0LL ==
2299 std::distance(E->children().begin(), E->children().end())) &&
2300 "Wrong NumArgs!");
2301 (void)NumArgs;
2302 for (Stmt *&Child : E->children())
2303 Child = Record.readSubStmt();
2304}
2305
2306//===----------------------------------------------------------------------===//
2307// Microsoft Expressions and Statements
2308//===----------------------------------------------------------------------===//
2309void ASTStmtReader::VisitMSPropertyRefExpr(MSPropertyRefExpr *E) {
2310 VisitExpr(E);
2311 E->IsArrow = (Record.readInt() != 0);
2312 E->BaseExpr = Record.readSubExpr();
2313 E->QualifierLoc = Record.readNestedNameSpecifierLoc();
2314 E->MemberLoc = readSourceLocation();
2315 E->TheDecl = readDeclAs<MSPropertyDecl>();
2316}
2317
2318void ASTStmtReader::VisitMSPropertySubscriptExpr(MSPropertySubscriptExpr *E) {
2319 VisitExpr(E);
2320 E->setBase(Record.readSubExpr());
2321 E->setIdx(Record.readSubExpr());
2322 E->setRBracketLoc(readSourceLocation());
2323}
2324
2325void ASTStmtReader::VisitCXXUuidofExpr(CXXUuidofExpr *E) {
2326 VisitExpr(E);
2327 E->setSourceRange(readSourceRange());
2328 E->Guid = readDeclAs<MSGuidDecl>();
2329 if (E->isTypeOperand())
2330 E->Operand = readTypeSourceInfo();
2331 else
2332 E->Operand = Record.readSubExpr();
2333}
2334
2335void ASTStmtReader::VisitSEHLeaveStmt(SEHLeaveStmt *S) {
2336 VisitStmt(S);
2337 S->setLeaveLoc(readSourceLocation());
2338}
2339
2340void ASTStmtReader::VisitSEHExceptStmt(SEHExceptStmt *S) {
2341 VisitStmt(S);
2342 S->Loc = readSourceLocation();
2343 S->Children[SEHExceptStmt::FILTER_EXPR] = Record.readSubStmt();
2344 S->Children[SEHExceptStmt::BLOCK] = Record.readSubStmt();
2345}
2346
2347void ASTStmtReader::VisitSEHFinallyStmt(SEHFinallyStmt *S) {
2348 VisitStmt(S);
2349 S->Loc = readSourceLocation();
2350 S->Block = Record.readSubStmt();
2351}
2352
2353void ASTStmtReader::VisitSEHTryStmt(SEHTryStmt *S) {
2354 VisitStmt(S);
2355 S->IsCXXTry = Record.readInt();
2356 S->TryLoc = readSourceLocation();
2357 S->Children[SEHTryStmt::TRY] = Record.readSubStmt();
2358 S->Children[SEHTryStmt::HANDLER] = Record.readSubStmt();
2359}
2360
2361//===----------------------------------------------------------------------===//
2362// CUDA Expressions and Statements
2363//===----------------------------------------------------------------------===//
2364
2365void ASTStmtReader::VisitCUDAKernelCallExpr(CUDAKernelCallExpr *E) {
2366 VisitCallExpr(E);
2367 E->setPreArg(CUDAKernelCallExpr::CONFIG, Record.readSubExpr());
2368}
2369
2370//===----------------------------------------------------------------------===//
2371// OpenCL Expressions and Statements.
2372//===----------------------------------------------------------------------===//
2373void ASTStmtReader::VisitAsTypeExpr(AsTypeExpr *E) {
2374 VisitExpr(E);
2375 E->BuiltinLoc = readSourceLocation();
2376 E->RParenLoc = readSourceLocation();
2377 E->SrcExpr = Record.readSubExpr();
2378}
2379
2380//===----------------------------------------------------------------------===//
2381// OpenMP Directives.
2382//===----------------------------------------------------------------------===//
2383
2384void ASTStmtReader::VisitOMPCanonicalLoop(OMPCanonicalLoop *S) {
2385 VisitStmt(S);
2386 for (Stmt *&SubStmt : S->SubStmts)
2387 SubStmt = Record.readSubStmt();
2388}
2389
2390void ASTStmtReader::VisitOMPExecutableDirective(OMPExecutableDirective *E) {
2391 Record.readOMPChildren(E->Data);
2392 E->setLocStart(readSourceLocation());
2393 E->setLocEnd(readSourceLocation());
2394}
2395
2396void ASTStmtReader::VisitOMPLoopBasedDirective(OMPLoopBasedDirective *D) {
2397 VisitStmt(D);
2398 // Field CollapsedNum was read in ReadStmtFromStream.
2399 Record.skipInts(1);
2400 VisitOMPExecutableDirective(D);
2401}
2402
2403void ASTStmtReader::VisitOMPLoopDirective(OMPLoopDirective *D) {
2404 VisitOMPLoopBasedDirective(D);
2405}
2406
2407void ASTStmtReader::VisitOMPMetaDirective(OMPMetaDirective *D) {
2408 VisitStmt(D);
2409 // The NumClauses field was read in ReadStmtFromStream.
2410 Record.skipInts(1);
2411 VisitOMPExecutableDirective(D);
2412}
2413
2414void ASTStmtReader::VisitOMPParallelDirective(OMPParallelDirective *D) {
2415 VisitStmt(D);
2416 VisitOMPExecutableDirective(D);
2417 D->setHasCancel(Record.readBool());
2418}
2419
2420void ASTStmtReader::VisitOMPSimdDirective(OMPSimdDirective *D) {
2421 VisitOMPLoopDirective(D);
2422}
2423
2424void ASTStmtReader::VisitOMPLoopTransformationDirective(
2426 VisitOMPLoopBasedDirective(D);
2427 D->setNumGeneratedLoops(Record.readUInt32());
2428}
2429
2430void ASTStmtReader::VisitOMPTileDirective(OMPTileDirective *D) {
2431 VisitOMPLoopTransformationDirective(D);
2432}
2433
2434void ASTStmtReader::VisitOMPUnrollDirective(OMPUnrollDirective *D) {
2435 VisitOMPLoopTransformationDirective(D);
2436}
2437
2438void ASTStmtReader::VisitOMPReverseDirective(OMPReverseDirective *D) {
2439 VisitOMPLoopTransformationDirective(D);
2440}
2441
2442void ASTStmtReader::VisitOMPInterchangeDirective(OMPInterchangeDirective *D) {
2443 VisitOMPLoopTransformationDirective(D);
2444}
2445
2446void ASTStmtReader::VisitOMPForDirective(OMPForDirective *D) {
2447 VisitOMPLoopDirective(D);
2448 D->setHasCancel(Record.readBool());
2449}
2450
2451void ASTStmtReader::VisitOMPForSimdDirective(OMPForSimdDirective *D) {
2452 VisitOMPLoopDirective(D);
2453}
2454
2455void ASTStmtReader::VisitOMPSectionsDirective(OMPSectionsDirective *D) {
2456 VisitStmt(D);
2457 VisitOMPExecutableDirective(D);
2458 D->setHasCancel(Record.readBool());
2459}
2460
2461void ASTStmtReader::VisitOMPSectionDirective(OMPSectionDirective *D) {
2462 VisitStmt(D);
2463 VisitOMPExecutableDirective(D);
2464 D->setHasCancel(Record.readBool());
2465}
2466
2467void ASTStmtReader::VisitOMPScopeDirective(OMPScopeDirective *D) {
2468 VisitStmt(D);
2469 VisitOMPExecutableDirective(D);
2470}
2471
2472void ASTStmtReader::VisitOMPSingleDirective(OMPSingleDirective *D) {
2473 VisitStmt(D);
2474 VisitOMPExecutableDirective(D);
2475}
2476
2477void ASTStmtReader::VisitOMPMasterDirective(OMPMasterDirective *D) {
2478 VisitStmt(D);
2479 VisitOMPExecutableDirective(D);
2480}
2481
2482void ASTStmtReader::VisitOMPCriticalDirective(OMPCriticalDirective *D) {
2483 VisitStmt(D);
2484 VisitOMPExecutableDirective(D);
2485 D->DirName = Record.readDeclarationNameInfo();
2486}
2487
2488void ASTStmtReader::VisitOMPParallelForDirective(OMPParallelForDirective *D) {
2489 VisitOMPLoopDirective(D);
2490 D->setHasCancel(Record.readBool());
2491}
2492
2493void ASTStmtReader::VisitOMPParallelForSimdDirective(
2495 VisitOMPLoopDirective(D);
2496}
2497
2498void ASTStmtReader::VisitOMPParallelMasterDirective(
2500 VisitStmt(D);
2501 VisitOMPExecutableDirective(D);
2502}
2503
2504void ASTStmtReader::VisitOMPParallelMaskedDirective(
2506 VisitStmt(D);
2507 VisitOMPExecutableDirective(D);
2508}
2509
2510void ASTStmtReader::VisitOMPParallelSectionsDirective(
2512 VisitStmt(D);
2513 VisitOMPExecutableDirective(D);
2514 D->setHasCancel(Record.readBool());
2515}
2516
2517void ASTStmtReader::VisitOMPTaskDirective(OMPTaskDirective *D) {
2518 VisitStmt(D);
2519 VisitOMPExecutableDirective(D);
2520 D->setHasCancel(Record.readBool());
2521}
2522
2523void ASTStmtReader::VisitOMPTaskyieldDirective(OMPTaskyieldDirective *D) {
2524 VisitStmt(D);
2525 VisitOMPExecutableDirective(D);
2526}
2527
2528void ASTStmtReader::VisitOMPBarrierDirective(OMPBarrierDirective *D) {
2529 VisitStmt(D);
2530 VisitOMPExecutableDirective(D);
2531}
2532
2533void ASTStmtReader::VisitOMPTaskwaitDirective(OMPTaskwaitDirective *D) {
2534 VisitStmt(D);
2535 // The NumClauses field was read in ReadStmtFromStream.
2536 Record.skipInts(1);
2537 VisitOMPExecutableDirective(D);
2538}
2539
2540void ASTStmtReader::VisitOMPAssumeDirective(OMPAssumeDirective *D) {
2541 VisitStmt(D);
2542 VisitOMPExecutableDirective(D);
2543}
2544
2545void ASTStmtReader::VisitOMPErrorDirective(OMPErrorDirective *D) {
2546 VisitStmt(D);
2547 // The NumClauses field was read in ReadStmtFromStream.
2548 Record.skipInts(1);
2549 VisitOMPExecutableDirective(D);
2550}
2551
2552void ASTStmtReader::VisitOMPTaskgroupDirective(OMPTaskgroupDirective *D) {
2553 VisitStmt(D);
2554 VisitOMPExecutableDirective(D);
2555}
2556
2557void ASTStmtReader::VisitOMPFlushDirective(OMPFlushDirective *D) {
2558 VisitStmt(D);
2559 VisitOMPExecutableDirective(D);
2560}
2561
2562void ASTStmtReader::VisitOMPDepobjDirective(OMPDepobjDirective *D) {
2563 VisitStmt(D);
2564 VisitOMPExecutableDirective(D);
2565}
2566
2567void ASTStmtReader::VisitOMPScanDirective(OMPScanDirective *D) {
2568 VisitStmt(D);
2569 VisitOMPExecutableDirective(D);
2570}
2571
2572void ASTStmtReader::VisitOMPOrderedDirective(OMPOrderedDirective *D) {
2573 VisitStmt(D);
2574 VisitOMPExecutableDirective(D);
2575}
2576
2577void ASTStmtReader::VisitOMPAtomicDirective(OMPAtomicDirective *D) {
2578 VisitStmt(D);
2579 VisitOMPExecutableDirective(D);
2580 D->Flags.IsXLHSInRHSPart = Record.readBool() ? 1 : 0;
2581 D->Flags.IsPostfixUpdate = Record.readBool() ? 1 : 0;
2582 D->Flags.IsFailOnly = Record.readBool() ? 1 : 0;
2583}
2584
2585void ASTStmtReader::VisitOMPTargetDirective(OMPTargetDirective *D) {
2586 VisitStmt(D);
2587 VisitOMPExecutableDirective(D);
2588}
2589
2590void ASTStmtReader::VisitOMPTargetDataDirective(OMPTargetDataDirective *D) {
2591 VisitStmt(D);
2592 VisitOMPExecutableDirective(D);
2593}
2594
2595void ASTStmtReader::VisitOMPTargetEnterDataDirective(
2597 VisitStmt(D);
2598 VisitOMPExecutableDirective(D);
2599}
2600
2601void ASTStmtReader::VisitOMPTargetExitDataDirective(
2603 VisitStmt(D);
2604 VisitOMPExecutableDirective(D);
2605}
2606
2607void ASTStmtReader::VisitOMPTargetParallelDirective(
2609 VisitStmt(D);
2610 VisitOMPExecutableDirective(D);
2611 D->setHasCancel(Record.readBool());
2612}
2613
2614void ASTStmtReader::VisitOMPTargetParallelForDirective(
2616 VisitOMPLoopDirective(D);
2617 D->setHasCancel(Record.readBool());
2618}
2619
2620void ASTStmtReader::VisitOMPTeamsDirective(OMPTeamsDirective *D) {
2621 VisitStmt(D);
2622 VisitOMPExecutableDirective(D);
2623}
2624
2625void ASTStmtReader::VisitOMPCancellationPointDirective(
2627 VisitStmt(D);
2628 VisitOMPExecutableDirective(D);
2629 D->setCancelRegion(Record.readEnum<OpenMPDirectiveKind>());
2630}
2631
2632void ASTStmtReader::VisitOMPCancelDirective(OMPCancelDirective *D) {
2633 VisitStmt(D);
2634 VisitOMPExecutableDirective(D);
2635 D->setCancelRegion(Record.readEnum<OpenMPDirectiveKind>());
2636}
2637
2638void ASTStmtReader::VisitOMPTaskLoopDirective(OMPTaskLoopDirective *D) {
2639 VisitOMPLoopDirective(D);
2640 D->setHasCancel(Record.readBool());
2641}
2642
2643void ASTStmtReader::VisitOMPTaskLoopSimdDirective(OMPTaskLoopSimdDirective *D) {
2644 VisitOMPLoopDirective(D);
2645}
2646
2647void ASTStmtReader::VisitOMPMasterTaskLoopDirective(
2649 VisitOMPLoopDirective(D);
2650 D->setHasCancel(Record.readBool());
2651}
2652
2653void ASTStmtReader::VisitOMPMaskedTaskLoopDirective(
2655 VisitOMPLoopDirective(D);
2656 D->setHasCancel(Record.readBool());
2657}
2658
2659void ASTStmtReader::VisitOMPMasterTaskLoopSimdDirective(
2661 VisitOMPLoopDirective(D);
2662}
2663
2664void ASTStmtReader::VisitOMPMaskedTaskLoopSimdDirective(
2666 VisitOMPLoopDirective(D);
2667}
2668
2669void ASTStmtReader::VisitOMPParallelMasterTaskLoopDirective(
2671 VisitOMPLoopDirective(D);
2672 D->setHasCancel(Record.readBool());
2673}
2674
2675void ASTStmtReader::VisitOMPParallelMaskedTaskLoopDirective(
2677 VisitOMPLoopDirective(D);
2678 D->setHasCancel(Record.readBool());
2679}
2680
2681void ASTStmtReader::VisitOMPParallelMasterTaskLoopSimdDirective(
2683 VisitOMPLoopDirective(D);
2684}
2685
2686void ASTStmtReader::VisitOMPParallelMaskedTaskLoopSimdDirective(
2688 VisitOMPLoopDirective(D);
2689}
2690
2691void ASTStmtReader::VisitOMPDistributeDirective(OMPDistributeDirective *D) {
2692 VisitOMPLoopDirective(D);
2693}
2694
2695void ASTStmtReader::VisitOMPTargetUpdateDirective(OMPTargetUpdateDirective *D) {
2696 VisitStmt(D);
2697 VisitOMPExecutableDirective(D);
2698}
2699
2700void ASTStmtReader::VisitOMPDistributeParallelForDirective(
2702 VisitOMPLoopDirective(D);
2703 D->setHasCancel(Record.readBool());
2704}
2705
2706void ASTStmtReader::VisitOMPDistributeParallelForSimdDirective(
2708 VisitOMPLoopDirective(D);
2709}
2710
2711void ASTStmtReader::VisitOMPDistributeSimdDirective(
2713 VisitOMPLoopDirective(D);
2714}
2715
2716void ASTStmtReader::VisitOMPTargetParallelForSimdDirective(
2718 VisitOMPLoopDirective(D);
2719}
2720
2721void ASTStmtReader::VisitOMPTargetSimdDirective(OMPTargetSimdDirective *D) {
2722 VisitOMPLoopDirective(D);
2723}
2724
2725void ASTStmtReader::VisitOMPTeamsDistributeDirective(
2727 VisitOMPLoopDirective(D);
2728}
2729
2730void ASTStmtReader::VisitOMPTeamsDistributeSimdDirective(
2732 VisitOMPLoopDirective(D);
2733}
2734
2735void ASTStmtReader::VisitOMPTeamsDistributeParallelForSimdDirective(
2737 VisitOMPLoopDirective(D);
2738}
2739
2740void ASTStmtReader::VisitOMPTeamsDistributeParallelForDirective(
2742 VisitOMPLoopDirective(D);
2743 D->setHasCancel(Record.readBool());
2744}
2745
2746void ASTStmtReader::VisitOMPTargetTeamsDirective(OMPTargetTeamsDirective *D) {
2747 VisitStmt(D);
2748 VisitOMPExecutableDirective(D);
2749}
2750
2751void ASTStmtReader::VisitOMPTargetTeamsDistributeDirective(
2753 VisitOMPLoopDirective(D);
2754}
2755
2756void ASTStmtReader::VisitOMPTargetTeamsDistributeParallelForDirective(
2758 VisitOMPLoopDirective(D);
2759 D->setHasCancel(Record.readBool());
2760}
2761
2762void ASTStmtReader::VisitOMPTargetTeamsDistributeParallelForSimdDirective(
2764 VisitOMPLoopDirective(D);
2765}
2766
2767void ASTStmtReader::VisitOMPTargetTeamsDistributeSimdDirective(
2769 VisitOMPLoopDirective(D);
2770}
2771
2772void ASTStmtReader::VisitOMPInteropDirective(OMPInteropDirective *D) {
2773 VisitStmt(D);
2774 VisitOMPExecutableDirective(D);
2775}
2776
2777void ASTStmtReader::VisitOMPDispatchDirective(OMPDispatchDirective *D) {
2778 VisitStmt(D);
2779 VisitOMPExecutableDirective(D);
2780 D->setTargetCallLoc(Record.readSourceLocation());
2781}
2782
2783void ASTStmtReader::VisitOMPMaskedDirective(OMPMaskedDirective *D) {
2784 VisitStmt(D);
2785 VisitOMPExecutableDirective(D);
2786}
2787
2788void ASTStmtReader::VisitOMPGenericLoopDirective(OMPGenericLoopDirective *D) {
2789 VisitOMPLoopDirective(D);
2790}
2791
2792void ASTStmtReader::VisitOMPTeamsGenericLoopDirective(
2794 VisitOMPLoopDirective(D);
2795}
2796
2797void ASTStmtReader::VisitOMPTargetTeamsGenericLoopDirective(
2799 VisitOMPLoopDirective(D);
2800 D->setCanBeParallelFor(Record.readBool());
2801}
2802
2803void ASTStmtReader::VisitOMPParallelGenericLoopDirective(
2805 VisitOMPLoopDirective(D);
2806}
2807
2808void ASTStmtReader::VisitOMPTargetParallelGenericLoopDirective(
2810 VisitOMPLoopDirective(D);
2811}
2812
2813//===----------------------------------------------------------------------===//
2814// OpenACC Constructs/Directives.
2815//===----------------------------------------------------------------------===//
2816void ASTStmtReader::VisitOpenACCConstructStmt(OpenACCConstructStmt *S) {
2817 (void)Record.readInt();
2818 S->Kind = Record.readEnum<OpenACCDirectiveKind>();
2819 S->Range = Record.readSourceRange();
2820 S->DirectiveLoc = Record.readSourceLocation();
2821 Record.readOpenACCClauseList(S->Clauses);
2822}
2823
2824void ASTStmtReader::VisitOpenACCAssociatedStmtConstruct(
2826 VisitOpenACCConstructStmt(S);
2827 S->setAssociatedStmt(Record.readSubStmt());
2828}
2829
2830void ASTStmtReader::VisitOpenACCComputeConstruct(OpenACCComputeConstruct *S) {
2831 VisitStmt(S);
2832 VisitOpenACCAssociatedStmtConstruct(S);
2833 S->findAndSetChildLoops();
2834}
2835
2836void ASTStmtReader::VisitOpenACCLoopConstruct(OpenACCLoopConstruct *S) {
2837 VisitStmt(S);
2838 VisitOpenACCAssociatedStmtConstruct(S);
2839}
2840
2841//===----------------------------------------------------------------------===//
2842// ASTReader Implementation
2843//===----------------------------------------------------------------------===//
2844
2846 switch (ReadingKind) {
2847 case Read_None:
2848 llvm_unreachable("should not call this when not reading anything");
2849 case Read_Decl:
2850 case Read_Type:
2851 return ReadStmtFromStream(F);
2852 case Read_Stmt:
2853 return ReadSubStmt();
2854 }
2855
2856 llvm_unreachable("ReadingKind not set ?");
2857}
2858
2860 return cast_or_null<Expr>(ReadStmt(F));
2861}
2862
2864 return cast_or_null<Expr>(ReadSubStmt());
2865}
2866
2867// Within the bitstream, expressions are stored in Reverse Polish
2868// Notation, with each of the subexpressions preceding the
2869// expression they are stored in. Subexpressions are stored from last to first.
2870// To evaluate expressions, we continue reading expressions and placing them on
2871// the stack, with expressions having operands removing those operands from the
2872// stack. Evaluation terminates when we see a STMT_STOP record, and
2873// the single remaining expression on the stack is our result.
2874Stmt *ASTReader::ReadStmtFromStream(ModuleFile &F) {
2875 ReadingKindTracker ReadingKind(Read_Stmt, *this);
2876 llvm::BitstreamCursor &Cursor = F.DeclsCursor;
2877
2878 // Map of offset to previously deserialized stmt. The offset points
2879 // just after the stmt record.
2880 llvm::DenseMap<uint64_t, Stmt *> StmtEntries;
2881
2882#ifndef NDEBUG
2883 unsigned PrevNumStmts = StmtStack.size();
2884#endif
2885
2886 ASTRecordReader Record(*this, F);
2887 ASTStmtReader Reader(Record, Cursor);
2889
2890 while (true) {
2892 Cursor.advanceSkippingSubblocks();
2893 if (!MaybeEntry) {
2894 Error(toString(MaybeEntry.takeError()));
2895 return nullptr;
2896 }
2897 llvm::BitstreamEntry Entry = MaybeEntry.get();
2898
2899 switch (Entry.Kind) {
2900 case llvm::BitstreamEntry::SubBlock: // Handled for us already.
2901 case llvm::BitstreamEntry::Error:
2902 Error("malformed block record in AST file");
2903 return nullptr;
2904 case llvm::BitstreamEntry::EndBlock:
2905 goto Done;
2906 case llvm::BitstreamEntry::Record:
2907 // The interesting case.
2908 break;
2909 }
2910
2911 ASTContext &Context = getContext();
2912 Stmt *S = nullptr;
2913 bool Finished = false;
2914 bool IsStmtReference = false;
2915 Expected<unsigned> MaybeStmtCode = Record.readRecord(Cursor, Entry.ID);
2916 if (!MaybeStmtCode) {
2917 Error(toString(MaybeStmtCode.takeError()));
2918 return nullptr;
2919 }
2920 switch ((StmtCode)MaybeStmtCode.get()) {
2921 case STMT_STOP:
2922 Finished = true;
2923 break;
2924
2925 case STMT_REF_PTR:
2926 IsStmtReference = true;
2927 assert(StmtEntries.contains(Record[0]) &&
2928 "No stmt was recorded for this offset reference!");
2929 S = StmtEntries[Record.readInt()];
2930 break;
2931
2932 case STMT_NULL_PTR:
2933 S = nullptr;
2934 break;
2935
2936 case STMT_NULL:
2937 S = new (Context) NullStmt(Empty);
2938 break;
2939
2940 case STMT_COMPOUND: {
2941 unsigned NumStmts = Record[ASTStmtReader::NumStmtFields];
2942 bool HasFPFeatures = Record[ASTStmtReader::NumStmtFields + 1];
2943 S = CompoundStmt::CreateEmpty(Context, NumStmts, HasFPFeatures);
2944 break;
2945 }
2946
2947 case STMT_CASE:
2949 Context,
2950 /*CaseStmtIsGNURange*/ Record[ASTStmtReader::NumStmtFields + 3]);
2951 break;
2952
2953 case STMT_DEFAULT:
2954 S = new (Context) DefaultStmt(Empty);
2955 break;
2956
2957 case STMT_LABEL:
2958 S = new (Context) LabelStmt(Empty);
2959 break;
2960
2961 case STMT_ATTRIBUTED:
2963 Context,
2965 break;
2966
2967 case STMT_IF: {
2969 bool HasElse = IfStmtBits.getNextBit();
2970 bool HasVar = IfStmtBits.getNextBit();
2971 bool HasInit = IfStmtBits.getNextBit();
2972 S = IfStmt::CreateEmpty(Context, HasElse, HasVar, HasInit);
2973 break;
2974 }
2975
2976 case STMT_SWITCH:
2978 Context,
2980 /* HasVar=*/Record[ASTStmtReader::NumStmtFields + 1]);
2981 break;
2982
2983 case STMT_WHILE:
2985 Context,
2987 break;
2988
2989 case STMT_DO:
2990 S = new (Context) DoStmt(Empty);
2991 break;
2992
2993 case STMT_FOR:
2994 S = new (Context) ForStmt(Empty);
2995 break;
2996
2997 case STMT_GOTO:
2998 S = new (Context) GotoStmt(Empty);
2999 break;
3000
3001 case STMT_INDIRECT_GOTO:
3002 S = new (Context) IndirectGotoStmt(Empty);
3003 break;
3004
3005 case STMT_CONTINUE:
3006 S = new (Context) ContinueStmt(Empty);
3007 break;
3008
3009 case STMT_BREAK:
3010 S = new (Context) BreakStmt(Empty);
3011 break;
3012
3013 case STMT_RETURN:
3015 Context, /* HasNRVOCandidate=*/Record[ASTStmtReader::NumStmtFields]);
3016 break;
3017
3018 case STMT_DECL:
3019 S = new (Context) DeclStmt(Empty);
3020 break;
3021
3022 case STMT_GCCASM:
3023 S = new (Context) GCCAsmStmt(Empty);
3024 break;
3025
3026 case STMT_MSASM:
3027 S = new (Context) MSAsmStmt(Empty);
3028 break;
3029
3030 case STMT_CAPTURED:
3033 break;
3034
3035 case EXPR_CONSTANT:
3037 Context, static_cast<ConstantResultStorageKind>(
3038 /*StorageKind=*/Record[ASTStmtReader::NumExprFields]));
3039 break;
3040
3043 break;
3044
3045 case EXPR_PREDEFINED:
3047 Context,
3048 /*HasFunctionName*/ Record[ASTStmtReader::NumExprFields]);
3049 break;
3050
3051 case EXPR_DECL_REF: {
3053 DeclRefExprBits.advance(5);
3054 bool HasFoundDecl = DeclRefExprBits.getNextBit();
3055 bool HasQualifier = DeclRefExprBits.getNextBit();
3056 bool HasTemplateKWAndArgsInfo = DeclRefExprBits.getNextBit();
3057 unsigned NumTemplateArgs = HasTemplateKWAndArgsInfo
3059 : 0;
3060 S = DeclRefExpr::CreateEmpty(Context, HasQualifier, HasFoundDecl,
3061 HasTemplateKWAndArgsInfo, NumTemplateArgs);
3062 break;
3063 }
3064
3066 S = IntegerLiteral::Create(Context, Empty);
3067 break;
3068
3070 S = FixedPointLiteral::Create(Context, Empty);
3071 break;
3072
3074 S = FloatingLiteral::Create(Context, Empty);
3075 break;
3076
3078 S = new (Context) ImaginaryLiteral(Empty);
3079 break;
3080
3083 Context,
3084 /* NumConcatenated=*/Record[ASTStmtReader::NumExprFields],
3085 /* Length=*/Record[ASTStmtReader::NumExprFields + 1],
3086 /* CharByteWidth=*/Record[ASTStmtReader::NumExprFields + 2]);
3087 break;
3088
3090 S = new (Context) CharacterLiteral(Empty);
3091 break;
3092
3093 case EXPR_PAREN:
3094 S = new (Context) ParenExpr(Empty);
3095 break;
3096
3097 case EXPR_PAREN_LIST:
3099 Context,
3100 /* NumExprs=*/Record[ASTStmtReader::NumExprFields]);
3101 break;
3102
3103 case EXPR_UNARY_OPERATOR: {
3105 UnaryOperatorBits.advance(ASTStmtReader::NumExprBits);
3106 bool HasFPFeatures = UnaryOperatorBits.getNextBit();
3107 S = UnaryOperator::CreateEmpty(Context, HasFPFeatures);
3108 break;
3109 }
3110
3111 case EXPR_OFFSETOF:
3112 S = OffsetOfExpr::CreateEmpty(Context,
3115 break;
3116
3118 S = new (Context) UnaryExprOrTypeTraitExpr(Empty);
3119 break;
3120
3122 S = new (Context) ArraySubscriptExpr(Empty);
3123 break;
3124
3126 S = new (Context) MatrixSubscriptExpr(Empty);
3127 break;
3128
3129 case EXPR_ARRAY_SECTION:
3130 S = new (Context) ArraySectionExpr(Empty);
3131 break;
3132
3136 break;
3137
3138 case EXPR_OMP_ITERATOR:
3139 S = OMPIteratorExpr::CreateEmpty(Context,
3141 break;
3142
3143 case EXPR_CALL: {
3144 auto NumArgs = Record[ASTStmtReader::NumExprFields];
3146 CallExprBits.advance(1);
3147 auto HasFPFeatures = CallExprBits.getNextBit();
3148 S = CallExpr::CreateEmpty(Context, NumArgs, HasFPFeatures, Empty);
3149 break;
3150 }
3151
3152 case EXPR_RECOVERY:
3154 Context, /*NumArgs=*/Record[ASTStmtReader::NumExprFields]);
3155 break;
3156
3157 case EXPR_MEMBER: {
3159 bool HasQualifier = ExprMemberBits.getNextBit();
3160 bool HasFoundDecl = ExprMemberBits.getNextBit();
3161 bool HasTemplateInfo = ExprMemberBits.getNextBit();
3162 unsigned NumTemplateArgs = Record[ASTStmtReader::NumExprFields + 1];
3163 S = MemberExpr::CreateEmpty(Context, HasQualifier, HasFoundDecl,
3164 HasTemplateInfo, NumTemplateArgs);
3165 break;
3166 }
3167
3168 case EXPR_BINARY_OPERATOR: {
3170 BinaryOperatorBits.advance(/*Size of opcode*/ 6);
3171 bool HasFPFeatures = BinaryOperatorBits.getNextBit();
3172 S = BinaryOperator::CreateEmpty(Context, HasFPFeatures);
3173 break;
3174 }
3175
3178 BinaryOperatorBits.advance(/*Size of opcode*/ 6);
3179 bool HasFPFeatures = BinaryOperatorBits.getNextBit();
3180 S = CompoundAssignOperator::CreateEmpty(Context, HasFPFeatures);
3181 break;
3182 }
3183
3185 S = new (Context) ConditionalOperator(Empty);
3186 break;
3187
3189 S = new (Context) BinaryConditionalOperator(Empty);
3190 break;
3191
3192 case EXPR_IMPLICIT_CAST: {
3193 unsigned PathSize = Record[ASTStmtReader::NumExprFields];
3195 CastExprBits.advance(7);
3196 bool HasFPFeatures = CastExprBits.getNextBit();
3197 S = ImplicitCastExpr::CreateEmpty(Context, PathSize, HasFPFeatures);
3198 break;
3199 }
3200
3201 case EXPR_CSTYLE_CAST: {
3202 unsigned PathSize = Record[ASTStmtReader::NumExprFields];
3204 CastExprBits.advance(7);
3205 bool HasFPFeatures = CastExprBits.getNextBit();
3206 S = CStyleCastExpr::CreateEmpty(Context, PathSize, HasFPFeatures);
3207 break;
3208 }
3209
3211 S = new (Context) CompoundLiteralExpr(Empty);
3212 break;
3213
3215 S = new (Context) ExtVectorElementExpr(Empty);
3216 break;
3217
3218 case EXPR_INIT_LIST:
3219 S = new (Context) InitListExpr(Empty);
3220 break;
3221
3225
3226 break;
3227
3229 S = new (Context) DesignatedInitUpdateExpr(Empty);
3230 break;
3231
3233 S = new (Context) ImplicitValueInitExpr(Empty);
3234 break;
3235
3236 case EXPR_NO_INIT:
3237 S = new (Context) NoInitExpr(Empty);
3238 break;
3239
3241 S = new (Context) ArrayInitLoopExpr(Empty);
3242 break;
3243
3245 S = new (Context) ArrayInitIndexExpr(Empty);
3246 break;
3247
3248 case EXPR_VA_ARG:
3249 S = new (Context) VAArgExpr(Empty);
3250 break;
3251
3252 case EXPR_SOURCE_LOC:
3253 S = new (Context) SourceLocExpr(Empty);
3254 break;
3255
3257 S = new (Context) EmbedExpr(Empty);
3258 break;
3259
3260 case EXPR_ADDR_LABEL:
3261 S = new (Context) AddrLabelExpr(Empty);
3262 break;
3263
3264 case EXPR_STMT:
3265 S = new (Context) StmtExpr(Empty);
3266 break;
3267
3268 case EXPR_CHOOSE:
3269 S = new (Context) ChooseExpr(Empty);
3270 break;
3271
3272 case EXPR_GNU_NULL:
3273 S = new (Context) GNUNullExpr(Empty);
3274 break;
3275
3277 S = new (Context) ShuffleVectorExpr(Empty);
3278 break;
3279
3281 S = new (Context) ConvertVectorExpr(Empty);
3282 break;
3283
3284 case EXPR_BLOCK:
3285 S = new (Context) BlockExpr(Empty);
3286 break;
3287
3290 Context,
3291 /*NumAssocs=*/Record[ASTStmtReader::NumExprFields]);
3292 break;
3293
3295 S = new (Context) ObjCStringLiteral(Empty);
3296 break;
3297
3299 S = new (Context) ObjCBoxedExpr(Empty);
3300 break;
3301
3305 break;
3306
3311 break;
3312
3313 case EXPR_OBJC_ENCODE:
3314 S = new (Context) ObjCEncodeExpr(Empty);
3315 break;
3316
3318 S = new (Context) ObjCSelectorExpr(Empty);
3319 break;
3320
3322 S = new (Context) ObjCProtocolExpr(Empty);
3323 break;
3324
3326 S = new (Context) ObjCIvarRefExpr(Empty);
3327 break;
3328
3330 S = new (Context) ObjCPropertyRefExpr(Empty);
3331 break;
3332
3334 S = new (Context) ObjCSubscriptRefExpr(Empty);
3335 break;
3336
3338 llvm_unreachable("mismatching AST file");
3339
3341 S = ObjCMessageExpr::CreateEmpty(Context,
3344 break;
3345
3346 case EXPR_OBJC_ISA:
3347 S = new (Context) ObjCIsaExpr(Empty);
3348 break;
3349
3351 S = new (Context) ObjCIndirectCopyRestoreExpr(Empty);
3352 break;
3353
3355 S = new (Context) ObjCBridgedCastExpr(Empty);
3356 break;
3357
3359 S = new (Context) ObjCForCollectionStmt(Empty);
3360 break;
3361
3362 case STMT_OBJC_CATCH:
3363 S = new (Context) ObjCAtCatchStmt(Empty);
3364 break;
3365
3366 case STMT_OBJC_FINALLY:
3367 S = new (Context) ObjCAtFinallyStmt(Empty);
3368 break;
3369
3370 case STMT_OBJC_AT_TRY:
3371 S = ObjCAtTryStmt::CreateEmpty(Context,
3374 break;
3375
3377 S = new (Context) ObjCAtSynchronizedStmt(Empty);
3378 break;
3379
3380 case STMT_OBJC_AT_THROW:
3381 S = new (Context) ObjCAtThrowStmt(Empty);
3382 break;
3383
3385 S = new (Context) ObjCAutoreleasePoolStmt(Empty);
3386 break;
3387
3389 S = new (Context) ObjCBoolLiteralExpr(Empty);
3390 break;
3391
3393 S = new (Context) ObjCAvailabilityCheckExpr(Empty);
3394 break;
3395
3396 case STMT_SEH_LEAVE:
3397 S = new (Context) SEHLeaveStmt(Empty);
3398 break;
3399
3400 case STMT_SEH_EXCEPT:
3401 S = new (Context) SEHExceptStmt(Empty);
3402 break;
3403
3404 case STMT_SEH_FINALLY:
3405 S = new (Context) SEHFinallyStmt(Empty);
3406 break;
3407
3408 case STMT_SEH_TRY:
3409 S = new (Context) SEHTryStmt(Empty);
3410 break;
3411
3412 case STMT_CXX_CATCH:
3413 S = new (Context) CXXCatchStmt(Empty);
3414 break;
3415
3416 case STMT_CXX_TRY:
3417 S = CXXTryStmt::Create(Context, Empty,
3418 /*numHandlers=*/Record[ASTStmtReader::NumStmtFields]);
3419 break;
3420
3421 case STMT_CXX_FOR_RANGE:
3422 S = new (Context) CXXForRangeStmt(Empty);
3423 break;
3424
3426 S = new (Context) MSDependentExistsStmt(SourceLocation(), true,
3429 nullptr);
3430 break;
3431
3433 S = OMPCanonicalLoop::createEmpty(Context);
3434 break;
3435
3439 break;
3440
3442 S =
3445 Empty);
3446 break;
3447
3449 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3450 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3451 S = OMPSimdDirective::CreateEmpty(Context, NumClauses,
3452 CollapsedNum, Empty);
3453 break;
3454 }
3455
3457 unsigned NumLoops = Record[ASTStmtReader::NumStmtFields];
3458 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3459 S = OMPTileDirective::CreateEmpty(Context, NumClauses, NumLoops);
3460 break;
3461 }
3462
3464 assert(Record[ASTStmtReader::NumStmtFields] == 1 && "Unroll directive accepts only a single loop");
3465 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3466 S = OMPUnrollDirective::CreateEmpty(Context, NumClauses);
3467 break;
3468 }
3469
3471 assert(Record[ASTStmtReader::NumStmtFields] == 1 &&
3472 "Reverse directive accepts only a single loop");
3473 assert(Record[ASTStmtReader::NumStmtFields + 1] == 0 &&
3474 "Reverse directive has no clauses");
3476 break;
3477 }
3478
3480 unsigned NumLoops = Record[ASTStmtReader::NumStmtFields];
3481 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3482 S = OMPInterchangeDirective::CreateEmpty(Context, NumClauses, NumLoops);
3483 break;
3484 }
3485
3487 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3488 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3489 S = OMPForDirective::CreateEmpty(Context, NumClauses, CollapsedNum,
3490 Empty);
3491 break;
3492 }
3493
3495 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3496 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3497 S = OMPForSimdDirective::CreateEmpty(Context, NumClauses, CollapsedNum,
3498 Empty);
3499 break;
3500 }
3501
3505 break;
3506
3509 break;
3510
3514 break;
3515
3519 break;
3520
3523 break;
3524
3528 break;
3529
3531 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3532 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3533 S = OMPParallelForDirective::CreateEmpty(Context, NumClauses,
3534 CollapsedNum, Empty);
3535 break;
3536 }
3537
3539 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3540 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3541 S = OMPParallelForSimdDirective::CreateEmpty(Context, NumClauses,
3542 CollapsedNum, Empty);
3543 break;
3544 }
3545
3549 break;
3550
3554 break;
3555
3559 break;
3560
3564 break;
3565
3568 break;
3569
3572 break;
3573
3577 break;
3578
3582 break;
3583
3587 break;
3588
3592 break;
3593
3597 break;
3598
3602 break;
3603
3605 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
3606 bool HasAssociatedStmt = Record[ASTStmtReader::NumStmtFields + 2];
3607 S = OMPOrderedDirective::CreateEmpty(Context, NumClauses,
3608 !HasAssociatedStmt, Empty);
3609 break;
3610 }
3611
3615 break;
3616
3620 break;
3621
3625 break;
3626
3630 break;
3631
3635 break;
3636
3640 break;
3641
3643 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3644 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3645 S = OMPTargetParallelForDirective::CreateEmpty(Context, NumClauses,
3646 CollapsedNum, Empty);
3647 break;
3648 }
3649
3653 break;
3654
3658 break;
3659
3662 break;
3663
3667 break;
3668
3670 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3671 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3672 S = OMPTaskLoopDirective::CreateEmpty(Context, NumClauses, CollapsedNum,
3673 Empty);
3674 break;
3675 }
3676
3678 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3679 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3680 S = OMPTaskLoopSimdDirective::CreateEmpty(Context, NumClauses,
3681 CollapsedNum, Empty);
3682 break;
3683 }
3684
3686 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3687 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3688 S = OMPMasterTaskLoopDirective::CreateEmpty(Context, NumClauses,
3689 CollapsedNum, Empty);
3690 break;
3691 }
3692
3694 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3695 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3696 S = OMPMaskedTaskLoopDirective::CreateEmpty(Context, NumClauses,
3697 CollapsedNum, Empty);
3698 break;
3699 }
3700
3702 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3703 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3704 S = OMPMasterTaskLoopSimdDirective::CreateEmpty(Context, NumClauses,
3705 CollapsedNum, Empty);
3706 break;
3707 }
3708
3710 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3711 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3712 S = OMPMaskedTaskLoopSimdDirective::CreateEmpty(Context, NumClauses,
3713 CollapsedNum, Empty);
3714 break;
3715 }
3716
3718 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3719 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3721 CollapsedNum, Empty);
3722 break;
3723 }
3724
3726 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3727 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3729 CollapsedNum, Empty);
3730 break;
3731 }
3732
3734 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3735 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3737 Context, NumClauses, CollapsedNum, Empty);
3738 break;
3739 }
3740
3742 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3743 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3745 Context, NumClauses, CollapsedNum, Empty);
3746 break;
3747 }
3748
3750 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3751 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3752 S = OMPDistributeDirective::CreateEmpty(Context, NumClauses, CollapsedNum,
3753 Empty);
3754 break;
3755 }
3756
3758 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3759 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3760 S = OMPDistributeParallelForDirective::CreateEmpty(Context, NumClauses,
3761 CollapsedNum, Empty);
3762 break;
3763 }
3764
3766 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3767 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3769 CollapsedNum,
3770 Empty);
3771 break;
3772 }
3773
3775 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3776 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3777 S = OMPDistributeSimdDirective::CreateEmpty(Context, NumClauses,
3778 CollapsedNum, Empty);
3779 break;
3780 }
3781
3783 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3784 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3785 S = OMPTargetParallelForSimdDirective::CreateEmpty(Context, NumClauses,
3786 CollapsedNum, Empty);
3787 break;
3788 }
3789
3791 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3792 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3793 S = OMPTargetSimdDirective::CreateEmpty(Context, NumClauses, CollapsedNum,
3794 Empty);
3795 break;
3796 }
3797
3799 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3800 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3801 S = OMPTeamsDistributeDirective::CreateEmpty(Context, NumClauses,
3802 CollapsedNum, Empty);
3803 break;
3804 }
3805
3807 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3808 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3809 S = OMPTeamsDistributeSimdDirective::CreateEmpty(Context, NumClauses,
3810 CollapsedNum, Empty);
3811 break;
3812 }
3813
3815 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3816 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3818 Context, NumClauses, CollapsedNum, Empty);
3819 break;
3820 }
3821
3823 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3824 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3826 Context, NumClauses, CollapsedNum, Empty);
3827 break;
3828 }
3829
3833 break;
3834
3836 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3837 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3838 S = OMPTargetTeamsDistributeDirective::CreateEmpty(Context, NumClauses,
3839 CollapsedNum, Empty);
3840 break;
3841 }
3842
3844 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3845 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3847 Context, NumClauses, CollapsedNum, Empty);
3848 break;
3849 }
3850
3852 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3853 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3855 Context, NumClauses, CollapsedNum, Empty);
3856 break;
3857 }
3858
3860 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3861 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3863 Context, NumClauses, CollapsedNum, Empty);
3864 break;
3865 }
3866
3870 break;
3871
3875 break;
3876
3880 break;
3881
3883 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3884 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3885 S = OMPGenericLoopDirective::CreateEmpty(Context, NumClauses,
3886 CollapsedNum, Empty);
3887 break;
3888 }
3889
3891 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3892 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3893 S = OMPTeamsGenericLoopDirective::CreateEmpty(Context, NumClauses,
3894 CollapsedNum, Empty);
3895 break;
3896 }
3897
3899 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3900 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3902 CollapsedNum, Empty);
3903 break;
3904 }
3905
3907 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3908 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3909 S = OMPParallelGenericLoopDirective::CreateEmpty(Context, NumClauses,
3910 CollapsedNum, Empty);
3911 break;
3912 }
3913
3915 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3916 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3918 Context, NumClauses, CollapsedNum, Empty);
3919 break;
3920 }
3921
3923 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
3924 S = OMPAssumeDirective::CreateEmpty(Context, NumClauses, Empty);
3925 break;
3926 }
3927
3929 auto NumArgs = Record[ASTStmtReader::NumExprFields];
3931 CallExprBits.advance(1);
3932 auto HasFPFeatures = CallExprBits.getNextBit();
3933 S = CXXOperatorCallExpr::CreateEmpty(Context, NumArgs, HasFPFeatures,
3934 Empty);
3935 break;
3936 }
3937
3938 case EXPR_CXX_MEMBER_CALL: {
3939 auto NumArgs = Record[ASTStmtReader::NumExprFields];
3941 CallExprBits.advance(1);
3942 auto HasFPFeatures = CallExprBits.getNextBit();
3943 S = CXXMemberCallExpr::CreateEmpty(Context, NumArgs, HasFPFeatures,
3944 Empty);
3945 break;
3946 }
3947
3949 S = new (Context) CXXRewrittenBinaryOperator(Empty);
3950 break;
3951
3952 case EXPR_CXX_CONSTRUCT:
3954 Context,
3955 /* NumArgs=*/Record[ASTStmtReader::NumExprFields]);
3956 break;
3957
3959 S = new (Context) CXXInheritedCtorInitExpr(Empty);
3960 break;
3961
3964 Context,
3965 /* NumArgs=*/Record[ASTStmtReader::NumExprFields]);
3966 break;
3967
3968 case EXPR_CXX_STATIC_CAST: {
3969 unsigned PathSize = Record[ASTStmtReader::NumExprFields];
3971 CastExprBits.advance(7);
3972 bool HasFPFeatures = CastExprBits.getNextBit();
3973 S = CXXStaticCastExpr::CreateEmpty(Context, PathSize, HasFPFeatures);
3974 break;
3975 }
3976
3977 case EXPR_CXX_DYNAMIC_CAST: {
3978 unsigned PathSize = Record[ASTStmtReader::NumExprFields];
3979 S = CXXDynamicCastExpr::CreateEmpty(Context, PathSize);
3980 break;
3981 }
3982
3984 unsigned PathSize = Record[ASTStmtReader::NumExprFields];
3985 S = CXXReinterpretCastExpr::CreateEmpty(Context, PathSize);
3986 break;
3987 }
3988
3990 S = CXXConstCastExpr::CreateEmpty(Context);
3991 break;
3992
3995 break;
3996
3998 unsigned PathSize = Record[ASTStmtReader::NumExprFields];
4000 CastExprBits.advance(7);
4001 bool HasFPFeatures = CastExprBits.getNextBit();
4002 S = CXXFunctionalCastExpr::CreateEmpty(Context, PathSize, HasFPFeatures);
4003 break;
4004 }
4005
4006 case EXPR_BUILTIN_BIT_CAST: {
4007#ifndef NDEBUG
4008 unsigned PathSize = Record[ASTStmtReader::NumExprFields];
4009 assert(PathSize == 0 && "Wrong PathSize!");
4010#endif
4011 S = new (Context) BuiltinBitCastExpr(Empty);
4012 break;
4013 }
4014
4016 auto NumArgs = Record[ASTStmtReader::NumExprFields];
4018 CallExprBits.advance(1);
4019 auto HasFPFeatures = CallExprBits.getNextBit();
4020 S = UserDefinedLiteral::CreateEmpty(Context, NumArgs, HasFPFeatures,
4021 Empty);
4022 break;
4023 }
4024
4026 S = new (Context) CXXStdInitializerListExpr(Empty);
4027 break;
4028
4030 S = new (Context) CXXBoolLiteralExpr(Empty);
4031 break;
4032
4034 S = new (Context) CXXNullPtrLiteralExpr(Empty);
4035 break;
4036
4038 S = new (Context) CXXTypeidExpr(Empty, true);
4039 break;
4040
4042 S = new (Context) CXXTypeidExpr(Empty, false);
4043 break;
4044
4046 S = new (Context) CXXUuidofExpr(Empty, true);
4047 break;
4048
4050 S = new (Context) MSPropertyRefExpr(Empty);
4051 break;
4052
4054 S = new (Context) MSPropertySubscriptExpr(Empty);
4055 break;
4056
4058 S = new (Context) CXXUuidofExpr(Empty, false);
4059 break;
4060
4061 case EXPR_CXX_THIS:
4062 S = CXXThisExpr::CreateEmpty(Context);
4063 break;
4064
4065 case EXPR_CXX_THROW:
4066 S = new (Context) CXXThrowExpr(Empty);
4067 break;
4068
4071 Context, /*HasRewrittenInit=*/Record[ASTStmtReader::NumExprFields]);
4072 break;
4073
4076 Context, /*HasRewrittenInit=*/Record[ASTStmtReader::NumExprFields]);
4077 break;
4078
4080 S = new (Context) CXXBindTemporaryExpr(Empty);
4081 break;
4082
4084 S = new (Context) CXXScalarValueInitExpr(Empty);
4085 break;
4086
4087 case EXPR_CXX_NEW:
4089 Context,
4091 /*HasInit=*/Record[ASTStmtReader::NumExprFields + 1],
4092 /*NumPlacementArgs=*/Record[ASTStmtReader::NumExprFields + 2],
4093 /*IsParenTypeId=*/Record[ASTStmtReader::NumExprFields + 3]);
4094 break;
4095
4096 case EXPR_CXX_DELETE:
4097 S = new (Context) CXXDeleteExpr(Empty);
4098 break;
4099
4101 S = new (Context) CXXPseudoDestructorExpr(Empty);
4102 break;
4103
4105 S = ExprWithCleanups::Create(Context, Empty,
4107 break;
4108
4110 unsigned NumTemplateArgs = Record[ASTStmtReader::NumExprFields];
4111 BitsUnpacker DependentScopeMemberBits(
4113 bool HasTemplateKWAndArgsInfo = DependentScopeMemberBits.getNextBit();
4114
4115 bool HasFirstQualifierFoundInScope =
4116 DependentScopeMemberBits.getNextBit();
4118 Context, HasTemplateKWAndArgsInfo, NumTemplateArgs,
4119 HasFirstQualifierFoundInScope);
4120 break;
4121 }
4122
4124 BitsUnpacker DependentScopeDeclRefBits(
4126 DependentScopeDeclRefBits.advance(ASTStmtReader::NumExprBits);
4127 bool HasTemplateKWAndArgsInfo = DependentScopeDeclRefBits.getNextBit();
4128 unsigned NumTemplateArgs =
4129 HasTemplateKWAndArgsInfo
4130 ? DependentScopeDeclRefBits.getNextBits(/*Width=*/16)
4131 : 0;
4133 Context, HasTemplateKWAndArgsInfo, NumTemplateArgs);
4134 break;
4135 }
4136
4140 break;
4141
4143 auto NumResults = Record[ASTStmtReader::NumExprFields];
4144 BitsUnpacker OverloadExprBits(Record[ASTStmtReader::NumExprFields + 1]);
4145 auto HasTemplateKWAndArgsInfo = OverloadExprBits.getNextBit();
4146 auto NumTemplateArgs = HasTemplateKWAndArgsInfo
4148 : 0;
4150 Context, NumResults, HasTemplateKWAndArgsInfo, NumTemplateArgs);
4151 break;
4152 }
4153
4155 auto NumResults = Record[ASTStmtReader::NumExprFields];
4156 BitsUnpacker OverloadExprBits(Record[ASTStmtReader::NumExprFields + 1]);
4157 auto HasTemplateKWAndArgsInfo = OverloadExprBits.getNextBit();
4158 auto NumTemplateArgs = HasTemplateKWAndArgsInfo
4160 : 0;
4162 Context, NumResults, HasTemplateKWAndArgsInfo, NumTemplateArgs);
4163 break;
4164 }
4165
4166 case EXPR_TYPE_TRAIT:
4169 break;
4170
4172 S = new (Context) ArrayTypeTraitExpr(Empty);
4173 break;
4174
4176 S = new (Context) ExpressionTraitExpr(Empty);
4177 break;
4178
4179 case EXPR_CXX_NOEXCEPT:
4180 S = new (Context) CXXNoexceptExpr(Empty);
4181 break;
4182
4184 S = new (Context) PackExpansionExpr(Empty);
4185 break;
4186
4187 case EXPR_SIZEOF_PACK:
4189 Context,
4190 /*NumPartialArgs=*/Record[ASTStmtReader::NumExprFields]);
4191 break;
4192
4193 case EXPR_PACK_INDEXING:
4195 Context,
4196 /*TransformedExprs=*/Record[ASTStmtReader::NumExprFields]);
4197 break;
4198
4200 S = new (Context) SubstNonTypeTemplateParmExpr(Empty);
4201 break;
4202
4204 S = new (Context) SubstNonTypeTemplateParmPackExpr(Empty);
4205 break;
4206
4210 break;
4211
4213 S = new (Context) MaterializeTemporaryExpr(Empty);
4214 break;
4215
4216 case EXPR_CXX_FOLD:
4217 S = new (Context) CXXFoldExpr(Empty);
4218 break;
4219
4222 Context, /*numExprs=*/Record[ASTStmtReader::NumExprFields], Empty);
4223 break;
4224
4225 case EXPR_OPAQUE_VALUE:
4226 S = new (Context) OpaqueValueExpr(Empty);
4227 break;
4228
4229 case EXPR_CUDA_KERNEL_CALL: {
4230 auto NumArgs = Record[ASTStmtReader::NumExprFields];
4232 CallExprBits.advance(1);
4233 auto HasFPFeatures = CallExprBits.getNextBit();
4234 S = CUDAKernelCallExpr::CreateEmpty(Context, NumArgs, HasFPFeatures,
4235 Empty);
4236 break;
4237 }
4238
4239 case EXPR_ASTYPE:
4240 S = new (Context) AsTypeExpr(Empty);
4241 break;
4242
4243 case EXPR_PSEUDO_OBJECT: {
4244 unsigned numSemanticExprs = Record[ASTStmtReader::NumExprFields];
4245 S = PseudoObjectExpr::Create(Context, Empty, numSemanticExprs);
4246 break;
4247 }
4248
4249 case EXPR_ATOMIC:
4250 S = new (Context) AtomicExpr(Empty);
4251 break;
4252
4253 case EXPR_LAMBDA: {
4254 unsigned NumCaptures = Record[ASTStmtReader::NumExprFields];
4255 S = LambdaExpr::CreateDeserialized(Context, NumCaptures);
4256 break;
4257 }
4258
4259 case STMT_COROUTINE_BODY: {
4260 unsigned NumParams = Record[ASTStmtReader::NumStmtFields];
4261 S = CoroutineBodyStmt::Create(Context, Empty, NumParams);
4262 break;
4263 }
4264
4265 case STMT_CORETURN:
4266 S = new (Context) CoreturnStmt(Empty);
4267 break;
4268
4269 case EXPR_COAWAIT:
4270 S = new (Context) CoawaitExpr(Empty);
4271 break;
4272
4273 case EXPR_COYIELD:
4274 S = new (Context) CoyieldExpr(Empty);
4275 break;
4276
4278 S = new (Context) DependentCoawaitExpr(Empty);
4279 break;
4280
4282 S = new (Context) ConceptSpecializationExpr(Empty);
4283 break;
4284 }
4286 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
4287 S = OpenACCComputeConstruct::CreateEmpty(Context, NumClauses);
4288 break;
4289 }
4291 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
4292 S = OpenACCLoopConstruct::CreateEmpty(Context, NumClauses);
4293 break;
4294 }
4295 case EXPR_REQUIRES:
4296 unsigned numLocalParameters = Record[ASTStmtReader::NumExprFields];
4297 unsigned numRequirement = Record[ASTStmtReader::NumExprFields + 1];
4298 S = RequiresExpr::Create(Context, Empty, numLocalParameters,
4299 numRequirement);
4300 break;
4301 }
4302
4303 // We hit a STMT_STOP, so we're done with this expression.
4304 if (Finished)
4305 break;
4306
4307 ++NumStatementsRead;
4308
4309 if (S && !IsStmtReference) {
4310 Reader.Visit(S);
4311 StmtEntries[Cursor.GetCurrentBitNo()] = S;
4312 }
4313
4314 assert(Record.getIdx() == Record.size() &&
4315 "Invalid deserialization of statement");
4316 StmtStack.push_back(S);
4317 }
4318Done:
4319 assert(StmtStack.size() > PrevNumStmts && "Read too many sub-stmts!");
4320 assert(StmtStack.size() == PrevNumStmts + 1 && "Extra expressions on stack!");
4321 return StmtStack.pop_back_val();
4322}
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:758
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:187
ASTContext & getContext()
Retrieve the AST context that this AST reader supplements.
Definition: ASTReader.h:2403
Stmt * ReadSubStmt()
Reads a sub-statement operand during statement reading.
Definition: ASTReader.h:2358
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:4372
Represents the index of the current element of an array being initialized by an ArrayInitLoopExpr.
Definition: Expr.h:5756
Represents a loop initializing the elements of an array.
Definition: Expr.h:5703
This class represents BOTH the OpenMP Array Section and OpenACC 'subarray', with a boolean differenti...
Definition: Expr.h:6926
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
Definition: Expr.h:2674
An Embarcadero array type trait, as used in the implementation of __array_rank and __array_extent.
Definition: ExprCXX.h:2853
AsTypeExpr - Clang builtin function __builtin_astype [OpenCL 6.2.4.2] This AST node provides support ...
Definition: Expr.h:6426
AsmStmt is the base class for GCCAsmStmt and MSAsmStmt.
Definition: Stmt.h:3110
AtomicExpr - Variadic atomic builtins: __atomic_exchange, __atomic_fetch_*, __atomic_load,...
Definition: Expr.h:6629
unsigned getNumSubExprs() const
Definition: Expr.h:6704
Represents an attribute applied to a statement.
Definition: Stmt.h:2090
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:4275
A builtin binary operation expression such as "x + y" or "x <= y".
Definition: Expr.h:3860
static BinaryOperator * CreateEmpty(const ASTContext &C, bool hasFPFeatures)
Definition: Expr.cpp:4851
A simple helper class to unpack an integer to bits and consuming the bits in order.
Definition: ASTReader.h:2465
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
Definition: Expr.h:6365
BreakStmt - This represents a break.
Definition: Stmt.h:2990
Represents a C++2a __builtin_bit_cast(T, v) expression.
Definition: ExprCXX.h:5292
CStyleCastExpr - An explicit cast in C (C99 6.5.4) or a C-style cast in C++ (C++ [expr....
Definition: Expr.h:3791
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:1921
A C++ addrspace_cast expression (currently only enabled for OpenCL).
Definition: ExprCXX.h:601
static CXXAddrspaceCastExpr * CreateEmpty(const ASTContext &Context)
Definition: ExprCXX.cpp:898
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:885
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:1175
A default argument (C++ [dcl.fct.default]).
Definition: ExprCXX.h:1268
static CXXDefaultArgExpr * CreateEmpty(const ASTContext &C, bool HasRewrittenInit)
Definition: ExprCXX.cpp:1012
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:1066
Represents a delete expression for memory deallocation and destructor calls, e.g.
Definition: ExprCXX.h:2498
Represents a C++ member access expression where the actual member referenced could not be resolved be...
Definition: ExprCXX.h:3683
static CXXDependentScopeMemberExpr * CreateEmpty(const ASTContext &Ctx, bool HasTemplateKWAndArgsInfo, unsigned NumTemplateArgs, bool HasFirstQualifierFoundInScope)
Definition: ExprCXX.cpp:1555
A C++ dynamic_cast expression (C++ [expr.dynamic.cast]).
Definition: ExprCXX.h:478
static CXXDynamicCastExpr * CreateEmpty(const ASTContext &Context, unsigned pathSize)
Definition: ExprCXX.cpp:807
Represents a folding of a pack over an operator.
Definition: ExprCXX.h:4840
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:918
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:692
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:2241
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:4126
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:627
Represents a list-initialization with parenthesis.
Definition: ExprCXX.h:4954
static CXXParenListInitExpr * CreateEmpty(ASTContext &C, unsigned numExprs, EmptyShell Empty)
Definition: ExprCXX.cpp:1943
Represents a C++ pseudo-destructor (C++ [expr.pseudo]).
Definition: ExprCXX.h:2617
A C++ reinterpret_cast expression (C++ [expr.reinterpret.cast]).
Definition: ExprCXX.h:523
static CXXReinterpretCastExpr * CreateEmpty(const ASTContext &Context, unsigned pathSize)
Definition: ExprCXX.cpp:871
A rewritten comparison expression that was originally written using operator syntax.
Definition: ExprCXX.h:283
An expression "T()" which creates an rvalue of a non-class type T.
Definition: ExprCXX.h:2182
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:779
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:1141
Represents the this expression in C++.
Definition: ExprCXX.h:1152
static CXXThisExpr * CreateEmpty(const ASTContext &Ctx)
Definition: ExprCXX.cpp:1575
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:3557
static CXXUnresolvedConstructExpr * CreateEmpty(const ASTContext &Context, unsigned NumArgs)
Definition: ExprCXX.cpp:1482
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:2830
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:3767
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:3771
CaseStmt - Represent a case statement.
Definition: Stmt.h:1811
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:3498
ChooseExpr - GNU builtin-in function __builtin_choose_expr.
Definition: Expr.h:4592
Represents a 'co_await' expression.
Definition: ExprCXX.h:5185
CompoundAssignOperator - For compound assignments (e.g.
Definition: Expr.h:4122
static CompoundAssignOperator * CreateEmpty(const ASTContext &C, bool hasFPFeatures)
Definition: Expr.cpp:4873
CompoundLiteralExpr - [C99 6.5.2.5].
Definition: Expr.h:3428
CompoundStmt - This represents a group of statements like { stmt stmt }.
Definition: Stmt.h:1611
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:4213
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
std::pair< SourceLocation, StringRef > SubstitutionDiagnostic
Definition: ASTConcept.h:49
llvm::SmallVector< Detail, 4 > Details
The substituted constraint expr, if the template arguments could be substituted into them,...
Definition: ASTConcept.h:58
ContinueStmt - This represents a continue.
Definition: Stmt.h:2960
ConvertVectorExpr - Clang builtin function __builtin_convertvector This AST node provides support for...
Definition: Expr.h:4533
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:5266
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:1502
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:5217
A qualified reference to a name whose declaration cannot yet be resolved.
Definition: ExprCXX.h:3323
static DependentScopeDeclRefExpr * CreateEmpty(const ASTContext &Context, bool HasTemplateKWAndArgsInfo, unsigned NumTemplateArgs)
Definition: ExprCXX.cpp:547
Represents a single C99 designator.
Definition: Expr.h:5327
Represents a C99 designated initializer expression.
Definition: Expr.h:5284
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:2735
Represents a reference to #emded data.
Definition: Expr.h:4867
ExplicitCastExpr - An explicit cast written in the source code.
Definition: Expr.h:3750
Represents an expression – generally a full-expression – that introduces cleanups to be run at the en...
Definition: ExprCXX.h:3474
llvm::PointerUnion< BlockDecl *, CompoundLiteralExpr * > CleanupObject
The type of objects that are kept in the cleanup.
Definition: ExprCXX.h:3480
static ExprWithCleanups * Create(const ASTContext &C, EmptyShell empty, unsigned numObjects)
Definition: ExprCXX.cpp:1447
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:2924
ExtVectorElementExpr - This represents access to specific elements of a vector, and may occur on the ...
Definition: Expr.h:6305
static FPOptionsOverride getFromOpaqueInt(storage_type I)
Definition: LangOptions.h:1010
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:2791
Represents a reference to a function parameter pack or init-capture pack that has been substituted bu...
Definition: ExprCXX.h:4648
static FunctionParmPackExpr * CreateEmpty(const ASTContext &Context, unsigned NumParams)
Definition: ExprCXX.cpp:1805
This represents a GCC inline-assembly statement extension.
Definition: Stmt.h:3269
GNUNullExpr - Implements the GNU __null extension, which is a name for a null pointer constant that h...
Definition: Expr.h:4667
Represents a C11 generic selection.
Definition: Expr.h:5917
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:2872
One of these records is kept for each identifier that is lexed.
IfStmt - This represents an if/then/else.
Definition: Stmt.h:2148
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:3675
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:5792
IndirectGotoStmt - This represents an indirect goto.
Definition: Stmt.h:2911
Describes an C or C++ initializer list.
Definition: Expr.h:5039
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:2041
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:1314
This represents a Microsoft inline-assembly statement extension.
Definition: Stmt.h:3492
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:4728
MatrixSubscriptExpr - Matrix subscript expression for the MatrixType extension.
Definition: Expr.h:2752
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
Definition: Expr.h:3187
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:5612
NullStmt - This is the null statement ";": C99 6.8.3p3.
Definition: Stmt.h:1574
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:5236
static OMPAssumeDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Definition: StmtOpenMP.cpp:812
This represents '#pragma omp atomic' directive.
Definition: StmtOpenMP.h:2947
static OMPAtomicDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
Definition: StmtOpenMP.cpp:988
This represents '#pragma omp barrier' directive.
Definition: StmtOpenMP.h:2625
static OMPBarrierDirective * CreateEmpty(const ASTContext &C, EmptyShell)
Creates an empty directive.
Definition: StmtOpenMP.cpp:840
This represents '#pragma omp cancel' directive.
Definition: StmtOpenMP.h:3655
static OMPCancelDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive.
Definition: StmtOpenMP.cpp:900
This represents '#pragma omp cancellation point' directive.
Definition: StmtOpenMP.h:3597
static OMPCancellationPointDirective * CreateEmpty(const ASTContext &C, EmptyShell)
Creates an empty directive.
Definition: StmtOpenMP.cpp:885
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:2076
static OMPCriticalDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive.
Definition: StmtOpenMP.cpp:628
This represents '#pragma omp depobj' directive.
Definition: StmtOpenMP.h:2841
static OMPDepobjDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
Definition: StmtOpenMP.cpp:930
This represents '#pragma omp dispatch' directive.
Definition: StmtOpenMP.h:5948
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:4425
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:4547
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:4643
static OMPDistributeParallelForSimdDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.