clang 19.0.0git
ASTReaderStmt.cpp
Go to the documentation of this file.
1//===- ASTReaderStmt.cpp - Stmt/Expr Deserialization ----------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// Statement/expression deserialization. This implements the
10// ASTReader::ReadStmt method.
11//
12//===----------------------------------------------------------------------===//
13
17#include "clang/AST/Decl.h"
19#include "clang/AST/DeclCXX.h"
20#include "clang/AST/DeclGroup.h"
21#include "clang/AST/DeclObjC.h"
25#include "clang/AST/Expr.h"
26#include "clang/AST/ExprCXX.h"
27#include "clang/AST/ExprObjC.h"
32#include "clang/AST/Stmt.h"
33#include "clang/AST/StmtCXX.h"
34#include "clang/AST/StmtObjC.h"
38#include "clang/AST/Type.h"
42#include "clang/Basic/LLVM.h"
43#include "clang/Basic/Lambda.h"
50#include "clang/Lex/Token.h"
53#include "llvm/ADT/BitmaskEnum.h"
54#include "llvm/ADT/DenseMap.h"
55#include "llvm/ADT/SmallString.h"
56#include "llvm/ADT/SmallVector.h"
57#include "llvm/ADT/StringRef.h"
58#include "llvm/Bitstream/BitstreamReader.h"
59#include "llvm/Support/Casting.h"
60#include "llvm/Support/ErrorHandling.h"
61#include <algorithm>
62#include <cassert>
63#include <cstdint>
64#include <optional>
65#include <string>
66
67using namespace clang;
68using namespace serialization;
69
70namespace clang {
71
72 class ASTStmtReader : public StmtVisitor<ASTStmtReader> {
73 ASTRecordReader &Record;
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;
616 NumTemplateArgs = Record.readInt();
617
618 if (E->hasQualifier())
619 new (E->getTrailingObjects<NestedNameSpecifierLoc>())
621
622 if (E->hasFoundDecl())
623 *E->getTrailingObjects<NamedDecl *>() = readDeclAs<NamedDecl>();
624
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);
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)
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();
766 break;
767 }
768 }
769 }
770
771 for (unsigned I = 0, N = E->getNumExpressions(); I != N; ++I)
772 E->setIndexExpr(I, Record.readSubExpr());
773}
774
775void ASTStmtReader::VisitUnaryExprOrTypeTraitExpr(UnaryExprOrTypeTraitExpr *E) {
776 VisitExpr(E);
777 E->setKind(static_cast<UnaryExprOrTypeTrait>(Record.readInt()));
778 if (Record.peekInt() == 0) {
779 E->setArgument(Record.readSubExpr());
780 Record.skipInts(1);
781 } else {
782 E->setArgument(readTypeSourceInfo());
783 }
784 E->setOperatorLoc(readSourceLocation());
785 E->setRParenLoc(readSourceLocation());
786}
787
790 ConstraintSatisfaction Satisfaction;
791 Satisfaction.IsSatisfied = Record.readInt();
792 Satisfaction.ContainsErrors = Record.readInt();
793 if (!Satisfaction.IsSatisfied) {
794 unsigned NumDetailRecords = Record.readInt();
795 for (unsigned i = 0; i != NumDetailRecords; ++i) {
796 Expr *ConstraintExpr = Record.readExpr();
797 if (/* IsDiagnostic */Record.readInt()) {
798 SourceLocation DiagLocation = Record.readSourceLocation();
799 std::string DiagMessage = Record.readString();
800 Satisfaction.Details.emplace_back(
801 ConstraintExpr, new (Record.getContext())
803 DiagLocation, DiagMessage});
804 } else
805 Satisfaction.Details.emplace_back(ConstraintExpr, Record.readExpr());
806 }
807 }
808 return Satisfaction;
809}
810
811void ASTStmtReader::VisitConceptSpecializationExpr(
813 VisitExpr(E);
814 E->SpecDecl = Record.readDeclAs<ImplicitConceptSpecializationDecl>();
815 if (Record.readBool())
816 E->ConceptRef = Record.readConceptReference();
817 E->Satisfaction = E->isValueDependent() ? nullptr :
820}
821
824 std::string SubstitutedEntity = Record.readString();
825 SourceLocation DiagLoc = Record.readSourceLocation();
826 std::string DiagMessage = Record.readString();
827 return new (Record.getContext())
828 concepts::Requirement::SubstitutionDiagnostic{SubstitutedEntity, DiagLoc,
829 DiagMessage};
830}
831
832void ASTStmtReader::VisitRequiresExpr(RequiresExpr *E) {
833 VisitExpr(E);
834 unsigned NumLocalParameters = Record.readInt();
835 unsigned NumRequirements = Record.readInt();
836 E->RequiresExprBits.RequiresKWLoc = Record.readSourceLocation();
837 E->RequiresExprBits.IsSatisfied = Record.readInt();
838 E->Body = Record.readDeclAs<RequiresExprBodyDecl>();
840 for (unsigned i = 0; i < NumLocalParameters; ++i)
841 LocalParameters.push_back(cast<ParmVarDecl>(Record.readDecl()));
842 std::copy(LocalParameters.begin(), LocalParameters.end(),
843 E->getTrailingObjects<ParmVarDecl *>());
845 for (unsigned i = 0; i < NumRequirements; ++i) {
846 auto RK =
847 static_cast<concepts::Requirement::RequirementKind>(Record.readInt());
848 concepts::Requirement *R = nullptr;
849 switch (RK) {
851 auto Status =
853 Record.readInt());
855 R = new (Record.getContext())
857 else
858 R = new (Record.getContext())
860 } break;
863 auto Status =
865 Record.readInt());
867 Expr *> E;
869 E = readSubstitutionDiagnostic(Record);
870 } else
871 E = Record.readExpr();
872
873 std::optional<concepts::ExprRequirement::ReturnTypeRequirement> Req;
874 ConceptSpecializationExpr *SubstitutedConstraintExpr = nullptr;
875 SourceLocation NoexceptLoc;
877 Req.emplace();
878 } else {
879 NoexceptLoc = Record.readSourceLocation();
880 switch (/* returnTypeRequirementKind */Record.readInt()) {
881 case 0:
882 // No return type requirement.
883 Req.emplace();
884 break;
885 case 1: {
886 // type-constraint
888 if (Status >=
890 SubstitutedConstraintExpr =
891 cast<ConceptSpecializationExpr>(Record.readExpr());
892 Req.emplace(TPL);
893 } break;
894 case 2:
895 // Substitution failure
896 Req.emplace(readSubstitutionDiagnostic(Record));
897 break;
898 }
899 }
900 if (Expr *Ex = E.dyn_cast<Expr *>())
901 R = new (Record.getContext()) concepts::ExprRequirement(
902 Ex, RK == concepts::Requirement::RK_Simple, NoexceptLoc,
903 std::move(*Req), Status, SubstitutedConstraintExpr);
904 else
905 R = new (Record.getContext()) concepts::ExprRequirement(
907 RK == concepts::Requirement::RK_Simple, NoexceptLoc,
908 std::move(*Req));
909 } break;
911 bool HasInvalidConstraint = Record.readInt();
912 if (HasInvalidConstraint) {
913 std::string InvalidConstraint = Record.readString();
914 char *InvalidConstraintBuf =
915 new (Record.getContext()) char[InvalidConstraint.size()];
916 std::copy(InvalidConstraint.begin(), InvalidConstraint.end(),
917 InvalidConstraintBuf);
918 R = new (Record.getContext()) concepts::NestedRequirement(
919 Record.getContext(),
920 StringRef(InvalidConstraintBuf, InvalidConstraint.size()),
922 break;
923 }
924 Expr *E = Record.readExpr();
926 R = new (Record.getContext()) concepts::NestedRequirement(E);
927 else
928 R = new (Record.getContext())
931 } break;
932 }
933 if (!R)
934 continue;
935 Requirements.push_back(R);
936 }
937 std::copy(Requirements.begin(), Requirements.end(),
938 E->getTrailingObjects<concepts::Requirement *>());
939 E->LParenLoc = Record.readSourceLocation();
940 E->RParenLoc = Record.readSourceLocation();
941 E->RBraceLoc = Record.readSourceLocation();
942}
943
944void ASTStmtReader::VisitArraySubscriptExpr(ArraySubscriptExpr *E) {
945 VisitExpr(E);
946 E->setLHS(Record.readSubExpr());
947 E->setRHS(Record.readSubExpr());
948 E->setRBracketLoc(readSourceLocation());
949}
950
951void ASTStmtReader::VisitMatrixSubscriptExpr(MatrixSubscriptExpr *E) {
952 VisitExpr(E);
953 E->setBase(Record.readSubExpr());
954 E->setRowIdx(Record.readSubExpr());
955 E->setColumnIdx(Record.readSubExpr());
956 E->setRBracketLoc(readSourceLocation());
957}
958
959void ASTStmtReader::VisitOMPArraySectionExpr(OMPArraySectionExpr *E) {
960 VisitExpr(E);
961 E->setBase(Record.readSubExpr());
962 E->setLowerBound(Record.readSubExpr());
963 E->setLength(Record.readSubExpr());
964 E->setStride(Record.readSubExpr());
965 E->setColonLocFirst(readSourceLocation());
966 E->setColonLocSecond(readSourceLocation());
967 E->setRBracketLoc(readSourceLocation());
968}
969
970void ASTStmtReader::VisitOMPArrayShapingExpr(OMPArrayShapingExpr *E) {
971 VisitExpr(E);
972 unsigned NumDims = Record.readInt();
973 E->setBase(Record.readSubExpr());
974 SmallVector<Expr *, 4> Dims(NumDims);
975 for (unsigned I = 0; I < NumDims; ++I)
976 Dims[I] = Record.readSubExpr();
977 E->setDimensions(Dims);
978 SmallVector<SourceRange, 4> SRs(NumDims);
979 for (unsigned I = 0; I < NumDims; ++I)
980 SRs[I] = readSourceRange();
981 E->setBracketsRanges(SRs);
982 E->setLParenLoc(readSourceLocation());
983 E->setRParenLoc(readSourceLocation());
984}
985
986void ASTStmtReader::VisitOMPIteratorExpr(OMPIteratorExpr *E) {
987 VisitExpr(E);
988 unsigned NumIters = Record.readInt();
989 E->setIteratorKwLoc(readSourceLocation());
990 E->setLParenLoc(readSourceLocation());
991 E->setRParenLoc(readSourceLocation());
992 for (unsigned I = 0; I < NumIters; ++I) {
993 E->setIteratorDeclaration(I, Record.readDeclRef());
994 E->setAssignmentLoc(I, readSourceLocation());
995 Expr *Begin = Record.readSubExpr();
996 Expr *End = Record.readSubExpr();
997 Expr *Step = Record.readSubExpr();
998 SourceLocation ColonLoc = readSourceLocation();
999 SourceLocation SecColonLoc;
1000 if (Step)
1001 SecColonLoc = readSourceLocation();
1002 E->setIteratorRange(I, Begin, ColonLoc, End, SecColonLoc, Step);
1003 // Deserialize helpers
1005 HD.CounterVD = cast_or_null<VarDecl>(Record.readDeclRef());
1006 HD.Upper = Record.readSubExpr();
1007 HD.Update = Record.readSubExpr();
1008 HD.CounterUpdate = Record.readSubExpr();
1009 E->setHelper(I, HD);
1010 }
1011}
1012
1013void ASTStmtReader::VisitCallExpr(CallExpr *E) {
1014 VisitExpr(E);
1015
1016 unsigned NumArgs = Record.readInt();
1017 CurrentUnpackingBits.emplace(Record.readInt());
1018 E->setADLCallKind(
1019 static_cast<CallExpr::ADLCallKind>(CurrentUnpackingBits->getNextBit()));
1020 bool HasFPFeatures = CurrentUnpackingBits->getNextBit();
1021 assert((NumArgs == E->getNumArgs()) && "Wrong NumArgs!");
1022 E->setRParenLoc(readSourceLocation());
1023 E->setCallee(Record.readSubExpr());
1024 for (unsigned I = 0; I != NumArgs; ++I)
1025 E->setArg(I, Record.readSubExpr());
1026
1027 if (HasFPFeatures)
1030}
1031
1032void ASTStmtReader::VisitCXXMemberCallExpr(CXXMemberCallExpr *E) {
1033 VisitCallExpr(E);
1034}
1035
1036void ASTStmtReader::VisitMemberExpr(MemberExpr *E) {
1037 VisitExpr(E);
1038
1039 CurrentUnpackingBits.emplace(Record.readInt());
1040 bool HasQualifier = CurrentUnpackingBits->getNextBit();
1041 bool HasFoundDecl = CurrentUnpackingBits->getNextBit();
1042 bool HasTemplateInfo = CurrentUnpackingBits->getNextBit();
1043 unsigned NumTemplateArgs = Record.readInt();
1044
1045 E->Base = Record.readSubExpr();
1046 E->MemberDecl = Record.readDeclAs<ValueDecl>();
1047 E->MemberDNLoc = Record.readDeclarationNameLoc(E->MemberDecl->getDeclName());
1048 E->MemberLoc = Record.readSourceLocation();
1049 E->MemberExprBits.IsArrow = CurrentUnpackingBits->getNextBit();
1050 E->MemberExprBits.HasQualifierOrFoundDecl = HasQualifier || HasFoundDecl;
1051 E->MemberExprBits.HasTemplateKWAndArgsInfo = HasTemplateInfo;
1052 E->MemberExprBits.HadMultipleCandidates = CurrentUnpackingBits->getNextBit();
1053 E->MemberExprBits.NonOdrUseReason =
1054 CurrentUnpackingBits->getNextBits(/*Width=*/2);
1055 E->MemberExprBits.OperatorLoc = Record.readSourceLocation();
1056
1057 if (HasQualifier || HasFoundDecl) {
1058 DeclAccessPair FoundDecl;
1059 if (HasFoundDecl) {
1060 auto *FoundD = Record.readDeclAs<NamedDecl>();
1061 auto AS = (AccessSpecifier)CurrentUnpackingBits->getNextBits(/*Width=*/2);
1062 FoundDecl = DeclAccessPair::make(FoundD, AS);
1063 } else {
1064 FoundDecl = DeclAccessPair::make(E->MemberDecl,
1065 E->MemberDecl->getAccess());
1066 }
1067 E->getTrailingObjects<MemberExprNameQualifier>()->FoundDecl = FoundDecl;
1068
1069 NestedNameSpecifierLoc QualifierLoc;
1070 if (HasQualifier)
1071 QualifierLoc = Record.readNestedNameSpecifierLoc();
1072 E->getTrailingObjects<MemberExprNameQualifier>()->QualifierLoc =
1073 QualifierLoc;
1074 }
1075
1076 if (HasTemplateInfo)
1078 *E->getTrailingObjects<ASTTemplateKWAndArgsInfo>(),
1079 E->getTrailingObjects<TemplateArgumentLoc>(), NumTemplateArgs);
1080}
1081
1082void ASTStmtReader::VisitObjCIsaExpr(ObjCIsaExpr *E) {
1083 VisitExpr(E);
1084 E->setBase(Record.readSubExpr());
1085 E->setIsaMemberLoc(readSourceLocation());
1086 E->setOpLoc(readSourceLocation());
1087 E->setArrow(Record.readInt());
1088}
1089
1090void ASTStmtReader::
1091VisitObjCIndirectCopyRestoreExpr(ObjCIndirectCopyRestoreExpr *E) {
1092 VisitExpr(E);
1093 E->Operand = Record.readSubExpr();
1094 E->setShouldCopy(Record.readInt());
1095}
1096
1097void ASTStmtReader::VisitObjCBridgedCastExpr(ObjCBridgedCastExpr *E) {
1098 VisitExplicitCastExpr(E);
1099 E->LParenLoc = readSourceLocation();
1100 E->BridgeKeywordLoc = readSourceLocation();
1101 E->Kind = Record.readInt();
1102}
1103
1104void ASTStmtReader::VisitCastExpr(CastExpr *E) {
1105 VisitExpr(E);
1106 unsigned NumBaseSpecs = Record.readInt();
1107 assert(NumBaseSpecs == E->path_size());
1108
1109 CurrentUnpackingBits.emplace(Record.readInt());
1110 E->setCastKind((CastKind)CurrentUnpackingBits->getNextBits(/*Width=*/7));
1111 unsigned HasFPFeatures = CurrentUnpackingBits->getNextBit();
1112 assert(E->hasStoredFPFeatures() == HasFPFeatures);
1113
1114 E->setSubExpr(Record.readSubExpr());
1115
1117 while (NumBaseSpecs--) {
1118 auto *BaseSpec = new (Record.getContext()) CXXBaseSpecifier;
1119 *BaseSpec = Record.readCXXBaseSpecifier();
1120 *BaseI++ = BaseSpec;
1121 }
1122 if (HasFPFeatures)
1123 *E->getTrailingFPFeatures() =
1125}
1126
1127void ASTStmtReader::VisitBinaryOperator(BinaryOperator *E) {
1128 VisitExpr(E);
1129 CurrentUnpackingBits.emplace(Record.readInt());
1130 E->setOpcode(
1131 (BinaryOperator::Opcode)CurrentUnpackingBits->getNextBits(/*Width=*/6));
1132 bool hasFP_Features = CurrentUnpackingBits->getNextBit();
1133 E->setHasStoredFPFeatures(hasFP_Features);
1134 E->setLHS(Record.readSubExpr());
1135 E->setRHS(Record.readSubExpr());
1136 E->setOperatorLoc(readSourceLocation());
1137 if (hasFP_Features)
1140}
1141
1142void ASTStmtReader::VisitCompoundAssignOperator(CompoundAssignOperator *E) {
1143 VisitBinaryOperator(E);
1144 E->setComputationLHSType(Record.readType());
1146}
1147
1148void ASTStmtReader::VisitConditionalOperator(ConditionalOperator *E) {
1149 VisitExpr(E);
1150 E->SubExprs[ConditionalOperator::COND] = Record.readSubExpr();
1151 E->SubExprs[ConditionalOperator::LHS] = Record.readSubExpr();
1152 E->SubExprs[ConditionalOperator::RHS] = Record.readSubExpr();
1153 E->QuestionLoc = readSourceLocation();
1154 E->ColonLoc = readSourceLocation();
1155}
1156
1157void
1158ASTStmtReader::VisitBinaryConditionalOperator(BinaryConditionalOperator *E) {
1159 VisitExpr(E);
1160 E->OpaqueValue = cast<OpaqueValueExpr>(Record.readSubExpr());
1161 E->SubExprs[BinaryConditionalOperator::COMMON] = Record.readSubExpr();
1162 E->SubExprs[BinaryConditionalOperator::COND] = Record.readSubExpr();
1163 E->SubExprs[BinaryConditionalOperator::LHS] = Record.readSubExpr();
1164 E->SubExprs[BinaryConditionalOperator::RHS] = Record.readSubExpr();
1165 E->QuestionLoc = readSourceLocation();
1166 E->ColonLoc = readSourceLocation();
1167}
1168
1169void ASTStmtReader::VisitImplicitCastExpr(ImplicitCastExpr *E) {
1170 VisitCastExpr(E);
1171 E->setIsPartOfExplicitCast(CurrentUnpackingBits->getNextBit());
1172}
1173
1174void ASTStmtReader::VisitExplicitCastExpr(ExplicitCastExpr *E) {
1175 VisitCastExpr(E);
1176 E->setTypeInfoAsWritten(readTypeSourceInfo());
1177}
1178
1179void ASTStmtReader::VisitCStyleCastExpr(CStyleCastExpr *E) {
1180 VisitExplicitCastExpr(E);
1181 E->setLParenLoc(readSourceLocation());
1182 E->setRParenLoc(readSourceLocation());
1183}
1184
1185void ASTStmtReader::VisitCompoundLiteralExpr(CompoundLiteralExpr *E) {
1186 VisitExpr(E);
1187 E->setLParenLoc(readSourceLocation());
1188 E->setTypeSourceInfo(readTypeSourceInfo());
1189 E->setInitializer(Record.readSubExpr());
1190 E->setFileScope(Record.readInt());
1191}
1192
1193void ASTStmtReader::VisitExtVectorElementExpr(ExtVectorElementExpr *E) {
1194 VisitExpr(E);
1195 E->setBase(Record.readSubExpr());
1196 E->setAccessor(Record.readIdentifier());
1197 E->setAccessorLoc(readSourceLocation());
1198}
1199
1200void ASTStmtReader::VisitInitListExpr(InitListExpr *E) {
1201 VisitExpr(E);
1202 if (auto *SyntForm = cast_or_null<InitListExpr>(Record.readSubStmt()))
1203 E->setSyntacticForm(SyntForm);
1204 E->setLBraceLoc(readSourceLocation());
1205 E->setRBraceLoc(readSourceLocation());
1206 bool isArrayFiller = Record.readInt();
1207 Expr *filler = nullptr;
1208 if (isArrayFiller) {
1209 filler = Record.readSubExpr();
1210 E->ArrayFillerOrUnionFieldInit = filler;
1211 } else
1212 E->ArrayFillerOrUnionFieldInit = readDeclAs<FieldDecl>();
1213 E->sawArrayRangeDesignator(Record.readInt());
1214 unsigned NumInits = Record.readInt();
1215 E->reserveInits(Record.getContext(), NumInits);
1216 if (isArrayFiller) {
1217 for (unsigned I = 0; I != NumInits; ++I) {
1218 Expr *init = Record.readSubExpr();
1219 E->updateInit(Record.getContext(), I, init ? init : filler);
1220 }
1221 } else {
1222 for (unsigned I = 0; I != NumInits; ++I)
1223 E->updateInit(Record.getContext(), I, Record.readSubExpr());
1224 }
1225}
1226
1227void ASTStmtReader::VisitDesignatedInitExpr(DesignatedInitExpr *E) {
1229
1230 VisitExpr(E);
1231 unsigned NumSubExprs = Record.readInt();
1232 assert(NumSubExprs == E->getNumSubExprs() && "Wrong number of subexprs");
1233 for (unsigned I = 0; I != NumSubExprs; ++I)
1234 E->setSubExpr(I, Record.readSubExpr());
1235 E->setEqualOrColonLoc(readSourceLocation());
1236 E->setGNUSyntax(Record.readInt());
1237
1238 SmallVector<Designator, 4> Designators;
1239 while (Record.getIdx() < Record.size()) {
1240 switch ((DesignatorTypes)Record.readInt()) {
1241 case DESIG_FIELD_DECL: {
1242 auto *Field = readDeclAs<FieldDecl>();
1243 SourceLocation DotLoc = readSourceLocation();
1244 SourceLocation FieldLoc = readSourceLocation();
1245 Designators.push_back(Designator::CreateFieldDesignator(
1246 Field->getIdentifier(), DotLoc, FieldLoc));
1247 Designators.back().setFieldDecl(Field);
1248 break;
1249 }
1250
1251 case DESIG_FIELD_NAME: {
1252 const IdentifierInfo *Name = Record.readIdentifier();
1253 SourceLocation DotLoc = readSourceLocation();
1254 SourceLocation FieldLoc = readSourceLocation();
1255 Designators.push_back(Designator::CreateFieldDesignator(Name, DotLoc,
1256 FieldLoc));
1257 break;
1258 }
1259
1260 case DESIG_ARRAY: {
1261 unsigned Index = Record.readInt();
1262 SourceLocation LBracketLoc = readSourceLocation();
1263 SourceLocation RBracketLoc = readSourceLocation();
1264 Designators.push_back(Designator::CreateArrayDesignator(Index,
1265 LBracketLoc,
1266 RBracketLoc));
1267 break;
1268 }
1269
1270 case DESIG_ARRAY_RANGE: {
1271 unsigned Index = Record.readInt();
1272 SourceLocation LBracketLoc = readSourceLocation();
1273 SourceLocation EllipsisLoc = readSourceLocation();
1274 SourceLocation RBracketLoc = readSourceLocation();
1275 Designators.push_back(Designator::CreateArrayRangeDesignator(
1276 Index, LBracketLoc, EllipsisLoc, RBracketLoc));
1277 break;
1278 }
1279 }
1280 }
1281 E->setDesignators(Record.getContext(),
1282 Designators.data(), Designators.size());
1283}
1284
1285void ASTStmtReader::VisitDesignatedInitUpdateExpr(DesignatedInitUpdateExpr *E) {
1286 VisitExpr(E);
1287 E->setBase(Record.readSubExpr());
1288 E->setUpdater(Record.readSubExpr());
1289}
1290
1291void ASTStmtReader::VisitNoInitExpr(NoInitExpr *E) {
1292 VisitExpr(E);
1293}
1294
1295void ASTStmtReader::VisitArrayInitLoopExpr(ArrayInitLoopExpr *E) {
1296 VisitExpr(E);
1297 E->SubExprs[0] = Record.readSubExpr();
1298 E->SubExprs[1] = Record.readSubExpr();
1299}
1300
1301void ASTStmtReader::VisitArrayInitIndexExpr(ArrayInitIndexExpr *E) {
1302 VisitExpr(E);
1303}
1304
1305void ASTStmtReader::VisitImplicitValueInitExpr(ImplicitValueInitExpr *E) {
1306 VisitExpr(E);
1307}
1308
1309void ASTStmtReader::VisitVAArgExpr(VAArgExpr *E) {
1310 VisitExpr(E);
1311 E->setSubExpr(Record.readSubExpr());
1312 E->setWrittenTypeInfo(readTypeSourceInfo());
1313 E->setBuiltinLoc(readSourceLocation());
1314 E->setRParenLoc(readSourceLocation());
1315 E->setIsMicrosoftABI(Record.readInt());
1316}
1317
1318void ASTStmtReader::VisitSourceLocExpr(SourceLocExpr *E) {
1319 VisitExpr(E);
1320 E->ParentContext = readDeclAs<DeclContext>();
1321 E->BuiltinLoc = readSourceLocation();
1322 E->RParenLoc = readSourceLocation();
1323 E->SourceLocExprBits.Kind = Record.readInt();
1324}
1325
1326void ASTStmtReader::VisitAddrLabelExpr(AddrLabelExpr *E) {
1327 VisitExpr(E);
1328 E->setAmpAmpLoc(readSourceLocation());
1329 E->setLabelLoc(readSourceLocation());
1330 E->setLabel(readDeclAs<LabelDecl>());
1331}
1332
1333void ASTStmtReader::VisitStmtExpr(StmtExpr *E) {
1334 VisitExpr(E);
1335 E->setLParenLoc(readSourceLocation());
1336 E->setRParenLoc(readSourceLocation());
1337 E->setSubStmt(cast_or_null<CompoundStmt>(Record.readSubStmt()));
1338 E->StmtExprBits.TemplateDepth = Record.readInt();
1339}
1340
1341void ASTStmtReader::VisitChooseExpr(ChooseExpr *E) {
1342 VisitExpr(E);
1343 E->setCond(Record.readSubExpr());
1344 E->setLHS(Record.readSubExpr());
1345 E->setRHS(Record.readSubExpr());
1346 E->setBuiltinLoc(readSourceLocation());
1347 E->setRParenLoc(readSourceLocation());
1348 E->setIsConditionTrue(Record.readInt());
1349}
1350
1351void ASTStmtReader::VisitGNUNullExpr(GNUNullExpr *E) {
1352 VisitExpr(E);
1353 E->setTokenLocation(readSourceLocation());
1354}
1355
1356void ASTStmtReader::VisitShuffleVectorExpr(ShuffleVectorExpr *E) {
1357 VisitExpr(E);
1359 unsigned NumExprs = Record.readInt();
1360 while (NumExprs--)
1361 Exprs.push_back(Record.readSubExpr());
1362 E->setExprs(Record.getContext(), Exprs);
1363 E->setBuiltinLoc(readSourceLocation());
1364 E->setRParenLoc(readSourceLocation());
1365}
1366
1367void ASTStmtReader::VisitConvertVectorExpr(ConvertVectorExpr *E) {
1368 VisitExpr(E);
1369 E->BuiltinLoc = readSourceLocation();
1370 E->RParenLoc = readSourceLocation();
1371 E->TInfo = readTypeSourceInfo();
1372 E->SrcExpr = Record.readSubExpr();
1373}
1374
1375void ASTStmtReader::VisitBlockExpr(BlockExpr *E) {
1376 VisitExpr(E);
1377 E->setBlockDecl(readDeclAs<BlockDecl>());
1378}
1379
1380void ASTStmtReader::VisitGenericSelectionExpr(GenericSelectionExpr *E) {
1381 VisitExpr(E);
1382
1383 unsigned NumAssocs = Record.readInt();
1384 assert(NumAssocs == E->getNumAssocs() && "Wrong NumAssocs!");
1385 E->IsExprPredicate = Record.readInt();
1386 E->ResultIndex = Record.readInt();
1387 E->GenericSelectionExprBits.GenericLoc = readSourceLocation();
1388 E->DefaultLoc = readSourceLocation();
1389 E->RParenLoc = readSourceLocation();
1390
1391 Stmt **Stmts = E->getTrailingObjects<Stmt *>();
1392 // Add 1 to account for the controlling expression which is the first
1393 // expression in the trailing array of Stmt *. This is not needed for
1394 // the trailing array of TypeSourceInfo *.
1395 for (unsigned I = 0, N = NumAssocs + 1; I < N; ++I)
1396 Stmts[I] = Record.readSubExpr();
1397
1398 TypeSourceInfo **TSIs = E->getTrailingObjects<TypeSourceInfo *>();
1399 for (unsigned I = 0, N = NumAssocs; I < N; ++I)
1400 TSIs[I] = readTypeSourceInfo();
1401}
1402
1403void ASTStmtReader::VisitPseudoObjectExpr(PseudoObjectExpr *E) {
1404 VisitExpr(E);
1405 unsigned numSemanticExprs = Record.readInt();
1406 assert(numSemanticExprs + 1 == E->PseudoObjectExprBits.NumSubExprs);
1407 E->PseudoObjectExprBits.ResultIndex = Record.readInt();
1408
1409 // Read the syntactic expression.
1410 E->getSubExprsBuffer()[0] = Record.readSubExpr();
1411
1412 // Read all the semantic expressions.
1413 for (unsigned i = 0; i != numSemanticExprs; ++i) {
1414 Expr *subExpr = Record.readSubExpr();
1415 E->getSubExprsBuffer()[i+1] = subExpr;
1416 }
1417}
1418
1419void ASTStmtReader::VisitAtomicExpr(AtomicExpr *E) {
1420 VisitExpr(E);
1421 E->Op = AtomicExpr::AtomicOp(Record.readInt());
1422 E->NumSubExprs = AtomicExpr::getNumSubExprs(E->Op);
1423 for (unsigned I = 0; I != E->NumSubExprs; ++I)
1424 E->SubExprs[I] = Record.readSubExpr();
1425 E->BuiltinLoc = readSourceLocation();
1426 E->RParenLoc = readSourceLocation();
1427}
1428
1429//===----------------------------------------------------------------------===//
1430// Objective-C Expressions and Statements
1431
1432void ASTStmtReader::VisitObjCStringLiteral(ObjCStringLiteral *E) {
1433 VisitExpr(E);
1434 E->setString(cast<StringLiteral>(Record.readSubStmt()));
1435 E->setAtLoc(readSourceLocation());
1436}
1437
1438void ASTStmtReader::VisitObjCBoxedExpr(ObjCBoxedExpr *E) {
1439 VisitExpr(E);
1440 // could be one of several IntegerLiteral, FloatLiteral, etc.
1441 E->SubExpr = Record.readSubStmt();
1442 E->BoxingMethod = readDeclAs<ObjCMethodDecl>();
1443 E->Range = readSourceRange();
1444}
1445
1446void ASTStmtReader::VisitObjCArrayLiteral(ObjCArrayLiteral *E) {
1447 VisitExpr(E);
1448 unsigned NumElements = Record.readInt();
1449 assert(NumElements == E->getNumElements() && "Wrong number of elements");
1450 Expr **Elements = E->getElements();
1451 for (unsigned I = 0, N = NumElements; I != N; ++I)
1452 Elements[I] = Record.readSubExpr();
1453 E->ArrayWithObjectsMethod = readDeclAs<ObjCMethodDecl>();
1454 E->Range = readSourceRange();
1455}
1456
1457void ASTStmtReader::VisitObjCDictionaryLiteral(ObjCDictionaryLiteral *E) {
1458 VisitExpr(E);
1459 unsigned NumElements = Record.readInt();
1460 assert(NumElements == E->getNumElements() && "Wrong number of elements");
1461 bool HasPackExpansions = Record.readInt();
1462 assert(HasPackExpansions == E->HasPackExpansions &&"Pack expansion mismatch");
1463 auto *KeyValues =
1464 E->getTrailingObjects<ObjCDictionaryLiteral::KeyValuePair>();
1465 auto *Expansions =
1466 E->getTrailingObjects<ObjCDictionaryLiteral::ExpansionData>();
1467 for (unsigned I = 0; I != NumElements; ++I) {
1468 KeyValues[I].Key = Record.readSubExpr();
1469 KeyValues[I].Value = Record.readSubExpr();
1470 if (HasPackExpansions) {
1471 Expansions[I].EllipsisLoc = readSourceLocation();
1472 Expansions[I].NumExpansionsPlusOne = Record.readInt();
1473 }
1474 }
1475 E->DictWithObjectsMethod = readDeclAs<ObjCMethodDecl>();
1476 E->Range = readSourceRange();
1477}
1478
1479void ASTStmtReader::VisitObjCEncodeExpr(ObjCEncodeExpr *E) {
1480 VisitExpr(E);
1481 E->setEncodedTypeSourceInfo(readTypeSourceInfo());
1482 E->setAtLoc(readSourceLocation());
1483 E->setRParenLoc(readSourceLocation());
1484}
1485
1486void ASTStmtReader::VisitObjCSelectorExpr(ObjCSelectorExpr *E) {
1487 VisitExpr(E);
1488 E->setSelector(Record.readSelector());
1489 E->setAtLoc(readSourceLocation());
1490 E->setRParenLoc(readSourceLocation());
1491}
1492
1493void ASTStmtReader::VisitObjCProtocolExpr(ObjCProtocolExpr *E) {
1494 VisitExpr(E);
1495 E->setProtocol(readDeclAs<ObjCProtocolDecl>());
1496 E->setAtLoc(readSourceLocation());
1497 E->ProtoLoc = readSourceLocation();
1498 E->setRParenLoc(readSourceLocation());
1499}
1500
1501void ASTStmtReader::VisitObjCIvarRefExpr(ObjCIvarRefExpr *E) {
1502 VisitExpr(E);
1503 E->setDecl(readDeclAs<ObjCIvarDecl>());
1504 E->setLocation(readSourceLocation());
1505 E->setOpLoc(readSourceLocation());
1506 E->setBase(Record.readSubExpr());
1507 E->setIsArrow(Record.readInt());
1508 E->setIsFreeIvar(Record.readInt());
1509}
1510
1511void ASTStmtReader::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *E) {
1512 VisitExpr(E);
1513 unsigned MethodRefFlags = Record.readInt();
1514 bool Implicit = Record.readInt() != 0;
1515 if (Implicit) {
1516 auto *Getter = readDeclAs<ObjCMethodDecl>();
1517 auto *Setter = readDeclAs<ObjCMethodDecl>();
1518 E->setImplicitProperty(Getter, Setter, MethodRefFlags);
1519 } else {
1520 E->setExplicitProperty(readDeclAs<ObjCPropertyDecl>(), MethodRefFlags);
1521 }
1522 E->setLocation(readSourceLocation());
1523 E->setReceiverLocation(readSourceLocation());
1524 switch (Record.readInt()) {
1525 case 0:
1526 E->setBase(Record.readSubExpr());
1527 break;
1528 case 1:
1529 E->setSuperReceiver(Record.readType());
1530 break;
1531 case 2:
1532 E->setClassReceiver(readDeclAs<ObjCInterfaceDecl>());
1533 break;
1534 }
1535}
1536
1537void ASTStmtReader::VisitObjCSubscriptRefExpr(ObjCSubscriptRefExpr *E) {
1538 VisitExpr(E);
1539 E->setRBracket(readSourceLocation());
1540 E->setBaseExpr(Record.readSubExpr());
1541 E->setKeyExpr(Record.readSubExpr());
1542 E->GetAtIndexMethodDecl = readDeclAs<ObjCMethodDecl>();
1543 E->SetAtIndexMethodDecl = readDeclAs<ObjCMethodDecl>();
1544}
1545
1546void ASTStmtReader::VisitObjCMessageExpr(ObjCMessageExpr *E) {
1547 VisitExpr(E);
1548 assert(Record.peekInt() == E->getNumArgs());
1549 Record.skipInts(1);
1550 unsigned NumStoredSelLocs = Record.readInt();
1551 E->SelLocsKind = Record.readInt();
1552 E->setDelegateInitCall(Record.readInt());
1553 E->IsImplicit = Record.readInt();
1554 auto Kind = static_cast<ObjCMessageExpr::ReceiverKind>(Record.readInt());
1555 switch (Kind) {
1557 E->setInstanceReceiver(Record.readSubExpr());
1558 break;
1559
1561 E->setClassReceiver(readTypeSourceInfo());
1562 break;
1563
1566 QualType T = Record.readType();
1567 SourceLocation SuperLoc = readSourceLocation();
1568 E->setSuper(SuperLoc, T, Kind == ObjCMessageExpr::SuperInstance);
1569 break;
1570 }
1571 }
1572
1573 assert(Kind == E->getReceiverKind());
1574
1575 if (Record.readInt())
1576 E->setMethodDecl(readDeclAs<ObjCMethodDecl>());
1577 else
1578 E->setSelector(Record.readSelector());
1579
1580 E->LBracLoc = readSourceLocation();
1581 E->RBracLoc = readSourceLocation();
1582
1583 for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
1584 E->setArg(I, Record.readSubExpr());
1585
1586 SourceLocation *Locs = E->getStoredSelLocs();
1587 for (unsigned I = 0; I != NumStoredSelLocs; ++I)
1588 Locs[I] = readSourceLocation();
1589}
1590
1591void ASTStmtReader::VisitObjCForCollectionStmt(ObjCForCollectionStmt *S) {
1592 VisitStmt(S);
1593 S->setElement(Record.readSubStmt());
1594 S->setCollection(Record.readSubExpr());
1595 S->setBody(Record.readSubStmt());
1596 S->setForLoc(readSourceLocation());
1597 S->setRParenLoc(readSourceLocation());
1598}
1599
1600void ASTStmtReader::VisitObjCAtCatchStmt(ObjCAtCatchStmt *S) {
1601 VisitStmt(S);
1602 S->setCatchBody(Record.readSubStmt());
1603 S->setCatchParamDecl(readDeclAs<VarDecl>());
1604 S->setAtCatchLoc(readSourceLocation());
1605 S->setRParenLoc(readSourceLocation());
1606}
1607
1608void ASTStmtReader::VisitObjCAtFinallyStmt(ObjCAtFinallyStmt *S) {
1609 VisitStmt(S);
1610 S->setFinallyBody(Record.readSubStmt());
1611 S->setAtFinallyLoc(readSourceLocation());
1612}
1613
1614void ASTStmtReader::VisitObjCAutoreleasePoolStmt(ObjCAutoreleasePoolStmt *S) {
1615 VisitStmt(S); // FIXME: no test coverage.
1616 S->setSubStmt(Record.readSubStmt());
1617 S->setAtLoc(readSourceLocation());
1618}
1619
1620void ASTStmtReader::VisitObjCAtTryStmt(ObjCAtTryStmt *S) {
1621 VisitStmt(S);
1622 assert(Record.peekInt() == S->getNumCatchStmts());
1623 Record.skipInts(1);
1624 bool HasFinally = Record.readInt();
1625 S->setTryBody(Record.readSubStmt());
1626 for (unsigned I = 0, N = S->getNumCatchStmts(); I != N; ++I)
1627 S->setCatchStmt(I, cast_or_null<ObjCAtCatchStmt>(Record.readSubStmt()));
1628
1629 if (HasFinally)
1630 S->setFinallyStmt(Record.readSubStmt());
1631 S->setAtTryLoc(readSourceLocation());
1632}
1633
1634void ASTStmtReader::VisitObjCAtSynchronizedStmt(ObjCAtSynchronizedStmt *S) {
1635 VisitStmt(S); // FIXME: no test coverage.
1636 S->setSynchExpr(Record.readSubStmt());
1637 S->setSynchBody(Record.readSubStmt());
1638 S->setAtSynchronizedLoc(readSourceLocation());
1639}
1640
1641void ASTStmtReader::VisitObjCAtThrowStmt(ObjCAtThrowStmt *S) {
1642 VisitStmt(S); // FIXME: no test coverage.
1643 S->setThrowExpr(Record.readSubStmt());
1644 S->setThrowLoc(readSourceLocation());
1645}
1646
1647void ASTStmtReader::VisitObjCBoolLiteralExpr(ObjCBoolLiteralExpr *E) {
1648 VisitExpr(E);
1649 E->setValue(Record.readInt());
1650 E->setLocation(readSourceLocation());
1651}
1652
1653void ASTStmtReader::VisitObjCAvailabilityCheckExpr(ObjCAvailabilityCheckExpr *E) {
1654 VisitExpr(E);
1655 SourceRange R = Record.readSourceRange();
1656 E->AtLoc = R.getBegin();
1657 E->RParen = R.getEnd();
1658 E->VersionToCheck = Record.readVersionTuple();
1659}
1660
1661//===----------------------------------------------------------------------===//
1662// C++ Expressions and Statements
1663//===----------------------------------------------------------------------===//
1664
1665void ASTStmtReader::VisitCXXCatchStmt(CXXCatchStmt *S) {
1666 VisitStmt(S);
1667 S->CatchLoc = readSourceLocation();
1668 S->ExceptionDecl = readDeclAs<VarDecl>();
1669 S->HandlerBlock = Record.readSubStmt();
1670}
1671
1672void ASTStmtReader::VisitCXXTryStmt(CXXTryStmt *S) {
1673 VisitStmt(S);
1674 assert(Record.peekInt() == S->getNumHandlers() && "NumStmtFields is wrong ?");
1675 Record.skipInts(1);
1676 S->TryLoc = readSourceLocation();
1677 S->getStmts()[0] = Record.readSubStmt();
1678 for (unsigned i = 0, e = S->getNumHandlers(); i != e; ++i)
1679 S->getStmts()[i + 1] = Record.readSubStmt();
1680}
1681
1682void ASTStmtReader::VisitCXXForRangeStmt(CXXForRangeStmt *S) {
1683 VisitStmt(S);
1684 S->ForLoc = readSourceLocation();
1685 S->CoawaitLoc = readSourceLocation();
1686 S->ColonLoc = readSourceLocation();
1687 S->RParenLoc = readSourceLocation();
1688 S->setInit(Record.readSubStmt());
1689 S->setRangeStmt(Record.readSubStmt());
1690 S->setBeginStmt(Record.readSubStmt());
1691 S->setEndStmt(Record.readSubStmt());
1692 S->setCond(Record.readSubExpr());
1693 S->setInc(Record.readSubExpr());
1694 S->setLoopVarStmt(Record.readSubStmt());
1695 S->setBody(Record.readSubStmt());
1696}
1697
1698void ASTStmtReader::VisitMSDependentExistsStmt(MSDependentExistsStmt *S) {
1699 VisitStmt(S);
1700 S->KeywordLoc = readSourceLocation();
1701 S->IsIfExists = Record.readInt();
1702 S->QualifierLoc = Record.readNestedNameSpecifierLoc();
1703 S->NameInfo = Record.readDeclarationNameInfo();
1704 S->SubStmt = Record.readSubStmt();
1705}
1706
1707void ASTStmtReader::VisitCXXOperatorCallExpr(CXXOperatorCallExpr *E) {
1708 VisitCallExpr(E);
1709 E->CXXOperatorCallExprBits.OperatorKind = Record.readInt();
1710 E->Range = Record.readSourceRange();
1711}
1712
1713void ASTStmtReader::VisitCXXRewrittenBinaryOperator(
1715 VisitExpr(E);
1716 E->CXXRewrittenBinaryOperatorBits.IsReversed = Record.readInt();
1717 E->SemanticForm = Record.readSubExpr();
1718}
1719
1720void ASTStmtReader::VisitCXXConstructExpr(CXXConstructExpr *E) {
1721 VisitExpr(E);
1722
1723 unsigned NumArgs = Record.readInt();
1724 assert((NumArgs == E->getNumArgs()) && "Wrong NumArgs!");
1725
1726 E->CXXConstructExprBits.Elidable = Record.readInt();
1727 E->CXXConstructExprBits.HadMultipleCandidates = Record.readInt();
1728 E->CXXConstructExprBits.ListInitialization = Record.readInt();
1729 E->CXXConstructExprBits.StdInitListInitialization = Record.readInt();
1730 E->CXXConstructExprBits.ZeroInitialization = Record.readInt();
1731 E->CXXConstructExprBits.ConstructionKind = Record.readInt();
1732 E->CXXConstructExprBits.IsImmediateEscalating = Record.readInt();
1733 E->CXXConstructExprBits.Loc = readSourceLocation();
1734 E->Constructor = readDeclAs<CXXConstructorDecl>();
1735 E->ParenOrBraceRange = readSourceRange();
1736
1737 for (unsigned I = 0; I != NumArgs; ++I)
1738 E->setArg(I, Record.readSubExpr());
1739}
1740
1741void ASTStmtReader::VisitCXXInheritedCtorInitExpr(CXXInheritedCtorInitExpr *E) {
1742 VisitExpr(E);
1743 E->Constructor = readDeclAs<CXXConstructorDecl>();
1744 E->Loc = readSourceLocation();
1745 E->ConstructsVirtualBase = Record.readInt();
1746 E->InheritedFromVirtualBase = Record.readInt();
1747}
1748
1749void ASTStmtReader::VisitCXXTemporaryObjectExpr(CXXTemporaryObjectExpr *E) {
1750 VisitCXXConstructExpr(E);
1751 E->TSI = readTypeSourceInfo();
1752}
1753
1754void ASTStmtReader::VisitLambdaExpr(LambdaExpr *E) {
1755 VisitExpr(E);
1756 unsigned NumCaptures = Record.readInt();
1757 (void)NumCaptures;
1758 assert(NumCaptures == E->LambdaExprBits.NumCaptures);
1759 E->IntroducerRange = readSourceRange();
1760 E->LambdaExprBits.CaptureDefault = Record.readInt();
1761 E->CaptureDefaultLoc = readSourceLocation();
1762 E->LambdaExprBits.ExplicitParams = Record.readInt();
1763 E->LambdaExprBits.ExplicitResultType = Record.readInt();
1764 E->ClosingBrace = readSourceLocation();
1765
1766 // Read capture initializers.
1768 CEnd = E->capture_init_end();
1769 C != CEnd; ++C)
1770 *C = Record.readSubExpr();
1771
1772 // The body will be lazily deserialized when needed from the call operator
1773 // declaration.
1774}
1775
1776void
1777ASTStmtReader::VisitCXXStdInitializerListExpr(CXXStdInitializerListExpr *E) {
1778 VisitExpr(E);
1779 E->SubExpr = Record.readSubExpr();
1780}
1781
1782void ASTStmtReader::VisitCXXNamedCastExpr(CXXNamedCastExpr *E) {
1783 VisitExplicitCastExpr(E);
1784 SourceRange R = readSourceRange();
1785 E->Loc = R.getBegin();
1786 E->RParenLoc = R.getEnd();
1787 if (CurrentUnpackingBits->getNextBit())
1788 E->AngleBrackets = readSourceRange();
1789}
1790
1791void ASTStmtReader::VisitCXXStaticCastExpr(CXXStaticCastExpr *E) {
1792 return VisitCXXNamedCastExpr(E);
1793}
1794
1795void ASTStmtReader::VisitCXXDynamicCastExpr(CXXDynamicCastExpr *E) {
1796 return VisitCXXNamedCastExpr(E);
1797}
1798
1799void ASTStmtReader::VisitCXXReinterpretCastExpr(CXXReinterpretCastExpr *E) {
1800 return VisitCXXNamedCastExpr(E);
1801}
1802
1803void ASTStmtReader::VisitCXXAddrspaceCastExpr(CXXAddrspaceCastExpr *E) {
1804 return VisitCXXNamedCastExpr(E);
1805}
1806
1807void ASTStmtReader::VisitCXXConstCastExpr(CXXConstCastExpr *E) {
1808 return VisitCXXNamedCastExpr(E);
1809}
1810
1811void ASTStmtReader::VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr *E) {
1812 VisitExplicitCastExpr(E);
1813 E->setLParenLoc(readSourceLocation());
1814 E->setRParenLoc(readSourceLocation());
1815}
1816
1817void ASTStmtReader::VisitBuiltinBitCastExpr(BuiltinBitCastExpr *E) {
1818 VisitExplicitCastExpr(E);
1819 E->KWLoc = readSourceLocation();
1820 E->RParenLoc = readSourceLocation();
1821}
1822
1823void ASTStmtReader::VisitUserDefinedLiteral(UserDefinedLiteral *E) {
1824 VisitCallExpr(E);
1825 E->UDSuffixLoc = readSourceLocation();
1826}
1827
1828void ASTStmtReader::VisitCXXBoolLiteralExpr(CXXBoolLiteralExpr *E) {
1829 VisitExpr(E);
1830 E->setValue(Record.readInt());
1831 E->setLocation(readSourceLocation());
1832}
1833
1834void ASTStmtReader::VisitCXXNullPtrLiteralExpr(CXXNullPtrLiteralExpr *E) {
1835 VisitExpr(E);
1836 E->setLocation(readSourceLocation());
1837}
1838
1839void ASTStmtReader::VisitCXXTypeidExpr(CXXTypeidExpr *E) {
1840 VisitExpr(E);
1841 E->setSourceRange(readSourceRange());
1842 if (E->isTypeOperand())
1843 E->Operand = readTypeSourceInfo();
1844 else
1845 E->Operand = Record.readSubExpr();
1846}
1847
1848void ASTStmtReader::VisitCXXThisExpr(CXXThisExpr *E) {
1849 VisitExpr(E);
1850 E->setLocation(readSourceLocation());
1851 E->setImplicit(Record.readInt());
1852}
1853
1854void ASTStmtReader::VisitCXXThrowExpr(CXXThrowExpr *E) {
1855 VisitExpr(E);
1856 E->CXXThrowExprBits.ThrowLoc = readSourceLocation();
1857 E->Operand = Record.readSubExpr();
1858 E->CXXThrowExprBits.IsThrownVariableInScope = Record.readInt();
1859}
1860
1861void ASTStmtReader::VisitCXXDefaultArgExpr(CXXDefaultArgExpr *E) {
1862 VisitExpr(E);
1863 E->Param = readDeclAs<ParmVarDecl>();
1864 E->UsedContext = readDeclAs<DeclContext>();
1865 E->CXXDefaultArgExprBits.Loc = readSourceLocation();
1866 E->CXXDefaultArgExprBits.HasRewrittenInit = Record.readInt();
1867 if (E->CXXDefaultArgExprBits.HasRewrittenInit)
1868 *E->getTrailingObjects<Expr *>() = Record.readSubExpr();
1869}
1870
1871void ASTStmtReader::VisitCXXDefaultInitExpr(CXXDefaultInitExpr *E) {
1872 VisitExpr(E);
1873 E->CXXDefaultInitExprBits.HasRewrittenInit = Record.readInt();
1874 E->Field = readDeclAs<FieldDecl>();
1875 E->UsedContext = readDeclAs<DeclContext>();
1876 E->CXXDefaultInitExprBits.Loc = readSourceLocation();
1877 if (E->CXXDefaultInitExprBits.HasRewrittenInit)
1878 *E->getTrailingObjects<Expr *>() = Record.readSubExpr();
1879}
1880
1881void ASTStmtReader::VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *E) {
1882 VisitExpr(E);
1883 E->setTemporary(Record.readCXXTemporary());
1884 E->setSubExpr(Record.readSubExpr());
1885}
1886
1887void ASTStmtReader::VisitCXXScalarValueInitExpr(CXXScalarValueInitExpr *E) {
1888 VisitExpr(E);
1889 E->TypeInfo = readTypeSourceInfo();
1890 E->CXXScalarValueInitExprBits.RParenLoc = readSourceLocation();
1891}
1892
1893void ASTStmtReader::VisitCXXNewExpr(CXXNewExpr *E) {
1894 VisitExpr(E);
1895
1896 bool IsArray = Record.readInt();
1897 bool HasInit = Record.readInt();
1898 unsigned NumPlacementArgs = Record.readInt();
1899 bool IsParenTypeId = Record.readInt();
1900
1901 E->CXXNewExprBits.IsGlobalNew = Record.readInt();
1902 E->CXXNewExprBits.ShouldPassAlignment = Record.readInt();
1903 E->CXXNewExprBits.UsualArrayDeleteWantsSize = Record.readInt();
1904 E->CXXNewExprBits.HasInitializer = Record.readInt();
1905 E->CXXNewExprBits.StoredInitializationStyle = Record.readInt();
1906
1907 assert((IsArray == E->isArray()) && "Wrong IsArray!");
1908 assert((HasInit == E->hasInitializer()) && "Wrong HasInit!");
1909 assert((NumPlacementArgs == E->getNumPlacementArgs()) &&
1910 "Wrong NumPlacementArgs!");
1911 assert((IsParenTypeId == E->isParenTypeId()) && "Wrong IsParenTypeId!");
1912 (void)IsArray;
1913 (void)HasInit;
1914 (void)NumPlacementArgs;
1915
1916 E->setOperatorNew(readDeclAs<FunctionDecl>());
1917 E->setOperatorDelete(readDeclAs<FunctionDecl>());
1918 E->AllocatedTypeInfo = readTypeSourceInfo();
1919 if (IsParenTypeId)
1920 E->getTrailingObjects<SourceRange>()[0] = readSourceRange();
1921 E->Range = readSourceRange();
1922 E->DirectInitRange = readSourceRange();
1923
1924 // Install all the subexpressions.
1926 N = E->raw_arg_end();
1927 I != N; ++I)
1928 *I = Record.readSubStmt();
1929}
1930
1931void ASTStmtReader::VisitCXXDeleteExpr(CXXDeleteExpr *E) {
1932 VisitExpr(E);
1933 E->CXXDeleteExprBits.GlobalDelete = Record.readInt();
1934 E->CXXDeleteExprBits.ArrayForm = Record.readInt();
1935 E->CXXDeleteExprBits.ArrayFormAsWritten = Record.readInt();
1936 E->CXXDeleteExprBits.UsualArrayDeleteWantsSize = Record.readInt();
1937 E->OperatorDelete = readDeclAs<FunctionDecl>();
1938 E->Argument = Record.readSubExpr();
1939 E->CXXDeleteExprBits.Loc = readSourceLocation();
1940}
1941
1942void ASTStmtReader::VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr *E) {
1943 VisitExpr(E);
1944
1945 E->Base = Record.readSubExpr();
1946 E->IsArrow = Record.readInt();
1947 E->OperatorLoc = readSourceLocation();
1948 E->QualifierLoc = Record.readNestedNameSpecifierLoc();
1949 E->ScopeType = readTypeSourceInfo();
1950 E->ColonColonLoc = readSourceLocation();
1951 E->TildeLoc = readSourceLocation();
1952
1953 IdentifierInfo *II = Record.readIdentifier();
1954 if (II)
1955 E->setDestroyedType(II, readSourceLocation());
1956 else
1957 E->setDestroyedType(readTypeSourceInfo());
1958}
1959
1960void ASTStmtReader::VisitExprWithCleanups(ExprWithCleanups *E) {
1961 VisitExpr(E);
1962
1963 unsigned NumObjects = Record.readInt();
1964 assert(NumObjects == E->getNumObjects());
1965 for (unsigned i = 0; i != NumObjects; ++i) {
1966 unsigned CleanupKind = Record.readInt();
1968 if (CleanupKind == COK_Block)
1969 Obj = readDeclAs<BlockDecl>();
1970 else if (CleanupKind == COK_CompoundLiteral)
1971 Obj = cast<CompoundLiteralExpr>(Record.readSubExpr());
1972 else
1973 llvm_unreachable("unexpected cleanup object type");
1974 E->getTrailingObjects<ExprWithCleanups::CleanupObject>()[i] = Obj;
1975 }
1976
1977 E->ExprWithCleanupsBits.CleanupsHaveSideEffects = Record.readInt();
1978 E->SubExpr = Record.readSubExpr();
1979}
1980
1981void ASTStmtReader::VisitCXXDependentScopeMemberExpr(
1983 VisitExpr(E);
1984
1985 unsigned NumTemplateArgs = Record.readInt();
1986 CurrentUnpackingBits.emplace(Record.readInt());
1987 bool HasTemplateKWAndArgsInfo = CurrentUnpackingBits->getNextBit();
1988 bool HasFirstQualifierFoundInScope = CurrentUnpackingBits->getNextBit();
1989
1990 assert((HasTemplateKWAndArgsInfo == E->hasTemplateKWAndArgsInfo()) &&
1991 "Wrong HasTemplateKWAndArgsInfo!");
1992 assert(
1993 (HasFirstQualifierFoundInScope == E->hasFirstQualifierFoundInScope()) &&
1994 "Wrong HasFirstQualifierFoundInScope!");
1995
1996 if (HasTemplateKWAndArgsInfo)
1998 *E->getTrailingObjects<ASTTemplateKWAndArgsInfo>(),
1999 E->getTrailingObjects<TemplateArgumentLoc>(), NumTemplateArgs);
2000
2001 assert((NumTemplateArgs == E->getNumTemplateArgs()) &&
2002 "Wrong NumTemplateArgs!");
2003
2005 CurrentUnpackingBits->getNextBit();
2006
2007 E->BaseType = Record.readType();
2008 E->QualifierLoc = Record.readNestedNameSpecifierLoc();
2009 // not ImplicitAccess
2010 if (CurrentUnpackingBits->getNextBit())
2011 E->Base = Record.readSubExpr();
2012 else
2013 E->Base = nullptr;
2014
2015 E->CXXDependentScopeMemberExprBits.OperatorLoc = readSourceLocation();
2016
2017 if (HasFirstQualifierFoundInScope)
2018 *E->getTrailingObjects<NamedDecl *>() = readDeclAs<NamedDecl>();
2019
2020 E->MemberNameInfo = Record.readDeclarationNameInfo();
2021}
2022
2023void
2024ASTStmtReader::VisitDependentScopeDeclRefExpr(DependentScopeDeclRefExpr *E) {
2025 VisitExpr(E);
2026
2027 if (CurrentUnpackingBits->getNextBit()) // HasTemplateKWAndArgsInfo
2029 *E->getTrailingObjects<ASTTemplateKWAndArgsInfo>(),
2030 E->getTrailingObjects<TemplateArgumentLoc>(),
2031 /*NumTemplateArgs=*/CurrentUnpackingBits->getNextBits(/*Width=*/16));
2032
2033 E->QualifierLoc = Record.readNestedNameSpecifierLoc();
2034 E->NameInfo = Record.readDeclarationNameInfo();
2035}
2036
2037void
2038ASTStmtReader::VisitCXXUnresolvedConstructExpr(CXXUnresolvedConstructExpr *E) {
2039 VisitExpr(E);
2040 assert(Record.peekInt() == E->getNumArgs() &&
2041 "Read wrong record during creation ?");
2042 Record.skipInts(1);
2043 for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
2044 E->setArg(I, Record.readSubExpr());
2045 E->TypeAndInitForm.setPointer(readTypeSourceInfo());
2046 E->setLParenLoc(readSourceLocation());
2047 E->setRParenLoc(readSourceLocation());
2048 E->TypeAndInitForm.setInt(Record.readInt());
2049}
2050
2051void ASTStmtReader::VisitOverloadExpr(OverloadExpr *E) {
2052 VisitExpr(E);
2053
2054 unsigned NumResults = Record.readInt();
2055 CurrentUnpackingBits.emplace(Record.readInt());
2056 bool HasTemplateKWAndArgsInfo = CurrentUnpackingBits->getNextBit();
2057 assert((E->getNumDecls() == NumResults) && "Wrong NumResults!");
2058 assert((E->hasTemplateKWAndArgsInfo() == HasTemplateKWAndArgsInfo) &&
2059 "Wrong HasTemplateKWAndArgsInfo!");
2060
2061 if (HasTemplateKWAndArgsInfo) {
2062 unsigned NumTemplateArgs = Record.readInt();
2065 NumTemplateArgs);
2066 assert((E->getNumTemplateArgs() == NumTemplateArgs) &&
2067 "Wrong NumTemplateArgs!");
2068 }
2069
2070 UnresolvedSet<8> Decls;
2071 for (unsigned I = 0; I != NumResults; ++I) {
2072 auto *D = readDeclAs<NamedDecl>();
2073 auto AS = (AccessSpecifier)Record.readInt();
2074 Decls.addDecl(D, AS);
2075 }
2076
2077 DeclAccessPair *Results = E->getTrailingResults();
2079 for (unsigned I = 0; I != NumResults; ++I) {
2080 Results[I] = (Iter + I).getPair();
2081 }
2082
2083 E->NameInfo = Record.readDeclarationNameInfo();
2084 E->QualifierLoc = Record.readNestedNameSpecifierLoc();
2085}
2086
2087void ASTStmtReader::VisitUnresolvedMemberExpr(UnresolvedMemberExpr *E) {
2088 VisitOverloadExpr(E);
2089 E->UnresolvedMemberExprBits.IsArrow = CurrentUnpackingBits->getNextBit();
2090 E->UnresolvedMemberExprBits.HasUnresolvedUsing =
2091 CurrentUnpackingBits->getNextBit();
2092
2093 if (/*!isImplicitAccess=*/CurrentUnpackingBits->getNextBit())
2094 E->Base = Record.readSubExpr();
2095 else
2096 E->Base = nullptr;
2097
2098 E->OperatorLoc = readSourceLocation();
2099
2100 E->BaseType = Record.readType();
2101}
2102
2103void ASTStmtReader::VisitUnresolvedLookupExpr(UnresolvedLookupExpr *E) {
2104 VisitOverloadExpr(E);
2105 E->UnresolvedLookupExprBits.RequiresADL = CurrentUnpackingBits->getNextBit();
2106 E->UnresolvedLookupExprBits.Overloaded = CurrentUnpackingBits->getNextBit();
2107 E->NamingClass = readDeclAs<CXXRecordDecl>();
2108}
2109
2110void ASTStmtReader::VisitTypeTraitExpr(TypeTraitExpr *E) {
2111 VisitExpr(E);
2112 E->TypeTraitExprBits.NumArgs = Record.readInt();
2113 E->TypeTraitExprBits.Kind = Record.readInt();
2114 E->TypeTraitExprBits.Value = Record.readInt();
2115 SourceRange Range = readSourceRange();
2116 E->Loc = Range.getBegin();
2117 E->RParenLoc = Range.getEnd();
2118
2119 auto **Args = E->getTrailingObjects<TypeSourceInfo *>();
2120 for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
2121 Args[I] = readTypeSourceInfo();
2122}
2123
2124void ASTStmtReader::VisitArrayTypeTraitExpr(ArrayTypeTraitExpr *E) {
2125 VisitExpr(E);
2126 E->ATT = (ArrayTypeTrait)Record.readInt();
2127 E->Value = (unsigned int)Record.readInt();
2128 SourceRange Range = readSourceRange();
2129 E->Loc = Range.getBegin();
2130 E->RParen = Range.getEnd();
2131 E->QueriedType = readTypeSourceInfo();
2132 E->Dimension = Record.readSubExpr();
2133}
2134
2135void ASTStmtReader::VisitExpressionTraitExpr(ExpressionTraitExpr *E) {
2136 VisitExpr(E);
2137 E->ET = (ExpressionTrait)Record.readInt();
2138 E->Value = (bool)Record.readInt();
2139 SourceRange Range = readSourceRange();
2140 E->QueriedExpression = Record.readSubExpr();
2141 E->Loc = Range.getBegin();
2142 E->RParen = Range.getEnd();
2143}
2144
2145void ASTStmtReader::VisitCXXNoexceptExpr(CXXNoexceptExpr *E) {
2146 VisitExpr(E);
2147 E->CXXNoexceptExprBits.Value = Record.readInt();
2148 E->Range = readSourceRange();
2149 E->Operand = Record.readSubExpr();
2150}
2151
2152void ASTStmtReader::VisitPackExpansionExpr(PackExpansionExpr *E) {
2153 VisitExpr(E);
2154 E->EllipsisLoc = readSourceLocation();
2155 E->NumExpansions = Record.readInt();
2156 E->Pattern = Record.readSubExpr();
2157}
2158
2159void ASTStmtReader::VisitSizeOfPackExpr(SizeOfPackExpr *E) {
2160 VisitExpr(E);
2161 unsigned NumPartialArgs = Record.readInt();
2162 E->OperatorLoc = readSourceLocation();
2163 E->PackLoc = readSourceLocation();
2164 E->RParenLoc = readSourceLocation();
2165 E->Pack = Record.readDeclAs<NamedDecl>();
2166 if (E->isPartiallySubstituted()) {
2167 assert(E->Length == NumPartialArgs);
2168 for (auto *I = E->getTrailingObjects<TemplateArgument>(),
2169 *E = I + NumPartialArgs;
2170 I != E; ++I)
2171 new (I) TemplateArgument(Record.readTemplateArgument());
2172 } else if (!E->isValueDependent()) {
2173 E->Length = Record.readInt();
2174 }
2175}
2176
2177void ASTStmtReader::VisitPackIndexingExpr(PackIndexingExpr *E) {
2178 VisitExpr(E);
2179 E->TransformedExpressions = Record.readInt();
2180 E->EllipsisLoc = readSourceLocation();
2181 E->RSquareLoc = readSourceLocation();
2182 E->SubExprs[0] = Record.readStmt();
2183 E->SubExprs[1] = Record.readStmt();
2184 auto **Exprs = E->getTrailingObjects<Expr *>();
2185 for (unsigned I = 0; I < E->TransformedExpressions; ++I)
2186 Exprs[I] = Record.readExpr();
2187}
2188
2189void ASTStmtReader::VisitSubstNonTypeTemplateParmExpr(
2191 VisitExpr(E);
2192 E->AssociatedDeclAndRef.setPointer(readDeclAs<Decl>());
2193 E->AssociatedDeclAndRef.setInt(CurrentUnpackingBits->getNextBit());
2194 E->Index = CurrentUnpackingBits->getNextBits(/*Width=*/12);
2195 if (CurrentUnpackingBits->getNextBit())
2196 E->PackIndex = Record.readInt();
2197 else
2198 E->PackIndex = 0;
2199 E->SubstNonTypeTemplateParmExprBits.NameLoc = readSourceLocation();
2200 E->Replacement = Record.readSubExpr();
2201}
2202
2203void ASTStmtReader::VisitSubstNonTypeTemplateParmPackExpr(
2205 VisitExpr(E);
2206 E->AssociatedDecl = readDeclAs<Decl>();
2207 E->Index = Record.readInt();
2208 TemplateArgument ArgPack = Record.readTemplateArgument();
2209 if (ArgPack.getKind() != TemplateArgument::Pack)
2210 return;
2211
2212 E->Arguments = ArgPack.pack_begin();
2213 E->NumArguments = ArgPack.pack_size();
2214 E->NameLoc = readSourceLocation();
2215}
2216
2217void ASTStmtReader::VisitFunctionParmPackExpr(FunctionParmPackExpr *E) {
2218 VisitExpr(E);
2219 E->NumParameters = Record.readInt();
2220 E->ParamPack = readDeclAs<ParmVarDecl>();
2221 E->NameLoc = readSourceLocation();
2222 auto **Parms = E->getTrailingObjects<VarDecl *>();
2223 for (unsigned i = 0, n = E->NumParameters; i != n; ++i)
2224 Parms[i] = readDeclAs<VarDecl>();
2225}
2226
2227void ASTStmtReader::VisitMaterializeTemporaryExpr(MaterializeTemporaryExpr *E) {
2228 VisitExpr(E);
2229 bool HasMaterialzedDecl = Record.readInt();
2230 if (HasMaterialzedDecl)
2231 E->State = cast<LifetimeExtendedTemporaryDecl>(Record.readDecl());
2232 else
2233 E->State = Record.readSubExpr();
2234}
2235
2236void ASTStmtReader::VisitCXXFoldExpr(CXXFoldExpr *E) {
2237 VisitExpr(E);
2238 E->LParenLoc = readSourceLocation();
2239 E->EllipsisLoc = readSourceLocation();
2240 E->RParenLoc = readSourceLocation();
2241 E->NumExpansions = Record.readInt();
2242 E->SubExprs[0] = Record.readSubExpr();
2243 E->SubExprs[1] = Record.readSubExpr();
2244 E->SubExprs[2] = Record.readSubExpr();
2245 E->Opcode = (BinaryOperatorKind)Record.readInt();
2246}
2247
2248void ASTStmtReader::VisitCXXParenListInitExpr(CXXParenListInitExpr *E) {
2249 VisitExpr(E);
2250 unsigned ExpectedNumExprs = Record.readInt();
2251 assert(E->NumExprs == ExpectedNumExprs &&
2252 "expected number of expressions does not equal the actual number of "
2253 "serialized expressions.");
2254 E->NumUserSpecifiedExprs = Record.readInt();
2255 E->InitLoc = readSourceLocation();
2256 E->LParenLoc = readSourceLocation();
2257 E->RParenLoc = readSourceLocation();
2258 for (unsigned I = 0; I < ExpectedNumExprs; I++)
2259 E->getTrailingObjects<Expr *>()[I] = Record.readSubExpr();
2260
2261 bool HasArrayFillerOrUnionDecl = Record.readBool();
2262 if (HasArrayFillerOrUnionDecl) {
2263 bool HasArrayFiller = Record.readBool();
2264 if (HasArrayFiller) {
2265 E->setArrayFiller(Record.readSubExpr());
2266 } else {
2267 E->setInitializedFieldInUnion(readDeclAs<FieldDecl>());
2268 }
2269 }
2270 E->updateDependence();
2271}
2272
2273void ASTStmtReader::VisitOpaqueValueExpr(OpaqueValueExpr *E) {
2274 VisitExpr(E);
2275 E->SourceExpr = Record.readSubExpr();
2276 E->OpaqueValueExprBits.Loc = readSourceLocation();
2277 E->setIsUnique(Record.readInt());
2278}
2279
2280void ASTStmtReader::VisitTypoExpr(TypoExpr *E) {
2281 llvm_unreachable("Cannot read TypoExpr nodes");
2282}
2283
2284void ASTStmtReader::VisitRecoveryExpr(RecoveryExpr *E) {
2285 VisitExpr(E);
2286 unsigned NumArgs = Record.readInt();
2287 E->BeginLoc = readSourceLocation();
2288 E->EndLoc = readSourceLocation();
2289 assert((NumArgs + 0LL ==
2290 std::distance(E->children().begin(), E->children().end())) &&
2291 "Wrong NumArgs!");
2292 (void)NumArgs;
2293 for (Stmt *&Child : E->children())
2294 Child = Record.readSubStmt();
2295}
2296
2297//===----------------------------------------------------------------------===//
2298// Microsoft Expressions and Statements
2299//===----------------------------------------------------------------------===//
2300void ASTStmtReader::VisitMSPropertyRefExpr(MSPropertyRefExpr *E) {
2301 VisitExpr(E);
2302 E->IsArrow = (Record.readInt() != 0);
2303 E->BaseExpr = Record.readSubExpr();
2304 E->QualifierLoc = Record.readNestedNameSpecifierLoc();
2305 E->MemberLoc = readSourceLocation();
2306 E->TheDecl = readDeclAs<MSPropertyDecl>();
2307}
2308
2309void ASTStmtReader::VisitMSPropertySubscriptExpr(MSPropertySubscriptExpr *E) {
2310 VisitExpr(E);
2311 E->setBase(Record.readSubExpr());
2312 E->setIdx(Record.readSubExpr());
2313 E->setRBracketLoc(readSourceLocation());
2314}
2315
2316void ASTStmtReader::VisitCXXUuidofExpr(CXXUuidofExpr *E) {
2317 VisitExpr(E);
2318 E->setSourceRange(readSourceRange());
2319 E->Guid = readDeclAs<MSGuidDecl>();
2320 if (E->isTypeOperand())
2321 E->Operand = readTypeSourceInfo();
2322 else
2323 E->Operand = Record.readSubExpr();
2324}
2325
2326void ASTStmtReader::VisitSEHLeaveStmt(SEHLeaveStmt *S) {
2327 VisitStmt(S);
2328 S->setLeaveLoc(readSourceLocation());
2329}
2330
2331void ASTStmtReader::VisitSEHExceptStmt(SEHExceptStmt *S) {
2332 VisitStmt(S);
2333 S->Loc = readSourceLocation();
2334 S->Children[SEHExceptStmt::FILTER_EXPR] = Record.readSubStmt();
2335 S->Children[SEHExceptStmt::BLOCK] = Record.readSubStmt();
2336}
2337
2338void ASTStmtReader::VisitSEHFinallyStmt(SEHFinallyStmt *S) {
2339 VisitStmt(S);
2340 S->Loc = readSourceLocation();
2341 S->Block = Record.readSubStmt();
2342}
2343
2344void ASTStmtReader::VisitSEHTryStmt(SEHTryStmt *S) {
2345 VisitStmt(S);
2346 S->IsCXXTry = Record.readInt();
2347 S->TryLoc = readSourceLocation();
2348 S->Children[SEHTryStmt::TRY] = Record.readSubStmt();
2349 S->Children[SEHTryStmt::HANDLER] = Record.readSubStmt();
2350}
2351
2352//===----------------------------------------------------------------------===//
2353// CUDA Expressions and Statements
2354//===----------------------------------------------------------------------===//
2355
2356void ASTStmtReader::VisitCUDAKernelCallExpr(CUDAKernelCallExpr *E) {
2357 VisitCallExpr(E);
2358 E->setPreArg(CUDAKernelCallExpr::CONFIG, Record.readSubExpr());
2359}
2360
2361//===----------------------------------------------------------------------===//
2362// OpenCL Expressions and Statements.
2363//===----------------------------------------------------------------------===//
2364void ASTStmtReader::VisitAsTypeExpr(AsTypeExpr *E) {
2365 VisitExpr(E);
2366 E->BuiltinLoc = readSourceLocation();
2367 E->RParenLoc = readSourceLocation();
2368 E->SrcExpr = Record.readSubExpr();
2369}
2370
2371//===----------------------------------------------------------------------===//
2372// OpenMP Directives.
2373//===----------------------------------------------------------------------===//
2374
2375void ASTStmtReader::VisitOMPCanonicalLoop(OMPCanonicalLoop *S) {
2376 VisitStmt(S);
2377 for (Stmt *&SubStmt : S->SubStmts)
2378 SubStmt = Record.readSubStmt();
2379}
2380
2381void ASTStmtReader::VisitOMPExecutableDirective(OMPExecutableDirective *E) {
2382 Record.readOMPChildren(E->Data);
2383 E->setLocStart(readSourceLocation());
2384 E->setLocEnd(readSourceLocation());
2386}
2387
2388void ASTStmtReader::VisitOMPLoopBasedDirective(OMPLoopBasedDirective *D) {
2389 VisitStmt(D);
2390 // Field CollapsedNum was read in ReadStmtFromStream.
2391 Record.skipInts(1);
2392 VisitOMPExecutableDirective(D);
2393}
2394
2395void ASTStmtReader::VisitOMPLoopDirective(OMPLoopDirective *D) {
2396 VisitOMPLoopBasedDirective(D);
2397}
2398
2399void ASTStmtReader::VisitOMPMetaDirective(OMPMetaDirective *D) {
2400 VisitStmt(D);
2401 // The NumClauses field was read in ReadStmtFromStream.
2402 Record.skipInts(1);
2403 VisitOMPExecutableDirective(D);
2404}
2405
2406void ASTStmtReader::VisitOMPParallelDirective(OMPParallelDirective *D) {
2407 VisitStmt(D);
2408 VisitOMPExecutableDirective(D);
2409 D->setHasCancel(Record.readBool());
2410}
2411
2412void ASTStmtReader::VisitOMPSimdDirective(OMPSimdDirective *D) {
2413 VisitOMPLoopDirective(D);
2414}
2415
2416void ASTStmtReader::VisitOMPLoopTransformationDirective(
2418 VisitOMPLoopBasedDirective(D);
2419 D->setNumGeneratedLoops(Record.readUInt32());
2420}
2421
2422void ASTStmtReader::VisitOMPTileDirective(OMPTileDirective *D) {
2423 VisitOMPLoopTransformationDirective(D);
2424}
2425
2426void ASTStmtReader::VisitOMPUnrollDirective(OMPUnrollDirective *D) {
2427 VisitOMPLoopTransformationDirective(D);
2428}
2429
2430void ASTStmtReader::VisitOMPForDirective(OMPForDirective *D) {
2431 VisitOMPLoopDirective(D);
2432 D->setHasCancel(Record.readBool());
2433}
2434
2435void ASTStmtReader::VisitOMPForSimdDirective(OMPForSimdDirective *D) {
2436 VisitOMPLoopDirective(D);
2437}
2438
2439void ASTStmtReader::VisitOMPSectionsDirective(OMPSectionsDirective *D) {
2440 VisitStmt(D);
2441 VisitOMPExecutableDirective(D);
2442 D->setHasCancel(Record.readBool());
2443}
2444
2445void ASTStmtReader::VisitOMPSectionDirective(OMPSectionDirective *D) {
2446 VisitStmt(D);
2447 VisitOMPExecutableDirective(D);
2448 D->setHasCancel(Record.readBool());
2449}
2450
2451void ASTStmtReader::VisitOMPScopeDirective(OMPScopeDirective *D) {
2452 VisitStmt(D);
2453 VisitOMPExecutableDirective(D);
2454}
2455
2456void ASTStmtReader::VisitOMPSingleDirective(OMPSingleDirective *D) {
2457 VisitStmt(D);
2458 VisitOMPExecutableDirective(D);
2459}
2460
2461void ASTStmtReader::VisitOMPMasterDirective(OMPMasterDirective *D) {
2462 VisitStmt(D);
2463 VisitOMPExecutableDirective(D);
2464}
2465
2466void ASTStmtReader::VisitOMPCriticalDirective(OMPCriticalDirective *D) {
2467 VisitStmt(D);
2468 VisitOMPExecutableDirective(D);
2469 D->DirName = Record.readDeclarationNameInfo();
2470}
2471
2472void ASTStmtReader::VisitOMPParallelForDirective(OMPParallelForDirective *D) {
2473 VisitOMPLoopDirective(D);
2474 D->setHasCancel(Record.readBool());
2475}
2476
2477void ASTStmtReader::VisitOMPParallelForSimdDirective(
2479 VisitOMPLoopDirective(D);
2480}
2481
2482void ASTStmtReader::VisitOMPParallelMasterDirective(
2484 VisitStmt(D);
2485 VisitOMPExecutableDirective(D);
2486}
2487
2488void ASTStmtReader::VisitOMPParallelMaskedDirective(
2490 VisitStmt(D);
2491 VisitOMPExecutableDirective(D);
2492}
2493
2494void ASTStmtReader::VisitOMPParallelSectionsDirective(
2496 VisitStmt(D);
2497 VisitOMPExecutableDirective(D);
2498 D->setHasCancel(Record.readBool());
2499}
2500
2501void ASTStmtReader::VisitOMPTaskDirective(OMPTaskDirective *D) {
2502 VisitStmt(D);
2503 VisitOMPExecutableDirective(D);
2504 D->setHasCancel(Record.readBool());
2505}
2506
2507void ASTStmtReader::VisitOMPTaskyieldDirective(OMPTaskyieldDirective *D) {
2508 VisitStmt(D);
2509 VisitOMPExecutableDirective(D);
2510}
2511
2512void ASTStmtReader::VisitOMPBarrierDirective(OMPBarrierDirective *D) {
2513 VisitStmt(D);
2514 VisitOMPExecutableDirective(D);
2515}
2516
2517void ASTStmtReader::VisitOMPTaskwaitDirective(OMPTaskwaitDirective *D) {
2518 VisitStmt(D);
2519 // The NumClauses field was read in ReadStmtFromStream.
2520 Record.skipInts(1);
2521 VisitOMPExecutableDirective(D);
2522}
2523
2524void ASTStmtReader::VisitOMPErrorDirective(OMPErrorDirective *D) {
2525 VisitStmt(D);
2526 // The NumClauses field was read in ReadStmtFromStream.
2527 Record.skipInts(1);
2528 VisitOMPExecutableDirective(D);
2529}
2530
2531void ASTStmtReader::VisitOMPTaskgroupDirective(OMPTaskgroupDirective *D) {
2532 VisitStmt(D);
2533 VisitOMPExecutableDirective(D);
2534}
2535
2536void ASTStmtReader::VisitOMPFlushDirective(OMPFlushDirective *D) {
2537 VisitStmt(D);
2538 VisitOMPExecutableDirective(D);
2539}
2540
2541void ASTStmtReader::VisitOMPDepobjDirective(OMPDepobjDirective *D) {
2542 VisitStmt(D);
2543 VisitOMPExecutableDirective(D);
2544}
2545
2546void ASTStmtReader::VisitOMPScanDirective(OMPScanDirective *D) {
2547 VisitStmt(D);
2548 VisitOMPExecutableDirective(D);
2549}
2550
2551void ASTStmtReader::VisitOMPOrderedDirective(OMPOrderedDirective *D) {
2552 VisitStmt(D);
2553 VisitOMPExecutableDirective(D);
2554}
2555
2556void ASTStmtReader::VisitOMPAtomicDirective(OMPAtomicDirective *D) {
2557 VisitStmt(D);
2558 VisitOMPExecutableDirective(D);
2559 D->Flags.IsXLHSInRHSPart = Record.readBool() ? 1 : 0;
2560 D->Flags.IsPostfixUpdate = Record.readBool() ? 1 : 0;
2561 D->Flags.IsFailOnly = Record.readBool() ? 1 : 0;
2562}
2563
2564void ASTStmtReader::VisitOMPTargetDirective(OMPTargetDirective *D) {
2565 VisitStmt(D);
2566 VisitOMPExecutableDirective(D);
2567}
2568
2569void ASTStmtReader::VisitOMPTargetDataDirective(OMPTargetDataDirective *D) {
2570 VisitStmt(D);
2571 VisitOMPExecutableDirective(D);
2572}
2573
2574void ASTStmtReader::VisitOMPTargetEnterDataDirective(
2576 VisitStmt(D);
2577 VisitOMPExecutableDirective(D);
2578}
2579
2580void ASTStmtReader::VisitOMPTargetExitDataDirective(
2582 VisitStmt(D);
2583 VisitOMPExecutableDirective(D);
2584}
2585
2586void ASTStmtReader::VisitOMPTargetParallelDirective(
2588 VisitStmt(D);
2589 VisitOMPExecutableDirective(D);
2590 D->setHasCancel(Record.readBool());
2591}
2592
2593void ASTStmtReader::VisitOMPTargetParallelForDirective(
2595 VisitOMPLoopDirective(D);
2596 D->setHasCancel(Record.readBool());
2597}
2598
2599void ASTStmtReader::VisitOMPTeamsDirective(OMPTeamsDirective *D) {
2600 VisitStmt(D);
2601 VisitOMPExecutableDirective(D);
2602}
2603
2604void ASTStmtReader::VisitOMPCancellationPointDirective(
2606 VisitStmt(D);
2607 VisitOMPExecutableDirective(D);
2608 D->setCancelRegion(Record.readEnum<OpenMPDirectiveKind>());
2609}
2610
2611void ASTStmtReader::VisitOMPCancelDirective(OMPCancelDirective *D) {
2612 VisitStmt(D);
2613 VisitOMPExecutableDirective(D);
2614 D->setCancelRegion(Record.readEnum<OpenMPDirectiveKind>());
2615}
2616
2617void ASTStmtReader::VisitOMPTaskLoopDirective(OMPTaskLoopDirective *D) {
2618 VisitOMPLoopDirective(D);
2619 D->setHasCancel(Record.readBool());
2620}
2621
2622void ASTStmtReader::VisitOMPTaskLoopSimdDirective(OMPTaskLoopSimdDirective *D) {
2623 VisitOMPLoopDirective(D);
2624}
2625
2626void ASTStmtReader::VisitOMPMasterTaskLoopDirective(
2628 VisitOMPLoopDirective(D);
2629 D->setHasCancel(Record.readBool());
2630}
2631
2632void ASTStmtReader::VisitOMPMaskedTaskLoopDirective(
2634 VisitOMPLoopDirective(D);
2635 D->setHasCancel(Record.readBool());
2636}
2637
2638void ASTStmtReader::VisitOMPMasterTaskLoopSimdDirective(
2640 VisitOMPLoopDirective(D);
2641}
2642
2643void ASTStmtReader::VisitOMPMaskedTaskLoopSimdDirective(
2645 VisitOMPLoopDirective(D);
2646}
2647
2648void ASTStmtReader::VisitOMPParallelMasterTaskLoopDirective(
2650 VisitOMPLoopDirective(D);
2651 D->setHasCancel(Record.readBool());
2652}
2653
2654void ASTStmtReader::VisitOMPParallelMaskedTaskLoopDirective(
2656 VisitOMPLoopDirective(D);
2657 D->setHasCancel(Record.readBool());
2658}
2659
2660void ASTStmtReader::VisitOMPParallelMasterTaskLoopSimdDirective(
2662 VisitOMPLoopDirective(D);
2663}
2664
2665void ASTStmtReader::VisitOMPParallelMaskedTaskLoopSimdDirective(
2667 VisitOMPLoopDirective(D);
2668}
2669
2670void ASTStmtReader::VisitOMPDistributeDirective(OMPDistributeDirective *D) {
2671 VisitOMPLoopDirective(D);
2672}
2673
2674void ASTStmtReader::VisitOMPTargetUpdateDirective(OMPTargetUpdateDirective *D) {
2675 VisitStmt(D);
2676 VisitOMPExecutableDirective(D);
2677}
2678
2679void ASTStmtReader::VisitOMPDistributeParallelForDirective(
2681 VisitOMPLoopDirective(D);
2682 D->setHasCancel(Record.readBool());
2683}
2684
2685void ASTStmtReader::VisitOMPDistributeParallelForSimdDirective(
2687 VisitOMPLoopDirective(D);
2688}
2689
2690void ASTStmtReader::VisitOMPDistributeSimdDirective(
2692 VisitOMPLoopDirective(D);
2693}
2694
2695void ASTStmtReader::VisitOMPTargetParallelForSimdDirective(
2697 VisitOMPLoopDirective(D);
2698}
2699
2700void ASTStmtReader::VisitOMPTargetSimdDirective(OMPTargetSimdDirective *D) {
2701 VisitOMPLoopDirective(D);
2702}
2703
2704void ASTStmtReader::VisitOMPTeamsDistributeDirective(
2706 VisitOMPLoopDirective(D);
2707}
2708
2709void ASTStmtReader::VisitOMPTeamsDistributeSimdDirective(
2711 VisitOMPLoopDirective(D);
2712}
2713
2714void ASTStmtReader::VisitOMPTeamsDistributeParallelForSimdDirective(
2716 VisitOMPLoopDirective(D);
2717}
2718
2719void ASTStmtReader::VisitOMPTeamsDistributeParallelForDirective(
2721 VisitOMPLoopDirective(D);
2722 D->setHasCancel(Record.readBool());
2723}
2724
2725void ASTStmtReader::VisitOMPTargetTeamsDirective(OMPTargetTeamsDirective *D) {
2726 VisitStmt(D);
2727 VisitOMPExecutableDirective(D);
2728}
2729
2730void ASTStmtReader::VisitOMPTargetTeamsDistributeDirective(
2732 VisitOMPLoopDirective(D);
2733}
2734
2735void ASTStmtReader::VisitOMPTargetTeamsDistributeParallelForDirective(
2737 VisitOMPLoopDirective(D);
2738 D->setHasCancel(Record.readBool());
2739}
2740
2741void ASTStmtReader::VisitOMPTargetTeamsDistributeParallelForSimdDirective(
2743 VisitOMPLoopDirective(D);
2744}
2745
2746void ASTStmtReader::VisitOMPTargetTeamsDistributeSimdDirective(
2748 VisitOMPLoopDirective(D);
2749}
2750
2751void ASTStmtReader::VisitOMPInteropDirective(OMPInteropDirective *D) {
2752 VisitStmt(D);
2753 VisitOMPExecutableDirective(D);
2754}
2755
2756void ASTStmtReader::VisitOMPDispatchDirective(OMPDispatchDirective *D) {
2757 VisitStmt(D);
2758 VisitOMPExecutableDirective(D);
2759 D->setTargetCallLoc(Record.readSourceLocation());
2760}
2761
2762void ASTStmtReader::VisitOMPMaskedDirective(OMPMaskedDirective *D) {
2763 VisitStmt(D);
2764 VisitOMPExecutableDirective(D);
2765}
2766
2767void ASTStmtReader::VisitOMPGenericLoopDirective(OMPGenericLoopDirective *D) {
2768 VisitOMPLoopDirective(D);
2769}
2770
2771void ASTStmtReader::VisitOMPTeamsGenericLoopDirective(
2773 VisitOMPLoopDirective(D);
2774}
2775
2776void ASTStmtReader::VisitOMPTargetTeamsGenericLoopDirective(
2778 VisitOMPLoopDirective(D);
2779}
2780
2781void ASTStmtReader::VisitOMPParallelGenericLoopDirective(
2783 VisitOMPLoopDirective(D);
2784}
2785
2786void ASTStmtReader::VisitOMPTargetParallelGenericLoopDirective(
2788 VisitOMPLoopDirective(D);
2789}
2790
2791//===----------------------------------------------------------------------===//
2792// OpenACC Constructs/Directives.
2793//===----------------------------------------------------------------------===//
2794void ASTStmtReader::VisitOpenACCConstructStmt(OpenACCConstructStmt *S) {
2795 S->Kind = Record.readEnum<OpenACCDirectiveKind>();
2796 S->Range = Record.readSourceRange();
2797 // TODO OpenACC: Deserialize Clauses.
2798}
2799
2800void ASTStmtReader::VisitOpenACCAssociatedStmtConstruct(
2802 VisitOpenACCConstructStmt(S);
2803 S->setAssociatedStmt(Record.readSubStmt());
2804}
2805
2806void ASTStmtReader::VisitOpenACCComputeConstruct(OpenACCComputeConstruct *S) {
2807 VisitStmt(S);
2808 VisitOpenACCConstructStmt(S);
2809}
2810
2811//===----------------------------------------------------------------------===//
2812// ASTReader Implementation
2813//===----------------------------------------------------------------------===//
2814
2816 switch (ReadingKind) {
2817 case Read_None:
2818 llvm_unreachable("should not call this when not reading anything");
2819 case Read_Decl:
2820 case Read_Type:
2821 return ReadStmtFromStream(F);
2822 case Read_Stmt:
2823 return ReadSubStmt();
2824 }
2825
2826 llvm_unreachable("ReadingKind not set ?");
2827}
2828
2830 return cast_or_null<Expr>(ReadStmt(F));
2831}
2832
2834 return cast_or_null<Expr>(ReadSubStmt());
2835}
2836
2837// Within the bitstream, expressions are stored in Reverse Polish
2838// Notation, with each of the subexpressions preceding the
2839// expression they are stored in. Subexpressions are stored from last to first.
2840// To evaluate expressions, we continue reading expressions and placing them on
2841// the stack, with expressions having operands removing those operands from the
2842// stack. Evaluation terminates when we see a STMT_STOP record, and
2843// the single remaining expression on the stack is our result.
2844Stmt *ASTReader::ReadStmtFromStream(ModuleFile &F) {
2845 ReadingKindTracker ReadingKind(Read_Stmt, *this);
2846 llvm::BitstreamCursor &Cursor = F.DeclsCursor;
2847
2848 // Map of offset to previously deserialized stmt. The offset points
2849 // just after the stmt record.
2850 llvm::DenseMap<uint64_t, Stmt *> StmtEntries;
2851
2852#ifndef NDEBUG
2853 unsigned PrevNumStmts = StmtStack.size();
2854#endif
2855
2856 ASTRecordReader Record(*this, F);
2857 ASTStmtReader Reader(Record, Cursor);
2858 Stmt::EmptyShell Empty;
2859
2860 while (true) {
2862 Cursor.advanceSkippingSubblocks();
2863 if (!MaybeEntry) {
2864 Error(toString(MaybeEntry.takeError()));
2865 return nullptr;
2866 }
2867 llvm::BitstreamEntry Entry = MaybeEntry.get();
2868
2869 switch (Entry.Kind) {
2870 case llvm::BitstreamEntry::SubBlock: // Handled for us already.
2871 case llvm::BitstreamEntry::Error:
2872 Error("malformed block record in AST file");
2873 return nullptr;
2874 case llvm::BitstreamEntry::EndBlock:
2875 goto Done;
2876 case llvm::BitstreamEntry::Record:
2877 // The interesting case.
2878 break;
2879 }
2880
2881 ASTContext &Context = getContext();
2882 Stmt *S = nullptr;
2883 bool Finished = false;
2884 bool IsStmtReference = false;
2885 Expected<unsigned> MaybeStmtCode = Record.readRecord(Cursor, Entry.ID);
2886 if (!MaybeStmtCode) {
2887 Error(toString(MaybeStmtCode.takeError()));
2888 return nullptr;
2889 }
2890 switch ((StmtCode)MaybeStmtCode.get()) {
2891 case STMT_STOP:
2892 Finished = true;
2893 break;
2894
2895 case STMT_REF_PTR:
2896 IsStmtReference = true;
2897 assert(StmtEntries.contains(Record[0]) &&
2898 "No stmt was recorded for this offset reference!");
2899 S = StmtEntries[Record.readInt()];
2900 break;
2901
2902 case STMT_NULL_PTR:
2903 S = nullptr;
2904 break;
2905
2906 case STMT_NULL:
2907 S = new (Context) NullStmt(Empty);
2908 break;
2909
2910 case STMT_COMPOUND: {
2911 unsigned NumStmts = Record[ASTStmtReader::NumStmtFields];
2912 bool HasFPFeatures = Record[ASTStmtReader::NumStmtFields + 1];
2913 S = CompoundStmt::CreateEmpty(Context, NumStmts, HasFPFeatures);
2914 break;
2915 }
2916
2917 case STMT_CASE:
2919 Context,
2920 /*CaseStmtIsGNURange*/ Record[ASTStmtReader::NumStmtFields + 3]);
2921 break;
2922
2923 case STMT_DEFAULT:
2924 S = new (Context) DefaultStmt(Empty);
2925 break;
2926
2927 case STMT_LABEL:
2928 S = new (Context) LabelStmt(Empty);
2929 break;
2930
2931 case STMT_ATTRIBUTED:
2933 Context,
2934 /*NumAttrs*/Record[ASTStmtReader::NumStmtFields]);
2935 break;
2936
2937 case STMT_IF: {
2938 BitsUnpacker IfStmtBits(Record[ASTStmtReader::NumStmtFields]);
2939 bool HasElse = IfStmtBits.getNextBit();
2940 bool HasVar = IfStmtBits.getNextBit();
2941 bool HasInit = IfStmtBits.getNextBit();
2942 S = IfStmt::CreateEmpty(Context, HasElse, HasVar, HasInit);
2943 break;
2944 }
2945
2946 case STMT_SWITCH:
2948 Context,
2949 /* HasInit=*/Record[ASTStmtReader::NumStmtFields],
2950 /* HasVar=*/Record[ASTStmtReader::NumStmtFields + 1]);
2951 break;
2952
2953 case STMT_WHILE:
2955 Context,
2956 /* HasVar=*/Record[ASTStmtReader::NumStmtFields]);
2957 break;
2958
2959 case STMT_DO:
2960 S = new (Context) DoStmt(Empty);
2961 break;
2962
2963 case STMT_FOR:
2964 S = new (Context) ForStmt(Empty);
2965 break;
2966
2967 case STMT_GOTO:
2968 S = new (Context) GotoStmt(Empty);
2969 break;
2970
2971 case STMT_INDIRECT_GOTO:
2972 S = new (Context) IndirectGotoStmt(Empty);
2973 break;
2974
2975 case STMT_CONTINUE:
2976 S = new (Context) ContinueStmt(Empty);
2977 break;
2978
2979 case STMT_BREAK:
2980 S = new (Context) BreakStmt(Empty);
2981 break;
2982
2983 case STMT_RETURN:
2985 Context, /* HasNRVOCandidate=*/Record[ASTStmtReader::NumStmtFields]);
2986 break;
2987
2988 case STMT_DECL:
2989 S = new (Context) DeclStmt(Empty);
2990 break;
2991
2992 case STMT_GCCASM:
2993 S = new (Context) GCCAsmStmt(Empty);
2994 break;
2995
2996 case STMT_MSASM:
2997 S = new (Context) MSAsmStmt(Empty);
2998 break;
2999
3000 case STMT_CAPTURED:
3002 Context, Record[ASTStmtReader::NumStmtFields]);
3003 break;
3004
3005 case EXPR_CONSTANT:
3007 Context, static_cast<ConstantResultStorageKind>(
3008 /*StorageKind=*/Record[ASTStmtReader::NumExprFields]));
3009 break;
3010
3013 break;
3014
3015 case EXPR_PREDEFINED:
3017 Context,
3018 /*HasFunctionName*/ Record[ASTStmtReader::NumExprFields]);
3019 break;
3020
3021 case EXPR_DECL_REF: {
3022 BitsUnpacker DeclRefExprBits(Record[ASTStmtReader::NumExprFields]);
3023 DeclRefExprBits.advance(5);
3024 bool HasFoundDecl = DeclRefExprBits.getNextBit();
3025 bool HasQualifier = DeclRefExprBits.getNextBit();
3026 bool HasTemplateKWAndArgsInfo = DeclRefExprBits.getNextBit();
3027 unsigned NumTemplateArgs = HasTemplateKWAndArgsInfo
3029 : 0;
3030 S = DeclRefExpr::CreateEmpty(Context, HasQualifier, HasFoundDecl,
3031 HasTemplateKWAndArgsInfo, NumTemplateArgs);
3032 break;
3033 }
3034
3036 S = IntegerLiteral::Create(Context, Empty);
3037 break;
3038
3040 S = FixedPointLiteral::Create(Context, Empty);
3041 break;
3042
3044 S = FloatingLiteral::Create(Context, Empty);
3045 break;
3046
3048 S = new (Context) ImaginaryLiteral(Empty);
3049 break;
3050
3053 Context,
3054 /* NumConcatenated=*/Record[ASTStmtReader::NumExprFields],
3055 /* Length=*/Record[ASTStmtReader::NumExprFields + 1],
3056 /* CharByteWidth=*/Record[ASTStmtReader::NumExprFields + 2]);
3057 break;
3058
3060 S = new (Context) CharacterLiteral(Empty);
3061 break;
3062
3063 case EXPR_PAREN:
3064 S = new (Context) ParenExpr(Empty);
3065 break;
3066
3067 case EXPR_PAREN_LIST:
3069 Context,
3070 /* NumExprs=*/Record[ASTStmtReader::NumExprFields]);
3071 break;
3072
3073 case EXPR_UNARY_OPERATOR: {
3074 BitsUnpacker UnaryOperatorBits(Record[ASTStmtReader::NumStmtFields]);
3075 UnaryOperatorBits.advance(ASTStmtReader::NumExprBits);
3076 bool HasFPFeatures = UnaryOperatorBits.getNextBit();
3077 S = UnaryOperator::CreateEmpty(Context, HasFPFeatures);
3078 break;
3079 }
3080
3081 case EXPR_OFFSETOF:
3082 S = OffsetOfExpr::CreateEmpty(Context,
3084 Record[ASTStmtReader::NumExprFields + 1]);
3085 break;
3086
3088 S = new (Context) UnaryExprOrTypeTraitExpr(Empty);
3089 break;
3090
3092 S = new (Context) ArraySubscriptExpr(Empty);
3093 break;
3094
3096 S = new (Context) MatrixSubscriptExpr(Empty);
3097 break;
3098
3100 S = new (Context) OMPArraySectionExpr(Empty);
3101 break;
3102
3105 Context, Record[ASTStmtReader::NumExprFields]);
3106 break;
3107
3108 case EXPR_OMP_ITERATOR:
3109 S = OMPIteratorExpr::CreateEmpty(Context,
3111 break;
3112
3113 case EXPR_CALL: {
3114 auto NumArgs = Record[ASTStmtReader::NumExprFields];
3115 BitsUnpacker CallExprBits(Record[ASTStmtReader::NumExprFields + 1]);
3116 CallExprBits.advance(1);
3117 auto HasFPFeatures = CallExprBits.getNextBit();
3118 S = CallExpr::CreateEmpty(Context, NumArgs, HasFPFeatures, Empty);
3119 break;
3120 }
3121
3122 case EXPR_RECOVERY:
3124 Context, /*NumArgs=*/Record[ASTStmtReader::NumExprFields]);
3125 break;
3126
3127 case EXPR_MEMBER: {
3128 BitsUnpacker ExprMemberBits(Record[ASTStmtReader::NumExprFields]);
3129 bool HasQualifier = ExprMemberBits.getNextBit();
3130 bool HasFoundDecl = ExprMemberBits.getNextBit();
3131 bool HasTemplateInfo = ExprMemberBits.getNextBit();
3132 unsigned NumTemplateArgs = Record[ASTStmtReader::NumExprFields + 1];
3133 S = MemberExpr::CreateEmpty(Context, HasQualifier, HasFoundDecl,
3134 HasTemplateInfo, NumTemplateArgs);
3135 break;
3136 }
3137
3138 case EXPR_BINARY_OPERATOR: {
3139 BitsUnpacker BinaryOperatorBits(Record[ASTStmtReader::NumExprFields]);
3140 BinaryOperatorBits.advance(/*Size of opcode*/ 6);
3141 bool HasFPFeatures = BinaryOperatorBits.getNextBit();
3142 S = BinaryOperator::CreateEmpty(Context, HasFPFeatures);
3143 break;
3144 }
3145
3147 BitsUnpacker BinaryOperatorBits(Record[ASTStmtReader::NumExprFields]);
3148 BinaryOperatorBits.advance(/*Size of opcode*/ 6);
3149 bool HasFPFeatures = BinaryOperatorBits.getNextBit();
3150 S = CompoundAssignOperator::CreateEmpty(Context, HasFPFeatures);
3151 break;
3152 }
3153
3155 S = new (Context) ConditionalOperator(Empty);
3156 break;
3157
3159 S = new (Context) BinaryConditionalOperator(Empty);
3160 break;
3161
3162 case EXPR_IMPLICIT_CAST: {
3163 unsigned PathSize = Record[ASTStmtReader::NumExprFields];
3164 BitsUnpacker CastExprBits(Record[ASTStmtReader::NumExprFields + 1]);
3165 CastExprBits.advance(7);
3166 bool HasFPFeatures = CastExprBits.getNextBit();
3167 S = ImplicitCastExpr::CreateEmpty(Context, PathSize, HasFPFeatures);
3168 break;
3169 }
3170
3171 case EXPR_CSTYLE_CAST: {
3172 unsigned PathSize = Record[ASTStmtReader::NumExprFields];
3173 BitsUnpacker CastExprBits(Record[ASTStmtReader::NumExprFields + 1]);
3174 CastExprBits.advance(7);
3175 bool HasFPFeatures = CastExprBits.getNextBit();
3176 S = CStyleCastExpr::CreateEmpty(Context, PathSize, HasFPFeatures);
3177 break;
3178 }
3179
3181 S = new (Context) CompoundLiteralExpr(Empty);
3182 break;
3183
3185 S = new (Context) ExtVectorElementExpr(Empty);
3186 break;
3187
3188 case EXPR_INIT_LIST:
3189 S = new (Context) InitListExpr(Empty);
3190 break;
3191
3194 Record[ASTStmtReader::NumExprFields] - 1);
3195
3196 break;
3197
3199 S = new (Context) DesignatedInitUpdateExpr(Empty);
3200 break;
3201
3203 S = new (Context) ImplicitValueInitExpr(Empty);
3204 break;
3205
3206 case EXPR_NO_INIT:
3207 S = new (Context) NoInitExpr(Empty);
3208 break;
3209
3211 S = new (Context) ArrayInitLoopExpr(Empty);
3212 break;
3213
3215 S = new (Context) ArrayInitIndexExpr(Empty);
3216 break;
3217
3218 case EXPR_VA_ARG:
3219 S = new (Context) VAArgExpr(Empty);
3220 break;
3221
3222 case EXPR_SOURCE_LOC:
3223 S = new (Context) SourceLocExpr(Empty);
3224 break;
3225
3226 case EXPR_ADDR_LABEL:
3227 S = new (Context) AddrLabelExpr(Empty);
3228 break;
3229
3230 case EXPR_STMT:
3231 S = new (Context) StmtExpr(Empty);
3232 break;
3233
3234 case EXPR_CHOOSE:
3235 S = new (Context) ChooseExpr(Empty);
3236 break;
3237
3238 case EXPR_GNU_NULL:
3239 S = new (Context) GNUNullExpr(Empty);
3240 break;
3241
3243 S = new (Context) ShuffleVectorExpr(Empty);
3244 break;
3245
3247 S = new (Context) ConvertVectorExpr(Empty);
3248 break;
3249
3250 case EXPR_BLOCK:
3251 S = new (Context) BlockExpr(Empty);
3252 break;
3253
3256 Context,
3257 /*NumAssocs=*/Record[ASTStmtReader::NumExprFields]);
3258 break;
3259
3261 S = new (Context) ObjCStringLiteral(Empty);
3262 break;
3263
3265 S = new (Context) ObjCBoxedExpr(Empty);
3266 break;
3267
3271 break;
3272
3276 Record[ASTStmtReader::NumExprFields + 1]);
3277 break;
3278
3279 case EXPR_OBJC_ENCODE:
3280 S = new (Context) ObjCEncodeExpr(Empty);
3281 break;
3282
3284 S = new (Context) ObjCSelectorExpr(Empty);
3285 break;
3286
3288 S = new (Context) ObjCProtocolExpr(Empty);
3289 break;
3290
3292 S = new (Context) ObjCIvarRefExpr(Empty);
3293 break;
3294
3296 S = new (Context) ObjCPropertyRefExpr(Empty);
3297 break;
3298
3300 S = new (Context) ObjCSubscriptRefExpr(Empty);
3301 break;
3302
3304 llvm_unreachable("mismatching AST file");
3305
3307 S = ObjCMessageExpr::CreateEmpty(Context,
3309 Record[ASTStmtReader::NumExprFields + 1]);
3310 break;
3311
3312 case EXPR_OBJC_ISA:
3313 S = new (Context) ObjCIsaExpr(Empty);
3314 break;
3315
3317 S = new (Context) ObjCIndirectCopyRestoreExpr(Empty);
3318 break;
3319
3321 S = new (Context) ObjCBridgedCastExpr(Empty);
3322 break;
3323
3325 S = new (Context) ObjCForCollectionStmt(Empty);
3326 break;
3327
3328 case STMT_OBJC_CATCH:
3329 S = new (Context) ObjCAtCatchStmt(Empty);
3330 break;
3331
3332 case STMT_OBJC_FINALLY:
3333 S = new (Context) ObjCAtFinallyStmt(Empty);
3334 break;
3335
3336 case STMT_OBJC_AT_TRY:
3337 S = ObjCAtTryStmt::CreateEmpty(Context,
3339 Record[ASTStmtReader::NumStmtFields + 1]);
3340 break;
3341
3343 S = new (Context) ObjCAtSynchronizedStmt(Empty);
3344 break;
3345
3346 case STMT_OBJC_AT_THROW:
3347 S = new (Context) ObjCAtThrowStmt(Empty);
3348 break;
3349
3351 S = new (Context) ObjCAutoreleasePoolStmt(Empty);
3352 break;
3353
3355 S = new (Context) ObjCBoolLiteralExpr(Empty);
3356 break;
3357
3359 S = new (Context) ObjCAvailabilityCheckExpr(Empty);
3360 break;
3361
3362 case STMT_SEH_LEAVE:
3363 S = new (Context) SEHLeaveStmt(Empty);
3364 break;
3365
3366 case STMT_SEH_EXCEPT:
3367 S = new (Context) SEHExceptStmt(Empty);
3368 break;
3369
3370 case STMT_SEH_FINALLY:
3371 S = new (Context) SEHFinallyStmt(Empty);
3372 break;
3373
3374 case STMT_SEH_TRY:
3375 S = new (Context) SEHTryStmt(Empty);
3376 break;
3377
3378 case STMT_CXX_CATCH:
3379 S = new (Context) CXXCatchStmt(Empty);
3380 break;
3381
3382 case STMT_CXX_TRY:
3383 S = CXXTryStmt::Create(Context, Empty,
3384 /*numHandlers=*/Record[ASTStmtReader::NumStmtFields]);
3385 break;
3386
3387 case STMT_CXX_FOR_RANGE:
3388 S = new (Context) CXXForRangeStmt(Empty);
3389 break;
3390
3392 S = new (Context) MSDependentExistsStmt(SourceLocation(), true,
3395 nullptr);
3396 break;
3397
3399 S = OMPCanonicalLoop::createEmpty(Context);
3400 break;
3401
3404 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3405 break;
3406
3408 S =
3411 Empty);
3412 break;
3413
3415 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3416 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3417 S = OMPSimdDirective::CreateEmpty(Context, NumClauses,
3418 CollapsedNum, Empty);
3419 break;
3420 }
3421
3423 unsigned NumLoops = Record[ASTStmtReader::NumStmtFields];
3424 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3425 S = OMPTileDirective::CreateEmpty(Context, NumClauses, NumLoops);
3426 break;
3427 }
3428
3430 assert(Record[ASTStmtReader::NumStmtFields] == 1 && "Unroll directive accepts only a single loop");
3431 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3432 S = OMPUnrollDirective::CreateEmpty(Context, NumClauses);
3433 break;
3434 }
3435
3437 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3438 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3439 S = OMPForDirective::CreateEmpty(Context, NumClauses, CollapsedNum,
3440 Empty);
3441 break;
3442 }
3443
3445 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3446 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3447 S = OMPForSimdDirective::CreateEmpty(Context, NumClauses, CollapsedNum,
3448 Empty);
3449 break;
3450 }
3451
3454 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3455 break;
3456
3458 S = OMPSectionDirective::CreateEmpty(Context, Empty);
3459 break;
3460
3463 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3464 break;
3465
3468 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3469 break;
3470
3472 S = OMPMasterDirective::CreateEmpty(Context, Empty);
3473 break;
3474
3477 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3478 break;
3479
3481 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3482 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3483 S = OMPParallelForDirective::CreateEmpty(Context, NumClauses,
3484 CollapsedNum, Empty);
3485 break;
3486 }
3487
3489 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3490 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3491 S = OMPParallelForSimdDirective::CreateEmpty(Context, NumClauses,
3492 CollapsedNum, Empty);
3493 break;
3494 }
3495
3498 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3499 break;
3500
3503 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3504 break;
3505
3508 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3509 break;
3510
3513 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3514 break;
3515
3517 S = OMPTaskyieldDirective::CreateEmpty(Context, Empty);
3518 break;
3519
3521 S = OMPBarrierDirective::CreateEmpty(Context, Empty);
3522 break;
3523
3526 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3527 break;
3528
3531 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3532 break;
3533
3536 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3537 break;
3538
3541 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3542 break;
3543
3546 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3547 break;
3548
3551 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3552 break;
3553
3555 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
3556 bool HasAssociatedStmt = Record[ASTStmtReader::NumStmtFields + 2];
3557 S = OMPOrderedDirective::CreateEmpty(Context, NumClauses,
3558 !HasAssociatedStmt, Empty);
3559 break;
3560 }
3561
3564 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3565 break;
3566
3569 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3570 break;
3571
3574 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3575 break;
3576
3579 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3580 break;
3581
3584 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3585 break;
3586
3589 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3590 break;
3591
3593 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3594 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3595 S = OMPTargetParallelForDirective::CreateEmpty(Context, NumClauses,
3596 CollapsedNum, Empty);
3597 break;
3598 }
3599
3602 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3603 break;
3604
3607 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3608 break;
3609
3612 break;
3613
3616 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3617 break;
3618
3620 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3621 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3622 S = OMPTaskLoopDirective::CreateEmpty(Context, NumClauses, CollapsedNum,
3623 Empty);
3624 break;
3625 }
3626
3628 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3629 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3630 S = OMPTaskLoopSimdDirective::CreateEmpty(Context, NumClauses,
3631 CollapsedNum, Empty);
3632 break;
3633 }
3634
3636 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3637 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3638 S = OMPMasterTaskLoopDirective::CreateEmpty(Context, NumClauses,
3639 CollapsedNum, Empty);
3640 break;
3641 }
3642
3644 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3645 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3646 S = OMPMaskedTaskLoopDirective::CreateEmpty(Context, NumClauses,
3647 CollapsedNum, Empty);
3648 break;
3649 }
3650
3652 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3653 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3654 S = OMPMasterTaskLoopSimdDirective::CreateEmpty(Context, NumClauses,
3655 CollapsedNum, Empty);
3656 break;
3657 }
3658
3660 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3661 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3662 S = OMPMaskedTaskLoopSimdDirective::CreateEmpty(Context, NumClauses,
3663 CollapsedNum, Empty);
3664 break;
3665 }
3666
3668 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3669 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3671 CollapsedNum, Empty);
3672 break;
3673 }
3674
3676 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3677 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3679 CollapsedNum, Empty);
3680 break;
3681 }
3682
3684 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3685 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3687 Context, NumClauses, CollapsedNum, Empty);
3688 break;
3689 }
3690
3692 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3693 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3695 Context, NumClauses, CollapsedNum, Empty);
3696 break;
3697 }
3698
3700 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3701 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3702 S = OMPDistributeDirective::CreateEmpty(Context, NumClauses, CollapsedNum,
3703 Empty);
3704 break;
3705 }
3706
3708 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3709 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3710 S = OMPDistributeParallelForDirective::CreateEmpty(Context, NumClauses,
3711 CollapsedNum, Empty);
3712 break;
3713 }
3714
3716 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3717 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3719 CollapsedNum,
3720 Empty);
3721 break;
3722 }
3723
3725 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3726 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3727 S = OMPDistributeSimdDirective::CreateEmpty(Context, NumClauses,
3728 CollapsedNum, Empty);
3729 break;
3730 }
3731
3733 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3734 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3735 S = OMPTargetParallelForSimdDirective::CreateEmpty(Context, NumClauses,
3736 CollapsedNum, Empty);
3737 break;
3738 }
3739
3741 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3742 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3743 S = OMPTargetSimdDirective::CreateEmpty(Context, NumClauses, CollapsedNum,
3744 Empty);
3745 break;
3746 }
3747
3749 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3750 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3751 S = OMPTeamsDistributeDirective::CreateEmpty(Context, NumClauses,
3752 CollapsedNum, Empty);
3753 break;
3754 }
3755
3757 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3758 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3759 S = OMPTeamsDistributeSimdDirective::CreateEmpty(Context, NumClauses,
3760 CollapsedNum, Empty);
3761 break;
3762 }
3763
3765 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3766 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3768 Context, NumClauses, CollapsedNum, Empty);
3769 break;
3770 }
3771
3773 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3774 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3776 Context, NumClauses, CollapsedNum, Empty);
3777 break;
3778 }
3779
3782 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3783 break;
3784
3786 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3787 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3788 S = OMPTargetTeamsDistributeDirective::CreateEmpty(Context, NumClauses,
3789 CollapsedNum, Empty);
3790 break;
3791 }
3792
3794 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3795 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3797 Context, NumClauses, CollapsedNum, Empty);
3798 break;
3799 }
3800
3802 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3803 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3805 Context, NumClauses, CollapsedNum, Empty);
3806 break;
3807 }
3808
3810 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3811 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3813 Context, NumClauses, CollapsedNum, Empty);
3814 break;
3815 }
3816
3819 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3820 break;
3821
3824 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3825 break;
3826
3829 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3830 break;
3831
3833 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3834 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3835 S = OMPGenericLoopDirective::CreateEmpty(Context, NumClauses,
3836 CollapsedNum, Empty);
3837 break;
3838 }
3839
3841 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3842 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3843 S = OMPTeamsGenericLoopDirective::CreateEmpty(Context, NumClauses,
3844 CollapsedNum, Empty);
3845 break;
3846 }
3847
3849 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3850 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3852 CollapsedNum, Empty);
3853 break;
3854 }
3855
3857 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3858 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3859 S = OMPParallelGenericLoopDirective::CreateEmpty(Context, NumClauses,
3860 CollapsedNum, Empty);
3861 break;
3862 }
3863
3865 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3866 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3868 Context, NumClauses, CollapsedNum, Empty);
3869 break;
3870 }
3871
3873 auto NumArgs = Record[ASTStmtReader::NumExprFields];
3874 BitsUnpacker CallExprBits(Record[ASTStmtReader::NumExprFields + 1]);
3875 CallExprBits.advance(1);
3876 auto HasFPFeatures = CallExprBits.getNextBit();
3877 S = CXXOperatorCallExpr::CreateEmpty(Context, NumArgs, HasFPFeatures,
3878 Empty);
3879 break;
3880 }
3881
3882 case EXPR_CXX_MEMBER_CALL: {
3883 auto NumArgs = Record[ASTStmtReader::NumExprFields];
3884 BitsUnpacker CallExprBits(Record[ASTStmtReader::NumExprFields + 1]);
3885 CallExprBits.advance(1);
3886 auto HasFPFeatures = CallExprBits.getNextBit();
3887 S = CXXMemberCallExpr::CreateEmpty(Context, NumArgs, HasFPFeatures,
3888 Empty);
3889 break;
3890 }
3891
3893 S = new (Context) CXXRewrittenBinaryOperator(Empty);
3894 break;
3895
3896 case EXPR_CXX_CONSTRUCT:
3898 Context,
3899 /* NumArgs=*/Record[ASTStmtReader::NumExprFields]);
3900 break;
3901
3903 S = new (Context) CXXInheritedCtorInitExpr(Empty);
3904 break;
3905
3908 Context,
3909 /* NumArgs=*/Record[ASTStmtReader::NumExprFields]);
3910 break;
3911
3912 case EXPR_CXX_STATIC_CAST: {
3913 unsigned PathSize = Record[ASTStmtReader::NumExprFields];
3914 BitsUnpacker CastExprBits(Record[ASTStmtReader::NumExprFields + 1]);
3915 CastExprBits.advance(7);
3916 bool HasFPFeatures = CastExprBits.getNextBit();
3917 S = CXXStaticCastExpr::CreateEmpty(Context, PathSize, HasFPFeatures);
3918 break;
3919 }
3920
3921 case EXPR_CXX_DYNAMIC_CAST: {
3922 unsigned PathSize = Record[ASTStmtReader::NumExprFields];
3923 S = CXXDynamicCastExpr::CreateEmpty(Context, PathSize);
3924 break;
3925 }
3926
3928 unsigned PathSize = Record[ASTStmtReader::NumExprFields];
3929 S = CXXReinterpretCastExpr::CreateEmpty(Context, PathSize);
3930 break;
3931 }
3932
3934 S = CXXConstCastExpr::CreateEmpty(Context);
3935 break;
3936
3939 break;
3940
3942 unsigned PathSize = Record[ASTStmtReader::NumExprFields];
3943 BitsUnpacker CastExprBits(Record[ASTStmtReader::NumExprFields + 1]);
3944 CastExprBits.advance(7);
3945 bool HasFPFeatures = CastExprBits.getNextBit();
3946 S = CXXFunctionalCastExpr::CreateEmpty(Context, PathSize, HasFPFeatures);
3947 break;
3948 }
3949
3950 case EXPR_BUILTIN_BIT_CAST: {
3951#ifndef NDEBUG
3952 unsigned PathSize = Record[ASTStmtReader::NumExprFields];
3953 assert(PathSize == 0 && "Wrong PathSize!");
3954#endif
3955 S = new (Context) BuiltinBitCastExpr(Empty);
3956 break;
3957 }
3958
3960 auto NumArgs = Record[ASTStmtReader::NumExprFields];
3961 BitsUnpacker CallExprBits(Record[ASTStmtReader::NumExprFields + 1]);
3962 CallExprBits.advance(1);
3963 auto HasFPFeatures = CallExprBits.getNextBit();
3964 S = UserDefinedLiteral::CreateEmpty(Context, NumArgs, HasFPFeatures,
3965 Empty);
3966 break;
3967 }
3968
3970 S = new (Context) CXXStdInitializerListExpr(Empty);
3971 break;
3972
3974 S = new (Context) CXXBoolLiteralExpr(Empty);
3975 break;
3976
3978 S = new (Context) CXXNullPtrLiteralExpr(Empty);
3979 break;
3980
3982 S = new (Context) CXXTypeidExpr(Empty, true);
3983 break;
3984
3986 S = new (Context) CXXTypeidExpr(Empty, false);
3987 break;
3988
3990 S = new (Context) CXXUuidofExpr(Empty, true);
3991 break;
3992
3994 S = new (Context) MSPropertyRefExpr(Empty);
3995 break;
3996
3998 S = new (Context) MSPropertySubscriptExpr(Empty);
3999 break;
4000
4002 S = new (Context) CXXUuidofExpr(Empty, false);
4003 break;
4004
4005 case EXPR_CXX_THIS:
4006 S = CXXThisExpr::CreateEmpty(Context);
4007 break;
4008
4009 case EXPR_CXX_THROW:
4010 S = new (Context) CXXThrowExpr(Empty);
4011 break;
4012
4015 Context, /*HasRewrittenInit=*/Record[ASTStmtReader::NumExprFields]);
4016 break;
4017
4020 Context, /*HasRewrittenInit=*/Record[ASTStmtReader::NumExprFields]);
4021 break;
4022
4024 S = new (Context) CXXBindTemporaryExpr(Empty);
4025 break;
4026
4028 S = new (Context) CXXScalarValueInitExpr(Empty);
4029 break;
4030
4031 case EXPR_CXX_NEW:
4033 Context,
4034 /*IsArray=*/Record[ASTStmtReader::NumExprFields],
4035 /*HasInit=*/Record[ASTStmtReader::NumExprFields + 1],
4036 /*NumPlacementArgs=*/Record[ASTStmtReader::NumExprFields + 2],
4037 /*IsParenTypeId=*/Record[ASTStmtReader::NumExprFields + 3]);
4038 break;
4039
4040 case EXPR_CXX_DELETE:
4041 S = new (Context) CXXDeleteExpr(Empty);
4042 break;
4043
4045 S = new (Context) CXXPseudoDestructorExpr(Empty);
4046 break;
4047
4049 S = ExprWithCleanups::Create(Context, Empty,
4051 break;
4052
4054 unsigned NumTemplateArgs = Record[ASTStmtReader::NumExprFields];
4055 BitsUnpacker DependentScopeMemberBits(
4056 Record[ASTStmtReader::NumExprFields + 1]);
4057 bool HasTemplateKWAndArgsInfo = DependentScopeMemberBits.getNextBit();
4058
4059 bool HasFirstQualifierFoundInScope =
4060 DependentScopeMemberBits.getNextBit();
4062 Context, HasTemplateKWAndArgsInfo, NumTemplateArgs,
4063 HasFirstQualifierFoundInScope);
4064 break;
4065 }
4066
4068 BitsUnpacker DependentScopeDeclRefBits(
4070 DependentScopeDeclRefBits.advance(ASTStmtReader::NumExprBits);
4071 bool HasTemplateKWAndArgsInfo = DependentScopeDeclRefBits.getNextBit();
4072 unsigned NumTemplateArgs =
4073 HasTemplateKWAndArgsInfo
4074 ? DependentScopeDeclRefBits.getNextBits(/*Width=*/16)
4075 : 0;
4077 Context, HasTemplateKWAndArgsInfo, NumTemplateArgs);
4078 break;
4079 }
4080
4083 /*NumArgs=*/Record[ASTStmtReader::NumExprFields]);
4084 break;
4085
4087 auto NumResults = Record[ASTStmtReader::NumExprFields];
4088 BitsUnpacker OverloadExprBits(Record[ASTStmtReader::NumExprFields + 1]);
4089 auto HasTemplateKWAndArgsInfo = OverloadExprBits.getNextBit();
4090 auto NumTemplateArgs = HasTemplateKWAndArgsInfo
4092 : 0;
4094 Context, NumResults, HasTemplateKWAndArgsInfo, NumTemplateArgs);
4095 break;
4096 }
4097
4099 auto NumResults = Record[ASTStmtReader::NumExprFields];
4100 BitsUnpacker OverloadExprBits(Record[ASTStmtReader::NumExprFields + 1]);
4101 auto HasTemplateKWAndArgsInfo = OverloadExprBits.getNextBit();
4102 auto NumTemplateArgs = HasTemplateKWAndArgsInfo
4104 : 0;
4106 Context, NumResults, HasTemplateKWAndArgsInfo, NumTemplateArgs);
4107 break;
4108 }
4109
4110 case EXPR_TYPE_TRAIT:
4113 break;
4114
4116 S = new (Context) ArrayTypeTraitExpr(Empty);
4117 break;
4118
4120 S = new (Context) ExpressionTraitExpr(Empty);
4121 break;
4122
4123 case EXPR_CXX_NOEXCEPT:
4124 S = new (Context) CXXNoexceptExpr(Empty);
4125 break;
4126
4128 S = new (Context) PackExpansionExpr(Empty);
4129 break;
4130
4131 case EXPR_SIZEOF_PACK:
4133 Context,
4134 /*NumPartialArgs=*/Record[ASTStmtReader::NumExprFields]);
4135 break;
4136
4137 case EXPR_PACK_INDEXING:
4139 Context,
4140 /*TransformedExprs=*/Record[ASTStmtReader::NumExprFields]);
4141 break;
4142
4144 S = new (Context) SubstNonTypeTemplateParmExpr(Empty);
4145 break;
4146
4148 S = new (Context) SubstNonTypeTemplateParmPackExpr(Empty);
4149 break;
4150
4154 break;
4155
4157 S = new (Context) MaterializeTemporaryExpr(Empty);
4158 break;
4159
4160 case EXPR_CXX_FOLD:
4161 S = new (Context) CXXFoldExpr(Empty);
4162 break;
4163
4166 Context, /*numExprs=*/Record[ASTStmtReader::NumExprFields], Empty);
4167 break;
4168
4169 case EXPR_OPAQUE_VALUE:
4170 S = new (Context) OpaqueValueExpr(Empty);
4171 break;
4172
4173 case EXPR_CUDA_KERNEL_CALL: {
4174 auto NumArgs = Record[ASTStmtReader::NumExprFields];
4175 BitsUnpacker CallExprBits(Record[ASTStmtReader::NumExprFields + 1]);
4176 CallExprBits.advance(1);
4177 auto HasFPFeatures = CallExprBits.getNextBit();
4178 S = CUDAKernelCallExpr::CreateEmpty(Context, NumArgs, HasFPFeatures,
4179 Empty);
4180 break;
4181 }
4182
4183 case EXPR_ASTYPE:
4184 S = new (Context) AsTypeExpr(Empty);
4185 break;
4186
4187 case EXPR_PSEUDO_OBJECT: {
4188 unsigned numSemanticExprs = Record[ASTStmtReader::NumExprFields];
4189 S = PseudoObjectExpr::Create(Context, Empty, numSemanticExprs);
4190 break;
4191 }
4192
4193 case EXPR_ATOMIC:
4194 S = new (Context) AtomicExpr(Empty);
4195 break;
4196
4197 case EXPR_LAMBDA: {
4198 unsigned NumCaptures = Record[ASTStmtReader::NumExprFields];
4199 S = LambdaExpr::CreateDeserialized(Context, NumCaptures);
4200 break;
4201 }
4202
4203 case STMT_COROUTINE_BODY: {
4204 unsigned NumParams = Record[ASTStmtReader::NumStmtFields];
4205 S = CoroutineBodyStmt::Create(Context, Empty, NumParams);
4206 break;
4207 }
4208
4209 case STMT_CORETURN:
4210 S = new (Context) CoreturnStmt(Empty);
4211 break;
4212
4213 case EXPR_COAWAIT:
4214 S = new (Context) CoawaitExpr(Empty);
4215 break;
4216
4217 case EXPR_COYIELD:
4218 S = new (Context) CoyieldExpr(Empty);
4219 break;
4220
4222 S = new (Context) DependentCoawaitExpr(Empty);
4223 break;
4224
4226 S = new (Context) ConceptSpecializationExpr(Empty);
4227 break;
4228 }
4230 S = OpenACCComputeConstruct::CreateEmpty(Context, Empty);
4231 break;
4232
4233 case EXPR_REQUIRES:
4234 unsigned numLocalParameters = Record[ASTStmtReader::NumExprFields];
4235 unsigned numRequirement = Record[ASTStmtReader::NumExprFields + 1];
4236 S = RequiresExpr::Create(Context, Empty, numLocalParameters,
4237 numRequirement);
4238 break;
4239 }
4240
4241 // We hit a STMT_STOP, so we're done with this expression.
4242 if (Finished)
4243 break;
4244
4245 ++NumStatementsRead;
4246
4247 if (S && !IsStmtReference) {
4248 Reader.Visit(S);
4249 StmtEntries[Cursor.GetCurrentBitNo()] = S;
4250 }
4251
4252 assert(Record.getIdx() == Record.size() &&
4253 "Invalid deserialization of statement");
4254 StmtStack.push_back(S);
4255 }
4256Done:
4257 assert(StmtStack.size() > PrevNumStmts && "Read too many sub-stmts!");
4258 assert(StmtStack.size() == PrevNumStmts + 1 && "Extra expressions on stack!");
4259 return StmtStack.pop_back_val();
4260}
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)
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.
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.
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
void setValue(const ASTContext &C, const llvm::APInt &Val)
bool needsCleanup() const
Returns whether the object performed allocations.
Definition: APValue.cpp:431
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:182
const TargetInfo & getTargetInfo() const
Definition: ASTContext.h:752
void addDestruction(T *Ptr) const
If T isn't trivially destructible, calls AddDeallocation to register it for destruction.
Definition: ASTContext.h:3082
ASTContext & getContext()
Retrieve the AST context that this AST reader supplements.
Definition: ASTReader.h:2356
Stmt * ReadSubStmt()
Reads a sub-statement operand during statement reading.
Definition: ASTReader.h:2311
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.
bool readBool()
Read a boolean value, advancing Idx.
std::string readString()
Read a string, advancing Idx.
Decl * readDecl()
Reads a declaration from the given position in a record in the given module, advancing Idx.
uint32_t readUInt32()
Read a 32-bit unsigned value; required to satisfy BasicReader.
llvm::APFloat readAPFloat(const llvm::fltSemantics &Sem)
Read an arbitrary constant value, advancing Idx.
Definition: ASTReader.cpp:9333
TemplateArgumentLoc readTemplateArgumentLoc()
Reads a TemplateArgumentLoc, advancing Idx.
Definition: ASTReader.cpp:7476
void readAttributes(AttrVec &Attrs)
Reads attributes from the current stream position, advancing Idx.
unsigned getIdx() const
The current position in this record.
DeclarationNameLoc readDeclarationNameLoc(DeclarationName Name)
Read a declaration name, advancing Idx.
Definition: ASTReader.cpp:9086
CXXBaseSpecifier readCXXBaseSpecifier()
Read a C++ base specifier, advancing Idx.
Definition: ASTReader.cpp:9172
QualType readType()
Read a type from the current position in the record.
T * readDeclAs()
Reads a declaration from the given position in the record, advancing Idx.
DeclarationNameInfo readDeclarationNameInfo()
Definition: ASTReader.cpp:9111
size_t size() const
The length of this record.
IdentifierInfo * readIdentifier()
TemplateArgument readTemplateArgument(bool Canonicalize)
ASTContext & getContext()
Retrieve the AST context that this AST reader supplements.
TypeSourceInfo * readTypeSourceInfo()
Reads a declarator info from the given record, advancing Idx.
Definition: ASTReader.cpp:7121
uint64_t peekInt()
Returns the current value in this record, without advancing.
void skipInts(unsigned N)
Skips the specified number of values.
SourceRange readSourceRange(LocSeq *Seq=nullptr)
Read a source range, advancing Idx.
NestedNameSpecifierLoc readNestedNameSpecifierLoc()
Return a nested name specifier, advancing Idx.
Definition: ASTReader.cpp:9252
ConceptReference * readConceptReference()
Definition: ASTReader.cpp:6961
SwitchCase * getSwitchCaseWithID(unsigned ID)
Retrieve the switch-case statement with the given ID.
Token readToken()
Reads a token out of a record, advancing Idx.
void recordSwitchCaseID(SwitchCase *SC, unsigned ID)
void readOMPChildren(OMPChildren *Data)
Read an OpenMP children, advancing Idx.
Selector readSelector()
Read a selector from the Record, advancing Idx.
CXXTemporary * readCXXTemporary()
TemplateParameterList * readTemplateParameterList()
Read a template parameter list, advancing Idx.
Definition: ASTReader.cpp:9132
VersionTuple readVersionTuple()
Read a version tuple, advancing Idx.
Stmt * readStmt()
Reads a statement.
Stmt * readSubStmt()
Reads a sub-statement operand during statement reading.
uint64_t readInt()
Returns the current value in this record, and advances to the next value.
Expr * readExpr()
Reads an expression.
SourceLocation readSourceLocation(LocSeq *Seq=nullptr)
Read a source location, advancing Idx.
Expr * readSubExpr()
Reads a sub-expression operand during statement reading.
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:4308
void setLabel(LabelDecl *L)
Definition: Expr.h:4332
void setLabelLoc(SourceLocation L)
Definition: Expr.h:4326
void setAmpAmpLoc(SourceLocation L)
Definition: Expr.h:4324
Represents the index of the current element of an array being initialized by an ArrayInitLoopExpr.
Definition: Expr.h:5534
Represents a loop initializing the elements of an array.
Definition: Expr.h:5481
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
Definition: Expr.h:2639
void setRHS(Expr *E)
Definition: Expr.h:2674
void setRBracketLoc(SourceLocation L)
Definition: Expr.h:2690
void setLHS(Expr *E)
Definition: Expr.h:2670
An Embarcadero array type trait, as used in the implementation of __array_rank and __array_extent.
Definition: ExprCXX.h:2836
AsTypeExpr - Clang builtin function __builtin_astype [OpenCL 6.2.4.2] This AST node provides support ...
Definition: Expr.h:6204
AsmStmt is the base class for GCCAsmStmt and MSAsmStmt.
Definition: Stmt.h:3098
AtomicExpr - Variadic atomic builtins: __atomic_exchange, __atomic_fetch_*, __atomic_load,...
Definition: Expr.h:6407
unsigned getNumSubExprs() const
Definition: Expr.h:6482
Represents an attribute applied to a statement.
Definition: Stmt.h:2078
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:4211
A builtin binary operation expression such as "x + y" or "x <= y".
Definition: Expr.h:3810
void setLHS(Expr *E)
Definition: Expr.h:3860
void setHasStoredFPFeatures(bool B)
Set and fetch the bit that shows whether FPFeatures needs to be allocated in Trailing Storage.
Definition: Expr.h:3993
void setOperatorLoc(SourceLocation L)
Definition: Expr.h:3852
void setRHS(Expr *E)
Definition: Expr.h:3862
static BinaryOperator * CreateEmpty(const ASTContext &C, bool hasFPFeatures)
Definition: Expr.cpp:4732
void setStoredFPFeatures(FPOptionsOverride F)
Set FPFeatures in trailing storage, used only by Serialization.
Definition: Expr.h:4002
void setOpcode(Opcode Opc)
Definition: Expr.h:3857
A simple helper class to unpack an integer to bits and consuming the bits in order.
Definition: ASTReader.h:2418
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
Definition: Expr.h:6143
void setBlockDecl(BlockDecl *BD)
Definition: Expr.h:6157
BreakStmt - This represents a break.
Definition: Stmt.h:2978
Represents a C++2a __builtin_bit_cast(T, v) expression.
Definition: ExprCXX.h:5230
CStyleCastExpr - An explicit cast in C (C99 6.5.4) or a C-style cast in C++ (C++ [expr....
Definition: Expr.h:3741
static CStyleCastExpr * CreateEmpty(const ASTContext &Context, unsigned PathSize, bool HasFPFeatures)
Definition: Expr.cpp:2098
void setRParenLoc(SourceLocation L)
Definition: Expr.h:3777
void setLParenLoc(SourceLocation L)
Definition: Expr.h:3774
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:1872
A C++ addrspace_cast expression (currently only enabled for OpenCL).
Definition: ExprCXX.h:601
static CXXAddrspaceCastExpr * CreateEmpty(const ASTContext &Context)
Definition: ExprCXX.cpp:848
Represents a base class of a C++ class.
Definition: DeclCXX.h:146
Represents binding an expression to a temporary.
Definition: ExprCXX.h:1475
void setTemporary(CXXTemporary *T)
Definition: ExprCXX.h:1495
void setSubExpr(Expr *E)
Definition: ExprCXX.h:1499
A boolean literal, per ([C++ lex.bool] Boolean literals).
Definition: ExprCXX.h:720
void setValue(bool V)
Definition: ExprCXX.h:738
void setLocation(SourceLocation L)
Definition: ExprCXX.h:744
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:835
Represents a call to a C++ constructor.
Definition: ExprCXX.h:1530
void setArg(unsigned Arg, Expr *ArgExpr)
Set the specified argument.
Definition: ExprCXX.h:1683
unsigned getNumArgs() const
Return the number of arguments to the constructor call.
Definition: ExprCXX.h:1670
static CXXConstructExpr * CreateEmpty(const ASTContext &Ctx, unsigned NumArgs)
Create an empty C++ construction expression.
Definition: ExprCXX.cpp:1125
A default argument (C++ [dcl.fct.default]).
Definition: ExprCXX.h:1254
static CXXDefaultArgExpr * CreateEmpty(const ASTContext &C, bool HasRewrittenInit)
Definition: ExprCXX.cpp:962
A use of a default initializer in a constructor or in aggregate initialization.
Definition: ExprCXX.h:1361
static CXXDefaultInitExpr * CreateEmpty(const ASTContext &C, bool HasRewrittenInit)
Definition: ExprCXX.cpp:1016
Represents a delete expression for memory deallocation and destructor calls, e.g.
Definition: ExprCXX.h:2481
Represents a C++ member access expression where the actual member referenced could not be resolved be...
Definition: ExprCXX.h:3645
unsigned getNumTemplateArgs() const
Retrieve the number of template arguments provided as part of this template-id.
Definition: ExprCXX.h:3843
static CXXDependentScopeMemberExpr * CreateEmpty(const ASTContext &Ctx, bool HasTemplateKWAndArgsInfo, unsigned NumTemplateArgs, bool HasFirstQualifierFoundInScope)
Definition: ExprCXX.cpp:1505
A C++ dynamic_cast expression (C++ [expr.dynamic.cast]).
Definition: ExprCXX.h:478
static CXXDynamicCastExpr * CreateEmpty(const ASTContext &Context, unsigned pathSize)
Definition: ExprCXX.cpp:757
Represents a folding of a pack over an operator.
Definition: ExprCXX.h:4791
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:1801
void setLParenLoc(SourceLocation L)
Definition: ExprCXX.h:1839
static CXXFunctionalCastExpr * CreateEmpty(const ASTContext &Context, unsigned PathSize, bool HasFPFeatures)
Definition: ExprCXX.cpp:868
void setRParenLoc(SourceLocation L)
Definition: ExprCXX.h:1841
Represents a call to an inherited base class constructor from an inheriting constructor.
Definition: ExprCXX.h:1721
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:642
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:2224
static CXXNewExpr * CreateEmpty(const ASTContext &Ctx, bool IsArray, bool HasInit, unsigned NumPlacementArgs, bool IsParenTypeId)
Create an empty c++ new expression.
Definition: ExprCXX.cpp:268
bool isArray() const
Definition: ExprCXX.h:2332
bool hasInitializer() const
Whether this new-expression has any initializer at all.
Definition: ExprCXX.h:2388
void setOperatorDelete(FunctionDecl *D)
Definition: ExprCXX.h:2330
unsigned getNumPlacementArgs() const
Definition: ExprCXX.h:2362
bool isParenTypeId() const
Definition: ExprCXX.h:2379
raw_arg_iterator raw_arg_end()
Definition: ExprCXX.h:2451
raw_arg_iterator raw_arg_begin()
Definition: ExprCXX.h:2450
void setOperatorNew(FunctionDecl *D)
Definition: ExprCXX.h:2328
Represents a C++11 noexcept expression (C++ [expr.unary.noexcept]).
Definition: ExprCXX.h:4088
The null pointer literal (C++11 [lex.nullptr])
Definition: ExprCXX.h:765
void setLocation(SourceLocation L)
Definition: ExprCXX.h:780
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:577
Represents a list-initialization with parenthesis.
Definition: ExprCXX.h:4913
void setInitializedFieldInUnion(FieldDecl *FD)
Definition: ExprCXX.h:4989
static CXXParenListInitExpr * CreateEmpty(ASTContext &C, unsigned numExprs, EmptyShell Empty)
Definition: ExprCXX.cpp:1894
void setArrayFiller(Expr *E)
Definition: ExprCXX.h:4979
Represents a C++ pseudo-destructor (C++ [expr.pseudo]).
Definition: ExprCXX.h:2600
void setDestroyedType(IdentifierInfo *II, SourceLocation Loc)
Set the name of destroyed type for a dependent pseudo-destructor expression.
Definition: ExprCXX.h:2715
A C++ reinterpret_cast expression (C++ [expr.reinterpret.cast]).
Definition: ExprCXX.h:523
static CXXReinterpretCastExpr * CreateEmpty(const ASTContext &Context, unsigned pathSize)
Definition: ExprCXX.cpp:821
A rewritten comparison expression that was originally written using operator syntax.
Definition: ExprCXX.h:283
An expression "T()" which creates a value-initialized rvalue of type T, which is a non-class type.
Definition: ExprCXX.h:2165
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:729
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:1869
static CXXTemporaryObjectExpr * CreateEmpty(const ASTContext &Ctx, unsigned NumArgs)
Definition: ExprCXX.cpp:1091
Represents the this expression in C++.
Definition: ExprCXX.h:1148
void setLocation(SourceLocation L)
Definition: ExprCXX.h:1165
static CXXThisExpr * CreateEmpty(const ASTContext &Ctx)
Definition: ExprCXX.cpp:1525
void setImplicit(bool I)
Definition: ExprCXX.h:1171
A C++ throw-expression (C++ [except.throw]).
Definition: ExprCXX.h:1192
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
bool isTypeOperand() const
Definition: ExprCXX.h:881
void setSourceRange(SourceRange R)
Definition: ExprCXX.h:900
Describes an explicit type conversion that uses functional notion but could not be resolved because o...
Definition: ExprCXX.h:3519
void setRParenLoc(SourceLocation L)
Definition: ExprCXX.h:3569
void setArg(unsigned I, Expr *E)
Definition: ExprCXX.h:3605
void setLParenLoc(SourceLocation L)
Definition: ExprCXX.h:3564
unsigned getNumArgs() const
Retrieve the number of arguments.
Definition: ExprCXX.h:3577
static CXXUnresolvedConstructExpr * CreateEmpty(const ASTContext &Context, unsigned NumArgs)
Definition: ExprCXX.cpp:1432
A Microsoft C++ __uuidof expression, which gets the _GUID that corresponds to the supplied type or ex...
Definition: ExprCXX.h:1062
bool isTypeOperand() const
Definition: ExprCXX.h:1092
void setSourceRange(SourceRange R)
Definition: ExprCXX.h:1113
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Definition: Expr.h:2795
void setRParenLoc(SourceLocation L)
Definition: Expr.h:3106
void setArg(unsigned Arg, Expr *ArgExpr)
setArg - Set the specified argument.
Definition: Expr.h:2999
void setADLCallKind(ADLCallKind V=UsesADL)
Definition: Expr.h:2952
static CallExpr * CreateEmpty(const ASTContext &Ctx, unsigned NumArgs, bool HasFPFeatures, EmptyShell Empty)
Create an empty call expression, for deserialization.
Definition: Expr.cpp:1487
void setPreArg(unsigned I, Stmt *PreArg)
Definition: Expr.h:2883
void setStoredFPFeatures(FPOptionsOverride F)
Set FPOptionsOverride in trailing storage. Used only by Serialization.
Definition: Expr.h:3064
unsigned getNumArgs() const
getNumArgs - Return the number of actual arguments to this call.
Definition: Expr.h:2973
void setCallee(Expr *F)
Definition: Expr.h:2947
This captures a statement into a function.
Definition: Stmt.h:3755
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:3759
CaseStmt - Represent a case statement.
Definition: Stmt.h:1799
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:3465
FPOptionsOverride * getTrailingFPFeatures()
Return a pointer to the trailing FPOptions.
Definition: Expr.cpp:2029
path_iterator path_begin()
Definition: Expr.h:3535
unsigned path_size() const
Definition: Expr.h:3534
void setCastKind(CastKind K)
Definition: Expr.h:3510
bool hasStoredFPFeatures() const
Definition: Expr.h:3552
void setSubExpr(Expr *E)
Definition: Expr.h:3517
void setValue(unsigned Val)
Definition: Expr.h:1603
void setLocation(SourceLocation Location)
Definition: Expr.h:1599
void setKind(CharacterLiteralKind kind)
Definition: Expr.h:1600
ChooseExpr - GNU builtin-in function __builtin_choose_expr.
Definition: Expr.h:4528
void setRParenLoc(SourceLocation L)
Definition: Expr.h:4579
void setIsConditionTrue(bool isTrue)
Definition: Expr.h:4556
void setBuiltinLoc(SourceLocation L)
Definition: Expr.h:4576
void setRHS(Expr *E)
Definition: Expr.h:4573
void setCond(Expr *E)
Definition: Expr.h:4569
void setLHS(Expr *E)
Definition: Expr.h:4571
Represents a 'co_await' expression.
Definition: ExprCXX.h:5123
void setIsImplicit(bool value=true)
Definition: ExprCXX.h:5146
CompoundAssignOperator - For compound assignments (e.g.
Definition: Expr.h:4058
void setComputationResultType(QualType T)
Definition: Expr.h:4096
static CompoundAssignOperator * CreateEmpty(const ASTContext &C, bool hasFPFeatures)
Definition: Expr.cpp:4754
void setComputationLHSType(QualType T)
Definition: Expr.h:4093
CompoundLiteralExpr - [C99 6.5.2.5].
Definition: Expr.h:3395
void setFileScope(bool FS)
Definition: Expr.h:3423
void setTypeSourceInfo(TypeSourceInfo *tinfo)
Definition: Expr.h:3431
void setLParenLoc(SourceLocation L)
Definition: Expr.h:3426
void setInitializer(Expr *E)
Definition: Expr.h:3420
CompoundStmt - This represents a group of statements like { stmt stmt }.
Definition: Stmt.h:1604
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:4149
ConstantExpr - An expression that occurs in a constant context and optionally the result of evaluatin...
Definition: Expr.h:1059
ConstantResultStorageKind getResultStorageKind() const
Definition: Expr.h:1128
static ConstantExpr * CreateEmpty(const ASTContext &Context, ConstantResultStorageKind StorageKind)
Definition: Expr.cpp:356
The result of a constraint satisfaction check, containing the necessary information to diagnose an un...
Definition: ASTConcept.h:35
llvm::SmallVector< std::pair< const Expr *, Detail >, 4 > Details
Pairs of unsatisfied atomic constraint expressions along with the substituted constraint expr,...
Definition: ASTConcept.h:60
std::pair< SourceLocation, StringRef > SubstitutionDiagnostic
Definition: ASTConcept.h:50
ContinueStmt - This represents a continue.
Definition: Stmt.h:2948
ConvertVectorExpr - Clang builtin function __builtin_convertvector This AST node provides support for...
Definition: Expr.h:4469
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:5204
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:1247
bool hasTemplateKWAndArgsInfo() const
Definition: Expr.h:1362
static DeclRefExpr * CreateEmpty(const ASTContext &Context, bool HasQualifier, bool HasFoundDecl, bool HasTemplateKWAndArgsInfo, unsigned NumTemplateArgs)
Construct an empty declaration reference expression.
Definition: Expr.cpp:518
void setLocation(SourceLocation L)
Definition: Expr.h:1324
bool hasQualifier() const
Determine whether this declaration reference was preceded by a C++ nested-name-specifier,...
Definition: Expr.h:1330
ValueDecl * getDecl()
Definition: Expr.h:1315
DeclStmt - Adaptor class for mixing declarations with statements and expressions.
Definition: Stmt.h:1495
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:85
AccessSpecifier getAccess() const
Definition: DeclBase.h:512
Represents a 'co_await' expression while the type of the promise is dependent.
Definition: ExprCXX.h:5155
A qualified reference to a name whose declaration cannot yet be resolved.
Definition: ExprCXX.h:3285
static DependentScopeDeclRefExpr * CreateEmpty(const ASTContext &Context, bool HasTemplateKWAndArgsInfo, unsigned NumTemplateArgs)
Definition: ExprCXX.cpp:497
Represents a single C99 designator.
Definition: Expr.h:5105
Represents a C99 designated initializer expression.
Definition: Expr.h:5062
static DesignatedInitExpr * CreateEmpty(const ASTContext &C, unsigned NumIndexExprs)
Definition: Expr.cpp:4562
void setSubExpr(unsigned Idx, Expr *E)
Definition: Expr.h:5349
void setGNUSyntax(bool GNU)
Definition: Expr.h:5327
void setEqualOrColonLoc(SourceLocation L)
Definition: Expr.h:5318
void setDesignators(const ASTContext &C, const Designator *Desigs, unsigned NumDesigs)
Definition: Expr.cpp:4569
unsigned getNumSubExprs() const
Retrieve the total number of subexpressions in this designated initializer expression,...
Definition: Expr.h:5342
void setBase(Expr *Base)
Definition: Expr.h:5447
void setUpdater(Expr *Updater)
Definition: Expr.h:5452
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:2723
ExplicitCastExpr - An explicit cast written in the source code.
Definition: Expr.h:3700
void setTypeInfoAsWritten(TypeSourceInfo *writtenTy)
Definition: Expr.h:3723
Represents an expression – generally a full-expression – that introduces cleanups to be run at the en...
Definition: ExprCXX.h:3436
unsigned getNumObjects() const
Definition: ExprCXX.h:3464
llvm::PointerUnion< BlockDecl *, CompoundLiteralExpr * > CleanupObject
The type of objects that are kept in the cleanup.
Definition: ExprCXX.h:3442
static ExprWithCleanups * Create(const ASTContext &C, EmptyShell empty, unsigned numObjects)
Definition: ExprCXX.cpp:1397
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:169
bool isInstantiationDependent() const
Whether this expression is instantiation-dependent, meaning that it depends in some way on.
Definition: Expr.h:215
void setValueKind(ExprValueKind Cat)
setValueKind - Set the value kind produced by this expression.
Definition: Expr.h:448
void setObjectKind(ExprObjectKind Cat)
setObjectKind - Set the object kind produced by this expression.
Definition: Expr.h:451
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:2907
ExtVectorElementExpr - This represents access to specific elements of a vector, and may occur on the ...
Definition: Expr.h:6083
void setAccessor(IdentifierInfo *II)
Definition: Expr.h:6105
void setBase(Expr *E)
Definition: Expr.h:6102
void setAccessorLoc(SourceLocation L)
Definition: Expr.h:6108
static FPOptionsOverride getFromOpaqueInt(storage_type I)
Definition: LangOptions.h:936
static FixedPointLiteral * Create(const ASTContext &C, EmptyShell Empty)
Returns an empty fixed-point literal.
Definition: Expr.cpp:976
void setLocation(SourceLocation Location)
Definition: Expr.h:1551
void setScale(unsigned S)
Definition: Expr.h:1554
static FloatingLiteral * Create(const ASTContext &C, const llvm::APFloat &V, bool isexact, QualType Type, SourceLocation L)
Definition: Expr.cpp:1047
const llvm::fltSemantics & getSemantics() const
Return the APFloat semantics this literal uses.
Definition: Expr.h:1656
void setValue(const ASTContext &C, const llvm::APFloat &Val)
Definition: Expr.h:1637
void setRawSemantics(llvm::APFloatBase::Semantics Sem)
Set the raw enumeration value representing the floating-point semantics of this literal (32-bit IEEE,...
Definition: Expr.h:1651
void setExact(bool E)
Definition: Expr.h:1668
void setLocation(SourceLocation L)
Definition: Expr.h:1676
ForStmt - This represents a 'for (init;cond;inc)' stmt.
Definition: Stmt.h:2779
void setSubExpr(Expr *E)
As with any mutator of the AST, be very careful when modifying an existing AST to preserve its invari...
Definition: Expr.h:1044
Stmt * SubExpr
Definition: Expr.h:1028
Represents a reference to a function parameter pack or init-capture pack that has been substituted bu...
Definition: ExprCXX.h:4599
static FunctionParmPackExpr * CreateEmpty(const ASTContext &Context, unsigned NumParams)
Definition: ExprCXX.cpp:1756
This represents a GCC inline-assembly statement extension.
Definition: Stmt.h:3257
GNUNullExpr - Implements the GNU __null extension, which is a name for a null pointer constant that h...
Definition: Expr.h:4603
void setTokenLocation(SourceLocation L)
Definition: Expr.h:4618
Represents a C11 generic selection.
Definition: Expr.h:5695
unsigned getNumAssocs() const
The number of association expressions.
Definition: Expr.h:5935
static GenericSelectionExpr * CreateEmpty(const ASTContext &Context, unsigned NumAssocs)
Create an empty generic selection expression for deserialization.
Definition: Expr.cpp:4496
GotoStmt - This represents a direct goto.
Definition: Stmt.h:2860
One of these records is kept for each identifier that is lexed.
IfStmt - This represents an if/then/else.
Definition: Stmt.h:2136
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:1699
void setSubExpr(Expr *E)
Definition: Expr.h:1713
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
Definition: Expr.h:3625
static ImplicitCastExpr * CreateEmpty(const ASTContext &Context, unsigned PathSize, bool HasFPFeatures)
Definition: Expr.cpp:2071
void setIsPartOfExplicitCast(bool PartOfExplicitCast)
Definition: Expr.h:3657
Represents an implicitly-generated value initialization of an object of a given type.
Definition: Expr.h:5570
IndirectGotoStmt - This represents an indirect goto.
Definition: Stmt.h:2899
Describes an C or C++ initializer list.
Definition: Expr.h:4817
void setSyntacticForm(InitListExpr *Init)
Definition: Expr.h:4987
Expr * updateInit(const ASTContext &C, unsigned Init, Expr *expr)
Updates the initializer at index Init with the new expression expr, and returns the old expression at...
Definition: Expr.cpp:2371
void setLBraceLoc(SourceLocation Loc)
Definition: Expr.h:4972
void setRBraceLoc(SourceLocation Loc)
Definition: Expr.h:4974
void sawArrayRangeDesignator(bool ARD=true)
Definition: Expr.h:4997
void reserveInits(const ASTContext &C, unsigned NumInits)
Reserve space for some number of initializers.
Definition: Expr.cpp:2362
void setLocation(SourceLocation Location)
Definition: Expr.h:1509
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:946
LabelStmt - Represents a label, which has a substatement.
Definition: Stmt.h:2029
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
Definition: ExprCXX.h:1938
static LambdaExpr * CreateDeserialized(const ASTContext &C, unsigned NumCaptures)
Construct a new lambda expression that will be deserialized from an external source.
Definition: ExprCXX.cpp:1264
capture_init_iterator capture_init_end()
Retrieve the iterator pointing one past the last initialization argument for this lambda expression.
Definition: ExprCXX.h:2076
capture_init_iterator capture_init_begin()
Retrieve the first initialization argument for this lambda expression (which initializes the first ca...
Definition: ExprCXX.h:2064
This represents a Microsoft inline-assembly statement extension.
Definition: Stmt.h:3480
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:929
MS property subscript expression.
Definition: ExprCXX.h:1000
void setRBracketLoc(SourceLocation L)
Definition: ExprCXX.h:1038
Represents a prvalue temporary that is written into memory so that a reference can bind to it.
Definition: ExprCXX.h:4679
MatrixSubscriptExpr - Matrix subscript expression for the MatrixType extension.
Definition: Expr.h:2717
void setColumnIdx(Expr *E)
Definition: Expr.h:2757
void setBase(Expr *E)
Definition: Expr.h:2745
void setRowIdx(Expr *E)
Definition: Expr.h:2749
void setRBracketLoc(SourceLocation L)
Definition: Expr.h:2772
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
Definition: Expr.h:3158
static MemberExpr * CreateEmpty(const ASTContext &Context, bool HasQualifier, bool HasFoundDecl, bool HasTemplateKWAndArgsInfo, unsigned NumTemplateArgs)
Definition: Expr.cpp:1751
This represents a decl that may have a name.
Definition: Decl.h:249
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
Definition: Decl.h:315
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:5390
NullStmt - This is the null statement ";": C99 6.8.3p3.
Definition: Stmt.h:1567
OpenMP 5.0 [2.1.5, Array Sections].
Definition: ExprOpenMP.h:56
void setStride(Expr *E)
Set length of the array section.
Definition: ExprOpenMP.h:111
void setLength(Expr *E)
Set length of the array section.
Definition: ExprOpenMP.h:105
void setColonLocFirst(SourceLocation L)
Definition: ExprOpenMP.h:119
void setLowerBound(Expr *E)
Set lower bound of the array section.
Definition: ExprOpenMP.h:99
void setRBracketLoc(SourceLocation L)
Definition: ExprOpenMP.h:125
void setBase(Expr *E)
Set base of the array section.
Definition: ExprOpenMP.h:88
void setColonLocSecond(SourceLocation L)
Definition: ExprOpenMP.h:122
An explicit cast in C or a C-style cast in C++, which uses the syntax ([s1][s2]......
Definition: ExprOpenMP.h:148
void setLParenLoc(SourceLocation L)
Definition: ExprOpenMP.h:193
static OMPArrayShapingExpr * CreateEmpty(const ASTContext &Context, unsigned NumDims)
Definition: Expr.cpp:5117
void setRParenLoc(SourceLocation L)
Definition: ExprOpenMP.h:196
This represents '#pragma omp atomic' directive.
Definition: StmtOpenMP.h:2963
static OMPAtomicDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
Definition: StmtOpenMP.cpp:935
This represents '#pragma omp barrier' directive.
Definition: StmtOpenMP.h:2641
static OMPBarrierDirective * CreateEmpty(const ASTContext &C, EmptyShell)
Creates an empty directive.
Definition: StmtOpenMP.cpp:787
This represents '#pragma omp cancel' directive.
Definition: StmtOpenMP.h:3671
static OMPCancelDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive.
Definition: StmtOpenMP.cpp:847
This represents '#pragma omp cancellation point' directive.
Definition: StmtOpenMP.h:3613
static OMPCancellationPointDirective * CreateEmpty(const ASTContext &C, EmptyShell)
Creates an empty directive.
Definition: StmtOpenMP.cpp:832
Representation of an OpenMP canonical loop.
Definition: StmtOpenMP.h:142
static OMPCanonicalLoop * createEmpty(const ASTContext &Ctx)
Create an empty OMPCanonicalLoop for deserialization.
Definition: StmtOpenMP.h:176
This represents '#pragma omp critical' directive.
Definition: StmtOpenMP.h:2092
static OMPCriticalDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive.
Definition: StmtOpenMP.cpp:592
This represents '#pragma omp depobj' directive.
Definition: StmtOpenMP.h:2857
static OMPDepobjDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
Definition: StmtOpenMP.cpp:877
This represents '#pragma omp dispatch' directive.
Definition: StmtOpenMP.h:5827
static OMPDispatchDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
This represents '#pragma omp distribute' directive.
Definition: StmtOpenMP.h:4441
static OMPDistributeDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
This represents '#pragma omp distribute parallel for' composite directive.
Definition: StmtOpenMP.h:4564
static OMPDistributeParallelForDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
This represents '#pragma omp distribute parallel for simd' composite directive.
Definition: StmtOpenMP.h:4660
static OMPDistributeParallelForSimdDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
This represents '#pragma omp distribute simd' composite directive.
Definition: StmtOpenMP.h:4725
static OMPDistributeSimdDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
This represents '#pragma omp error' directive.
Definition: StmtOpenMP.h:6302
static OMPErrorDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive.
Definition: StmtOpenMP.cpp:775
This is a basic class for representing single OpenMP executable directive.
Definition: StmtOpenMP.h:266
void setLocStart(SourceLocation Loc)
Set starting location of directive kind.
Definition: StmtOpenMP.h:510
OMPChildren * Data
Data, associated with the directive.
Definition: StmtOpenMP.h:295
void setLocEnd(SourceLocation Loc)
Set ending location of directive.
Definition: StmtOpenMP.h:515
void setMappedDirective(OpenMPDirectiveKind MappedDirective)
Definition: StmtOpenMP.h:357
This represents '#pragma omp flush' directive.
Definition: StmtOpenMP.h:2805
static OMPFlushDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
Definition: StmtOpenMP.cpp:862
This represents '#pragma omp for' directive.
Definition: StmtOpenMP.h:1649
static OMPForDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
Definition: StmtOpenMP.cpp:400
This represents '#pragma omp for simd' directive.
Definition: StmtOpenMP.h:1740
static OMPForSimdDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
Definition: StmtOpenMP.cpp:487
This represents '#pragma omp loop' directive.
Definition: StmtOpenMP.h:5982
static OMPGenericLoopDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with a place for NumClauses clauses.
This represents '#pragma omp interop' directive.
Definition: StmtOpenMP.h:5774
static OMPInteropDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive.
OpenMP 5.0 [2.1.6 Iterators] Iterators are identifiers that expand to multiple values in the clause o...
Definition: ExprOpenMP.h:275
void setLParenLoc(SourceLocation L)
Definition: ExprOpenMP.h:367
static OMPIteratorExpr * CreateEmpty(const ASTContext &Context, unsigned NumIterators)
Definition: Expr.cpp:5248
void setRParenLoc(SourceLocation L)
Definition: ExprOpenMP.h:370
void setIteratorKwLoc(SourceLocation L)
Definition: ExprOpenMP.h:373
The base class for all loop-based directives, including loop transformation directives.
Definition: StmtOpenMP.h:698
This is a common base class for loop directives ('omp simd', 'omp for', 'omp for simd' etc....
Definition: StmtOpenMP.h:1018
The base class for all loop transformation directives.
Definition: StmtOpenMP.h:975
void setNumGeneratedLoops(unsigned Num)
Set the number of loops generated by this loop transformation.
Definition: StmtOpenMP.h:990
This represents '#pragma omp masked' directive.
Definition: StmtOpenMP.h:5892
static OMPMaskedDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive.
This represents '#pragma omp masked taskloop' directive.
Definition: StmtOpenMP.h:3946
static OMPMaskedTaskLoopDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
This represents '#pragma omp masked taskloop simd' directive.
Definition: StmtOpenMP.h:4087
static OMPMaskedTaskLoopSimdDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
This represents '#pragma omp master' directive.
Definition: StmtOpenMP.h:2044
static OMPMasterDirective * CreateEmpty(const ASTContext &C, EmptyShell)
Creates an empty directive.
Definition: StmtOpenMP.cpp:577
This represents '#pragma omp master taskloop' directive.
Definition: StmtOpenMP.h:3870
static OMPMasterTaskLoopDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
This represents '#pragma omp master taskloop simd' directive.
Definition: StmtOpenMP.h:4022
static OMPMasterTaskLoopSimdDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
This represents '#pragma omp metadirective' directive.
Definition: StmtOpenMP.h:5943
static OMPMetaDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Definition: StmtOpenMP.cpp:273
This represents '#pragma omp ordered' directive.
Definition: StmtOpenMP.h:2909
static OMPOrderedDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, bool IsStandalone, EmptyShell)
Creates an empty directive.
Definition: StmtOpenMP.cpp:908
This represents '#pragma omp parallel' directive.
Definition: StmtOpenMP.h:627
static OMPParallelDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive with the place for N clauses.
Definition: StmtOpenMP.cpp:292
This represents '#pragma omp parallel for' directive.
Definition: StmtOpenMP.h:2163
static OMPParallelForDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
Definition: StmtOpenMP.cpp:637
This represents '#pragma omp parallel for simd' directive.
Definition: StmtOpenMP.h:2260
static OMPParallelForSimdDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
Definition: StmtOpenMP.cpp:680
This represents '#pragma omp parallel loop' directive.
Definition: StmtOpenMP.h:6175
static OMPParallelGenericLoopDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
This represents '#pragma omp parallel masked' directive.
Definition: StmtOpenMP.h:2388
static OMPParallelMaskedDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
Definition: StmtOpenMP.cpp:714
This represents '#pragma omp parallel masked taskloop' directive.
Definition: StmtOpenMP.h:4231
static OMPParallelMaskedTaskLoopDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
This represents '#pragma omp parallel masked taskloop simd' directive.
Definition: StmtOpenMP.h:4376
static OMPParallelMaskedTaskLoopSimdDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
This represents '#pragma omp parallel master' directive.
Definition: StmtOpenMP.h:2325
static OMPParallelMasterDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
Definition: StmtOpenMP.cpp:698
This represents '#pragma omp parallel master taskloop' directive.
Definition: StmtOpenMP.h:4153
static OMPParallelMasterTaskLoopDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
This represents '#pragma omp parallel master taskloop simd' directive.
Definition: StmtOpenMP.h:4309
static OMPParallelMasterTaskLoopSimdDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
This represents '#pragma omp parallel sections' directive.
Definition: StmtOpenMP.h:2452
static OMPParallelSectionsDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
Definition: StmtOpenMP.cpp:732
This represents '#pragma omp scan' directive.
Definition: StmtOpenMP.h:5721
static OMPScanDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
Definition: StmtOpenMP.cpp:892
This represents '#pragma omp scope' directive.
Definition: StmtOpenMP.h:1941
static OMPScopeDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive.
Definition: StmtOpenMP.cpp:544
This represents '#pragma omp section' directive.
Definition: StmtOpenMP.h:1880
static OMPSectionDirective * CreateEmpty(const ASTContext &C, EmptyShell)
Creates an empty directive.
Definition: StmtOpenMP.cpp:528
void setHasCancel(bool Has)
Set cancel state.
Definition: StmtOpenMP.h:1924
This represents '#pragma omp sections' directive.
Definition: StmtOpenMP.h:1803
static OMPSectionsDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
Definition: StmtOpenMP.cpp:508
This represents '#pragma omp simd' directive.
Definition: StmtOpenMP.h:1585
static OMPSimdDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
Definition: StmtOpenMP.cpp:327
This represents '#pragma omp single' directive.
Definition: StmtOpenMP.h:1993
static OMPSingleDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
Definition: StmtOpenMP.cpp:561
This represents '#pragma omp target data' directive.
Definition: StmtOpenMP.h:3222
static OMPTargetDataDirective * CreateEmpty(const ASTContext &C, unsigned N, EmptyShell)
Creates an empty directive with the place for N clauses.
This represents '#pragma omp target' directive.
Definition: StmtOpenMP.h:3168
static OMPTargetDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
Definition: StmtOpenMP.cpp:951
This represents '#pragma omp target enter data' directive.
Definition: StmtOpenMP.h:3276
static OMPTargetEnterDataDirective * CreateEmpty(const ASTContext &C, unsigned N, EmptyShell)
Creates an empty directive with the place for N clauses.
This represents '#pragma omp target exit data' directive.
Definition: StmtOpenMP.h:3331
static OMPTargetExitDataDirective * CreateEmpty(const ASTContext &C, unsigned N, EmptyShell)
Creates an empty directive with the place for N clauses.
This represents '#pragma omp target parallel' directive.
Definition: StmtOpenMP.h:3385
static OMPTargetParallelDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
Definition: StmtOpenMP.cpp:970
This represents '#pragma omp target parallel for' directive.
Definition: StmtOpenMP.h:3465