clang 22.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"
36#include "clang/AST/StmtSYCL.h"
39#include "clang/AST/Type.h"
43#include "clang/Basic/LLVM.h"
49#include "clang/Lex/Token.h"
52#include "llvm/ADT/DenseMap.h"
53#include "llvm/ADT/SmallVector.h"
54#include "llvm/ADT/StringRef.h"
55#include "llvm/Bitstream/BitstreamReader.h"
56#include "llvm/Support/ErrorHandling.h"
57#include <algorithm>
58#include <cassert>
59#include <cstdint>
60#include <optional>
61#include <string>
62
63using namespace clang;
64using namespace serialization;
65
66namespace clang {
67
68 class ASTStmtReader : public StmtVisitor<ASTStmtReader> {
69 ASTRecordReader &Record;
70 llvm::BitstreamCursor &DeclsCursor;
71
72 std::optional<BitsUnpacker> CurrentUnpackingBits;
73
74 SourceLocation readSourceLocation() {
75 return Record.readSourceLocation();
76 }
77
78 SourceRange readSourceRange() {
79 return Record.readSourceRange();
80 }
81
82 std::string readString() {
83 return Record.readString();
84 }
85
86 TypeSourceInfo *readTypeSourceInfo() {
87 return Record.readTypeSourceInfo();
88 }
89
90 Decl *readDecl() {
91 return Record.readDecl();
92 }
93
94 template<typename T>
95 T *readDeclAs() {
96 return Record.readDeclAs<T>();
97 }
98
99 public:
100 ASTStmtReader(ASTRecordReader &Record, llvm::BitstreamCursor &Cursor)
101 : Record(Record), DeclsCursor(Cursor) {}
102
103 /// The number of record fields required for the Stmt class
104 /// itself.
105 static const unsigned NumStmtFields = 0;
106
107 /// The number of record fields required for the Expr class
108 /// itself.
109 static const unsigned NumExprFields = NumStmtFields + 2;
110
111 /// The number of bits required for the packing bits for the Expr class.
112 static const unsigned NumExprBits = 10;
113
114 /// Read and initialize a ExplicitTemplateArgumentList structure.
116 TemplateArgumentLoc *ArgsLocArray,
117 unsigned NumTemplateArgs);
118
119 void VisitStmt(Stmt *S);
120#define STMT(Type, Base) \
121 void Visit##Type(Type *);
122#include "clang/AST/StmtNodes.inc"
123 };
124
125} // namespace clang
126
128 TemplateArgumentLoc *ArgsLocArray,
129 unsigned NumTemplateArgs) {
130 SourceLocation TemplateKWLoc = readSourceLocation();
132 ArgInfo.setLAngleLoc(readSourceLocation());
133 ArgInfo.setRAngleLoc(readSourceLocation());
134 for (unsigned i = 0; i != NumTemplateArgs; ++i)
135 ArgInfo.addArgument(Record.readTemplateArgumentLoc());
136 Args.initializeFrom(TemplateKWLoc, ArgInfo, ArgsLocArray);
137}
138
140 assert(Record.getIdx() == NumStmtFields && "Incorrect statement field count");
141}
142
143void ASTStmtReader::VisitNullStmt(NullStmt *S) {
144 VisitStmt(S);
145 S->setSemiLoc(readSourceLocation());
146 S->NullStmtBits.HasLeadingEmptyMacro = Record.readInt();
147}
148
149void ASTStmtReader::VisitCompoundStmt(CompoundStmt *S) {
150 VisitStmt(S);
152 unsigned NumStmts = Record.readInt();
153 unsigned HasFPFeatures = Record.readInt();
154 assert(S->hasStoredFPFeatures() == HasFPFeatures);
155 while (NumStmts--)
156 Stmts.push_back(Record.readSubStmt());
157 S->setStmts(Stmts);
158 if (HasFPFeatures)
159 S->setStoredFPFeatures(
161 S->LBraceLoc = readSourceLocation();
162 S->RBraceLoc = readSourceLocation();
163}
164
165void ASTStmtReader::VisitSwitchCase(SwitchCase *S) {
166 VisitStmt(S);
167 Record.recordSwitchCaseID(S, Record.readInt());
168 S->setKeywordLoc(readSourceLocation());
169 S->setColonLoc(readSourceLocation());
170}
171
172void ASTStmtReader::VisitCaseStmt(CaseStmt *S) {
173 VisitSwitchCase(S);
174 bool CaseStmtIsGNURange = Record.readInt();
175 S->setLHS(Record.readSubExpr());
176 S->setSubStmt(Record.readSubStmt());
177 if (CaseStmtIsGNURange) {
178 S->setRHS(Record.readSubExpr());
179 S->setEllipsisLoc(readSourceLocation());
180 }
181}
182
183void ASTStmtReader::VisitDefaultStmt(DefaultStmt *S) {
184 VisitSwitchCase(S);
185 S->setSubStmt(Record.readSubStmt());
186}
187
188void ASTStmtReader::VisitLabelStmt(LabelStmt *S) {
189 VisitStmt(S);
190 bool IsSideEntry = Record.readInt();
191 auto *LD = readDeclAs<LabelDecl>();
192 LD->setStmt(S);
193 S->setDecl(LD);
194 S->setSubStmt(Record.readSubStmt());
195 S->setIdentLoc(readSourceLocation());
196 S->setSideEntry(IsSideEntry);
197}
198
199void ASTStmtReader::VisitAttributedStmt(AttributedStmt *S) {
200 VisitStmt(S);
201 // NumAttrs in AttributedStmt is set when creating an empty
202 // AttributedStmt in AttributedStmt::CreateEmpty, since it is needed
203 // to allocate the right amount of space for the trailing Attr *.
204 uint64_t NumAttrs = Record.readInt();
205 AttrVec Attrs;
206 Record.readAttributes(Attrs);
207 (void)NumAttrs;
208 assert(NumAttrs == S->AttributedStmtBits.NumAttrs);
209 assert(NumAttrs == Attrs.size());
210 std::copy(Attrs.begin(), Attrs.end(), S->getAttrArrayPtr());
211 S->SubStmt = Record.readSubStmt();
212 S->AttributedStmtBits.AttrLoc = readSourceLocation();
213}
214
215void ASTStmtReader::VisitIfStmt(IfStmt *S) {
216 VisitStmt(S);
217
218 CurrentUnpackingBits.emplace(Record.readInt());
219
220 bool HasElse = CurrentUnpackingBits->getNextBit();
221 bool HasVar = CurrentUnpackingBits->getNextBit();
222 bool HasInit = CurrentUnpackingBits->getNextBit();
223
224 S->setStatementKind(static_cast<IfStatementKind>(Record.readInt()));
225 S->setCond(Record.readSubExpr());
226 S->setThen(Record.readSubStmt());
227 if (HasElse)
228 S->setElse(Record.readSubStmt());
229 if (HasVar)
230 S->setConditionVariableDeclStmt(cast<DeclStmt>(Record.readSubStmt()));
231 if (HasInit)
232 S->setInit(Record.readSubStmt());
233
234 S->setIfLoc(readSourceLocation());
235 S->setLParenLoc(readSourceLocation());
236 S->setRParenLoc(readSourceLocation());
237 if (HasElse)
238 S->setElseLoc(readSourceLocation());
239}
240
241void ASTStmtReader::VisitSwitchStmt(SwitchStmt *S) {
242 VisitStmt(S);
243
244 bool HasInit = Record.readInt();
245 bool HasVar = Record.readInt();
246 bool AllEnumCasesCovered = Record.readInt();
247 if (AllEnumCasesCovered)
249
250 S->setCond(Record.readSubExpr());
251 S->setBody(Record.readSubStmt());
252 if (HasInit)
253 S->setInit(Record.readSubStmt());
254 if (HasVar)
255 S->setConditionVariableDeclStmt(cast<DeclStmt>(Record.readSubStmt()));
256
257 S->setSwitchLoc(readSourceLocation());
258 S->setLParenLoc(readSourceLocation());
259 S->setRParenLoc(readSourceLocation());
260
261 SwitchCase *PrevSC = nullptr;
262 for (auto E = Record.size(); Record.getIdx() != E; ) {
263 SwitchCase *SC = Record.getSwitchCaseWithID(Record.readInt());
264 if (PrevSC)
265 PrevSC->setNextSwitchCase(SC);
266 else
267 S->setSwitchCaseList(SC);
268
269 PrevSC = SC;
270 }
271}
272
273void ASTStmtReader::VisitWhileStmt(WhileStmt *S) {
274 VisitStmt(S);
275
276 bool HasVar = Record.readInt();
277
278 S->setCond(Record.readSubExpr());
279 S->setBody(Record.readSubStmt());
280 if (HasVar)
281 S->setConditionVariableDeclStmt(cast<DeclStmt>(Record.readSubStmt()));
282
283 S->setWhileLoc(readSourceLocation());
284 S->setLParenLoc(readSourceLocation());
285 S->setRParenLoc(readSourceLocation());
286}
287
288void ASTStmtReader::VisitDoStmt(DoStmt *S) {
289 VisitStmt(S);
290 S->setCond(Record.readSubExpr());
291 S->setBody(Record.readSubStmt());
292 S->setDoLoc(readSourceLocation());
293 S->setWhileLoc(readSourceLocation());
294 S->setRParenLoc(readSourceLocation());
295}
296
297void ASTStmtReader::VisitForStmt(ForStmt *S) {
298 VisitStmt(S);
299 S->setInit(Record.readSubStmt());
300 S->setCond(Record.readSubExpr());
301 S->setConditionVariableDeclStmt(cast_or_null<DeclStmt>(Record.readSubStmt()));
302 S->setInc(Record.readSubExpr());
303 S->setBody(Record.readSubStmt());
304 S->setForLoc(readSourceLocation());
305 S->setLParenLoc(readSourceLocation());
306 S->setRParenLoc(readSourceLocation());
307}
308
309void ASTStmtReader::VisitGotoStmt(GotoStmt *S) {
310 VisitStmt(S);
311 S->setLabel(readDeclAs<LabelDecl>());
312 S->setGotoLoc(readSourceLocation());
313 S->setLabelLoc(readSourceLocation());
314}
315
316void ASTStmtReader::VisitIndirectGotoStmt(IndirectGotoStmt *S) {
317 VisitStmt(S);
318 S->setGotoLoc(readSourceLocation());
319 S->setStarLoc(readSourceLocation());
320 S->setTarget(Record.readSubExpr());
321}
322
323void ASTStmtReader::VisitLoopControlStmt(LoopControlStmt *S) {
324 VisitStmt(S);
325 S->setKwLoc(readSourceLocation());
326 if (Record.readBool()) {
327 S->setLabelDecl(readDeclAs<LabelDecl>());
328 S->setLabelLoc(readSourceLocation());
329 }
330}
331
332void ASTStmtReader::VisitContinueStmt(ContinueStmt *S) {
333 VisitLoopControlStmt(S);
334}
335
336void ASTStmtReader::VisitBreakStmt(BreakStmt *S) { VisitLoopControlStmt(S); }
337
338void ASTStmtReader::VisitDeferStmt(DeferStmt *S) {
339 VisitStmt(S);
340 S->setDeferLoc(readSourceLocation());
341 S->setBody(Record.readSubStmt());
342}
343
344void ASTStmtReader::VisitReturnStmt(ReturnStmt *S) {
345 VisitStmt(S);
346
347 bool HasNRVOCandidate = Record.readInt();
348
349 S->setRetValue(Record.readSubExpr());
350 if (HasNRVOCandidate)
351 S->setNRVOCandidate(readDeclAs<VarDecl>());
352
353 S->setReturnLoc(readSourceLocation());
354}
355
356void ASTStmtReader::VisitDeclStmt(DeclStmt *S) {
357 VisitStmt(S);
358 S->setStartLoc(readSourceLocation());
359 S->setEndLoc(readSourceLocation());
360
361 if (Record.size() - Record.getIdx() == 1) {
362 // Single declaration
363 S->setDeclGroup(DeclGroupRef(readDecl()));
364 } else {
365 SmallVector<Decl *, 16> Decls;
366 int N = Record.size() - Record.getIdx();
367 Decls.reserve(N);
368 for (int I = 0; I < N; ++I)
369 Decls.push_back(readDecl());
370 S->setDeclGroup(DeclGroupRef(DeclGroup::Create(Record.getContext(),
371 Decls.data(),
372 Decls.size())));
373 }
374}
375
376void ASTStmtReader::VisitAsmStmt(AsmStmt *S) {
377 VisitStmt(S);
378 S->NumOutputs = Record.readInt();
379 S->NumInputs = Record.readInt();
380 S->NumClobbers = Record.readInt();
381 S->setAsmLoc(readSourceLocation());
382 S->setVolatile(Record.readInt());
383 S->setSimple(Record.readInt());
384}
385
386void ASTStmtReader::VisitGCCAsmStmt(GCCAsmStmt *S) {
387 VisitAsmStmt(S);
388 S->NumLabels = Record.readInt();
389 S->setRParenLoc(readSourceLocation());
390 S->setAsmStringExpr(cast_or_null<Expr>(Record.readSubStmt()));
391
392 unsigned NumOutputs = S->getNumOutputs();
393 unsigned NumInputs = S->getNumInputs();
394 unsigned NumClobbers = S->getNumClobbers();
395 unsigned NumLabels = S->getNumLabels();
396
397 // Outputs and inputs
398 SmallVector<IdentifierInfo *, 16> Names;
399 SmallVector<Expr *, 16> Constraints;
400 SmallVector<Stmt*, 16> Exprs;
401 for (unsigned I = 0, N = NumOutputs + NumInputs; I != N; ++I) {
402 Names.push_back(Record.readIdentifier());
403 Constraints.push_back(cast_or_null<Expr>(Record.readSubStmt()));
404 Exprs.push_back(Record.readSubStmt());
405 }
406
407 // Constraints
408 SmallVector<Expr *, 16> Clobbers;
409 for (unsigned I = 0; I != NumClobbers; ++I)
410 Clobbers.push_back(cast_or_null<Expr>(Record.readSubStmt()));
411
412 // Labels
413 for (unsigned I = 0, N = NumLabels; I != N; ++I) {
414 Names.push_back(Record.readIdentifier());
415 Exprs.push_back(Record.readSubStmt());
416 }
417
418 S->setOutputsAndInputsAndClobbers(Record.getContext(),
419 Names.data(), Constraints.data(),
420 Exprs.data(), NumOutputs, NumInputs,
421 NumLabels,
422 Clobbers.data(), NumClobbers);
423}
424
425void ASTStmtReader::VisitMSAsmStmt(MSAsmStmt *S) {
426 VisitAsmStmt(S);
427 S->LBraceLoc = readSourceLocation();
428 S->EndLoc = readSourceLocation();
429 S->NumAsmToks = Record.readInt();
430 std::string AsmStr = readString();
431
432 // Read the tokens.
433 SmallVector<Token, 16> AsmToks;
434 AsmToks.reserve(S->NumAsmToks);
435 for (unsigned i = 0, e = S->NumAsmToks; i != e; ++i) {
436 AsmToks.push_back(Record.readToken());
437 }
438
439 // The calls to reserve() for the FooData vectors are mandatory to
440 // prevent dead StringRefs in the Foo vectors.
441
442 // Read the clobbers.
443 SmallVector<std::string, 16> ClobbersData;
444 SmallVector<StringRef, 16> Clobbers;
445 ClobbersData.reserve(S->NumClobbers);
446 Clobbers.reserve(S->NumClobbers);
447 for (unsigned i = 0, e = S->NumClobbers; i != e; ++i) {
448 ClobbersData.push_back(readString());
449 Clobbers.push_back(ClobbersData.back());
450 }
451
452 // Read the operands.
453 unsigned NumOperands = S->NumOutputs + S->NumInputs;
454 SmallVector<Expr*, 16> Exprs;
455 SmallVector<std::string, 16> ConstraintsData;
456 SmallVector<StringRef, 16> Constraints;
457 Exprs.reserve(NumOperands);
458 ConstraintsData.reserve(NumOperands);
459 Constraints.reserve(NumOperands);
460 for (unsigned i = 0; i != NumOperands; ++i) {
461 Exprs.push_back(cast<Expr>(Record.readSubStmt()));
462 ConstraintsData.push_back(readString());
463 Constraints.push_back(ConstraintsData.back());
464 }
465
466 S->initialize(Record.getContext(), AsmStr, AsmToks,
467 Constraints, Exprs, Clobbers);
468}
469
470void ASTStmtReader::VisitCoroutineBodyStmt(CoroutineBodyStmt *S) {
471 VisitStmt(S);
472 assert(Record.peekInt() == S->NumParams);
473 Record.skipInts(1);
474 auto *StoredStmts = S->getStoredStmts();
475 for (unsigned i = 0;
476 i < CoroutineBodyStmt::SubStmt::FirstParamMove + S->NumParams; ++i)
477 StoredStmts[i] = Record.readSubStmt();
478}
479
480void ASTStmtReader::VisitCoreturnStmt(CoreturnStmt *S) {
481 VisitStmt(S);
482 S->CoreturnLoc = Record.readSourceLocation();
483 for (auto &SubStmt: S->SubStmts)
484 SubStmt = Record.readSubStmt();
485 S->IsImplicit = Record.readInt() != 0;
486}
487
488void ASTStmtReader::VisitCoawaitExpr(CoawaitExpr *E) {
489 VisitExpr(E);
490 E->KeywordLoc = readSourceLocation();
491 for (auto &SubExpr: E->SubExprs)
492 SubExpr = Record.readSubStmt();
493 E->OpaqueValue = cast_or_null<OpaqueValueExpr>(Record.readSubStmt());
494 E->setIsImplicit(Record.readInt() != 0);
495}
496
497void ASTStmtReader::VisitCoyieldExpr(CoyieldExpr *E) {
498 VisitExpr(E);
499 E->KeywordLoc = readSourceLocation();
500 for (auto &SubExpr: E->SubExprs)
501 SubExpr = Record.readSubStmt();
502 E->OpaqueValue = cast_or_null<OpaqueValueExpr>(Record.readSubStmt());
503}
504
505void ASTStmtReader::VisitDependentCoawaitExpr(DependentCoawaitExpr *E) {
506 VisitExpr(E);
507 E->KeywordLoc = readSourceLocation();
508 for (auto &SubExpr: E->SubExprs)
509 SubExpr = Record.readSubStmt();
510}
511
512void ASTStmtReader::VisitCapturedStmt(CapturedStmt *S) {
513 VisitStmt(S);
514 Record.skipInts(1);
515 S->setCapturedDecl(readDeclAs<CapturedDecl>());
516 S->setCapturedRegionKind(static_cast<CapturedRegionKind>(Record.readInt()));
517 S->setCapturedRecordDecl(readDeclAs<RecordDecl>());
518
519 // Capture inits
521 E = S->capture_init_end();
522 I != E; ++I)
523 *I = Record.readSubExpr();
524
525 // Body
526 S->setCapturedStmt(Record.readSubStmt());
528
529 // Captures
530 for (auto &I : S->captures()) {
531 I.VarAndKind.setPointer(readDeclAs<VarDecl>());
532 I.VarAndKind.setInt(
533 static_cast<CapturedStmt::VariableCaptureKind>(Record.readInt()));
534 I.Loc = readSourceLocation();
535 }
536}
537
538void ASTStmtReader::VisitSYCLKernelCallStmt(SYCLKernelCallStmt *S) {
539 VisitStmt(S);
540 S->setOriginalStmt(cast<CompoundStmt>(Record.readSubStmt()));
541 S->setOutlinedFunctionDecl(readDeclAs<OutlinedFunctionDecl>());
542}
543
544void ASTStmtReader::VisitExpr(Expr *E) {
545 VisitStmt(E);
546 CurrentUnpackingBits.emplace(Record.readInt());
547 E->setDependence(static_cast<ExprDependence>(
548 CurrentUnpackingBits->getNextBits(/*Width=*/5)));
549 E->setValueKind(static_cast<ExprValueKind>(
550 CurrentUnpackingBits->getNextBits(/*Width=*/2)));
551 E->setObjectKind(static_cast<ExprObjectKind>(
552 CurrentUnpackingBits->getNextBits(/*Width=*/3)));
553
554 E->setType(Record.readType());
555 assert(Record.getIdx() == NumExprFields &&
556 "Incorrect expression field count");
557}
558
559void ASTStmtReader::VisitConstantExpr(ConstantExpr *E) {
560 VisitExpr(E);
561
562 auto StorageKind = static_cast<ConstantResultStorageKind>(Record.readInt());
563 assert(E->getResultStorageKind() == StorageKind && "Wrong ResultKind!");
564
565 E->ConstantExprBits.APValueKind = Record.readInt();
566 E->ConstantExprBits.IsUnsigned = Record.readInt();
567 E->ConstantExprBits.BitWidth = Record.readInt();
568 E->ConstantExprBits.HasCleanup = false; // Not serialized, see below.
569 E->ConstantExprBits.IsImmediateInvocation = Record.readInt();
570
571 switch (StorageKind) {
573 break;
574
576 E->Int64Result() = Record.readInt();
577 break;
578
580 E->APValueResult() = Record.readAPValue();
581 if (E->APValueResult().needsCleanup()) {
582 E->ConstantExprBits.HasCleanup = true;
583 Record.getContext().addDestruction(&E->APValueResult());
584 }
585 break;
586 }
587
588 E->setSubExpr(Record.readSubExpr());
589}
590
591void ASTStmtReader::VisitOpenACCAsteriskSizeExpr(OpenACCAsteriskSizeExpr *E) {
592 VisitExpr(E);
593 E->setAsteriskLocation(readSourceLocation());
594}
595
596void ASTStmtReader::VisitSYCLUniqueStableNameExpr(SYCLUniqueStableNameExpr *E) {
597 VisitExpr(E);
598
599 E->setLocation(readSourceLocation());
600 E->setLParenLocation(readSourceLocation());
601 E->setRParenLocation(readSourceLocation());
602
603 E->setTypeSourceInfo(Record.readTypeSourceInfo());
604}
605
606void ASTStmtReader::VisitPredefinedExpr(PredefinedExpr *E) {
607 VisitExpr(E);
608 bool HasFunctionName = Record.readInt();
609 E->PredefinedExprBits.HasFunctionName = HasFunctionName;
610 E->PredefinedExprBits.Kind = Record.readInt();
611 E->PredefinedExprBits.IsTransparent = Record.readInt();
612 E->setLocation(readSourceLocation());
613 if (HasFunctionName)
614 E->setFunctionName(cast<StringLiteral>(Record.readSubExpr()));
615}
616
617void ASTStmtReader::VisitDeclRefExpr(DeclRefExpr *E) {
618 VisitExpr(E);
619
620 CurrentUnpackingBits.emplace(Record.readInt());
621 E->DeclRefExprBits.HadMultipleCandidates = CurrentUnpackingBits->getNextBit();
622 E->DeclRefExprBits.RefersToEnclosingVariableOrCapture =
623 CurrentUnpackingBits->getNextBit();
624 E->DeclRefExprBits.NonOdrUseReason =
625 CurrentUnpackingBits->getNextBits(/*Width=*/2);
626 E->DeclRefExprBits.IsImmediateEscalating = CurrentUnpackingBits->getNextBit();
627 E->DeclRefExprBits.HasFoundDecl = CurrentUnpackingBits->getNextBit();
628 E->DeclRefExprBits.HasQualifier = CurrentUnpackingBits->getNextBit();
629 E->DeclRefExprBits.HasTemplateKWAndArgsInfo =
630 CurrentUnpackingBits->getNextBit();
631 E->DeclRefExprBits.CapturedByCopyInLambdaWithExplicitObjectParameter = false;
632 unsigned NumTemplateArgs = 0;
634 NumTemplateArgs = Record.readInt();
635
636 if (E->hasQualifier())
637 new (E->getTrailingObjects<NestedNameSpecifierLoc>())
638 NestedNameSpecifierLoc(Record.readNestedNameSpecifierLoc());
639
640 if (E->hasFoundDecl())
641 *E->getTrailingObjects<NamedDecl *>() = readDeclAs<NamedDecl>();
642
645 *E->getTrailingObjects<ASTTemplateKWAndArgsInfo>(),
646 E->getTrailingObjects<TemplateArgumentLoc>(), NumTemplateArgs);
647
648 E->D = readDeclAs<ValueDecl>();
649 E->setLocation(readSourceLocation());
650 E->DNLoc = Record.readDeclarationNameLoc(E->getDecl()->getDeclName());
651}
652
653void ASTStmtReader::VisitIntegerLiteral(IntegerLiteral *E) {
654 VisitExpr(E);
655 E->setLocation(readSourceLocation());
656 E->setValue(Record.getContext(), Record.readAPInt());
657}
658
659void ASTStmtReader::VisitFixedPointLiteral(FixedPointLiteral *E) {
660 VisitExpr(E);
661 E->setLocation(readSourceLocation());
662 E->setScale(Record.readInt());
663 E->setValue(Record.getContext(), Record.readAPInt());
664}
665
666void ASTStmtReader::VisitFloatingLiteral(FloatingLiteral *E) {
667 VisitExpr(E);
669 static_cast<llvm::APFloatBase::Semantics>(Record.readInt()));
670 E->setExact(Record.readInt());
671 E->setValue(Record.getContext(), Record.readAPFloat(E->getSemantics()));
672 E->setLocation(readSourceLocation());
673}
674
675void ASTStmtReader::VisitImaginaryLiteral(ImaginaryLiteral *E) {
676 VisitExpr(E);
677 E->setSubExpr(Record.readSubExpr());
678}
679
680void ASTStmtReader::VisitStringLiteral(StringLiteral *E) {
681 VisitExpr(E);
682
683 // NumConcatenated, Length and CharByteWidth are set by the empty
684 // ctor since they are needed to allocate storage for the trailing objects.
685 unsigned NumConcatenated = Record.readInt();
686 unsigned Length = Record.readInt();
687 unsigned CharByteWidth = Record.readInt();
688 assert((NumConcatenated == E->getNumConcatenated()) &&
689 "Wrong number of concatenated tokens!");
690 assert((Length == E->getLength()) && "Wrong Length!");
691 assert((CharByteWidth == E->getCharByteWidth()) && "Wrong character width!");
692 E->StringLiteralBits.Kind = Record.readInt();
693 E->StringLiteralBits.IsPascal = Record.readInt();
694
695 // The character width is originally computed via mapCharByteWidth.
696 // Check that the deserialized character width is consistant with the result
697 // of calling mapCharByteWidth.
698 assert((CharByteWidth ==
699 StringLiteral::mapCharByteWidth(Record.getContext().getTargetInfo(),
700 E->getKind())) &&
701 "Wrong character width!");
702
703 // Deserialize the trailing array of SourceLocation.
704 for (unsigned I = 0; I < NumConcatenated; ++I)
705 E->setStrTokenLoc(I, readSourceLocation());
706
707 // Deserialize the trailing array of char holding the string data.
708 char *StrData = E->getStrDataAsChar();
709 for (unsigned I = 0; I < Length * CharByteWidth; ++I)
710 StrData[I] = Record.readInt();
711}
712
713void ASTStmtReader::VisitCharacterLiteral(CharacterLiteral *E) {
714 VisitExpr(E);
715 E->setValue(Record.readInt());
716 E->setLocation(readSourceLocation());
717 E->setKind(static_cast<CharacterLiteralKind>(Record.readInt()));
718}
719
720void ASTStmtReader::VisitParenExpr(ParenExpr *E) {
721 VisitExpr(E);
722 E->setIsProducedByFoldExpansion(Record.readInt());
723 E->setLParen(readSourceLocation());
724 E->setRParen(readSourceLocation());
725 E->setSubExpr(Record.readSubExpr());
726}
727
728void ASTStmtReader::VisitParenListExpr(ParenListExpr *E) {
729 VisitExpr(E);
730 unsigned NumExprs = Record.readInt();
731 assert((NumExprs == E->getNumExprs()) && "Wrong NumExprs!");
732 for (unsigned I = 0; I != NumExprs; ++I)
733 E->getTrailingObjects()[I] = Record.readSubStmt();
734 E->LParenLoc = readSourceLocation();
735 E->RParenLoc = readSourceLocation();
736}
737
738void ASTStmtReader::VisitUnaryOperator(UnaryOperator *E) {
739 VisitExpr(E);
740 bool hasFP_Features = CurrentUnpackingBits->getNextBit();
741 assert(hasFP_Features == E->hasStoredFPFeatures());
742 E->setSubExpr(Record.readSubExpr());
743 E->setOpcode(
744 (UnaryOperator::Opcode)CurrentUnpackingBits->getNextBits(/*Width=*/5));
745 E->setOperatorLoc(readSourceLocation());
746 E->setCanOverflow(CurrentUnpackingBits->getNextBit());
747 if (hasFP_Features)
749 FPOptionsOverride::getFromOpaqueInt(Record.readInt()));
750}
751
752void ASTStmtReader::VisitOffsetOfExpr(OffsetOfExpr *E) {
753 VisitExpr(E);
754 assert(E->getNumComponents() == Record.peekInt());
755 Record.skipInts(1);
756 assert(E->getNumExpressions() == Record.peekInt());
757 Record.skipInts(1);
758 E->setOperatorLoc(readSourceLocation());
759 E->setRParenLoc(readSourceLocation());
760 E->setTypeSourceInfo(readTypeSourceInfo());
761 for (unsigned I = 0, N = E->getNumComponents(); I != N; ++I) {
762 auto Kind = static_cast<OffsetOfNode::Kind>(Record.readInt());
763 SourceLocation Start = readSourceLocation();
764 SourceLocation End = readSourceLocation();
765 switch (Kind) {
767 E->setComponent(I, OffsetOfNode(Start, Record.readInt(), End));
768 break;
769
771 E->setComponent(
772 I, OffsetOfNode(Start, readDeclAs<FieldDecl>(), End));
773 break;
774
776 E->setComponent(
777 I,
778 OffsetOfNode(Start, Record.readIdentifier(), End));
779 break;
780
781 case OffsetOfNode::Base: {
782 auto *Base = new (Record.getContext()) CXXBaseSpecifier();
783 *Base = Record.readCXXBaseSpecifier();
784 E->setComponent(I, OffsetOfNode(Base));
785 break;
786 }
787 }
788 }
789
790 for (unsigned I = 0, N = E->getNumExpressions(); I != N; ++I)
791 E->setIndexExpr(I, Record.readSubExpr());
792}
793
794void ASTStmtReader::VisitUnaryExprOrTypeTraitExpr(UnaryExprOrTypeTraitExpr *E) {
795 VisitExpr(E);
796 E->setKind(static_cast<UnaryExprOrTypeTrait>(Record.readInt()));
797 if (Record.peekInt() == 0) {
798 E->setArgument(Record.readSubExpr());
799 Record.skipInts(1);
800 } else {
801 E->setArgument(readTypeSourceInfo());
802 }
803 E->setOperatorLoc(readSourceLocation());
804 E->setRParenLoc(readSourceLocation());
805}
806
809 ConstraintSatisfaction Satisfaction;
810 Satisfaction.IsSatisfied = Record.readInt();
811 Satisfaction.ContainsErrors = Record.readInt();
812 const ASTContext &C = Record.getContext();
813 if (!Satisfaction.IsSatisfied) {
814 unsigned NumDetailRecords = Record.readInt();
815 for (unsigned i = 0; i != NumDetailRecords; ++i) {
816 auto Kind = Record.readInt();
817 if (Kind == 0) {
818 SourceLocation DiagLocation = Record.readSourceLocation();
819 StringRef DiagMessage = C.backupStr(Record.readString());
820
821 Satisfaction.Details.emplace_back(new (
822 C) ConstraintSubstitutionDiagnostic(DiagLocation, DiagMessage));
823 } else if (Kind == 1) {
824 Satisfaction.Details.emplace_back(Record.readExpr());
825 } else {
826 assert(Kind == 2);
827 Satisfaction.Details.emplace_back(Record.readConceptReference());
828 }
829 }
830 }
831 return Satisfaction;
832}
833
834void ASTStmtReader::VisitConceptSpecializationExpr(
836 VisitExpr(E);
837 E->SpecDecl = Record.readDeclAs<ImplicitConceptSpecializationDecl>();
838 if (Record.readBool())
839 E->ConceptRef = Record.readConceptReference();
840 E->Satisfaction = E->isValueDependent() ? nullptr :
841 ASTConstraintSatisfaction::Create(Record.getContext(),
843}
844
847 const ASTContext &C = Record.getContext();
848 StringRef SubstitutedEntity = C.backupStr(Record.readString());
849 SourceLocation DiagLoc = Record.readSourceLocation();
850 StringRef DiagMessage = C.backupStr(Record.readString());
851
852 return new (Record.getContext())
853 concepts::Requirement::SubstitutionDiagnostic{SubstitutedEntity, DiagLoc,
854 DiagMessage};
855}
856
857void ASTStmtReader::VisitRequiresExpr(RequiresExpr *E) {
858 VisitExpr(E);
859 unsigned NumLocalParameters = Record.readInt();
860 unsigned NumRequirements = Record.readInt();
861 E->RequiresExprBits.RequiresKWLoc = Record.readSourceLocation();
862 E->RequiresExprBits.IsSatisfied = Record.readInt();
863 E->Body = Record.readDeclAs<RequiresExprBodyDecl>();
864 llvm::SmallVector<ParmVarDecl *, 4> LocalParameters;
865 for (unsigned i = 0; i < NumLocalParameters; ++i)
866 LocalParameters.push_back(cast<ParmVarDecl>(Record.readDecl()));
867 std::copy(LocalParameters.begin(), LocalParameters.end(),
868 E->getTrailingObjects<ParmVarDecl *>());
869 llvm::SmallVector<concepts::Requirement *, 4> Requirements;
870 for (unsigned i = 0; i < NumRequirements; ++i) {
871 auto RK =
872 static_cast<concepts::Requirement::RequirementKind>(Record.readInt());
873 concepts::Requirement *R = nullptr;
874 switch (RK) {
876 auto Status =
878 Record.readInt());
880 R = new (Record.getContext())
881 concepts::TypeRequirement(readSubstitutionDiagnostic(Record));
882 else
883 R = new (Record.getContext())
884 concepts::TypeRequirement(Record.readTypeSourceInfo());
885 } break;
888 auto Status =
890 Record.readInt());
891 llvm::PointerUnion<concepts::Requirement::SubstitutionDiagnostic *,
892 Expr *> E;
894 E = readSubstitutionDiagnostic(Record);
895 } else
896 E = Record.readExpr();
897
898 std::optional<concepts::ExprRequirement::ReturnTypeRequirement> Req;
899 ConceptSpecializationExpr *SubstitutedConstraintExpr = nullptr;
900 SourceLocation NoexceptLoc;
902 Req.emplace();
903 } else {
904 NoexceptLoc = Record.readSourceLocation();
905 switch (/* returnTypeRequirementKind */Record.readInt()) {
906 case 0:
907 // No return type requirement.
908 Req.emplace();
909 break;
910 case 1: {
911 // type-constraint
912 TemplateParameterList *TPL = Record.readTemplateParameterList();
913 if (Status >=
915 SubstitutedConstraintExpr =
916 cast<ConceptSpecializationExpr>(Record.readExpr());
917 Req.emplace(TPL);
918 } break;
919 case 2:
920 // Substitution failure
921 Req.emplace(readSubstitutionDiagnostic(Record));
922 break;
923 }
924 }
925 if (Expr *Ex = E.dyn_cast<Expr *>())
926 R = new (Record.getContext()) concepts::ExprRequirement(
927 Ex, RK == concepts::Requirement::RK_Simple, NoexceptLoc,
928 std::move(*Req), Status, SubstitutedConstraintExpr);
929 else
930 R = new (Record.getContext()) concepts::ExprRequirement(
932 RK == concepts::Requirement::RK_Simple, NoexceptLoc,
933 std::move(*Req));
934 } break;
936 ASTContext &C = Record.getContext();
937 bool HasInvalidConstraint = Record.readInt();
938 if (HasInvalidConstraint) {
939 StringRef InvalidConstraint = C.backupStr(Record.readString());
940 R = new (C) concepts::NestedRequirement(
941 Record.getContext(), InvalidConstraint,
943 break;
944 }
945 Expr *E = Record.readExpr();
947 R = new (C) concepts::NestedRequirement(E);
948 else
949 R = new (C) concepts::NestedRequirement(
950 C, E, readConstraintSatisfaction(Record));
951 } break;
952 }
953 if (!R)
954 continue;
955 Requirements.push_back(R);
956 }
957 std::copy(Requirements.begin(), Requirements.end(),
958 E->getTrailingObjects<concepts::Requirement *>());
959 E->LParenLoc = Record.readSourceLocation();
960 E->RParenLoc = Record.readSourceLocation();
961 E->RBraceLoc = Record.readSourceLocation();
962}
963
964void ASTStmtReader::VisitArraySubscriptExpr(ArraySubscriptExpr *E) {
965 VisitExpr(E);
966 E->setLHS(Record.readSubExpr());
967 E->setRHS(Record.readSubExpr());
968 E->setRBracketLoc(readSourceLocation());
969}
970
971void ASTStmtReader::VisitMatrixSubscriptExpr(MatrixSubscriptExpr *E) {
972 VisitExpr(E);
973 E->setBase(Record.readSubExpr());
974 E->setRowIdx(Record.readSubExpr());
975 E->setColumnIdx(Record.readSubExpr());
976 E->setRBracketLoc(readSourceLocation());
977}
978
979void ASTStmtReader::VisitArraySectionExpr(ArraySectionExpr *E) {
980 VisitExpr(E);
981 E->ASType = Record.readEnum<ArraySectionExpr::ArraySectionType>();
982
983 E->setBase(Record.readSubExpr());
984 E->setLowerBound(Record.readSubExpr());
985 E->setLength(Record.readSubExpr());
986
987 if (E->isOMPArraySection())
988 E->setStride(Record.readSubExpr());
989
990 E->setColonLocFirst(readSourceLocation());
991
992 if (E->isOMPArraySection())
993 E->setColonLocSecond(readSourceLocation());
994
995 E->setRBracketLoc(readSourceLocation());
996}
997
998void ASTStmtReader::VisitOMPArrayShapingExpr(OMPArrayShapingExpr *E) {
999 VisitExpr(E);
1000 unsigned NumDims = Record.readInt();
1001 E->setBase(Record.readSubExpr());
1002 SmallVector<Expr *, 4> Dims(NumDims);
1003 for (unsigned I = 0; I < NumDims; ++I)
1004 Dims[I] = Record.readSubExpr();
1005 E->setDimensions(Dims);
1006 SmallVector<SourceRange, 4> SRs(NumDims);
1007 for (unsigned I = 0; I < NumDims; ++I)
1008 SRs[I] = readSourceRange();
1009 E->setBracketsRanges(SRs);
1010 E->setLParenLoc(readSourceLocation());
1011 E->setRParenLoc(readSourceLocation());
1012}
1013
1014void ASTStmtReader::VisitOMPIteratorExpr(OMPIteratorExpr *E) {
1015 VisitExpr(E);
1016 unsigned NumIters = Record.readInt();
1017 E->setIteratorKwLoc(readSourceLocation());
1018 E->setLParenLoc(readSourceLocation());
1019 E->setRParenLoc(readSourceLocation());
1020 for (unsigned I = 0; I < NumIters; ++I) {
1021 E->setIteratorDeclaration(I, Record.readDeclRef());
1022 E->setAssignmentLoc(I, readSourceLocation());
1023 Expr *Begin = Record.readSubExpr();
1024 Expr *End = Record.readSubExpr();
1025 Expr *Step = Record.readSubExpr();
1026 SourceLocation ColonLoc = readSourceLocation();
1027 SourceLocation SecColonLoc;
1028 if (Step)
1029 SecColonLoc = readSourceLocation();
1030 E->setIteratorRange(I, Begin, ColonLoc, End, SecColonLoc, Step);
1031 // Deserialize helpers
1032 OMPIteratorHelperData HD;
1033 HD.CounterVD = cast_or_null<VarDecl>(Record.readDeclRef());
1034 HD.Upper = Record.readSubExpr();
1035 HD.Update = Record.readSubExpr();
1036 HD.CounterUpdate = Record.readSubExpr();
1037 E->setHelper(I, HD);
1038 }
1039}
1040
1041void ASTStmtReader::VisitCallExpr(CallExpr *E) {
1042 VisitExpr(E);
1043
1044 unsigned NumArgs = Record.readInt();
1045 CurrentUnpackingBits.emplace(Record.readInt());
1046 E->setADLCallKind(
1047 static_cast<CallExpr::ADLCallKind>(CurrentUnpackingBits->getNextBit()));
1048 bool HasFPFeatures = CurrentUnpackingBits->getNextBit();
1049 E->setCoroElideSafe(CurrentUnpackingBits->getNextBit());
1050 E->setUsesMemberSyntax(CurrentUnpackingBits->getNextBit());
1051 assert((NumArgs == E->getNumArgs()) && "Wrong NumArgs!");
1052 E->setRParenLoc(readSourceLocation());
1053 E->setCallee(Record.readSubExpr());
1054 for (unsigned I = 0; I != NumArgs; ++I)
1055 E->setArg(I, Record.readSubExpr());
1056
1057 if (HasFPFeatures)
1059 FPOptionsOverride::getFromOpaqueInt(Record.readInt()));
1060
1061 if (E->getStmtClass() == Stmt::CallExprClass)
1062 E->updateTrailingSourceLoc();
1063}
1064
1065void ASTStmtReader::VisitCXXMemberCallExpr(CXXMemberCallExpr *E) {
1066 VisitCallExpr(E);
1067}
1068
1069void ASTStmtReader::VisitMemberExpr(MemberExpr *E) {
1070 VisitExpr(E);
1071
1072 CurrentUnpackingBits.emplace(Record.readInt());
1073 bool HasQualifier = CurrentUnpackingBits->getNextBit();
1074 bool HasFoundDecl = CurrentUnpackingBits->getNextBit();
1075 bool HasTemplateInfo = CurrentUnpackingBits->getNextBit();
1076 unsigned NumTemplateArgs = Record.readInt();
1077
1078 E->Base = Record.readSubExpr();
1079 E->MemberDecl = Record.readDeclAs<ValueDecl>();
1080 E->MemberDNLoc = Record.readDeclarationNameLoc(E->MemberDecl->getDeclName());
1081 E->MemberLoc = Record.readSourceLocation();
1082 E->MemberExprBits.IsArrow = CurrentUnpackingBits->getNextBit();
1083 E->MemberExprBits.HasQualifier = HasQualifier;
1084 E->MemberExprBits.HasFoundDecl = HasFoundDecl;
1085 E->MemberExprBits.HasTemplateKWAndArgsInfo = HasTemplateInfo;
1086 E->MemberExprBits.HadMultipleCandidates = CurrentUnpackingBits->getNextBit();
1087 E->MemberExprBits.NonOdrUseReason =
1088 CurrentUnpackingBits->getNextBits(/*Width=*/2);
1089 E->MemberExprBits.OperatorLoc = Record.readSourceLocation();
1090
1091 if (HasQualifier)
1092 new (E->getTrailingObjects<NestedNameSpecifierLoc>())
1093 NestedNameSpecifierLoc(Record.readNestedNameSpecifierLoc());
1094
1095 if (HasFoundDecl) {
1096 auto *FoundD = Record.readDeclAs<NamedDecl>();
1097 auto AS = (AccessSpecifier)CurrentUnpackingBits->getNextBits(/*Width=*/2);
1098 *E->getTrailingObjects<DeclAccessPair>() = DeclAccessPair::make(FoundD, AS);
1099 }
1100
1101 if (HasTemplateInfo)
1103 *E->getTrailingObjects<ASTTemplateKWAndArgsInfo>(),
1104 E->getTrailingObjects<TemplateArgumentLoc>(), NumTemplateArgs);
1105}
1106
1107void ASTStmtReader::VisitObjCIsaExpr(ObjCIsaExpr *E) {
1108 VisitExpr(E);
1109 E->setBase(Record.readSubExpr());
1110 E->setIsaMemberLoc(readSourceLocation());
1111 E->setOpLoc(readSourceLocation());
1112 E->setArrow(Record.readInt());
1113}
1114
1115void ASTStmtReader::
1116VisitObjCIndirectCopyRestoreExpr(ObjCIndirectCopyRestoreExpr *E) {
1117 VisitExpr(E);
1118 E->Operand = Record.readSubExpr();
1119 E->setShouldCopy(Record.readInt());
1120}
1121
1122void ASTStmtReader::VisitObjCBridgedCastExpr(ObjCBridgedCastExpr *E) {
1123 VisitExplicitCastExpr(E);
1124 E->LParenLoc = readSourceLocation();
1125 E->BridgeKeywordLoc = readSourceLocation();
1126 E->Kind = Record.readInt();
1127}
1128
1129void ASTStmtReader::VisitCastExpr(CastExpr *E) {
1130 VisitExpr(E);
1131 unsigned NumBaseSpecs = Record.readInt();
1132 assert(NumBaseSpecs == E->path_size());
1133
1134 CurrentUnpackingBits.emplace(Record.readInt());
1135 E->setCastKind((CastKind)CurrentUnpackingBits->getNextBits(/*Width=*/7));
1136 unsigned HasFPFeatures = CurrentUnpackingBits->getNextBit();
1137 assert(E->hasStoredFPFeatures() == HasFPFeatures);
1138
1139 E->setSubExpr(Record.readSubExpr());
1140
1142 while (NumBaseSpecs--) {
1143 auto *BaseSpec = new (Record.getContext()) CXXBaseSpecifier;
1144 *BaseSpec = Record.readCXXBaseSpecifier();
1145 *BaseI++ = BaseSpec;
1146 }
1147 if (HasFPFeatures)
1148 *E->getTrailingFPFeatures() =
1149 FPOptionsOverride::getFromOpaqueInt(Record.readInt());
1150}
1151
1152void ASTStmtReader::VisitBinaryOperator(BinaryOperator *E) {
1153 VisitExpr(E);
1154 CurrentUnpackingBits.emplace(Record.readInt());
1155 E->setOpcode(
1156 (BinaryOperator::Opcode)CurrentUnpackingBits->getNextBits(/*Width=*/6));
1157 bool hasFP_Features = CurrentUnpackingBits->getNextBit();
1158 E->setHasStoredFPFeatures(hasFP_Features);
1159 E->setExcludedOverflowPattern(CurrentUnpackingBits->getNextBit());
1160 E->setLHS(Record.readSubExpr());
1161 E->setRHS(Record.readSubExpr());
1162 E->setOperatorLoc(readSourceLocation());
1163 if (hasFP_Features)
1165 FPOptionsOverride::getFromOpaqueInt(Record.readInt()));
1166}
1167
1168void ASTStmtReader::VisitCompoundAssignOperator(CompoundAssignOperator *E) {
1169 VisitBinaryOperator(E);
1170 E->setComputationLHSType(Record.readType());
1171 E->setComputationResultType(Record.readType());
1172}
1173
1174void ASTStmtReader::VisitConditionalOperator(ConditionalOperator *E) {
1175 VisitExpr(E);
1176 E->SubExprs[ConditionalOperator::COND] = Record.readSubExpr();
1177 E->SubExprs[ConditionalOperator::LHS] = Record.readSubExpr();
1178 E->SubExprs[ConditionalOperator::RHS] = Record.readSubExpr();
1179 E->QuestionLoc = readSourceLocation();
1180 E->ColonLoc = readSourceLocation();
1181}
1182
1183void
1184ASTStmtReader::VisitBinaryConditionalOperator(BinaryConditionalOperator *E) {
1185 VisitExpr(E);
1186 E->OpaqueValue = cast<OpaqueValueExpr>(Record.readSubExpr());
1187 E->SubExprs[BinaryConditionalOperator::COMMON] = Record.readSubExpr();
1188 E->SubExprs[BinaryConditionalOperator::COND] = Record.readSubExpr();
1189 E->SubExprs[BinaryConditionalOperator::LHS] = Record.readSubExpr();
1190 E->SubExprs[BinaryConditionalOperator::RHS] = Record.readSubExpr();
1191 E->QuestionLoc = readSourceLocation();
1192 E->ColonLoc = readSourceLocation();
1193}
1194
1195void ASTStmtReader::VisitImplicitCastExpr(ImplicitCastExpr *E) {
1196 VisitCastExpr(E);
1197 E->setIsPartOfExplicitCast(CurrentUnpackingBits->getNextBit());
1198}
1199
1200void ASTStmtReader::VisitExplicitCastExpr(ExplicitCastExpr *E) {
1201 VisitCastExpr(E);
1202 E->setTypeInfoAsWritten(readTypeSourceInfo());
1203}
1204
1205void ASTStmtReader::VisitCStyleCastExpr(CStyleCastExpr *E) {
1206 VisitExplicitCastExpr(E);
1207 E->setLParenLoc(readSourceLocation());
1208 E->setRParenLoc(readSourceLocation());
1209}
1210
1211void ASTStmtReader::VisitCompoundLiteralExpr(CompoundLiteralExpr *E) {
1212 VisitExpr(E);
1213 E->setLParenLoc(readSourceLocation());
1214 E->setTypeSourceInfo(readTypeSourceInfo());
1215 E->setInitializer(Record.readSubExpr());
1216 E->setFileScope(Record.readInt());
1217}
1218
1219void ASTStmtReader::VisitExtVectorElementExpr(ExtVectorElementExpr *E) {
1220 VisitExpr(E);
1221 E->setBase(Record.readSubExpr());
1222 E->setAccessor(Record.readIdentifier());
1223 E->setAccessorLoc(readSourceLocation());
1224}
1225
1226void ASTStmtReader::VisitInitListExpr(InitListExpr *E) {
1227 VisitExpr(E);
1228 if (auto *SyntForm = cast_or_null<InitListExpr>(Record.readSubStmt()))
1229 E->setSyntacticForm(SyntForm);
1230 E->setLBraceLoc(readSourceLocation());
1231 E->setRBraceLoc(readSourceLocation());
1232 bool isArrayFiller = Record.readInt();
1233 Expr *filler = nullptr;
1234 if (isArrayFiller) {
1235 filler = Record.readSubExpr();
1236 E->ArrayFillerOrUnionFieldInit = filler;
1237 } else
1238 E->ArrayFillerOrUnionFieldInit = readDeclAs<FieldDecl>();
1239 E->sawArrayRangeDesignator(Record.readInt());
1240 unsigned NumInits = Record.readInt();
1241 E->reserveInits(Record.getContext(), NumInits);
1242 if (isArrayFiller) {
1243 for (unsigned I = 0; I != NumInits; ++I) {
1244 Expr *init = Record.readSubExpr();
1245 E->updateInit(Record.getContext(), I, init ? init : filler);
1246 }
1247 } else {
1248 for (unsigned I = 0; I != NumInits; ++I)
1249 E->updateInit(Record.getContext(), I, Record.readSubExpr());
1250 }
1251}
1252
1253void ASTStmtReader::VisitDesignatedInitExpr(DesignatedInitExpr *E) {
1254 using Designator = DesignatedInitExpr::Designator;
1255
1256 VisitExpr(E);
1257 unsigned NumSubExprs = Record.readInt();
1258 assert(NumSubExprs == E->getNumSubExprs() && "Wrong number of subexprs");
1259 for (unsigned I = 0; I != NumSubExprs; ++I)
1260 E->setSubExpr(I, Record.readSubExpr());
1261 E->setEqualOrColonLoc(readSourceLocation());
1262 E->setGNUSyntax(Record.readInt());
1263
1264 SmallVector<Designator, 4> Designators;
1265 while (Record.getIdx() < Record.size()) {
1266 switch ((DesignatorTypes)Record.readInt()) {
1267 case DESIG_FIELD_DECL: {
1268 auto *Field = readDeclAs<FieldDecl>();
1269 SourceLocation DotLoc = readSourceLocation();
1270 SourceLocation FieldLoc = readSourceLocation();
1271 Designators.push_back(Designator::CreateFieldDesignator(
1272 Field->getIdentifier(), DotLoc, FieldLoc));
1273 Designators.back().setFieldDecl(Field);
1274 break;
1275 }
1276
1277 case DESIG_FIELD_NAME: {
1278 const IdentifierInfo *Name = Record.readIdentifier();
1279 SourceLocation DotLoc = readSourceLocation();
1280 SourceLocation FieldLoc = readSourceLocation();
1281 Designators.push_back(Designator::CreateFieldDesignator(Name, DotLoc,
1282 FieldLoc));
1283 break;
1284 }
1285
1286 case DESIG_ARRAY: {
1287 unsigned Index = Record.readInt();
1288 SourceLocation LBracketLoc = readSourceLocation();
1289 SourceLocation RBracketLoc = readSourceLocation();
1290 Designators.push_back(Designator::CreateArrayDesignator(Index,
1291 LBracketLoc,
1292 RBracketLoc));
1293 break;
1294 }
1295
1296 case DESIG_ARRAY_RANGE: {
1297 unsigned Index = Record.readInt();
1298 SourceLocation LBracketLoc = readSourceLocation();
1299 SourceLocation EllipsisLoc = readSourceLocation();
1300 SourceLocation RBracketLoc = readSourceLocation();
1301 Designators.push_back(Designator::CreateArrayRangeDesignator(
1302 Index, LBracketLoc, EllipsisLoc, RBracketLoc));
1303 break;
1304 }
1305 }
1306 }
1307 E->setDesignators(Record.getContext(),
1308 Designators.data(), Designators.size());
1309}
1310
1311void ASTStmtReader::VisitDesignatedInitUpdateExpr(DesignatedInitUpdateExpr *E) {
1312 VisitExpr(E);
1313 E->setBase(Record.readSubExpr());
1314 E->setUpdater(Record.readSubExpr());
1315}
1316
1317void ASTStmtReader::VisitNoInitExpr(NoInitExpr *E) {
1318 VisitExpr(E);
1319}
1320
1321void ASTStmtReader::VisitArrayInitLoopExpr(ArrayInitLoopExpr *E) {
1322 VisitExpr(E);
1323 E->SubExprs[0] = Record.readSubExpr();
1324 E->SubExprs[1] = Record.readSubExpr();
1325}
1326
1327void ASTStmtReader::VisitArrayInitIndexExpr(ArrayInitIndexExpr *E) {
1328 VisitExpr(E);
1329}
1330
1331void ASTStmtReader::VisitImplicitValueInitExpr(ImplicitValueInitExpr *E) {
1332 VisitExpr(E);
1333}
1334
1335void ASTStmtReader::VisitVAArgExpr(VAArgExpr *E) {
1336 VisitExpr(E);
1337 E->setSubExpr(Record.readSubExpr());
1338 E->setWrittenTypeInfo(readTypeSourceInfo());
1339 E->setBuiltinLoc(readSourceLocation());
1340 E->setRParenLoc(readSourceLocation());
1341 E->setIsMicrosoftABI(Record.readInt());
1342}
1343
1344void ASTStmtReader::VisitSourceLocExpr(SourceLocExpr *E) {
1345 VisitExpr(E);
1346 E->ParentContext = readDeclAs<DeclContext>();
1347 E->BuiltinLoc = readSourceLocation();
1348 E->RParenLoc = readSourceLocation();
1349 E->SourceLocExprBits.Kind = Record.readInt();
1350}
1351
1352void ASTStmtReader::VisitEmbedExpr(EmbedExpr *E) {
1353 VisitExpr(E);
1354 E->EmbedKeywordLoc = readSourceLocation();
1355 EmbedDataStorage *Data = new (Record.getContext()) EmbedDataStorage;
1356 Data->BinaryData = cast<StringLiteral>(Record.readSubStmt());
1357 E->Data = Data;
1358 E->Begin = Record.readInt();
1359 E->NumOfElements = Record.readInt();
1360}
1361
1362void ASTStmtReader::VisitAddrLabelExpr(AddrLabelExpr *E) {
1363 VisitExpr(E);
1364 E->setAmpAmpLoc(readSourceLocation());
1365 E->setLabelLoc(readSourceLocation());
1366 E->setLabel(readDeclAs<LabelDecl>());
1367}
1368
1369void ASTStmtReader::VisitStmtExpr(StmtExpr *E) {
1370 VisitExpr(E);
1371 E->setLParenLoc(readSourceLocation());
1372 E->setRParenLoc(readSourceLocation());
1373 E->setSubStmt(cast_or_null<CompoundStmt>(Record.readSubStmt()));
1374 E->StmtExprBits.TemplateDepth = Record.readInt();
1375}
1376
1377void ASTStmtReader::VisitChooseExpr(ChooseExpr *E) {
1378 VisitExpr(E);
1379 E->setCond(Record.readSubExpr());
1380 E->setLHS(Record.readSubExpr());
1381 E->setRHS(Record.readSubExpr());
1382 E->setBuiltinLoc(readSourceLocation());
1383 E->setRParenLoc(readSourceLocation());
1384 E->setIsConditionTrue(Record.readInt());
1385}
1386
1387void ASTStmtReader::VisitGNUNullExpr(GNUNullExpr *E) {
1388 VisitExpr(E);
1389 E->setTokenLocation(readSourceLocation());
1390}
1391
1392void ASTStmtReader::VisitShuffleVectorExpr(ShuffleVectorExpr *E) {
1393 VisitExpr(E);
1394 SmallVector<Expr *, 16> Exprs;
1395 unsigned NumExprs = Record.readInt();
1396 while (NumExprs--)
1397 Exprs.push_back(Record.readSubExpr());
1398 E->setExprs(Record.getContext(), Exprs);
1399 E->setBuiltinLoc(readSourceLocation());
1400 E->setRParenLoc(readSourceLocation());
1401}
1402
1403void ASTStmtReader::VisitConvertVectorExpr(ConvertVectorExpr *E) {
1404 VisitExpr(E);
1405 bool HasFPFeatures = CurrentUnpackingBits->getNextBit();
1406 assert(HasFPFeatures == E->hasStoredFPFeatures());
1407 E->BuiltinLoc = readSourceLocation();
1408 E->RParenLoc = readSourceLocation();
1409 E->TInfo = readTypeSourceInfo();
1410 E->SrcExpr = Record.readSubExpr();
1411 if (HasFPFeatures)
1413 FPOptionsOverride::getFromOpaqueInt(Record.readInt()));
1414}
1415
1416void ASTStmtReader::VisitBlockExpr(BlockExpr *E) {
1417 VisitExpr(E);
1418 E->setBlockDecl(readDeclAs<BlockDecl>());
1419}
1420
1421void ASTStmtReader::VisitGenericSelectionExpr(GenericSelectionExpr *E) {
1422 VisitExpr(E);
1423
1424 unsigned NumAssocs = Record.readInt();
1425 assert(NumAssocs == E->getNumAssocs() && "Wrong NumAssocs!");
1426 E->IsExprPredicate = Record.readInt();
1427 E->ResultIndex = Record.readInt();
1428 E->GenericSelectionExprBits.GenericLoc = readSourceLocation();
1429 E->DefaultLoc = readSourceLocation();
1430 E->RParenLoc = readSourceLocation();
1431
1432 Stmt **Stmts = E->getTrailingObjects<Stmt *>();
1433 // Add 1 to account for the controlling expression which is the first
1434 // expression in the trailing array of Stmt *. This is not needed for
1435 // the trailing array of TypeSourceInfo *.
1436 for (unsigned I = 0, N = NumAssocs + 1; I < N; ++I)
1437 Stmts[I] = Record.readSubExpr();
1438
1439 TypeSourceInfo **TSIs = E->getTrailingObjects<TypeSourceInfo *>();
1440 for (unsigned I = 0, N = NumAssocs; I < N; ++I)
1441 TSIs[I] = readTypeSourceInfo();
1442}
1443
1444void ASTStmtReader::VisitPseudoObjectExpr(PseudoObjectExpr *E) {
1445 VisitExpr(E);
1446 unsigned numSemanticExprs = Record.readInt();
1447 assert(numSemanticExprs + 1 == E->PseudoObjectExprBits.NumSubExprs);
1448 E->PseudoObjectExprBits.ResultIndex = Record.readInt();
1449
1450 // Read the syntactic expression.
1451 E->getTrailingObjects()[0] = Record.readSubExpr();
1452
1453 // Read all the semantic expressions.
1454 for (unsigned i = 0; i != numSemanticExprs; ++i) {
1455 Expr *subExpr = Record.readSubExpr();
1456 E->getTrailingObjects()[i + 1] = subExpr;
1457 }
1458}
1459
1460void ASTStmtReader::VisitAtomicExpr(AtomicExpr *E) {
1461 VisitExpr(E);
1462 E->Op = AtomicExpr::AtomicOp(Record.readInt());
1463 E->NumSubExprs = AtomicExpr::getNumSubExprs(E->Op);
1464 for (unsigned I = 0; I != E->NumSubExprs; ++I)
1465 E->SubExprs[I] = Record.readSubExpr();
1466 E->BuiltinLoc = readSourceLocation();
1467 E->RParenLoc = readSourceLocation();
1468}
1469
1470//===----------------------------------------------------------------------===//
1471// Objective-C Expressions and Statements
1472
1473void ASTStmtReader::VisitObjCStringLiteral(ObjCStringLiteral *E) {
1474 VisitExpr(E);
1475 E->setString(cast<StringLiteral>(Record.readSubStmt()));
1476 E->setAtLoc(readSourceLocation());
1477}
1478
1479void ASTStmtReader::VisitObjCBoxedExpr(ObjCBoxedExpr *E) {
1480 VisitExpr(E);
1481 // could be one of several IntegerLiteral, FloatLiteral, etc.
1482 E->SubExpr = Record.readSubStmt();
1483 E->BoxingMethod = readDeclAs<ObjCMethodDecl>();
1484 E->Range = readSourceRange();
1485}
1486
1487void ASTStmtReader::VisitObjCArrayLiteral(ObjCArrayLiteral *E) {
1488 VisitExpr(E);
1489 unsigned NumElements = Record.readInt();
1490 assert(NumElements == E->getNumElements() && "Wrong number of elements");
1491 Expr **Elements = E->getElements();
1492 for (unsigned I = 0, N = NumElements; I != N; ++I)
1493 Elements[I] = Record.readSubExpr();
1494 E->ArrayWithObjectsMethod = readDeclAs<ObjCMethodDecl>();
1495 E->Range = readSourceRange();
1496}
1497
1498void ASTStmtReader::VisitObjCDictionaryLiteral(ObjCDictionaryLiteral *E) {
1499 VisitExpr(E);
1500 unsigned NumElements = Record.readInt();
1501 assert(NumElements == E->getNumElements() && "Wrong number of elements");
1502 bool HasPackExpansions = Record.readInt();
1503 assert(HasPackExpansions == E->HasPackExpansions &&"Pack expansion mismatch");
1504 auto *KeyValues =
1505 E->getTrailingObjects<ObjCDictionaryLiteral::KeyValuePair>();
1506 auto *Expansions =
1507 E->getTrailingObjects<ObjCDictionaryLiteral::ExpansionData>();
1508 for (unsigned I = 0; I != NumElements; ++I) {
1509 KeyValues[I].Key = Record.readSubExpr();
1510 KeyValues[I].Value = Record.readSubExpr();
1511 if (HasPackExpansions) {
1512 Expansions[I].EllipsisLoc = readSourceLocation();
1513 Expansions[I].NumExpansionsPlusOne = Record.readInt();
1514 }
1515 }
1516 E->DictWithObjectsMethod = readDeclAs<ObjCMethodDecl>();
1517 E->Range = readSourceRange();
1518}
1519
1520void ASTStmtReader::VisitObjCEncodeExpr(ObjCEncodeExpr *E) {
1521 VisitExpr(E);
1522 E->setEncodedTypeSourceInfo(readTypeSourceInfo());
1523 E->setAtLoc(readSourceLocation());
1524 E->setRParenLoc(readSourceLocation());
1525}
1526
1527void ASTStmtReader::VisitObjCSelectorExpr(ObjCSelectorExpr *E) {
1528 VisitExpr(E);
1529 E->setSelector(Record.readSelector());
1530 E->setAtLoc(readSourceLocation());
1531 E->setRParenLoc(readSourceLocation());
1532}
1533
1534void ASTStmtReader::VisitObjCProtocolExpr(ObjCProtocolExpr *E) {
1535 VisitExpr(E);
1536 E->setProtocol(readDeclAs<ObjCProtocolDecl>());
1537 E->setAtLoc(readSourceLocation());
1538 E->ProtoLoc = readSourceLocation();
1539 E->setRParenLoc(readSourceLocation());
1540}
1541
1542void ASTStmtReader::VisitObjCIvarRefExpr(ObjCIvarRefExpr *E) {
1543 VisitExpr(E);
1544 E->setDecl(readDeclAs<ObjCIvarDecl>());
1545 E->setLocation(readSourceLocation());
1546 E->setOpLoc(readSourceLocation());
1547 E->setBase(Record.readSubExpr());
1548 E->setIsArrow(Record.readInt());
1549 E->setIsFreeIvar(Record.readInt());
1550}
1551
1552void ASTStmtReader::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *E) {
1553 VisitExpr(E);
1554 unsigned MethodRefFlags = Record.readInt();
1555 bool Implicit = Record.readInt() != 0;
1556 if (Implicit) {
1557 auto *Getter = readDeclAs<ObjCMethodDecl>();
1558 auto *Setter = readDeclAs<ObjCMethodDecl>();
1559 E->setImplicitProperty(Getter, Setter, MethodRefFlags);
1560 } else {
1561 E->setExplicitProperty(readDeclAs<ObjCPropertyDecl>(), MethodRefFlags);
1562 }
1563 E->setLocation(readSourceLocation());
1564 E->setReceiverLocation(readSourceLocation());
1565 switch (Record.readInt()) {
1566 case 0:
1567 E->setBase(Record.readSubExpr());
1568 break;
1569 case 1:
1570 E->setSuperReceiver(Record.readType());
1571 break;
1572 case 2:
1573 E->setClassReceiver(readDeclAs<ObjCInterfaceDecl>());
1574 break;
1575 }
1576}
1577
1578void ASTStmtReader::VisitObjCSubscriptRefExpr(ObjCSubscriptRefExpr *E) {
1579 VisitExpr(E);
1580 E->setRBracket(readSourceLocation());
1581 E->setBaseExpr(Record.readSubExpr());
1582 E->setKeyExpr(Record.readSubExpr());
1583 E->GetAtIndexMethodDecl = readDeclAs<ObjCMethodDecl>();
1584 E->SetAtIndexMethodDecl = readDeclAs<ObjCMethodDecl>();
1585}
1586
1587void ASTStmtReader::VisitObjCMessageExpr(ObjCMessageExpr *E) {
1588 VisitExpr(E);
1589 assert(Record.peekInt() == E->getNumArgs());
1590 Record.skipInts(1);
1591 unsigned NumStoredSelLocs = Record.readInt();
1592 E->SelLocsKind = Record.readInt();
1593 E->setDelegateInitCall(Record.readInt());
1594 E->IsImplicit = Record.readInt();
1595 auto Kind = static_cast<ObjCMessageExpr::ReceiverKind>(Record.readInt());
1596 switch (Kind) {
1598 E->setInstanceReceiver(Record.readSubExpr());
1599 break;
1600
1602 E->setClassReceiver(readTypeSourceInfo());
1603 break;
1604
1607 QualType T = Record.readType();
1608 SourceLocation SuperLoc = readSourceLocation();
1609 E->setSuper(SuperLoc, T, Kind == ObjCMessageExpr::SuperInstance);
1610 break;
1611 }
1612 }
1613
1614 assert(Kind == E->getReceiverKind());
1615
1616 if (Record.readInt())
1617 E->setMethodDecl(readDeclAs<ObjCMethodDecl>());
1618 else
1619 E->setSelector(Record.readSelector());
1620
1621 E->LBracLoc = readSourceLocation();
1622 E->RBracLoc = readSourceLocation();
1623
1624 for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
1625 E->setArg(I, Record.readSubExpr());
1626
1627 SourceLocation *Locs = E->getStoredSelLocs();
1628 for (unsigned I = 0; I != NumStoredSelLocs; ++I)
1629 Locs[I] = readSourceLocation();
1630}
1631
1632void ASTStmtReader::VisitObjCForCollectionStmt(ObjCForCollectionStmt *S) {
1633 VisitStmt(S);
1634 S->setElement(Record.readSubStmt());
1635 S->setCollection(Record.readSubExpr());
1636 S->setBody(Record.readSubStmt());
1637 S->setForLoc(readSourceLocation());
1638 S->setRParenLoc(readSourceLocation());
1639}
1640
1641void ASTStmtReader::VisitObjCAtCatchStmt(ObjCAtCatchStmt *S) {
1642 VisitStmt(S);
1643 S->setCatchBody(Record.readSubStmt());
1644 S->setCatchParamDecl(readDeclAs<VarDecl>());
1645 S->setAtCatchLoc(readSourceLocation());
1646 S->setRParenLoc(readSourceLocation());
1647}
1648
1649void ASTStmtReader::VisitObjCAtFinallyStmt(ObjCAtFinallyStmt *S) {
1650 VisitStmt(S);
1651 S->setFinallyBody(Record.readSubStmt());
1652 S->setAtFinallyLoc(readSourceLocation());
1653}
1654
1655void ASTStmtReader::VisitObjCAutoreleasePoolStmt(ObjCAutoreleasePoolStmt *S) {
1656 VisitStmt(S); // FIXME: no test coverage.
1657 S->setSubStmt(Record.readSubStmt());
1658 S->setAtLoc(readSourceLocation());
1659}
1660
1661void ASTStmtReader::VisitObjCAtTryStmt(ObjCAtTryStmt *S) {
1662 VisitStmt(S);
1663 assert(Record.peekInt() == S->getNumCatchStmts());
1664 Record.skipInts(1);
1665 bool HasFinally = Record.readInt();
1666 S->setTryBody(Record.readSubStmt());
1667 for (unsigned I = 0, N = S->getNumCatchStmts(); I != N; ++I)
1668 S->setCatchStmt(I, cast_or_null<ObjCAtCatchStmt>(Record.readSubStmt()));
1669
1670 if (HasFinally)
1671 S->setFinallyStmt(Record.readSubStmt());
1672 S->setAtTryLoc(readSourceLocation());
1673}
1674
1675void ASTStmtReader::VisitObjCAtSynchronizedStmt(ObjCAtSynchronizedStmt *S) {
1676 VisitStmt(S); // FIXME: no test coverage.
1677 S->setSynchExpr(Record.readSubStmt());
1678 S->setSynchBody(Record.readSubStmt());
1679 S->setAtSynchronizedLoc(readSourceLocation());
1680}
1681
1682void ASTStmtReader::VisitObjCAtThrowStmt(ObjCAtThrowStmt *S) {
1683 VisitStmt(S); // FIXME: no test coverage.
1684 S->setThrowExpr(Record.readSubStmt());
1685 S->setThrowLoc(readSourceLocation());
1686}
1687
1688void ASTStmtReader::VisitObjCBoolLiteralExpr(ObjCBoolLiteralExpr *E) {
1689 VisitExpr(E);
1690 E->setValue(Record.readInt());
1691 E->setLocation(readSourceLocation());
1692}
1693
1694void ASTStmtReader::VisitObjCAvailabilityCheckExpr(ObjCAvailabilityCheckExpr *E) {
1695 VisitExpr(E);
1696 SourceRange R = Record.readSourceRange();
1697 E->AtLoc = R.getBegin();
1698 E->RParen = R.getEnd();
1699 E->VersionToCheck = Record.readVersionTuple();
1700}
1701
1702//===----------------------------------------------------------------------===//
1703// C++ Expressions and Statements
1704//===----------------------------------------------------------------------===//
1705
1706void ASTStmtReader::VisitCXXCatchStmt(CXXCatchStmt *S) {
1707 VisitStmt(S);
1708 S->CatchLoc = readSourceLocation();
1709 S->ExceptionDecl = readDeclAs<VarDecl>();
1710 S->HandlerBlock = Record.readSubStmt();
1711}
1712
1713void ASTStmtReader::VisitCXXTryStmt(CXXTryStmt *S) {
1714 VisitStmt(S);
1715 assert(Record.peekInt() == S->getNumHandlers() && "NumStmtFields is wrong ?");
1716 Record.skipInts(1);
1717 S->TryLoc = readSourceLocation();
1718 S->getStmts()[0] = Record.readSubStmt();
1719 for (unsigned i = 0, e = S->getNumHandlers(); i != e; ++i)
1720 S->getStmts()[i + 1] = Record.readSubStmt();
1721}
1722
1723void ASTStmtReader::VisitCXXForRangeStmt(CXXForRangeStmt *S) {
1724 VisitStmt(S);
1725 S->ForLoc = readSourceLocation();
1726 S->CoawaitLoc = readSourceLocation();
1727 S->ColonLoc = readSourceLocation();
1728 S->RParenLoc = readSourceLocation();
1729 S->setInit(Record.readSubStmt());
1730 S->setRangeStmt(Record.readSubStmt());
1731 S->setBeginStmt(Record.readSubStmt());
1732 S->setEndStmt(Record.readSubStmt());
1733 S->setCond(Record.readSubExpr());
1734 S->setInc(Record.readSubExpr());
1735 S->setLoopVarStmt(Record.readSubStmt());
1736 S->setBody(Record.readSubStmt());
1737}
1738
1739void ASTStmtReader::VisitMSDependentExistsStmt(MSDependentExistsStmt *S) {
1740 VisitStmt(S);
1741 S->KeywordLoc = readSourceLocation();
1742 S->IsIfExists = Record.readInt();
1743 S->QualifierLoc = Record.readNestedNameSpecifierLoc();
1744 S->NameInfo = Record.readDeclarationNameInfo();
1745 S->SubStmt = Record.readSubStmt();
1746}
1747
1748void ASTStmtReader::VisitCXXOperatorCallExpr(CXXOperatorCallExpr *E) {
1749 VisitCallExpr(E);
1750 E->CXXOperatorCallExprBits.OperatorKind = Record.readInt();
1751 E->BeginLoc = Record.readSourceLocation();
1752}
1753
1754void ASTStmtReader::VisitCXXRewrittenBinaryOperator(
1756 VisitExpr(E);
1757 E->CXXRewrittenBinaryOperatorBits.IsReversed = Record.readInt();
1758 E->SemanticForm = Record.readSubExpr();
1759}
1760
1761void ASTStmtReader::VisitCXXConstructExpr(CXXConstructExpr *E) {
1762 VisitExpr(E);
1763
1764 unsigned NumArgs = Record.readInt();
1765 assert((NumArgs == E->getNumArgs()) && "Wrong NumArgs!");
1766
1767 E->CXXConstructExprBits.Elidable = Record.readInt();
1768 E->CXXConstructExprBits.HadMultipleCandidates = Record.readInt();
1769 E->CXXConstructExprBits.ListInitialization = Record.readInt();
1770 E->CXXConstructExprBits.StdInitListInitialization = Record.readInt();
1771 E->CXXConstructExprBits.ZeroInitialization = Record.readInt();
1772 E->CXXConstructExprBits.ConstructionKind = Record.readInt();
1773 E->CXXConstructExprBits.IsImmediateEscalating = Record.readInt();
1774 E->CXXConstructExprBits.Loc = readSourceLocation();
1775 E->Constructor = readDeclAs<CXXConstructorDecl>();
1776 E->ParenOrBraceRange = readSourceRange();
1777
1778 for (unsigned I = 0; I != NumArgs; ++I)
1779 E->setArg(I, Record.readSubExpr());
1780}
1781
1782void ASTStmtReader::VisitCXXInheritedCtorInitExpr(CXXInheritedCtorInitExpr *E) {
1783 VisitExpr(E);
1784 E->Constructor = readDeclAs<CXXConstructorDecl>();
1785 E->Loc = readSourceLocation();
1786 E->ConstructsVirtualBase = Record.readInt();
1787 E->InheritedFromVirtualBase = Record.readInt();
1788}
1789
1790void ASTStmtReader::VisitCXXTemporaryObjectExpr(CXXTemporaryObjectExpr *E) {
1791 VisitCXXConstructExpr(E);
1792 E->TSI = readTypeSourceInfo();
1793}
1794
1795void ASTStmtReader::VisitLambdaExpr(LambdaExpr *E) {
1796 VisitExpr(E);
1797 unsigned NumCaptures = Record.readInt();
1798 (void)NumCaptures;
1799 assert(NumCaptures == E->LambdaExprBits.NumCaptures);
1800 E->IntroducerRange = readSourceRange();
1801 E->LambdaExprBits.CaptureDefault = Record.readInt();
1802 E->CaptureDefaultLoc = readSourceLocation();
1803 E->LambdaExprBits.ExplicitParams = Record.readInt();
1804 E->LambdaExprBits.ExplicitResultType = Record.readInt();
1805 E->ClosingBrace = readSourceLocation();
1806
1807 // Read capture initializers.
1809 CEnd = E->capture_init_end();
1810 C != CEnd; ++C)
1811 *C = Record.readSubExpr();
1812
1813 // The body will be lazily deserialized when needed from the call operator
1814 // declaration.
1815}
1816
1817void
1818ASTStmtReader::VisitCXXStdInitializerListExpr(CXXStdInitializerListExpr *E) {
1819 VisitExpr(E);
1820 E->SubExpr = Record.readSubExpr();
1821}
1822
1823void ASTStmtReader::VisitCXXNamedCastExpr(CXXNamedCastExpr *E) {
1824 VisitExplicitCastExpr(E);
1825 SourceRange R = readSourceRange();
1826 E->Loc = R.getBegin();
1827 E->RParenLoc = R.getEnd();
1828 if (CurrentUnpackingBits->getNextBit())
1829 E->AngleBrackets = readSourceRange();
1830}
1831
1832void ASTStmtReader::VisitCXXStaticCastExpr(CXXStaticCastExpr *E) {
1833 return VisitCXXNamedCastExpr(E);
1834}
1835
1836void ASTStmtReader::VisitCXXDynamicCastExpr(CXXDynamicCastExpr *E) {
1837 return VisitCXXNamedCastExpr(E);
1838}
1839
1840void ASTStmtReader::VisitCXXReinterpretCastExpr(CXXReinterpretCastExpr *E) {
1841 return VisitCXXNamedCastExpr(E);
1842}
1843
1844void ASTStmtReader::VisitCXXAddrspaceCastExpr(CXXAddrspaceCastExpr *E) {
1845 return VisitCXXNamedCastExpr(E);
1846}
1847
1848void ASTStmtReader::VisitCXXConstCastExpr(CXXConstCastExpr *E) {
1849 return VisitCXXNamedCastExpr(E);
1850}
1851
1852void ASTStmtReader::VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr *E) {
1853 VisitExplicitCastExpr(E);
1854 E->setLParenLoc(readSourceLocation());
1855 E->setRParenLoc(readSourceLocation());
1856}
1857
1858void ASTStmtReader::VisitBuiltinBitCastExpr(BuiltinBitCastExpr *E) {
1859 VisitExplicitCastExpr(E);
1860 E->KWLoc = readSourceLocation();
1861 E->RParenLoc = readSourceLocation();
1862}
1863
1864void ASTStmtReader::VisitUserDefinedLiteral(UserDefinedLiteral *E) {
1865 VisitCallExpr(E);
1866 E->UDSuffixLoc = readSourceLocation();
1867}
1868
1869void ASTStmtReader::VisitCXXBoolLiteralExpr(CXXBoolLiteralExpr *E) {
1870 VisitExpr(E);
1871 E->setValue(Record.readInt());
1872 E->setLocation(readSourceLocation());
1873}
1874
1875void ASTStmtReader::VisitCXXNullPtrLiteralExpr(CXXNullPtrLiteralExpr *E) {
1876 VisitExpr(E);
1877 E->setLocation(readSourceLocation());
1878}
1879
1880void ASTStmtReader::VisitCXXTypeidExpr(CXXTypeidExpr *E) {
1881 VisitExpr(E);
1882 E->setSourceRange(readSourceRange());
1883 if (E->isTypeOperand())
1884 E->Operand = readTypeSourceInfo();
1885 else
1886 E->Operand = Record.readSubExpr();
1887}
1888
1889void ASTStmtReader::VisitCXXThisExpr(CXXThisExpr *E) {
1890 VisitExpr(E);
1891 E->setLocation(readSourceLocation());
1892 E->setImplicit(Record.readInt());
1894}
1895
1896void ASTStmtReader::VisitCXXThrowExpr(CXXThrowExpr *E) {
1897 VisitExpr(E);
1898 E->CXXThrowExprBits.ThrowLoc = readSourceLocation();
1899 E->Operand = Record.readSubExpr();
1900 E->CXXThrowExprBits.IsThrownVariableInScope = Record.readInt();
1901}
1902
1903void ASTStmtReader::VisitCXXDefaultArgExpr(CXXDefaultArgExpr *E) {
1904 VisitExpr(E);
1905 E->Param = readDeclAs<ParmVarDecl>();
1906 E->UsedContext = readDeclAs<DeclContext>();
1907 E->CXXDefaultArgExprBits.Loc = readSourceLocation();
1908 E->CXXDefaultArgExprBits.HasRewrittenInit = Record.readInt();
1909 if (E->CXXDefaultArgExprBits.HasRewrittenInit)
1910 *E->getTrailingObjects() = Record.readSubExpr();
1911}
1912
1913void ASTStmtReader::VisitCXXDefaultInitExpr(CXXDefaultInitExpr *E) {
1914 VisitExpr(E);
1915 E->CXXDefaultInitExprBits.HasRewrittenInit = Record.readInt();
1916 E->Field = readDeclAs<FieldDecl>();
1917 E->UsedContext = readDeclAs<DeclContext>();
1918 E->CXXDefaultInitExprBits.Loc = readSourceLocation();
1919 if (E->CXXDefaultInitExprBits.HasRewrittenInit)
1920 *E->getTrailingObjects() = Record.readSubExpr();
1921}
1922
1923void ASTStmtReader::VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *E) {
1924 VisitExpr(E);
1925 E->setTemporary(Record.readCXXTemporary());
1926 E->setSubExpr(Record.readSubExpr());
1927}
1928
1929void ASTStmtReader::VisitCXXScalarValueInitExpr(CXXScalarValueInitExpr *E) {
1930 VisitExpr(E);
1931 E->TypeInfo = readTypeSourceInfo();
1932 E->CXXScalarValueInitExprBits.RParenLoc = readSourceLocation();
1933}
1934
1935void ASTStmtReader::VisitCXXNewExpr(CXXNewExpr *E) {
1936 VisitExpr(E);
1937
1938 bool IsArray = Record.readInt();
1939 bool HasInit = Record.readInt();
1940 unsigned NumPlacementArgs = Record.readInt();
1941 bool IsParenTypeId = Record.readInt();
1942
1943 E->CXXNewExprBits.IsGlobalNew = Record.readInt();
1944 E->CXXNewExprBits.ShouldPassAlignment = Record.readInt();
1945 E->CXXNewExprBits.ShouldPassTypeIdentity = Record.readInt();
1946 E->CXXNewExprBits.UsualArrayDeleteWantsSize = Record.readInt();
1947 E->CXXNewExprBits.HasInitializer = Record.readInt();
1948 E->CXXNewExprBits.StoredInitializationStyle = Record.readInt();
1949
1950 assert((IsArray == E->isArray()) && "Wrong IsArray!");
1951 assert((HasInit == E->hasInitializer()) && "Wrong HasInit!");
1952 assert((NumPlacementArgs == E->getNumPlacementArgs()) &&
1953 "Wrong NumPlacementArgs!");
1954 assert((IsParenTypeId == E->isParenTypeId()) && "Wrong IsParenTypeId!");
1955 (void)IsArray;
1956 (void)HasInit;
1957 (void)NumPlacementArgs;
1958
1959 E->setOperatorNew(readDeclAs<FunctionDecl>());
1960 E->setOperatorDelete(readDeclAs<FunctionDecl>());
1961 E->AllocatedTypeInfo = readTypeSourceInfo();
1962 if (IsParenTypeId)
1963 E->getTrailingObjects<SourceRange>()[0] = readSourceRange();
1964 E->Range = readSourceRange();
1965 E->DirectInitRange = readSourceRange();
1966
1967 // Install all the subexpressions.
1969 N = E->raw_arg_end();
1970 I != N; ++I)
1971 *I = Record.readSubStmt();
1972}
1973
1974void ASTStmtReader::VisitCXXDeleteExpr(CXXDeleteExpr *E) {
1975 VisitExpr(E);
1976 E->CXXDeleteExprBits.GlobalDelete = Record.readInt();
1977 E->CXXDeleteExprBits.ArrayForm = Record.readInt();
1978 E->CXXDeleteExprBits.ArrayFormAsWritten = Record.readInt();
1979 E->CXXDeleteExprBits.UsualArrayDeleteWantsSize = Record.readInt();
1980 E->OperatorDelete = readDeclAs<FunctionDecl>();
1981 E->Argument = Record.readSubExpr();
1982 E->CXXDeleteExprBits.Loc = readSourceLocation();
1983}
1984
1985void ASTStmtReader::VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr *E) {
1986 VisitExpr(E);
1987
1988 E->Base = Record.readSubExpr();
1989 E->IsArrow = Record.readInt();
1990 E->OperatorLoc = readSourceLocation();
1991 E->QualifierLoc = Record.readNestedNameSpecifierLoc();
1992 E->ScopeType = readTypeSourceInfo();
1993 E->ColonColonLoc = readSourceLocation();
1994 E->TildeLoc = readSourceLocation();
1995
1996 IdentifierInfo *II = Record.readIdentifier();
1997 if (II)
1998 E->setDestroyedType(II, readSourceLocation());
1999 else
2000 E->setDestroyedType(readTypeSourceInfo());
2001}
2002
2003void ASTStmtReader::VisitExprWithCleanups(ExprWithCleanups *E) {
2004 VisitExpr(E);
2005
2006 unsigned NumObjects = Record.readInt();
2007 assert(NumObjects == E->getNumObjects());
2008 for (unsigned i = 0; i != NumObjects; ++i) {
2009 unsigned CleanupKind = Record.readInt();
2011 if (CleanupKind == COK_Block)
2012 Obj = readDeclAs<BlockDecl>();
2013 else if (CleanupKind == COK_CompoundLiteral)
2014 Obj = cast<CompoundLiteralExpr>(Record.readSubExpr());
2015 else
2016 llvm_unreachable("unexpected cleanup object type");
2017 E->getTrailingObjects()[i] = Obj;
2018 }
2019
2020 E->ExprWithCleanupsBits.CleanupsHaveSideEffects = Record.readInt();
2021 E->SubExpr = Record.readSubExpr();
2022}
2023
2024void ASTStmtReader::VisitCXXDependentScopeMemberExpr(
2026 VisitExpr(E);
2027
2028 unsigned NumTemplateArgs = Record.readInt();
2029 CurrentUnpackingBits.emplace(Record.readInt());
2030 bool HasTemplateKWAndArgsInfo = CurrentUnpackingBits->getNextBit();
2031 bool HasFirstQualifierFoundInScope = CurrentUnpackingBits->getNextBit();
2032
2033 assert((HasTemplateKWAndArgsInfo == E->hasTemplateKWAndArgsInfo()) &&
2034 "Wrong HasTemplateKWAndArgsInfo!");
2035 assert(
2036 (HasFirstQualifierFoundInScope == E->hasFirstQualifierFoundInScope()) &&
2037 "Wrong HasFirstQualifierFoundInScope!");
2038
2039 if (HasTemplateKWAndArgsInfo)
2041 *E->getTrailingObjects<ASTTemplateKWAndArgsInfo>(),
2042 E->getTrailingObjects<TemplateArgumentLoc>(), NumTemplateArgs);
2043
2044 assert((NumTemplateArgs == E->getNumTemplateArgs()) &&
2045 "Wrong NumTemplateArgs!");
2046
2048 CurrentUnpackingBits->getNextBit();
2049
2050 E->BaseType = Record.readType();
2051 E->QualifierLoc = Record.readNestedNameSpecifierLoc();
2052 // not ImplicitAccess
2053 if (CurrentUnpackingBits->getNextBit())
2054 E->Base = Record.readSubExpr();
2055 else
2056 E->Base = nullptr;
2057
2058 E->CXXDependentScopeMemberExprBits.OperatorLoc = readSourceLocation();
2059
2060 if (HasFirstQualifierFoundInScope)
2061 *E->getTrailingObjects<NamedDecl *>() = readDeclAs<NamedDecl>();
2062
2063 E->MemberNameInfo = Record.readDeclarationNameInfo();
2064}
2065
2066void
2067ASTStmtReader::VisitDependentScopeDeclRefExpr(DependentScopeDeclRefExpr *E) {
2068 VisitExpr(E);
2069
2070 if (CurrentUnpackingBits->getNextBit()) // HasTemplateKWAndArgsInfo
2072 *E->getTrailingObjects<ASTTemplateKWAndArgsInfo>(),
2073 E->getTrailingObjects<TemplateArgumentLoc>(),
2074 /*NumTemplateArgs=*/CurrentUnpackingBits->getNextBits(/*Width=*/16));
2075
2076 E->QualifierLoc = Record.readNestedNameSpecifierLoc();
2077 E->NameInfo = Record.readDeclarationNameInfo();
2078}
2079
2080void
2081ASTStmtReader::VisitCXXUnresolvedConstructExpr(CXXUnresolvedConstructExpr *E) {
2082 VisitExpr(E);
2083 assert(Record.peekInt() == E->getNumArgs() &&
2084 "Read wrong record during creation ?");
2085 Record.skipInts(1);
2086 for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
2087 E->setArg(I, Record.readSubExpr());
2088 E->TypeAndInitForm.setPointer(readTypeSourceInfo());
2089 E->setLParenLoc(readSourceLocation());
2090 E->setRParenLoc(readSourceLocation());
2091 E->TypeAndInitForm.setInt(Record.readInt());
2092}
2093
2094void ASTStmtReader::VisitOverloadExpr(OverloadExpr *E) {
2095 VisitExpr(E);
2096
2097 unsigned NumResults = Record.readInt();
2098 CurrentUnpackingBits.emplace(Record.readInt());
2099 bool HasTemplateKWAndArgsInfo = CurrentUnpackingBits->getNextBit();
2100 assert((E->getNumDecls() == NumResults) && "Wrong NumResults!");
2101 assert((E->hasTemplateKWAndArgsInfo() == HasTemplateKWAndArgsInfo) &&
2102 "Wrong HasTemplateKWAndArgsInfo!");
2103
2104 unsigned NumTemplateArgs = 0;
2105 if (HasTemplateKWAndArgsInfo) {
2106 NumTemplateArgs = Record.readInt();
2109 NumTemplateArgs);
2110 }
2111
2112 UnresolvedSet<8> Decls;
2113 for (unsigned I = 0; I != NumResults; ++I) {
2114 auto *D = readDeclAs<NamedDecl>();
2115 auto AS = (AccessSpecifier)Record.readInt();
2116 Decls.addDecl(D, AS);
2117 }
2118
2119 DeclAccessPair *Results = E->getTrailingResults();
2120 UnresolvedSetIterator Iter = Decls.begin();
2121 for (unsigned I = 0; I != NumResults; ++I) {
2122 Results[I] = (Iter + I).getPair();
2123 }
2124
2125 assert((E->getNumTemplateArgs() == NumTemplateArgs) &&
2126 "Wrong NumTemplateArgs!");
2127
2128 E->NameInfo = Record.readDeclarationNameInfo();
2129 E->QualifierLoc = Record.readNestedNameSpecifierLoc();
2130}
2131
2132void ASTStmtReader::VisitUnresolvedMemberExpr(UnresolvedMemberExpr *E) {
2133 VisitOverloadExpr(E);
2134 E->UnresolvedMemberExprBits.IsArrow = CurrentUnpackingBits->getNextBit();
2135 E->UnresolvedMemberExprBits.HasUnresolvedUsing =
2136 CurrentUnpackingBits->getNextBit();
2137
2138 if (/*!isImplicitAccess=*/CurrentUnpackingBits->getNextBit())
2139 E->Base = Record.readSubExpr();
2140 else
2141 E->Base = nullptr;
2142
2143 E->OperatorLoc = readSourceLocation();
2144
2145 E->BaseType = Record.readType();
2146}
2147
2148void ASTStmtReader::VisitUnresolvedLookupExpr(UnresolvedLookupExpr *E) {
2149 VisitOverloadExpr(E);
2150 E->UnresolvedLookupExprBits.RequiresADL = CurrentUnpackingBits->getNextBit();
2151 E->NamingClass = readDeclAs<CXXRecordDecl>();
2152}
2153
2154void ASTStmtReader::VisitTypeTraitExpr(TypeTraitExpr *E) {
2155 VisitExpr(E);
2156 E->TypeTraitExprBits.IsBooleanTypeTrait = Record.readInt();
2157 E->TypeTraitExprBits.NumArgs = Record.readInt();
2158 E->TypeTraitExprBits.Kind = Record.readInt();
2159
2160 if (E->TypeTraitExprBits.IsBooleanTypeTrait)
2161 E->TypeTraitExprBits.Value = Record.readInt();
2162 else
2163 *E->getTrailingObjects<APValue>() = Record.readAPValue();
2164
2165 SourceRange Range = readSourceRange();
2166 E->Loc = Range.getBegin();
2167 E->RParenLoc = Range.getEnd();
2168
2169 auto **Args = E->getTrailingObjects<TypeSourceInfo *>();
2170 for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
2171 Args[I] = readTypeSourceInfo();
2172}
2173
2174void ASTStmtReader::VisitArrayTypeTraitExpr(ArrayTypeTraitExpr *E) {
2175 VisitExpr(E);
2176 E->ArrayTypeTraitExprBits.ATT = (ArrayTypeTrait)Record.readInt();
2177 E->Value = (unsigned int)Record.readInt();
2178 SourceRange Range = readSourceRange();
2179 E->Loc = Range.getBegin();
2180 E->RParen = Range.getEnd();
2181 E->QueriedType = readTypeSourceInfo();
2182 E->Dimension = Record.readSubExpr();
2183}
2184
2185void ASTStmtReader::VisitExpressionTraitExpr(ExpressionTraitExpr *E) {
2186 VisitExpr(E);
2187 E->ExpressionTraitExprBits.ET = (ExpressionTrait)Record.readInt();
2188 E->ExpressionTraitExprBits.Value = (bool)Record.readInt();
2189 SourceRange Range = readSourceRange();
2190 E->QueriedExpression = Record.readSubExpr();
2191 E->Loc = Range.getBegin();
2192 E->RParen = Range.getEnd();
2193}
2194
2195void ASTStmtReader::VisitCXXNoexceptExpr(CXXNoexceptExpr *E) {
2196 VisitExpr(E);
2197 E->CXXNoexceptExprBits.Value = Record.readInt();
2198 E->Range = readSourceRange();
2199 E->Operand = Record.readSubExpr();
2200}
2201
2202void ASTStmtReader::VisitPackExpansionExpr(PackExpansionExpr *E) {
2203 VisitExpr(E);
2204 E->EllipsisLoc = readSourceLocation();
2205 E->NumExpansions = Record.readInt();
2206 E->Pattern = Record.readSubExpr();
2207}
2208
2209void ASTStmtReader::VisitSizeOfPackExpr(SizeOfPackExpr *E) {
2210 VisitExpr(E);
2211 unsigned NumPartialArgs = Record.readInt();
2212 E->OperatorLoc = readSourceLocation();
2213 E->PackLoc = readSourceLocation();
2214 E->RParenLoc = readSourceLocation();
2215 E->Pack = Record.readDeclAs<NamedDecl>();
2216 if (E->isPartiallySubstituted()) {
2217 assert(E->Length == NumPartialArgs);
2218 for (auto *I = E->getTrailingObjects(), *E = I + NumPartialArgs; I != E;
2219 ++I)
2220 new (I) TemplateArgument(Record.readTemplateArgument());
2221 } else if (!E->isValueDependent()) {
2222 E->Length = Record.readInt();
2223 }
2224}
2225
2226void ASTStmtReader::VisitPackIndexingExpr(PackIndexingExpr *E) {
2227 VisitExpr(E);
2228 E->PackIndexingExprBits.TransformedExpressions = Record.readInt();
2229 E->PackIndexingExprBits.FullySubstituted = Record.readInt();
2230 E->EllipsisLoc = readSourceLocation();
2231 E->RSquareLoc = readSourceLocation();
2232 E->SubExprs[0] = Record.readStmt();
2233 E->SubExprs[1] = Record.readStmt();
2234 auto **Exprs = E->getTrailingObjects();
2235 for (unsigned I = 0; I < E->PackIndexingExprBits.TransformedExpressions; ++I)
2236 Exprs[I] = Record.readExpr();
2237}
2238
2239void ASTStmtReader::VisitSubstNonTypeTemplateParmExpr(
2241 VisitExpr(E);
2242 E->AssociatedDeclAndRef.setPointer(readDeclAs<Decl>());
2243 E->AssociatedDeclAndRef.setInt(CurrentUnpackingBits->getNextBit());
2244 E->Index = CurrentUnpackingBits->getNextBits(/*Width=*/12);
2245 E->PackIndex = Record.readUnsignedOrNone().toInternalRepresentation();
2246 E->Final = CurrentUnpackingBits->getNextBit();
2247 E->SubstNonTypeTemplateParmExprBits.NameLoc = readSourceLocation();
2248 E->Replacement = Record.readSubExpr();
2249}
2250
2251void ASTStmtReader::VisitSubstNonTypeTemplateParmPackExpr(
2253 VisitExpr(E);
2254 E->AssociatedDecl = readDeclAs<Decl>();
2255 E->Final = CurrentUnpackingBits->getNextBit();
2256 E->Index = Record.readInt();
2257 TemplateArgument ArgPack = Record.readTemplateArgument();
2258 if (ArgPack.getKind() != TemplateArgument::Pack)
2259 return;
2260
2261 E->Arguments = ArgPack.pack_begin();
2262 E->NumArguments = ArgPack.pack_size();
2263 E->NameLoc = readSourceLocation();
2264}
2265
2266void ASTStmtReader::VisitFunctionParmPackExpr(FunctionParmPackExpr *E) {
2267 VisitExpr(E);
2268 E->NumParameters = Record.readInt();
2269 E->ParamPack = readDeclAs<ValueDecl>();
2270 E->NameLoc = readSourceLocation();
2271 auto **Parms = E->getTrailingObjects();
2272 for (unsigned i = 0, n = E->NumParameters; i != n; ++i)
2273 Parms[i] = readDeclAs<ValueDecl>();
2274}
2275
2276void ASTStmtReader::VisitMaterializeTemporaryExpr(MaterializeTemporaryExpr *E) {
2277 VisitExpr(E);
2278 bool HasMaterialzedDecl = Record.readInt();
2279 if (HasMaterialzedDecl)
2280 E->State = cast<LifetimeExtendedTemporaryDecl>(Record.readDecl());
2281 else
2282 E->State = Record.readSubExpr();
2283}
2284
2285void ASTStmtReader::VisitCXXFoldExpr(CXXFoldExpr *E) {
2286 VisitExpr(E);
2287 E->LParenLoc = readSourceLocation();
2288 E->EllipsisLoc = readSourceLocation();
2289 E->RParenLoc = readSourceLocation();
2290 E->NumExpansions = Record.readUnsignedOrNone();
2291 E->SubExprs[0] = Record.readSubExpr();
2292 E->SubExprs[1] = Record.readSubExpr();
2293 E->SubExprs[2] = Record.readSubExpr();
2294 E->CXXFoldExprBits.Opcode = (BinaryOperatorKind)Record.readInt();
2295}
2296
2297void ASTStmtReader::VisitCXXParenListInitExpr(CXXParenListInitExpr *E) {
2298 VisitExpr(E);
2299 unsigned ExpectedNumExprs = Record.readInt();
2300 assert(E->NumExprs == ExpectedNumExprs &&
2301 "expected number of expressions does not equal the actual number of "
2302 "serialized expressions.");
2303 E->NumUserSpecifiedExprs = Record.readInt();
2304 E->InitLoc = readSourceLocation();
2305 E->LParenLoc = readSourceLocation();
2306 E->RParenLoc = readSourceLocation();
2307 for (unsigned I = 0; I < ExpectedNumExprs; I++)
2308 E->getTrailingObjects()[I] = Record.readSubExpr();
2309
2310 bool HasArrayFillerOrUnionDecl = Record.readBool();
2311 if (HasArrayFillerOrUnionDecl) {
2312 bool HasArrayFiller = Record.readBool();
2313 if (HasArrayFiller) {
2314 E->setArrayFiller(Record.readSubExpr());
2315 } else {
2316 E->setInitializedFieldInUnion(readDeclAs<FieldDecl>());
2317 }
2318 }
2319 E->updateDependence();
2320}
2321
2322void ASTStmtReader::VisitOpaqueValueExpr(OpaqueValueExpr *E) {
2323 VisitExpr(E);
2324 E->SourceExpr = Record.readSubExpr();
2325 E->OpaqueValueExprBits.Loc = readSourceLocation();
2326 E->setIsUnique(Record.readInt());
2327}
2328
2329void ASTStmtReader::VisitRecoveryExpr(RecoveryExpr *E) {
2330 VisitExpr(E);
2331 unsigned NumArgs = Record.readInt();
2332 E->BeginLoc = readSourceLocation();
2333 E->EndLoc = readSourceLocation();
2334 assert((NumArgs + 0LL ==
2335 std::distance(E->children().begin(), E->children().end())) &&
2336 "Wrong NumArgs!");
2337 (void)NumArgs;
2338 for (Stmt *&Child : E->children())
2339 Child = Record.readSubStmt();
2340}
2341
2342//===----------------------------------------------------------------------===//
2343// Microsoft Expressions and Statements
2344//===----------------------------------------------------------------------===//
2345void ASTStmtReader::VisitMSPropertyRefExpr(MSPropertyRefExpr *E) {
2346 VisitExpr(E);
2347 E->IsArrow = (Record.readInt() != 0);
2348 E->BaseExpr = Record.readSubExpr();
2349 E->QualifierLoc = Record.readNestedNameSpecifierLoc();
2350 E->MemberLoc = readSourceLocation();
2351 E->TheDecl = readDeclAs<MSPropertyDecl>();
2352}
2353
2354void ASTStmtReader::VisitMSPropertySubscriptExpr(MSPropertySubscriptExpr *E) {
2355 VisitExpr(E);
2356 E->setBase(Record.readSubExpr());
2357 E->setIdx(Record.readSubExpr());
2358 E->setRBracketLoc(readSourceLocation());
2359}
2360
2361void ASTStmtReader::VisitCXXUuidofExpr(CXXUuidofExpr *E) {
2362 VisitExpr(E);
2363 E->setSourceRange(readSourceRange());
2364 E->Guid = readDeclAs<MSGuidDecl>();
2365 if (E->isTypeOperand())
2366 E->Operand = readTypeSourceInfo();
2367 else
2368 E->Operand = Record.readSubExpr();
2369}
2370
2371void ASTStmtReader::VisitSEHLeaveStmt(SEHLeaveStmt *S) {
2372 VisitStmt(S);
2373 S->setLeaveLoc(readSourceLocation());
2374}
2375
2376void ASTStmtReader::VisitSEHExceptStmt(SEHExceptStmt *S) {
2377 VisitStmt(S);
2378 S->Loc = readSourceLocation();
2379 S->Children[SEHExceptStmt::FILTER_EXPR] = Record.readSubStmt();
2380 S->Children[SEHExceptStmt::BLOCK] = Record.readSubStmt();
2381}
2382
2383void ASTStmtReader::VisitSEHFinallyStmt(SEHFinallyStmt *S) {
2384 VisitStmt(S);
2385 S->Loc = readSourceLocation();
2386 S->Block = Record.readSubStmt();
2387}
2388
2389void ASTStmtReader::VisitSEHTryStmt(SEHTryStmt *S) {
2390 VisitStmt(S);
2391 S->IsCXXTry = Record.readInt();
2392 S->TryLoc = readSourceLocation();
2393 S->Children[SEHTryStmt::TRY] = Record.readSubStmt();
2394 S->Children[SEHTryStmt::HANDLER] = Record.readSubStmt();
2395}
2396
2397//===----------------------------------------------------------------------===//
2398// CUDA Expressions and Statements
2399//===----------------------------------------------------------------------===//
2400
2401void ASTStmtReader::VisitCUDAKernelCallExpr(CUDAKernelCallExpr *E) {
2402 VisitCallExpr(E);
2403 E->setPreArg(CUDAKernelCallExpr::CONFIG, Record.readSubExpr());
2404}
2405
2406//===----------------------------------------------------------------------===//
2407// OpenCL Expressions and Statements.
2408//===----------------------------------------------------------------------===//
2409void ASTStmtReader::VisitAsTypeExpr(AsTypeExpr *E) {
2410 VisitExpr(E);
2411 E->BuiltinLoc = readSourceLocation();
2412 E->RParenLoc = readSourceLocation();
2413 E->SrcExpr = Record.readSubExpr();
2414}
2415
2416//===----------------------------------------------------------------------===//
2417// OpenMP Directives.
2418//===----------------------------------------------------------------------===//
2419
2420void ASTStmtReader::VisitOMPCanonicalLoop(OMPCanonicalLoop *S) {
2421 VisitStmt(S);
2422 for (Stmt *&SubStmt : S->SubStmts)
2423 SubStmt = Record.readSubStmt();
2424}
2425
2426void ASTStmtReader::VisitOMPExecutableDirective(OMPExecutableDirective *E) {
2427 Record.readOMPChildren(E->Data);
2428 E->setLocStart(readSourceLocation());
2429 E->setLocEnd(readSourceLocation());
2430}
2431
2432void ASTStmtReader::VisitOMPLoopBasedDirective(OMPLoopBasedDirective *D) {
2433 VisitStmt(D);
2434 // Field CollapsedNum was read in ReadStmtFromStream.
2435 Record.skipInts(1);
2436 VisitOMPExecutableDirective(D);
2437}
2438
2439void ASTStmtReader::VisitOMPLoopDirective(OMPLoopDirective *D) {
2440 VisitOMPLoopBasedDirective(D);
2441}
2442
2443void ASTStmtReader::VisitOMPMetaDirective(OMPMetaDirective *D) {
2444 VisitStmt(D);
2445 // The NumClauses field was read in ReadStmtFromStream.
2446 Record.skipInts(1);
2447 VisitOMPExecutableDirective(D);
2448}
2449
2450void ASTStmtReader::VisitOMPParallelDirective(OMPParallelDirective *D) {
2451 VisitStmt(D);
2452 VisitOMPExecutableDirective(D);
2453 D->setHasCancel(Record.readBool());
2454}
2455
2456void ASTStmtReader::VisitOMPSimdDirective(OMPSimdDirective *D) {
2457 VisitOMPLoopDirective(D);
2458}
2459
2460void ASTStmtReader::VisitOMPCanonicalLoopNestTransformationDirective(
2461 OMPCanonicalLoopNestTransformationDirective *D) {
2462 VisitOMPLoopBasedDirective(D);
2463 D->setNumGeneratedTopLevelLoops(Record.readUInt32());
2464}
2465
2466void ASTStmtReader::VisitOMPTileDirective(OMPTileDirective *D) {
2467 VisitOMPCanonicalLoopNestTransformationDirective(D);
2468}
2469
2470void ASTStmtReader::VisitOMPStripeDirective(OMPStripeDirective *D) {
2471 VisitOMPCanonicalLoopNestTransformationDirective(D);
2472}
2473
2474void ASTStmtReader::VisitOMPUnrollDirective(OMPUnrollDirective *D) {
2475 VisitOMPCanonicalLoopNestTransformationDirective(D);
2476}
2477
2478void ASTStmtReader::VisitOMPReverseDirective(OMPReverseDirective *D) {
2479 VisitOMPCanonicalLoopNestTransformationDirective(D);
2480}
2481
2482void ASTStmtReader::VisitOMPCanonicalLoopSequenceTransformationDirective(
2483 OMPCanonicalLoopSequenceTransformationDirective *D) {
2484 VisitStmt(D);
2485 VisitOMPExecutableDirective(D);
2486 D->setNumGeneratedTopLevelLoops(Record.readUInt32());
2487}
2488
2489void ASTStmtReader::VisitOMPInterchangeDirective(OMPInterchangeDirective *D) {
2490 VisitOMPCanonicalLoopNestTransformationDirective(D);
2491}
2492
2493void ASTStmtReader::VisitOMPFuseDirective(OMPFuseDirective *D) {
2494 VisitOMPCanonicalLoopSequenceTransformationDirective(D);
2495}
2496
2497void ASTStmtReader::VisitOMPForDirective(OMPForDirective *D) {
2498 VisitOMPLoopDirective(D);
2499 D->setHasCancel(Record.readBool());
2500}
2501
2502void ASTStmtReader::VisitOMPForSimdDirective(OMPForSimdDirective *D) {
2503 VisitOMPLoopDirective(D);
2504}
2505
2506void ASTStmtReader::VisitOMPSectionsDirective(OMPSectionsDirective *D) {
2507 VisitStmt(D);
2508 VisitOMPExecutableDirective(D);
2509 D->setHasCancel(Record.readBool());
2510}
2511
2512void ASTStmtReader::VisitOMPSectionDirective(OMPSectionDirective *D) {
2513 VisitStmt(D);
2514 VisitOMPExecutableDirective(D);
2515 D->setHasCancel(Record.readBool());
2516}
2517
2518void ASTStmtReader::VisitOMPScopeDirective(OMPScopeDirective *D) {
2519 VisitStmt(D);
2520 VisitOMPExecutableDirective(D);
2521}
2522
2523void ASTStmtReader::VisitOMPSingleDirective(OMPSingleDirective *D) {
2524 VisitStmt(D);
2525 VisitOMPExecutableDirective(D);
2526}
2527
2528void ASTStmtReader::VisitOMPMasterDirective(OMPMasterDirective *D) {
2529 VisitStmt(D);
2530 VisitOMPExecutableDirective(D);
2531}
2532
2533void ASTStmtReader::VisitOMPCriticalDirective(OMPCriticalDirective *D) {
2534 VisitStmt(D);
2535 VisitOMPExecutableDirective(D);
2536 D->DirName = Record.readDeclarationNameInfo();
2537}
2538
2539void ASTStmtReader::VisitOMPParallelForDirective(OMPParallelForDirective *D) {
2540 VisitOMPLoopDirective(D);
2541 D->setHasCancel(Record.readBool());
2542}
2543
2544void ASTStmtReader::VisitOMPParallelForSimdDirective(
2545 OMPParallelForSimdDirective *D) {
2546 VisitOMPLoopDirective(D);
2547}
2548
2549void ASTStmtReader::VisitOMPParallelMasterDirective(
2550 OMPParallelMasterDirective *D) {
2551 VisitStmt(D);
2552 VisitOMPExecutableDirective(D);
2553}
2554
2555void ASTStmtReader::VisitOMPParallelMaskedDirective(
2556 OMPParallelMaskedDirective *D) {
2557 VisitStmt(D);
2558 VisitOMPExecutableDirective(D);
2559}
2560
2561void ASTStmtReader::VisitOMPParallelSectionsDirective(
2562 OMPParallelSectionsDirective *D) {
2563 VisitStmt(D);
2564 VisitOMPExecutableDirective(D);
2565 D->setHasCancel(Record.readBool());
2566}
2567
2568void ASTStmtReader::VisitOMPTaskDirective(OMPTaskDirective *D) {
2569 VisitStmt(D);
2570 VisitOMPExecutableDirective(D);
2571 D->setHasCancel(Record.readBool());
2572}
2573
2574void ASTStmtReader::VisitOMPTaskyieldDirective(OMPTaskyieldDirective *D) {
2575 VisitStmt(D);
2576 VisitOMPExecutableDirective(D);
2577}
2578
2579void ASTStmtReader::VisitOMPBarrierDirective(OMPBarrierDirective *D) {
2580 VisitStmt(D);
2581 VisitOMPExecutableDirective(D);
2582}
2583
2584void ASTStmtReader::VisitOMPTaskwaitDirective(OMPTaskwaitDirective *D) {
2585 VisitStmt(D);
2586 // The NumClauses field was read in ReadStmtFromStream.
2587 Record.skipInts(1);
2588 VisitOMPExecutableDirective(D);
2589}
2590
2591void ASTStmtReader::VisitOMPAssumeDirective(OMPAssumeDirective *D) {
2592 VisitStmt(D);
2593 VisitOMPExecutableDirective(D);
2594}
2595
2596void ASTStmtReader::VisitOMPErrorDirective(OMPErrorDirective *D) {
2597 VisitStmt(D);
2598 // The NumClauses field was read in ReadStmtFromStream.
2599 Record.skipInts(1);
2600 VisitOMPExecutableDirective(D);
2601}
2602
2603void ASTStmtReader::VisitOMPTaskgroupDirective(OMPTaskgroupDirective *D) {
2604 VisitStmt(D);
2605 VisitOMPExecutableDirective(D);
2606}
2607
2608void ASTStmtReader::VisitOMPFlushDirective(OMPFlushDirective *D) {
2609 VisitStmt(D);
2610 VisitOMPExecutableDirective(D);
2611}
2612
2613void ASTStmtReader::VisitOMPDepobjDirective(OMPDepobjDirective *D) {
2614 VisitStmt(D);
2615 VisitOMPExecutableDirective(D);
2616}
2617
2618void ASTStmtReader::VisitOMPScanDirective(OMPScanDirective *D) {
2619 VisitStmt(D);
2620 VisitOMPExecutableDirective(D);
2621}
2622
2623void ASTStmtReader::VisitOMPOrderedDirective(OMPOrderedDirective *D) {
2624 VisitStmt(D);
2625 VisitOMPExecutableDirective(D);
2626}
2627
2628void ASTStmtReader::VisitOMPAtomicDirective(OMPAtomicDirective *D) {
2629 VisitStmt(D);
2630 VisitOMPExecutableDirective(D);
2631 D->Flags.IsXLHSInRHSPart = Record.readBool() ? 1 : 0;
2632 D->Flags.IsPostfixUpdate = Record.readBool() ? 1 : 0;
2633 D->Flags.IsFailOnly = Record.readBool() ? 1 : 0;
2634}
2635
2636void ASTStmtReader::VisitOMPTargetDirective(OMPTargetDirective *D) {
2637 VisitStmt(D);
2638 VisitOMPExecutableDirective(D);
2639}
2640
2641void ASTStmtReader::VisitOMPTargetDataDirective(OMPTargetDataDirective *D) {
2642 VisitStmt(D);
2643 VisitOMPExecutableDirective(D);
2644}
2645
2646void ASTStmtReader::VisitOMPTargetEnterDataDirective(
2647 OMPTargetEnterDataDirective *D) {
2648 VisitStmt(D);
2649 VisitOMPExecutableDirective(D);
2650}
2651
2652void ASTStmtReader::VisitOMPTargetExitDataDirective(
2653 OMPTargetExitDataDirective *D) {
2654 VisitStmt(D);
2655 VisitOMPExecutableDirective(D);
2656}
2657
2658void ASTStmtReader::VisitOMPTargetParallelDirective(
2659 OMPTargetParallelDirective *D) {
2660 VisitStmt(D);
2661 VisitOMPExecutableDirective(D);
2662 D->setHasCancel(Record.readBool());
2663}
2664
2665void ASTStmtReader::VisitOMPTargetParallelForDirective(
2666 OMPTargetParallelForDirective *D) {
2667 VisitOMPLoopDirective(D);
2668 D->setHasCancel(Record.readBool());
2669}
2670
2671void ASTStmtReader::VisitOMPTeamsDirective(OMPTeamsDirective *D) {
2672 VisitStmt(D);
2673 VisitOMPExecutableDirective(D);
2674}
2675
2676void ASTStmtReader::VisitOMPCancellationPointDirective(
2677 OMPCancellationPointDirective *D) {
2678 VisitStmt(D);
2679 VisitOMPExecutableDirective(D);
2680 D->setCancelRegion(Record.readEnum<OpenMPDirectiveKind>());
2681}
2682
2683void ASTStmtReader::VisitOMPCancelDirective(OMPCancelDirective *D) {
2684 VisitStmt(D);
2685 VisitOMPExecutableDirective(D);
2686 D->setCancelRegion(Record.readEnum<OpenMPDirectiveKind>());
2687}
2688
2689void ASTStmtReader::VisitOMPTaskLoopDirective(OMPTaskLoopDirective *D) {
2690 VisitOMPLoopDirective(D);
2691 D->setHasCancel(Record.readBool());
2692}
2693
2694void ASTStmtReader::VisitOMPTaskLoopSimdDirective(OMPTaskLoopSimdDirective *D) {
2695 VisitOMPLoopDirective(D);
2696}
2697
2698void ASTStmtReader::VisitOMPMasterTaskLoopDirective(
2699 OMPMasterTaskLoopDirective *D) {
2700 VisitOMPLoopDirective(D);
2701 D->setHasCancel(Record.readBool());
2702}
2703
2704void ASTStmtReader::VisitOMPMaskedTaskLoopDirective(
2705 OMPMaskedTaskLoopDirective *D) {
2706 VisitOMPLoopDirective(D);
2707 D->setHasCancel(Record.readBool());
2708}
2709
2710void ASTStmtReader::VisitOMPMasterTaskLoopSimdDirective(
2711 OMPMasterTaskLoopSimdDirective *D) {
2712 VisitOMPLoopDirective(D);
2713}
2714
2715void ASTStmtReader::VisitOMPMaskedTaskLoopSimdDirective(
2716 OMPMaskedTaskLoopSimdDirective *D) {
2717 VisitOMPLoopDirective(D);
2718}
2719
2720void ASTStmtReader::VisitOMPParallelMasterTaskLoopDirective(
2721 OMPParallelMasterTaskLoopDirective *D) {
2722 VisitOMPLoopDirective(D);
2723 D->setHasCancel(Record.readBool());
2724}
2725
2726void ASTStmtReader::VisitOMPParallelMaskedTaskLoopDirective(
2727 OMPParallelMaskedTaskLoopDirective *D) {
2728 VisitOMPLoopDirective(D);
2729 D->setHasCancel(Record.readBool());
2730}
2731
2732void ASTStmtReader::VisitOMPParallelMasterTaskLoopSimdDirective(
2733 OMPParallelMasterTaskLoopSimdDirective *D) {
2734 VisitOMPLoopDirective(D);
2735}
2736
2737void ASTStmtReader::VisitOMPParallelMaskedTaskLoopSimdDirective(
2738 OMPParallelMaskedTaskLoopSimdDirective *D) {
2739 VisitOMPLoopDirective(D);
2740}
2741
2742void ASTStmtReader::VisitOMPDistributeDirective(OMPDistributeDirective *D) {
2743 VisitOMPLoopDirective(D);
2744}
2745
2746void ASTStmtReader::VisitOMPTargetUpdateDirective(OMPTargetUpdateDirective *D) {
2747 VisitStmt(D);
2748 VisitOMPExecutableDirective(D);
2749}
2750
2751void ASTStmtReader::VisitOMPDistributeParallelForDirective(
2752 OMPDistributeParallelForDirective *D) {
2753 VisitOMPLoopDirective(D);
2754 D->setHasCancel(Record.readBool());
2755}
2756
2757void ASTStmtReader::VisitOMPDistributeParallelForSimdDirective(
2758 OMPDistributeParallelForSimdDirective *D) {
2759 VisitOMPLoopDirective(D);
2760}
2761
2762void ASTStmtReader::VisitOMPDistributeSimdDirective(
2763 OMPDistributeSimdDirective *D) {
2764 VisitOMPLoopDirective(D);
2765}
2766
2767void ASTStmtReader::VisitOMPTargetParallelForSimdDirective(
2768 OMPTargetParallelForSimdDirective *D) {
2769 VisitOMPLoopDirective(D);
2770}
2771
2772void ASTStmtReader::VisitOMPTargetSimdDirective(OMPTargetSimdDirective *D) {
2773 VisitOMPLoopDirective(D);
2774}
2775
2776void ASTStmtReader::VisitOMPTeamsDistributeDirective(
2777 OMPTeamsDistributeDirective *D) {
2778 VisitOMPLoopDirective(D);
2779}
2780
2781void ASTStmtReader::VisitOMPTeamsDistributeSimdDirective(
2782 OMPTeamsDistributeSimdDirective *D) {
2783 VisitOMPLoopDirective(D);
2784}
2785
2786void ASTStmtReader::VisitOMPTeamsDistributeParallelForSimdDirective(
2787 OMPTeamsDistributeParallelForSimdDirective *D) {
2788 VisitOMPLoopDirective(D);
2789}
2790
2791void ASTStmtReader::VisitOMPTeamsDistributeParallelForDirective(
2792 OMPTeamsDistributeParallelForDirective *D) {
2793 VisitOMPLoopDirective(D);
2794 D->setHasCancel(Record.readBool());
2795}
2796
2797void ASTStmtReader::VisitOMPTargetTeamsDirective(OMPTargetTeamsDirective *D) {
2798 VisitStmt(D);
2799 VisitOMPExecutableDirective(D);
2800}
2801
2802void ASTStmtReader::VisitOMPTargetTeamsDistributeDirective(
2803 OMPTargetTeamsDistributeDirective *D) {
2804 VisitOMPLoopDirective(D);
2805}
2806
2807void ASTStmtReader::VisitOMPTargetTeamsDistributeParallelForDirective(
2808 OMPTargetTeamsDistributeParallelForDirective *D) {
2809 VisitOMPLoopDirective(D);
2810 D->setHasCancel(Record.readBool());
2811}
2812
2813void ASTStmtReader::VisitOMPTargetTeamsDistributeParallelForSimdDirective(
2814 OMPTargetTeamsDistributeParallelForSimdDirective *D) {
2815 VisitOMPLoopDirective(D);
2816}
2817
2818void ASTStmtReader::VisitOMPTargetTeamsDistributeSimdDirective(
2819 OMPTargetTeamsDistributeSimdDirective *D) {
2820 VisitOMPLoopDirective(D);
2821}
2822
2823void ASTStmtReader::VisitOMPInteropDirective(OMPInteropDirective *D) {
2824 VisitStmt(D);
2825 VisitOMPExecutableDirective(D);
2826}
2827
2828void ASTStmtReader::VisitOMPDispatchDirective(OMPDispatchDirective *D) {
2829 VisitStmt(D);
2830 VisitOMPExecutableDirective(D);
2831 D->setTargetCallLoc(Record.readSourceLocation());
2832}
2833
2834void ASTStmtReader::VisitOMPMaskedDirective(OMPMaskedDirective *D) {
2835 VisitStmt(D);
2836 VisitOMPExecutableDirective(D);
2837}
2838
2839void ASTStmtReader::VisitOMPGenericLoopDirective(OMPGenericLoopDirective *D) {
2840 VisitOMPLoopDirective(D);
2841}
2842
2843void ASTStmtReader::VisitOMPTeamsGenericLoopDirective(
2844 OMPTeamsGenericLoopDirective *D) {
2845 VisitOMPLoopDirective(D);
2846}
2847
2848void ASTStmtReader::VisitOMPTargetTeamsGenericLoopDirective(
2849 OMPTargetTeamsGenericLoopDirective *D) {
2850 VisitOMPLoopDirective(D);
2851 D->setCanBeParallelFor(Record.readBool());
2852}
2853
2854void ASTStmtReader::VisitOMPParallelGenericLoopDirective(
2855 OMPParallelGenericLoopDirective *D) {
2856 VisitOMPLoopDirective(D);
2857}
2858
2859void ASTStmtReader::VisitOMPTargetParallelGenericLoopDirective(
2860 OMPTargetParallelGenericLoopDirective *D) {
2861 VisitOMPLoopDirective(D);
2862}
2863
2864//===----------------------------------------------------------------------===//
2865// OpenACC Constructs/Directives.
2866//===----------------------------------------------------------------------===//
2867void ASTStmtReader::VisitOpenACCConstructStmt(OpenACCConstructStmt *S) {
2868 (void)Record.readInt();
2869 S->Kind = Record.readEnum<OpenACCDirectiveKind>();
2870 S->Range = Record.readSourceRange();
2871 S->DirectiveLoc = Record.readSourceLocation();
2872 Record.readOpenACCClauseList(S->Clauses);
2873}
2874
2875void ASTStmtReader::VisitOpenACCAssociatedStmtConstruct(
2877 VisitOpenACCConstructStmt(S);
2878 S->setAssociatedStmt(Record.readSubStmt());
2879}
2880
2881void ASTStmtReader::VisitOpenACCComputeConstruct(OpenACCComputeConstruct *S) {
2882 VisitStmt(S);
2883 VisitOpenACCAssociatedStmtConstruct(S);
2884}
2885
2886void ASTStmtReader::VisitOpenACCLoopConstruct(OpenACCLoopConstruct *S) {
2887 VisitStmt(S);
2888 VisitOpenACCAssociatedStmtConstruct(S);
2889 S->ParentComputeConstructKind = Record.readEnum<OpenACCDirectiveKind>();
2890}
2891
2892void ASTStmtReader::VisitOpenACCCombinedConstruct(OpenACCCombinedConstruct *S) {
2893 VisitStmt(S);
2894 VisitOpenACCAssociatedStmtConstruct(S);
2895}
2896
2897void ASTStmtReader::VisitOpenACCDataConstruct(OpenACCDataConstruct *S) {
2898 VisitStmt(S);
2899 VisitOpenACCAssociatedStmtConstruct(S);
2900}
2901
2902void ASTStmtReader::VisitOpenACCEnterDataConstruct(
2903 OpenACCEnterDataConstruct *S) {
2904 VisitStmt(S);
2905 VisitOpenACCConstructStmt(S);
2906}
2907
2908void ASTStmtReader::VisitOpenACCExitDataConstruct(OpenACCExitDataConstruct *S) {
2909 VisitStmt(S);
2910 VisitOpenACCConstructStmt(S);
2911}
2912
2913void ASTStmtReader::VisitOpenACCInitConstruct(OpenACCInitConstruct *S) {
2914 VisitStmt(S);
2915 VisitOpenACCConstructStmt(S);
2916}
2917
2918void ASTStmtReader::VisitOpenACCShutdownConstruct(OpenACCShutdownConstruct *S) {
2919 VisitStmt(S);
2920 VisitOpenACCConstructStmt(S);
2921}
2922
2923void ASTStmtReader::VisitOpenACCSetConstruct(OpenACCSetConstruct *S) {
2924 VisitStmt(S);
2925 VisitOpenACCConstructStmt(S);
2926}
2927
2928void ASTStmtReader::VisitOpenACCUpdateConstruct(OpenACCUpdateConstruct *S) {
2929 VisitStmt(S);
2930 VisitOpenACCConstructStmt(S);
2931}
2932
2933void ASTStmtReader::VisitOpenACCHostDataConstruct(OpenACCHostDataConstruct *S) {
2934 VisitStmt(S);
2935 VisitOpenACCAssociatedStmtConstruct(S);
2936}
2937
2938void ASTStmtReader::VisitOpenACCWaitConstruct(OpenACCWaitConstruct *S) {
2939 VisitStmt(S);
2940 // Consume the count of Expressions.
2941 (void)Record.readInt();
2942 VisitOpenACCConstructStmt(S);
2943 S->LParenLoc = Record.readSourceLocation();
2944 S->RParenLoc = Record.readSourceLocation();
2945 S->QueuesLoc = Record.readSourceLocation();
2946
2947 for (unsigned I = 0; I < S->NumExprs; ++I) {
2948 S->getExprPtr()[I] = cast_if_present<Expr>(Record.readSubStmt());
2949 assert((I == 0 || S->getExprPtr()[I] != nullptr) &&
2950 "Only first expression should be null");
2951 }
2952}
2953
2954void ASTStmtReader::VisitOpenACCCacheConstruct(OpenACCCacheConstruct *S) {
2955 VisitStmt(S);
2956 (void)Record.readInt();
2957 VisitOpenACCConstructStmt(S);
2958 S->ParensLoc = Record.readSourceRange();
2959 S->ReadOnlyLoc = Record.readSourceLocation();
2960 for (unsigned I = 0; I < S->NumVars; ++I)
2961 S->getVarList()[I] = cast<Expr>(Record.readSubStmt());
2962}
2963
2964void ASTStmtReader::VisitOpenACCAtomicConstruct(OpenACCAtomicConstruct *S) {
2965 VisitStmt(S);
2966 VisitOpenACCConstructStmt(S);
2967 S->AtomicKind = Record.readEnum<OpenACCAtomicKind>();
2968 S->setAssociatedStmt(Record.readSubStmt());
2969}
2970
2971//===----------------------------------------------------------------------===//
2972// HLSL Constructs/Directives.
2973//===----------------------------------------------------------------------===//
2974
2975void ASTStmtReader::VisitHLSLOutArgExpr(HLSLOutArgExpr *S) {
2976 VisitExpr(S);
2977 S->SubExprs[HLSLOutArgExpr::BaseLValue] = Record.readSubExpr();
2978 S->SubExprs[HLSLOutArgExpr::CastedTemporary] = Record.readSubExpr();
2979 S->SubExprs[HLSLOutArgExpr::WritebackCast] = Record.readSubExpr();
2980 S->IsInOut = Record.readBool();
2981}
2982
2983//===----------------------------------------------------------------------===//
2984// ASTReader Implementation
2985//===----------------------------------------------------------------------===//
2986
2988 switch (ReadingKind) {
2989 case Read_None:
2990 llvm_unreachable("should not call this when not reading anything");
2991 case Read_Decl:
2992 case Read_Type:
2993 return ReadStmtFromStream(F);
2994 case Read_Stmt:
2995 return ReadSubStmt();
2996 }
2997
2998 llvm_unreachable("ReadingKind not set ?");
2999}
3000
3002 return cast_or_null<Expr>(ReadStmt(F));
3003}
3004
3006 return cast_or_null<Expr>(ReadSubStmt());
3007}
3008
3009// Within the bitstream, expressions are stored in Reverse Polish
3010// Notation, with each of the subexpressions preceding the
3011// expression they are stored in. Subexpressions are stored from last to first.
3012// To evaluate expressions, we continue reading expressions and placing them on
3013// the stack, with expressions having operands removing those operands from the
3014// stack. Evaluation terminates when we see a STMT_STOP record, and
3015// the single remaining expression on the stack is our result.
3016Stmt *ASTReader::ReadStmtFromStream(ModuleFile &F) {
3017 ReadingKindTracker ReadingKind(Read_Stmt, *this);
3018 llvm::BitstreamCursor &Cursor = F.DeclsCursor;
3019
3020 // Map of offset to previously deserialized stmt. The offset points
3021 // just after the stmt record.
3022 llvm::DenseMap<uint64_t, Stmt *> StmtEntries;
3023
3024#ifndef NDEBUG
3025 unsigned PrevNumStmts = StmtStack.size();
3026#endif
3027
3028 ASTRecordReader Record(*this, F);
3029 ASTStmtReader Reader(Record, Cursor);
3031
3032 while (true) {
3034 Cursor.advanceSkippingSubblocks();
3035 if (!MaybeEntry) {
3036 Error(toString(MaybeEntry.takeError()));
3037 return nullptr;
3038 }
3039 llvm::BitstreamEntry Entry = MaybeEntry.get();
3040
3041 switch (Entry.Kind) {
3042 case llvm::BitstreamEntry::SubBlock: // Handled for us already.
3043 case llvm::BitstreamEntry::Error:
3044 Error("malformed block record in AST file");
3045 return nullptr;
3046 case llvm::BitstreamEntry::EndBlock:
3047 goto Done;
3048 case llvm::BitstreamEntry::Record:
3049 // The interesting case.
3050 break;
3051 }
3052
3053 ASTContext &Context = getContext();
3054 Stmt *S = nullptr;
3055 bool Finished = false;
3056 bool IsStmtReference = false;
3057 Expected<unsigned> MaybeStmtCode = Record.readRecord(Cursor, Entry.ID);
3058 if (!MaybeStmtCode) {
3059 Error(toString(MaybeStmtCode.takeError()));
3060 return nullptr;
3061 }
3062 switch ((StmtCode)MaybeStmtCode.get()) {
3063 case STMT_STOP:
3064 Finished = true;
3065 break;
3066
3067 case STMT_REF_PTR:
3068 IsStmtReference = true;
3069 assert(StmtEntries.contains(Record[0]) &&
3070 "No stmt was recorded for this offset reference!");
3071 S = StmtEntries[Record.readInt()];
3072 break;
3073
3074 case STMT_NULL_PTR:
3075 S = nullptr;
3076 break;
3077
3078 case STMT_NULL:
3079 S = new (Context) NullStmt(Empty);
3080 break;
3081
3082 case STMT_COMPOUND: {
3083 unsigned NumStmts = Record[ASTStmtReader::NumStmtFields];
3084 bool HasFPFeatures = Record[ASTStmtReader::NumStmtFields + 1];
3085 S = CompoundStmt::CreateEmpty(Context, NumStmts, HasFPFeatures);
3086 break;
3087 }
3088
3089 case STMT_CASE:
3091 Context,
3092 /*CaseStmtIsGNURange*/ Record[ASTStmtReader::NumStmtFields + 3]);
3093 break;
3094
3095 case STMT_DEFAULT:
3096 S = new (Context) DefaultStmt(Empty);
3097 break;
3098
3099 case STMT_LABEL:
3100 S = new (Context) LabelStmt(Empty);
3101 break;
3102
3103 case STMT_ATTRIBUTED:
3105 Context,
3107 break;
3108
3109 case STMT_IF: {
3110 BitsUnpacker IfStmtBits(Record[ASTStmtReader::NumStmtFields]);
3111 bool HasElse = IfStmtBits.getNextBit();
3112 bool HasVar = IfStmtBits.getNextBit();
3113 bool HasInit = IfStmtBits.getNextBit();
3114 S = IfStmt::CreateEmpty(Context, HasElse, HasVar, HasInit);
3115 break;
3116 }
3117
3118 case STMT_SWITCH:
3120 Context,
3122 /* HasVar=*/Record[ASTStmtReader::NumStmtFields + 1]);
3123 break;
3124
3125 case STMT_WHILE:
3127 Context,
3129 break;
3130
3131 case STMT_DO:
3132 S = new (Context) DoStmt(Empty);
3133 break;
3134
3135 case STMT_FOR:
3136 S = new (Context) ForStmt(Empty);
3137 break;
3138
3139 case STMT_GOTO:
3140 S = new (Context) GotoStmt(Empty);
3141 break;
3142
3143 case STMT_INDIRECT_GOTO:
3144 S = new (Context) IndirectGotoStmt(Empty);
3145 break;
3146
3147 case STMT_CONTINUE:
3148 S = new (Context) ContinueStmt(Empty);
3149 break;
3150
3151 case STMT_BREAK:
3152 S = new (Context) BreakStmt(Empty);
3153 break;
3154
3155 case STMT_DEFER:
3156 S = DeferStmt::CreateEmpty(Context, Empty);
3157 break;
3158
3159 case STMT_RETURN:
3161 Context, /* HasNRVOCandidate=*/Record[ASTStmtReader::NumStmtFields]);
3162 break;
3163
3164 case STMT_DECL:
3165 S = new (Context) DeclStmt(Empty);
3166 break;
3167
3168 case STMT_GCCASM:
3169 S = new (Context) GCCAsmStmt(Empty);
3170 break;
3171
3172 case STMT_MSASM:
3173 S = new (Context) MSAsmStmt(Empty);
3174 break;
3175
3176 case STMT_CAPTURED:
3179 break;
3180
3182 S = new (Context) SYCLKernelCallStmt(Empty);
3183 break;
3184
3185 case EXPR_CONSTANT:
3187 Context, static_cast<ConstantResultStorageKind>(
3188 /*StorageKind=*/Record[ASTStmtReader::NumExprFields]));
3189 break;
3190
3193 break;
3194
3197 break;
3198
3199 case EXPR_PREDEFINED:
3201 Context,
3202 /*HasFunctionName*/ Record[ASTStmtReader::NumExprFields]);
3203 break;
3204
3205 case EXPR_DECL_REF: {
3206 BitsUnpacker DeclRefExprBits(Record[ASTStmtReader::NumExprFields]);
3207 DeclRefExprBits.advance(5);
3208 bool HasFoundDecl = DeclRefExprBits.getNextBit();
3209 bool HasQualifier = DeclRefExprBits.getNextBit();
3210 bool HasTemplateKWAndArgsInfo = DeclRefExprBits.getNextBit();
3211 unsigned NumTemplateArgs = HasTemplateKWAndArgsInfo
3213 : 0;
3214 S = DeclRefExpr::CreateEmpty(Context, HasQualifier, HasFoundDecl,
3215 HasTemplateKWAndArgsInfo, NumTemplateArgs);
3216 break;
3217 }
3218
3220 S = IntegerLiteral::Create(Context, Empty);
3221 break;
3222
3224 S = FixedPointLiteral::Create(Context, Empty);
3225 break;
3226
3228 S = FloatingLiteral::Create(Context, Empty);
3229 break;
3230
3232 S = new (Context) ImaginaryLiteral(Empty);
3233 break;
3234
3237 Context,
3238 /* NumConcatenated=*/Record[ASTStmtReader::NumExprFields],
3239 /* Length=*/Record[ASTStmtReader::NumExprFields + 1],
3240 /* CharByteWidth=*/Record[ASTStmtReader::NumExprFields + 2]);
3241 break;
3242
3244 S = new (Context) CharacterLiteral(Empty);
3245 break;
3246
3247 case EXPR_PAREN:
3248 S = new (Context) ParenExpr(Empty);
3249 break;
3250
3251 case EXPR_PAREN_LIST:
3253 Context,
3254 /* NumExprs=*/Record[ASTStmtReader::NumExprFields]);
3255 break;
3256
3257 case EXPR_UNARY_OPERATOR: {
3258 BitsUnpacker UnaryOperatorBits(Record[ASTStmtReader::NumStmtFields]);
3259 UnaryOperatorBits.advance(ASTStmtReader::NumExprBits);
3260 bool HasFPFeatures = UnaryOperatorBits.getNextBit();
3261 S = UnaryOperator::CreateEmpty(Context, HasFPFeatures);
3262 break;
3263 }
3264
3265 case EXPR_OFFSETOF:
3266 S = OffsetOfExpr::CreateEmpty(Context,
3269 break;
3270
3272 S = new (Context) UnaryExprOrTypeTraitExpr(Empty);
3273 break;
3274
3276 S = new (Context) ArraySubscriptExpr(Empty);
3277 break;
3278
3280 S = new (Context) MatrixSubscriptExpr(Empty);
3281 break;
3282
3283 case EXPR_ARRAY_SECTION:
3284 S = new (Context) ArraySectionExpr(Empty);
3285 break;
3286
3290 break;
3291
3292 case EXPR_OMP_ITERATOR:
3293 S = OMPIteratorExpr::CreateEmpty(Context,
3295 break;
3296
3297 case EXPR_CALL: {
3298 auto NumArgs = Record[ASTStmtReader::NumExprFields];
3299 BitsUnpacker CallExprBits(Record[ASTStmtReader::NumExprFields + 1]);
3300 CallExprBits.advance(1);
3301 auto HasFPFeatures = CallExprBits.getNextBit();
3302 S = CallExpr::CreateEmpty(Context, NumArgs, HasFPFeatures, Empty);
3303 break;
3304 }
3305
3306 case EXPR_RECOVERY:
3308 Context, /*NumArgs=*/Record[ASTStmtReader::NumExprFields]);
3309 break;
3310
3311 case EXPR_MEMBER: {
3312 BitsUnpacker ExprMemberBits(Record[ASTStmtReader::NumExprFields]);
3313 bool HasQualifier = ExprMemberBits.getNextBit();
3314 bool HasFoundDecl = ExprMemberBits.getNextBit();
3315 bool HasTemplateInfo = ExprMemberBits.getNextBit();
3316 unsigned NumTemplateArgs = Record[ASTStmtReader::NumExprFields + 1];
3317 S = MemberExpr::CreateEmpty(Context, HasQualifier, HasFoundDecl,
3318 HasTemplateInfo, NumTemplateArgs);
3319 break;
3320 }
3321
3322 case EXPR_BINARY_OPERATOR: {
3323 BitsUnpacker BinaryOperatorBits(Record[ASTStmtReader::NumExprFields]);
3324 BinaryOperatorBits.advance(/*Size of opcode*/ 6);
3325 bool HasFPFeatures = BinaryOperatorBits.getNextBit();
3326 S = BinaryOperator::CreateEmpty(Context, HasFPFeatures);
3327 break;
3328 }
3329
3331 BitsUnpacker BinaryOperatorBits(Record[ASTStmtReader::NumExprFields]);
3332 BinaryOperatorBits.advance(/*Size of opcode*/ 6);
3333 bool HasFPFeatures = BinaryOperatorBits.getNextBit();
3334 S = CompoundAssignOperator::CreateEmpty(Context, HasFPFeatures);
3335 break;
3336 }
3337
3339 S = new (Context) ConditionalOperator(Empty);
3340 break;
3341
3343 S = new (Context) BinaryConditionalOperator(Empty);
3344 break;
3345
3346 case EXPR_IMPLICIT_CAST: {
3347 unsigned PathSize = Record[ASTStmtReader::NumExprFields];
3348 BitsUnpacker CastExprBits(Record[ASTStmtReader::NumExprFields + 1]);
3349 CastExprBits.advance(7);
3350 bool HasFPFeatures = CastExprBits.getNextBit();
3351 S = ImplicitCastExpr::CreateEmpty(Context, PathSize, HasFPFeatures);
3352 break;
3353 }
3354
3355 case EXPR_CSTYLE_CAST: {
3356 unsigned PathSize = Record[ASTStmtReader::NumExprFields];
3357 BitsUnpacker CastExprBits(Record[ASTStmtReader::NumExprFields + 1]);
3358 CastExprBits.advance(7);
3359 bool HasFPFeatures = CastExprBits.getNextBit();
3360 S = CStyleCastExpr::CreateEmpty(Context, PathSize, HasFPFeatures);
3361 break;
3362 }
3363
3365 S = new (Context) CompoundLiteralExpr(Empty);
3366 break;
3367
3369 S = new (Context) ExtVectorElementExpr(Empty);
3370 break;
3371
3372 case EXPR_INIT_LIST:
3373 S = new (Context) InitListExpr(Empty);
3374 break;
3375
3379
3380 break;
3381
3383 S = new (Context) DesignatedInitUpdateExpr(Empty);
3384 break;
3385
3387 S = new (Context) ImplicitValueInitExpr(Empty);
3388 break;
3389
3390 case EXPR_NO_INIT:
3391 S = new (Context) NoInitExpr(Empty);
3392 break;
3393
3395 S = new (Context) ArrayInitLoopExpr(Empty);
3396 break;
3397
3399 S = new (Context) ArrayInitIndexExpr(Empty);
3400 break;
3401
3402 case EXPR_VA_ARG:
3403 S = new (Context) VAArgExpr(Empty);
3404 break;
3405
3406 case EXPR_SOURCE_LOC:
3407 S = new (Context) SourceLocExpr(Empty);
3408 break;
3409
3411 S = new (Context) EmbedExpr(Empty);
3412 break;
3413
3414 case EXPR_ADDR_LABEL:
3415 S = new (Context) AddrLabelExpr(Empty);
3416 break;
3417
3418 case EXPR_STMT:
3419 S = new (Context) StmtExpr(Empty);
3420 break;
3421
3422 case EXPR_CHOOSE:
3423 S = new (Context) ChooseExpr(Empty);
3424 break;
3425
3426 case EXPR_GNU_NULL:
3427 S = new (Context) GNUNullExpr(Empty);
3428 break;
3429
3431 S = new (Context) ShuffleVectorExpr(Empty);
3432 break;
3433
3434 case EXPR_CONVERT_VECTOR: {
3435 BitsUnpacker ConvertVectorExprBits(Record[ASTStmtReader::NumStmtFields]);
3436 ConvertVectorExprBits.advance(ASTStmtReader::NumExprBits);
3437 bool HasFPFeatures = ConvertVectorExprBits.getNextBit();
3438 S = ConvertVectorExpr::CreateEmpty(Context, HasFPFeatures);
3439 break;
3440 }
3441
3442 case EXPR_BLOCK:
3443 S = new (Context) BlockExpr(Empty);
3444 break;
3445
3448 Context,
3449 /*NumAssocs=*/Record[ASTStmtReader::NumExprFields]);
3450 break;
3451
3453 S = new (Context) ObjCStringLiteral(Empty);
3454 break;
3455
3457 S = new (Context) ObjCBoxedExpr(Empty);
3458 break;
3459
3463 break;
3464
3469 break;
3470
3471 case EXPR_OBJC_ENCODE:
3472 S = new (Context) ObjCEncodeExpr(Empty);
3473 break;
3474
3476 S = new (Context) ObjCSelectorExpr(Empty);
3477 break;
3478
3480 S = new (Context) ObjCProtocolExpr(Empty);
3481 break;
3482
3484 S = new (Context) ObjCIvarRefExpr(Empty);
3485 break;
3486
3488 S = new (Context) ObjCPropertyRefExpr(Empty);
3489 break;
3490
3492 S = new (Context) ObjCSubscriptRefExpr(Empty);
3493 break;
3494
3496 llvm_unreachable("mismatching AST file");
3497
3499 S = ObjCMessageExpr::CreateEmpty(Context,
3502 break;
3503
3504 case EXPR_OBJC_ISA:
3505 S = new (Context) ObjCIsaExpr(Empty);
3506 break;
3507
3509 S = new (Context) ObjCIndirectCopyRestoreExpr(Empty);
3510 break;
3511
3513 S = new (Context) ObjCBridgedCastExpr(Empty);
3514 break;
3515
3517 S = new (Context) ObjCForCollectionStmt(Empty);
3518 break;
3519
3520 case STMT_OBJC_CATCH:
3521 S = new (Context) ObjCAtCatchStmt(Empty);
3522 break;
3523
3524 case STMT_OBJC_FINALLY:
3525 S = new (Context) ObjCAtFinallyStmt(Empty);
3526 break;
3527
3528 case STMT_OBJC_AT_TRY:
3529 S = ObjCAtTryStmt::CreateEmpty(Context,
3532 break;
3533
3535 S = new (Context) ObjCAtSynchronizedStmt(Empty);
3536 break;
3537
3538 case STMT_OBJC_AT_THROW:
3539 S = new (Context) ObjCAtThrowStmt(Empty);
3540 break;
3541
3543 S = new (Context) ObjCAutoreleasePoolStmt(Empty);
3544 break;
3545
3547 S = new (Context) ObjCBoolLiteralExpr(Empty);
3548 break;
3549
3551 S = new (Context) ObjCAvailabilityCheckExpr(Empty);
3552 break;
3553
3554 case STMT_SEH_LEAVE:
3555 S = new (Context) SEHLeaveStmt(Empty);
3556 break;
3557
3558 case STMT_SEH_EXCEPT:
3559 S = new (Context) SEHExceptStmt(Empty);
3560 break;
3561
3562 case STMT_SEH_FINALLY:
3563 S = new (Context) SEHFinallyStmt(Empty);
3564 break;
3565
3566 case STMT_SEH_TRY:
3567 S = new (Context) SEHTryStmt(Empty);
3568 break;
3569
3570 case STMT_CXX_CATCH:
3571 S = new (Context) CXXCatchStmt(Empty);
3572 break;
3573
3574 case STMT_CXX_TRY:
3575 S = CXXTryStmt::Create(Context, Empty,
3576 /*numHandlers=*/Record[ASTStmtReader::NumStmtFields]);
3577 break;
3578
3579 case STMT_CXX_FOR_RANGE:
3580 S = new (Context) CXXForRangeStmt(Empty);
3581 break;
3582
3584 S = new (Context) MSDependentExistsStmt(SourceLocation(), true,
3585 NestedNameSpecifierLoc(),
3586 DeclarationNameInfo(),
3587 nullptr);
3588 break;
3589
3591 S = OMPCanonicalLoop::createEmpty(Context);
3592 break;
3593
3597 break;
3598
3600 S =
3601 OMPParallelDirective::CreateEmpty(Context,
3603 Empty);
3604 break;
3605
3607 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3608 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3609 S = OMPSimdDirective::CreateEmpty(Context, NumClauses,
3610 CollapsedNum, Empty);
3611 break;
3612 }
3613
3615 unsigned NumLoops = Record[ASTStmtReader::NumStmtFields];
3616 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3617 S = OMPTileDirective::CreateEmpty(Context, NumClauses, NumLoops);
3618 break;
3619 }
3620
3622 unsigned NumLoops = Record[ASTStmtReader::NumStmtFields];
3623 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3624 S = OMPStripeDirective::CreateEmpty(Context, NumClauses, NumLoops);
3625 break;
3626 }
3627
3629 assert(Record[ASTStmtReader::NumStmtFields] == 1 && "Unroll directive accepts only a single loop");
3630 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3631 S = OMPUnrollDirective::CreateEmpty(Context, NumClauses);
3632 break;
3633 }
3634
3636 unsigned NumLoops = Record[ASTStmtReader::NumStmtFields];
3637 assert(Record[ASTStmtReader::NumStmtFields + 1] == 0 &&
3638 "Reverse directive has no clauses");
3639 S = OMPReverseDirective::CreateEmpty(Context, NumLoops);
3640 break;
3641 }
3642
3644 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
3645 S = OMPFuseDirective::CreateEmpty(Context, NumClauses);
3646 break;
3647 }
3648
3650 unsigned NumLoops = Record[ASTStmtReader::NumStmtFields];
3651 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3652 S = OMPInterchangeDirective::CreateEmpty(Context, NumClauses, NumLoops);
3653 break;
3654 }
3655
3657 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3658 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3659 S = OMPForDirective::CreateEmpty(Context, NumClauses, CollapsedNum,
3660 Empty);
3661 break;
3662 }
3663
3665 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3666 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3667 S = OMPForSimdDirective::CreateEmpty(Context, NumClauses, CollapsedNum,
3668 Empty);
3669 break;
3670 }
3671
3673 S = OMPSectionsDirective::CreateEmpty(
3675 break;
3676
3678 S = OMPSectionDirective::CreateEmpty(Context, Empty);
3679 break;
3680
3682 S = OMPScopeDirective::CreateEmpty(
3684 break;
3685
3687 S = OMPSingleDirective::CreateEmpty(
3689 break;
3690
3692 S = OMPMasterDirective::CreateEmpty(Context, Empty);
3693 break;
3694
3696 S = OMPCriticalDirective::CreateEmpty(
3698 break;
3699
3701 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3702 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3703 S = OMPParallelForDirective::CreateEmpty(Context, NumClauses,
3704 CollapsedNum, Empty);
3705 break;
3706 }
3707
3709 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3710 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3711 S = OMPParallelForSimdDirective::CreateEmpty(Context, NumClauses,
3712 CollapsedNum, Empty);
3713 break;
3714 }
3715
3717 S = OMPParallelMasterDirective::CreateEmpty(
3719 break;
3720
3722 S = OMPParallelMaskedDirective::CreateEmpty(
3724 break;
3725
3727 S = OMPParallelSectionsDirective::CreateEmpty(
3729 break;
3730
3732 S = OMPTaskDirective::CreateEmpty(
3734 break;
3735
3737 S = OMPTaskyieldDirective::CreateEmpty(Context, Empty);
3738 break;
3739
3741 S = OMPBarrierDirective::CreateEmpty(Context, Empty);
3742 break;
3743
3745 S = OMPTaskwaitDirective::CreateEmpty(
3747 break;
3748
3752 break;
3753
3755 S = OMPTaskgroupDirective::CreateEmpty(
3757 break;
3758
3760 S = OMPFlushDirective::CreateEmpty(
3762 break;
3763
3765 S = OMPDepobjDirective::CreateEmpty(
3767 break;
3768
3772 break;
3773
3775 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
3776 bool HasAssociatedStmt = Record[ASTStmtReader::NumStmtFields + 2];
3777 S = OMPOrderedDirective::CreateEmpty(Context, NumClauses,
3778 !HasAssociatedStmt, Empty);
3779 break;
3780 }
3781
3783 S = OMPAtomicDirective::CreateEmpty(
3785 break;
3786
3790 break;
3791
3795 break;
3796
3800 break;
3801
3805 break;
3806
3810 break;
3811
3813 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3814 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3815 S = OMPTargetParallelForDirective::CreateEmpty(Context, NumClauses,
3816 CollapsedNum, Empty);
3817 break;
3818 }
3819
3823 break;
3824
3828 break;
3829
3832 break;
3833
3837 break;
3838
3840 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3841 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3842 S = OMPTaskLoopDirective::CreateEmpty(Context, NumClauses, CollapsedNum,
3843 Empty);
3844 break;
3845 }
3846
3848 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3849 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3850 S = OMPTaskLoopSimdDirective::CreateEmpty(Context, NumClauses,
3851 CollapsedNum, Empty);
3852 break;
3853 }
3854
3856 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3857 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3858 S = OMPMasterTaskLoopDirective::CreateEmpty(Context, NumClauses,
3859 CollapsedNum, Empty);
3860 break;
3861 }
3862
3864 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3865 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3866 S = OMPMaskedTaskLoopDirective::CreateEmpty(Context, NumClauses,
3867 CollapsedNum, Empty);
3868 break;
3869 }
3870
3872 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3873 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3874 S = OMPMasterTaskLoopSimdDirective::CreateEmpty(Context, NumClauses,
3875 CollapsedNum, Empty);
3876 break;
3877 }
3878
3880 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3881 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3882 S = OMPMaskedTaskLoopSimdDirective::CreateEmpty(Context, NumClauses,
3883 CollapsedNum, Empty);
3884 break;
3885 }
3886
3888 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3889 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3891 CollapsedNum, Empty);
3892 break;
3893 }
3894
3896 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3897 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3899 CollapsedNum, Empty);
3900 break;
3901 }
3902
3904 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3905 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3907 Context, NumClauses, CollapsedNum, Empty);
3908 break;
3909 }
3910
3912 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3913 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3915 Context, NumClauses, CollapsedNum, Empty);
3916 break;
3917 }
3918
3920 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3921 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3922 S = OMPDistributeDirective::CreateEmpty(Context, NumClauses, CollapsedNum,
3923 Empty);
3924 break;
3925 }
3926
3928 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3929 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3930 S = OMPDistributeParallelForDirective::CreateEmpty(Context, NumClauses,
3931 CollapsedNum, Empty);
3932 break;
3933 }
3934
3936 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3937 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3939 CollapsedNum,
3940 Empty);
3941 break;
3942 }
3943
3945 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3946 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3947 S = OMPDistributeSimdDirective::CreateEmpty(Context, NumClauses,
3948 CollapsedNum, Empty);
3949 break;
3950 }
3951
3953 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3954 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3955 S = OMPTargetParallelForSimdDirective::CreateEmpty(Context, NumClauses,
3956 CollapsedNum, Empty);
3957 break;
3958 }
3959
3961 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3962 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3963 S = OMPTargetSimdDirective::CreateEmpty(Context, NumClauses, CollapsedNum,
3964 Empty);
3965 break;
3966 }
3967
3969 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3970 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3971 S = OMPTeamsDistributeDirective::CreateEmpty(Context, NumClauses,
3972 CollapsedNum, Empty);
3973 break;
3974 }
3975
3977 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3978 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3979 S = OMPTeamsDistributeSimdDirective::CreateEmpty(Context, NumClauses,
3980 CollapsedNum, Empty);
3981 break;
3982 }
3983
3985 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3986 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3988 Context, NumClauses, CollapsedNum, Empty);
3989 break;
3990 }
3991
3993 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3994 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3996 Context, NumClauses, CollapsedNum, Empty);
3997 break;
3998 }
3999
4003 break;
4004
4006 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
4007 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
4008 S = OMPTargetTeamsDistributeDirective::CreateEmpty(Context, NumClauses,
4009 CollapsedNum, Empty);
4010 break;
4011 }
4012
4014 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
4015 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
4017 Context, NumClauses, CollapsedNum, Empty);
4018 break;
4019 }
4020
4022 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
4023 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
4025 Context, NumClauses, CollapsedNum, Empty);
4026 break;
4027 }
4028
4030 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
4031 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
4033 Context, NumClauses, CollapsedNum, Empty);
4034 break;
4035 }
4036
4040 break;
4041
4045 break;
4046
4050 break;
4051
4053 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
4054 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
4055 S = OMPGenericLoopDirective::CreateEmpty(Context, NumClauses,
4056 CollapsedNum, Empty);
4057 break;
4058 }
4059
4061 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
4062 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
4063 S = OMPTeamsGenericLoopDirective::CreateEmpty(Context, NumClauses,
4064 CollapsedNum, Empty);
4065 break;
4066 }
4067
4069 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
4070 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
4072 CollapsedNum, Empty);
4073 break;
4074 }
4075
4077 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
4078 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
4079 S = OMPParallelGenericLoopDirective::CreateEmpty(Context, NumClauses,
4080 CollapsedNum, Empty);
4081 break;
4082 }
4083
4085 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
4086 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
4088 Context, NumClauses, CollapsedNum, Empty);
4089 break;
4090 }
4091
4093 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
4094 S = OMPAssumeDirective::CreateEmpty(Context, NumClauses, Empty);
4095 break;
4096 }
4097
4099 auto NumArgs = Record[ASTStmtReader::NumExprFields];
4100 BitsUnpacker CallExprBits(Record[ASTStmtReader::NumExprFields + 1]);
4101 CallExprBits.advance(1);
4102 auto HasFPFeatures = CallExprBits.getNextBit();
4103 S = CXXOperatorCallExpr::CreateEmpty(Context, NumArgs, HasFPFeatures,
4104 Empty);
4105 break;
4106 }
4107
4108 case EXPR_CXX_MEMBER_CALL: {
4109 auto NumArgs = Record[ASTStmtReader::NumExprFields];
4110 BitsUnpacker CallExprBits(Record[ASTStmtReader::NumExprFields + 1]);
4111 CallExprBits.advance(1);
4112 auto HasFPFeatures = CallExprBits.getNextBit();
4113 S = CXXMemberCallExpr::CreateEmpty(Context, NumArgs, HasFPFeatures,
4114 Empty);
4115 break;
4116 }
4117
4119 S = new (Context) CXXRewrittenBinaryOperator(Empty);
4120 break;
4121
4122 case EXPR_CXX_CONSTRUCT:
4124 Context,
4125 /* NumArgs=*/Record[ASTStmtReader::NumExprFields]);
4126 break;
4127
4129 S = new (Context) CXXInheritedCtorInitExpr(Empty);
4130 break;
4131
4134 Context,
4135 /* NumArgs=*/Record[ASTStmtReader::NumExprFields]);
4136 break;
4137
4138 case EXPR_CXX_STATIC_CAST: {
4139 unsigned PathSize = Record[ASTStmtReader::NumExprFields];
4140 BitsUnpacker CastExprBits(Record[ASTStmtReader::NumExprFields + 1]);
4141 CastExprBits.advance(7);
4142 bool HasFPFeatures = CastExprBits.getNextBit();
4143 S = CXXStaticCastExpr::CreateEmpty(Context, PathSize, HasFPFeatures);
4144 break;
4145 }
4146
4147 case EXPR_CXX_DYNAMIC_CAST: {
4148 unsigned PathSize = Record[ASTStmtReader::NumExprFields];
4149 S = CXXDynamicCastExpr::CreateEmpty(Context, PathSize);
4150 break;
4151 }
4152
4154 unsigned PathSize = Record[ASTStmtReader::NumExprFields];
4155 S = CXXReinterpretCastExpr::CreateEmpty(Context, PathSize);
4156 break;
4157 }
4158
4160 S = CXXConstCastExpr::CreateEmpty(Context);
4161 break;
4162
4165 break;
4166
4168 unsigned PathSize = Record[ASTStmtReader::NumExprFields];
4169 BitsUnpacker CastExprBits(Record[ASTStmtReader::NumExprFields + 1]);
4170 CastExprBits.advance(7);
4171 bool HasFPFeatures = CastExprBits.getNextBit();
4172 S = CXXFunctionalCastExpr::CreateEmpty(Context, PathSize, HasFPFeatures);
4173 break;
4174 }
4175
4176 case EXPR_BUILTIN_BIT_CAST: {
4177#ifndef NDEBUG
4178 unsigned PathSize = Record[ASTStmtReader::NumExprFields];
4179 assert(PathSize == 0 && "Wrong PathSize!");
4180#endif
4181 S = new (Context) BuiltinBitCastExpr(Empty);
4182 break;
4183 }
4184
4186 auto NumArgs = Record[ASTStmtReader::NumExprFields];
4187 BitsUnpacker CallExprBits(Record[ASTStmtReader::NumExprFields + 1]);
4188 CallExprBits.advance(1);
4189 auto HasFPFeatures = CallExprBits.getNextBit();
4190 S = UserDefinedLiteral::CreateEmpty(Context, NumArgs, HasFPFeatures,
4191 Empty);
4192 break;
4193 }
4194
4196 S = new (Context) CXXStdInitializerListExpr(Empty);
4197 break;
4198
4200 S = new (Context) CXXBoolLiteralExpr(Empty);
4201 break;
4202
4204 S = new (Context) CXXNullPtrLiteralExpr(Empty);
4205 break;
4206
4208 S = new (Context) CXXTypeidExpr(Empty, true);
4209 break;
4210
4212 S = new (Context) CXXTypeidExpr(Empty, false);
4213 break;
4214
4216 S = new (Context) CXXUuidofExpr(Empty, true);
4217 break;
4218
4220 S = new (Context) MSPropertyRefExpr(Empty);
4221 break;
4222
4224 S = new (Context) MSPropertySubscriptExpr(Empty);
4225 break;
4226
4228 S = new (Context) CXXUuidofExpr(Empty, false);
4229 break;
4230
4231 case EXPR_CXX_THIS:
4232 S = CXXThisExpr::CreateEmpty(Context);
4233 break;
4234
4235 case EXPR_CXX_THROW:
4236 S = new (Context) CXXThrowExpr(Empty);
4237 break;
4238
4241 Context, /*HasRewrittenInit=*/Record[ASTStmtReader::NumExprFields]);
4242 break;
4243
4246 Context, /*HasRewrittenInit=*/Record[ASTStmtReader::NumExprFields]);
4247 break;
4248
4250 S = new (Context) CXXBindTemporaryExpr(Empty);
4251 break;
4252
4254 S = new (Context) CXXScalarValueInitExpr(Empty);
4255 break;
4256
4257 case EXPR_CXX_NEW:
4259 Context,
4261 /*HasInit=*/Record[ASTStmtReader::NumExprFields + 1],
4262 /*NumPlacementArgs=*/Record[ASTStmtReader::NumExprFields + 2],
4263 /*IsParenTypeId=*/Record[ASTStmtReader::NumExprFields + 3]);
4264 break;
4265
4266 case EXPR_CXX_DELETE:
4267 S = new (Context) CXXDeleteExpr(Empty);
4268 break;
4269
4271 S = new (Context) CXXPseudoDestructorExpr(Empty);
4272 break;
4273
4275 S = ExprWithCleanups::Create(Context, Empty,
4277 break;
4278
4280 unsigned NumTemplateArgs = Record[ASTStmtReader::NumExprFields];
4281 BitsUnpacker DependentScopeMemberBits(
4283 bool HasTemplateKWAndArgsInfo = DependentScopeMemberBits.getNextBit();
4284
4285 bool HasFirstQualifierFoundInScope =
4286 DependentScopeMemberBits.getNextBit();
4288 Context, HasTemplateKWAndArgsInfo, NumTemplateArgs,
4289 HasFirstQualifierFoundInScope);
4290 break;
4291 }
4292
4294 BitsUnpacker DependentScopeDeclRefBits(
4296 DependentScopeDeclRefBits.advance(ASTStmtReader::NumExprBits);
4297 bool HasTemplateKWAndArgsInfo = DependentScopeDeclRefBits.getNextBit();
4298 unsigned NumTemplateArgs =
4299 HasTemplateKWAndArgsInfo
4300 ? DependentScopeDeclRefBits.getNextBits(/*Width=*/16)
4301 : 0;
4303 Context, HasTemplateKWAndArgsInfo, NumTemplateArgs);
4304 break;
4305 }
4306
4310 break;
4311
4313 auto NumResults = Record[ASTStmtReader::NumExprFields];
4314 BitsUnpacker OverloadExprBits(Record[ASTStmtReader::NumExprFields + 1]);
4315 auto HasTemplateKWAndArgsInfo = OverloadExprBits.getNextBit();
4316 auto NumTemplateArgs = HasTemplateKWAndArgsInfo
4318 : 0;
4320 Context, NumResults, HasTemplateKWAndArgsInfo, NumTemplateArgs);
4321 break;
4322 }
4323
4325 auto NumResults = Record[ASTStmtReader::NumExprFields];
4326 BitsUnpacker OverloadExprBits(Record[ASTStmtReader::NumExprFields + 1]);
4327 auto HasTemplateKWAndArgsInfo = OverloadExprBits.getNextBit();
4328 auto NumTemplateArgs = HasTemplateKWAndArgsInfo
4330 : 0;
4332 Context, NumResults, HasTemplateKWAndArgsInfo, NumTemplateArgs);
4333 break;
4334 }
4335
4336 case EXPR_TYPE_TRAIT:
4340 break;
4341
4343 S = new (Context) ArrayTypeTraitExpr(Empty);
4344 break;
4345
4347 S = new (Context) ExpressionTraitExpr(Empty);
4348 break;
4349
4350 case EXPR_CXX_NOEXCEPT:
4351 S = new (Context) CXXNoexceptExpr(Empty);
4352 break;
4353
4355 S = new (Context) PackExpansionExpr(Empty);
4356 break;
4357
4358 case EXPR_SIZEOF_PACK:
4360 Context,
4361 /*NumPartialArgs=*/Record[ASTStmtReader::NumExprFields]);
4362 break;
4363
4364 case EXPR_PACK_INDEXING:
4366 Context,
4367 /*TransformedExprs=*/Record[ASTStmtReader::NumExprFields]);
4368 break;
4369
4371 S = new (Context) SubstNonTypeTemplateParmExpr(Empty);
4372 break;
4373
4375 S = new (Context) SubstNonTypeTemplateParmPackExpr(Empty);
4376 break;
4377
4381 break;
4382
4384 S = new (Context) MaterializeTemporaryExpr(Empty);
4385 break;
4386
4387 case EXPR_CXX_FOLD:
4388 S = new (Context) CXXFoldExpr(Empty);
4389 break;
4390
4393 Context, /*numExprs=*/Record[ASTStmtReader::NumExprFields], Empty);
4394 break;
4395
4396 case EXPR_OPAQUE_VALUE:
4397 S = new (Context) OpaqueValueExpr(Empty);
4398 break;
4399
4400 case EXPR_CUDA_KERNEL_CALL: {
4401 auto NumArgs = Record[ASTStmtReader::NumExprFields];
4402 BitsUnpacker CallExprBits(Record[ASTStmtReader::NumExprFields + 1]);
4403 CallExprBits.advance(1);
4404 auto HasFPFeatures = CallExprBits.getNextBit();
4405 S = CUDAKernelCallExpr::CreateEmpty(Context, NumArgs, HasFPFeatures,
4406 Empty);
4407 break;
4408 }
4409
4410 case EXPR_ASTYPE:
4411 S = new (Context) AsTypeExpr(Empty);
4412 break;
4413
4414 case EXPR_PSEUDO_OBJECT: {
4415 unsigned numSemanticExprs = Record[ASTStmtReader::NumExprFields];
4416 S = PseudoObjectExpr::Create(Context, Empty, numSemanticExprs);
4417 break;
4418 }
4419
4420 case EXPR_ATOMIC:
4421 S = new (Context) AtomicExpr(Empty);
4422 break;
4423
4424 case EXPR_LAMBDA: {
4425 unsigned NumCaptures = Record[ASTStmtReader::NumExprFields];
4426 S = LambdaExpr::CreateDeserialized(Context, NumCaptures);
4427 break;
4428 }
4429
4430 case STMT_COROUTINE_BODY: {
4431 unsigned NumParams = Record[ASTStmtReader::NumStmtFields];
4432 S = CoroutineBodyStmt::Create(Context, Empty, NumParams);
4433 break;
4434 }
4435
4436 case STMT_CORETURN:
4437 S = new (Context) CoreturnStmt(Empty);
4438 break;
4439
4440 case EXPR_COAWAIT:
4441 S = new (Context) CoawaitExpr(Empty);
4442 break;
4443
4444 case EXPR_COYIELD:
4445 S = new (Context) CoyieldExpr(Empty);
4446 break;
4447
4449 S = new (Context) DependentCoawaitExpr(Empty);
4450 break;
4451
4453 S = new (Context) ConceptSpecializationExpr(Empty);
4454 break;
4455 }
4457 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
4458 S = OpenACCComputeConstruct::CreateEmpty(Context, NumClauses);
4459 break;
4460 }
4462 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
4463 S = OpenACCLoopConstruct::CreateEmpty(Context, NumClauses);
4464 break;
4465 }
4467 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
4468 S = OpenACCCombinedConstruct::CreateEmpty(Context, NumClauses);
4469 break;
4470 }
4472 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
4473 S = OpenACCDataConstruct::CreateEmpty(Context, NumClauses);
4474 break;
4475 }
4477 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
4478 S = OpenACCEnterDataConstruct::CreateEmpty(Context, NumClauses);
4479 break;
4480 }
4482 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
4483 S = OpenACCExitDataConstruct::CreateEmpty(Context, NumClauses);
4484 break;
4485 }
4487 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
4488 S = OpenACCHostDataConstruct::CreateEmpty(Context, NumClauses);
4489 break;
4490 }
4492 unsigned NumExprs = Record[ASTStmtReader::NumStmtFields];
4493 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
4494 S = OpenACCWaitConstruct::CreateEmpty(Context, NumExprs, NumClauses);
4495 break;
4496 }
4498 unsigned NumVars = Record[ASTStmtReader::NumStmtFields];
4499 S = OpenACCCacheConstruct::CreateEmpty(Context, NumVars);
4500 break;
4501 }
4503 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
4504 S = OpenACCInitConstruct::CreateEmpty(Context, NumClauses);
4505 break;
4506 }
4508 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
4509 S = OpenACCShutdownConstruct::CreateEmpty(Context, NumClauses);
4510 break;
4511 }
4513 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
4514 S = OpenACCSetConstruct::CreateEmpty(Context, NumClauses);
4515 break;
4516 }
4518 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
4519 S = OpenACCUpdateConstruct::CreateEmpty(Context, NumClauses);
4520 break;
4521 }
4523 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
4524 S = OpenACCAtomicConstruct::CreateEmpty(Context, NumClauses);
4525 break;
4526 }
4527 case EXPR_REQUIRES: {
4528 unsigned numLocalParameters = Record[ASTStmtReader::NumExprFields];
4529 unsigned numRequirement = Record[ASTStmtReader::NumExprFields + 1];
4530 S = RequiresExpr::Create(Context, Empty, numLocalParameters,
4531 numRequirement);
4532 break;
4533 }
4534 case EXPR_HLSL_OUT_ARG:
4535 S = HLSLOutArgExpr::CreateEmpty(Context);
4536 break;
4537 }
4538
4539 // We hit a STMT_STOP, so we're done with this expression.
4540 if (Finished)
4541 break;
4542
4543 ++NumStatementsRead;
4544
4545 if (S && !IsStmtReference) {
4546 Reader.Visit(S);
4547 StmtEntries[Cursor.GetCurrentBitNo()] = S;
4548 }
4549
4550 assert(Record.getIdx() == Record.size() &&
4551 "Invalid deserialization of statement");
4552 StmtStack.push_back(S);
4553 }
4554Done:
4555 assert(StmtStack.size() > PrevNumStmts && "Read too many sub-stmts!");
4556 assert(StmtStack.size() == PrevNumStmts + 1 && "Extra expressions on stack!");
4557 return StmtStack.pop_back_val();
4558}
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.
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Defines the clang::LangOptions interface.
llvm::MachO::Record Record
Definition MachO.h:31
This file defines OpenMP AST classes for clauses.
Defines some OpenMP-specific enums and functions.
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.
This file defines SYCL AST classes used to represent calls to SYCL kernels.
Defines enumerations for the type traits support.
C Language Family Type Representation.
static OMPAssumeDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
static OMPCancelDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive.
static OMPCancellationPointDirective * CreateEmpty(const ASTContext &C, EmptyShell)
Creates an empty directive.
static OMPDispatchDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
static OMPDistributeDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
static OMPDistributeParallelForDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
static OMPDistributeParallelForSimdDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
static OMPDistributeSimdDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
static OMPErrorDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive.
static OMPFuseDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses)
Build an empty 'pragma omp fuse' AST node for deserialization.
static OMPGenericLoopDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with a place for NumClauses clauses.
static OMPInterchangeDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned NumLoops)
Build an empty 'pragma omp interchange' AST node for deserialization.
static OMPInteropDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive.
static OMPMaskedDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive.
static OMPMaskedTaskLoopDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
static OMPMaskedTaskLoopSimdDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
static OMPMasterTaskLoopDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
static OMPMasterTaskLoopSimdDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
static OMPMetaDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
static OMPParallelGenericLoopDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
static OMPParallelMaskedTaskLoopDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
static OMPParallelMaskedTaskLoopSimdDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
static OMPParallelMasterTaskLoopDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
static OMPParallelMasterTaskLoopSimdDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
static OMPReverseDirective * CreateEmpty(const ASTContext &C, unsigned NumLoops)
Build an empty 'pragma omp reverse' AST node for deserialization.
static OMPScanDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
static OMPStripeDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned NumLoops)
Build an empty 'pragma omp stripe' AST node for deserialization.
static OMPTargetDataDirective * CreateEmpty(const ASTContext &C, unsigned N, EmptyShell)
Creates an empty directive with the place for N clauses.
static OMPTargetDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
static OMPTargetEnterDataDirective * CreateEmpty(const ASTContext &C, unsigned N, EmptyShell)
Creates an empty directive with the place for N clauses.
static OMPTargetExitDataDirective * CreateEmpty(const ASTContext &C, unsigned N, EmptyShell)
Creates an empty directive with the place for N clauses.
static OMPTargetParallelDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
static OMPTargetParallelForDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
static OMPTargetParallelForSimdDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
static OMPTargetParallelGenericLoopDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
static OMPTargetSimdDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
static OMPTargetTeamsDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
static OMPTargetTeamsDistributeDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
static OMPTargetTeamsDistributeParallelForDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
static OMPTargetTeamsDistributeParallelForSimdDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
static OMPTargetTeamsDistributeSimdDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
static OMPTargetTeamsGenericLoopDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
static OMPTargetUpdateDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
static OMPTaskLoopDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
static OMPTaskLoopSimdDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
static OMPTeamsDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
static OMPTeamsDistributeDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
static OMPTeamsDistributeParallelForDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
static OMPTeamsDistributeParallelForSimdDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
static OMPTeamsDistributeSimdDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
static OMPTeamsGenericLoopDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
static OMPTileDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned NumLoops)
Build an empty 'pragma omp tile' AST node for deserialization.
static OMPUnrollDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses)
Build an empty 'pragma omp unroll' AST node for deserialization.
static OpenACCAtomicConstruct * CreateEmpty(const ASTContext &C, unsigned NumClauses)
ArrayRef< Expr * > getVarList() const
static OpenACCCacheConstruct * CreateEmpty(const ASTContext &C, unsigned NumVars)
static OpenACCCombinedConstruct * CreateEmpty(const ASTContext &C, unsigned NumClauses)
static OpenACCDataConstruct * CreateEmpty(const ASTContext &C, unsigned NumClauses)
static OpenACCEnterDataConstruct * CreateEmpty(const ASTContext &C, unsigned NumClauses)
static OpenACCExitDataConstruct * CreateEmpty(const ASTContext &C, unsigned NumClauses)
static OpenACCHostDataConstruct * CreateEmpty(const ASTContext &C, unsigned NumClauses)
static OpenACCInitConstruct * CreateEmpty(const ASTContext &C, unsigned NumClauses)
static OpenACCLoopConstruct * CreateEmpty(const ASTContext &C, unsigned NumClauses)
static OpenACCSetConstruct * CreateEmpty(const ASTContext &C, unsigned NumClauses)
static OpenACCShutdownConstruct * CreateEmpty(const ASTContext &C, unsigned NumClauses)
static OpenACCUpdateConstruct * CreateEmpty(const ASTContext &C, unsigned NumClauses)
static OpenACCWaitConstruct * CreateEmpty(const ASTContext &C, unsigned NumExprs, unsigned NumClauses)
void setValue(const ASTContext &C, const llvm::APInt &Val)
bool needsCleanup() const
Returns whether the object performed allocations.
Definition APValue.cpp:437
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition ASTContext.h:220
ASTContext & getContext()
Retrieve the AST context that this AST reader supplements.
Definition ASTReader.h:2607
Stmt * ReadSubStmt()
Reads a sub-statement operand during statement reading.
Definition ASTReader.h:2562
Expr * ReadSubExpr()
Reads a sub-expression operand during statement reading.
Expr * ReadExpr(ModuleFile &F)
Reads an expression.
Stmt * ReadStmt(ModuleFile &F)
Reads a statement.
serialization::ModuleFile ModuleFile
Definition ASTReader.h:476
An object for streaming information from a record.
static const unsigned NumExprFields
The number of record fields required for the Expr class itself.
static const unsigned NumStmtFields
The number of record fields required for the Stmt class itself.
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:4484
void setLabel(LabelDecl *L)
Definition Expr.h:4508
void setLabelLoc(SourceLocation L)
Definition Expr.h:4502
void setAmpAmpLoc(SourceLocation L)
Definition Expr.h:4500
Represents the index of the current element of an array being initialized by an ArrayInitLoopExpr.
Definition Expr.h:5955
Represents a loop initializing the elements of an array.
Definition Expr.h:5902
This class represents BOTH the OpenMP Array Section and OpenACC 'subarray', with a boolean differenti...
Definition Expr.h:7105
bool isOMPArraySection() const
Definition Expr.h:7179
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
Definition Expr.h:2721
void setRHS(Expr *E)
Definition Expr.h:2756
void setRBracketLoc(SourceLocation L)
Definition Expr.h:2772
void setLHS(Expr *E)
Definition Expr.h:2752
An Embarcadero array type trait, as used in the implementation of __array_rank and __array_extent.
Definition ExprCXX.h:2996
AsTypeExpr - Clang builtin function __builtin_astype [OpenCL 6.2.4.2] This AST node provides support ...
Definition Expr.h:6619
AsmStmt is the base class for GCCAsmStmt and MSAsmStmt.
Definition Stmt.h:3267
void setSimple(bool V)
Definition Stmt.h:3301
void setAsmLoc(SourceLocation L)
Definition Stmt.h:3298
void setVolatile(bool V)
Definition Stmt.h:3304
unsigned NumInputs
Definition Stmt.h:3282
unsigned getNumClobbers() const
Definition Stmt.h:3348
unsigned getNumOutputs() const
Definition Stmt.h:3316
unsigned NumOutputs
Definition Stmt.h:3281
unsigned NumClobbers
Definition Stmt.h:3283
unsigned getNumInputs() const
Definition Stmt.h:3338
AtomicExpr - Variadic atomic builtins: __atomic_exchange, __atomic_fetch_*, __atomic_load,...
Definition Expr.h:6814
unsigned getNumSubExprs() const
Definition Expr.h:6887
Represents an attribute applied to a statement.
Definition Stmt.h:2193
static AttributedStmt * CreateEmpty(const ASTContext &C, unsigned NumAttrs)
Definition Stmt.cpp:445
BinaryConditionalOperator - The GNU extension to the conditional operator which allows the middle ope...
Definition Expr.h:4387
A builtin binary operation expression such as "x + y" or "x <= y".
Definition Expr.h:3972
void setLHS(Expr *E)
Definition Expr.h:4023
void setHasStoredFPFeatures(bool B)
Set and fetch the bit that shows whether FPFeatures needs to be allocated in Trailing Storage.
Definition Expr.h:4156
void setOperatorLoc(SourceLocation L)
Definition Expr.h:4015
void setRHS(Expr *E)
Definition Expr.h:4025
void setExcludedOverflowPattern(bool B)
Set and get the bit that informs arithmetic overflow sanitizers whether or not they should exclude ce...
Definition Expr.h:4161
static BinaryOperator * CreateEmpty(const ASTContext &C, bool hasFPFeatures)
Definition Expr.cpp:4973
void setStoredFPFeatures(FPOptionsOverride F)
Set FPFeatures in trailing storage, used only by Serialization.
Definition Expr.h:4174
void setOpcode(Opcode Opc)
Definition Expr.h:4020
BinaryOperatorKind Opcode
Definition Expr.h:3977
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
Definition Expr.h:6558
void setBlockDecl(BlockDecl *BD)
Definition Expr.h:6572
BreakStmt - This represents a break.
Definition Stmt.h:3125
Represents a C++2a __builtin_bit_cast(T, v) expression.
Definition ExprCXX.h:5476
CStyleCastExpr - An explicit cast in C (C99 6.5.4) or a C-style cast in C++ (C++ [expr....
Definition Expr.h:3903
static CStyleCastExpr * CreateEmpty(const ASTContext &Context, unsigned PathSize, bool HasFPFeatures)
Definition Expr.cpp:2121
void setRParenLoc(SourceLocation L)
Definition Expr.h:3939
void setLParenLoc(SourceLocation L)
Definition Expr.h:3936
Represents a call to a CUDA kernel function.
Definition ExprCXX.h:234
static CUDAKernelCallExpr * CreateEmpty(const ASTContext &Ctx, unsigned NumArgs, bool HasFPFeatures, EmptyShell Empty)
Definition ExprCXX.cpp:1972
A C++ addrspace_cast expression (currently only enabled for OpenCL).
Definition ExprCXX.h:604
static CXXAddrspaceCastExpr * CreateEmpty(const ASTContext &Context)
Definition ExprCXX.cpp:914
Represents binding an expression to a temporary.
Definition ExprCXX.h:1493
void setTemporary(CXXTemporary *T)
Definition ExprCXX.h:1513
A boolean literal, per ([C++ lex.bool] Boolean literals).
Definition ExprCXX.h:723
void setValue(bool V)
Definition ExprCXX.h:741
void setLocation(SourceLocation L)
Definition ExprCXX.h:747
CXXCatchStmt - This represents a C++ catch block.
Definition StmtCXX.h:28
A C++ const_cast expression (C++ [expr.const.cast]).
Definition ExprCXX.h:566
static CXXConstCastExpr * CreateEmpty(const ASTContext &Context)
Definition ExprCXX.cpp:901
Represents a call to a C++ constructor.
Definition ExprCXX.h:1548
void setArg(unsigned Arg, Expr *ArgExpr)
Set the specified argument.
Definition ExprCXX.h:1701
unsigned getNumArgs() const
Return the number of arguments to the constructor call.
Definition ExprCXX.h:1688
static CXXConstructExpr * CreateEmpty(const ASTContext &Ctx, unsigned NumArgs)
Create an empty C++ construction expression.
Definition ExprCXX.cpp:1195
A default argument (C++ [dcl.fct.default]).
Definition ExprCXX.h:1270
static CXXDefaultArgExpr * CreateEmpty(const ASTContext &C, bool HasRewrittenInit)
Definition ExprCXX.cpp:1032
A use of a default initializer in a constructor or in aggregate initialization.
Definition ExprCXX.h:1377
static CXXDefaultInitExpr * CreateEmpty(const ASTContext &C, bool HasRewrittenInit)
Definition ExprCXX.cpp:1086
Represents a delete expression for memory deallocation and destructor calls, e.g.
Definition ExprCXX.h:2626
Represents a C++ member access expression where the actual member referenced could not be resolved be...
Definition ExprCXX.h:3870
unsigned getNumTemplateArgs() const
Retrieve the number of template arguments provided as part of this template-id.
Definition ExprCXX.h:4064
static CXXDependentScopeMemberExpr * CreateEmpty(const ASTContext &Ctx, bool HasTemplateKWAndArgsInfo, unsigned NumTemplateArgs, bool HasFirstQualifierFoundInScope)
Definition ExprCXX.cpp:1571
A C++ dynamic_cast expression (C++ [expr.dynamic.cast]).
Definition ExprCXX.h:481
static CXXDynamicCastExpr * CreateEmpty(const ASTContext &Context, unsigned pathSize)
Definition ExprCXX.cpp:824
Represents a folding of a pack over an operator.
Definition ExprCXX.h:5032
CXXForRangeStmt - This represents C++0x [stmt.ranged]'s ranged for statement, represented as 'for (ra...
Definition StmtCXX.h:135
void setLoopVarStmt(Stmt *S)
Definition StmtCXX.h:199
void setRangeStmt(Stmt *S)
Definition StmtCXX.h:194
void setEndStmt(Stmt *S)
Definition StmtCXX.h:196
void setInc(Expr *E)
Definition StmtCXX.h:198
void setBeginStmt(Stmt *S)
Definition StmtCXX.h:195
void setInit(Stmt *S)
Definition StmtCXX.h:192
void setBody(Stmt *S)
Definition StmtCXX.h:200
void setCond(Expr *E)
Definition StmtCXX.h:197
Represents an explicit C++ type conversion that uses "functional" notation (C++ [expr....
Definition ExprCXX.h:1831
void setLParenLoc(SourceLocation L)
Definition ExprCXX.h:1869
static CXXFunctionalCastExpr * CreateEmpty(const ASTContext &Context, unsigned PathSize, bool HasFPFeatures)
Definition ExprCXX.cpp:934
void setRParenLoc(SourceLocation L)
Definition ExprCXX.h:1871
Represents a call to an inherited base class constructor from an inheriting constructor.
Definition ExprCXX.h:1751
Represents a call to a member function that may be written either with member call syntax (e....
Definition ExprCXX.h:179
static CXXMemberCallExpr * CreateEmpty(const ASTContext &Ctx, unsigned NumArgs, bool HasFPFeatures, EmptyShell Empty)
Definition ExprCXX.cpp:709
Abstract class common to all of the C++ "named"/"keyword" casts.
Definition ExprCXX.h:375
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)".
Definition ExprCXX.h:2355
static CXXNewExpr * CreateEmpty(const ASTContext &Ctx, bool IsArray, bool HasInit, unsigned NumPlacementArgs, bool IsParenTypeId)
Create an empty c++ new expression.
Definition ExprCXX.cpp:315
bool isArray() const
Definition ExprCXX.h:2464
bool hasInitializer() const
Whether this new-expression has any initializer at all.
Definition ExprCXX.h:2524
Stmt ** raw_arg_iterator
Definition ExprCXX.h:2593
void setOperatorDelete(FunctionDecl *D)
Definition ExprCXX.h:2462
unsigned getNumPlacementArgs() const
Definition ExprCXX.h:2494
bool isParenTypeId() const
Definition ExprCXX.h:2515
raw_arg_iterator raw_arg_end()
Definition ExprCXX.h:2596
raw_arg_iterator raw_arg_begin()
Definition ExprCXX.h:2595
void setOperatorNew(FunctionDecl *D)
Definition ExprCXX.h:2460
Represents a C++11 noexcept expression (C++ [expr.unary.noexcept]).
Definition ExprCXX.h:4309
The null pointer literal (C++11 [lex.nullptr])
Definition ExprCXX.h:768
void setLocation(SourceLocation L)
Definition ExprCXX.h:783
A call to an overloaded operator written using operator syntax.
Definition ExprCXX.h:84
static CXXOperatorCallExpr * CreateEmpty(const ASTContext &Ctx, unsigned NumArgs, bool HasFPFeatures, EmptyShell Empty)
Definition ExprCXX.cpp:641
Represents a list-initialization with parenthesis.
Definition ExprCXX.h:5141
void setInitializedFieldInUnion(FieldDecl *FD)
Definition ExprCXX.h:5215
static CXXParenListInitExpr * CreateEmpty(ASTContext &C, unsigned numExprs, EmptyShell Empty)
Definition ExprCXX.cpp:1996
void setArrayFiller(Expr *E)
Definition ExprCXX.h:5205
Represents a C++ pseudo-destructor (C++ [expr.pseudo]).
Definition ExprCXX.h:2745
void setDestroyedType(IdentifierInfo *II, SourceLocation Loc)
Set the name of destroyed type for a dependent pseudo-destructor expression.
Definition ExprCXX.h:2860
A C++ reinterpret_cast expression (C++ [expr.reinterpret.cast]).
Definition ExprCXX.h:526
static CXXReinterpretCastExpr * CreateEmpty(const ASTContext &Context, unsigned pathSize)
Definition ExprCXX.cpp:887
A rewritten comparison expression that was originally written using operator syntax.
Definition ExprCXX.h:286
An expression "T()" which creates an rvalue of a non-class type T.
Definition ExprCXX.h:2196
A C++ static_cast expression (C++ [expr.static.cast]).
Definition ExprCXX.h:436
static CXXStaticCastExpr * CreateEmpty(const ASTContext &Context, unsigned PathSize, bool hasFPFeatures)
Definition ExprCXX.cpp:797
Implicit construction of a std::initializer_list<T> object from an array temporary within list-initia...
Definition ExprCXX.h:800
Represents a C++ functional cast expression that builds a temporary object.
Definition ExprCXX.h:1899
static CXXTemporaryObjectExpr * CreateEmpty(const ASTContext &Ctx, unsigned NumArgs)
Definition ExprCXX.cpp:1161
Represents the this expression in C++.
Definition ExprCXX.h:1154
void setCapturedByCopyInLambdaWithExplicitObjectParameter(bool Set)
Definition ExprCXX.h:1184
void setLocation(SourceLocation L)
Definition ExprCXX.h:1172
static CXXThisExpr * CreateEmpty(const ASTContext &Ctx)
Definition ExprCXX.cpp:1591
void setImplicit(bool I)
Definition ExprCXX.h:1178
A C++ throw-expression (C++ [except.throw]).
Definition ExprCXX.h:1208
CXXTryStmt - A C++ try block, including all handlers.
Definition StmtCXX.h:69
unsigned getNumHandlers() const
Definition StmtCXX.h:107
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:848
bool isTypeOperand() const
Definition ExprCXX.h:884
void setSourceRange(SourceRange R)
Definition ExprCXX.h:903
Describes an explicit type conversion that uses functional notion but could not be resolved because o...
Definition ExprCXX.h:3744
void setRParenLoc(SourceLocation L)
Definition ExprCXX.h:3794
void setArg(unsigned I, Expr *E)
Definition ExprCXX.h:3830
void setLParenLoc(SourceLocation L)
Definition ExprCXX.h:3789
unsigned getNumArgs() const
Retrieve the number of arguments.
Definition ExprCXX.h:3802
static CXXUnresolvedConstructExpr * CreateEmpty(const ASTContext &Context, unsigned NumArgs)
Definition ExprCXX.cpp:1498
A Microsoft C++ __uuidof expression, which gets the _GUID that corresponds to the supplied type or ex...
Definition ExprCXX.h:1068
bool isTypeOperand() const
Definition ExprCXX.h:1098
void setSourceRange(SourceRange R)
Definition ExprCXX.h:1119
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Definition Expr.h:2877
void setRParenLoc(SourceLocation L)
Definition Expr.h:3209
void setCoroElideSafe(bool V=true)
Definition Expr.h:3052
void setArg(unsigned Arg, Expr *ArgExpr)
setArg - Set the specified argument.
Definition Expr.h:3094
void setADLCallKind(ADLCallKind V=UsesADL)
Definition Expr.h:3031
static CallExpr * CreateEmpty(const ASTContext &Ctx, unsigned NumArgs, bool HasFPFeatures, EmptyShell Empty)
Create an empty call expression, for deserialization.
Definition Expr.cpp:1534
void setUsesMemberSyntax(bool V=true)
Definition Expr.h:3041
void setPreArg(unsigned I, Stmt *PreArg)
Definition Expr.h:2974
void setStoredFPFeatures(FPOptionsOverride F)
Set FPOptionsOverride in trailing storage. Used only by Serialization.
Definition Expr.h:3158
unsigned getNumArgs() const
getNumArgs - Return the number of actual arguments to this call.
Definition Expr.h:3068
void setCallee(Expr *F)
Definition Expr.h:3026
void setBody(Stmt *B)
Definition Decl.cpp:5633
This captures a statement into a function.
Definition Stmt.h:3917
static CapturedStmt * CreateDeserialized(const ASTContext &Context, unsigned NumCaptures)
Definition Stmt.cpp:1433
Expr ** capture_init_iterator
Iterator that walks over the capture initialization arguments.
Definition Stmt.h:4076
void setCapturedRegionKind(CapturedRegionKind Kind)
Set the captured region kind.
Definition Stmt.cpp:1475
CapturedDecl * getCapturedDecl()
Retrieve the outlined function declaration.
Definition Stmt.cpp:1455
Stmt * getCapturedStmt()
Retrieve the statement being captured.
Definition Stmt.h:4021
capture_init_iterator capture_init_begin()
Retrieve the first initialization argument.
Definition Stmt.h:4094
void setCapturedDecl(CapturedDecl *D)
Set the outlined function declaration.
Definition Stmt.cpp:1464
void setCapturedRecordDecl(RecordDecl *D)
Set the record declaration for captured variables.
Definition Stmt.h:4041
capture_init_iterator capture_init_end()
Retrieve the iterator pointing one past the last initialization argument.
Definition Stmt.h:4104
capture_range captures()
Definition Stmt.h:4055
VariableCaptureKind
The different capture forms: by 'this', by reference, capture for variable-length array type etc.
Definition Stmt.h:3921
CaseStmt - Represent a case statement.
Definition Stmt.h:1910
void setEllipsisLoc(SourceLocation L)
Set the location of the ... in a case statement of the form LHS ... RHS.
Definition Stmt.h:1986
static CaseStmt * CreateEmpty(const ASTContext &Ctx, bool CaseStmtIsGNURange)
Build an empty case statement.
Definition Stmt.cpp:1279
void setLHS(Expr *Val)
Definition Stmt.h:2001
void setSubStmt(Stmt *S)
Definition Stmt.h:2028
void setRHS(Expr *Val)
Definition Stmt.h:2017
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
Definition Expr.h:3610
FPOptionsOverride * getTrailingFPFeatures()
Return a pointer to the trailing FPOptions.
Definition Expr.cpp:2052
path_iterator path_begin()
Definition Expr.h:3680
unsigned path_size() const
Definition Expr.h:3679
void setCastKind(CastKind K)
Definition Expr.h:3655
bool hasStoredFPFeatures() const
Definition Expr.h:3709
CXXBaseSpecifier ** path_iterator
Definition Expr.h:3676
void setSubExpr(Expr *E)
Definition Expr.h:3662
void setValue(unsigned Val)
Definition Expr.h:1635
void setLocation(SourceLocation Location)
Definition Expr.h:1631
void setKind(CharacterLiteralKind kind)
Definition Expr.h:1632
ChooseExpr - GNU builtin-in function __builtin_choose_expr.
Definition Expr.h:4782
void setRParenLoc(SourceLocation L)
Definition Expr.h:4833
void setIsConditionTrue(bool isTrue)
Definition Expr.h:4810
void setBuiltinLoc(SourceLocation L)
Definition Expr.h:4830
void setRHS(Expr *E)
Definition Expr.h:4827
void setCond(Expr *E)
Definition Expr.h:4823
void setLHS(Expr *E)
Definition Expr.h:4825
Represents a 'co_await' expression.
Definition ExprCXX.h:5369
void setIsImplicit(bool value=true)
Definition ExprCXX.h:5392
CompoundAssignOperator - For compound assignments (e.g.
Definition Expr.h:4234
void setComputationResultType(QualType T)
Definition Expr.h:4272
static CompoundAssignOperator * CreateEmpty(const ASTContext &C, bool hasFPFeatures)
Definition Expr.cpp:4995
void setComputationLHSType(QualType T)
Definition Expr.h:4269
CompoundLiteralExpr - [C99 6.5.2.5].
Definition Expr.h:3539
void setFileScope(bool FS)
Definition Expr.h:3572
void setTypeSourceInfo(TypeSourceInfo *tinfo)
Definition Expr.h:3580
void setLParenLoc(SourceLocation L)
Definition Expr.h:3575
void setInitializer(Expr *E)
Definition Expr.h:3569
CompoundStmt - This represents a group of statements like { stmt stmt }.
Definition Stmt.h:1730
static CompoundStmt * CreateEmpty(const ASTContext &C, unsigned NumStmts, bool HasFPFeatures)
Definition Stmt.cpp:404
bool hasStoredFPFeatures() const
Definition Stmt.h:1777
Represents the specialization of a concept - evaluates to a prvalue of type bool.
ConditionalOperator - The ?
Definition Expr.h:4325
ConstantExpr - An expression that occurs in a constant context and optionally the result of evaluatin...
Definition Expr.h:1082
ConstantResultStorageKind getResultStorageKind() const
Definition Expr.h:1151
static ConstantExpr * CreateEmpty(const ASTContext &Context, ConstantResultStorageKind StorageKind)
Definition Expr.cpp:366
The result of a constraint satisfaction check, containing the necessary information to diagnose an un...
Definition ASTConcept.h:47
llvm::SmallVector< UnsatisfiedConstraintRecord, 4 > Details
The substituted constraint expr, if the template arguments could be substituted into them,...
Definition ASTConcept.h:67
ContinueStmt - This represents a continue.
Definition Stmt.h:3109
ConvertVectorExpr - Clang builtin function __builtin_convertvector This AST node provides support for...
Definition Expr.h:4653
static ConvertVectorExpr * CreateEmpty(const ASTContext &C, bool hasFPFeatures)
Definition Expr.cpp:5551
void setStoredFPFeatures(FPOptionsOverride F)
Set FPFeatures in trailing storage, used by Serialization & ASTImporter.
Definition Expr.h:4726
bool hasStoredFPFeatures() const
Is FPFeatures in Trailing Storage?
Definition Expr.h:4711
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:5450
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:1270
bool hasTemplateKWAndArgsInfo() const
Definition Expr.h:1391
static DeclRefExpr * CreateEmpty(const ASTContext &Context, bool HasQualifier, bool HasFoundDecl, bool HasTemplateKWAndArgsInfo, unsigned NumTemplateArgs)
Construct an empty declaration reference expression.
Definition Expr.cpp:528
void setLocation(SourceLocation L)
Definition Expr.h:1347
bool hasQualifier() const
Determine whether this declaration reference was preceded by a C++ nested-name-specifier,...
Definition Expr.h:1359
ValueDecl * getDecl()
Definition Expr.h:1338
DeclStmt - Adaptor class for mixing declarations with statements and expressions.
Definition Stmt.h:1621
void setStartLoc(SourceLocation L)
Definition Stmt.h:1643
void setEndLoc(SourceLocation L)
Definition Stmt.h:1645
void setDeclGroup(DeclGroupRef DGR)
Definition Stmt.h:1641
Decl - This represents one declaration (or definition), e.g.
Definition DeclBase.h:86
void setSubStmt(Stmt *S)
Definition Stmt.h:2073
DeferStmt - This represents a deferred statement.
Definition Stmt.h:3226
void setBody(Stmt *S)
Definition Stmt.h:3247
void setDeferLoc(SourceLocation DeferLoc)
Definition Stmt.h:3241
static DeferStmt * CreateEmpty(ASTContext &Context, EmptyShell Empty)
Definition Stmt.cpp:1510
Represents a 'co_await' expression while the type of the promise is dependent.
Definition ExprCXX.h:5401
A qualified reference to a name whose declaration cannot yet be resolved.
Definition ExprCXX.h:3510
static DependentScopeDeclRefExpr * CreateEmpty(const ASTContext &Context, bool HasTemplateKWAndArgsInfo, unsigned NumTemplateArgs)
Definition ExprCXX.cpp:559
Represents a C99 designated initializer expression.
Definition Expr.h:5485
static DesignatedInitExpr * CreateEmpty(const ASTContext &C, unsigned NumIndexExprs)
Definition Expr.cpp:4727
void setSubExpr(unsigned Idx, Expr *E)
Definition Expr.h:5771
void setGNUSyntax(bool GNU)
Definition Expr.h:5750
void setEqualOrColonLoc(SourceLocation L)
Definition Expr.h:5741
void setDesignators(const ASTContext &C, const Designator *Desigs, unsigned NumDesigs)
Definition Expr.cpp:4734
unsigned getNumSubExprs() const
Retrieve the total number of subexpressions in this designated initializer expression,...
Definition Expr.h:5765
void setBase(Expr *Base)
Definition Expr.h:5868
void setUpdater(Expr *Updater)
Definition Expr.h:5873
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:2822
void setWhileLoc(SourceLocation L)
Definition Stmt.h:2854
void setDoLoc(SourceLocation L)
Definition Stmt.h:2852
void setRParenLoc(SourceLocation L)
Definition Stmt.h:2856
void setBody(Stmt *Body)
Definition Stmt.h:2849
void setCond(Expr *Cond)
Definition Stmt.h:2845
Represents a reference to emded data.
Definition Expr.h:5060
ExplicitCastExpr - An explicit cast written in the source code.
Definition Expr.h:3862
void setTypeInfoAsWritten(TypeSourceInfo *writtenTy)
Definition Expr.h:3885
Represents an expression – generally a full-expression – that introduces cleanups to be run at the en...
Definition ExprCXX.h:3661
unsigned getNumObjects() const
Definition ExprCXX.h:3689
llvm::PointerUnion< BlockDecl *, CompoundLiteralExpr * > CleanupObject
The type of objects that are kept in the cleanup.
Definition ExprCXX.h:3667
static ExprWithCleanups * Create(const ASTContext &C, EmptyShell empty, unsigned numObjects)
Definition ExprCXX.cpp:1464
This represents one expression.
Definition Expr.h:112
void setType(QualType t)
Definition Expr.h:145
bool isValueDependent() const
Determines whether the value of this expression depends on.
Definition Expr.h:177
bool isInstantiationDependent() const
Whether this expression is instantiation-dependent, meaning that it depends in some way on.
Definition Expr.h:223
void setValueKind(ExprValueKind Cat)
setValueKind - Set the value kind produced by this expression.
Definition Expr.h:461
void setObjectKind(ExprObjectKind Cat)
setObjectKind - Set the object kind produced by this expression.
Definition Expr.h:464
void setDependence(ExprDependence Deps)
Each concrete expr subclass is expected to compute its dependence and call this in the constructor.
Definition Expr.h:137
An expression trait intrinsic.
Definition ExprCXX.h:3069
ExtVectorElementExpr - This represents access to specific elements of a vector, and may occur on the ...
Definition Expr.h:6498
void setAccessor(IdentifierInfo *II)
Definition Expr.h:6520
void setBase(Expr *E)
Definition Expr.h:6517
void setAccessorLoc(SourceLocation L)
Definition Expr.h:6523
static FPOptionsOverride getFromOpaqueInt(storage_type I)
static FixedPointLiteral * Create(const ASTContext &C, EmptyShell Empty)
Returns an empty fixed-point literal.
Definition Expr.cpp:1004
void setLocation(SourceLocation Location)
Definition Expr.h:1583
void setScale(unsigned S)
Definition Expr.h:1586
static FloatingLiteral * Create(const ASTContext &C, const llvm::APFloat &V, bool isexact, QualType Type, SourceLocation L)
Definition Expr.cpp:1075
const llvm::fltSemantics & getSemantics() const
Return the APFloat semantics this literal uses.
Definition Expr.h:1688
void setValue(const ASTContext &C, const llvm::APFloat &Val)
Definition Expr.h:1669
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:1683
void setExact(bool E)
Definition Expr.h:1700
void setLocation(SourceLocation L)
Definition Expr.h:1708
ForStmt - This represents a 'for (init;cond;inc)' stmt.
Definition Stmt.h:2878
void setBody(Stmt *S)
Definition Stmt.h:2932
void setCond(Expr *E)
Definition Stmt.h:2930
void setForLoc(SourceLocation L)
Definition Stmt.h:2935
void setInc(Expr *E)
Definition Stmt.h:2931
void setLParenLoc(SourceLocation L)
Definition Stmt.h:2937
void setInit(Stmt *S)
Definition Stmt.h:2929
void setConditionVariableDeclStmt(DeclStmt *CondVar)
Definition Stmt.h:2916
void setRParenLoc(SourceLocation L)
Definition Stmt.h:2939
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:1067
Stmt * SubExpr
Definition Expr.h:1051
Represents a reference to a function parameter pack, init-capture pack, or binding pack that has been...
Definition ExprCXX.h:4841
static FunctionParmPackExpr * CreateEmpty(const ASTContext &Context, unsigned NumParams)
Definition ExprCXX.cpp:1824
This represents a GCC inline-assembly statement extension.
Definition Stmt.h:3426
unsigned getNumLabels() const
Definition Stmt.h:3576
void setAsmStringExpr(Expr *E)
Definition Stmt.h:3455
void setRParenLoc(SourceLocation L)
Definition Stmt.h:3449
GNUNullExpr - Implements the GNU __null extension, which is a name for a null pointer constant that h...
Definition Expr.h:4857
void setTokenLocation(SourceLocation L)
Definition Expr.h:4872
Represents a C11 generic selection.
Definition Expr.h:6112
unsigned getNumAssocs() const
The number of association expressions.
Definition Expr.h:6352
static GenericSelectionExpr * CreateEmpty(const ASTContext &Context, unsigned NumAssocs)
Create an empty generic selection expression for deserialization.
Definition Expr.cpp:4661
GotoStmt - This represents a direct goto.
Definition Stmt.h:2959
void setLabel(LabelDecl *D)
Definition Stmt.h:2973
void setLabelLoc(SourceLocation L)
Definition Stmt.h:2978
void setGotoLoc(SourceLocation L)
Definition Stmt.h:2976
This class represents temporary values used to represent inout and out arguments in HLSL.
Definition Expr.h:7283
static HLSLOutArgExpr * CreateEmpty(const ASTContext &Ctx)
Definition Expr.cpp:5537
IfStmt - This represents an if/then/else.
Definition Stmt.h:2249
void setThen(Stmt *Then)
Definition Stmt.h:2343
void setConditionVariableDeclStmt(DeclStmt *CondVar)
Definition Stmt.h:2394
void setCond(Expr *Cond)
Definition Stmt.h:2334
void setLParenLoc(SourceLocation Loc)
Definition Stmt.h:2468
void setElse(Stmt *Else)
Definition Stmt.h:2357
void setElseLoc(SourceLocation ElseLoc)
Definition Stmt.h:2423
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:1021
void setStatementKind(IfStatementKind Kind)
Definition Stmt.h:2446
void setRParenLoc(SourceLocation Loc)
Definition Stmt.h:2470
void setIfLoc(SourceLocation IfLoc)
Definition Stmt.h:2416
void setInit(Stmt *Init)
Definition Stmt.h:2409
ImaginaryLiteral - We support imaginary integer and floating point literals, like "1....
Definition Expr.h:1731
void setSubExpr(Expr *E)
Definition Expr.h:1745
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
Definition Expr.h:3787
static ImplicitCastExpr * CreateEmpty(const ASTContext &Context, unsigned PathSize, bool HasFPFeatures)
Definition Expr.cpp:2094
void setIsPartOfExplicitCast(bool PartOfExplicitCast)
Definition Expr.h:3819
Represents an implicitly-generated value initialization of an object of a given type.
Definition Expr.h:5991
IndirectGotoStmt - This represents an indirect goto.
Definition Stmt.h:2998
void setTarget(Expr *E)
Definition Stmt.h:3022
void setGotoLoc(SourceLocation L)
Definition Stmt.h:3013
void setStarLoc(SourceLocation L)
Definition Stmt.h:3015
Describes an C or C++ initializer list.
Definition Expr.h:5233
void setSyntacticForm(InitListExpr *Init)
Definition Expr.h:5410
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:2425
void setLBraceLoc(SourceLocation Loc)
Definition Expr.h:5395
void setRBraceLoc(SourceLocation Loc)
Definition Expr.h:5397
void sawArrayRangeDesignator(bool ARD=true)
Definition Expr.h:5420
void reserveInits(const ASTContext &C, unsigned NumInits)
Reserve space for some number of initializers.
Definition Expr.cpp:2416
void setLocation(SourceLocation Location)
Definition Expr.h:1538
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:974
LabelStmt - Represents a label, which has a substatement.
Definition Stmt.h:2136
void setSubStmt(Stmt *SS)
Definition Stmt.h:2161
void setDecl(LabelDecl *D)
Definition Stmt.h:2155
void setIdentLoc(SourceLocation L)
Definition Stmt.h:2152
void setSideEntry(bool SE)
Definition Stmt.h:2184
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
Definition ExprCXX.h:1968
Expr ** capture_init_iterator
Iterator that walks over the capture initialization arguments.
Definition ExprCXX.h:2075
static LambdaExpr * CreateDeserialized(const ASTContext &C, unsigned NumCaptures)
Construct a new lambda expression that will be deserialized from an external source.
Definition ExprCXX.cpp:1332
capture_init_iterator capture_init_end()
Retrieve the iterator pointing one past the last initialization argument for this lambda expression.
Definition ExprCXX.h:2106
capture_init_iterator capture_init_begin()
Retrieve the first initialization argument for this lambda expression (which initializes the first ca...
Definition ExprCXX.h:2094
Base class for BreakStmt and ContinueStmt.
Definition Stmt.h:3047
void setLabelDecl(LabelDecl *S)
Definition Stmt.h:3087
void setLabelLoc(SourceLocation L)
Definition Stmt.h:3083
void setKwLoc(SourceLocation L)
Definition Stmt.h:3073
This represents a Microsoft inline-assembly statement extension.
Definition Stmt.h:3645
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:936
MS property subscript expression.
Definition ExprCXX.h:1006
void setRBracketLoc(SourceLocation L)
Definition ExprCXX.h:1044
Represents a prvalue temporary that is written into memory so that a reference can bind to it.
Definition ExprCXX.h:4920
MatrixSubscriptExpr - Matrix subscript expression for the MatrixType extension.
Definition Expr.h:2799
void setColumnIdx(Expr *E)
Definition Expr.h:2839
void setBase(Expr *E)
Definition Expr.h:2827
void setRowIdx(Expr *E)
Definition Expr.h:2831
void setRBracketLoc(SourceLocation L)
Definition Expr.h:2854
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
Definition Expr.h:3298
static MemberExpr * CreateEmpty(const ASTContext &Context, bool HasQualifier, bool HasFoundDecl, bool HasTemplateKWAndArgsInfo, unsigned NumTemplateArgs)
Definition Expr.cpp:1771
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
Definition Decl.h:340
Represents a place-holder for an object not to be initialized by anything.
Definition Expr.h:5811
NullStmt - This is the null statement ";": C99 6.8.3p3.
Definition Stmt.h:1693
void setSemiLoc(SourceLocation L)
Definition Stmt.h:1705
An explicit cast in C or a C-style cast in C++, which uses the syntax ([s1][s2]......
Definition ExprOpenMP.h:24
void setLParenLoc(SourceLocation L)
Definition ExprOpenMP.h:69
static OMPArrayShapingExpr * CreateEmpty(const ASTContext &Context, unsigned NumDims)
Definition Expr.cpp:5391
void setRParenLoc(SourceLocation L)
Definition ExprOpenMP.h:72
OpenMP 5.0 [2.1.6 Iterators] Iterators are identifiers that expand to multiple values in the clause o...
Definition ExprOpenMP.h:151
void setLParenLoc(SourceLocation L)
Definition ExprOpenMP.h:243
static OMPIteratorExpr * CreateEmpty(const ASTContext &Context, unsigned NumIterators)
Definition Expr.cpp:5520
void setRParenLoc(SourceLocation L)
Definition ExprOpenMP.h:246
void setIteratorKwLoc(SourceLocation L)
Definition ExprOpenMP.h:249
ObjCArrayLiteral - used for objective-c array containers; as in: @["Hello", NSApp,...
Definition ExprObjC.h:192
static ObjCArrayLiteral * CreateEmpty(const ASTContext &C, unsigned NumElements)
Definition ExprObjC.cpp:45
Expr ** getElements()
Retrieve elements of array of literals.
Definition ExprObjC.h:221
unsigned getNumElements() const
getNumElements - Return number of elements of objective-c array literal.
Definition ExprObjC.h:227
Represents Objective-C's @catch statement.
Definition StmtObjC.h:77
void setCatchParamDecl(VarDecl *D)
Definition StmtObjC.h:103
void setCatchBody(Stmt *S)
Definition StmtObjC.h:95
void setRParenLoc(SourceLocation Loc)
Definition StmtObjC.h:108
void setAtCatchLoc(SourceLocation Loc)
Definition StmtObjC.h:106
Represents Objective-C's @finally statement.
Definition StmtObjC.h:127
void setFinallyBody(Stmt *S)
Definition StmtObjC.h:141
void setAtFinallyLoc(SourceLocation Loc)
Definition StmtObjC.h:149
Represents Objective-C's @synchronized statement.
Definition StmtObjC.h:303
void setAtSynchronizedLoc(SourceLocation Loc)
Definition StmtObjC.h:321
Represents Objective-C's @throw statement.
Definition StmtObjC.h:358
void setThrowLoc(SourceLocation Loc)
Definition StmtObjC.h:375
void setThrowExpr(Stmt *S)
Definition StmtObjC.h:372
Represents Objective-C's @try ... @catch ... @finally statement.
Definition StmtObjC.h:167
void setAtTryLoc(SourceLocation Loc)
Definition StmtObjC.h:211
void setFinallyStmt(Stmt *S)
Definition StmtObjC.h:253
static ObjCAtTryStmt * CreateEmpty(const ASTContext &Context, unsigned NumCatchStmts, bool HasFinally)
Definition StmtObjC.cpp:56
unsigned getNumCatchStmts() const
Retrieve the number of @catch statements in this try-catch-finally block.
Definition StmtObjC.h:220
void setCatchStmt(unsigned I, ObjCAtCatchStmt *S)
Set a particular catch statement.
Definition StmtObjC.h:235
void setTryBody(Stmt *S)
Definition StmtObjC.h:216
Represents Objective-C's @autoreleasepool Statement.
Definition StmtObjC.h:394
void setAtLoc(SourceLocation Loc)
Definition StmtObjC.h:415
A runtime availability query.
Definition ExprObjC.h:1700
ObjCBoolLiteralExpr - Objective-C Boolean Literal.
Definition ExprObjC.h:88
void setLocation(SourceLocation L)
Definition ExprObjC.h:108
ObjCBoxedExpr - used for generalized expression boxing.
Definition ExprObjC.h:128
An Objective-C "bridged" cast expression, which casts between Objective-C pointers and C pointers,...
Definition ExprObjC.h:1640
ObjCDictionaryLiteral - AST node to represent objective-c dictionary literals; as in:"name" : NSUserN...
Definition ExprObjC.h:307
static ObjCDictionaryLiteral * CreateEmpty(const ASTContext &C, unsigned NumElements, bool HasPackExpansions)
Definition ExprObjC.cpp:86
unsigned getNumElements() const
getNumElements - Return number of elements of objective-c dictionary literal.
Definition ExprObjC.h:358
ObjCEncodeExpr, used for @encode in Objective-C.
Definition ExprObjC.h:407
void setEncodedTypeSourceInfo(TypeSourceInfo *EncType)
Definition ExprObjC.h:430
void setRParenLoc(SourceLocation L)
Definition ExprObjC.h:424
void setAtLoc(SourceLocation L)
Definition ExprObjC.h:422
Represents Objective-C's collection statement.
Definition StmtObjC.h:23
void setCollection(Expr *E)
Definition StmtObjC.h:47
void setForLoc(SourceLocation Loc)
Definition StmtObjC.h:53
void setRParenLoc(SourceLocation Loc)
Definition StmtObjC.h:55
ObjCIndirectCopyRestoreExpr - Represents the passing of a function argument by indirect copy-restore ...
Definition ExprObjC.h:1579
ObjCIsaExpr - Represent X->isa and X.isa when X is an ObjC 'id' type.
Definition ExprObjC.h:1495
void setIsaMemberLoc(SourceLocation L)
Definition ExprObjC.h:1528
void setBase(Expr *E)
Definition ExprObjC.h:1519
void setArrow(bool A)
Definition ExprObjC.h:1523
void setOpLoc(SourceLocation L)
Definition ExprObjC.h:1531
ObjCIvarRefExpr - A reference to an ObjC instance variable.
Definition ExprObjC.h:546
void setIsArrow(bool A)
Definition ExprObjC.h:586
void setBase(Expr *base)
Definition ExprObjC.h:582
void setDecl(ObjCIvarDecl *d)
Definition ExprObjC.h:578
void setIsFreeIvar(bool A)
Definition ExprObjC.h:587
void setOpLoc(SourceLocation L)
Definition ExprObjC.h:598
void setLocation(SourceLocation L)
Definition ExprObjC.h:590
An expression that sends a message to the given Objective-C object or class.
Definition ExprObjC.h:937
static ObjCMessageExpr * CreateEmpty(const ASTContext &Context, unsigned NumArgs, unsigned NumStoredSelLocs)
Create an empty Objective-C message expression, to be filled in by subsequent calls.
Definition ExprObjC.cpp:228
void setMethodDecl(ObjCMethodDecl *MD)
Definition ExprObjC.h:1375
void setClassReceiver(TypeSourceInfo *TSInfo)
Definition ExprObjC.h:1299
void setInstanceReceiver(Expr *rec)
Turn this message send into an instance message that computes the receiver object with the given expr...
Definition ExprObjC.h:1277
void setSuper(SourceLocation Loc, QualType T, bool IsInstanceSuper)
Definition ExprObjC.h:1348
ReceiverKind
The kind of receiver this message is sending to.
Definition ExprObjC.h:940
@ SuperInstance
The receiver is the instance of the superclass object.
Definition ExprObjC.h:951
@ Instance
The receiver is an object instance.
Definition ExprObjC.h:945
@ SuperClass
The receiver is a superclass.
Definition ExprObjC.h:948
@ Class
The receiver is a class.
Definition ExprObjC.h:942
void setDelegateInitCall(bool isDelegate)
Definition ExprObjC.h:1419
ReceiverKind getReceiverKind() const
Determine the kind of receiver that this message is being sent to.
Definition ExprObjC.h:1226
unsigned getNumArgs() const
Return the number of actual arguments in this message, not counting the receiver.
Definition ExprObjC.h:1387
void setSelector(Selector S)
Definition ExprObjC.h:1356
void setArg(unsigned Arg, Expr *ArgExpr)
setArg - Set the specified argument.
Definition ExprObjC.h:1410
ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC property.
Definition ExprObjC.h:614
ObjCProtocolExpr used for protocol expression in Objective-C.
Definition ExprObjC.h:502
void setProtocol(ObjCProtocolDecl *P)
Definition ExprObjC.h:520
void setRParenLoc(SourceLocation L)
Definition ExprObjC.h:526
void setAtLoc(SourceLocation L)
Definition ExprObjC.h:525
ObjCSelectorExpr used for @selector in Objective-C.
Definition ExprObjC.h:452
void setSelector(Selector S)
Definition ExprObjC.h:467
void setAtLoc(SourceLocation L)
Definition ExprObjC.h:471
void setRParenLoc(SourceLocation L)
Definition ExprObjC.h:472
ObjCStringLiteral, used for Objective-C string literals i.e.
Definition ExprObjC.h:52
void setAtLoc(SourceLocation L)
Definition ExprObjC.h:70
void setString(StringLiteral *S)
Definition ExprObjC.h:67
ObjCSubscriptRefExpr - used for array and dictionary subscripting.
Definition ExprObjC.h:836
void setRBracket(SourceLocation RB)
Definition ExprObjC.h:867
void setBaseExpr(Stmt *S)
Definition ExprObjC.h:876
OffsetOfExpr - [C99 7.17] - This represents an expression of the form offsetof(record-type,...
Definition Expr.h:2527
void setOperatorLoc(SourceLocation L)
Definition Expr.h:2561
static OffsetOfExpr * CreateEmpty(const ASTContext &C, unsigned NumComps, unsigned NumExprs)
Definition Expr.cpp:1665
void setIndexExpr(unsigned Idx, Expr *E)
Definition Expr.h:2594
void setTypeSourceInfo(TypeSourceInfo *tsi)
Definition Expr.h:2570
void setComponent(unsigned Idx, OffsetOfNode ON)
Definition Expr.h:2578
unsigned getNumExpressions() const
Definition Expr.h:2598
void setRParenLoc(SourceLocation R)
Definition Expr.h:2565
unsigned getNumComponents() const
Definition Expr.h:2582
Kind
The kind of offsetof node we have.
Definition Expr.h:2424
@ Array
An index into an array.
Definition Expr.h:2426
@ Identifier
A field in a dependent type, known only by its name.
Definition Expr.h:2430
@ Field
A field.
Definition Expr.h:2428
@ Base
An implicit indirection through a C++ base class, when the field found is in a base class.
Definition Expr.h:2433
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class.
Definition Expr.h:1178
void setIsUnique(bool V)
Definition Expr.h:1230
This is a base class for any OpenACC statement-level constructs that have an associated statement.
Definition StmtOpenACC.h:81
This expression type represents an asterisk in an OpenACC Size-Expr, used in the 'tile' and 'gang' cl...
Definition Expr.h:2090
static OpenACCAsteriskSizeExpr * CreateEmpty(const ASTContext &C)
Definition Expr.cpp:5547
This is the base class for an OpenACC statement-level construct, other construct types are expected t...
Definition StmtOpenACC.h:26
A reference to an overloaded function set, either an UnresolvedLookupExpr or an UnresolvedMemberExpr.
Definition ExprCXX.h:3128
ASTTemplateKWAndArgsInfo * getTrailingASTTemplateKWAndArgsInfo()
Return the optional template keyword and arguments info.
Definition ExprCXX.h:4282
unsigned getNumDecls() const
Gets the number of declarations in the unresolved set.
Definition ExprCXX.h:3232
TemplateArgumentLoc * getTrailingTemplateArgumentLoc()
Return the optional template arguments.
Definition ExprCXX.h:4292
DeclAccessPair * getTrailingResults()
Return the results. Defined after UnresolvedMemberExpr.
Definition ExprCXX.h:4276
bool hasTemplateKWAndArgsInfo() const
Definition ExprCXX.h:3172
unsigned getNumTemplateArgs() const
Definition ExprCXX.h:3330
Represents a C++11 pack expansion that produces a sequence of expressions.
Definition ExprCXX.h:4363
static PackIndexingExpr * CreateDeserialized(ASTContext &Context, unsigned NumTransformedExprs)
Definition ExprCXX.cpp:1761
ParenExpr - This represents a parenthesized expression, e.g.
Definition Expr.h:2182
void setLParen(SourceLocation Loc)
Definition Expr.h:2208
void setIsProducedByFoldExpansion(bool ProducedByFoldExpansion=true)
Definition Expr.h:2227
void setRParen(SourceLocation Loc)
Definition Expr.h:2212
void setSubExpr(Expr *E)
Definition Expr.h:2201
static ParenListExpr * CreateEmpty(const ASTContext &Ctx, unsigned NumExprs)
Create an empty paren list.
Definition Expr.cpp:4862
unsigned getNumExprs() const
Return the number of expressions in this paren list.
Definition Expr.h:6044
[C99 6.4.2.2] - A predefined identifier such as func.
Definition Expr.h:2005
void setLocation(SourceLocation L)
Definition Expr.h:2047
static PredefinedExpr * CreateEmpty(const ASTContext &Ctx, bool HasFunctionName)
Create an empty PredefinedExpr.
Definition Expr.cpp:641
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
Definition Expr.h:6690
static PseudoObjectExpr * Create(const ASTContext &Context, Expr *syntactic, ArrayRef< Expr * > semantic, unsigned resultIndex)
Definition Expr.cpp:5075
Frontend produces RecoveryExprs on semantic errors that prevent creating other well-formed expression...
Definition Expr.h:7389
child_range children()
Definition Expr.h:7402
static RecoveryExpr * CreateEmpty(ASTContext &Ctx, unsigned NumSubExprs)
Definition Expr.cpp:5346
C++2a [expr.prim.req]: A requires-expression provides a concise way to express requirements on templa...
static RequiresExpr * Create(ASTContext &C, SourceLocation RequiresKWLoc, RequiresExprBodyDecl *Body, SourceLocation LParenLoc, ArrayRef< ParmVarDecl * > LocalParameters, SourceLocation RParenLoc, ArrayRef< concepts::Requirement * > Requirements, SourceLocation RBraceLoc)
ReturnStmt - This represents a return, optionally of an expression: return; return 4;.
Definition Stmt.h:3150
void setRetValue(Expr *E)
Definition Stmt.h:3179
void setReturnLoc(SourceLocation L)
Definition Stmt.h:3200
void setNRVOCandidate(const VarDecl *Var)
Set the variable that might be used for the named return value optimization.
Definition Stmt.h:3193
static ReturnStmt * CreateEmpty(const ASTContext &Ctx, bool HasNRVOCandidate)
Create an empty return statement, optionally with storage for an NRVO candidate.
Definition Stmt.cpp:1260
Represents a __leave statement.
Definition Stmt.h:3878
void setLeaveLoc(SourceLocation L)
Definition Stmt.h:3889
SYCLKernelCallStmt represents the transformation that is applied to the body of a function declared w...
Definition StmtSYCL.h:37
void setOriginalStmt(CompoundStmt *CS)
Definition StmtSYCL.h:58
void setOutlinedFunctionDecl(OutlinedFunctionDecl *OFD)
Set the outlined function declaration.
Definition StmtSYCL.h:65
static SYCLUniqueStableNameExpr * CreateEmpty(const ASTContext &Ctx)
Definition Expr.cpp:581
ShuffleVectorExpr - clang-specific builtin-in function __builtin_shufflevector.
Definition Expr.h:4577
void setExprs(const ASTContext &C, ArrayRef< Expr * > Exprs)
Definition Expr.cpp:4491
void setRParenLoc(SourceLocation L)
Definition Expr.h:4598
void setBuiltinLoc(SourceLocation L)
Definition Expr.h:4595
Represents an expression that computes the length of a parameter pack.
Definition ExprCXX.h:4441
static SizeOfPackExpr * CreateDeserialized(ASTContext &Context, unsigned NumPartialArgs)
Definition ExprCXX.cpp:1721
bool isPartiallySubstituted() const
Determine whether this represents a partially-substituted sizeof... expression, such as is produced f...
Definition ExprCXX.h:4526
Represents a function call to one of __builtin_LINE(), __builtin_COLUMN(), __builtin_FUNCTION(),...
Definition Expr.h:4951
Encodes a location in the source.
A trivial tuple used to represent a source range.
SourceLocation getEnd() const
SourceLocation getBegin() const
StmtExpr - This is the GNU Statement Expression extension: ({int X=4; X;}).
Definition Expr.h:4529
void setRParenLoc(SourceLocation L)
Definition Expr.h:4556
void setLParenLoc(SourceLocation L)
Definition Expr.h:4554
void setSubStmt(CompoundStmt *S)
Definition Expr.h:4548
StmtVisitor - This class implements a simple visitor for Stmt subclasses.
Stmt - This represents one statement.
Definition Stmt.h:85
ExpressionTraitExprBitfields ExpressionTraitExprBits
Definition Stmt.h:1386
GenericSelectionExprBitfields GenericSelectionExprBits
Definition Stmt.h:1350
LambdaExprBitfields LambdaExprBits
Definition Stmt.h:1383
AttributedStmtBitfields AttributedStmtBits
Definition Stmt.h:1321
UnresolvedLookupExprBitfields UnresolvedLookupExprBits
Definition Stmt.h:1379
SubstNonTypeTemplateParmExprBitfields SubstNonTypeTemplateParmExprBits
Definition Stmt.h:1382
CXXNoexceptExprBitfields CXXNoexceptExprBits
Definition Stmt.h:1381
CXXRewrittenBinaryOperatorBitfields CXXRewrittenBinaryOperatorBits
Definition Stmt.h:1362
ExprWithCleanupsBitfields ExprWithCleanupsBits
Definition Stmt.h:1375
StmtClass getStmtClass() const
Definition Stmt.h:1483
CXXScalarValueInitExprBitfields CXXScalarValueInitExprBits
Definition Stmt.h:1369
CXXConstructExprBitfields CXXConstructExprBits
Definition Stmt.h:1374
CXXDependentScopeMemberExprBitfields CXXDependentScopeMemberExprBits
Definition Stmt.h:1377
TypeTraitExprBitfields TypeTraitExprBits
Definition Stmt.h:1372
CXXNewExprBitfields CXXNewExprBits
Definition Stmt.h:1370
SourceLocExprBitfields SourceLocExprBits
Definition Stmt.h:1352
ConstantExprBitfields ConstantExprBits
Definition Stmt.h:1335
RequiresExprBitfields RequiresExprBits
Definition Stmt.h:1384
CXXFoldExprBitfields CXXFoldExprBits
Definition Stmt.h:1387
StmtExprBitfields StmtExprBits
Definition Stmt.h:1357
StringLiteralBitfields StringLiteralBits
Definition Stmt.h:1339
OpaqueValueExprBitfields OpaqueValueExprBits
Definition Stmt.h:1397
CXXThrowExprBitfields CXXThrowExprBits
Definition Stmt.h:1366
MemberExprBitfields MemberExprBits
Definition Stmt.h:1345
PackIndexingExprBitfields PackIndexingExprBits
Definition Stmt.h:1388
DeclRefExprBitfields DeclRefExprBits
Definition Stmt.h:1337
CXXOperatorCallExprBitfields CXXOperatorCallExprBits
Definition Stmt.h:1361
CXXDefaultInitExprBitfields CXXDefaultInitExprBits
Definition Stmt.h:1368
NullStmtBitfields NullStmtBits
Definition Stmt.h:1318
ArrayTypeTraitExprBitfields ArrayTypeTraitExprBits
Definition Stmt.h:1385
PredefinedExprBitfields PredefinedExprBits
Definition Stmt.h:1336
UnresolvedMemberExprBitfields UnresolvedMemberExprBits
Definition Stmt.h:1380
PseudoObjectExprBitfields PseudoObjectExprBits
Definition Stmt.h:1351
CXXDeleteExprBitfields CXXDeleteExprBits
Definition Stmt.h:1371
CXXDefaultArgExprBitfields CXXDefaultArgExprBits
Definition Stmt.h:1367
StringLiteral - This represents a string literal expression, e.g.
Definition Expr.h:1799
unsigned getLength() const
Definition Expr.h:1909
StringLiteralKind getKind() const
Definition Expr.h:1912
static StringLiteral * CreateEmpty(const ASTContext &Ctx, unsigned NumConcatenated, unsigned Length, unsigned CharByteWidth)
Construct an empty string literal.
Definition Expr.cpp:1197
unsigned getNumConcatenated() const
getNumConcatenated - Get the number of string literal tokens that were concatenated in translation ph...
Definition Expr.h:1940
unsigned getCharByteWidth() const
Definition Expr.h:1910
Represents a reference to a non-type template parameter that has been substituted with a template arg...
Definition ExprCXX.h:4664
Represents a reference to a non-type template parameter pack that has been substituted with a non-tem...
Definition ExprCXX.h:4754
void setColonLoc(SourceLocation L)
Definition Stmt.h:1890
void setKeywordLoc(SourceLocation L)
Definition Stmt.h:1888
void setNextSwitchCase(SwitchCase *SC)
Definition Stmt.h:1885
SwitchStmt - This represents a 'switch' stmt.
Definition Stmt.h:2499
void setCond(Expr *Cond)
Definition Stmt.h:2570
void setSwitchLoc(SourceLocation L)
Definition Stmt.h:2635
void setConditionVariableDeclStmt(DeclStmt *CondVar)
Definition Stmt.h:2625
void setBody(Stmt *Body)
Definition Stmt.h:2577
void setRParenLoc(SourceLocation Loc)
Definition Stmt.h:2639
void setInit(Stmt *Init)
Definition Stmt.h:2587
void setLParenLoc(SourceLocation Loc)
Definition Stmt.h:2637
static SwitchStmt * CreateEmpty(const ASTContext &Ctx, bool HasInit, bool HasVar)
Create an empty switch statement optionally with storage for an init expression and a condition varia...
Definition Stmt.cpp:1140
void setAllEnumCasesCovered()
Set a flag in the SwitchStmt indicating that if the 'switch (X)' is a switch over an enum value then ...
Definition Stmt.h:2655
void setSwitchCaseList(SwitchCase *SC)
Definition Stmt.h:2632
A convenient class for passing around template argument information.
void setLAngleLoc(SourceLocation Loc)
void setRAngleLoc(SourceLocation Loc)
void addArgument(const TemplateArgumentLoc &Loc)
Location wrapper for a TemplateArgument.
pack_iterator pack_begin() const
Iterator referencing the first argument of a template argument pack.
unsigned pack_size() const
The number of template arguments in the given template argument pack.
@ Pack
The template argument is actually a parameter pack.
ArgKind getKind() const
Return the kind of stored template argument.
A container of type source information.
Definition TypeBase.h:8249
A type trait used in the implementation of various C++11 and Library TR1 trait templates.
Definition ExprCXX.h:2896
unsigned getNumArgs() const
Determine the number of arguments to this type trait.
Definition ExprCXX.h:2958
static TypeTraitExpr * CreateDeserialized(const ASTContext &C, bool IsStoredAsBool, unsigned NumArgs)
Definition ExprCXX.cpp:1934
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand.
Definition Expr.h:2625
void setKind(UnaryExprOrTypeTrait K)
Definition Expr.h:2660
void setOperatorLoc(SourceLocation L)
Definition Expr.h:2699
void setRParenLoc(SourceLocation L)
Definition Expr.h:2702
UnaryOperator - This represents the unary-expression's (except sizeof and alignof),...
Definition Expr.h:2244
void setSubExpr(Expr *E)
Definition Expr.h:2286
void setOperatorLoc(SourceLocation L)
Definition Expr.h:2290
void setCanOverflow(bool C)
Definition Expr.h:2299
bool hasStoredFPFeatures() const
Is FPFeatures in Trailing Storage?
Definition Expr.h:2381
void setOpcode(Opcode Opc)
Definition Expr.h:2283
void setStoredFPFeatures(FPOptionsOverride F)
Set FPFeatures in trailing storage, used by Serialization & ASTImporter.
Definition Expr.h:2395
UnaryOperatorKind Opcode
Definition Expr.h:2258
static UnaryOperator * CreateEmpty(const ASTContext &C, bool hasFPFeatures)
Definition Expr.cpp:5017
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
Definition ExprCXX.h:3390
static UnresolvedLookupExpr * CreateEmpty(const ASTContext &Context, unsigned NumResults, bool HasTemplateKWAndArgsInfo, unsigned NumTemplateArgs)
Definition ExprCXX.cpp:467
Represents a C++ member access expression for which lookup produced a set of overloaded functions.
Definition ExprCXX.h:4126
static UnresolvedMemberExpr * CreateEmpty(const ASTContext &Context, unsigned NumResults, bool HasTemplateKWAndArgsInfo, unsigned NumTemplateArgs)
Definition ExprCXX.cpp:1671
void addDecl(NamedDecl *D)
A call to a literal operator (C++11 [over.literal]) written as a user-defined literal (C++11 [lit....
Definition ExprCXX.h:640
static UserDefinedLiteral * CreateEmpty(const ASTContext &Ctx, unsigned NumArgs, bool HasFPOptions, EmptyShell Empty)
Definition ExprCXX.cpp:984
Represents a call to the builtin function __builtin_va_arg.
Definition Expr.h:4891
void setRParenLoc(SourceLocation L)
Definition Expr.h:4922
void setIsMicrosoftABI(bool IsMS)
Definition Expr.h:4913
void setSubExpr(Expr *E)
Definition Expr.h:4909
void setBuiltinLoc(SourceLocation L)
Definition Expr.h:4919
void setWrittenTypeInfo(TypeSourceInfo *TI)
Definition Expr.h:4916
WhileStmt - This represents a 'while' stmt.
Definition Stmt.h:2687
void setCond(Expr *Cond)
Definition Stmt.h:2747
void setBody(Stmt *Body)
Definition Stmt.h:2754
void setLParenLoc(SourceLocation L)
Definition Stmt.h:2796
void setRParenLoc(SourceLocation L)
Definition Stmt.h:2798
void setWhileLoc(SourceLocation L)
Definition Stmt.h:2793
static WhileStmt * CreateEmpty(const ASTContext &Ctx, bool HasVar)
Create an empty while statement optionally with storage for a condition variable.
Definition Stmt.cpp:1202
void setConditionVariableDeclStmt(DeclStmt *CondVar)
Definition Stmt.h:2787
Information about a module that has been loaded by the ASTReader.
Definition ModuleFile.h:130
llvm::BitstreamCursor DeclsCursor
DeclsCursor - This is a cursor to the start of the DECLTYPES_BLOCK block.
Definition ModuleFile.h:442
#define bool
Definition gpuintrin.h:32
StmtCode
Record codes for each kind of statement or expression.
DesignatorTypes
The kinds of designators that can occur in a DesignatedInitExpr.
@ EXPR_DESIGNATED_INIT
A DesignatedInitExpr record.
@ EXPR_COMPOUND_LITERAL
A CompoundLiteralExpr record.
@ STMT_OMP_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE
@ EXPR_OBJC_IVAR_REF_EXPR
An ObjCIvarRefExpr record.
@ EXPR_MEMBER
A MemberExpr record.
@ EXPR_CXX_TEMPORARY_OBJECT
A CXXTemporaryObjectExpr record.
@ STMT_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE
@ EXPR_COMPOUND_ASSIGN_OPERATOR
A CompoundAssignOperator record.
@ EXPR_CXX_STATIC_CAST
A CXXStaticCastExpr record.
@ EXPR_OBJC_STRING_LITERAL
An ObjCStringLiteral record.
@ EXPR_VA_ARG
A VAArgExpr record.
@ EXPR_OBJC_ISA
An ObjCIsa Expr record.
@ EXPR_CXX_OPERATOR_CALL
A CXXOperatorCallExpr record.
@ STMT_OBJC_AT_TRY
An ObjCAtTryStmt record.
@ STMT_DO
A DoStmt record.
@ STMT_OBJC_CATCH
An ObjCAtCatchStmt record.
@ STMT_IF
An IfStmt record.
@ EXPR_STRING_LITERAL
A StringLiteral record.
@ EXPR_OBJC_AVAILABILITY_CHECK
An ObjCAvailabilityCheckExpr record.
@ STMT_OMP_PARALLEL_MASKED_TASKLOOP_DIRECTIVE
@ EXPR_MATRIX_SUBSCRIPT
An MatrixSubscriptExpr record.
@ EXPR_PSEUDO_OBJECT
A PseudoObjectExpr record.
@ STMT_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE
@ EXPR_IMPLICIT_CAST
An ImplicitCastExpr record.
@ STMT_CAPTURED
A CapturedStmt record.
@ STMT_OMP_TARGET_PARALLEL_FOR_SIMD_DIRECTIVE
@ STMT_GCCASM
A GCC-style AsmStmt record.
@ EXPR_IMAGINARY_LITERAL
An ImaginaryLiteral record.
@ STMT_WHILE
A WhileStmt record.
@ EXPR_CONVERT_VECTOR
A ConvertVectorExpr record.
@ EXPR_OBJC_SUBSCRIPT_REF_EXPR
An ObjCSubscriptRefExpr record.
@ EXPR_STMT
A StmtExpr record.
@ EXPR_CXX_REINTERPRET_CAST
A CXXReinterpretCastExpr record.
@ EXPR_DESIGNATED_INIT_UPDATE
A DesignatedInitUpdateExpr record.
@ STMT_OBJC_AT_SYNCHRONIZED
An ObjCAtSynchronizedStmt record.
@ STMT_OMP_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE
@ EXPR_BUILTIN_BIT_CAST
A BuiltinBitCastExpr record.
@ STMT_OMP_TARGET_TEAMS_DISTRIBUTE_SIMD_DIRECTIVE
@ STMT_SYCLKERNELCALL
A SYCLKernelCallStmt record.
@ EXPR_CHARACTER_LITERAL
A CharacterLiteral record.
@ EXPR_OBJC_ENCODE
An ObjCEncodeExpr record.
@ EXPR_CSTYLE_CAST
A CStyleCastExpr record.
@ EXPR_OBJC_BOOL_LITERAL
An ObjCBoolLiteralExpr record.
@ EXPR_EXT_VECTOR_ELEMENT
An ExtVectorElementExpr record.
@ EXPR_ATOMIC
An AtomicExpr record.
@ EXPR_OFFSETOF
An OffsetOfExpr record.
@ STMT_RETURN
A ReturnStmt record.
@ STMT_OBJC_FOR_COLLECTION
An ObjCForCollectionStmt record.
@ STMT_OMP_TARGET_TEAMS_DISTRIBUTE_DIRECTIVE
@ EXPR_ARRAY_INIT_LOOP
An ArrayInitLoopExpr record.
@ STMT_OMP_PARALLEL_MASTER_TASKLOOP_DIRECTIVE
@ STMT_OMP_PARALLEL_MASKED_TASKLOOP_SIMD_DIRECTIVE
@ STMT_CONTINUE
A ContinueStmt record.
@ EXPR_PREDEFINED
A PredefinedExpr record.
@ EXPR_CXX_BOOL_LITERAL
A CXXBoolLiteralExpr record.
@ EXPR_PAREN_LIST
A ParenListExpr record.
@ EXPR_CXX_PAREN_LIST_INIT
A CXXParenListInitExpr record.
@ STMT_COMPOUND
A CompoundStmt record.
@ STMT_FOR
A ForStmt record.
@ STMT_ATTRIBUTED
An AttributedStmt record.
@ STMT_OMP_TARGET_TEAMS_GENERIC_LOOP_DIRECTIVE
@ EXPR_CXX_REWRITTEN_BINARY_OPERATOR
A CXXRewrittenBinaryOperator record.
@ STMT_GOTO
A GotoStmt record.
@ EXPR_NO_INIT
An NoInitExpr record.
@ EXPR_OBJC_PROTOCOL_EXPR
An ObjCProtocolExpr record.
@ EXPR_ARRAY_INIT_INDEX
An ArrayInitIndexExpr record.
@ EXPR_CXX_CONSTRUCT
A CXXConstructExpr record.
@ STMT_OMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE
@ STMT_OMP_PARALLEL_MASTER_TASKLOOP_SIMD_DIRECTIVE
@ STMT_OMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE
@ EXPR_CXX_DYNAMIC_CAST
A CXXDynamicCastExpr record.
@ STMT_CXX_TRY
A CXXTryStmt record.
@ EXPR_GENERIC_SELECTION
A GenericSelectionExpr record.
@ EXPR_OBJC_INDIRECT_COPY_RESTORE
An ObjCIndirectCopyRestoreExpr record.
@ EXPR_CXX_INHERITED_CTOR_INIT
A CXXInheritedCtorInitExpr record.
@ EXPR_CALL
A CallExpr record.
@ EXPR_GNU_NULL
A GNUNullExpr record.
@ EXPR_OBJC_PROPERTY_REF_EXPR
An ObjCPropertyRefExpr record.
@ EXPR_CXX_CONST_CAST
A CXXConstCastExpr record.
@ STMT_REF_PTR
A reference to a previously [de]serialized Stmt record.
@ EXPR_OBJC_MESSAGE_EXPR
An ObjCMessageExpr record.
@ STMT_CASE
A CaseStmt record.
@ EXPR_CONSTANT
A constant expression context.
@ STMT_STOP
A marker record that indicates that we are at the end of an expression.
@ STMT_MSASM
A MS-style AsmStmt record.
@ EXPR_CONDITIONAL_OPERATOR
A ConditionOperator record.
@ EXPR_BINARY_OPERATOR
A BinaryOperator record.
@ EXPR_CXX_STD_INITIALIZER_LIST
A CXXStdInitializerListExpr record.
@ EXPR_SHUFFLE_VECTOR
A ShuffleVectorExpr record.
@ STMT_OBJC_FINALLY
An ObjCAtFinallyStmt record.
@ EXPR_OBJC_SELECTOR_EXPR
An ObjCSelectorExpr record.
@ EXPR_FLOATING_LITERAL
A FloatingLiteral record.
@ STMT_NULL_PTR
A NULL expression.
@ STMT_DEFAULT
A DefaultStmt record.
@ EXPR_CHOOSE
A ChooseExpr record.
@ STMT_NULL
A NullStmt record.
@ EXPR_DECL_REF
A DeclRefExpr record.
@ EXPR_INIT_LIST
An InitListExpr record.
@ EXPR_IMPLICIT_VALUE_INIT
An ImplicitValueInitExpr record.
@ STMT_OBJC_AUTORELEASE_POOL
An ObjCAutoreleasePoolStmt record.
@ EXPR_RECOVERY
A RecoveryExpr record.
@ EXPR_PAREN
A ParenExpr record.
@ STMT_OMP_TARGET_PARALLEL_GENERIC_LOOP_DIRECTIVE
@ STMT_LABEL
A LabelStmt record.
@ EXPR_CXX_FUNCTIONAL_CAST
A CXXFunctionalCastExpr record.
@ EXPR_USER_DEFINED_LITERAL
A UserDefinedLiteral record.
@ EXPR_INTEGER_LITERAL
An IntegerLiteral record.
@ EXPR_SOURCE_LOC
A SourceLocExpr record.
@ EXPR_CXX_MEMBER_CALL
A CXXMemberCallExpr record.
@ STMT_SWITCH
A SwitchStmt record.
@ STMT_DECL
A DeclStmt record.
@ EXPR_OBJC_KVC_REF_EXPR
UNUSED.
@ EXPR_SIZEOF_ALIGN_OF
A SizefAlignOfExpr record.
@ STMT_BREAK
A BreakStmt record.
@ STMT_OBJC_AT_THROW
An ObjCAtThrowStmt record.
@ EXPR_ADDR_LABEL
An AddrLabelExpr record.
@ STMT_CXX_FOR_RANGE
A CXXForRangeStmt record.
@ EXPR_CXX_ADDRSPACE_CAST
A CXXAddrspaceCastExpr record.
@ EXPR_ARRAY_SUBSCRIPT
An ArraySubscriptExpr record.
@ EXPR_UNARY_OPERATOR
A UnaryOperator record.
@ STMT_CXX_CATCH
A CXXCatchStmt record.
@ EXPR_BUILTIN_PP_EMBED
A EmbedExpr record.
@ STMT_INDIRECT_GOTO
An IndirectGotoStmt record.
@ DESIG_ARRAY_RANGE
GNU array range designator.
@ DESIG_FIELD_NAME
Field designator where only the field name is known.
@ DESIG_FIELD_DECL
Field designator where the field has been resolved to a declaration.
@ DESIG_ARRAY
Array designator.
The JSON file list parser is used to communicate input to InstallAPI.
ConstantResultStorageKind
Describes the kind of result that can be tail-allocated.
Definition Expr.h:1076
OpenACCDirectiveKind
ArrayTypeTrait
Names for the array type traits.
Definition TypeTraits.h:42
OpenACCAtomicKind
ExprDependenceScope::ExprDependence ExprDependence
IfStatementKind
In an if statement, this denotes whether the statement is a constexpr or consteval if statement.
Definition Specifiers.h:39
ExprObjectKind
A further classification of the kind of object referenced by an l-value or x-value.
Definition Specifiers.h:149
AccessSpecifier
A C++ access specifier (public, private, protected), plus the special value "none" which means differ...
Definition Specifiers.h:123
SmallVector< Attr *, 4 > AttrVec
AttrVec - A vector of Attr, which is how they are stored on the AST.
nullptr
This class represents a compute construct, representing a 'Kind' of ‘parallel’, 'serial',...
CapturedRegionKind
The different kinds of captured statement.
OpenACCComputeConstruct(OpenACCDirectiveKind K, SourceLocation Start, SourceLocation DirectiveLoc, SourceLocation End, ArrayRef< const OpenACCClause * > Clauses, Stmt *StructuredBlock)
UnaryExprOrTypeTrait
Names for the "expression or type" traits.
Definition TypeTraits.h:51
const FunctionProtoType * T
std::pair< SourceLocation, StringRef > ConstraintSubstitutionDiagnostic
Unsatisfied constraint expressions if the template arguments could be substituted into them,...
Definition ASTConcept.h:40
CastKind
CastKind - The kind of operation required for a conversion.
llvm::omp::Directive OpenMPDirectiveKind
OpenMP directives.
Definition OpenMPKinds.h:25
ExprValueKind
The categorization of expression values, currently following the C++11 scheme.
Definition Specifiers.h:132
U cast(CodeGen::Address addr)
Definition Address.h:327
@ Implicit
An implicit conversion.
Definition Sema.h:438
CharacterLiteralKind
Definition Expr.h:1603
unsigned long uint64_t
static ASTConstraintSatisfaction * Create(const ASTContext &C, const ConstraintSatisfaction &Satisfaction)
Represents an explicit template argument list in C++, e.g., the "<int>" in "sort<int>".
void initializeFrom(SourceLocation TemplateKWLoc, const TemplateArgumentListInfo &List, TemplateArgumentLoc *OutArgArray)
Expr * CounterUpdate
Updater for the internal counter: ++CounterVD;.
Definition ExprOpenMP.h:121
Expr * Upper
Normalized upper bound.
Definition ExprOpenMP.h:116
Expr * Update
Update expression for the originally specified iteration variable, calculated as VD = Begin + Counter...
Definition ExprOpenMP.h:119
VarDecl * CounterVD
Internal normalized counter.
Definition ExprOpenMP.h:113
A placeholder type used to construct an empty shell of a type, that will be filled in later (e....
Definition Stmt.h:1423