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 CLANG_VENDOR="Debian " -D _DEBUG -D _GNU_SOURCE -D __STDC_CONSTANT_MACROS -D __STDC_FORMAT_MACROS -D __STDC_LIMIT_MACROS -I /build/llvm-toolchain-snapshot-12~++20200917111122+b03c2b8395b/build-llvm/tools/clang/lib/Serialization -I /build/llvm-toolchain-snapshot-12~++20200917111122+b03c2b8395b/clang/lib/Serialization -I /build/llvm-toolchain-snapshot-12~++20200917111122+b03c2b8395b/clang/include -I /build/llvm-toolchain-snapshot-12~++20200917111122+b03c2b8395b/build-llvm/tools/clang/include -I /build/llvm-toolchain-snapshot-12~++20200917111122+b03c2b8395b/build-llvm/include -I /build/llvm-toolchain-snapshot-12~++20200917111122+b03c2b8395b/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~++20200917111122+b03c2b8395b/build-llvm/tools/clang/lib/Serialization -fdebug-prefix-map=/build/llvm-toolchain-snapshot-12~++20200917111122+b03c2b8395b=. -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-09-17-195756-12974-1 -x c++ /build/llvm-toolchain-snapshot-12~++20200917111122+b03c2b8395b/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~++20200917111122+b03c2b8395b/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~++20200917111122+b03c2b8395b/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~++20200917111122+b03c2b8395b/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~++20200917111122+b03c2b8395b/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~++20200917111122+b03c2b8395b/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~++20200917111122+b03c2b8395b/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~++20200917111122+b03c2b8395b/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~++20200917111122+b03c2b8395b/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~++20200917111122+b03c2b8395b/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~++20200917111122+b03c2b8395b/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~++20200917111122+b03c2b8395b/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~++20200917111122+b03c2b8395b/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~++20200917111122+b03c2b8395b/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~++20200917111122+b03c2b8395b/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~++20200917111122+b03c2b8395b/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~++20200917111122+b03c2b8395b/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~++20200917111122+b03c2b8395b/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~++20200917111122+b03c2b8395b/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~++20200917111122+b03c2b8395b/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~++20200917111122+b03c2b8395b/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~++20200917111122+b03c2b8395b/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~++20200917111122+b03c2b8395b/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~++20200917111122+b03c2b8395b/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~++20200917111122+b03c2b8395b/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~++20200917111122+b03c2b8395b/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~++20200917111122+b03c2b8395b/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~++20200917111122+b03c2b8395b/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~++20200917111122+b03c2b8395b/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~++20200917111122+b03c2b8395b/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~++20200917111122+b03c2b8395b/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~++20200917111122+b03c2b8395b/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~++20200917111122+b03c2b8395b/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~++20200917111122+b03c2b8395b/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~++20200917111122+b03c2b8395b/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~++20200917111122+b03c2b8395b/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~++20200917111122+b03c2b8395b/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~++20200917111122+b03c2b8395b/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~++20200917111122+b03c2b8395b/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~++20200917111122+b03c2b8395b/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~++20200917111122+b03c2b8395b/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~++20200917111122+b03c2b8395b/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~++20200917111122+b03c2b8395b/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~++20200917111122+b03c2b8395b/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~++20200917111122+b03c2b8395b/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~++20200917111122+b03c2b8395b/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~++20200917111122+b03c2b8395b/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~++20200917111122+b03c2b8395b/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~++20200917111122+b03c2b8395b/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~++20200917111122+b03c2b8395b/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->arg_size() &&((Record.peekInt() == E->arg_size() && "Read wrong record during creation ?"
) ? static_cast<void> (0) : __assert_fail ("Record.peekInt() == E->arg_size() && \"Read wrong record during creation ?\""
, "/build/llvm-toolchain-snapshot-12~++20200917111122+b03c2b8395b/clang/lib/Serialization/ASTReaderStmt.cpp"
, 1994, __PRETTY_FUNCTION__))
1994 "Read wrong record during creation ?")((Record.peekInt() == E->arg_size() && "Read wrong record during creation ?"
) ? static_cast<void> (0) : __assert_fail ("Record.peekInt() == E->arg_size() && \"Read wrong record during creation ?\""
, "/build/llvm-toolchain-snapshot-12~++20200917111122+b03c2b8395b/clang/lib/Serialization/ASTReaderStmt.cpp"
, 1994, __PRETTY_FUNCTION__))
;
1995 Record.skipInts(1);
1996 for (unsigned I = 0, N = E->arg_size(); 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~++20200917111122+b03c2b8395b/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~++20200917111122+b03c2b8395b/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~++20200917111122+b03c2b8395b/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~++20200917111122+b03c2b8395b/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~++20200917111122+b03c2b8395b/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~++20200917111122+b03c2b8395b/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->Param = readDeclAs<NonTypeTemplateParmDecl>();
2125 E->SubstNonTypeTemplateParmExprBits.NameLoc = readSourceLocation();
2126 E->Replacement = Record.readSubExpr();
2127}
2128
2129void ASTStmtReader::VisitSubstNonTypeTemplateParmPackExpr(
2130 SubstNonTypeTemplateParmPackExpr *E) {
2131 VisitExpr(E);
2132 E->Param = readDeclAs<NonTypeTemplateParmDecl>();
2133 TemplateArgument ArgPack = Record.readTemplateArgument();
2134 if (ArgPack.getKind() != TemplateArgument::Pack)
2135 return;
2136
2137 E->Arguments = ArgPack.pack_begin();
2138 E->NumArguments = ArgPack.pack_size();
2139 E->NameLoc = readSourceLocation();
2140}
2141
2142void ASTStmtReader::VisitFunctionParmPackExpr(FunctionParmPackExpr *E) {
2143 VisitExpr(E);
2144 E->NumParameters = Record.readInt();
2145 E->ParamPack = readDeclAs<ParmVarDecl>();
2146 E->NameLoc = readSourceLocation();
2147 auto **Parms = E->getTrailingObjects<VarDecl *>();
2148 for (unsigned i = 0, n = E->NumParameters; i != n; ++i)
2149 Parms[i] = readDeclAs<VarDecl>();
2150}
2151
2152void ASTStmtReader::VisitMaterializeTemporaryExpr(MaterializeTemporaryExpr *E) {
2153 VisitExpr(E);
2154 bool HasMaterialzedDecl = Record.readInt();
2155 if (HasMaterialzedDecl)
2156 E->State = cast<LifetimeExtendedTemporaryDecl>(Record.readDecl());
2157 else
2158 E->State = Record.readSubExpr();
2159}
2160
2161void ASTStmtReader::VisitCXXFoldExpr(CXXFoldExpr *E) {
2162 VisitExpr(E);
2163 E->LParenLoc = readSourceLocation();
2164 E->EllipsisLoc = readSourceLocation();
2165 E->RParenLoc = readSourceLocation();
2166 E->NumExpansions = Record.readInt();
2167 E->SubExprs[0] = Record.readSubExpr();
2168 E->SubExprs[1] = Record.readSubExpr();
2169 E->SubExprs[2] = Record.readSubExpr();
2170 E->Opcode = (BinaryOperatorKind)Record.readInt();
2171}
2172
2173void ASTStmtReader::VisitOpaqueValueExpr(OpaqueValueExpr *E) {
2174 VisitExpr(E);
2175 E->SourceExpr = Record.readSubExpr();
2176 E->OpaqueValueExprBits.Loc = readSourceLocation();
2177 E->setIsUnique(Record.readInt());
2178}
2179
2180void ASTStmtReader::VisitTypoExpr(TypoExpr *E) {
2181 llvm_unreachable("Cannot read TypoExpr nodes")::llvm::llvm_unreachable_internal("Cannot read TypoExpr nodes"
, "/build/llvm-toolchain-snapshot-12~++20200917111122+b03c2b8395b/clang/lib/Serialization/ASTReaderStmt.cpp"
, 2181)
;
2182}
2183
2184void ASTStmtReader::VisitRecoveryExpr(RecoveryExpr *E) {
2185 VisitExpr(E);
2186 unsigned NumArgs = Record.readInt();
2187 E->BeginLoc = readSourceLocation();
2188 E->EndLoc = readSourceLocation();
2189 assert((((NumArgs == std::distance(E->children().begin(), E->children
().end())) && "Wrong NumArgs!") ? static_cast<void
> (0) : __assert_fail ("(NumArgs == std::distance(E->children().begin(), E->children().end())) && \"Wrong NumArgs!\""
, "/build/llvm-toolchain-snapshot-12~++20200917111122+b03c2b8395b/clang/lib/Serialization/ASTReaderStmt.cpp"
, 2191, __PRETTY_FUNCTION__))
2190 (NumArgs == std::distance(E->children().begin(), E->children().end())) &&(((NumArgs == std::distance(E->children().begin(), E->children
().end())) && "Wrong NumArgs!") ? static_cast<void
> (0) : __assert_fail ("(NumArgs == std::distance(E->children().begin(), E->children().end())) && \"Wrong NumArgs!\""
, "/build/llvm-toolchain-snapshot-12~++20200917111122+b03c2b8395b/clang/lib/Serialization/ASTReaderStmt.cpp"
, 2191, __PRETTY_FUNCTION__))
2191 "Wrong NumArgs!")(((NumArgs == std::distance(E->children().begin(), E->children
().end())) && "Wrong NumArgs!") ? static_cast<void
> (0) : __assert_fail ("(NumArgs == std::distance(E->children().begin(), E->children().end())) && \"Wrong NumArgs!\""
, "/build/llvm-toolchain-snapshot-12~++20200917111122+b03c2b8395b/clang/lib/Serialization/ASTReaderStmt.cpp"
, 2191, __PRETTY_FUNCTION__))
;
2192 (void)NumArgs;
2193 for (Stmt *&Child : E->children())
2194 Child = Record.readSubStmt();
2195}
2196
2197//===----------------------------------------------------------------------===//
2198// Microsoft Expressions and Statements
2199//===----------------------------------------------------------------------===//
2200void ASTStmtReader::VisitMSPropertyRefExpr(MSPropertyRefExpr *E) {
2201 VisitExpr(E);
2202 E->IsArrow = (Record.readInt() != 0);
2203 E->BaseExpr = Record.readSubExpr();
2204 E->QualifierLoc = Record.readNestedNameSpecifierLoc();
2205 E->MemberLoc = readSourceLocation();
2206 E->TheDecl = readDeclAs<MSPropertyDecl>();
2207}
2208
2209void ASTStmtReader::VisitMSPropertySubscriptExpr(MSPropertySubscriptExpr *E) {
2210 VisitExpr(E);
2211 E->setBase(Record.readSubExpr());
2212 E->setIdx(Record.readSubExpr());
2213 E->setRBracketLoc(readSourceLocation());
2214}
2215
2216void ASTStmtReader::VisitCXXUuidofExpr(CXXUuidofExpr *E) {
2217 VisitExpr(E);
2218 E->setSourceRange(readSourceRange());
2219 E->Guid = readDeclAs<MSGuidDecl>();
2220 if (E->isTypeOperand())
2221 E->Operand = readTypeSourceInfo();
2222 else
2223 E->Operand = Record.readSubExpr();
2224}
2225
2226void ASTStmtReader::VisitSEHLeaveStmt(SEHLeaveStmt *S) {
2227 VisitStmt(S);
2228 S->setLeaveLoc(readSourceLocation());
2229}
2230
2231void ASTStmtReader::VisitSEHExceptStmt(SEHExceptStmt *S) {
2232 VisitStmt(S);
2233 S->Loc = readSourceLocation();
2234 S->Children[SEHExceptStmt::FILTER_EXPR] = Record.readSubStmt();
2235 S->Children[SEHExceptStmt::BLOCK] = Record.readSubStmt();
2236}
2237
2238void ASTStmtReader::VisitSEHFinallyStmt(SEHFinallyStmt *S) {
2239 VisitStmt(S);
2240 S->Loc = readSourceLocation();
2241 S->Block = Record.readSubStmt();
2242}
2243
2244void ASTStmtReader::VisitSEHTryStmt(SEHTryStmt *S) {
2245 VisitStmt(S);
2246 S->IsCXXTry = Record.readInt();
2247 S->TryLoc = readSourceLocation();
2248 S->Children[SEHTryStmt::TRY] = Record.readSubStmt();
2249 S->Children[SEHTryStmt::HANDLER] = Record.readSubStmt();
2250}
2251
2252//===----------------------------------------------------------------------===//
2253// CUDA Expressions and Statements
2254//===----------------------------------------------------------------------===//
2255
2256void ASTStmtReader::VisitCUDAKernelCallExpr(CUDAKernelCallExpr *E) {
2257 VisitCallExpr(E);
2258 E->setPreArg(CUDAKernelCallExpr::CONFIG, Record.readSubExpr());
2259}
2260
2261//===----------------------------------------------------------------------===//
2262// OpenCL Expressions and Statements.
2263//===----------------------------------------------------------------------===//
2264void ASTStmtReader::VisitAsTypeExpr(AsTypeExpr *E) {
2265 VisitExpr(E);
2266 E->BuiltinLoc = readSourceLocation();
2267 E->RParenLoc = readSourceLocation();
2268 E->SrcExpr = Record.readSubExpr();
2269}
2270
2271//===----------------------------------------------------------------------===//
2272// OpenMP Directives.
2273//===----------------------------------------------------------------------===//
2274
2275void ASTStmtReader::VisitOMPExecutableDirective(OMPExecutableDirective *E) {
2276 Record.readOMPChildren(E->Data);
2277 E->setLocStart(readSourceLocation());
2278 E->setLocEnd(readSourceLocation());
2279}
2280
2281void ASTStmtReader::VisitOMPLoopDirective(OMPLoopDirective *D) {
2282 VisitStmt(D);
2283 // Field CollapsedNum was read in ReadStmtFromStream.
2284 Record.skipInts(1);
2285 VisitOMPExecutableDirective(D);
2286}
2287
2288void ASTStmtReader::VisitOMPParallelDirective(OMPParallelDirective *D) {
2289 VisitStmt(D);
2290 VisitOMPExecutableDirective(D);
2291 D->setHasCancel(Record.readBool());
2292}
2293
2294void ASTStmtReader::VisitOMPSimdDirective(OMPSimdDirective *D) {
2295 VisitOMPLoopDirective(D);
2296}
2297
2298void ASTStmtReader::VisitOMPForDirective(OMPForDirective *D) {
2299 VisitOMPLoopDirective(D);
2300 D->setHasCancel(Record.readBool());
2301}
2302
2303void ASTStmtReader::VisitOMPForSimdDirective(OMPForSimdDirective *D) {
2304 VisitOMPLoopDirective(D);
2305}
2306
2307void ASTStmtReader::VisitOMPSectionsDirective(OMPSectionsDirective *D) {
2308 VisitStmt(D);
2309 VisitOMPExecutableDirective(D);
2310 D->setHasCancel(Record.readBool());
2311}
2312
2313void ASTStmtReader::VisitOMPSectionDirective(OMPSectionDirective *D) {
2314 VisitStmt(D);
2315 VisitOMPExecutableDirective(D);
2316 D->setHasCancel(Record.readBool());
2317}
2318
2319void ASTStmtReader::VisitOMPSingleDirective(OMPSingleDirective *D) {
2320 VisitStmt(D);
2321 VisitOMPExecutableDirective(D);
2322}
2323
2324void ASTStmtReader::VisitOMPMasterDirective(OMPMasterDirective *D) {
2325 VisitStmt(D);
2326 VisitOMPExecutableDirective(D);
2327}
2328
2329void ASTStmtReader::VisitOMPCriticalDirective(OMPCriticalDirective *D) {
2330 VisitStmt(D);
2331 VisitOMPExecutableDirective(D);
2332 D->DirName = Record.readDeclarationNameInfo();
2333}
2334
2335void ASTStmtReader::VisitOMPParallelForDirective(OMPParallelForDirective *D) {
2336 VisitOMPLoopDirective(D);
2337 D->setHasCancel(Record.readBool());
2338}
2339
2340void ASTStmtReader::VisitOMPParallelForSimdDirective(
2341 OMPParallelForSimdDirective *D) {
2342 VisitOMPLoopDirective(D);
2343}
2344
2345void ASTStmtReader::VisitOMPParallelMasterDirective(
2346 OMPParallelMasterDirective *D) {
2347 VisitStmt(D);
2348 VisitOMPExecutableDirective(D);
2349}
2350
2351void ASTStmtReader::VisitOMPParallelSectionsDirective(
2352 OMPParallelSectionsDirective *D) {
2353 VisitStmt(D);
2354 VisitOMPExecutableDirective(D);
2355 D->setHasCancel(Record.readBool());
2356}
2357
2358void ASTStmtReader::VisitOMPTaskDirective(OMPTaskDirective *D) {
2359 VisitStmt(D);
2360 VisitOMPExecutableDirective(D);
2361 D->setHasCancel(Record.readBool());
2362}
2363
2364void ASTStmtReader::VisitOMPTaskyieldDirective(OMPTaskyieldDirective *D) {
2365 VisitStmt(D);
2366 VisitOMPExecutableDirective(D);
2367}
2368
2369void ASTStmtReader::VisitOMPBarrierDirective(OMPBarrierDirective *D) {
2370 VisitStmt(D);
2371 VisitOMPExecutableDirective(D);
2372}
2373
2374void ASTStmtReader::VisitOMPTaskwaitDirective(OMPTaskwaitDirective *D) {
2375 VisitStmt(D);
2376 VisitOMPExecutableDirective(D);
2377}
2378
2379void ASTStmtReader::VisitOMPTaskgroupDirective(OMPTaskgroupDirective *D) {
2380 VisitStmt(D);
2381 VisitOMPExecutableDirective(D);
2382}
2383
2384void ASTStmtReader::VisitOMPFlushDirective(OMPFlushDirective *D) {
2385 VisitStmt(D);
2386 VisitOMPExecutableDirective(D);
2387}
2388
2389void ASTStmtReader::VisitOMPDepobjDirective(OMPDepobjDirective *D) {
2390 VisitStmt(D);
2391 VisitOMPExecutableDirective(D);
2392}
2393
2394void ASTStmtReader::VisitOMPScanDirective(OMPScanDirective *D) {
2395 VisitStmt(D);
2396 VisitOMPExecutableDirective(D);
2397}
2398
2399void ASTStmtReader::VisitOMPOrderedDirective(OMPOrderedDirective *D) {
2400 VisitStmt(D);
2401 VisitOMPExecutableDirective(D);
2402}
2403
2404void ASTStmtReader::VisitOMPAtomicDirective(OMPAtomicDirective *D) {
2405 VisitStmt(D);
2406 VisitOMPExecutableDirective(D);
2407 D->IsXLHSInRHSPart = Record.readBool();
2408 D->IsPostfixUpdate = Record.readBool();
2409}
2410
2411void ASTStmtReader::VisitOMPTargetDirective(OMPTargetDirective *D) {
2412 VisitStmt(D);
2413 VisitOMPExecutableDirective(D);
2414}
2415
2416void ASTStmtReader::VisitOMPTargetDataDirective(OMPTargetDataDirective *D) {
2417 VisitStmt(D);
2418 VisitOMPExecutableDirective(D);
2419}
2420
2421void ASTStmtReader::VisitOMPTargetEnterDataDirective(
2422 OMPTargetEnterDataDirective *D) {
2423 VisitStmt(D);
2424 VisitOMPExecutableDirective(D);
2425}
2426
2427void ASTStmtReader::VisitOMPTargetExitDataDirective(
2428 OMPTargetExitDataDirective *D) {
2429 VisitStmt(D);
2430 VisitOMPExecutableDirective(D);
2431}
2432
2433void ASTStmtReader::VisitOMPTargetParallelDirective(
2434 OMPTargetParallelDirective *D) {
2435 VisitStmt(D);
2436 VisitOMPExecutableDirective(D);
2437 D->setHasCancel(Record.readBool());
2438}
2439
2440void ASTStmtReader::VisitOMPTargetParallelForDirective(
2441 OMPTargetParallelForDirective *D) {
2442 VisitOMPLoopDirective(D);
2443 D->setHasCancel(Record.readBool());
2444}
2445
2446void ASTStmtReader::VisitOMPTeamsDirective(OMPTeamsDirective *D) {
2447 VisitStmt(D);
2448 VisitOMPExecutableDirective(D);
2449}
2450
2451void ASTStmtReader::VisitOMPCancellationPointDirective(
2452 OMPCancellationPointDirective *D) {
2453 VisitStmt(D);
2454 VisitOMPExecutableDirective(D);
2455 D->setCancelRegion(Record.readEnum<OpenMPDirectiveKind>());
2456}
2457
2458void ASTStmtReader::VisitOMPCancelDirective(OMPCancelDirective *D) {
2459 VisitStmt(D);
2460 VisitOMPExecutableDirective(D);
2461 D->setCancelRegion(Record.readEnum<OpenMPDirectiveKind>());
2462}
2463
2464void ASTStmtReader::VisitOMPTaskLoopDirective(OMPTaskLoopDirective *D) {
2465 VisitOMPLoopDirective(D);
2466 D->setHasCancel(Record.readBool());
2467}
2468
2469void ASTStmtReader::VisitOMPTaskLoopSimdDirective(OMPTaskLoopSimdDirective *D) {
2470 VisitOMPLoopDirective(D);
2471}
2472
2473void ASTStmtReader::VisitOMPMasterTaskLoopDirective(
2474 OMPMasterTaskLoopDirective *D) {
2475 VisitOMPLoopDirective(D);
2476 D->setHasCancel(Record.readBool());
2477}
2478
2479void ASTStmtReader::VisitOMPMasterTaskLoopSimdDirective(
2480 OMPMasterTaskLoopSimdDirective *D) {
2481 VisitOMPLoopDirective(D);
2482}
2483
2484void ASTStmtReader::VisitOMPParallelMasterTaskLoopDirective(
2485 OMPParallelMasterTaskLoopDirective *D) {
2486 VisitOMPLoopDirective(D);
2487 D->setHasCancel(Record.readBool());
2488}
2489
2490void ASTStmtReader::VisitOMPParallelMasterTaskLoopSimdDirective(
2491 OMPParallelMasterTaskLoopSimdDirective *D) {
2492 VisitOMPLoopDirective(D);
2493}
2494
2495void ASTStmtReader::VisitOMPDistributeDirective(OMPDistributeDirective *D) {
2496 VisitOMPLoopDirective(D);
2497}
2498
2499void ASTStmtReader::VisitOMPTargetUpdateDirective(OMPTargetUpdateDirective *D) {
2500 VisitStmt(D);
2501 VisitOMPExecutableDirective(D);
2502}
2503
2504void ASTStmtReader::VisitOMPDistributeParallelForDirective(
2505 OMPDistributeParallelForDirective *D) {
2506 VisitOMPLoopDirective(D);
2507 D->setHasCancel(Record.readBool());
2508}
2509
2510void ASTStmtReader::VisitOMPDistributeParallelForSimdDirective(
2511 OMPDistributeParallelForSimdDirective *D) {
2512 VisitOMPLoopDirective(D);
2513}
2514
2515void ASTStmtReader::VisitOMPDistributeSimdDirective(
2516 OMPDistributeSimdDirective *D) {
2517 VisitOMPLoopDirective(D);
2518}
2519
2520void ASTStmtReader::VisitOMPTargetParallelForSimdDirective(
2521 OMPTargetParallelForSimdDirective *D) {
2522 VisitOMPLoopDirective(D);
2523}
2524
2525void ASTStmtReader::VisitOMPTargetSimdDirective(OMPTargetSimdDirective *D) {
2526 VisitOMPLoopDirective(D);
2527}
2528
2529void ASTStmtReader::VisitOMPTeamsDistributeDirective(
2530 OMPTeamsDistributeDirective *D) {
2531 VisitOMPLoopDirective(D);
2532}
2533
2534void ASTStmtReader::VisitOMPTeamsDistributeSimdDirective(
2535 OMPTeamsDistributeSimdDirective *D) {
2536 VisitOMPLoopDirective(D);
2537}
2538
2539void ASTStmtReader::VisitOMPTeamsDistributeParallelForSimdDirective(
2540 OMPTeamsDistributeParallelForSimdDirective *D) {
2541 VisitOMPLoopDirective(D);
2542}
2543
2544void ASTStmtReader::VisitOMPTeamsDistributeParallelForDirective(
2545 OMPTeamsDistributeParallelForDirective *D) {
2546 VisitOMPLoopDirective(D);
2547 D->setHasCancel(Record.readBool());
2548}
2549
2550void ASTStmtReader::VisitOMPTargetTeamsDirective(OMPTargetTeamsDirective *D) {
2551 VisitStmt(D);
2552 VisitOMPExecutableDirective(D);
2553}
2554
2555void ASTStmtReader::VisitOMPTargetTeamsDistributeDirective(
2556 OMPTargetTeamsDistributeDirective *D) {
2557 VisitOMPLoopDirective(D);
2558}
2559
2560void ASTStmtReader::VisitOMPTargetTeamsDistributeParallelForDirective(
2561 OMPTargetTeamsDistributeParallelForDirective *D) {
2562 VisitOMPLoopDirective(D);
2563 D->setHasCancel(Record.readBool());
2564}
2565
2566void ASTStmtReader::VisitOMPTargetTeamsDistributeParallelForSimdDirective(
2567 OMPTargetTeamsDistributeParallelForSimdDirective *D) {
2568 VisitOMPLoopDirective(D);
2569}
2570
2571void ASTStmtReader::VisitOMPTargetTeamsDistributeSimdDirective(
2572 OMPTargetTeamsDistributeSimdDirective *D) {
2573 VisitOMPLoopDirective(D);
2574}
2575
2576//===----------------------------------------------------------------------===//
2577// ASTReader Implementation
2578//===----------------------------------------------------------------------===//
2579
2580Stmt *ASTReader::ReadStmt(ModuleFile &F) {
2581 switch (ReadingKind) {
2582 case Read_None:
2583 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~++20200917111122+b03c2b8395b/clang/lib/Serialization/ASTReaderStmt.cpp"
, 2583)
;
2584 case Read_Decl:
2585 case Read_Type:
2586 return ReadStmtFromStream(F);
2587 case Read_Stmt:
2588 return ReadSubStmt();
2589 }
2590
2591 llvm_unreachable("ReadingKind not set ?")::llvm::llvm_unreachable_internal("ReadingKind not set ?", "/build/llvm-toolchain-snapshot-12~++20200917111122+b03c2b8395b/clang/lib/Serialization/ASTReaderStmt.cpp"
, 2591)
;
2592}
2593
2594Expr *ASTReader::ReadExpr(ModuleFile &F) {
2595 return cast_or_null<Expr>(ReadStmt(F));
2596}
2597
2598Expr *ASTReader::ReadSubExpr() {
2599 return cast_or_null<Expr>(ReadSubStmt());
2600}
2601
2602// Within the bitstream, expressions are stored in Reverse Polish
2603// Notation, with each of the subexpressions preceding the
2604// expression they are stored in. Subexpressions are stored from last to first.
2605// To evaluate expressions, we continue reading expressions and placing them on
2606// the stack, with expressions having operands removing those operands from the
2607// stack. Evaluation terminates when we see a STMT_STOP record, and
2608// the single remaining expression on the stack is our result.
2609Stmt *ASTReader::ReadStmtFromStream(ModuleFile &F) {
2610 ReadingKindTracker ReadingKind(Read_Stmt, *this);
2611 llvm::BitstreamCursor &Cursor = F.DeclsCursor;
2612
2613 // Map of offset to previously deserialized stmt. The offset points
2614 // just after the stmt record.
2615 llvm::DenseMap<uint64_t, Stmt *> StmtEntries;
2616
2617#ifndef NDEBUG
2618 unsigned PrevNumStmts = StmtStack.size();
2619#endif
2620
2621 ASTRecordReader Record(*this, F);
2622 ASTStmtReader Reader(Record, Cursor);
2623 Stmt::EmptyShell Empty;
2624
2625 while (true) {
2626 llvm::Expected<llvm::BitstreamEntry> MaybeEntry =
2627 Cursor.advanceSkippingSubblocks();
2628 if (!MaybeEntry) {
2629 Error(toString(MaybeEntry.takeError()));
2630 return nullptr;
2631 }
2632 llvm::BitstreamEntry Entry = MaybeEntry.get();
2633
2634 switch (Entry.Kind) {
2635 case llvm::BitstreamEntry::SubBlock: // Handled for us already.
2636 case llvm::BitstreamEntry::Error:
2637 Error("malformed block record in AST file");
2638 return nullptr;
2639 case llvm::BitstreamEntry::EndBlock:
2640 goto Done;
2641 case llvm::BitstreamEntry::Record:
2642 // The interesting case.
2643 break;
2644 }
2645
2646 ASTContext &Context = getContext();
2647 Stmt *S = nullptr;
2648 bool Finished = false;
2649 bool IsStmtReference = false;
2650 Expected<unsigned> MaybeStmtCode = Record.readRecord(Cursor, Entry.ID);
2651 if (!MaybeStmtCode) {
2652 Error(toString(MaybeStmtCode.takeError()));
2653 return nullptr;
2654 }
2655 switch ((StmtCode)MaybeStmtCode.get()) {
2656 case STMT_STOP:
2657 Finished = true;
2658 break;
2659
2660 case STMT_REF_PTR:
2661 IsStmtReference = true;
2662 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~++20200917111122+b03c2b8395b/clang/lib/Serialization/ASTReaderStmt.cpp"
, 2663, __PRETTY_FUNCTION__))
2663 "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~++20200917111122+b03c2b8395b/clang/lib/Serialization/ASTReaderStmt.cpp"
, 2663, __PRETTY_FUNCTION__))
;
2664 S = StmtEntries[Record.readInt()];
2665 break;
2666
2667 case STMT_NULL_PTR:
2668 S = nullptr;
2669 break;
2670
2671 case STMT_NULL:
2672 S = new (Context) NullStmt(Empty);
2673 break;
2674
2675 case STMT_COMPOUND:
2676 S = CompoundStmt::CreateEmpty(
2677 Context, /*NumStmts=*/Record[ASTStmtReader::NumStmtFields]);
2678 break;
2679
2680 case STMT_CASE:
2681 S = CaseStmt::CreateEmpty(
2682 Context,
2683 /*CaseStmtIsGNURange*/ Record[ASTStmtReader::NumStmtFields + 3]);
2684 break;
2685
2686 case STMT_DEFAULT:
2687 S = new (Context) DefaultStmt(Empty);
2688 break;
2689
2690 case STMT_LABEL:
2691 S = new (Context) LabelStmt(Empty);
2692 break;
2693
2694 case STMT_ATTRIBUTED:
2695 S = AttributedStmt::CreateEmpty(
2696 Context,
2697 /*NumAttrs*/Record[ASTStmtReader::NumStmtFields]);
2698 break;
2699
2700 case STMT_IF:
2701 S = IfStmt::CreateEmpty(
2702 Context,
2703 /* HasElse=*/Record[ASTStmtReader::NumStmtFields + 1],
2704 /* HasVar=*/Record[ASTStmtReader::NumStmtFields + 2],
2705 /* HasInit=*/Record[ASTStmtReader::NumStmtFields + 3]);
2706 break;
2707
2708 case STMT_SWITCH:
2709 S = SwitchStmt::CreateEmpty(
2710 Context,
2711 /* HasInit=*/Record[ASTStmtReader::NumStmtFields],
2712 /* HasVar=*/Record[ASTStmtReader::NumStmtFields + 1]);
2713 break;
2714
2715 case STMT_WHILE:
2716 S = WhileStmt::CreateEmpty(
2717 Context,
2718 /* HasVar=*/Record[ASTStmtReader::NumStmtFields]);
2719 break;
2720
2721 case STMT_DO:
2722 S = new (Context) DoStmt(Empty);
2723 break;
2724
2725 case STMT_FOR:
2726 S = new (Context) ForStmt(Empty);
2727 break;
2728
2729 case STMT_GOTO:
2730 S = new (Context) GotoStmt(Empty);
2731 break;
2732
2733 case STMT_INDIRECT_GOTO:
2734 S = new (Context) IndirectGotoStmt(Empty);
2735 break;
2736
2737 case STMT_CONTINUE:
2738 S = new (Context) ContinueStmt(Empty);
2739 break;
2740
2741 case STMT_BREAK:
2742 S = new (Context) BreakStmt(Empty);
2743 break;
2744
2745 case STMT_RETURN:
2746 S = ReturnStmt::CreateEmpty(
2747 Context, /* HasNRVOCandidate=*/Record[ASTStmtReader::NumStmtFields]);
2748 break;
2749
2750 case STMT_DECL:
2751 S = new (Context) DeclStmt(Empty);
2752 break;
2753
2754 case STMT_GCCASM:
2755 S = new (Context) GCCAsmStmt(Empty);
2756 break;
2757
2758 case STMT_MSASM:
2759 S = new (Context) MSAsmStmt(Empty);
2760 break;
2761
2762 case STMT_CAPTURED:
2763 S = CapturedStmt::CreateDeserialized(
2764 Context, Record[ASTStmtReader::NumStmtFields]);
2765 break;
2766
2767 case EXPR_CONSTANT:
2768 S = ConstantExpr::CreateEmpty(
2769 Context, static_cast<ConstantExpr::ResultStorageKind>(
2770 /*StorageKind=*/Record[ASTStmtReader::NumExprFields]));
2771 break;
2772
2773 case EXPR_PREDEFINED:
2774 S = PredefinedExpr::CreateEmpty(
2775 Context,
2776 /*HasFunctionName*/ Record[ASTStmtReader::NumExprFields]);
2777 break;
2778
2779 case EXPR_DECL_REF:
2780 S = DeclRefExpr::CreateEmpty(
2781 Context,
2782 /*HasQualifier=*/Record[ASTStmtReader::NumExprFields],
2783 /*HasFoundDecl=*/Record[ASTStmtReader::NumExprFields + 1],
2784 /*HasTemplateKWAndArgsInfo=*/Record[ASTStmtReader::NumExprFields + 2],
2785 /*NumTemplateArgs=*/Record[ASTStmtReader::NumExprFields + 2] ?
2786 Record[ASTStmtReader::NumExprFields + 6] : 0);
2787 break;
2788
2789 case EXPR_INTEGER_LITERAL:
2790 S = IntegerLiteral::Create(Context, Empty);
2791 break;
2792
2793 case EXPR_FIXEDPOINT_LITERAL:
2794 S = FixedPointLiteral::Create(Context, Empty);
2795 break;
2796
2797 case EXPR_FLOATING_LITERAL:
2798 S = FloatingLiteral::Create(Context, Empty);
2799 break;
2800
2801 case EXPR_IMAGINARY_LITERAL:
2802 S = new (Context) ImaginaryLiteral(Empty);
2803 break;
2804
2805 case EXPR_STRING_LITERAL:
2806 S = StringLiteral::CreateEmpty(
2807 Context,
2808 /* NumConcatenated=*/Record[ASTStmtReader::NumExprFields],
2809 /* Length=*/Record[ASTStmtReader::NumExprFields + 1],
2810 /* CharByteWidth=*/Record[ASTStmtReader::NumExprFields + 2]);
2811 break;
2812
2813 case EXPR_CHARACTER_LITERAL:
2814 S = new (Context) CharacterLiteral(Empty);
2815 break;
2816
2817 case EXPR_PAREN:
2818 S = new (Context) ParenExpr(Empty);
2819 break;
2820
2821 case EXPR_PAREN_LIST:
2822 S = ParenListExpr::CreateEmpty(
2823 Context,
2824 /* NumExprs=*/Record[ASTStmtReader::NumExprFields]);
2825 break;
2826
2827 case EXPR_UNARY_OPERATOR:
2828 S = UnaryOperator::CreateEmpty(Context,
2829 Record[ASTStmtReader::NumExprFields]);
2830 break;
2831
2832 case EXPR_OFFSETOF:
2833 S = OffsetOfExpr::CreateEmpty(Context,
2834 Record[ASTStmtReader::NumExprFields],
2835 Record[ASTStmtReader::NumExprFields + 1]);
2836 break;
2837
2838 case EXPR_SIZEOF_ALIGN_OF:
2839 S = new (Context) UnaryExprOrTypeTraitExpr(Empty);
2840 break;
2841
2842 case EXPR_ARRAY_SUBSCRIPT:
2843 S = new (Context) ArraySubscriptExpr(Empty);
2844 break;
2845
2846 case EXPR_MATRIX_SUBSCRIPT:
2847 S = new (Context) MatrixSubscriptExpr(Empty);
2848 break;
2849
2850 case EXPR_OMP_ARRAY_SECTION:
2851 S = new (Context) OMPArraySectionExpr(Empty);
2852 break;
2853
2854 case EXPR_OMP_ARRAY_SHAPING:
2855 S = OMPArrayShapingExpr::CreateEmpty(
2856 Context, Record[ASTStmtReader::NumExprFields]);
2857 break;
2858
2859 case EXPR_OMP_ITERATOR:
2860 S = OMPIteratorExpr::CreateEmpty(Context,
2861 Record[ASTStmtReader::NumExprFields]);
2862 break;
2863
2864 case EXPR_CALL:
2865 S = CallExpr::CreateEmpty(
2866 Context, /*NumArgs=*/Record[ASTStmtReader::NumExprFields],
2867 /*HasFPFeatures=*/Record[ASTStmtReader::NumExprFields + 1], Empty);
2868 break;
2869
2870 case EXPR_RECOVERY:
2871 S = RecoveryExpr::CreateEmpty(
2872 Context, /*NumArgs=*/Record[ASTStmtReader::NumExprFields]);
2873 break;
2874
2875 case EXPR_MEMBER:
2876 S = MemberExpr::CreateEmpty(Context, Record[ASTStmtReader::NumExprFields],
2877 Record[ASTStmtReader::NumExprFields + 1],
2878 Record[ASTStmtReader::NumExprFields + 2],
2879 Record[ASTStmtReader::NumExprFields + 3]);
2880 break;
2881
2882 case EXPR_BINARY_OPERATOR:
2883 S = BinaryOperator::CreateEmpty(Context,
2884 Record[ASTStmtReader::NumExprFields]);
2885 break;
2886
2887 case EXPR_COMPOUND_ASSIGN_OPERATOR:
2888 S = CompoundAssignOperator::CreateEmpty(
2889 Context, Record[ASTStmtReader::NumExprFields]);
2890 break;
2891
2892 case EXPR_CONDITIONAL_OPERATOR:
2893 S = new (Context) ConditionalOperator(Empty);
2894 break;
2895
2896 case EXPR_BINARY_CONDITIONAL_OPERATOR:
2897 S = new (Context) BinaryConditionalOperator(Empty);
2898 break;
2899
2900 case EXPR_IMPLICIT_CAST:
2901 S = ImplicitCastExpr::CreateEmpty(
2902 Context,
2903 /*PathSize*/ Record[ASTStmtReader::NumExprFields],
2904 /*HasFPFeatures*/ Record[ASTStmtReader::NumExprFields + 1]);
2905 break;
2906
2907 case EXPR_CSTYLE_CAST:
2908 S = CStyleCastExpr::CreateEmpty(
2909 Context,
2910 /*PathSize*/ Record[ASTStmtReader::NumExprFields],
2911 /*HasFPFeatures*/ Record[ASTStmtReader::NumExprFields + 1]);
2912 break;
2913
2914 case EXPR_COMPOUND_LITERAL:
2915 S = new (Context) CompoundLiteralExpr(Empty);
2916 break;
2917
2918 case EXPR_EXT_VECTOR_ELEMENT:
2919 S = new (Context) ExtVectorElementExpr(Empty);
2920 break;
2921
2922 case EXPR_INIT_LIST:
2923 S = new (Context) InitListExpr(Empty);
2924 break;
2925
2926 case EXPR_DESIGNATED_INIT:
2927 S = DesignatedInitExpr::CreateEmpty(Context,
2928 Record[ASTStmtReader::NumExprFields] - 1);
2929
2930 break;
2931
2932 case EXPR_DESIGNATED_INIT_UPDATE:
2933 S = new (Context) DesignatedInitUpdateExpr(Empty);
2934 break;
2935
2936 case EXPR_IMPLICIT_VALUE_INIT:
2937 S = new (Context) ImplicitValueInitExpr(Empty);
2938 break;
2939
2940 case EXPR_NO_INIT:
2941 S = new (Context) NoInitExpr(Empty);
2942 break;
2943
2944 case EXPR_ARRAY_INIT_LOOP:
2945 S = new (Context) ArrayInitLoopExpr(Empty);
2946 break;
2947
2948 case EXPR_ARRAY_INIT_INDEX:
2949 S = new (Context) ArrayInitIndexExpr(Empty);
2950 break;
2951
2952 case EXPR_VA_ARG:
2953 S = new (Context) VAArgExpr(Empty);
2954 break;
2955
2956 case EXPR_SOURCE_LOC:
2957 S = new (Context) SourceLocExpr(Empty);
2958 break;
2959
2960 case EXPR_ADDR_LABEL:
2961 S = new (Context) AddrLabelExpr(Empty);
2962 break;
2963
2964 case EXPR_STMT:
2965 S = new (Context) StmtExpr(Empty);
2966 break;
2967
2968 case EXPR_CHOOSE:
2969 S = new (Context) ChooseExpr(Empty);
2970 break;
2971
2972 case EXPR_GNU_NULL:
2973 S = new (Context) GNUNullExpr(Empty);
2974 break;
2975
2976 case EXPR_SHUFFLE_VECTOR:
2977 S = new (Context) ShuffleVectorExpr(Empty);
2978 break;
2979
2980 case EXPR_CONVERT_VECTOR:
2981 S = new (Context) ConvertVectorExpr(Empty);
2982 break;
2983
2984 case EXPR_BLOCK:
2985 S = new (Context) BlockExpr(Empty);
2986 break;
2987
2988 case EXPR_GENERIC_SELECTION:
2989 S = GenericSelectionExpr::CreateEmpty(
2990 Context,
2991 /*NumAssocs=*/Record[ASTStmtReader::NumExprFields]);
2992 break;
2993
2994 case EXPR_OBJC_STRING_LITERAL:
2995 S = new (Context) ObjCStringLiteral(Empty);
2996 break;
2997
2998 case EXPR_OBJC_BOXED_EXPRESSION:
2999 S = new (Context) ObjCBoxedExpr(Empty);
3000 break;
3001
3002 case EXPR_OBJC_ARRAY_LITERAL:
3003 S = ObjCArrayLiteral::CreateEmpty(Context,
3004 Record[ASTStmtReader::NumExprFields]);
3005 break;
3006
3007 case EXPR_OBJC_DICTIONARY_LITERAL:
3008 S = ObjCDictionaryLiteral::CreateEmpty(Context,
3009 Record[ASTStmtReader::NumExprFields],
3010 Record[ASTStmtReader::NumExprFields + 1]);
3011 break;
3012
3013 case EXPR_OBJC_ENCODE:
3014 S = new (Context) ObjCEncodeExpr(Empty);
3015 break;
3016
3017 case EXPR_OBJC_SELECTOR_EXPR:
3018 S = new (Context) ObjCSelectorExpr(Empty);
3019 break;
3020
3021 case EXPR_OBJC_PROTOCOL_EXPR:
3022 S = new (Context) ObjCProtocolExpr(Empty);
3023 break;
3024
3025 case EXPR_OBJC_IVAR_REF_EXPR:
3026 S = new (Context) ObjCIvarRefExpr(Empty);
3027 break;
3028
3029 case EXPR_OBJC_PROPERTY_REF_EXPR:
3030 S = new (Context) ObjCPropertyRefExpr(Empty);
3031 break;
3032
3033 case EXPR_OBJC_SUBSCRIPT_REF_EXPR:
3034 S = new (Context) ObjCSubscriptRefExpr(Empty);
3035 break;
3036
3037 case EXPR_OBJC_KVC_REF_EXPR:
3038 llvm_unreachable("mismatching AST file")::llvm::llvm_unreachable_internal("mismatching AST file", "/build/llvm-toolchain-snapshot-12~++20200917111122+b03c2b8395b/clang/lib/Serialization/ASTReaderStmt.cpp"
, 3038)
;
3039
3040 case EXPR_OBJC_MESSAGE_EXPR:
3041 S = ObjCMessageExpr::CreateEmpty(Context,
3042 Record[ASTStmtReader::NumExprFields],
3043 Record[ASTStmtReader::NumExprFields + 1]);
3044 break;
3045
3046 case EXPR_OBJC_ISA:
3047 S = new (Context) ObjCIsaExpr(Empty);
3048 break;
3049
3050 case EXPR_OBJC_INDIRECT_COPY_RESTORE:
3051 S = new (Context) ObjCIndirectCopyRestoreExpr(Empty);
3052 break;
3053
3054 case EXPR_OBJC_BRIDGED_CAST:
3055 S = new (Context) ObjCBridgedCastExpr(Empty);
3056 break;
3057
3058 case STMT_OBJC_FOR_COLLECTION:
3059 S = new (Context) ObjCForCollectionStmt(Empty);
3060 break;
3061
3062 case STMT_OBJC_CATCH:
3063 S = new (Context) ObjCAtCatchStmt(Empty);
3064 break;
3065
3066 case STMT_OBJC_FINALLY:
3067 S = new (Context) ObjCAtFinallyStmt(Empty);
3068 break;
3069
3070 case STMT_OBJC_AT_TRY:
3071 S = ObjCAtTryStmt::CreateEmpty(Context,
3072 Record[ASTStmtReader::NumStmtFields],
3073 Record[ASTStmtReader::NumStmtFields + 1]);
3074 break;
3075
3076 case STMT_OBJC_AT_SYNCHRONIZED:
3077 S = new (Context) ObjCAtSynchronizedStmt(Empty);
3078 break;
3079
3080 case STMT_OBJC_AT_THROW:
3081 S = new (Context) ObjCAtThrowStmt(Empty);
3082 break;
3083
3084 case STMT_OBJC_AUTORELEASE_POOL:
3085 S = new (Context) ObjCAutoreleasePoolStmt(Empty);
3086 break;
3087
3088 case EXPR_OBJC_BOOL_LITERAL:
3089 S = new (Context) ObjCBoolLiteralExpr(Empty);
3090 break;
3091
3092 case EXPR_OBJC_AVAILABILITY_CHECK:
3093 S = new (Context) ObjCAvailabilityCheckExpr(Empty);
3094 break;
3095
3096 case STMT_SEH_LEAVE:
3097 S = new (Context) SEHLeaveStmt(Empty);
3098 break;
3099
3100 case STMT_SEH_EXCEPT:
3101 S = new (Context) SEHExceptStmt(Empty);
3102 break;
3103
3104 case STMT_SEH_FINALLY:
3105 S = new (Context) SEHFinallyStmt(Empty);
3106 break;
3107
3108 case STMT_SEH_TRY:
3109 S = new (Context) SEHTryStmt(Empty);
3110 break;
3111
3112 case STMT_CXX_CATCH:
3113 S = new (Context) CXXCatchStmt(Empty);
3114 break;
3115
3116 case STMT_CXX_TRY:
3117 S = CXXTryStmt::Create(Context, Empty,
3118 /*numHandlers=*/Record[ASTStmtReader::NumStmtFields]);
3119 break;
3120
3121 case STMT_CXX_FOR_RANGE:
3122 S = new (Context) CXXForRangeStmt(Empty);
3123 break;
3124
3125 case STMT_MS_DEPENDENT_EXISTS:
3126 S = new (Context) MSDependentExistsStmt(SourceLocation(), true,
3127 NestedNameSpecifierLoc(),
3128 DeclarationNameInfo(),
3129 nullptr);
3130 break;
3131
3132 case STMT_OMP_PARALLEL_DIRECTIVE:
3133 S =
3134 OMPParallelDirective::CreateEmpty(Context,
3135 Record[ASTStmtReader::NumStmtFields],
3136 Empty);
3137 break;
3138
3139 case STMT_OMP_SIMD_DIRECTIVE: {
3140 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3141 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3142 S = OMPSimdDirective::CreateEmpty(Context, NumClauses,
3143 CollapsedNum, Empty);
3144 break;
3145 }
3146
3147 case STMT_OMP_FOR_DIRECTIVE: {
3148 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3149 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3150 S = OMPForDirective::CreateEmpty(Context, NumClauses, CollapsedNum,
3151 Empty);
3152 break;
3153 }
3154
3155 case STMT_OMP_FOR_SIMD_DIRECTIVE: {
3156 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3157 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3158 S = OMPForSimdDirective::CreateEmpty(Context, NumClauses, CollapsedNum,
3159 Empty);
3160 break;
3161 }
3162
3163 case STMT_OMP_SECTIONS_DIRECTIVE:
3164 S = OMPSectionsDirective::CreateEmpty(
3165 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3166 break;
3167
3168 case STMT_OMP_SECTION_DIRECTIVE:
3169 S = OMPSectionDirective::CreateEmpty(Context, Empty);
3170 break;
3171
3172 case STMT_OMP_SINGLE_DIRECTIVE:
3173 S = OMPSingleDirective::CreateEmpty(
3174 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3175 break;
3176
3177 case STMT_OMP_MASTER_DIRECTIVE:
3178 S = OMPMasterDirective::CreateEmpty(Context, Empty);
3179 break;
3180
3181 case STMT_OMP_CRITICAL_DIRECTIVE:
3182 S = OMPCriticalDirective::CreateEmpty(
3183 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3184 break;
3185
3186 case STMT_OMP_PARALLEL_FOR_DIRECTIVE: {
3187 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3188 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3189 S = OMPParallelForDirective::CreateEmpty(Context, NumClauses,
3190 CollapsedNum, Empty);
3191 break;
3192 }
3193
3194 case STMT_OMP_PARALLEL_FOR_SIMD_DIRECTIVE: {
3195 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3196 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3197 S = OMPParallelForSimdDirective::CreateEmpty(Context, NumClauses,
3198 CollapsedNum, Empty);
3199 break;
3200 }
3201
3202 case STMT_OMP_PARALLEL_MASTER_DIRECTIVE:
3203 S = OMPParallelMasterDirective::CreateEmpty(
3204 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3205 break;
3206
3207 case STMT_OMP_PARALLEL_SECTIONS_DIRECTIVE:
3208 S = OMPParallelSectionsDirective::CreateEmpty(
3209 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3210 break;
3211
3212 case STMT_OMP_TASK_DIRECTIVE:
3213 S = OMPTaskDirective::CreateEmpty(
3214 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3215 break;
3216
3217 case STMT_OMP_TASKYIELD_DIRECTIVE:
3218 S = OMPTaskyieldDirective::CreateEmpty(Context, Empty);
3219 break;
3220
3221 case STMT_OMP_BARRIER_DIRECTIVE:
3222 S = OMPBarrierDirective::CreateEmpty(Context, Empty);
3223 break;
3224
3225 case STMT_OMP_TASKWAIT_DIRECTIVE:
3226 S = OMPTaskwaitDirective::CreateEmpty(Context, Empty);
3227 break;
3228
3229 case STMT_OMP_TASKGROUP_DIRECTIVE:
3230 S = OMPTaskgroupDirective::CreateEmpty(
3231 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3232 break;
3233
3234 case STMT_OMP_FLUSH_DIRECTIVE:
3235 S = OMPFlushDirective::CreateEmpty(
3236 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3237 break;
3238
3239 case STMT_OMP_DEPOBJ_DIRECTIVE:
3240 S = OMPDepobjDirective::CreateEmpty(
3241 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3242 break;
3243
3244 case STMT_OMP_SCAN_DIRECTIVE:
3245 S = OMPScanDirective::CreateEmpty(
3246 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3247 break;
3248
3249 case STMT_OMP_ORDERED_DIRECTIVE: {
3250 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
3251 bool HasAssociatedStmt = Record[ASTStmtReader::NumStmtFields + 2];
3252 S = OMPOrderedDirective::CreateEmpty(Context, NumClauses,
3253 !HasAssociatedStmt, Empty);
3254 break;
3255 }
3256
3257 case STMT_OMP_ATOMIC_DIRECTIVE:
3258 S = OMPAtomicDirective::CreateEmpty(
3259 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3260 break;
3261
3262 case STMT_OMP_TARGET_DIRECTIVE:
3263 S = OMPTargetDirective::CreateEmpty(
3264 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3265 break;
3266
3267 case STMT_OMP_TARGET_DATA_DIRECTIVE:
3268 S = OMPTargetDataDirective::CreateEmpty(
3269 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3270 break;
3271
3272 case STMT_OMP_TARGET_ENTER_DATA_DIRECTIVE:
3273 S = OMPTargetEnterDataDirective::CreateEmpty(
3274 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3275 break;
3276
3277 case STMT_OMP_TARGET_EXIT_DATA_DIRECTIVE:
3278 S = OMPTargetExitDataDirective::CreateEmpty(
3279 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3280 break;
3281
3282 case STMT_OMP_TARGET_PARALLEL_DIRECTIVE:
3283 S = OMPTargetParallelDirective::CreateEmpty(
3284 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3285 break;
3286
3287 case STMT_OMP_TARGET_PARALLEL_FOR_DIRECTIVE: {
3288 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3289 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3290 S = OMPTargetParallelForDirective::CreateEmpty(Context, NumClauses,
3291 CollapsedNum, Empty);
3292 break;
3293 }
3294
3295 case STMT_OMP_TARGET_UPDATE_DIRECTIVE:
3296 S = OMPTargetUpdateDirective::CreateEmpty(
3297 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3298 break;
3299
3300 case STMT_OMP_TEAMS_DIRECTIVE:
3301 S = OMPTeamsDirective::CreateEmpty(
3302 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3303 break;
3304
3305 case STMT_OMP_CANCELLATION_POINT_DIRECTIVE:
3306 S = OMPCancellationPointDirective::CreateEmpty(Context, Empty);
3307 break;
3308
3309 case STMT_OMP_CANCEL_DIRECTIVE:
3310 S = OMPCancelDirective::CreateEmpty(
3311 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3312 break;
3313
3314 case STMT_OMP_TASKLOOP_DIRECTIVE: {
3315 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3316 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3317 S = OMPTaskLoopDirective::CreateEmpty(Context, NumClauses, CollapsedNum,
3318 Empty);
3319 break;
3320 }
3321
3322 case STMT_OMP_TASKLOOP_SIMD_DIRECTIVE: {
3323 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3324 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3325 S = OMPTaskLoopSimdDirective::CreateEmpty(Context, NumClauses,
3326 CollapsedNum, Empty);
3327 break;
3328 }
3329
3330 case STMT_OMP_MASTER_TASKLOOP_DIRECTIVE: {
3331 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3332 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3333 S = OMPMasterTaskLoopDirective::CreateEmpty(Context, NumClauses,
3334 CollapsedNum, Empty);
3335 break;
3336 }
3337
3338 case STMT_OMP_MASTER_TASKLOOP_SIMD_DIRECTIVE: {
3339 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3340 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3341 S = OMPMasterTaskLoopSimdDirective::CreateEmpty(Context, NumClauses,
3342 CollapsedNum, Empty);
3343 break;
3344 }
3345
3346 case STMT_OMP_PARALLEL_MASTER_TASKLOOP_DIRECTIVE: {
3347 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3348 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3349 S = OMPParallelMasterTaskLoopDirective::CreateEmpty(Context, NumClauses,
3350 CollapsedNum, Empty);
3351 break;
3352 }
3353
3354 case STMT_OMP_PARALLEL_MASTER_TASKLOOP_SIMD_DIRECTIVE: {
3355 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3356 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3357 S = OMPParallelMasterTaskLoopSimdDirective::CreateEmpty(
3358 Context, NumClauses, CollapsedNum, Empty);
3359 break;
3360 }
3361
3362 case STMT_OMP_DISTRIBUTE_DIRECTIVE: {
3363 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3364 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3365 S = OMPDistributeDirective::CreateEmpty(Context, NumClauses, CollapsedNum,
3366 Empty);
3367 break;
3368 }
3369
3370 case STMT_OMP_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE: {
3371 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3372 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3373 S = OMPDistributeParallelForDirective::CreateEmpty(Context, NumClauses,
3374 CollapsedNum, Empty);
3375 break;
3376 }
3377
3378 case STMT_OMP_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE: {
3379 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3380 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3381 S = OMPDistributeParallelForSimdDirective::CreateEmpty(Context, NumClauses,
3382 CollapsedNum,
3383 Empty);
3384 break;
3385 }
3386
3387 case STMT_OMP_DISTRIBUTE_SIMD_DIRECTIVE: {
3388 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3389 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3390 S = OMPDistributeSimdDirective::CreateEmpty(Context, NumClauses,
3391 CollapsedNum, Empty);
3392 break;
3393 }
3394
3395 case STMT_OMP_TARGET_PARALLEL_FOR_SIMD_DIRECTIVE: {
3396 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3397 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3398 S = OMPTargetParallelForSimdDirective::CreateEmpty(Context, NumClauses,
3399 CollapsedNum, Empty);
3400 break;
3401 }
3402
3403 case STMT_OMP_TARGET_SIMD_DIRECTIVE: {
3404 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3405 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3406 S = OMPTargetSimdDirective::CreateEmpty(Context, NumClauses, CollapsedNum,
3407 Empty);
3408 break;
3409 }
3410
3411 case STMT_OMP_TEAMS_DISTRIBUTE_DIRECTIVE: {
3412 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3413 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3414 S = OMPTeamsDistributeDirective::CreateEmpty(Context, NumClauses,
3415 CollapsedNum, Empty);
3416 break;
3417 }
3418
3419 case STMT_OMP_TEAMS_DISTRIBUTE_SIMD_DIRECTIVE: {
3420 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3421 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3422 S = OMPTeamsDistributeSimdDirective::CreateEmpty(Context, NumClauses,
3423 CollapsedNum, Empty);
3424 break;
3425 }
3426
3427 case STMT_OMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE: {
3428 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3429 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3430 S = OMPTeamsDistributeParallelForSimdDirective::CreateEmpty(
3431 Context, NumClauses, CollapsedNum, Empty);
3432 break;
3433 }
3434
3435 case STMT_OMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE: {
3436 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3437 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3438 S = OMPTeamsDistributeParallelForDirective::CreateEmpty(
3439 Context, NumClauses, CollapsedNum, Empty);
3440 break;
3441 }
3442
3443 case STMT_OMP_TARGET_TEAMS_DIRECTIVE:
3444 S = OMPTargetTeamsDirective::CreateEmpty(
3445 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3446 break;
3447
3448 case STMT_OMP_TARGET_TEAMS_DISTRIBUTE_DIRECTIVE: {
3449 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3450 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3451 S = OMPTargetTeamsDistributeDirective::CreateEmpty(Context, NumClauses,
3452 CollapsedNum, Empty);
3453 break;
3454 }
3455
3456 case STMT_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE: {
3457 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3458 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3459 S = OMPTargetTeamsDistributeParallelForDirective::CreateEmpty(
3460 Context, NumClauses, CollapsedNum, Empty);
3461 break;
3462 }
3463
3464 case STMT_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE: {
3465 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3466 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3467 S = OMPTargetTeamsDistributeParallelForSimdDirective::CreateEmpty(
3468 Context, NumClauses, CollapsedNum, Empty);
3469 break;
3470 }
3471
3472 case STMT_OMP_TARGET_TEAMS_DISTRIBUTE_SIMD_DIRECTIVE: {
3473 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
3474 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3475 S = OMPTargetTeamsDistributeSimdDirective::CreateEmpty(
3476 Context, NumClauses, CollapsedNum, Empty);
3477 break;
3478 }
3479
3480 case EXPR_CXX_OPERATOR_CALL:
3481 S = CXXOperatorCallExpr::CreateEmpty(
3482 Context, /*NumArgs=*/Record[ASTStmtReader::NumExprFields],
3483 /*HasFPFeatures=*/Record[ASTStmtReader::NumExprFields + 1], Empty);
3484 break;
3485
3486 case EXPR_CXX_MEMBER_CALL:
3487 S = CXXMemberCallExpr::CreateEmpty(
3488 Context, /*NumArgs=*/Record[ASTStmtReader::NumExprFields],
3489 /*HasFPFeatures=*/Record[ASTStmtReader::NumExprFields + 1], Empty);
3490 break;
3491
3492 case EXPR_CXX_REWRITTEN_BINARY_OPERATOR:
3493 S = new (Context) CXXRewrittenBinaryOperator(Empty);
3494 break;
3495
3496 case EXPR_CXX_CONSTRUCT:
3497 S = CXXConstructExpr::CreateEmpty(
3498 Context,
3499 /* NumArgs=*/Record[ASTStmtReader::NumExprFields]);
3500 break;
3501
3502 case EXPR_CXX_INHERITED_CTOR_INIT:
3503 S = new (Context) CXXInheritedCtorInitExpr(Empty);
3504 break;
3505
3506 case EXPR_CXX_TEMPORARY_OBJECT:
3507 S = CXXTemporaryObjectExpr::CreateEmpty(
3508 Context,
3509 /* NumArgs=*/Record[ASTStmtReader::NumExprFields]);
3510 break;
3511
3512 case EXPR_CXX_STATIC_CAST:
3513 S = CXXStaticCastExpr::CreateEmpty(
3514 Context,
3515 /*PathSize*/ Record[ASTStmtReader::NumExprFields],
3516 /*HasFPFeatures*/ Record[ASTStmtReader::NumExprFields + 1]);
3517 break;
3518
3519 case EXPR_CXX_DYNAMIC_CAST:
3520 S = CXXDynamicCastExpr::CreateEmpty(Context,
3521 /*PathSize*/ Record[ASTStmtReader::NumExprFields]);
3522 break;
3523
3524 case EXPR_CXX_REINTERPRET_CAST:
3525 S = CXXReinterpretCastExpr::CreateEmpty(Context,
3526 /*PathSize*/ Record[ASTStmtReader::NumExprFields]);
3527 break;
3528
3529 case EXPR_CXX_CONST_CAST:
3530 S = CXXConstCastExpr::CreateEmpty(Context);
3531 break;
3532
3533 case EXPR_CXX_ADDRSPACE_CAST:
3534 S = CXXAddrspaceCastExpr::CreateEmpty(Context);
3535 break;
3536
3537 case EXPR_CXX_FUNCTIONAL_CAST:
3538 S = CXXFunctionalCastExpr::CreateEmpty(
3539 Context,
3540 /*PathSize*/ Record[ASTStmtReader::NumExprFields],
3541 /*HasFPFeatures*/ Record[ASTStmtReader::NumExprFields + 1]);
3542 break;
3543
3544 case EXPR_BUILTIN_BIT_CAST:
3545 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~++20200917111122+b03c2b8395b/clang/lib/Serialization/ASTReaderStmt.cpp"
, 3545, __PRETTY_FUNCTION__))
;
3546 S = new (Context) BuiltinBitCastExpr(Empty);
3547 break;
3548
3549 case EXPR_USER_DEFINED_LITERAL:
3550 S = UserDefinedLiteral::CreateEmpty(
3551 Context, /*NumArgs=*/Record[ASTStmtReader::NumExprFields],
3552 /*HasFPFeatures=*/Record[ASTStmtReader::NumExprFields + 1], Empty);
3553 break;
3554
3555 case EXPR_CXX_STD_INITIALIZER_LIST:
3556 S = new (Context) CXXStdInitializerListExpr(Empty);
3557 break;
3558
3559 case EXPR_CXX_BOOL_LITERAL:
3560 S = new (Context) CXXBoolLiteralExpr(Empty);
3561 break;
3562
3563 case EXPR_CXX_NULL_PTR_LITERAL:
3564 S = new (Context) CXXNullPtrLiteralExpr(Empty);
3565 break;
3566
3567 case EXPR_CXX_TYPEID_EXPR:
3568 S = new (Context) CXXTypeidExpr(Empty, true);
3569 break;
3570
3571 case EXPR_CXX_TYPEID_TYPE:
3572 S = new (Context) CXXTypeidExpr(Empty, false);
3573 break;
3574
3575 case EXPR_CXX_UUIDOF_EXPR:
3576 S = new (Context) CXXUuidofExpr(Empty, true);
3577 break;
3578
3579 case EXPR_CXX_PROPERTY_REF_EXPR:
3580 S = new (Context) MSPropertyRefExpr(Empty);
3581 break;
3582
3583 case EXPR_CXX_PROPERTY_SUBSCRIPT_EXPR:
3584 S = new (Context) MSPropertySubscriptExpr(Empty);
3585 break;
3586
3587 case EXPR_CXX_UUIDOF_TYPE:
3588 S = new (Context) CXXUuidofExpr(Empty, false);
3589 break;
3590
3591 case EXPR_CXX_THIS:
3592 S = new (Context) CXXThisExpr(Empty);
3593 break;
3594
3595 case EXPR_CXX_THROW:
3596 S = new (Context) CXXThrowExpr(Empty);
3597 break;
3598
3599 case EXPR_CXX_DEFAULT_ARG:
3600 S = new (Context) CXXDefaultArgExpr(Empty);
3601 break;
3602
3603 case EXPR_CXX_DEFAULT_INIT:
3604 S = new (Context) CXXDefaultInitExpr(Empty);
3605 break;
3606
3607 case EXPR_CXX_BIND_TEMPORARY:
3608 S = new (Context) CXXBindTemporaryExpr(Empty);
3609 break;
3610
3611 case EXPR_CXX_SCALAR_VALUE_INIT:
3612 S = new (Context) CXXScalarValueInitExpr(Empty);
3613 break;
3614
3615 case EXPR_CXX_NEW:
3616 S = CXXNewExpr::CreateEmpty(
3617 Context,
3618 /*IsArray=*/Record[ASTStmtReader::NumExprFields],
3619 /*HasInit=*/Record[ASTStmtReader::NumExprFields + 1],
3620 /*NumPlacementArgs=*/Record[ASTStmtReader::NumExprFields + 2],
3621 /*IsParenTypeId=*/Record[ASTStmtReader::NumExprFields + 3]);
3622 break;
3623
3624 case EXPR_CXX_DELETE:
3625 S = new (Context) CXXDeleteExpr(Empty);
3626 break;
3627
3628 case EXPR_CXX_PSEUDO_DESTRUCTOR:
3629 S = new (Context) CXXPseudoDestructorExpr(Empty);
3630 break;
3631
3632 case EXPR_EXPR_WITH_CLEANUPS:
3633 S = ExprWithCleanups::Create(Context, Empty,
3634 Record[ASTStmtReader::NumExprFields]);
3635 break;
3636
3637 case EXPR_CXX_DEPENDENT_SCOPE_MEMBER:
3638 S = CXXDependentScopeMemberExpr::CreateEmpty(
3639 Context,
3640 /*HasTemplateKWAndArgsInfo=*/Record[ASTStmtReader::NumExprFields],
3641 /*NumTemplateArgs=*/Record[ASTStmtReader::NumExprFields + 1],
3642 /*HasFirstQualifierFoundInScope=*/
3643 Record[ASTStmtReader::NumExprFields + 2]);
3644 break;
3645
3646 case EXPR_CXX_DEPENDENT_SCOPE_DECL_REF:
3647 S = DependentScopeDeclRefExpr::CreateEmpty(Context,
3648 /*HasTemplateKWAndArgsInfo=*/Record[ASTStmtReader::NumExprFields],
3649 /*NumTemplateArgs=*/Record[ASTStmtReader::NumExprFields]
3650 ? Record[ASTStmtReader::NumExprFields + 1]
3651 : 0);
3652 break;
3653
3654 case EXPR_CXX_UNRESOLVED_CONSTRUCT:
3655 S = CXXUnresolvedConstructExpr::CreateEmpty(Context,
3656 /*NumArgs=*/Record[ASTStmtReader::NumExprFields]);
3657 break;
3658
3659 case EXPR_CXX_UNRESOLVED_MEMBER:
3660 S = UnresolvedMemberExpr::CreateEmpty(
3661 Context,
3662 /*NumResults=*/Record[ASTStmtReader::NumExprFields],
3663 /*HasTemplateKWAndArgsInfo=*/Record[ASTStmtReader::NumExprFields + 1],
3664 /*NumTemplateArgs=*/
3665 Record[ASTStmtReader::NumExprFields + 1]
3666 ? Record[ASTStmtReader::NumExprFields + 2]
3667 : 0);
3668 break;
3669
3670 case EXPR_CXX_UNRESOLVED_LOOKUP:
3671 S = UnresolvedLookupExpr::CreateEmpty(
3672 Context,
3673 /*NumResults=*/Record[ASTStmtReader::NumExprFields],
3674 /*HasTemplateKWAndArgsInfo=*/Record[ASTStmtReader::NumExprFields + 1],
3675 /*NumTemplateArgs=*/
3676 Record[ASTStmtReader::NumExprFields + 1]
3677 ? Record[ASTStmtReader::NumExprFields + 2]
3678 : 0);
3679 break;
3680
3681 case EXPR_TYPE_TRAIT:
3682 S = TypeTraitExpr::CreateDeserialized(Context,
3683 Record[ASTStmtReader::NumExprFields]);
3684 break;
3685
3686 case EXPR_ARRAY_TYPE_TRAIT:
3687 S = new (Context) ArrayTypeTraitExpr(Empty);
3688 break;
3689
3690 case EXPR_CXX_EXPRESSION_TRAIT:
3691 S = new (Context) ExpressionTraitExpr(Empty);
3692 break;
3693
3694 case EXPR_CXX_NOEXCEPT:
3695 S = new (Context) CXXNoexceptExpr(Empty);
3696 break;
3697
3698 case EXPR_PACK_EXPANSION:
3699 S = new (Context) PackExpansionExpr(Empty);
3700 break;
3701
3702 case EXPR_SIZEOF_PACK:
3703 S = SizeOfPackExpr::CreateDeserialized(
3704 Context,
3705 /*NumPartialArgs=*/Record[ASTStmtReader::NumExprFields]);
3706 break;
3707
3708 case EXPR_SUBST_NON_TYPE_TEMPLATE_PARM:
3709 S = new (Context) SubstNonTypeTemplateParmExpr(Empty);
3710 break;
3711
3712 case EXPR_SUBST_NON_TYPE_TEMPLATE_PARM_PACK:
3713 S = new (Context) SubstNonTypeTemplateParmPackExpr(Empty);
3714 break;
3715
3716 case EXPR_FUNCTION_PARM_PACK:
3717 S = FunctionParmPackExpr::CreateEmpty(Context,
3718 Record[ASTStmtReader::NumExprFields]);
3719 break;
3720
3721 case EXPR_MATERIALIZE_TEMPORARY:
3722 S = new (Context) MaterializeTemporaryExpr(Empty);
3723 break;
3724
3725 case EXPR_CXX_FOLD:
3726 S = new (Context) CXXFoldExpr(Empty);
3727 break;
3728
3729 case EXPR_OPAQUE_VALUE:
3730 S = new (Context) OpaqueValueExpr(Empty);
3731 break;
3732
3733 case EXPR_CUDA_KERNEL_CALL:
3734 S = CUDAKernelCallExpr::CreateEmpty(
3735 Context, /*NumArgs=*/Record[ASTStmtReader::NumExprFields],
3736 /*HasFPFeatures=*/Record[ASTStmtReader::NumExprFields + 1], Empty);
3737 break;
3738
3739 case EXPR_ASTYPE:
3740 S = new (Context) AsTypeExpr(Empty);
3741 break;
3742
3743 case EXPR_PSEUDO_OBJECT: {
3744 unsigned numSemanticExprs = Record[ASTStmtReader::NumExprFields];
3745 S = PseudoObjectExpr::Create(Context, Empty, numSemanticExprs);
3746 break;
3747 }
3748
3749 case EXPR_ATOMIC:
3750 S = new (Context) AtomicExpr(Empty);
3751 break;
3752
3753 case EXPR_LAMBDA: {
3754 unsigned NumCaptures = Record[ASTStmtReader::NumExprFields];
3755 S = LambdaExpr::CreateDeserialized(Context, NumCaptures);
3756 break;
3757 }
3758
3759 case STMT_COROUTINE_BODY: {
3760 unsigned NumParams = Record[ASTStmtReader::NumStmtFields];
3761 S = CoroutineBodyStmt::Create(Context, Empty, NumParams);
3762 break;
3763 }
3764
3765 case STMT_CORETURN:
3766 S = new (Context) CoreturnStmt(Empty);
3767 break;
3768
3769 case EXPR_COAWAIT:
3770 S = new (Context) CoawaitExpr(Empty);
3771 break;
3772
3773 case EXPR_COYIELD:
3774 S = new (Context) CoyieldExpr(Empty);
3775 break;
3776
3777 case EXPR_DEPENDENT_COAWAIT:
3778 S = new (Context) DependentCoawaitExpr(Empty);
3779 break;
3780
3781 case EXPR_CONCEPT_SPECIALIZATION: {
3782 unsigned numTemplateArgs = Record[ASTStmtReader::NumExprFields];
3783 S = ConceptSpecializationExpr::Create(Context, Empty, numTemplateArgs);
3784 break;
3785 }
3786
3787 case EXPR_REQUIRES:
3788 unsigned numLocalParameters = Record[ASTStmtReader::NumExprFields];
3789 unsigned numRequirement = Record[ASTStmtReader::NumExprFields + 1];
3790 S = RequiresExpr::Create(Context, Empty, numLocalParameters,
3791 numRequirement);
3792 break;
3793 }
3794
3795 // We hit a STMT_STOP, so we're done with this expression.
3796 if (Finished)
3797 break;
3798
3799 ++NumStatementsRead;
3800
3801 if (S && !IsStmtReference) {
3802 Reader.Visit(S);
3803 StmtEntries[Cursor.GetCurrentBitNo()] = S;
3804 }
3805
3806 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~++20200917111122+b03c2b8395b/clang/lib/Serialization/ASTReaderStmt.cpp"
, 3807, __PRETTY_FUNCTION__))
3807 "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~++20200917111122+b03c2b8395b/clang/lib/Serialization/ASTReaderStmt.cpp"
, 3807, __PRETTY_FUNCTION__))
;
3808 StmtStack.push_back(S);
3809 }
3810Done:
3811 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~++20200917111122+b03c2b8395b/clang/lib/Serialization/ASTReaderStmt.cpp"
, 3811, __PRETTY_FUNCTION__))
;
3812 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~++20200917111122+b03c2b8395b/clang/lib/Serialization/ASTReaderStmt.cpp"
, 3812, __PRETTY_FUNCTION__))
;
3813 return StmtStack.pop_back_val();
3814}