Bug Summary

File:clang/lib/Serialization/ASTReaderStmt.cpp
Warning:line 1105, column 16
Although the value stored to 'opc' is used in the enclosing expression, the value is never actually read from 'opc'

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-pc-linux-gnu -analyze -disable-free -disable-llvm-verifier -discard-value-names -main-file-name ASTReaderStmt.cpp -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=cplusplus -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -analyzer-config-compatibility-mode=true -mrelocation-model pic -pic-level 2 -mframe-pointer=none -relaxed-aliasing -fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -tune-cpu generic -fno-split-dwarf-inlining -debugger-tuning=gdb -ffunction-sections -fdata-sections -resource-dir /usr/lib/llvm-12/lib/clang/12.0.0 -D _DEBUG -D _GNU_SOURCE -D __STDC_CONSTANT_MACROS -D __STDC_FORMAT_MACROS -D __STDC_LIMIT_MACROS -I /build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/build-llvm/tools/clang/lib/Serialization -I /build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization -I /build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/include -I /build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/build-llvm/tools/clang/include -I /build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/build-llvm/include -I /build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/llvm/include -U NDEBUG -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/x86_64-linux-gnu/c++/6.3.0 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/x86_64-linux-gnu/c++/6.3.0 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0/backward -internal-isystem /usr/local/include -internal-isystem /usr/lib/llvm-12/lib/clang/12.0.0/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -Wno-unused-parameter -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long -Wno-maybe-uninitialized -Wno-comment -std=c++14 -fdeprecated-macro -fdebug-compilation-dir /build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/build-llvm/tools/clang/lib/Serialization -fdebug-prefix-map=/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d=. -ferror-limit 19 -fvisibility-inlines-hidden -stack-protector 2 -fgnuc-version=4.2.1 -vectorize-loops -vectorize-slp -analyzer-output=html -analyzer-config stable-report-filename=true -faddrsig -o /tmp/scan-build-2020-11-29-190409-37574-1 -x c++ /build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp
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
14#include "clang/AST/ASTConcept.h"
15#include "clang/AST/ASTContext.h"
16#include "clang/AST/AttrIterator.h"
17#include "clang/AST/Decl.h"
18#include "clang/AST/DeclAccessPair.h"
19#include "clang/AST/DeclCXX.h"
20#include "clang/AST/DeclGroup.h"
21#include "clang/AST/DeclObjC.h"
22#include "clang/AST/DeclTemplate.h"
23#include "clang/AST/DeclarationName.h"
24#include "clang/AST/DependenceFlags.h"
25#include "clang/AST/Expr.h"
26#include "clang/AST/ExprCXX.h"
27#include "clang/AST/ExprObjC.h"
28#include "clang/AST/ExprOpenMP.h"
29#include "clang/AST/NestedNameSpecifier.h"
30#include "clang/AST/OpenMPClause.h"
31#include "clang/AST/OperationKinds.h"
32#include "clang/AST/Stmt.h"
33#include "clang/AST/StmtCXX.h"
34#include "clang/AST/StmtObjC.h"
35#include "clang/AST/StmtOpenMP.h"
36#include "clang/AST/StmtVisitor.h"
37#include "clang/AST/TemplateBase.h"
38#include "clang/AST/Type.h"
39#include "clang/AST/UnresolvedSet.h"
40#include "clang/Basic/CapturedStmt.h"
41#include "clang/Basic/ExpressionTraits.h"
42#include "clang/Basic/LLVM.h"
43#include "clang/Basic/Lambda.h"
44#include "clang/Basic/LangOptions.h"
45#include "clang/Basic/OpenMPKinds.h"
46#include "clang/Basic/OperatorKinds.h"
47#include "clang/Basic/SourceLocation.h"
48#include "clang/Basic/Specifiers.h"
49#include "clang/Basic/TypeTraits.h"
50#include "clang/Lex/Token.h"
51#include "clang/Serialization/ASTBitCodes.h"
52#include "clang/Serialization/ASTRecordReader.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 <string>
65
66using namespace clang;
67using namespace serialization;
68
69namespace clang {
70
71 class ASTStmtReader : public StmtVisitor<ASTStmtReader> {
72 ASTRecordReader &Record;
73 llvm::BitstreamCursor &DeclsCursor;
74
75 SourceLocation readSourceLocation() {
76 return Record.readSourceLocation();
77 }
78
79 SourceRange readSourceRange() {
80 return Record.readSourceRange();
81 }
82
83 std::string readString() {
84 return Record.readString();
85 }
86
87 TypeSourceInfo *readTypeSourceInfo() {
88 return Record.readTypeSourceInfo();
89 }
90
91 Decl *readDecl() {
92 return Record.readDecl();
93 }
94
95 template<typename T>
96 T *readDeclAs() {
97 return Record.readDeclAs<T>();
98 }
99
100 public:
101 ASTStmtReader(ASTRecordReader &Record, llvm::BitstreamCursor &Cursor)
102 : Record(Record), DeclsCursor(Cursor) {}
103
104 /// The number of record fields required for the Stmt class
105 /// itself.
106 static const unsigned NumStmtFields = 0;
107
108 /// The number of record fields required for the Expr class
109 /// itself.
110 static const unsigned NumExprFields =
111 NumStmtFields + llvm::BitWidth<ExprDependence> + 3;
112
113 /// Read and initialize a ExplicitTemplateArgumentList structure.
114 void ReadTemplateKWAndArgsInfo(ASTTemplateKWAndArgsInfo &Args,
115 TemplateArgumentLoc *ArgsLocArray,
116 unsigned NumTemplateArgs);
117
118 /// Read and initialize a ExplicitTemplateArgumentList structure.
119 void ReadExplicitTemplateArgumentList(ASTTemplateArgumentListInfo &ArgList,
120 unsigned NumTemplateArgs);
121
122 void VisitStmt(Stmt *S);
123#define STMT(Type, Base) \
124 void Visit##Type(Type *);
125#include "clang/AST/StmtNodes.inc"
126 };
127
128} // namespace clang
129
130void ASTStmtReader::ReadTemplateKWAndArgsInfo(ASTTemplateKWAndArgsInfo &Args,
131 TemplateArgumentLoc *ArgsLocArray,
132 unsigned NumTemplateArgs) {
133 SourceLocation TemplateKWLoc = readSourceLocation();
134 TemplateArgumentListInfo ArgInfo;
135 ArgInfo.setLAngleLoc(readSourceLocation());
136 ArgInfo.setRAngleLoc(readSourceLocation());
137 for (unsigned i = 0; i != NumTemplateArgs; ++i)
138 ArgInfo.addArgument(Record.readTemplateArgumentLoc());
139 Args.initializeFrom(TemplateKWLoc, ArgInfo, ArgsLocArray);
140}
141
142void ASTStmtReader::VisitStmt(Stmt *S) {
143 assert(Record.getIdx() == NumStmtFields && "Incorrect statement field count")((Record.getIdx() == NumStmtFields && "Incorrect statement field count"
) ? static_cast<void> (0) : __assert_fail ("Record.getIdx() == NumStmtFields && \"Incorrect statement field count\""
, "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 143, __PRETTY_FUNCTION__))
;
144}
145
146void ASTStmtReader::VisitNullStmt(NullStmt *S) {
147 VisitStmt(S);
148 S->setSemiLoc(readSourceLocation());
149 S->NullStmtBits.HasLeadingEmptyMacro = Record.readInt();
150}
151
152void ASTStmtReader::VisitCompoundStmt(CompoundStmt *S) {
153 VisitStmt(S);
154 SmallVector<Stmt *, 16> Stmts;
155 unsigned NumStmts = Record.readInt();
156 while (NumStmts--)
157 Stmts.push_back(Record.readSubStmt());
158 S->setStmts(Stmts);
159 S->CompoundStmtBits.LBraceLoc = readSourceLocation();
160 S->RBraceLoc = readSourceLocation();
161}
162
163void ASTStmtReader::VisitSwitchCase(SwitchCase *S) {
164 VisitStmt(S);
165 Record.recordSwitchCaseID(S, Record.readInt());
166 S->setKeywordLoc(readSourceLocation());
167 S->setColonLoc(readSourceLocation());
168}
169
170void ASTStmtReader::VisitCaseStmt(CaseStmt *S) {
171 VisitSwitchCase(S);
172 bool CaseStmtIsGNURange = Record.readInt();
173 S->setLHS(Record.readSubExpr());
174 S->setSubStmt(Record.readSubStmt());
175 if (CaseStmtIsGNURange) {
176 S->setRHS(Record.readSubExpr());
177 S->setEllipsisLoc(readSourceLocation());
178 }
179}
180
181void ASTStmtReader::VisitDefaultStmt(DefaultStmt *S) {
182 VisitSwitchCase(S);
183 S->setSubStmt(Record.readSubStmt());
184}
185
186void ASTStmtReader::VisitLabelStmt(LabelStmt *S) {
187 VisitStmt(S);
188 auto *LD = readDeclAs<LabelDecl>();
189 LD->setStmt(S);
190 S->setDecl(LD);
191 S->setSubStmt(Record.readSubStmt());
192 S->setIdentLoc(readSourceLocation());
193}
194
195void ASTStmtReader::VisitAttributedStmt(AttributedStmt *S) {
196 VisitStmt(S);
197 // NumAttrs in AttributedStmt is set when creating an empty
198 // AttributedStmt in AttributedStmt::CreateEmpty, since it is needed
199 // to allocate the right amount of space for the trailing Attr *.
200 uint64_t NumAttrs = Record.readInt();
201 AttrVec Attrs;
202 Record.readAttributes(Attrs);
203 (void)NumAttrs;
204 assert(NumAttrs == S->AttributedStmtBits.NumAttrs)((NumAttrs == S->AttributedStmtBits.NumAttrs) ? static_cast
<void> (0) : __assert_fail ("NumAttrs == S->AttributedStmtBits.NumAttrs"
, "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 204, __PRETTY_FUNCTION__))
;
205 assert(NumAttrs == Attrs.size())((NumAttrs == Attrs.size()) ? static_cast<void> (0) : __assert_fail
("NumAttrs == Attrs.size()", "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 205, __PRETTY_FUNCTION__))
;
206 std::copy(Attrs.begin(), Attrs.end(), S->getAttrArrayPtr());
207 S->SubStmt = Record.readSubStmt();
208 S->AttributedStmtBits.AttrLoc = readSourceLocation();
209}
210
211void ASTStmtReader::VisitIfStmt(IfStmt *S) {
212 VisitStmt(S);
213
214 S->setConstexpr(Record.readInt());
215 bool HasElse = Record.readInt();
216 bool HasVar = Record.readInt();
217 bool HasInit = Record.readInt();
218
219 S->setCond(Record.readSubExpr());
220 S->setThen(Record.readSubStmt());
221 if (HasElse)
222 S->setElse(Record.readSubStmt());
223 if (HasVar)
224 S->setConditionVariable(Record.getContext(), readDeclAs<VarDecl>());
225 if (HasInit)
226 S->setInit(Record.readSubStmt());
227
228 S->setIfLoc(readSourceLocation());
229 S->setLParenLoc(readSourceLocation());
230 S->setRParenLoc(readSourceLocation());
231 if (HasElse)
232 S->setElseLoc(readSourceLocation());
233}
234
235void ASTStmtReader::VisitSwitchStmt(SwitchStmt *S) {
236 VisitStmt(S);
237
238 bool HasInit = Record.readInt();
239 bool HasVar = Record.readInt();
240 bool AllEnumCasesCovered = Record.readInt();
241 if (AllEnumCasesCovered)
242 S->setAllEnumCasesCovered();
243
244 S->setCond(Record.readSubExpr());
245 S->setBody(Record.readSubStmt());
246 if (HasInit)
247 S->setInit(Record.readSubStmt());
248 if (HasVar)
249 S->setConditionVariable(Record.getContext(), readDeclAs<VarDecl>());
250
251 S->setSwitchLoc(readSourceLocation());
252 S->setLParenLoc(readSourceLocation());
253 S->setRParenLoc(readSourceLocation());
254
255 SwitchCase *PrevSC = nullptr;
256 for (auto E = Record.size(); Record.getIdx() != E; ) {
257 SwitchCase *SC = Record.getSwitchCaseWithID(Record.readInt());
258 if (PrevSC)
259 PrevSC->setNextSwitchCase(SC);
260 else
261 S->setSwitchCaseList(SC);
262
263 PrevSC = SC;
264 }
265}
266
267void ASTStmtReader::VisitWhileStmt(WhileStmt *S) {
268 VisitStmt(S);
269
270 bool HasVar = Record.readInt();
271
272 S->setCond(Record.readSubExpr());
273 S->setBody(Record.readSubStmt());
274 if (HasVar)
275 S->setConditionVariable(Record.getContext(), readDeclAs<VarDecl>());
276
277 S->setWhileLoc(readSourceLocation());
278 S->setLParenLoc(readSourceLocation());
279 S->setRParenLoc(readSourceLocation());
280}
281
282void ASTStmtReader::VisitDoStmt(DoStmt *S) {
283 VisitStmt(S);
284 S->setCond(Record.readSubExpr());
285 S->setBody(Record.readSubStmt());
286 S->setDoLoc(readSourceLocation());
287 S->setWhileLoc(readSourceLocation());
288 S->setRParenLoc(readSourceLocation());
289}
290
291void ASTStmtReader::VisitForStmt(ForStmt *S) {
292 VisitStmt(S);
293 S->setInit(Record.readSubStmt());
294 S->setCond(Record.readSubExpr());
295 S->setConditionVariable(Record.getContext(), readDeclAs<VarDecl>());
296 S->setInc(Record.readSubExpr());
297 S->setBody(Record.readSubStmt());
298 S->setForLoc(readSourceLocation());
299 S->setLParenLoc(readSourceLocation());
300 S->setRParenLoc(readSourceLocation());
301}
302
303void ASTStmtReader::VisitGotoStmt(GotoStmt *S) {
304 VisitStmt(S);
305 S->setLabel(readDeclAs<LabelDecl>());
306 S->setGotoLoc(readSourceLocation());
307 S->setLabelLoc(readSourceLocation());
308}
309
310void ASTStmtReader::VisitIndirectGotoStmt(IndirectGotoStmt *S) {
311 VisitStmt(S);
312 S->setGotoLoc(readSourceLocation());
313 S->setStarLoc(readSourceLocation());
314 S->setTarget(Record.readSubExpr());
315}
316
317void ASTStmtReader::VisitContinueStmt(ContinueStmt *S) {
318 VisitStmt(S);
319 S->setContinueLoc(readSourceLocation());
320}
321
322void ASTStmtReader::VisitBreakStmt(BreakStmt *S) {
323 VisitStmt(S);
324 S->setBreakLoc(readSourceLocation());
325}
326
327void ASTStmtReader::VisitReturnStmt(ReturnStmt *S) {
328 VisitStmt(S);
329
330 bool HasNRVOCandidate = Record.readInt();
331
332 S->setRetValue(Record.readSubExpr());
333 if (HasNRVOCandidate)
334 S->setNRVOCandidate(readDeclAs<VarDecl>());
335
336 S->setReturnLoc(readSourceLocation());
337}
338
339void ASTStmtReader::VisitDeclStmt(DeclStmt *S) {
340 VisitStmt(S);
341 S->setStartLoc(readSourceLocation());
342 S->setEndLoc(readSourceLocation());
343
344 if (Record.size() - Record.getIdx() == 1) {
345 // Single declaration
346 S->setDeclGroup(DeclGroupRef(readDecl()));
347 } else {
348 SmallVector<Decl *, 16> Decls;
349 int N = Record.size() - Record.getIdx();
350 Decls.reserve(N);
351 for (int I = 0; I < N; ++I)
352 Decls.push_back(readDecl());
353 S->setDeclGroup(DeclGroupRef(DeclGroup::Create(Record.getContext(),
354 Decls.data(),
355 Decls.size())));
356 }
357}
358
359void ASTStmtReader::VisitAsmStmt(AsmStmt *S) {
360 VisitStmt(S);
361 S->NumOutputs = Record.readInt();
362 S->NumInputs = Record.readInt();
363 S->NumClobbers = Record.readInt();
364 S->setAsmLoc(readSourceLocation());
365 S->setVolatile(Record.readInt());
366 S->setSimple(Record.readInt());
367}
368
369void ASTStmtReader::VisitGCCAsmStmt(GCCAsmStmt *S) {
370 VisitAsmStmt(S);
371 S->NumLabels = Record.readInt();
372 S->setRParenLoc(readSourceLocation());
373 S->setAsmString(cast_or_null<StringLiteral>(Record.readSubStmt()));
374
375 unsigned NumOutputs = S->getNumOutputs();
376 unsigned NumInputs = S->getNumInputs();
377 unsigned NumClobbers = S->getNumClobbers();
378 unsigned NumLabels = S->getNumLabels();
379
380 // Outputs and inputs
381 SmallVector<IdentifierInfo *, 16> Names;
382 SmallVector<StringLiteral*, 16> Constraints;
383 SmallVector<Stmt*, 16> Exprs;
384 for (unsigned I = 0, N = NumOutputs + NumInputs; I != N; ++I) {
385 Names.push_back(Record.readIdentifier());
386 Constraints.push_back(cast_or_null<StringLiteral>(Record.readSubStmt()));
387 Exprs.push_back(Record.readSubStmt());
388 }
389
390 // Constraints
391 SmallVector<StringLiteral*, 16> Clobbers;
392 for (unsigned I = 0; I != NumClobbers; ++I)
393 Clobbers.push_back(cast_or_null<StringLiteral>(Record.readSubStmt()));
394
395 // Labels
396 for (unsigned I = 0, N = NumLabels; I != N; ++I)
397 Exprs.push_back(Record.readSubStmt());
398
399 S->setOutputsAndInputsAndClobbers(Record.getContext(),
400 Names.data(), Constraints.data(),
401 Exprs.data(), NumOutputs, NumInputs,
402 NumLabels,
403 Clobbers.data(), NumClobbers);
404}
405
406void ASTStmtReader::VisitMSAsmStmt(MSAsmStmt *S) {
407 VisitAsmStmt(S);
408 S->LBraceLoc = readSourceLocation();
409 S->EndLoc = readSourceLocation();
410 S->NumAsmToks = Record.readInt();
411 std::string AsmStr = readString();
412
413 // Read the tokens.
414 SmallVector<Token, 16> AsmToks;
415 AsmToks.reserve(S->NumAsmToks);
416 for (unsigned i = 0, e = S->NumAsmToks; i != e; ++i) {
417 AsmToks.push_back(Record.readToken());
418 }
419
420 // The calls to reserve() for the FooData vectors are mandatory to
421 // prevent dead StringRefs in the Foo vectors.
422
423 // Read the clobbers.
424 SmallVector<std::string, 16> ClobbersData;
425 SmallVector<StringRef, 16> Clobbers;
426 ClobbersData.reserve(S->NumClobbers);
427 Clobbers.reserve(S->NumClobbers);
428 for (unsigned i = 0, e = S->NumClobbers; i != e; ++i) {
429 ClobbersData.push_back(readString());
430 Clobbers.push_back(ClobbersData.back());
431 }
432
433 // Read the operands.
434 unsigned NumOperands = S->NumOutputs + S->NumInputs;
435 SmallVector<Expr*, 16> Exprs;
436 SmallVector<std::string, 16> ConstraintsData;
437 SmallVector<StringRef, 16> Constraints;
438 Exprs.reserve(NumOperands);
439 ConstraintsData.reserve(NumOperands);
440 Constraints.reserve(NumOperands);
441 for (unsigned i = 0; i != NumOperands; ++i) {
442 Exprs.push_back(cast<Expr>(Record.readSubStmt()));
443 ConstraintsData.push_back(readString());
444 Constraints.push_back(ConstraintsData.back());
445 }
446
447 S->initialize(Record.getContext(), AsmStr, AsmToks,
448 Constraints, Exprs, Clobbers);
449}
450
451void ASTStmtReader::VisitCoroutineBodyStmt(CoroutineBodyStmt *S) {
452 VisitStmt(S);
453 assert(Record.peekInt() == S->NumParams)((Record.peekInt() == S->NumParams) ? static_cast<void>
(0) : __assert_fail ("Record.peekInt() == S->NumParams", "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 453, __PRETTY_FUNCTION__))
;
454 Record.skipInts(1);
455 auto *StoredStmts = S->getStoredStmts();
456 for (unsigned i = 0;
457 i < CoroutineBodyStmt::SubStmt::FirstParamMove + S->NumParams; ++i)
458 StoredStmts[i] = Record.readSubStmt();
459}
460
461void ASTStmtReader::VisitCoreturnStmt(CoreturnStmt *S) {
462 VisitStmt(S);
463 S->CoreturnLoc = Record.readSourceLocation();
464 for (auto &SubStmt: S->SubStmts)
465 SubStmt = Record.readSubStmt();
466 S->IsImplicit = Record.readInt() != 0;
467}
468
469void ASTStmtReader::VisitCoawaitExpr(CoawaitExpr *E) {
470 VisitExpr(E);
471 E->KeywordLoc = readSourceLocation();
472 for (auto &SubExpr: E->SubExprs)
473 SubExpr = Record.readSubStmt();
474 E->OpaqueValue = cast_or_null<OpaqueValueExpr>(Record.readSubStmt());
475 E->setIsImplicit(Record.readInt() != 0);
476}
477
478void ASTStmtReader::VisitCoyieldExpr(CoyieldExpr *E) {
479 VisitExpr(E);
480 E->KeywordLoc = readSourceLocation();
481 for (auto &SubExpr: E->SubExprs)
482 SubExpr = Record.readSubStmt();
483 E->OpaqueValue = cast_or_null<OpaqueValueExpr>(Record.readSubStmt());
484}
485
486void ASTStmtReader::VisitDependentCoawaitExpr(DependentCoawaitExpr *E) {
487 VisitExpr(E);
488 E->KeywordLoc = readSourceLocation();
489 for (auto &SubExpr: E->SubExprs)
490 SubExpr = Record.readSubStmt();
491}
492
493void ASTStmtReader::VisitCapturedStmt(CapturedStmt *S) {
494 VisitStmt(S);
495 Record.skipInts(1);
496 S->setCapturedDecl(readDeclAs<CapturedDecl>());
497 S->setCapturedRegionKind(static_cast<CapturedRegionKind>(Record.readInt()));
498 S->setCapturedRecordDecl(readDeclAs<RecordDecl>());
499
500 // Capture inits
501 for (CapturedStmt::capture_init_iterator I = S->capture_init_begin(),
502 E = S->capture_init_end();
503 I != E; ++I)
504 *I = Record.readSubExpr();
505
506 // Body
507 S->setCapturedStmt(Record.readSubStmt());
508 S->getCapturedDecl()->setBody(S->getCapturedStmt());
509
510 // Captures
511 for (auto &I : S->captures()) {
512 I.VarAndKind.setPointer(readDeclAs<VarDecl>());
513 I.VarAndKind.setInt(
514 static_cast<CapturedStmt::VariableCaptureKind>(Record.readInt()));
515 I.Loc = readSourceLocation();
516 }
517}
518
519void ASTStmtReader::VisitExpr(Expr *E) {
520 VisitStmt(E);
521 E->setType(Record.readType());
522
523 // FIXME: write and read all DependentFlags with a single call.
524 bool TypeDependent = Record.readInt();
525 bool ValueDependent = Record.readInt();
526 bool InstantiationDependent = Record.readInt();
527 bool ContainsUnexpandedTemplateParameters = Record.readInt();
528 bool ContainsErrors = Record.readInt();
529 auto Deps = ExprDependence::None;
530 if (TypeDependent)
531 Deps |= ExprDependence::Type;
532 if (ValueDependent)
533 Deps |= ExprDependence::Value;
534 if (InstantiationDependent)
535 Deps |= ExprDependence::Instantiation;
536 if (ContainsUnexpandedTemplateParameters)
537 Deps |= ExprDependence::UnexpandedPack;
538 if (ContainsErrors)
539 Deps |= ExprDependence::Error;
540 E->setDependence(Deps);
541
542 E->setValueKind(static_cast<ExprValueKind>(Record.readInt()));
543 E->setObjectKind(static_cast<ExprObjectKind>(Record.readInt()));
544 assert(Record.getIdx() == NumExprFields &&((Record.getIdx() == NumExprFields && "Incorrect expression field count"
) ? static_cast<void> (0) : __assert_fail ("Record.getIdx() == NumExprFields && \"Incorrect expression field count\""
, "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 545, __PRETTY_FUNCTION__))
545 "Incorrect expression field count")((Record.getIdx() == NumExprFields && "Incorrect expression field count"
) ? static_cast<void> (0) : __assert_fail ("Record.getIdx() == NumExprFields && \"Incorrect expression field count\""
, "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 545, __PRETTY_FUNCTION__))
;
546}
547
548void ASTStmtReader::VisitConstantExpr(ConstantExpr *E) {
549 VisitExpr(E);
550
551 auto StorageKind = Record.readInt();
552 assert(E->ConstantExprBits.ResultKind == StorageKind && "Wrong ResultKind!")((E->ConstantExprBits.ResultKind == StorageKind &&
"Wrong ResultKind!") ? static_cast<void> (0) : __assert_fail
("E->ConstantExprBits.ResultKind == StorageKind && \"Wrong ResultKind!\""
, "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 552, __PRETTY_FUNCTION__))
;
553
554 E->ConstantExprBits.APValueKind = Record.readInt();
555 E->ConstantExprBits.IsUnsigned = Record.readInt();
556 E->ConstantExprBits.BitWidth = Record.readInt();
557 E->ConstantExprBits.HasCleanup = false; // Not serialized, see below.
558 E->ConstantExprBits.IsImmediateInvocation = Record.readInt();
559
560 switch (StorageKind) {
561 case ConstantExpr::RSK_None:
562 break;
563
564 case ConstantExpr::RSK_Int64:
565 E->Int64Result() = Record.readInt();
566 break;
567
568 case ConstantExpr::RSK_APValue:
569 E->APValueResult() = Record.readAPValue();
570 if (E->APValueResult().needsCleanup()) {
571 E->ConstantExprBits.HasCleanup = true;
572 Record.getContext().addDestruction(&E->APValueResult());
573 }
574 break;
575 default:
576 llvm_unreachable("unexpected ResultKind!")::llvm::llvm_unreachable_internal("unexpected ResultKind!", "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 576)
;
577 }
578
579 E->setSubExpr(Record.readSubExpr());
580}
581
582void ASTStmtReader::VisitPredefinedExpr(PredefinedExpr *E) {
583 VisitExpr(E);
584 bool HasFunctionName = Record.readInt();
585 E->PredefinedExprBits.HasFunctionName = HasFunctionName;
586 E->PredefinedExprBits.Kind = Record.readInt();
587 E->setLocation(readSourceLocation());
588 if (HasFunctionName)
589 E->setFunctionName(cast<StringLiteral>(Record.readSubExpr()));
590}
591
592void ASTStmtReader::VisitDeclRefExpr(DeclRefExpr *E) {
593 VisitExpr(E);
594
595 E->DeclRefExprBits.HasQualifier = Record.readInt();
596 E->DeclRefExprBits.HasFoundDecl = Record.readInt();
597 E->DeclRefExprBits.HasTemplateKWAndArgsInfo = Record.readInt();
598 E->DeclRefExprBits.HadMultipleCandidates = Record.readInt();
599 E->DeclRefExprBits.RefersToEnclosingVariableOrCapture = Record.readInt();
600 E->DeclRefExprBits.NonOdrUseReason = Record.readInt();
601 unsigned NumTemplateArgs = 0;
602 if (E->hasTemplateKWAndArgsInfo())
603 NumTemplateArgs = Record.readInt();
604
605 if (E->hasQualifier())
606 new (E->getTrailingObjects<NestedNameSpecifierLoc>())
607 NestedNameSpecifierLoc(Record.readNestedNameSpecifierLoc());
608
609 if (E->hasFoundDecl())
610 *E->getTrailingObjects<NamedDecl *>() = readDeclAs<NamedDecl>();
611
612 if (E->hasTemplateKWAndArgsInfo())
613 ReadTemplateKWAndArgsInfo(
614 *E->getTrailingObjects<ASTTemplateKWAndArgsInfo>(),
615 E->getTrailingObjects<TemplateArgumentLoc>(), NumTemplateArgs);
616
617 E->setDecl(readDeclAs<ValueDecl>());
618 E->setLocation(readSourceLocation());
619 E->DNLoc = Record.readDeclarationNameLoc(E->getDecl()->getDeclName());
620}
621
622void ASTStmtReader::VisitIntegerLiteral(IntegerLiteral *E) {
623 VisitExpr(E);
624 E->setLocation(readSourceLocation());
625 E->setValue(Record.getContext(), Record.readAPInt());
626}
627
628void ASTStmtReader::VisitFixedPointLiteral(FixedPointLiteral *E) {
629 VisitExpr(E);
630 E->setLocation(readSourceLocation());
631 E->setScale(Record.readInt());
632 E->setValue(Record.getContext(), Record.readAPInt());
633}
634
635void ASTStmtReader::VisitFloatingLiteral(FloatingLiteral *E) {
636 VisitExpr(E);
637 E->setRawSemantics(
638 static_cast<llvm::APFloatBase::Semantics>(Record.readInt()));
639 E->setExact(Record.readInt());
640 E->setValue(Record.getContext(), Record.readAPFloat(E->getSemantics()));
641 E->setLocation(readSourceLocation());
642}
643
644void ASTStmtReader::VisitImaginaryLiteral(ImaginaryLiteral *E) {
645 VisitExpr(E);
646 E->setSubExpr(Record.readSubExpr());
647}
648
649void ASTStmtReader::VisitStringLiteral(StringLiteral *E) {
650 VisitExpr(E);
651
652 // NumConcatenated, Length and CharByteWidth are set by the empty
653 // ctor since they are needed to allocate storage for the trailing objects.
654 unsigned NumConcatenated = Record.readInt();
655 unsigned Length = Record.readInt();
656 unsigned CharByteWidth = Record.readInt();
657 assert((NumConcatenated == E->getNumConcatenated()) &&(((NumConcatenated == E->getNumConcatenated()) && "Wrong number of concatenated tokens!"
) ? static_cast<void> (0) : __assert_fail ("(NumConcatenated == E->getNumConcatenated()) && \"Wrong number of concatenated tokens!\""
, "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 658, __PRETTY_FUNCTION__))
658 "Wrong number of concatenated tokens!")(((NumConcatenated == E->getNumConcatenated()) && "Wrong number of concatenated tokens!"
) ? static_cast<void> (0) : __assert_fail ("(NumConcatenated == E->getNumConcatenated()) && \"Wrong number of concatenated tokens!\""
, "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 658, __PRETTY_FUNCTION__))
;
659 assert((Length == E->getLength()) && "Wrong Length!")(((Length == E->getLength()) && "Wrong Length!") ?
static_cast<void> (0) : __assert_fail ("(Length == E->getLength()) && \"Wrong Length!\""
, "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 659, __PRETTY_FUNCTION__))
;
660 assert((CharByteWidth == E->getCharByteWidth()) && "Wrong character width!")(((CharByteWidth == E->getCharByteWidth()) && "Wrong character width!"
) ? static_cast<void> (0) : __assert_fail ("(CharByteWidth == E->getCharByteWidth()) && \"Wrong character width!\""
, "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 660, __PRETTY_FUNCTION__))
;
661 E->StringLiteralBits.Kind = Record.readInt();
662 E->StringLiteralBits.IsPascal = Record.readInt();
663
664 // The character width is originally computed via mapCharByteWidth.
665 // Check that the deserialized character width is consistant with the result
666 // of calling mapCharByteWidth.
667 assert((CharByteWidth ==(((CharByteWidth == StringLiteral::mapCharByteWidth(Record.getContext
().getTargetInfo(), E->getKind())) && "Wrong character width!"
) ? static_cast<void> (0) : __assert_fail ("(CharByteWidth == StringLiteral::mapCharByteWidth(Record.getContext().getTargetInfo(), E->getKind())) && \"Wrong character width!\""
, "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 670, __PRETTY_FUNCTION__))
668 StringLiteral::mapCharByteWidth(Record.getContext().getTargetInfo(),(((CharByteWidth == StringLiteral::mapCharByteWidth(Record.getContext
().getTargetInfo(), E->getKind())) && "Wrong character width!"
) ? static_cast<void> (0) : __assert_fail ("(CharByteWidth == StringLiteral::mapCharByteWidth(Record.getContext().getTargetInfo(), E->getKind())) && \"Wrong character width!\""
, "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 670, __PRETTY_FUNCTION__))
669 E->getKind())) &&(((CharByteWidth == StringLiteral::mapCharByteWidth(Record.getContext
().getTargetInfo(), E->getKind())) && "Wrong character width!"
) ? static_cast<void> (0) : __assert_fail ("(CharByteWidth == StringLiteral::mapCharByteWidth(Record.getContext().getTargetInfo(), E->getKind())) && \"Wrong character width!\""
, "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 670, __PRETTY_FUNCTION__))
670 "Wrong character width!")(((CharByteWidth == StringLiteral::mapCharByteWidth(Record.getContext
().getTargetInfo(), E->getKind())) && "Wrong character width!"
) ? static_cast<void> (0) : __assert_fail ("(CharByteWidth == StringLiteral::mapCharByteWidth(Record.getContext().getTargetInfo(), E->getKind())) && \"Wrong character width!\""
, "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 670, __PRETTY_FUNCTION__))
;
671
672 // Deserialize the trailing array of SourceLocation.
673 for (unsigned I = 0; I < NumConcatenated; ++I)
674 E->setStrTokenLoc(I, readSourceLocation());
675
676 // Deserialize the trailing array of char holding the string data.
677 char *StrData = E->getStrDataAsChar();
678 for (unsigned I = 0; I < Length * CharByteWidth; ++I)
679 StrData[I] = Record.readInt();
680}
681
682void ASTStmtReader::VisitCharacterLiteral(CharacterLiteral *E) {
683 VisitExpr(E);
684 E->setValue(Record.readInt());
685 E->setLocation(readSourceLocation());
686 E->setKind(static_cast<CharacterLiteral::CharacterKind>(Record.readInt()));
687}
688
689void ASTStmtReader::VisitParenExpr(ParenExpr *E) {
690 VisitExpr(E);
691 E->setLParen(readSourceLocation());
692 E->setRParen(readSourceLocation());
693 E->setSubExpr(Record.readSubExpr());
694}
695
696void ASTStmtReader::VisitParenListExpr(ParenListExpr *E) {
697 VisitExpr(E);
698 unsigned NumExprs = Record.readInt();
699 assert((NumExprs == E->getNumExprs()) && "Wrong NumExprs!")(((NumExprs == E->getNumExprs()) && "Wrong NumExprs!"
) ? static_cast<void> (0) : __assert_fail ("(NumExprs == E->getNumExprs()) && \"Wrong NumExprs!\""
, "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 699, __PRETTY_FUNCTION__))
;
700 for (unsigned I = 0; I != NumExprs; ++I)
701 E->getTrailingObjects<Stmt *>()[I] = Record.readSubStmt();
702 E->LParenLoc = readSourceLocation();
703 E->RParenLoc = readSourceLocation();
704}
705
706void ASTStmtReader::VisitUnaryOperator(UnaryOperator *E) {
707 VisitExpr(E);
708 bool hasFP_Features = Record.readInt();
709 assert(hasFP_Features == E->hasStoredFPFeatures())((hasFP_Features == E->hasStoredFPFeatures()) ? static_cast
<void> (0) : __assert_fail ("hasFP_Features == E->hasStoredFPFeatures()"
, "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 709, __PRETTY_FUNCTION__))
;
710 E->setSubExpr(Record.readSubExpr());
711 E->setOpcode((UnaryOperator::Opcode)Record.readInt());
712 E->setOperatorLoc(readSourceLocation());
713 E->setCanOverflow(Record.readInt());
714 if (hasFP_Features)
715 E->setStoredFPFeatures(
716 FPOptionsOverride::getFromOpaqueInt(Record.readInt()));
717}
718
719void ASTStmtReader::VisitOffsetOfExpr(OffsetOfExpr *E) {
720 VisitExpr(E);
721 assert(E->getNumComponents() == Record.peekInt())((E->getNumComponents() == Record.peekInt()) ? static_cast
<void> (0) : __assert_fail ("E->getNumComponents() == Record.peekInt()"
, "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 721, __PRETTY_FUNCTION__))
;
722 Record.skipInts(1);
723 assert(E->getNumExpressions() == Record.peekInt())((E->getNumExpressions() == Record.peekInt()) ? static_cast
<void> (0) : __assert_fail ("E->getNumExpressions() == Record.peekInt()"
, "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 723, __PRETTY_FUNCTION__))
;
724 Record.skipInts(1);
725 E->setOperatorLoc(readSourceLocation());
726 E->setRParenLoc(readSourceLocation());
727 E->setTypeSourceInfo(readTypeSourceInfo());
728 for (unsigned I = 0, N = E->getNumComponents(); I != N; ++I) {
729 auto Kind = static_cast<OffsetOfNode::Kind>(Record.readInt());
730 SourceLocation Start = readSourceLocation();
731 SourceLocation End = readSourceLocation();
732 switch (Kind) {
733 case OffsetOfNode::Array:
734 E->setComponent(I, OffsetOfNode(Start, Record.readInt(), End));
735 break;
736
737 case OffsetOfNode::Field:
738 E->setComponent(
739 I, OffsetOfNode(Start, readDeclAs<FieldDecl>(), End));
740 break;
741
742 case OffsetOfNode::Identifier:
743 E->setComponent(
744 I,
745 OffsetOfNode(Start, Record.readIdentifier(), End));
746 break;
747
748 case OffsetOfNode::Base: {
749 auto *Base = new (Record.getContext()) CXXBaseSpecifier();
750 *Base = Record.readCXXBaseSpecifier();
751 E->setComponent(I, OffsetOfNode(Base));
752 break;
753 }
754 }
755 }
756
757 for (unsigned I = 0, N = E->getNumExpressions(); I != N; ++I)
758 E->setIndexExpr(I, Record.readSubExpr());
759}
760
761void ASTStmtReader::VisitUnaryExprOrTypeTraitExpr(UnaryExprOrTypeTraitExpr *E) {
762 VisitExpr(E);
763 E->setKind(static_cast<UnaryExprOrTypeTrait>(Record.readInt()));
764 if (Record.peekInt() == 0) {
765 E->setArgument(Record.readSubExpr());
766 Record.skipInts(1);
767 } else {
768 E->setArgument(readTypeSourceInfo());
769 }
770 E->setOperatorLoc(readSourceLocation());
771 E->setRParenLoc(readSourceLocation());
772}
773
774static ConstraintSatisfaction
775readConstraintSatisfaction(ASTRecordReader &Record) {
776 ConstraintSatisfaction Satisfaction;
777 Satisfaction.IsSatisfied = Record.readInt();
778 if (!Satisfaction.IsSatisfied) {
779 unsigned NumDetailRecords = Record.readInt();
780 for (unsigned i = 0; i != NumDetailRecords; ++i) {
781 Expr *ConstraintExpr = Record.readExpr();
782 if (/* IsDiagnostic */Record.readInt()) {
783 SourceLocation DiagLocation = Record.readSourceLocation();
784 std::string DiagMessage = Record.readString();
785 Satisfaction.Details.emplace_back(
786 ConstraintExpr, new (Record.getContext())
787 ConstraintSatisfaction::SubstitutionDiagnostic{
788 DiagLocation, DiagMessage});
789 } else
790 Satisfaction.Details.emplace_back(ConstraintExpr, Record.readExpr());
791 }
792 }
793 return Satisfaction;
794}
795
796void ASTStmtReader::VisitConceptSpecializationExpr(
797 ConceptSpecializationExpr *E) {
798 VisitExpr(E);
799 unsigned NumTemplateArgs = Record.readInt();
800 E->NestedNameSpec = Record.readNestedNameSpecifierLoc();
801 E->TemplateKWLoc = Record.readSourceLocation();
802 E->ConceptName = Record.readDeclarationNameInfo();
803 E->NamedConcept = readDeclAs<ConceptDecl>();
804 E->FoundDecl = Record.readDeclAs<NamedDecl>();
805 E->ArgsAsWritten = Record.readASTTemplateArgumentListInfo();
806 llvm::SmallVector<TemplateArgument, 4> Args;
807 for (unsigned I = 0; I < NumTemplateArgs; ++I)
808 Args.push_back(Record.readTemplateArgument());
809 E->setTemplateArguments(Args);
810 E->Satisfaction = E->isValueDependent() ? nullptr :
811 ASTConstraintSatisfaction::Create(Record.getContext(),
812 readConstraintSatisfaction(Record));
813}
814
815static concepts::Requirement::SubstitutionDiagnostic *
816readSubstitutionDiagnostic(ASTRecordReader &Record) {
817 std::string SubstitutedEntity = Record.readString();
818 SourceLocation DiagLoc = Record.readSourceLocation();
819 std::string DiagMessage = Record.readString();
820 return new (Record.getContext())
821 concepts::Requirement::SubstitutionDiagnostic{SubstitutedEntity, DiagLoc,
822 DiagMessage};
823}
824
825void ASTStmtReader::VisitRequiresExpr(RequiresExpr *E) {
826 VisitExpr(E);
827 unsigned NumLocalParameters = Record.readInt();
828 unsigned NumRequirements = Record.readInt();
829 E->RequiresExprBits.RequiresKWLoc = Record.readSourceLocation();
830 E->RequiresExprBits.IsSatisfied = Record.readInt();
831 E->Body = Record.readDeclAs<RequiresExprBodyDecl>();
832 llvm::SmallVector<ParmVarDecl *, 4> LocalParameters;
833 for (unsigned i = 0; i < NumLocalParameters; ++i)
834 LocalParameters.push_back(cast<ParmVarDecl>(Record.readDecl()));
835 std::copy(LocalParameters.begin(), LocalParameters.end(),
836 E->getTrailingObjects<ParmVarDecl *>());
837 llvm::SmallVector<concepts::Requirement *, 4> Requirements;
838 for (unsigned i = 0; i < NumRequirements; ++i) {
839 auto RK =
840 static_cast<concepts::Requirement::RequirementKind>(Record.readInt());
841 concepts::Requirement *R = nullptr;
842 switch (RK) {
843 case concepts::Requirement::RK_Type: {
844 auto Status =
845 static_cast<concepts::TypeRequirement::SatisfactionStatus>(
846 Record.readInt());
847 if (Status == concepts::TypeRequirement::SS_SubstitutionFailure)
848 R = new (Record.getContext())
849 concepts::TypeRequirement(readSubstitutionDiagnostic(Record));
850 else
851 R = new (Record.getContext())
852 concepts::TypeRequirement(Record.readTypeSourceInfo());
853 } break;
854 case concepts::Requirement::RK_Simple:
855 case concepts::Requirement::RK_Compound: {
856 auto Status =
857 static_cast<concepts::ExprRequirement::SatisfactionStatus>(
858 Record.readInt());
859 llvm::PointerUnion<concepts::Requirement::SubstitutionDiagnostic *,
860 Expr *> E;
861 if (Status == concepts::ExprRequirement::SS_ExprSubstitutionFailure) {
862 E = readSubstitutionDiagnostic(Record);
863 } else
864 E = Record.readExpr();
865
866 llvm::Optional<concepts::ExprRequirement::ReturnTypeRequirement> Req;
867 ConceptSpecializationExpr *SubstitutedConstraintExpr = nullptr;
868 SourceLocation NoexceptLoc;
869 if (RK == concepts::Requirement::RK_Simple) {
870 Req.emplace();
871 } else {
872 NoexceptLoc = Record.readSourceLocation();
873 switch (/* returnTypeRequirementKind */Record.readInt()) {
874 case 0:
875 // No return type requirement.
876 Req.emplace();
877 break;
878 case 1: {
879 // type-constraint
880 TemplateParameterList *TPL = Record.readTemplateParameterList();
881 if (Status >=
882 concepts::ExprRequirement::SS_ConstraintsNotSatisfied)
883 SubstitutedConstraintExpr =
884 cast<ConceptSpecializationExpr>(Record.readExpr());
885 Req.emplace(TPL);
886 } break;
887 case 2:
888 // Substitution failure
889 Req.emplace(readSubstitutionDiagnostic(Record));
890 break;
891 }
892 }
893 if (Expr *Ex = E.dyn_cast<Expr *>())
894 R = new (Record.getContext()) concepts::ExprRequirement(
895 Ex, RK == concepts::Requirement::RK_Simple, NoexceptLoc,
896 std::move(*Req), Status, SubstitutedConstraintExpr);
897 else
898 R = new (Record.getContext()) concepts::ExprRequirement(
899 E.get<concepts::Requirement::SubstitutionDiagnostic *>(),
900 RK == concepts::Requirement::RK_Simple, NoexceptLoc,
901 std::move(*Req));
902 } break;
903 case concepts::Requirement::RK_Nested: {
904 if (/* IsSubstitutionDiagnostic */Record.readInt()) {
905 R = new (Record.getContext()) concepts::NestedRequirement(
906 readSubstitutionDiagnostic(Record));
907 break;
908 }
909 Expr *E = Record.readExpr();
910 if (E->isInstantiationDependent())
911 R = new (Record.getContext()) concepts::NestedRequirement(E);
912 else
913 R = new (Record.getContext())
914 concepts::NestedRequirement(Record.getContext(), E,
915 readConstraintSatisfaction(Record));
916 } break;
917 }
918 if (!R)
919 continue;
920 Requirements.push_back(R);
921 }
922 std::copy(Requirements.begin(), Requirements.end(),
923 E->getTrailingObjects<concepts::Requirement *>());
924 E->RBraceLoc = Record.readSourceLocation();
925}
926
927void ASTStmtReader::VisitArraySubscriptExpr(ArraySubscriptExpr *E) {
928 VisitExpr(E);
929 E->setLHS(Record.readSubExpr());
930 E->setRHS(Record.readSubExpr());
931 E->setRBracketLoc(readSourceLocation());
932}
933
934void ASTStmtReader::VisitMatrixSubscriptExpr(MatrixSubscriptExpr *E) {
935 VisitExpr(E);
936 E->setBase(Record.readSubExpr());
937 E->setRowIdx(Record.readSubExpr());
938 E->setColumnIdx(Record.readSubExpr());
939 E->setRBracketLoc(readSourceLocation());
940}
941
942void ASTStmtReader::VisitOMPArraySectionExpr(OMPArraySectionExpr *E) {
943 VisitExpr(E);
944 E->setBase(Record.readSubExpr());
945 E->setLowerBound(Record.readSubExpr());
946 E->setLength(Record.readSubExpr());
947 E->setStride(Record.readSubExpr());
948 E->setColonLocFirst(readSourceLocation());
949 E->setColonLocSecond(readSourceLocation());
950 E->setRBracketLoc(readSourceLocation());
951}
952
953void ASTStmtReader::VisitOMPArrayShapingExpr(OMPArrayShapingExpr *E) {
954 VisitExpr(E);
955 unsigned NumDims = Record.readInt();
956 E->setBase(Record.readSubExpr());
957 SmallVector<Expr *, 4> Dims(NumDims);
958 for (unsigned I = 0; I < NumDims; ++I)
959 Dims[I] = Record.readSubExpr();
960 E->setDimensions(Dims);
961 SmallVector<SourceRange, 4> SRs(NumDims);
962 for (unsigned I = 0; I < NumDims; ++I)
963 SRs[I] = readSourceRange();
964 E->setBracketsRanges(SRs);
965 E->setLParenLoc(readSourceLocation());
966 E->setRParenLoc(readSourceLocation());
967}
968
969void ASTStmtReader::VisitOMPIteratorExpr(OMPIteratorExpr *E) {
970 VisitExpr(E);
971 unsigned NumIters = Record.readInt();
972 E->setIteratorKwLoc(readSourceLocation());
973 E->setLParenLoc(readSourceLocation());
974 E->setRParenLoc(readSourceLocation());
975 for (unsigned I = 0; I < NumIters; ++I) {
976 E->setIteratorDeclaration(I, Record.readDeclRef());
977 E->setAssignmentLoc(I, readSourceLocation());
978 Expr *Begin = Record.readSubExpr();
979 Expr *End = Record.readSubExpr();
980 Expr *Step = Record.readSubExpr();
981 SourceLocation ColonLoc = readSourceLocation();
982 SourceLocation SecColonLoc;
983 if (Step)
984 SecColonLoc = readSourceLocation();
985 E->setIteratorRange(I, Begin, ColonLoc, End, SecColonLoc, Step);
986 // Deserialize helpers
987 OMPIteratorHelperData HD;
988 HD.CounterVD = cast_or_null<VarDecl>(Record.readDeclRef());
989 HD.Upper = Record.readSubExpr();
990 HD.Update = Record.readSubExpr();
991 HD.CounterUpdate = Record.readSubExpr();
992 E->setHelper(I, HD);
993 }
994}
995
996void ASTStmtReader::VisitCallExpr(CallExpr *E) {
997 VisitExpr(E);
998 unsigned NumArgs = Record.readInt();
999 bool HasFPFeatures = Record.readInt();
1000 assert((NumArgs == E->getNumArgs()) && "Wrong NumArgs!")(((NumArgs == E->getNumArgs()) && "Wrong NumArgs!"
) ? static_cast<void> (0) : __assert_fail ("(NumArgs == E->getNumArgs()) && \"Wrong NumArgs!\""
, "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 1000, __PRETTY_FUNCTION__))
;
1001 E->setRParenLoc(readSourceLocation());
1002 E->setCallee(Record.readSubExpr());
1003 for (unsigned I = 0; I != NumArgs; ++I)
1004 E->setArg(I, Record.readSubExpr());
1005 E->setADLCallKind(static_cast<CallExpr::ADLCallKind>(Record.readInt()));
1006 if (HasFPFeatures)
1007 E->setStoredFPFeatures(
1008 FPOptionsOverride::getFromOpaqueInt(Record.readInt()));
1009}
1010
1011void ASTStmtReader::VisitCXXMemberCallExpr(CXXMemberCallExpr *E) {
1012 VisitCallExpr(E);
1013}
1014
1015void ASTStmtReader::VisitMemberExpr(MemberExpr *E) {
1016 VisitExpr(E);
1017
1018 bool HasQualifier = Record.readInt();
1019 bool HasFoundDecl = Record.readInt();
1020 bool HasTemplateInfo = Record.readInt();
1021 unsigned NumTemplateArgs = Record.readInt();
1022
1023 E->Base = Record.readSubExpr();
1024 E->MemberDecl = Record.readDeclAs<ValueDecl>();
1025 E->MemberDNLoc = Record.readDeclarationNameLoc(E->MemberDecl->getDeclName());
1026 E->MemberLoc = Record.readSourceLocation();
1027 E->MemberExprBits.IsArrow = Record.readInt();
1028 E->MemberExprBits.HasQualifierOrFoundDecl = HasQualifier || HasFoundDecl;
1029 E->MemberExprBits.HasTemplateKWAndArgsInfo = HasTemplateInfo;
1030 E->MemberExprBits.HadMultipleCandidates = Record.readInt();
1031 E->MemberExprBits.NonOdrUseReason = Record.readInt();
1032 E->MemberExprBits.OperatorLoc = Record.readSourceLocation();
1033
1034 if (HasQualifier || HasFoundDecl) {
1035 DeclAccessPair FoundDecl;
1036 if (HasFoundDecl) {
1037 auto *FoundD = Record.readDeclAs<NamedDecl>();
1038 auto AS = (AccessSpecifier)Record.readInt();
1039 FoundDecl = DeclAccessPair::make(FoundD, AS);
1040 } else {
1041 FoundDecl = DeclAccessPair::make(E->MemberDecl,
1042 E->MemberDecl->getAccess());
1043 }
1044 E->getTrailingObjects<MemberExprNameQualifier>()->FoundDecl = FoundDecl;
1045
1046 NestedNameSpecifierLoc QualifierLoc;
1047 if (HasQualifier)
1048 QualifierLoc = Record.readNestedNameSpecifierLoc();
1049 E->getTrailingObjects<MemberExprNameQualifier>()->QualifierLoc =
1050 QualifierLoc;
1051 }
1052
1053 if (HasTemplateInfo)
1054 ReadTemplateKWAndArgsInfo(
1055 *E->getTrailingObjects<ASTTemplateKWAndArgsInfo>(),
1056 E->getTrailingObjects<TemplateArgumentLoc>(), NumTemplateArgs);
1057}
1058
1059void ASTStmtReader::VisitObjCIsaExpr(ObjCIsaExpr *E) {
1060 VisitExpr(E);
1061 E->setBase(Record.readSubExpr());
1062 E->setIsaMemberLoc(readSourceLocation());
1063 E->setOpLoc(readSourceLocation());
1064 E->setArrow(Record.readInt());
1065}
1066
1067void ASTStmtReader::
1068VisitObjCIndirectCopyRestoreExpr(ObjCIndirectCopyRestoreExpr *E) {
1069 VisitExpr(E);
1070 E->Operand = Record.readSubExpr();
1071 E->setShouldCopy(Record.readInt());
1072}
1073
1074void ASTStmtReader::VisitObjCBridgedCastExpr(ObjCBridgedCastExpr *E) {
1075 VisitExplicitCastExpr(E);
1076 E->LParenLoc = readSourceLocation();
1077 E->BridgeKeywordLoc = readSourceLocation();
1078 E->Kind = Record.readInt();
1079}
1080
1081void ASTStmtReader::VisitCastExpr(CastExpr *E) {
1082 VisitExpr(E);
1083 unsigned NumBaseSpecs = Record.readInt();
1084 assert(NumBaseSpecs == E->path_size())((NumBaseSpecs == E->path_size()) ? static_cast<void>
(0) : __assert_fail ("NumBaseSpecs == E->path_size()", "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 1084, __PRETTY_FUNCTION__))
;
1085 unsigned HasFPFeatures = Record.readInt();
1086 assert(E->hasStoredFPFeatures() == HasFPFeatures)((E->hasStoredFPFeatures() == HasFPFeatures) ? static_cast
<void> (0) : __assert_fail ("E->hasStoredFPFeatures() == HasFPFeatures"
, "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 1086, __PRETTY_FUNCTION__))
;
1087 E->setSubExpr(Record.readSubExpr());
1088 E->setCastKind((CastKind)Record.readInt());
1089 CastExpr::path_iterator BaseI = E->path_begin();
1090 while (NumBaseSpecs--) {
1091 auto *BaseSpec = new (Record.getContext()) CXXBaseSpecifier;
1092 *BaseSpec = Record.readCXXBaseSpecifier();
1093 *BaseI++ = BaseSpec;
1094 }
1095 if (HasFPFeatures)
1096 *E->getTrailingFPFeatures() =
1097 FPOptionsOverride::getFromOpaqueInt(Record.readInt());
1098}
1099
1100void ASTStmtReader::VisitBinaryOperator(BinaryOperator *E) {
1101 bool hasFP_Features;
1102 BinaryOperator::Opcode opc;
1103 VisitExpr(E);
1104 E->setHasStoredFPFeatures(hasFP_Features = Record.readInt());
1105 E->setOpcode(opc = (BinaryOperator::Opcode)Record.readInt());
Although the value stored to 'opc' is used in the enclosing expression, the value is never actually read from 'opc'
1106 E->setLHS(Record.readSubExpr());
1107 E->setRHS(Record.readSubExpr());
1108 E->setOperatorLoc(readSourceLocation());
1109 if (hasFP_Features)
1110 E->setStoredFPFeatures(
1111 FPOptionsOverride::getFromOpaqueInt(Record.readInt()));
1112}
1113
1114void ASTStmtReader::VisitCompoundAssignOperator(CompoundAssignOperator *E) {
1115 VisitBinaryOperator(E);
1116 E->setComputationLHSType(Record.readType());
1117 E->setComputationResultType(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) {
1200 using Designator = DesignatedInitExpr::Designator;
1201
1202 VisitExpr(E);
1203 unsigned NumSubExprs = Record.readInt();
1204 assert(NumSubExprs == E->getNumSubExprs() && "Wrong number of subexprs")((NumSubExprs == E->getNumSubExprs() && "Wrong number of subexprs"
) ? static_cast<void> (0) : __assert_fail ("NumSubExprs == E->getNumSubExprs() && \"Wrong number of subexprs\""
, "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 1204, __PRETTY_FUNCTION__))
;
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(Field->getIdentifier(), DotLoc,
1218 FieldLoc));
1219 Designators.back().setField(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(Name, DotLoc, FieldLoc));
1228 break;
1229 }
1230
1231 case DESIG_ARRAY: {
1232 unsigned Index = Record.readInt();
1233 SourceLocation LBracketLoc = readSourceLocation();
1234 SourceLocation RBracketLoc = readSourceLocation();
1235 Designators.push_back(Designator(Index, LBracketLoc, RBracketLoc));
1236 break;
1237 }
1238
1239 case DESIG_ARRAY_RANGE: {
1240 unsigned Index = Record.readInt();
1241 SourceLocation LBracketLoc = readSourceLocation();
1242 SourceLocation EllipsisLoc = readSourceLocation();
1243 SourceLocation RBracketLoc = readSourceLocation();
1244 Designators.push_back(Designator(Index, LBracketLoc, EllipsisLoc,
1245 RBracketLoc));
1246 break;
1247 }
1248 }
1249 }
1250 E->setDesignators(Record.getContext(),
1251 Designators.data(), Designators.size());
1252}
1253
1254void ASTStmtReader::VisitDesignatedInitUpdateExpr(DesignatedInitUpdateExpr *E) {
1255 VisitExpr(E);
1256 E->setBase(Record.readSubExpr());
1257 E->setUpdater(Record.readSubExpr());
1258}
1259
1260void ASTStmtReader::VisitNoInitExpr(NoInitExpr *E) {
1261 VisitExpr(E);
1262}
1263
1264void ASTStmtReader::VisitArrayInitLoopExpr(ArrayInitLoopExpr *E) {
1265 VisitExpr(E);
1266 E->SubExprs[0] = Record.readSubExpr();
1267 E->SubExprs[1] = Record.readSubExpr();
1268}
1269
1270void ASTStmtReader::VisitArrayInitIndexExpr(ArrayInitIndexExpr *E) {
1271 VisitExpr(E);
1272}
1273
1274void ASTStmtReader::VisitImplicitValueInitExpr(ImplicitValueInitExpr *E) {
1275 VisitExpr(E);
1276}
1277
1278void ASTStmtReader::VisitVAArgExpr(VAArgExpr *E) {
1279 VisitExpr(E);
1280 E->setSubExpr(Record.readSubExpr());
1281 E->setWrittenTypeInfo(readTypeSourceInfo());
1282 E->setBuiltinLoc(readSourceLocation());
1283 E->setRParenLoc(readSourceLocation());
1284 E->setIsMicrosoftABI(Record.readInt());
1285}
1286
1287void ASTStmtReader::VisitSourceLocExpr(SourceLocExpr *E) {
1288 VisitExpr(E);
1289 E->ParentContext = readDeclAs<DeclContext>();
1290 E->BuiltinLoc = readSourceLocation();
1291 E->RParenLoc = readSourceLocation();
1292 E->SourceLocExprBits.Kind =
1293 static_cast<SourceLocExpr::IdentKind>(Record.readInt());
1294}
1295
1296void ASTStmtReader::VisitAddrLabelExpr(AddrLabelExpr *E) {
1297 VisitExpr(E);
1298 E->setAmpAmpLoc(readSourceLocation());
1299 E->setLabelLoc(readSourceLocation());
1300 E->setLabel(readDeclAs<LabelDecl>());
1301}
1302
1303void ASTStmtReader::VisitStmtExpr(StmtExpr *E) {
1304 VisitExpr(E);
1305 E->setLParenLoc(readSourceLocation());
1306 E->setRParenLoc(readSourceLocation());
1307 E->setSubStmt(cast_or_null<CompoundStmt>(Record.readSubStmt()));
1308 E->StmtExprBits.TemplateDepth = Record.readInt();
1309}
1310
1311void ASTStmtReader::VisitChooseExpr(ChooseExpr *E) {
1312 VisitExpr(E);
1313 E->setCond(Record.readSubExpr());
1314 E->setLHS(Record.readSubExpr());
1315 E->setRHS(Record.readSubExpr());
1316 E->setBuiltinLoc(readSourceLocation());
1317 E->setRParenLoc(readSourceLocation());
1318 E->setIsConditionTrue(Record.readInt());
1319}
1320
1321void ASTStmtReader::VisitGNUNullExpr(GNUNullExpr *E) {
1322 VisitExpr(E);
1323 E->setTokenLocation(readSourceLocation());
1324}
1325
1326void ASTStmtReader::VisitShuffleVectorExpr(ShuffleVectorExpr *E) {
1327 VisitExpr(E);
1328 SmallVector<Expr *, 16> Exprs;
1329 unsigned NumExprs = Record.readInt();
1330 while (NumExprs--)
1331 Exprs.push_back(Record.readSubExpr());
1332 E->setExprs(Record.getContext(), Exprs);
1333 E->setBuiltinLoc(readSourceLocation());
1334 E->setRParenLoc(readSourceLocation());
1335}
1336
1337void ASTStmtReader::VisitConvertVectorExpr(ConvertVectorExpr *E) {
1338 VisitExpr(E);
1339 E->BuiltinLoc = readSourceLocation();
1340 E->RParenLoc = readSourceLocation();
1341 E->TInfo = readTypeSourceInfo();
1342 E->SrcExpr = Record.readSubExpr();
1343}
1344
1345void ASTStmtReader::VisitBlockExpr(BlockExpr *E) {
1346 VisitExpr(E);
1347 E->setBlockDecl(readDeclAs<BlockDecl>());
1348}
1349
1350void ASTStmtReader::VisitGenericSelectionExpr(GenericSelectionExpr *E) {
1351 VisitExpr(E);
1352
1353 unsigned NumAssocs = Record.readInt();
1354 assert(NumAssocs == E->getNumAssocs() && "Wrong NumAssocs!")((NumAssocs == E->getNumAssocs() && "Wrong NumAssocs!"
) ? static_cast<void> (0) : __assert_fail ("NumAssocs == E->getNumAssocs() && \"Wrong NumAssocs!\""
, "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 1354, __PRETTY_FUNCTION__))
;
1355 E->ResultIndex = Record.readInt();
1356 E->GenericSelectionExprBits.GenericLoc = readSourceLocation();
1357 E->DefaultLoc = readSourceLocation();
1358 E->RParenLoc = readSourceLocation();
1359
1360 Stmt **Stmts = E->getTrailingObjects<Stmt *>();
1361 // Add 1 to account for the controlling expression which is the first
1362 // expression in the trailing array of Stmt *. This is not needed for
1363 // the trailing array of TypeSourceInfo *.
1364 for (unsigned I = 0, N = NumAssocs + 1; I < N; ++I)
1365 Stmts[I] = Record.readSubExpr();
1366
1367 TypeSourceInfo **TSIs = E->getTrailingObjects<TypeSourceInfo *>();
1368 for (unsigned I = 0, N = NumAssocs; I < N; ++I)
1369 TSIs[I] = readTypeSourceInfo();
1370}
1371
1372void ASTStmtReader::VisitPseudoObjectExpr(PseudoObjectExpr *E) {
1373 VisitExpr(E);
1374 unsigned numSemanticExprs = Record.readInt();
1375 assert(numSemanticExprs + 1 == E->PseudoObjectExprBits.NumSubExprs)((numSemanticExprs + 1 == E->PseudoObjectExprBits.NumSubExprs
) ? static_cast<void> (0) : __assert_fail ("numSemanticExprs + 1 == E->PseudoObjectExprBits.NumSubExprs"
, "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 1375, __PRETTY_FUNCTION__))
;
1376 E->PseudoObjectExprBits.ResultIndex = Record.readInt();
1377
1378 // Read the syntactic expression.
1379 E->getSubExprsBuffer()[0] = Record.readSubExpr();
1380
1381 // Read all the semantic expressions.
1382 for (unsigned i = 0; i != numSemanticExprs; ++i) {
1383 Expr *subExpr = Record.readSubExpr();
1384 E->getSubExprsBuffer()[i+1] = subExpr;
1385 }
1386}
1387
1388void ASTStmtReader::VisitAtomicExpr(AtomicExpr *E) {
1389 VisitExpr(E);
1390 E->Op = AtomicExpr::AtomicOp(Record.readInt());
1391 E->NumSubExprs = AtomicExpr::getNumSubExprs(E->Op);
1392 for (unsigned I = 0; I != E->NumSubExprs; ++I)
1393 E->SubExprs[I] = Record.readSubExpr();
1394 E->BuiltinLoc = readSourceLocation();
1395 E->RParenLoc = readSourceLocation();
1396}
1397
1398//===----------------------------------------------------------------------===//
1399// Objective-C Expressions and Statements
1400
1401void ASTStmtReader::VisitObjCStringLiteral(ObjCStringLiteral *E) {
1402 VisitExpr(E);
1403 E->setString(cast<StringLiteral>(Record.readSubStmt()));
1404 E->setAtLoc(readSourceLocation());
1405}
1406
1407void ASTStmtReader::VisitObjCBoxedExpr(ObjCBoxedExpr *E) {
1408 VisitExpr(E);
1409 // could be one of several IntegerLiteral, FloatLiteral, etc.
1410 E->SubExpr = Record.readSubStmt();
1411 E->BoxingMethod = readDeclAs<ObjCMethodDecl>();
1412 E->Range = readSourceRange();
1413}
1414
1415void ASTStmtReader::VisitObjCArrayLiteral(ObjCArrayLiteral *E) {
1416 VisitExpr(E);
1417 unsigned NumElements = Record.readInt();
1418 assert(NumElements == E->getNumElements() && "Wrong number of elements")((NumElements == E->getNumElements() && "Wrong number of elements"
) ? static_cast<void> (0) : __assert_fail ("NumElements == E->getNumElements() && \"Wrong number of elements\""
, "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 1418, __PRETTY_FUNCTION__))
;
1419 Expr **Elements = E->getElements();
1420 for (unsigned I = 0, N = NumElements; I != N; ++I)
1421 Elements[I] = Record.readSubExpr();
1422 E->ArrayWithObjectsMethod = readDeclAs<ObjCMethodDecl>();
1423 E->Range = readSourceRange();
1424}
1425
1426void ASTStmtReader::VisitObjCDictionaryLiteral(ObjCDictionaryLiteral *E) {
1427 VisitExpr(E);
1428 unsigned NumElements = Record.readInt();
1429 assert(NumElements == E->getNumElements() && "Wrong number of elements")((NumElements == E->getNumElements() && "Wrong number of elements"
) ? static_cast<void> (0) : __assert_fail ("NumElements == E->getNumElements() && \"Wrong number of elements\""
, "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 1429, __PRETTY_FUNCTION__))
;
1430 bool HasPackExpansions = Record.readInt();
1431 assert(HasPackExpansions == E->HasPackExpansions &&"Pack expansion mismatch")((HasPackExpansions == E->HasPackExpansions &&"Pack expansion mismatch"
) ? static_cast<void> (0) : __assert_fail ("HasPackExpansions == E->HasPackExpansions &&\"Pack expansion mismatch\""
, "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 1431, __PRETTY_FUNCTION__))
;
1432 auto *KeyValues =
1433 E->getTrailingObjects<ObjCDictionaryLiteral::KeyValuePair>();
1434 auto *Expansions =
1435 E->getTrailingObjects<ObjCDictionaryLiteral::ExpansionData>();
1436 for (unsigned I = 0; I != NumElements; ++I) {
1437 KeyValues[I].Key = Record.readSubExpr();
1438 KeyValues[I].Value = Record.readSubExpr();
1439 if (HasPackExpansions) {
1440 Expansions[I].EllipsisLoc = readSourceLocation();
1441 Expansions[I].NumExpansionsPlusOne = Record.readInt();
1442 }
1443 }
1444 E->DictWithObjectsMethod = readDeclAs<ObjCMethodDecl>();
1445 E->Range = readSourceRange();
1446}
1447
1448void ASTStmtReader::VisitObjCEncodeExpr(ObjCEncodeExpr *E) {
1449 VisitExpr(E);
1450 E->setEncodedTypeSourceInfo(readTypeSourceInfo());
1451 E->setAtLoc(readSourceLocation());
1452 E->setRParenLoc(readSourceLocation());
1453}
1454
1455void ASTStmtReader::VisitObjCSelectorExpr(ObjCSelectorExpr *E) {
1456 VisitExpr(E);
1457 E->setSelector(Record.readSelector());
1458 E->setAtLoc(readSourceLocation());
1459 E->setRParenLoc(readSourceLocation());
1460}
1461
1462void ASTStmtReader::VisitObjCProtocolExpr(ObjCProtocolExpr *E) {
1463 VisitExpr(E);
1464 E->setProtocol(readDeclAs<ObjCProtocolDecl>());
1465 E->setAtLoc(readSourceLocation());
1466 E->ProtoLoc = readSourceLocation();
1467 E->setRParenLoc(readSourceLocation());
1468}
1469
1470void ASTStmtReader::VisitObjCIvarRefExpr(ObjCIvarRefExpr *E) {
1471 VisitExpr(E);
1472 E->setDecl(readDeclAs<ObjCIvarDecl>());
1473 E->setLocation(readSourceLocation());
1474 E->setOpLoc(readSourceLocation());
1475 E->setBase(Record.readSubExpr());
1476 E->setIsArrow(Record.readInt());
1477 E->setIsFreeIvar(Record.readInt());
1478}
1479
1480void ASTStmtReader::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *E) {
1481 VisitExpr(E);
1482 unsigned MethodRefFlags = Record.readInt();
1483 bool Implicit = Record.readInt() != 0;
1484 if (Implicit) {
1485 auto *Getter = readDeclAs<ObjCMethodDecl>();
1486 auto *Setter = readDeclAs<ObjCMethodDecl>();
1487 E->setImplicitProperty(Getter, Setter, MethodRefFlags);
1488 } else {
1489 E->setExplicitProperty(readDeclAs<ObjCPropertyDecl>(), MethodRefFlags);
1490 }
1491 E->setLocation(readSourceLocation());
1492 E->setReceiverLocation(readSourceLocation());
1493 switch (Record.readInt()) {
1494 case 0:
1495 E->setBase(Record.readSubExpr());
1496 break;
1497 case 1:
1498 E->setSuperReceiver(Record.readType());
1499 break;
1500 case 2:
1501 E->setClassReceiver(readDeclAs<ObjCInterfaceDecl>());
1502 break;
1503 }
1504}
1505
1506void ASTStmtReader::VisitObjCSubscriptRefExpr(ObjCSubscriptRefExpr *E) {
1507 VisitExpr(E);
1508 E->setRBracket(readSourceLocation());
1509 E->setBaseExpr(Record.readSubExpr());
1510 E->setKeyExpr(Record.readSubExpr());
1511 E->GetAtIndexMethodDecl = readDeclAs<ObjCMethodDecl>();
1512 E->SetAtIndexMethodDecl = readDeclAs<ObjCMethodDecl>();
1513}
1514
1515void ASTStmtReader::VisitObjCMessageExpr(ObjCMessageExpr *E) {
1516 VisitExpr(E);
1517 assert(Record.peekInt() == E->getNumArgs())((Record.peekInt() == E->getNumArgs()) ? static_cast<void
> (0) : __assert_fail ("Record.peekInt() == E->getNumArgs()"
, "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 1517, __PRETTY_FUNCTION__))
;
1518 Record.skipInts(1);
1519 unsigned NumStoredSelLocs = Record.readInt();
1520 E->SelLocsKind = Record.readInt();
1521 E->setDelegateInitCall(Record.readInt());
1522 E->IsImplicit = Record.readInt();
1523 auto Kind = static_cast<ObjCMessageExpr::ReceiverKind>(Record.readInt());
1524 switch (Kind) {
1525 case ObjCMessageExpr::Instance:
1526 E->setInstanceReceiver(Record.readSubExpr());
1527 break;
1528
1529 case ObjCMessageExpr::Class:
1530 E->setClassReceiver(readTypeSourceInfo());
1531 break;
1532
1533 case ObjCMessageExpr::SuperClass:
1534 case ObjCMessageExpr::SuperInstance: {
1535 QualType T = Record.readType();
1536 SourceLocation SuperLoc = readSourceLocation();
1537 E->setSuper(SuperLoc, T, Kind == ObjCMessageExpr::SuperInstance);
1538 break;
1539 }
1540 }
1541
1542 assert(Kind == E->getReceiverKind())((Kind == E->getReceiverKind()) ? static_cast<void> (
0) : __assert_fail ("Kind == E->getReceiverKind()", "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 1542, __PRETTY_FUNCTION__))
;
1543
1544 if (Record.readInt())
1545 E->setMethodDecl(readDeclAs<ObjCMethodDecl>());
1546 else
1547 E->setSelector(Record.readSelector());
1548
1549 E->LBracLoc = readSourceLocation();
1550 E->RBracLoc = readSourceLocation();
1551
1552 for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
1553 E->setArg(I, Record.readSubExpr());
1554
1555 SourceLocation *Locs = E->getStoredSelLocs();
1556 for (unsigned I = 0; I != NumStoredSelLocs; ++I)
1557 Locs[I] = readSourceLocation();
1558}
1559
1560void ASTStmtReader::VisitObjCForCollectionStmt(ObjCForCollectionStmt *S) {
1561 VisitStmt(S);
1562 S->setElement(Record.readSubStmt());
1563 S->setCollection(Record.readSubExpr());
1564 S->setBody(Record.readSubStmt());
1565 S->setForLoc(readSourceLocation());
1566 S->setRParenLoc(readSourceLocation());
1567}
1568
1569void ASTStmtReader::VisitObjCAtCatchStmt(ObjCAtCatchStmt *S) {
1570 VisitStmt(S);
1571 S->setCatchBody(Record.readSubStmt());
1572 S->setCatchParamDecl(readDeclAs<VarDecl>());
1573 S->setAtCatchLoc(readSourceLocation());
1574 S->setRParenLoc(readSourceLocation());
1575}
1576
1577void ASTStmtReader::VisitObjCAtFinallyStmt(ObjCAtFinallyStmt *S) {
1578 VisitStmt(S);
1579 S->setFinallyBody(Record.readSubStmt());
1580 S->setAtFinallyLoc(readSourceLocation());
1581}
1582
1583void ASTStmtReader::VisitObjCAutoreleasePoolStmt(ObjCAutoreleasePoolStmt *S) {
1584 VisitStmt(S); // FIXME: no test coverage.
1585 S->setSubStmt(Record.readSubStmt());
1586 S->setAtLoc(readSourceLocation());
1587}
1588
1589void ASTStmtReader::VisitObjCAtTryStmt(ObjCAtTryStmt *S) {
1590 VisitStmt(S);
1591 assert(Record.peekInt() == S->getNumCatchStmts())((Record.peekInt() == S->getNumCatchStmts()) ? static_cast
<void> (0) : __assert_fail ("Record.peekInt() == S->getNumCatchStmts()"
, "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 1591, __PRETTY_FUNCTION__))
;
1592 Record.skipInts(1);
1593 bool HasFinally = Record.readInt();
1594 S->setTryBody(Record.readSubStmt());
1595 for (unsigned I = 0, N = S->getNumCatchStmts(); I != N; ++I)
1596 S->setCatchStmt(I, cast_or_null<ObjCAtCatchStmt>(Record.readSubStmt()));
1597
1598 if (HasFinally)
1599 S->setFinallyStmt(Record.readSubStmt());
1600 S->setAtTryLoc(readSourceLocation());
1601}
1602
1603void ASTStmtReader::VisitObjCAtSynchronizedStmt(ObjCAtSynchronizedStmt *S) {
1604 VisitStmt(S); // FIXME: no test coverage.
1605 S->setSynchExpr(Record.readSubStmt());
1606 S->setSynchBody(Record.readSubStmt());
1607 S->setAtSynchronizedLoc(readSourceLocation());
1608}
1609
1610void ASTStmtReader::VisitObjCAtThrowStmt(ObjCAtThrowStmt *S) {
1611 VisitStmt(S); // FIXME: no test coverage.
1612 S->setThrowExpr(Record.readSubStmt());
1613 S->setThrowLoc(readSourceLocation());
1614}
1615
1616void ASTStmtReader::VisitObjCBoolLiteralExpr(ObjCBoolLiteralExpr *E) {
1617 VisitExpr(E);
1618 E->setValue(Record.readInt());
1619 E->setLocation(readSourceLocation());
1620}
1621
1622void ASTStmtReader::VisitObjCAvailabilityCheckExpr(ObjCAvailabilityCheckExpr *E) {
1623 VisitExpr(E);
1624 SourceRange R = Record.readSourceRange();
1625 E->AtLoc = R.getBegin();
1626 E->RParen = R.getEnd();
1627 E->VersionToCheck = Record.readVersionTuple();
1628}
1629
1630//===----------------------------------------------------------------------===//
1631// C++ Expressions and Statements
1632//===----------------------------------------------------------------------===//
1633
1634void ASTStmtReader::VisitCXXCatchStmt(CXXCatchStmt *S) {
1635 VisitStmt(S);
1636 S->CatchLoc = readSourceLocation();
1637 S->ExceptionDecl = readDeclAs<VarDecl>();
1638 S->HandlerBlock = Record.readSubStmt();
1639}
1640
1641void ASTStmtReader::VisitCXXTryStmt(CXXTryStmt *S) {
1642 VisitStmt(S);
1643 assert(Record.peekInt() == S->getNumHandlers() && "NumStmtFields is wrong ?")((Record.peekInt() == S->getNumHandlers() && "NumStmtFields is wrong ?"
) ? static_cast<void> (0) : __assert_fail ("Record.peekInt() == S->getNumHandlers() && \"NumStmtFields is wrong ?\""
, "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 1643, __PRETTY_FUNCTION__))
;
1644 Record.skipInts(1);
1645 S->TryLoc = readSourceLocation();
1646 S->getStmts()[0] = Record.readSubStmt();
1647 for (unsigned i = 0, e = S->getNumHandlers(); i != e; ++i)
1648 S->getStmts()[i + 1] = Record.readSubStmt();
1649}
1650
1651void ASTStmtReader::VisitCXXForRangeStmt(CXXForRangeStmt *S) {
1652 VisitStmt(S);
1653 S->ForLoc = readSourceLocation();
1654 S->CoawaitLoc = readSourceLocation();
1655 S->ColonLoc = readSourceLocation();
1656 S->RParenLoc = readSourceLocation();
1657 S->setInit(Record.readSubStmt());
1658 S->setRangeStmt(Record.readSubStmt());
1659 S->setBeginStmt(Record.readSubStmt());
1660 S->setEndStmt(Record.readSubStmt());
1661 S->setCond(Record.readSubExpr());
1662 S->setInc(Record.readSubExpr());
1663 S->setLoopVarStmt(Record.readSubStmt());
1664 S->setBody(Record.readSubStmt());
1665}
1666
1667void ASTStmtReader::VisitMSDependentExistsStmt(MSDependentExistsStmt *S) {
1668 VisitStmt(S);
1669 S->KeywordLoc = readSourceLocation();
1670 S->IsIfExists = Record.readInt();
1671 S->QualifierLoc = Record.readNestedNameSpecifierLoc();
1672 S->NameInfo = Record.readDeclarationNameInfo();
1673 S->SubStmt = Record.readSubStmt();
1674}
1675
1676void ASTStmtReader::VisitCXXOperatorCallExpr(CXXOperatorCallExpr *E) {
1677 VisitCallExpr(E);
1678 E->CXXOperatorCallExprBits.OperatorKind = Record.readInt();
1679 E->Range = Record.readSourceRange();
1680}
1681
1682void ASTStmtReader::VisitCXXRewrittenBinaryOperator(
1683 CXXRewrittenBinaryOperator *E) {
1684 VisitExpr(E);
1685 E->CXXRewrittenBinaryOperatorBits.IsReversed = Record.readInt();
1686 E->SemanticForm = Record.readSubExpr();
1687}
1688
1689void ASTStmtReader::VisitCXXConstructExpr(CXXConstructExpr *E) {
1690 VisitExpr(E);
1691
1692 unsigned NumArgs = Record.readInt();
1693 assert((NumArgs == E->getNumArgs()) && "Wrong NumArgs!")(((NumArgs == E->getNumArgs()) && "Wrong NumArgs!"
) ? static_cast<void> (0) : __assert_fail ("(NumArgs == E->getNumArgs()) && \"Wrong NumArgs!\""
, "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 1693, __PRETTY_FUNCTION__))
;
1694
1695 E->CXXConstructExprBits.Elidable = Record.readInt();
1696 E->CXXConstructExprBits.HadMultipleCandidates = Record.readInt();
1697 E->CXXConstructExprBits.ListInitialization = Record.readInt();
1698 E->CXXConstructExprBits.StdInitListInitialization = Record.readInt();
1699 E->CXXConstructExprBits.ZeroInitialization = Record.readInt();
1700 E->CXXConstructExprBits.ConstructionKind = Record.readInt();
1701 E->CXXConstructExprBits.Loc = readSourceLocation();
1702 E->Constructor = readDeclAs<CXXConstructorDecl>();
1703 E->ParenOrBraceRange = readSourceRange();
1704
1705 for (unsigned I = 0; I != NumArgs; ++I)
1706 E->setArg(I, Record.readSubExpr());
1707}
1708
1709void ASTStmtReader::VisitCXXInheritedCtorInitExpr(CXXInheritedCtorInitExpr *E) {
1710 VisitExpr(E);
1711 E->Constructor = readDeclAs<CXXConstructorDecl>();
1712 E->Loc = readSourceLocation();
1713 E->ConstructsVirtualBase = Record.readInt();
1714 E->InheritedFromVirtualBase = Record.readInt();
1715}
1716
1717void ASTStmtReader::VisitCXXTemporaryObjectExpr(CXXTemporaryObjectExpr *E) {
1718 VisitCXXConstructExpr(E);
1719 E->TSI = readTypeSourceInfo();
1720}
1721
1722void ASTStmtReader::VisitLambdaExpr(LambdaExpr *E) {
1723 VisitExpr(E);
1724 unsigned NumCaptures = Record.readInt();
1725 (void)NumCaptures;
1726 assert(NumCaptures == E->LambdaExprBits.NumCaptures)((NumCaptures == E->LambdaExprBits.NumCaptures) ? static_cast
<void> (0) : __assert_fail ("NumCaptures == E->LambdaExprBits.NumCaptures"
, "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 1726, __PRETTY_FUNCTION__))
;
1727 E->IntroducerRange = readSourceRange();
1728 E->LambdaExprBits.CaptureDefault = Record.readInt();
1729 E->CaptureDefaultLoc = readSourceLocation();
1730 E->LambdaExprBits.ExplicitParams = Record.readInt();
1731 E->LambdaExprBits.ExplicitResultType = Record.readInt();
1732 E->ClosingBrace = readSourceLocation();
1733
1734 // Read capture initializers.
1735 for (LambdaExpr::capture_init_iterator C = E->capture_init_begin(),
1736 CEnd = E->capture_init_end();
1737 C != CEnd; ++C)
1738 *C = Record.readSubExpr();
1739
1740 // The body will be lazily deserialized when needed from the call operator
1741 // declaration.
1742}
1743
1744void
1745ASTStmtReader::VisitCXXStdInitializerListExpr(CXXStdInitializerListExpr *E) {
1746 VisitExpr(E);
1747 E->SubExpr = Record.readSubExpr();
1748}
1749
1750void ASTStmtReader::VisitCXXNamedCastExpr(CXXNamedCastExpr *E) {
1751 VisitExplicitCastExpr(E);
1752 SourceRange R = readSourceRange();
1753 E->Loc = R.getBegin();
1754 E->RParenLoc = R.getEnd();
1755 R = readSourceRange();
1756 E->AngleBrackets = R;
1757}
1758
1759void ASTStmtReader::VisitCXXStaticCastExpr(CXXStaticCastExpr *E) {
1760 return VisitCXXNamedCastExpr(E);
1761}
1762
1763void ASTStmtReader::VisitCXXDynamicCastExpr(CXXDynamicCastExpr *E) {
1764 return VisitCXXNamedCastExpr(E);
1765}
1766
1767void ASTStmtReader::VisitCXXReinterpretCastExpr(CXXReinterpretCastExpr *E) {
1768 return VisitCXXNamedCastExpr(E);
1769}
1770
1771void ASTStmtReader::VisitCXXAddrspaceCastExpr(CXXAddrspaceCastExpr *E) {
1772 return VisitCXXNamedCastExpr(E);
1773}
1774
1775void ASTStmtReader::VisitCXXConstCastExpr(CXXConstCastExpr *E) {
1776 return VisitCXXNamedCastExpr(E);
1777}
1778
1779void ASTStmtReader::VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr *E) {
1780 VisitExplicitCastExpr(E);
1781 E->setLParenLoc(readSourceLocation());
1782 E->setRParenLoc(readSourceLocation());
1783}
1784
1785void ASTStmtReader::VisitBuiltinBitCastExpr(BuiltinBitCastExpr *E) {
1786 VisitExplicitCastExpr(E);
1787 E->KWLoc = readSourceLocation();
1788 E->RParenLoc = readSourceLocation();
1789}
1790
1791void ASTStmtReader::VisitUserDefinedLiteral(UserDefinedLiteral *E) {
1792 VisitCallExpr(E);
1793 E->UDSuffixLoc = readSourceLocation();
1794}
1795
1796void ASTStmtReader::VisitCXXBoolLiteralExpr(CXXBoolLiteralExpr *E) {
1797 VisitExpr(E);
1798 E->setValue(Record.readInt());
1799 E->setLocation(readSourceLocation());
1800}
1801
1802void ASTStmtReader::VisitCXXNullPtrLiteralExpr(CXXNullPtrLiteralExpr *E) {
1803 VisitExpr(E);
1804 E->setLocation(readSourceLocation());
1805}
1806
1807void ASTStmtReader::VisitCXXTypeidExpr(CXXTypeidExpr *E) {
1808 VisitExpr(E);
1809 E->setSourceRange(readSourceRange());
1810 if (E->isTypeOperand())
1811 E->Operand = readTypeSourceInfo();
1812 else
1813 E->Operand = Record.readSubExpr();
1814}
1815
1816void ASTStmtReader::VisitCXXThisExpr(CXXThisExpr *E) {
1817 VisitExpr(E);
1818 E->setLocation(readSourceLocation());
1819 E->setImplicit(Record.readInt());
1820}
1821
1822void ASTStmtReader::VisitCXXThrowExpr(CXXThrowExpr *E) {
1823 VisitExpr(E);
1824 E->CXXThrowExprBits.ThrowLoc = readSourceLocation();
1825 E->Operand = Record.readSubExpr();
1826 E->CXXThrowExprBits.IsThrownVariableInScope = Record.readInt();
1827}
1828
1829void ASTStmtReader::VisitCXXDefaultArgExpr(CXXDefaultArgExpr *E) {
1830 VisitExpr(E);
1831 E->Param = readDeclAs<ParmVarDecl>();
1832 E->UsedContext = readDeclAs<DeclContext>();
1833 E->CXXDefaultArgExprBits.Loc = readSourceLocation();
1834}
1835
1836void ASTStmtReader::VisitCXXDefaultInitExpr(CXXDefaultInitExpr *E) {
1837 VisitExpr(E);
1838 E->Field = readDeclAs<FieldDecl>();
1839 E->UsedContext = readDeclAs<DeclContext>();
1840 E->CXXDefaultInitExprBits.Loc = readSourceLocation();
1841}
1842
1843void ASTStmtReader::VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *E) {
1844 VisitExpr(E);
1845 E->setTemporary(Record.readCXXTemporary());
1846 E->setSubExpr(Record.readSubExpr());
1847}
1848
1849void ASTStmtReader::VisitCXXScalarValueInitExpr(CXXScalarValueInitExpr *E) {
1850 VisitExpr(E);
1851 E->TypeInfo = readTypeSourceInfo();
1852 E->CXXScalarValueInitExprBits.RParenLoc = readSourceLocation();
1853}
1854
1855void ASTStmtReader::VisitCXXNewExpr(CXXNewExpr *E) {
1856 VisitExpr(E);
1857
1858 bool IsArray = Record.readInt();
1859 bool HasInit = Record.readInt();
1860 unsigned NumPlacementArgs = Record.readInt();
1861 bool IsParenTypeId = Record.readInt();
1862
1863 E->CXXNewExprBits.IsGlobalNew = Record.readInt();
1864 E->CXXNewExprBits.ShouldPassAlignment = Record.readInt();
1865 E->CXXNewExprBits.UsualArrayDeleteWantsSize = Record.readInt();
1866 E->CXXNewExprBits.StoredInitializationStyle = Record.readInt();
1867
1868 assert((IsArray == E->isArray()) && "Wrong IsArray!")(((IsArray == E->isArray()) && "Wrong IsArray!") ?
static_cast<void> (0) : __assert_fail ("(IsArray == E->isArray()) && \"Wrong IsArray!\""
, "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 1868, __PRETTY_FUNCTION__))
;
1869 assert((HasInit == E->hasInitializer()) && "Wrong HasInit!")(((HasInit == E->hasInitializer()) && "Wrong HasInit!"
) ? static_cast<void> (0) : __assert_fail ("(HasInit == E->hasInitializer()) && \"Wrong HasInit!\""
, "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 1869, __PRETTY_FUNCTION__))
;
1870 assert((NumPlacementArgs == E->getNumPlacementArgs()) &&(((NumPlacementArgs == E->getNumPlacementArgs()) &&
"Wrong NumPlacementArgs!") ? static_cast<void> (0) : __assert_fail
("(NumPlacementArgs == E->getNumPlacementArgs()) && \"Wrong NumPlacementArgs!\""
, "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 1871, __PRETTY_FUNCTION__))
1871 "Wrong NumPlacementArgs!")(((NumPlacementArgs == E->getNumPlacementArgs()) &&
"Wrong NumPlacementArgs!") ? static_cast<void> (0) : __assert_fail
("(NumPlacementArgs == E->getNumPlacementArgs()) && \"Wrong NumPlacementArgs!\""
, "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 1871, __PRETTY_FUNCTION__))
;
1872 assert((IsParenTypeId == E->isParenTypeId()) && "Wrong IsParenTypeId!")(((IsParenTypeId == E->isParenTypeId()) && "Wrong IsParenTypeId!"
) ? static_cast<void> (0) : __assert_fail ("(IsParenTypeId == E->isParenTypeId()) && \"Wrong IsParenTypeId!\""
, "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 1872, __PRETTY_FUNCTION__))
;
1873 (void)IsArray;
1874 (void)HasInit;
1875 (void)NumPlacementArgs;
1876
1877 E->setOperatorNew(readDeclAs<FunctionDecl>());
1878 E->setOperatorDelete(readDeclAs<FunctionDecl>());
1879 E->AllocatedTypeInfo = readTypeSourceInfo();
1880 if (IsParenTypeId)
1881 E->getTrailingObjects<SourceRange>()[0] = readSourceRange();
1882 E->Range = readSourceRange();
1883 E->DirectInitRange = readSourceRange();
1884
1885 // Install all the subexpressions.
1886 for (CXXNewExpr::raw_arg_iterator I = E->raw_arg_begin(),
1887 N = E->raw_arg_end();
1888 I != N; ++I)
1889 *I = Record.readSubStmt();
1890}
1891
1892void ASTStmtReader::VisitCXXDeleteExpr(CXXDeleteExpr *E) {
1893 VisitExpr(E);
1894 E->CXXDeleteExprBits.GlobalDelete = Record.readInt();
1895 E->CXXDeleteExprBits.ArrayForm = Record.readInt();
1896 E->CXXDeleteExprBits.ArrayFormAsWritten = Record.readInt();
1897 E->CXXDeleteExprBits.UsualArrayDeleteWantsSize = Record.readInt();
1898 E->OperatorDelete = readDeclAs<FunctionDecl>();
1899 E->Argument = Record.readSubExpr();
1900 E->CXXDeleteExprBits.Loc = readSourceLocation();
1901}
1902
1903void ASTStmtReader::VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr *E) {
1904 VisitExpr(E);
1905
1906 E->Base = Record.readSubExpr();
1907 E->IsArrow = Record.readInt();
1908 E->OperatorLoc = readSourceLocation();
1909 E->QualifierLoc = Record.readNestedNameSpecifierLoc();
1910 E->ScopeType = readTypeSourceInfo();
1911 E->ColonColonLoc = readSourceLocation();
1912 E->TildeLoc = readSourceLocation();
1913
1914 IdentifierInfo *II = Record.readIdentifier();
1915 if (II)
1916 E->setDestroyedType(II, readSourceLocation());
1917 else
1918 E->setDestroyedType(readTypeSourceInfo());
1919}
1920
1921void ASTStmtReader::VisitExprWithCleanups(ExprWithCleanups *E) {
1922 VisitExpr(E);
1923
1924 unsigned NumObjects = Record.readInt();
1925 assert(NumObjects == E->getNumObjects())((NumObjects == E->getNumObjects()) ? static_cast<void>
(0) : __assert_fail ("NumObjects == E->getNumObjects()", "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 1925, __PRETTY_FUNCTION__))
;
1926 for (unsigned i = 0; i != NumObjects; ++i) {
1927 unsigned CleanupKind = Record.readInt();
1928 ExprWithCleanups::CleanupObject Obj;
1929 if (CleanupKind == COK_Block)
1930 Obj = readDeclAs<BlockDecl>();
1931 else if (CleanupKind == COK_CompoundLiteral)
1932 Obj = cast<CompoundLiteralExpr>(Record.readSubExpr());
1933 else
1934 llvm_unreachable("unexpected cleanup object type")::llvm::llvm_unreachable_internal("unexpected cleanup object type"
, "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 1934)
;
1935 E->getTrailingObjects<ExprWithCleanups::CleanupObject>()[i] = Obj;
1936 }
1937
1938 E->ExprWithCleanupsBits.CleanupsHaveSideEffects = Record.readInt();
1939 E->SubExpr = Record.readSubExpr();
1940}
1941
1942void ASTStmtReader::VisitCXXDependentScopeMemberExpr(
1943 CXXDependentScopeMemberExpr *E) {
1944 VisitExpr(E);
1945
1946 bool HasTemplateKWAndArgsInfo = Record.readInt();
1947 unsigned NumTemplateArgs = Record.readInt();
1948 bool HasFirstQualifierFoundInScope = Record.readInt();
1949
1950 assert((HasTemplateKWAndArgsInfo == E->hasTemplateKWAndArgsInfo()) &&(((HasTemplateKWAndArgsInfo == E->hasTemplateKWAndArgsInfo
()) && "Wrong HasTemplateKWAndArgsInfo!") ? static_cast
<void> (0) : __assert_fail ("(HasTemplateKWAndArgsInfo == E->hasTemplateKWAndArgsInfo()) && \"Wrong HasTemplateKWAndArgsInfo!\""
, "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 1951, __PRETTY_FUNCTION__))
1951 "Wrong HasTemplateKWAndArgsInfo!")(((HasTemplateKWAndArgsInfo == E->hasTemplateKWAndArgsInfo
()) && "Wrong HasTemplateKWAndArgsInfo!") ? static_cast
<void> (0) : __assert_fail ("(HasTemplateKWAndArgsInfo == E->hasTemplateKWAndArgsInfo()) && \"Wrong HasTemplateKWAndArgsInfo!\""
, "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 1951, __PRETTY_FUNCTION__))
;
1952 assert((((HasFirstQualifierFoundInScope == E->hasFirstQualifierFoundInScope
()) && "Wrong HasFirstQualifierFoundInScope!") ? static_cast
<void> (0) : __assert_fail ("(HasFirstQualifierFoundInScope == E->hasFirstQualifierFoundInScope()) && \"Wrong HasFirstQualifierFoundInScope!\""
, "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 1954, __PRETTY_FUNCTION__))
1953 (HasFirstQualifierFoundInScope == E->hasFirstQualifierFoundInScope()) &&(((HasFirstQualifierFoundInScope == E->hasFirstQualifierFoundInScope
()) && "Wrong HasFirstQualifierFoundInScope!") ? static_cast
<void> (0) : __assert_fail ("(HasFirstQualifierFoundInScope == E->hasFirstQualifierFoundInScope()) && \"Wrong HasFirstQualifierFoundInScope!\""
, "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 1954, __PRETTY_FUNCTION__))
1954 "Wrong HasFirstQualifierFoundInScope!")(((HasFirstQualifierFoundInScope == E->hasFirstQualifierFoundInScope
()) && "Wrong HasFirstQualifierFoundInScope!") ? static_cast
<void> (0) : __assert_fail ("(HasFirstQualifierFoundInScope == E->hasFirstQualifierFoundInScope()) && \"Wrong HasFirstQualifierFoundInScope!\""
, "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 1954, __PRETTY_FUNCTION__))
;
1955
1956 if (HasTemplateKWAndArgsInfo)
1957 ReadTemplateKWAndArgsInfo(
1958 *E->getTrailingObjects<ASTTemplateKWAndArgsInfo>(),
1959 E->getTrailingObjects<TemplateArgumentLoc>(), NumTemplateArgs);
1960
1961 assert((NumTemplateArgs == E->getNumTemplateArgs()) &&(((NumTemplateArgs == E->getNumTemplateArgs()) && "Wrong NumTemplateArgs!"
) ? static_cast<void> (0) : __assert_fail ("(NumTemplateArgs == E->getNumTemplateArgs()) && \"Wrong NumTemplateArgs!\""
, "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 1962, __PRETTY_FUNCTION__))
1962 "Wrong NumTemplateArgs!")(((NumTemplateArgs == E->getNumTemplateArgs()) && "Wrong NumTemplateArgs!"
) ? static_cast<void> (0) : __assert_fail ("(NumTemplateArgs == E->getNumTemplateArgs()) && \"Wrong NumTemplateArgs!\""
, "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 1962, __PRETTY_FUNCTION__))
;
1963
1964 E->CXXDependentScopeMemberExprBits.IsArrow = Record.readInt();
1965 E->CXXDependentScopeMemberExprBits.OperatorLoc = readSourceLocation();
1966 E->BaseType = Record.readType();
1967 E->QualifierLoc = Record.readNestedNameSpecifierLoc();
1968 E->Base = Record.readSubExpr();
1969
1970 if (HasFirstQualifierFoundInScope)
1971 *E->getTrailingObjects<NamedDecl *>() = readDeclAs<NamedDecl>();
1972
1973 E->MemberNameInfo = Record.readDeclarationNameInfo();
1974}
1975
1976void
1977ASTStmtReader::VisitDependentScopeDeclRefExpr(DependentScopeDeclRefExpr *E) {
1978 VisitExpr(E);
1979
1980 if (Record.readInt()) // HasTemplateKWAndArgsInfo
1981 ReadTemplateKWAndArgsInfo(
1982 *E->getTrailingObjects<ASTTemplateKWAndArgsInfo>(),
1983 E->getTrailingObjects<TemplateArgumentLoc>(),
1984 /*NumTemplateArgs=*/Record.readInt());
1985
1986 E->QualifierLoc = Record.readNestedNameSpecifierLoc();
1987 E->NameInfo = Record.readDeclarationNameInfo();
1988}
1989
1990void
1991ASTStmtReader::VisitCXXUnresolvedConstructExpr(CXXUnresolvedConstructExpr *E) {
1992 VisitExpr(E);
1993 assert(Record.peekInt() == E->getNumArgs() &&((Record.peekInt() == E->getNumArgs() && "Read wrong record during creation ?"
) ? static_cast<void> (0) : __assert_fail ("Record.peekInt() == E->getNumArgs() && \"Read wrong record during creation ?\""
, "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 1994, __PRETTY_FUNCTION__))
1994 "Read wrong record during creation ?")((Record.peekInt() == E->getNumArgs() && "Read wrong record during creation ?"
) ? static_cast<void> (0) : __assert_fail ("Record.peekInt() == E->getNumArgs() && \"Read wrong record during creation ?\""
, "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 1994, __PRETTY_FUNCTION__))
;
1995 Record.skipInts(1);
1996 for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
1997 E->setArg(I, Record.readSubExpr());
1998 E->TSI = readTypeSourceInfo();
1999 E->setLParenLoc(readSourceLocation());
2000 E->setRParenLoc(readSourceLocation());
2001}
2002
2003void ASTStmtReader::VisitOverloadExpr(OverloadExpr *E) {
2004 VisitExpr(E);
2005
2006 unsigned NumResults = Record.readInt();
2007 bool HasTemplateKWAndArgsInfo = Record.readInt();
2008 assert((E->getNumDecls() == NumResults) && "Wrong NumResults!")(((E->getNumDecls() == NumResults) && "Wrong NumResults!"
) ? static_cast<void> (0) : __assert_fail ("(E->getNumDecls() == NumResults) && \"Wrong NumResults!\""
, "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 2008, __PRETTY_FUNCTION__))
;
2009 assert((E->hasTemplateKWAndArgsInfo() == HasTemplateKWAndArgsInfo) &&(((E->hasTemplateKWAndArgsInfo() == HasTemplateKWAndArgsInfo
) && "Wrong HasTemplateKWAndArgsInfo!") ? static_cast
<void> (0) : __assert_fail ("(E->hasTemplateKWAndArgsInfo() == HasTemplateKWAndArgsInfo) && \"Wrong HasTemplateKWAndArgsInfo!\""
, "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 2010, __PRETTY_FUNCTION__))
2010 "Wrong HasTemplateKWAndArgsInfo!")(((E->hasTemplateKWAndArgsInfo() == HasTemplateKWAndArgsInfo
) && "Wrong HasTemplateKWAndArgsInfo!") ? static_cast
<void> (0) : __assert_fail ("(E->hasTemplateKWAndArgsInfo() == HasTemplateKWAndArgsInfo) && \"Wrong HasTemplateKWAndArgsInfo!\""
, "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 2010, __PRETTY_FUNCTION__))
;
2011
2012 if (HasTemplateKWAndArgsInfo) {
2013 unsigned NumTemplateArgs = Record.readInt();
2014 ReadTemplateKWAndArgsInfo(*E->getTrailingASTTemplateKWAndArgsInfo(),
2015 E->getTrailingTemplateArgumentLoc(),
2016 NumTemplateArgs);
2017 assert((E->getNumTemplateArgs() == NumTemplateArgs) &&(((E->getNumTemplateArgs() == NumTemplateArgs) && "Wrong NumTemplateArgs!"
) ? static_cast<void> (0) : __assert_fail ("(E->getNumTemplateArgs() == NumTemplateArgs) && \"Wrong NumTemplateArgs!\""
, "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 2018, __PRETTY_FUNCTION__))
2018 "Wrong NumTemplateArgs!")(((E->getNumTemplateArgs() == NumTemplateArgs) && "Wrong NumTemplateArgs!"
) ? static_cast<void> (0) : __assert_fail ("(E->getNumTemplateArgs() == NumTemplateArgs) && \"Wrong NumTemplateArgs!\""
, "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 2018, __PRETTY_FUNCTION__))
;
2019 }
2020
2021 UnresolvedSet<8> Decls;
2022 for (unsigned I = 0; I != NumResults; ++I) {
2023 auto *D = readDeclAs<NamedDecl>();
2024 auto AS = (AccessSpecifier)Record.readInt();
2025 Decls.addDecl(D, AS);
2026 }
2027
2028 DeclAccessPair *Results = E->getTrailingResults();
2029 UnresolvedSetIterator Iter = Decls.begin();
2030 for (unsigned I = 0; I != NumResults; ++I) {
2031 Results[I] = (Iter + I).getPair();
2032 }
2033
2034 E->NameInfo = Record.readDeclarationNameInfo();
2035 E->QualifierLoc = Record.readNestedNameSpecifierLoc();
2036}
2037
2038void ASTStmtReader::VisitUnresolvedMemberExpr(UnresolvedMemberExpr *E) {
2039 VisitOverloadExpr(E);
2040 E->UnresolvedMemberExprBits.IsArrow = Record.readInt();
2041 E->UnresolvedMemberExprBits.HasUnresolvedUsing = Record.readInt();
2042 E->Base = Record.readSubExpr();
2043 E->BaseType = Record.readType();
2044 E->OperatorLoc = readSourceLocation();
2045}
2046
2047void ASTStmtReader::VisitUnresolvedLookupExpr(UnresolvedLookupExpr *E) {
2048 VisitOverloadExpr(E);
2049 E->UnresolvedLookupExprBits.RequiresADL = Record.readInt();
2050 E->UnresolvedLookupExprBits.Overloaded = Record.readInt();
2051 E->NamingClass = readDeclAs<CXXRecordDecl>();
2052}
2053
2054void ASTStmtReader::VisitTypeTraitExpr(TypeTraitExpr *E) {
2055 VisitExpr(E);
2056 E->TypeTraitExprBits.NumArgs = Record.readInt();
2057 E->TypeTraitExprBits.Kind = Record.readInt();
2058 E->TypeTraitExprBits.Value = Record.readInt();
2059 SourceRange Range = readSourceRange();
2060 E->Loc = Range.getBegin();
2061 E->RParenLoc = Range.getEnd();
2062
2063 auto **Args = E->getTrailingObjects<TypeSourceInfo *>();
2064 for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
2065 Args[I] = readTypeSourceInfo();
2066}
2067
2068void ASTStmtReader::VisitArrayTypeTraitExpr(ArrayTypeTraitExpr *E) {
2069 VisitExpr(E);
2070 E->ATT = (ArrayTypeTrait)Record.readInt();
2071 E->Value = (unsigned int)Record.readInt();
2072 SourceRange Range = readSourceRange();
2073 E->Loc = Range.getBegin();
2074 E->RParen = Range.getEnd();
2075 E->QueriedType = readTypeSourceInfo();
2076 E->Dimension = Record.readSubExpr();
2077}
2078
2079void ASTStmtReader::VisitExpressionTraitExpr(ExpressionTraitExpr *E) {
2080 VisitExpr(E);
2081 E->ET = (ExpressionTrait)Record.readInt();
2082 E->Value = (bool)Record.readInt();
2083 SourceRange Range = readSourceRange();
2084 E->QueriedExpression = Record.readSubExpr();
2085 E->Loc = Range.getBegin();
2086 E->RParen = Range.getEnd();
2087}
2088
2089void ASTStmtReader::VisitCXXNoexceptExpr(CXXNoexceptExpr *E) {
2090 VisitExpr(E);
2091 E->CXXNoexceptExprBits.Value = Record.readInt();
2092 E->Range = readSourceRange();
2093 E->Operand = Record.readSubExpr();
2094}
2095
2096void ASTStmtReader::VisitPackExpansionExpr(PackExpansionExpr *E) {
2097 VisitExpr(E);
2098 E->EllipsisLoc = readSourceLocation();
2099 E->NumExpansions = Record.readInt();
2100 E->Pattern = Record.readSubExpr();
2101}
2102
2103void ASTStmtReader::VisitSizeOfPackExpr(SizeOfPackExpr *E) {
2104 VisitExpr(E);
2105 unsigned NumPartialArgs = Record.readInt();
2106 E->OperatorLoc = readSourceLocation();
2107 E->PackLoc = readSourceLocation();
2108 E->RParenLoc = readSourceLocation();
2109 E->Pack = Record.readDeclAs<NamedDecl>();
2110 if (E->isPartiallySubstituted()) {
2111 assert(E->Length == NumPartialArgs)((E->Length == NumPartialArgs) ? static_cast<void> (
0) : __assert_fail ("E->Length == NumPartialArgs", "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 2111, __PRETTY_FUNCTION__))
;
2112 for (auto *I = E->getTrailingObjects<TemplateArgument>(),
2113 *E = I + NumPartialArgs;
2114 I != E; ++I)
2115 new (I) TemplateArgument(Record.readTemplateArgument());
2116 } else if (!E->isValueDependent()) {
2117 E->Length = Record.readInt();
2118 }
2119}
2120
2121void ASTStmtReader::VisitSubstNonTypeTemplateParmExpr(
2122 SubstNonTypeTemplateParmExpr *E) {
2123 VisitExpr(E);
2124 E->ParamAndRef.setPointer(readDeclAs<NonTypeTemplateParmDecl>());
2125 E->ParamAndRef.setInt(Record.readInt());
2126 E->SubstNonTypeTemplateParmExprBits.NameLoc = readSourceLocation();
2127 E->Replacement = Record.readSubExpr();
2128}
2129
2130void ASTStmtReader::VisitSubstNonTypeTemplateParmPackExpr(
2131 SubstNonTypeTemplateParmPackExpr *E) {
2132 VisitExpr(E);
2133 E->Param = readDeclAs<NonTypeTemplateParmDecl>();
2134 TemplateArgument ArgPack = Record.readTemplateArgument();
2135 if (ArgPack.getKind() != TemplateArgument::Pack)
2136 return;
2137
2138 E->Arguments = ArgPack.pack_begin();
2139 E->NumArguments = ArgPack.pack_size();
2140 E->NameLoc = readSourceLocation();
2141}
2142
2143void ASTStmtReader::VisitFunctionParmPackExpr(FunctionParmPackExpr *E) {
2144 VisitExpr(E);
2145 E->NumParameters = Record.readInt();
2146 E->ParamPack = readDeclAs<ParmVarDecl>();
2147 E->NameLoc = readSourceLocation();
2148 auto **Parms = E->getTrailingObjects<VarDecl *>();
2149 for (unsigned i = 0, n = E->NumParameters; i != n; ++i)
2150 Parms[i] = readDeclAs<VarDecl>();
2151}
2152
2153void ASTStmtReader::VisitMaterializeTemporaryExpr(MaterializeTemporaryExpr *E) {
2154 VisitExpr(E);
2155 bool HasMaterialzedDecl = Record.readInt();
2156 if (HasMaterialzedDecl)
2157 E->State = cast<LifetimeExtendedTemporaryDecl>(Record.readDecl());
2158 else
2159 E->State = Record.readSubExpr();
2160}
2161
2162void ASTStmtReader::VisitCXXFoldExpr(CXXFoldExpr *E) {
2163 VisitExpr(E);
2164 E->LParenLoc = readSourceLocation();
2165 E->EllipsisLoc = readSourceLocation();
2166 E->RParenLoc = readSourceLocation();
2167 E->NumExpansions = Record.readInt();
2168 E->SubExprs[0] = Record.readSubExpr();
2169 E->SubExprs[1] = Record.readSubExpr();
2170 E->SubExprs[2] = Record.readSubExpr();
2171 E->Opcode = (BinaryOperatorKind)Record.readInt();
2172}
2173
2174void ASTStmtReader::VisitOpaqueValueExpr(OpaqueValueExpr *E) {
2175 VisitExpr(E);
2176 E->SourceExpr = Record.readSubExpr();
2177 E->OpaqueValueExprBits.Loc = readSourceLocation();
2178 E->setIsUnique(Record.readInt());
2179}
2180
2181void ASTStmtReader::VisitTypoExpr(TypoExpr *E) {
2182 llvm_unreachable("Cannot read TypoExpr nodes")::llvm::llvm_unreachable_internal("Cannot read TypoExpr nodes"
, "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 2182)
;
2183}
2184
2185void ASTStmtReader::VisitRecoveryExpr(RecoveryExpr *E) {
2186 VisitExpr(E);
2187 unsigned NumArgs = Record.readInt();
2188 E->BeginLoc = readSourceLocation();
2189 E->EndLoc = readSourceLocation();
2190 assert((NumArgs + 0LL ==(((NumArgs + 0LL == std::distance(E->children().begin(), E
->children().end())) && "Wrong NumArgs!") ? static_cast
<void> (0) : __assert_fail ("(NumArgs + 0LL == std::distance(E->children().begin(), E->children().end())) && \"Wrong NumArgs!\""
, "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 2192, __PRETTY_FUNCTION__))
2191 std::distance(E->children().begin(), E->children().end())) &&(((NumArgs + 0LL == std::distance(E->children().begin(), E
->children().end())) && "Wrong NumArgs!") ? static_cast
<void> (0) : __assert_fail ("(NumArgs + 0LL == std::distance(E->children().begin(), E->children().end())) && \"Wrong NumArgs!\""
, "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 2192, __PRETTY_FUNCTION__))
2192 "Wrong NumArgs!")(((NumArgs + 0LL == std::distance(E->children().begin(), E
->children().end())) && "Wrong NumArgs!") ? static_cast
<void> (0) : __assert_fail ("(NumArgs + 0LL == std::distance(E->children().begin(), E->children().end())) && \"Wrong NumArgs!\""
, "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 2192, __PRETTY_FUNCTION__))
;
2193 (void)NumArgs;
2194 for (Stmt *&Child : E->children())
2195 Child = Record.readSubStmt();
2196}
2197
2198//===----------------------------------------------------------------------===//
2199// Microsoft Expressions and Statements
2200//===----------------------------------------------------------------------===//
2201void ASTStmtReader::VisitMSPropertyRefExpr(MSPropertyRefExpr *E) {
2202 VisitExpr(E);
2203 E->IsArrow = (Record.readInt() != 0);
2204 E->BaseExpr = Record.readSubExpr();
2205 E->QualifierLoc = Record.readNestedNameSpecifierLoc();
2206 E->MemberLoc = readSourceLocation();
2207 E->TheDecl = readDeclAs<MSPropertyDecl>();
2208}
2209
2210void ASTStmtReader::VisitMSPropertySubscriptExpr(MSPropertySubscriptExpr *E) {
2211 VisitExpr(E);
2212 E->setBase(Record.readSubExpr());
2213 E->setIdx(Record.readSubExpr());
2214 E->setRBracketLoc(readSourceLocation());
2215}
2216
2217void ASTStmtReader::VisitCXXUuidofExpr(CXXUuidofExpr *E) {
2218 VisitExpr(E);
2219 E->setSourceRange(readSourceRange());
2220 E->Guid = readDeclAs<MSGuidDecl>();
2221 if (E->isTypeOperand())
2222 E->Operand = readTypeSourceInfo();
2223 else
2224 E->Operand = Record.readSubExpr();
2225}
2226
2227void ASTStmtReader::VisitSEHLeaveStmt(SEHLeaveStmt *S) {
2228 VisitStmt(S);
2229 S->setLeaveLoc(readSourceLocation());
2230}
2231
2232void ASTStmtReader::VisitSEHExceptStmt(SEHExceptStmt *S) {
2233 VisitStmt(S);
2234 S->Loc = readSourceLocation();
2235 S->Children[SEHExceptStmt::FILTER_EXPR] = Record.readSubStmt();
2236 S->Children[SEHExceptStmt::BLOCK] = Record.readSubStmt();
2237}
2238
2239void ASTStmtReader::VisitSEHFinallyStmt(SEHFinallyStmt *S) {
2240 VisitStmt(S);
2241 S->Loc = readSourceLocation();
2242 S->Block = Record.readSubStmt();
2243}
2244
2245void ASTStmtReader::VisitSEHTryStmt(SEHTryStmt *S) {
2246 VisitStmt(S);
2247 S->IsCXXTry = Record.readInt();
2248 S->TryLoc = readSourceLocation();
2249 S->Children[SEHTryStmt::TRY] = Record.readSubStmt();
2250 S->Children[SEHTryStmt::HANDLER] = Record.readSubStmt();
2251}
2252
2253//===----------------------------------------------------------------------===//
2254// CUDA Expressions and Statements
2255//===----------------------------------------------------------------------===//
2256
2257void ASTStmtReader::VisitCUDAKernelCallExpr(CUDAKernelCallExpr *E) {
2258 VisitCallExpr(E);
2259 E->setPreArg(CUDAKernelCallExpr::CONFIG, Record.readSubExpr());
2260}
2261
2262//===----------------------------------------------------------------------===//
2263// OpenCL Expressions and Statements.
2264//===----------------------------------------------------------------------===//
2265void ASTStmtReader::VisitAsTypeExpr(AsTypeExpr *E) {
2266 VisitExpr(E);
2267 E->BuiltinLoc = readSourceLocation();
2268 E->RParenLoc = readSourceLocation();
2269 E->SrcExpr = Record.readSubExpr();
2270}
2271
2272//===----------------------------------------------------------------------===//
2273// OpenMP Directives.
2274//===----------------------------------------------------------------------===//
2275
2276void ASTStmtReader::VisitOMPExecutableDirective(OMPExecutableDirective *E) {
2277 Record.readOMPChildren(E->Data);
2278 E->setLocStart(readSourceLocation());
2279 E->setLocEnd(readSourceLocation());
2280}
2281
2282void ASTStmtReader::VisitOMPLoopDirective(OMPLoopDirective *D) {
2283 VisitStmt(D);
2284 // Field CollapsedNum was read in ReadStmtFromStream.
2285 Record.skipInts(1);
2286 VisitOMPExecutableDirective(D);
2287}
2288
2289void ASTStmtReader::VisitOMPParallelDirective(OMPParallelDirective *D) {
2290 VisitStmt(D);
2291 VisitOMPExecutableDirective(D);
2292 D->setHasCancel(Record.readBool());
2293}
2294
2295void ASTStmtReader::VisitOMPSimdDirective(OMPSimdDirective *D) {
2296 VisitOMPLoopDirective(D);
2297}
2298
2299void ASTStmtReader::VisitOMPForDirective(OMPForDirective *D) {
2300 VisitOMPLoopDirective(D);
2301 D->setHasCancel(Record.readBool());
2302}
2303
2304void ASTStmtReader::VisitOMPForSimdDirective(OMPForSimdDirective *D) {
2305 VisitOMPLoopDirective(D);
2306}
2307
2308void ASTStmtReader::VisitOMPSectionsDirective(OMPSectionsDirective *D) {
2309 VisitStmt(D);
2310 VisitOMPExecutableDirective(D);
2311 D->setHasCancel(Record.readBool());
2312}
2313
2314void ASTStmtReader::VisitOMPSectionDirective(OMPSectionDirective *D) {
2315 VisitStmt(D);
2316 VisitOMPExecutableDirective(D);
2317 D->setHasCancel(Record.readBool());
2318}
2319
2320void ASTStmtReader::VisitOMPSingleDirective(OMPSingleDirective *D) {
2321 VisitStmt(D);
2322 VisitOMPExecutableDirective(D);
2323}
2324
2325void ASTStmtReader::VisitOMPMasterDirective(OMPMasterDirective *D) {
2326 VisitStmt(D);
2327 VisitOMPExecutableDirective(D);
2328}
2329
2330void ASTStmtReader::VisitOMPCriticalDirective(OMPCriticalDirective *D) {
2331 VisitStmt(D);
2332 VisitOMPExecutableDirective(D);
2333 D->DirName = Record.readDeclarationNameInfo();
2334}
2335
2336void ASTStmtReader::VisitOMPParallelForDirective(OMPParallelForDirective *D) {
2337 VisitOMPLoopDirective(D);
2338 D->setHasCancel(Record.readBool());
2339}
2340
2341void ASTStmtReader::VisitOMPParallelForSimdDirective(
2342 OMPParallelForSimdDirective *D) {
2343 VisitOMPLoopDirective(D);
2344}
2345
2346void ASTStmtReader::VisitOMPParallelMasterDirective(
2347 OMPParallelMasterDirective *D) {
2348 VisitStmt(D);
2349 VisitOMPExecutableDirective(D);
2350}
2351
2352void ASTStmtReader::VisitOMPParallelSectionsDirective(
2353 OMPParallelSectionsDirective *D) {
2354 VisitStmt(D);
2355 VisitOMPExecutableDirective(D);
2356 D->setHasCancel(Record.readBool());
2357}
2358
2359void ASTStmtReader::VisitOMPTaskDirective(OMPTaskDirective *D) {
2360 VisitStmt(D);
2361 VisitOMPExecutableDirective(D);
2362 D->setHasCancel(Record.readBool());
2363}
2364
2365void ASTStmtReader::VisitOMPTaskyieldDirective(OMPTaskyieldDirective *D) {
2366 VisitStmt(D);
2367 VisitOMPExecutableDirective(D);
2368}
2369
2370void ASTStmtReader::VisitOMPBarrierDirective(OMPBarrierDirective *D) {
2371 VisitStmt(D);
2372 VisitOMPExecutableDirective(D);
2373}
2374
2375void ASTStmtReader::VisitOMPTaskwaitDirective(OMPTaskwaitDirective *D) {
2376 VisitStmt(D);
2377 VisitOMPExecutableDirective(D);
2378}
2379
2380void ASTStmtReader::VisitOMPTaskgroupDirective(OMPTaskgroupDirective *D) {
2381 VisitStmt(D);
2382 VisitOMPExecutableDirective(D);
2383}
2384
2385void ASTStmtReader::VisitOMPFlushDirective(OMPFlushDirective *D) {
2386 VisitStmt(D);
2387 VisitOMPExecutableDirective(D);
2388}
2389
2390void ASTStmtReader::VisitOMPDepobjDirective(OMPDepobjDirective *D) {
2391 VisitStmt(D);
2392 VisitOMPExecutableDirective(D);
2393}
2394
2395void ASTStmtReader::VisitOMPScanDirective(OMPScanDirective *D) {
2396 VisitStmt(D);
2397 VisitOMPExecutableDirective(D);
2398}
2399
2400void ASTStmtReader::VisitOMPOrderedDirective(OMPOrderedDirective *D) {
2401 VisitStmt(D);
2402 VisitOMPExecutableDirective(D);
2403}
2404
2405void ASTStmtReader::VisitOMPAtomicDirective(OMPAtomicDirective *D) {
2406 VisitStmt(D);
2407 VisitOMPExecutableDirective(D);
2408 D->IsXLHSInRHSPart = Record.readBool();
2409 D->IsPostfixUpdate = Record.readBool();
2410}
2411
2412void ASTStmtReader::VisitOMPTargetDirective(OMPTargetDirective *D) {
2413 VisitStmt(D);
2414 VisitOMPExecutableDirective(D);
2415}
2416
2417void ASTStmtReader::VisitOMPTargetDataDirective(OMPTargetDataDirective *D) {
2418 VisitStmt(D);
2419 VisitOMPExecutableDirective(D);
2420}
2421
2422void ASTStmtReader::VisitOMPTargetEnterDataDirective(
2423 OMPTargetEnterDataDirective *D) {
2424 VisitStmt(D);
2425 VisitOMPExecutableDirective(D);
2426}
2427
2428void ASTStmtReader::VisitOMPTargetExitDataDirective(
2429 OMPTargetExitDataDirective *D) {
2430 VisitStmt(D);
2431 VisitOMPExecutableDirective(D);
2432}
2433
2434void ASTStmtReader::VisitOMPTargetParallelDirective(
2435 OMPTargetParallelDirective *D) {
2436 VisitStmt(D);
2437 VisitOMPExecutableDirective(D);
2438 D->setHasCancel(Record.readBool());
2439}
2440
2441void ASTStmtReader::VisitOMPTargetParallelForDirective(
2442 OMPTargetParallelForDirective *D) {
2443 VisitOMPLoopDirective(D);
2444 D->setHasCancel(Record.readBool());
2445}
2446
2447void ASTStmtReader::VisitOMPTeamsDirective(OMPTeamsDirective *D) {
2448 VisitStmt(D);
2449 VisitOMPExecutableDirective(D);
2450}
2451
2452void ASTStmtReader::VisitOMPCancellationPointDirective(
2453 OMPCancellationPointDirective *D) {
2454 VisitStmt(D);
2455 VisitOMPExecutableDirective(D);
2456 D->setCancelRegion(Record.readEnum<OpenMPDirectiveKind>());
2457}
2458
2459void ASTStmtReader::VisitOMPCancelDirective(OMPCancelDirective *D) {
2460 VisitStmt(D);
2461 VisitOMPExecutableDirective(D);
2462 D->setCancelRegion(Record.readEnum<OpenMPDirectiveKind>());
2463}
2464
2465void ASTStmtReader::VisitOMPTaskLoopDirective(OMPTaskLoopDirective *D) {
2466 VisitOMPLoopDirective(D);
2467 D->setHasCancel(Record.readBool());
2468}
2469
2470void ASTStmtReader::VisitOMPTaskLoopSimdDirective(OMPTaskLoopSimdDirective *D) {
2471 VisitOMPLoopDirective(D);
2472}
2473
2474void ASTStmtReader::VisitOMPMasterTaskLoopDirective(
2475 OMPMasterTaskLoopDirective *D) {
2476 VisitOMPLoopDirective(D);
2477 D->setHasCancel(Record.readBool());
2478}
2479
2480void ASTStmtReader::VisitOMPMasterTaskLoopSimdDirective(
2481 OMPMasterTaskLoopSimdDirective *D) {
2482 VisitOMPLoopDirective(D);
2483}
2484
2485void ASTStmtReader::VisitOMPParallelMasterTaskLoopDirective(
2486 OMPParallelMasterTaskLoopDirective *D) {
2487 VisitOMPLoopDirective(D);
2488 D->setHasCancel(Record.readBool());
2489}
2490
2491void ASTStmtReader::VisitOMPParallelMasterTaskLoopSimdDirective(
2492 OMPParallelMasterTaskLoopSimdDirective *D) {
2493 VisitOMPLoopDirective(D);
2494}
2495
2496void ASTStmtReader::VisitOMPDistributeDirective(OMPDistributeDirective *D) {
2497 VisitOMPLoopDirective(D);
2498}
2499
2500void ASTStmtReader::VisitOMPTargetUpdateDirective(OMPTargetUpdateDirective *D) {
2501 VisitStmt(D);
2502 VisitOMPExecutableDirective(D);
2503}
2504
2505void ASTStmtReader::VisitOMPDistributeParallelForDirective(
2506 OMPDistributeParallelForDirective *D) {
2507 VisitOMPLoopDirective(D);
2508 D->setHasCancel(Record.readBool());
2509}
2510
2511void ASTStmtReader::VisitOMPDistributeParallelForSimdDirective(
2512 OMPDistributeParallelForSimdDirective *D) {
2513 VisitOMPLoopDirective(D);
2514}
2515
2516void ASTStmtReader::VisitOMPDistributeSimdDirective(
2517 OMPDistributeSimdDirective *D) {
2518 VisitOMPLoopDirective(D);
2519}
2520
2521void ASTStmtReader::VisitOMPTargetParallelForSimdDirective(
2522 OMPTargetParallelForSimdDirective *D) {
2523 VisitOMPLoopDirective(D);
2524}
2525
2526void ASTStmtReader::VisitOMPTargetSimdDirective(OMPTargetSimdDirective *D) {
2527 VisitOMPLoopDirective(D);
2528}
2529
2530void ASTStmtReader::VisitOMPTeamsDistributeDirective(
2531 OMPTeamsDistributeDirective *D) {
2532 VisitOMPLoopDirective(D);
2533}
2534
2535void ASTStmtReader::VisitOMPTeamsDistributeSimdDirective(
2536 OMPTeamsDistributeSimdDirective *D) {
2537 VisitOMPLoopDirective(D);
2538}
2539
2540void ASTStmtReader::VisitOMPTeamsDistributeParallelForSimdDirective(
2541 OMPTeamsDistributeParallelForSimdDirective *D) {
2542 VisitOMPLoopDirective(D);
2543}
2544
2545void ASTStmtReader::VisitOMPTeamsDistributeParallelForDirective(
2546 OMPTeamsDistributeParallelForDirective *D) {
2547 VisitOMPLoopDirective(D);
2548 D->setHasCancel(Record.readBool());
2549}
2550
2551void ASTStmtReader::VisitOMPTargetTeamsDirective(OMPTargetTeamsDirective *D) {
2552 VisitStmt(D);
2553 VisitOMPExecutableDirective(D);
2554}
2555
2556void ASTStmtReader::VisitOMPTargetTeamsDistributeDirective(
2557 OMPTargetTeamsDistributeDirective *D) {
2558 VisitOMPLoopDirective(D);
2559}
2560
2561void ASTStmtReader::VisitOMPTargetTeamsDistributeParallelForDirective(
2562 OMPTargetTeamsDistributeParallelForDirective *D) {
2563 VisitOMPLoopDirective(D);
2564 D->setHasCancel(Record.readBool());
2565}
2566
2567void ASTStmtReader::VisitOMPTargetTeamsDistributeParallelForSimdDirective(
2568 OMPTargetTeamsDistributeParallelForSimdDirective *D) {
2569 VisitOMPLoopDirective(D);
2570}
2571
2572void ASTStmtReader::VisitOMPTargetTeamsDistributeSimdDirective(
2573 OMPTargetTeamsDistributeSimdDirective *D) {
2574 VisitOMPLoopDirective(D);
2575}
2576
2577//===----------------------------------------------------------------------===//
2578// ASTReader Implementation
2579//===----------------------------------------------------------------------===//
2580
2581Stmt *ASTReader::ReadStmt(ModuleFile &F) {
2582 switch (ReadingKind) {
2583 case Read_None:
2584 llvm_unreachable("should not call this when not reading anything")::llvm::llvm_unreachable_internal("should not call this when not reading anything"
, "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 2584)
;
2585 case Read_Decl:
2586 case Read_Type:
2587 return ReadStmtFromStream(F);
2588 case Read_Stmt:
2589 return ReadSubStmt();
2590 }
2591
2592 llvm_unreachable("ReadingKind not set ?")::llvm::llvm_unreachable_internal("ReadingKind not set ?", "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 2592)
;
2593}
2594
2595Expr *ASTReader::ReadExpr(ModuleFile &F) {
2596 return cast_or_null<Expr>(ReadStmt(F));
2597}
2598
2599Expr *ASTReader::ReadSubExpr() {
2600 return cast_or_null<Expr>(ReadSubStmt());
2601}
2602
2603// Within the bitstream, expressions are stored in Reverse Polish
2604// Notation, with each of the subexpressions preceding the
2605// expression they are stored in. Subexpressions are stored from last to first.
2606// To evaluate expressions, we continue reading expressions and placing them on
2607// the stack, with expressions having operands removing those operands from the
2608// stack. Evaluation terminates when we see a STMT_STOP record, and
2609// the single remaining expression on the stack is our result.
2610Stmt *ASTReader::ReadStmtFromStream(ModuleFile &F) {
2611 ReadingKindTracker ReadingKind(Read_Stmt, *this);
2612 llvm::BitstreamCursor &Cursor = F.DeclsCursor;
2613
2614 // Map of offset to previously deserialized stmt. The offset points
2615 // just after the stmt record.
2616 llvm::DenseMap<uint64_t, Stmt *> StmtEntries;
2617
2618#ifndef NDEBUG
2619 unsigned PrevNumStmts = StmtStack.size();
2620#endif
2621
2622 ASTRecordReader Record(*this, F);
2623 ASTStmtReader Reader(Record, Cursor);
2624 Stmt::EmptyShell Empty;
2625
2626 while (true) {
2627 llvm::Expected<llvm::BitstreamEntry> MaybeEntry =
2628 Cursor.advanceSkippingSubblocks();
2629 if (!MaybeEntry) {
2630 Error(toString(MaybeEntry.takeError()));
2631 return nullptr;
2632 }
2633 llvm::BitstreamEntry Entry = MaybeEntry.get();
2634
2635 switch (Entry.Kind) {
2636 case llvm::BitstreamEntry::SubBlock: // Handled for us already.
2637 case llvm::BitstreamEntry::Error:
2638 Error("malformed block record in AST file");
2639 return nullptr;
2640 case llvm::BitstreamEntry::EndBlock:
2641 goto Done;
2642 case llvm::BitstreamEntry::Record:
2643 // The interesting case.
2644 break;
2645 }
2646
2647 ASTContext &Context = getContext();
2648 Stmt *S = nullptr;
2649 bool Finished = false;
2650 bool IsStmtReference = false;
2651 Expected<unsigned> MaybeStmtCode = Record.readRecord(Cursor, Entry.ID);
2652 if (!MaybeStmtCode) {
2653 Error(toString(MaybeStmtCode.takeError()));
2654 return nullptr;
2655 }
2656 switch ((StmtCode)MaybeStmtCode.get()) {
2657 case STMT_STOP:
2658 Finished = true;
2659 break;
2660
2661 case STMT_REF_PTR:
2662 IsStmtReference = true;
2663 assert(StmtEntries.find(Record[0]) != StmtEntries.end() &&((StmtEntries.find(Record[0]) != StmtEntries.end() &&
"No stmt was recorded for this offset reference!") ? static_cast
<void> (0) : __assert_fail ("StmtEntries.find(Record[0]) != StmtEntries.end() && \"No stmt was recorded for this offset reference!\""
, "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 2664, __PRETTY_FUNCTION__))
2664 "No stmt was recorded for this offset reference!")((StmtEntries.find(Record[0]) != StmtEntries.end() &&
"No stmt was recorded for this offset reference!") ? static_cast
<void> (0) : __assert_fail ("StmtEntries.find(Record[0]) != StmtEntries.end() && \"No stmt was recorded for this offset reference!\""
, "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 2664, __PRETTY_FUNCTION__))
;
2665 S = StmtEntries[Record.readInt()];
2666 break;
2667
2668 case STMT_NULL_PTR:
2669 S = nullptr;
2670 break;
2671
2672 case STMT_NULL:
2673 S = new (Context) NullStmt(Empty);
2674 break;
2675
2676 case STMT_COMPOUND:
2677 S = CompoundStmt::CreateEmpty(
2678 Context, /*NumStmts=*/Record[ASTStmtReader::NumStmtFields]);
2679 break;
2680
2681 case STMT_CASE:
2682 S = CaseStmt::CreateEmpty(
2683 Context,
2684 /*CaseStmtIsGNURange*/ Record[ASTStmtReader::NumStmtFields + 3]);
2685 break;
2686
2687 case STMT_DEFAULT:
2688 S = new (Context) DefaultStmt(Empty);
2689 break;
2690
2691 case STMT_LABEL:
2692 S = new (Context) LabelStmt(Empty);
2693 break;
2694
2695 case STMT_ATTRIBUTED:
2696 S = AttributedStmt::CreateEmpty(
2697 Context,
2698 /*NumAttrs*/Record[ASTStmtReader::NumStmtFields]);
2699 break;
2700
2701 case STMT_IF:
2702 S = IfStmt::CreateEmpty(
2703 Context,
2704 /* HasElse=*/Record[ASTStmtReader::NumStmtFields + 1],
2705 /* HasVar=*/Record[ASTStmtReader::NumStmtFields + 2],
2706 /* HasInit=*/Record[ASTStmtReader::NumStmtFields + 3]);
2707 break;
2708
2709 case STMT_SWITCH:
2710 S = SwitchStmt::CreateEmpty(
2711 Context,
2712 /* HasInit=*/Record[ASTStmtReader::NumStmtFields],
2713 /* HasVar=*/Record[ASTStmtReader::NumStmtFields + 1]);
2714 break;
2715
2716 case STMT_WHILE:
2717 S = WhileStmt::CreateEmpty(
2718 Context,
2719 /* HasVar=*/Record[ASTStmtReader::NumStmtFields]);
2720 break;
2721
2722 case STMT_DO:
2723 S = new (Context) DoStmt(Empty);
2724 break;
2725
2726 case STMT_FOR:
2727 S = new (Context) ForStmt(Empty);
2728 break;
2729
2730 case STMT_GOTO:
2731 S = new (Context) GotoStmt(Empty);
2732 break;
2733
2734 case STMT_INDIRECT_GOTO:
2735 S = new (Context) IndirectGotoStmt(Empty);
2736 break;
2737
2738 case STMT_CONTINUE:
2739 S = new (Context) ContinueStmt(Empty);
2740 break;
2741
2742 case STMT_BREAK:
2743 S = new (Context) BreakStmt(Empty);
2744 break;
2745
2746 case STMT_RETURN:
2747 S = ReturnStmt::CreateEmpty(
2748 Context, /* HasNRVOCandidate=*/Record[ASTStmtReader::NumStmtFields]);
2749 break;
2750
2751 case STMT_DECL:
2752 S = new (Context) DeclStmt(Empty);
2753 break;
2754
2755 case STMT_GCCASM:
2756 S = new (Context) GCCAsmStmt(Empty);
2757 break;
2758
2759 case STMT_MSASM:
2760 S = new (Context) MSAsmStmt(Empty);
2761 break;
2762
2763 case STMT_CAPTURED:
2764 S = CapturedStmt::CreateDeserialized(
2765 Context, Record[ASTStmtReader::NumStmtFields]);
2766 break;
2767
2768 case EXPR_CONSTANT:
2769 S = ConstantExpr::CreateEmpty(
2770 Context, static_cast<ConstantExpr::ResultStorageKind>(
2771 /*StorageKind=*/Record[ASTStmtReader::NumExprFields]));
2772 break;
2773
2774 case EXPR_PREDEFINED:
2775 S = PredefinedExpr::CreateEmpty(
2776 Context,
2777 /*HasFunctionName*/ Record[ASTStmtReader::NumExprFields]);
2778 break;
2779
2780 case EXPR_DECL_REF:
2781 S = DeclRefExpr::CreateEmpty(
2782 Context,
2783 /*HasQualifier=*/Record[ASTStmtReader::NumExprFields],
2784 /*HasFoundDecl=*/Record[ASTStmtReader::NumExprFields + 1],
2785 /*HasTemplateKWAndArgsInfo=*/Record[ASTStmtReader::NumExprFields + 2],
2786 /*NumTemplateArgs=*/Record[ASTStmtReader::NumExprFields + 2] ?
2787 Record[ASTStmtReader::NumExprFields + 6] : 0);
2788 break;
2789
2790 case EXPR_INTEGER_LITERAL:
2791 S = IntegerLiteral::Create(Context, Empty);
2792 break;
2793
2794 case EXPR_FIXEDPOINT_LITERAL:
2795 S = FixedPointLiteral::Create(Context, Empty);
2796 break;
2797
2798 case EXPR_FLOATING_LITERAL:
2799 S = FloatingLiteral::Create(Context, Empty);
2800 break;
2801
2802 case EXPR_IMAGINARY_LITERAL:
2803 S = new (Context) ImaginaryLiteral(Empty);
2804 break;
2805
2806 case EXPR_STRING_LITERAL:
2807 S = StringLiteral::CreateEmpty(
2808 Context,
2809 /* NumConcatenated=*/Record[ASTStmtReader::NumExprFields],
2810 /* Length=*/Record[ASTStmtReader::NumExprFields + 1],
2811 /* CharByteWidth=*/Record[ASTStmtReader::NumExprFields + 2]);
2812 break;
2813
2814 case EXPR_CHARACTER_LITERAL:
2815 S = new (Context) CharacterLiteral(Empty);
2816 break;
2817
2818 case EXPR_PAREN:
2819 S = new (Context) ParenExpr(Empty);
2820 break;
2821
2822 case EXPR_PAREN_LIST:
2823 S = ParenListExpr::CreateEmpty(
2824 Context,
2825 /* NumExprs=*/Record[ASTStmtReader::NumExprFields]);
2826 break;
2827
2828 case EXPR_UNARY_OPERATOR:
2829 S = UnaryOperator::CreateEmpty(Context,
2830 Record[ASTStmtReader::NumExprFields]);
2831 break;
2832
2833 case EXPR_OFFSETOF:
2834 S = OffsetOfExpr::CreateEmpty(Context,
2835 Record[ASTStmtReader::NumExprFields],
2836 Record[ASTStmtReader::NumExprFields + 1]);
2837 break;
2838
2839 case EXPR_SIZEOF_ALIGN_OF:
2840 S = new (Context) UnaryExprOrTypeTraitExpr(Empty);
2841 break;
2842
2843 case EXPR_ARRAY_SUBSCRIPT:
2844 S = new (Context) ArraySubscriptExpr(Empty);
2845 break;
2846
2847 case EXPR_MATRIX_SUBSCRIPT:
2848 S = new (Context) MatrixSubscriptExpr(Empty);
2849 break;
2850
2851 case EXPR_OMP_ARRAY_SECTION:
2852 S = new (Context) OMPArraySectionExpr(Empty);
2853 break;
2854
2855 case EXPR_OMP_ARRAY_SHAPING:
2856 S = OMPArrayShapingExpr::CreateEmpty(
2857 Context, Record[ASTStmtReader::NumExprFields]);
2858 break;
2859
2860 case EXPR_OMP_ITERATOR:
2861 S = OMPIteratorExpr::CreateEmpty(Context,
2862 Record[ASTStmtReader::NumExprFields]);
2863 break;
2864
2865 case EXPR_CALL:
2866 S = CallExpr::CreateEmpty(
2867 Context, /*NumArgs=*/Record[ASTStmtReader::NumExprFields],
2868 /*HasFPFeatures=*/Record[ASTStmtReader::NumExprFields + 1], Empty);
2869 break;
2870
2871 case EXPR_RECOVERY:
2872 S = RecoveryExpr::CreateEmpty(
2873 Context, /*NumArgs=*/Record[ASTStmtReader::NumExprFields]);
2874 break;
2875
2876 case EXPR_MEMBER:
2877 S = MemberExpr::CreateEmpty(Context, Record[ASTStmtReader::NumExprFields],
2878 Record[ASTStmtReader::NumExprFields + 1],
2879 Record[ASTStmtReader::NumExprFields + 2],
2880 Record[ASTStmtReader::NumExprFields + 3]);
2881 break;
2882
2883 case EXPR_BINARY_OPERATOR:
2884 S = BinaryOperator::CreateEmpty(Context,
2885 Record[ASTStmtReader::NumExprFields]);
2886 break;
2887
2888 case EXPR_COMPOUND_ASSIGN_OPERATOR:
2889 S = CompoundAssignOperator::CreateEmpty(
2890 Context, Record[ASTStmtReader::NumExprFields]);
2891 break;
2892
2893 case EXPR_CONDITIONAL_OPERATOR:
2894 S = new (Context) ConditionalOperator(Empty);
2895 break;
2896
2897 case EXPR_BINARY_CONDITIONAL_OPERATOR:
2898 S = new (Context) BinaryConditionalOperator(Empty);
2899 break;
2900
2901 case EXPR_IMPLICIT_CAST:
2902 S = ImplicitCastExpr::CreateEmpty(
2903 Context,
2904 /*PathSize*/ Record[ASTStmtReader::NumExprFields],
2905 /*HasFPFeatures*/ Record[ASTStmtReader::NumExprFields + 1]);
2906 break;
2907
2908 case EXPR_CSTYLE_CAST:
2909 S = CStyleCastExpr::CreateEmpty(
2910 Context,
2911 /*PathSize*/ Record[ASTStmtReader::NumExprFields],
2912 /*HasFPFeatures*/ Record[ASTStmtReader::NumExprFields + 1]);
2913 break;
2914
2915 case EXPR_COMPOUND_LITERAL:
2916 S = new (Context) CompoundLiteralExpr(Empty);
2917 break;
2918
2919 case EXPR_EXT_VECTOR_ELEMENT:
2920 S = new (Context) ExtVectorElementExpr(Empty);
2921 break;
2922
2923 case EXPR_INIT_LIST:
2924 S = new (Context) InitListExpr(Empty);
2925 break;
2926
2927 case EXPR_DESIGNATED_INIT:
2928 S = DesignatedInitExpr::CreateEmpty(Context,
2929 Record[ASTStmtReader::NumExprFields] - 1);
2930
2931 break;
2932
2933 case EXPR_DESIGNATED_INIT_UPDATE:
2934 S = new (Context) DesignatedInitUpdateExpr(Empty);
2935 break;
2936
2937 case EXPR_IMPLICIT_VALUE_INIT:
2938 S = new (Context) ImplicitValueInitExpr(Empty);
2939 break;
2940
2941 case EXPR_NO_INIT:
2942 S = new (Context) NoInitExpr(Empty);
2943 break;
2944
2945 case EXPR_ARRAY_INIT_LOOP:
2946 S = new (Context) ArrayInitLoopExpr(Empty);
2947 break;
2948
2949 case EXPR_ARRAY_INIT_INDEX:
2950 S = new (Context) ArrayInitIndexExpr(Empty);
2951 break;
2952
2953 case EXPR_VA_ARG:
2954 S = new (Context) VAArgExpr(Empty);
2955 break;
2956
2957 case EXPR_SOURCE_LOC:
2958 S = new (Context) SourceLocExpr(Empty);
2959 break;
2960
2961 case EXPR_ADDR_LABEL:
2962 S = new (Context) AddrLabelExpr(Empty);
2963 break;
2964
2965 case EXPR_STMT:
2966 S = new (Context) StmtExpr(Empty);
2967 break;
2968
2969 case EXPR_CHOOSE:
2970 S = new (Context) ChooseExpr(Empty);
2971 break;
2972
2973 case EXPR_GNU_NULL:
2974 S = new (Context) GNUNullExpr(Empty);
2975 break;
2976
2977 case EXPR_SHUFFLE_VECTOR:
2978 S = new (Context) ShuffleVectorExpr(Empty);
2979 break;
2980
2981 case EXPR_CONVERT_VECTOR:
2982 S = new (Context) ConvertVectorExpr(Empty);
2983 break;
2984
2985 case EXPR_BLOCK:
2986 S = new (Context) BlockExpr(Empty);
2987 break;
2988
2989 case EXPR_GENERIC_SELECTION:
2990 S = GenericSelectionExpr::CreateEmpty(
2991 Context,
2992 /*NumAssocs=*/Record[ASTStmtReader::NumExprFields]);
2993 break;
2994
2995 case EXPR_OBJC_STRING_LITERAL:
2996 S = new (Context) ObjCStringLiteral(Empty);
2997 break;
2998
2999 case EXPR_OBJC_BOXED_EXPRESSION:
3000 S = new (Context) ObjCBoxedExpr(Empty);
3001 break;
3002
3003 case EXPR_OBJC_ARRAY_LITERAL:
3004 S = ObjCArrayLiteral::CreateEmpty(Context,
3005 Record[ASTStmtReader::NumExprFields]);
3006 break;
3007
3008 case EXPR_OBJC_DICTIONARY_LITERAL:
3009 S = ObjCDictionaryLiteral::CreateEmpty(Context,
3010 Record[ASTStmtReader::NumExprFields],
3011 Record[ASTStmtReader::NumExprFields + 1]);
3012 break;
3013
3014 case EXPR_OBJC_ENCODE:
3015 S = new (Context) ObjCEncodeExpr(Empty);
3016 break;
3017
3018 case EXPR_OBJC_SELECTOR_EXPR:
3019 S = new (Context) ObjCSelectorExpr(Empty);
3020 break;
3021
3022 case EXPR_OBJC_PROTOCOL_EXPR:
3023 S = new (Context) ObjCProtocolExpr(Empty);
3024 break;
3025
3026 case EXPR_OBJC_IVAR_REF_EXPR:
3027 S = new (Context) ObjCIvarRefExpr(Empty);
3028 break;
3029
3030 case EXPR_OBJC_PROPERTY_REF_EXPR:
3031 S = new (Context) ObjCPropertyRefExpr(Empty);
3032 break;
3033
3034 case EXPR_OBJC_SUBSCRIPT_REF_EXPR:
3035 S = new (Context) ObjCSubscriptRefExpr(Empty);
3036 break;
3037
3038 case EXPR_OBJC_KVC_REF_EXPR:
3039 llvm_unreachable("mismatching AST file")::llvm::llvm_unreachable_internal("mismatching AST file", "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 3039)
;
3040
3041 case EXPR_OBJC_MESSAGE_EXPR:
3042 S = ObjCMessageExpr::CreateEmpty(Context,
3043 Record[ASTStmtReader::NumExprFields],
3044 Record[ASTStmtReader::NumExprFields + 1]);
3045 break;
3046
3047 case EXPR_OBJC_ISA:
3048 S = new (Context) ObjCIsaExpr(Empty);
3049 break;
3050
3051 case EXPR_OBJC_INDIRECT_COPY_RESTORE:
3052 S = new (Context) ObjCIndirectCopyRestoreExpr(Empty);
3053 break;
3054
3055 case EXPR_OBJC_BRIDGED_CAST:
3056 S = new (Context) ObjCBridgedCastExpr(Empty);
3057 break;
3058
3059 case STMT_OBJC_FOR_COLLECTION:
3060 S = new (Context) ObjCForCollectionStmt(Empty);
3061 break;
3062
3063 case STMT_OBJC_CATCH:
3064 S = new (Context) ObjCAtCatchStmt(Empty);
3065 break;
3066
3067 case STMT_OBJC_FINALLY:
3068 S = new (Context) ObjCAtFinallyStmt(Empty);
3069 break;
3070
3071 case STMT_OBJC_AT_TRY:
3072 S = ObjCAtTryStmt::CreateEmpty(Context,
3073 Record[ASTStmtReader::NumStmtFields],
3074 Record[ASTStmtReader::NumStmtFields + 1]);
3075 break;
3076
3077 case STMT_OBJC_AT_SYNCHRONIZED:
3078 S = new (Context) ObjCAtSynchronizedStmt(Empty);
3079 break;
3080
3081 case STMT_OBJC_AT_THROW:
3082 S = new (Context) ObjCAtThrowStmt(Empty);
3083 break;
3084
3085 case STMT_OBJC_AUTORELEASE_POOL:
3086 S = new (Context) ObjCAutoreleasePoolStmt(Empty);
3087 break;
3088
3089 case EXPR_OBJC_BOOL_LITERAL:
3090 S = new (Context) ObjCBoolLiteralExpr(Empty);
3091 break;
3092
3093 case EXPR_OBJC_AVAILABILITY_CHECK:
3094 S = new (Context) ObjCAvailabilityCheckExpr(Empty);
3095 break;
3096
3097 case STMT_SEH_LEAVE:
3098 S = new (Context) SEHLeaveStmt(Empty);
3099 break;
3100
3101 case STMT_SEH_EXCEPT:
3102 S = new (Context) SEHExceptStmt(Empty);
3103 break;
3104
3105 case STMT_SEH_FINALLY:
3106 S = new (Context) SEHFinallyStmt(Empty);
3107 break;
3108
3109 case STMT_SEH_TRY:
3110 S = new (Context) SEHTryStmt(Empty);
3111 break;
3112
3113 case STMT_CXX_CATCH:
3114 S = new (Context) CXXCatchStmt(Empty);
3115 break;
3116
3117 case STMT_CXX_TRY:
3118 S = CXXTryStmt::Create(Context, Empty,
3119 /*numHandlers=*/Record[ASTStmtReader::NumStmtFields]);
3120 break;
3121
3122 case STMT_CXX_FOR_RANGE:
3123 S = new (Context) CXXForRangeStmt(Empty);
3124 break;
3125
3126 case STMT_MS_DEPENDENT_EXISTS:
3127 S = new (Context) MSDependentExistsStmt(SourceLocation(), true,
3128 NestedNameSpecifierLoc(),
3129 DeclarationNameInfo(),
3130 nullptr);
3131 break;
3132
3133 case STMT_OMP_PARALLEL_DIRECTIVE:
3134 S =
3135 OMPParallelDirective::CreateEmpty(Context,
3136 Record[ASTStmtReader::NumStmtFields],
3137 Empty);
3138 break;
3139
3140 case STMT_OMP_SIMD_DIRECTIVE: {
3141 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3142 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3143 S = OMPSimdDirective::CreateEmpty(Context, NumClauses,
3144 CollapsedNum, Empty);
3145 break;
3146 }
3147
3148 case STMT_OMP_FOR_DIRECTIVE: {
3149 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3150 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3151 S = OMPForDirective::CreateEmpty(Context, NumClauses, CollapsedNum,
3152 Empty);
3153 break;
3154 }
3155
3156 case STMT_OMP_FOR_SIMD_DIRECTIVE: {
3157 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3158 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3159 S = OMPForSimdDirective::CreateEmpty(Context, NumClauses, CollapsedNum,
3160 Empty);
3161 break;
3162 }
3163
3164 case STMT_OMP_SECTIONS_DIRECTIVE:
3165 S = OMPSectionsDirective::CreateEmpty(
3166 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3167 break;
3168
3169 case STMT_OMP_SECTION_DIRECTIVE:
3170 S = OMPSectionDirective::CreateEmpty(Context, Empty);
3171 break;
3172
3173 case STMT_OMP_SINGLE_DIRECTIVE:
3174 S = OMPSingleDirective::CreateEmpty(
3175 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3176 break;
3177
3178 case STMT_OMP_MASTER_DIRECTIVE:
3179 S = OMPMasterDirective::CreateEmpty(Context, Empty);
3180 break;
3181
3182 case STMT_OMP_CRITICAL_DIRECTIVE:
3183 S = OMPCriticalDirective::CreateEmpty(
3184 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3185 break;
3186
3187 case STMT_OMP_PARALLEL_FOR_DIRECTIVE: {
3188 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3189 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3190 S = OMPParallelForDirective::CreateEmpty(Context, NumClauses,
3191 CollapsedNum, Empty);
3192 break;
3193 }
3194
3195 case STMT_OMP_PARALLEL_FOR_SIMD_DIRECTIVE: {
3196 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3197 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3198 S = OMPParallelForSimdDirective::CreateEmpty(Context, NumClauses,
3199 CollapsedNum, Empty);
3200 break;
3201 }
3202
3203 case STMT_OMP_PARALLEL_MASTER_DIRECTIVE:
3204 S = OMPParallelMasterDirective::CreateEmpty(
3205 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3206 break;
3207
3208 case STMT_OMP_PARALLEL_SECTIONS_DIRECTIVE:
3209 S = OMPParallelSectionsDirective::CreateEmpty(
3210 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3211 break;
3212
3213 case STMT_OMP_TASK_DIRECTIVE:
3214 S = OMPTaskDirective::CreateEmpty(
3215 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3216 break;
3217
3218 case STMT_OMP_TASKYIELD_DIRECTIVE:
3219 S = OMPTaskyieldDirective::CreateEmpty(Context, Empty);
3220 break;
3221
3222 case STMT_OMP_BARRIER_DIRECTIVE:
3223 S = OMPBarrierDirective::CreateEmpty(Context, Empty);
3224 break;
3225
3226 case STMT_OMP_TASKWAIT_DIRECTIVE:
3227 S = OMPTaskwaitDirective::CreateEmpty(Context, Empty);
3228 break;
3229
3230 case STMT_OMP_TASKGROUP_DIRECTIVE:
3231 S = OMPTaskgroupDirective::CreateEmpty(
3232 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3233 break;
3234
3235 case STMT_OMP_FLUSH_DIRECTIVE:
3236 S = OMPFlushDirective::CreateEmpty(
3237 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3238 break;
3239
3240 case STMT_OMP_DEPOBJ_DIRECTIVE:
3241 S = OMPDepobjDirective::CreateEmpty(
3242 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3243 break;
3244
3245 case STMT_OMP_SCAN_DIRECTIVE:
3246 S = OMPScanDirective::CreateEmpty(
3247 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3248 break;
3249
3250 case STMT_OMP_ORDERED_DIRECTIVE: {
3251 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
3252 bool HasAssociatedStmt = Record[ASTStmtReader::NumStmtFields + 2];
3253 S = OMPOrderedDirective::CreateEmpty(Context, NumClauses,
3254 !HasAssociatedStmt, Empty);
3255 break;
3256 }
3257
3258 case STMT_OMP_ATOMIC_DIRECTIVE:
3259 S = OMPAtomicDirective::CreateEmpty(
3260 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3261 break;
3262
3263 case STMT_OMP_TARGET_DIRECTIVE:
3264 S = OMPTargetDirective::CreateEmpty(
3265 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3266 break;
3267
3268 case STMT_OMP_TARGET_DATA_DIRECTIVE:
3269 S = OMPTargetDataDirective::CreateEmpty(
3270 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3271 break;
3272
3273 case STMT_OMP_TARGET_ENTER_DATA_DIRECTIVE:
3274 S = OMPTargetEnterDataDirective::CreateEmpty(
3275 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3276 break;
3277
3278 case STMT_OMP_TARGET_EXIT_DATA_DIRECTIVE:
3279 S = OMPTargetExitDataDirective::CreateEmpty(
3280 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3281 break;
3282
3283 case STMT_OMP_TARGET_PARALLEL_DIRECTIVE:
3284 S = OMPTargetParallelDirective::CreateEmpty(
3285 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3286 break;
3287
3288 case STMT_OMP_TARGET_PARALLEL_FOR_DIRECTIVE: {
3289 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3290 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3291 S = OMPTargetParallelForDirective::CreateEmpty(Context, NumClauses,
3292 CollapsedNum, Empty);
3293 break;
3294 }
3295
3296 case STMT_OMP_TARGET_UPDATE_DIRECTIVE:
3297 S = OMPTargetUpdateDirective::CreateEmpty(
3298 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3299 break;
3300
3301 case STMT_OMP_TEAMS_DIRECTIVE:
3302 S = OMPTeamsDirective::CreateEmpty(
3303 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3304 break;
3305
3306 case STMT_OMP_CANCELLATION_POINT_DIRECTIVE:
3307 S = OMPCancellationPointDirective::CreateEmpty(Context, Empty);
3308 break;
3309
3310 case STMT_OMP_CANCEL_DIRECTIVE:
3311 S = OMPCancelDirective::CreateEmpty(
3312 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3313 break;
3314
3315 case STMT_OMP_TASKLOOP_DIRECTIVE: {
3316 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3317 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3318 S = OMPTaskLoopDirective::CreateEmpty(Context, NumClauses, CollapsedNum,
3319 Empty);
3320 break;
3321 }
3322
3323 case STMT_OMP_TASKLOOP_SIMD_DIRECTIVE: {
3324 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3325 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3326 S = OMPTaskLoopSimdDirective::CreateEmpty(Context, NumClauses,
3327 CollapsedNum, Empty);
3328 break;
3329 }
3330
3331 case STMT_OMP_MASTER_TASKLOOP_DIRECTIVE: {
3332 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3333 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3334 S = OMPMasterTaskLoopDirective::CreateEmpty(Context, NumClauses,
3335 CollapsedNum, Empty);
3336 break;
3337 }
3338
3339 case STMT_OMP_MASTER_TASKLOOP_SIMD_DIRECTIVE: {
3340 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3341 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3342 S = OMPMasterTaskLoopSimdDirective::CreateEmpty(Context, NumClauses,
3343 CollapsedNum, Empty);
3344 break;
3345 }
3346
3347 case STMT_OMP_PARALLEL_MASTER_TASKLOOP_DIRECTIVE: {
3348 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3349 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3350 S = OMPParallelMasterTaskLoopDirective::CreateEmpty(Context, NumClauses,
3351 CollapsedNum, Empty);
3352 break;
3353 }
3354
3355 case STMT_OMP_PARALLEL_MASTER_TASKLOOP_SIMD_DIRECTIVE: {
3356 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3357 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3358 S = OMPParallelMasterTaskLoopSimdDirective::CreateEmpty(
3359 Context, NumClauses, CollapsedNum, Empty);
3360 break;
3361 }
3362
3363 case STMT_OMP_DISTRIBUTE_DIRECTIVE: {
3364 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3365 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3366 S = OMPDistributeDirective::CreateEmpty(Context, NumClauses, CollapsedNum,
3367 Empty);
3368 break;
3369 }
3370
3371 case STMT_OMP_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE: {
3372 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3373 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3374 S = OMPDistributeParallelForDirective::CreateEmpty(Context, NumClauses,
3375 CollapsedNum, Empty);
3376 break;
3377 }
3378
3379 case STMT_OMP_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE: {
3380 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3381 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3382 S = OMPDistributeParallelForSimdDirective::CreateEmpty(Context, NumClauses,
3383 CollapsedNum,
3384 Empty);
3385 break;
3386 }
3387
3388 case STMT_OMP_DISTRIBUTE_SIMD_DIRECTIVE: {
3389 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3390 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3391 S = OMPDistributeSimdDirective::CreateEmpty(Context, NumClauses,
3392 CollapsedNum, Empty);
3393 break;
3394 }
3395
3396 case STMT_OMP_TARGET_PARALLEL_FOR_SIMD_DIRECTIVE: {
3397 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3398 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3399 S = OMPTargetParallelForSimdDirective::CreateEmpty(Context, NumClauses,
3400 CollapsedNum, Empty);
3401 break;
3402 }
3403
3404 case STMT_OMP_TARGET_SIMD_DIRECTIVE: {
3405 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3406 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3407 S = OMPTargetSimdDirective::CreateEmpty(Context, NumClauses, CollapsedNum,
3408 Empty);
3409 break;
3410 }
3411
3412 case STMT_OMP_TEAMS_DISTRIBUTE_DIRECTIVE: {
3413 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3414 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3415 S = OMPTeamsDistributeDirective::CreateEmpty(Context, NumClauses,
3416 CollapsedNum, Empty);
3417 break;
3418 }
3419
3420 case STMT_OMP_TEAMS_DISTRIBUTE_SIMD_DIRECTIVE: {
3421 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3422 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3423 S = OMPTeamsDistributeSimdDirective::CreateEmpty(Context, NumClauses,
3424 CollapsedNum, Empty);
3425 break;
3426 }
3427
3428 case STMT_OMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE: {
3429 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3430 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3431 S = OMPTeamsDistributeParallelForSimdDirective::CreateEmpty(
3432 Context, NumClauses, CollapsedNum, Empty);
3433 break;
3434 }
3435
3436 case STMT_OMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE: {
3437 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3438 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3439 S = OMPTeamsDistributeParallelForDirective::CreateEmpty(
3440 Context, NumClauses, CollapsedNum, Empty);
3441 break;
3442 }
3443
3444 case STMT_OMP_TARGET_TEAMS_DIRECTIVE:
3445 S = OMPTargetTeamsDirective::CreateEmpty(
3446 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3447 break;
3448
3449 case STMT_OMP_TARGET_TEAMS_DISTRIBUTE_DIRECTIVE: {
3450 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3451 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3452 S = OMPTargetTeamsDistributeDirective::CreateEmpty(Context, NumClauses,
3453 CollapsedNum, Empty);
3454 break;
3455 }
3456
3457 case STMT_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE: {
3458 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3459 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3460 S = OMPTargetTeamsDistributeParallelForDirective::CreateEmpty(
3461 Context, NumClauses, CollapsedNum, Empty);
3462 break;
3463 }
3464
3465 case STMT_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE: {
3466 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3467 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3468 S = OMPTargetTeamsDistributeParallelForSimdDirective::CreateEmpty(
3469 Context, NumClauses, CollapsedNum, Empty);
3470 break;
3471 }
3472
3473 case STMT_OMP_TARGET_TEAMS_DISTRIBUTE_SIMD_DIRECTIVE: {
3474 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3475 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3476 S = OMPTargetTeamsDistributeSimdDirective::CreateEmpty(
3477 Context, NumClauses, CollapsedNum, Empty);
3478 break;
3479 }
3480
3481 case EXPR_CXX_OPERATOR_CALL:
3482 S = CXXOperatorCallExpr::CreateEmpty(
3483 Context, /*NumArgs=*/Record[ASTStmtReader::NumExprFields],
3484 /*HasFPFeatures=*/Record[ASTStmtReader::NumExprFields + 1], Empty);
3485 break;
3486
3487 case EXPR_CXX_MEMBER_CALL:
3488 S = CXXMemberCallExpr::CreateEmpty(
3489 Context, /*NumArgs=*/Record[ASTStmtReader::NumExprFields],
3490 /*HasFPFeatures=*/Record[ASTStmtReader::NumExprFields + 1], Empty);
3491 break;
3492
3493 case EXPR_CXX_REWRITTEN_BINARY_OPERATOR:
3494 S = new (Context) CXXRewrittenBinaryOperator(Empty);
3495 break;
3496
3497 case EXPR_CXX_CONSTRUCT:
3498 S = CXXConstructExpr::CreateEmpty(
3499 Context,
3500 /* NumArgs=*/Record[ASTStmtReader::NumExprFields]);
3501 break;
3502
3503 case EXPR_CXX_INHERITED_CTOR_INIT:
3504 S = new (Context) CXXInheritedCtorInitExpr(Empty);
3505 break;
3506
3507 case EXPR_CXX_TEMPORARY_OBJECT:
3508 S = CXXTemporaryObjectExpr::CreateEmpty(
3509 Context,
3510 /* NumArgs=*/Record[ASTStmtReader::NumExprFields]);
3511 break;
3512
3513 case EXPR_CXX_STATIC_CAST:
3514 S = CXXStaticCastExpr::CreateEmpty(
3515 Context,
3516 /*PathSize*/ Record[ASTStmtReader::NumExprFields],
3517 /*HasFPFeatures*/ Record[ASTStmtReader::NumExprFields + 1]);
3518 break;
3519
3520 case EXPR_CXX_DYNAMIC_CAST:
3521 S = CXXDynamicCastExpr::CreateEmpty(Context,
3522 /*PathSize*/ Record[ASTStmtReader::NumExprFields]);
3523 break;
3524
3525 case EXPR_CXX_REINTERPRET_CAST:
3526 S = CXXReinterpretCastExpr::CreateEmpty(Context,
3527 /*PathSize*/ Record[ASTStmtReader::NumExprFields]);
3528 break;
3529
3530 case EXPR_CXX_CONST_CAST:
3531 S = CXXConstCastExpr::CreateEmpty(Context);
3532 break;
3533
3534 case EXPR_CXX_ADDRSPACE_CAST:
3535 S = CXXAddrspaceCastExpr::CreateEmpty(Context);
3536 break;
3537
3538 case EXPR_CXX_FUNCTIONAL_CAST:
3539 S = CXXFunctionalCastExpr::CreateEmpty(
3540 Context,
3541 /*PathSize*/ Record[ASTStmtReader::NumExprFields],
3542 /*HasFPFeatures*/ Record[ASTStmtReader::NumExprFields + 1]);
3543 break;
3544
3545 case EXPR_BUILTIN_BIT_CAST:
3546 assert(Record[ASTStmtReader::NumExprFields] == 0 && "Wrong PathSize!")((Record[ASTStmtReader::NumExprFields] == 0 && "Wrong PathSize!"
) ? static_cast<void> (0) : __assert_fail ("Record[ASTStmtReader::NumExprFields] == 0 && \"Wrong PathSize!\""
, "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 3546, __PRETTY_FUNCTION__))
;
3547 S = new (Context) BuiltinBitCastExpr(Empty);
3548 break;
3549
3550 case EXPR_USER_DEFINED_LITERAL:
3551 S = UserDefinedLiteral::CreateEmpty(
3552 Context, /*NumArgs=*/Record[ASTStmtReader::NumExprFields],
3553 /*HasFPFeatures=*/Record[ASTStmtReader::NumExprFields + 1], Empty);
3554 break;
3555
3556 case EXPR_CXX_STD_INITIALIZER_LIST:
3557 S = new (Context) CXXStdInitializerListExpr(Empty);
3558 break;
3559
3560 case EXPR_CXX_BOOL_LITERAL:
3561 S = new (Context) CXXBoolLiteralExpr(Empty);
3562 break;
3563
3564 case EXPR_CXX_NULL_PTR_LITERAL:
3565 S = new (Context) CXXNullPtrLiteralExpr(Empty);
3566 break;
3567
3568 case EXPR_CXX_TYPEID_EXPR:
3569 S = new (Context) CXXTypeidExpr(Empty, true);
3570 break;
3571
3572 case EXPR_CXX_TYPEID_TYPE:
3573 S = new (Context) CXXTypeidExpr(Empty, false);
3574 break;
3575
3576 case EXPR_CXX_UUIDOF_EXPR:
3577 S = new (Context) CXXUuidofExpr(Empty, true);
3578 break;
3579
3580 case EXPR_CXX_PROPERTY_REF_EXPR:
3581 S = new (Context) MSPropertyRefExpr(Empty);
3582 break;
3583
3584 case EXPR_CXX_PROPERTY_SUBSCRIPT_EXPR:
3585 S = new (Context) MSPropertySubscriptExpr(Empty);
3586 break;
3587
3588 case EXPR_CXX_UUIDOF_TYPE:
3589 S = new (Context) CXXUuidofExpr(Empty, false);
3590 break;
3591
3592 case EXPR_CXX_THIS:
3593 S = new (Context) CXXThisExpr(Empty);
3594 break;
3595
3596 case EXPR_CXX_THROW:
3597 S = new (Context) CXXThrowExpr(Empty);
3598 break;
3599
3600 case EXPR_CXX_DEFAULT_ARG:
3601 S = new (Context) CXXDefaultArgExpr(Empty);
3602 break;
3603
3604 case EXPR_CXX_DEFAULT_INIT:
3605 S = new (Context) CXXDefaultInitExpr(Empty);
3606 break;
3607
3608 case EXPR_CXX_BIND_TEMPORARY:
3609 S = new (Context) CXXBindTemporaryExpr(Empty);
3610 break;
3611
3612 case EXPR_CXX_SCALAR_VALUE_INIT:
3613 S = new (Context) CXXScalarValueInitExpr(Empty);
3614 break;
3615
3616 case EXPR_CXX_NEW:
3617 S = CXXNewExpr::CreateEmpty(
3618 Context,
3619 /*IsArray=*/Record[ASTStmtReader::NumExprFields],
3620 /*HasInit=*/Record[ASTStmtReader::NumExprFields + 1],
3621 /*NumPlacementArgs=*/Record[ASTStmtReader::NumExprFields + 2],
3622 /*IsParenTypeId=*/Record[ASTStmtReader::NumExprFields + 3]);
3623 break;
3624
3625 case EXPR_CXX_DELETE:
3626 S = new (Context) CXXDeleteExpr(Empty);
3627 break;
3628
3629 case EXPR_CXX_PSEUDO_DESTRUCTOR:
3630 S = new (Context) CXXPseudoDestructorExpr(Empty);
3631 break;
3632
3633 case EXPR_EXPR_WITH_CLEANUPS:
3634 S = ExprWithCleanups::Create(Context, Empty,
3635 Record[ASTStmtReader::NumExprFields]);
3636 break;
3637
3638 case EXPR_CXX_DEPENDENT_SCOPE_MEMBER:
3639 S = CXXDependentScopeMemberExpr::CreateEmpty(
3640 Context,
3641 /*HasTemplateKWAndArgsInfo=*/Record[ASTStmtReader::NumExprFields],
3642 /*NumTemplateArgs=*/Record[ASTStmtReader::NumExprFields + 1],
3643 /*HasFirstQualifierFoundInScope=*/
3644 Record[ASTStmtReader::NumExprFields + 2]);
3645 break;
3646
3647 case EXPR_CXX_DEPENDENT_SCOPE_DECL_REF:
3648 S = DependentScopeDeclRefExpr::CreateEmpty(Context,
3649 /*HasTemplateKWAndArgsInfo=*/Record[ASTStmtReader::NumExprFields],
3650 /*NumTemplateArgs=*/Record[ASTStmtReader::NumExprFields]
3651 ? Record[ASTStmtReader::NumExprFields + 1]
3652 : 0);
3653 break;
3654
3655 case EXPR_CXX_UNRESOLVED_CONSTRUCT:
3656 S = CXXUnresolvedConstructExpr::CreateEmpty(Context,
3657 /*NumArgs=*/Record[ASTStmtReader::NumExprFields]);
3658 break;
3659
3660 case EXPR_CXX_UNRESOLVED_MEMBER:
3661 S = UnresolvedMemberExpr::CreateEmpty(
3662 Context,
3663 /*NumResults=*/Record[ASTStmtReader::NumExprFields],
3664 /*HasTemplateKWAndArgsInfo=*/Record[ASTStmtReader::NumExprFields + 1],
3665 /*NumTemplateArgs=*/
3666 Record[ASTStmtReader::NumExprFields + 1]
3667 ? Record[ASTStmtReader::NumExprFields + 2]
3668 : 0);
3669 break;
3670
3671 case EXPR_CXX_UNRESOLVED_LOOKUP:
3672 S = UnresolvedLookupExpr::CreateEmpty(
3673 Context,
3674 /*NumResults=*/Record[ASTStmtReader::NumExprFields],
3675 /*HasTemplateKWAndArgsInfo=*/Record[ASTStmtReader::NumExprFields + 1],
3676 /*NumTemplateArgs=*/
3677 Record[ASTStmtReader::NumExprFields + 1]
3678 ? Record[ASTStmtReader::NumExprFields + 2]
3679 : 0);
3680 break;
3681
3682 case EXPR_TYPE_TRAIT:
3683 S = TypeTraitExpr::CreateDeserialized(Context,
3684 Record[ASTStmtReader::NumExprFields]);
3685 break;
3686
3687 case EXPR_ARRAY_TYPE_TRAIT:
3688 S = new (Context) ArrayTypeTraitExpr(Empty);
3689 break;
3690
3691 case EXPR_CXX_EXPRESSION_TRAIT:
3692 S = new (Context) ExpressionTraitExpr(Empty);
3693 break;
3694
3695 case EXPR_CXX_NOEXCEPT:
3696 S = new (Context) CXXNoexceptExpr(Empty);
3697 break;
3698
3699 case EXPR_PACK_EXPANSION:
3700 S = new (Context) PackExpansionExpr(Empty);
3701 break;
3702
3703 case EXPR_SIZEOF_PACK:
3704 S = SizeOfPackExpr::CreateDeserialized(
3705 Context,
3706 /*NumPartialArgs=*/Record[ASTStmtReader::NumExprFields]);
3707 break;
3708
3709 case EXPR_SUBST_NON_TYPE_TEMPLATE_PARM:
3710 S = new (Context) SubstNonTypeTemplateParmExpr(Empty);
3711 break;
3712
3713 case EXPR_SUBST_NON_TYPE_TEMPLATE_PARM_PACK:
3714 S = new (Context) SubstNonTypeTemplateParmPackExpr(Empty);
3715 break;
3716
3717 case EXPR_FUNCTION_PARM_PACK:
3718 S = FunctionParmPackExpr::CreateEmpty(Context,
3719 Record[ASTStmtReader::NumExprFields]);
3720 break;
3721
3722 case EXPR_MATERIALIZE_TEMPORARY:
3723 S = new (Context) MaterializeTemporaryExpr(Empty);
3724 break;
3725
3726 case EXPR_CXX_FOLD:
3727 S = new (Context) CXXFoldExpr(Empty);
3728 break;
3729
3730 case EXPR_OPAQUE_VALUE:
3731 S = new (Context) OpaqueValueExpr(Empty);
3732 break;
3733
3734 case EXPR_CUDA_KERNEL_CALL:
3735 S = CUDAKernelCallExpr::CreateEmpty(
3736 Context, /*NumArgs=*/Record[ASTStmtReader::NumExprFields],
3737 /*HasFPFeatures=*/Record[ASTStmtReader::NumExprFields + 1], Empty);
3738 break;
3739
3740 case EXPR_ASTYPE:
3741 S = new (Context) AsTypeExpr(Empty);
3742 break;
3743
3744 case EXPR_PSEUDO_OBJECT: {
3745 unsigned numSemanticExprs = Record[ASTStmtReader::NumExprFields];
3746 S = PseudoObjectExpr::Create(Context, Empty, numSemanticExprs);
3747 break;
3748 }
3749
3750 case EXPR_ATOMIC:
3751 S = new (Context) AtomicExpr(Empty);
3752 break;
3753
3754 case EXPR_LAMBDA: {
3755 unsigned NumCaptures = Record[ASTStmtReader::NumExprFields];
3756 S = LambdaExpr::CreateDeserialized(Context, NumCaptures);
3757 break;
3758 }
3759
3760 case STMT_COROUTINE_BODY: {
3761 unsigned NumParams = Record[ASTStmtReader::NumStmtFields];
3762 S = CoroutineBodyStmt::Create(Context, Empty, NumParams);
3763 break;
3764 }
3765
3766 case STMT_CORETURN:
3767 S = new (Context) CoreturnStmt(Empty);
3768 break;
3769
3770 case EXPR_COAWAIT:
3771 S = new (Context) CoawaitExpr(Empty);
3772 break;
3773
3774 case EXPR_COYIELD:
3775 S = new (Context) CoyieldExpr(Empty);
3776 break;
3777
3778 case EXPR_DEPENDENT_COAWAIT:
3779 S = new (Context) DependentCoawaitExpr(Empty);
3780 break;
3781
3782 case EXPR_CONCEPT_SPECIALIZATION: {
3783 unsigned numTemplateArgs = Record[ASTStmtReader::NumExprFields];
3784 S = ConceptSpecializationExpr::Create(Context, Empty, numTemplateArgs);
3785 break;
3786 }
3787
3788 case EXPR_REQUIRES:
3789 unsigned numLocalParameters = Record[ASTStmtReader::NumExprFields];
3790 unsigned numRequirement = Record[ASTStmtReader::NumExprFields + 1];
3791 S = RequiresExpr::Create(Context, Empty, numLocalParameters,
3792 numRequirement);
3793 break;
3794 }
3795
3796 // We hit a STMT_STOP, so we're done with this expression.
3797 if (Finished)
3798 break;
3799
3800 ++NumStatementsRead;
3801
3802 if (S && !IsStmtReference) {
3803 Reader.Visit(S);
3804 StmtEntries[Cursor.GetCurrentBitNo()] = S;
3805 }
3806
3807 assert(Record.getIdx() == Record.size() &&((Record.getIdx() == Record.size() && "Invalid deserialization of statement"
) ? static_cast<void> (0) : __assert_fail ("Record.getIdx() == Record.size() && \"Invalid deserialization of statement\""
, "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 3808, __PRETTY_FUNCTION__))
3808 "Invalid deserialization of statement")((Record.getIdx() == Record.size() && "Invalid deserialization of statement"
) ? static_cast<void> (0) : __assert_fail ("Record.getIdx() == Record.size() && \"Invalid deserialization of statement\""
, "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 3808, __PRETTY_FUNCTION__))
;
3809 StmtStack.push_back(S);
3810 }
3811Done:
3812 assert(StmtStack.size() > PrevNumStmts && "Read too many sub-stmts!")((StmtStack.size() > PrevNumStmts && "Read too many sub-stmts!"
) ? static_cast<void> (0) : __assert_fail ("StmtStack.size() > PrevNumStmts && \"Read too many sub-stmts!\""
, "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 3812, __PRETTY_FUNCTION__))
;
3813 assert(StmtStack.size() == PrevNumStmts + 1 && "Extra expressions on stack!")((StmtStack.size() == PrevNumStmts + 1 && "Extra expressions on stack!"
) ? static_cast<void> (0) : __assert_fail ("StmtStack.size() == PrevNumStmts + 1 && \"Extra expressions on stack!\""
, "/build/llvm-toolchain-snapshot-12~++20201129111111+e987fbdd85d/clang/lib/Serialization/ASTReaderStmt.cpp"
, 3813, __PRETTY_FUNCTION__))
;
3814 return StmtStack.pop_back_val();
3815}