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