Bug Summary

File:tools/clang/lib/Serialization/ASTReaderStmt.cpp
Warning:line 692, column 7
Called C++ object pointer is null

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -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 -analyzer-config-compatibility-mode=true -mrelocation-model pic -pic-level 2 -mthread-model posix -relaxed-aliasing -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -momit-leaf-frame-pointer -ffunction-sections -fdata-sections -resource-dir /usr/lib/llvm-8/lib/clang/8.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-8~svn350071/build-llvm/tools/clang/lib/Serialization -I /build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/Serialization -I /build/llvm-toolchain-snapshot-8~svn350071/tools/clang/include -I /build/llvm-toolchain-snapshot-8~svn350071/build-llvm/tools/clang/include -I /build/llvm-toolchain-snapshot-8~svn350071/build-llvm/include -I /build/llvm-toolchain-snapshot-8~svn350071/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/include/clang/8.0.0/include/ -internal-isystem /usr/local/include -internal-isystem /usr/lib/llvm-8/lib/clang/8.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++11 -fdeprecated-macro -fdebug-compilation-dir /build/llvm-toolchain-snapshot-8~svn350071/build-llvm/tools/clang/lib/Serialization -fdebug-prefix-map=/build/llvm-toolchain-snapshot-8~svn350071=. -ferror-limit 19 -fmessage-length 0 -fvisibility-inlines-hidden -stack-protector 2 -fobjc-runtime=gcc -fno-common -fdiagnostics-show-option -vectorize-loops -vectorize-slp -analyzer-output=html -analyzer-config stable-report-filename=true -o /tmp/scan-build-2018-12-27-042839-1215-1 -x c++ /build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/Serialization/ASTReaderStmt.cpp -faddrsig
1//===- ASTReaderStmt.cpp - Stmt/Expr Deserialization ----------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// Statement/expression deserialization. This implements the
11// ASTReader::ReadStmt method.
12//
13//===----------------------------------------------------------------------===//
14
15#include "clang/Serialization/ASTReader.h"
16#include "clang/AST/ASTContext.h"
17#include "clang/AST/AttrIterator.h"
18#include "clang/AST/Decl.h"
19#include "clang/AST/DeclAccessPair.h"
20#include "clang/AST/DeclCXX.h"
21#include "clang/AST/DeclGroup.h"
22#include "clang/AST/DeclObjC.h"
23#include "clang/AST/DeclTemplate.h"
24#include "clang/AST/DeclarationName.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 "llvm/ADT/DenseMap.h"
53#include "llvm/ADT/SmallString.h"
54#include "llvm/ADT/SmallVector.h"
55#include "llvm/ADT/StringRef.h"
56#include "llvm/Bitcode/BitstreamReader.h"
57#include "llvm/Support/Casting.h"
58#include "llvm/Support/ErrorHandling.h"
59#include <algorithm>
60#include <cassert>
61#include <cstdint>
62#include <string>
63
64using namespace clang;
65using namespace serialization;
66
67namespace clang {
68
69 class ASTStmtReader : public StmtVisitor<ASTStmtReader> {
70 friend class OMPClauseReader;
71
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 *GetTypeSourceInfo() {
88 return Record.getTypeSourceInfo();
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 void ReadDeclarationNameLoc(DeclarationNameLoc &DNLoc,
101 DeclarationName Name) {
102 Record.readDeclarationNameLoc(DNLoc, Name);
103 }
104
105 void ReadDeclarationNameInfo(DeclarationNameInfo &NameInfo) {
106 Record.readDeclarationNameInfo(NameInfo);
107 }
108
109 public:
110 ASTStmtReader(ASTRecordReader &Record, llvm::BitstreamCursor &Cursor)
111 : Record(Record), DeclsCursor(Cursor) {}
112
113 /// The number of record fields required for the Stmt class
114 /// itself.
115 static const unsigned NumStmtFields = 0;
116
117 /// The number of record fields required for the Expr class
118 /// itself.
119 static const unsigned NumExprFields = NumStmtFields + 7;
120
121 /// Read and initialize a ExplicitTemplateArgumentList structure.
122 void ReadTemplateKWAndArgsInfo(ASTTemplateKWAndArgsInfo &Args,
123 TemplateArgumentLoc *ArgsLocArray,
124 unsigned NumTemplateArgs);
125
126 /// Read and initialize a ExplicitTemplateArgumentList structure.
127 void ReadExplicitTemplateArgumentList(ASTTemplateArgumentListInfo &ArgList,
128 unsigned NumTemplateArgs);
129
130 void VisitStmt(Stmt *S);
131#define STMT(Type, Base) \
132 void Visit##Type(Type *);
133#include "clang/AST/StmtNodes.inc"
134 };
135
136} // namespace clang
137
138void ASTStmtReader::ReadTemplateKWAndArgsInfo(ASTTemplateKWAndArgsInfo &Args,
139 TemplateArgumentLoc *ArgsLocArray,
140 unsigned NumTemplateArgs) {
141 SourceLocation TemplateKWLoc = ReadSourceLocation();
142 TemplateArgumentListInfo ArgInfo;
143 ArgInfo.setLAngleLoc(ReadSourceLocation());
144 ArgInfo.setRAngleLoc(ReadSourceLocation());
145 for (unsigned i = 0; i != NumTemplateArgs; ++i)
146 ArgInfo.addArgument(Record.readTemplateArgumentLoc());
147 Args.initializeFrom(TemplateKWLoc, ArgInfo, ArgsLocArray);
148}
149
150void ASTStmtReader::VisitStmt(Stmt *S) {
151 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-8~svn350071/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 151, __PRETTY_FUNCTION__))
;
152}
153
154void ASTStmtReader::VisitNullStmt(NullStmt *S) {
155 VisitStmt(S);
156 S->setSemiLoc(ReadSourceLocation());
157 S->NullStmtBits.HasLeadingEmptyMacro = Record.readInt();
158}
159
160void ASTStmtReader::VisitCompoundStmt(CompoundStmt *S) {
161 VisitStmt(S);
162 SmallVector<Stmt *, 16> Stmts;
163 unsigned NumStmts = Record.readInt();
164 while (NumStmts--)
165 Stmts.push_back(Record.readSubStmt());
166 S->setStmts(Stmts);
167 S->CompoundStmtBits.LBraceLoc = ReadSourceLocation();
168 S->RBraceLoc = ReadSourceLocation();
169}
170
171void ASTStmtReader::VisitSwitchCase(SwitchCase *S) {
172 VisitStmt(S);
173 Record.recordSwitchCaseID(S, Record.readInt());
174 S->setKeywordLoc(ReadSourceLocation());
175 S->setColonLoc(ReadSourceLocation());
176}
177
178void ASTStmtReader::VisitCaseStmt(CaseStmt *S) {
179 VisitSwitchCase(S);
180 bool CaseStmtIsGNURange = Record.readInt();
181 S->setLHS(Record.readSubExpr());
182 S->setSubStmt(Record.readSubStmt());
183 if (CaseStmtIsGNURange) {
184 S->setRHS(Record.readSubExpr());
185 S->setEllipsisLoc(ReadSourceLocation());
186 }
187}
188
189void ASTStmtReader::VisitDefaultStmt(DefaultStmt *S) {
190 VisitSwitchCase(S);
191 S->setSubStmt(Record.readSubStmt());
192}
193
194void ASTStmtReader::VisitLabelStmt(LabelStmt *S) {
195 VisitStmt(S);
196 auto *LD = ReadDeclAs<LabelDecl>();
197 LD->setStmt(S);
198 S->setDecl(LD);
199 S->setSubStmt(Record.readSubStmt());
200 S->setIdentLoc(ReadSourceLocation());
201}
202
203void ASTStmtReader::VisitAttributedStmt(AttributedStmt *S) {
204 VisitStmt(S);
205 // NumAttrs in AttributedStmt is set when creating an empty
206 // AttributedStmt in AttributedStmt::CreateEmpty, since it is needed
207 // to allocate the right amount of space for the trailing Attr *.
208 uint64_t NumAttrs = Record.readInt();
209 AttrVec Attrs;
210 Record.readAttributes(Attrs);
211 (void)NumAttrs;
212 assert(NumAttrs == S->AttributedStmtBits.NumAttrs)((NumAttrs == S->AttributedStmtBits.NumAttrs) ? static_cast
<void> (0) : __assert_fail ("NumAttrs == S->AttributedStmtBits.NumAttrs"
, "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 212, __PRETTY_FUNCTION__))
;
213 assert(NumAttrs == Attrs.size())((NumAttrs == Attrs.size()) ? static_cast<void> (0) : __assert_fail
("NumAttrs == Attrs.size()", "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 213, __PRETTY_FUNCTION__))
;
214 std::copy(Attrs.begin(), Attrs.end(), S->getAttrArrayPtr());
215 S->SubStmt = Record.readSubStmt();
216 S->AttributedStmtBits.AttrLoc = ReadSourceLocation();
217}
218
219void ASTStmtReader::VisitIfStmt(IfStmt *S) {
220 VisitStmt(S);
221
222 S->setConstexpr(Record.readInt());
223 bool HasElse = Record.readInt();
224 bool HasVar = Record.readInt();
225 bool HasInit = Record.readInt();
226
227 S->setCond(Record.readSubExpr());
228 S->setThen(Record.readSubStmt());
229 if (HasElse)
230 S->setElse(Record.readSubStmt());
231 if (HasVar)
232 S->setConditionVariable(Record.getContext(), ReadDeclAs<VarDecl>());
233 if (HasInit)
234 S->setInit(Record.readSubStmt());
235
236 S->setIfLoc(ReadSourceLocation());
237 if (HasElse)
238 S->setElseLoc(ReadSourceLocation());
239}
240
241void ASTStmtReader::VisitSwitchStmt(SwitchStmt *S) {
242 VisitStmt(S);
243
244 bool HasInit = Record.readInt();
245 bool HasVar = Record.readInt();
246 bool AllEnumCasesCovered = Record.readInt();
247 if (AllEnumCasesCovered)
248 S->setAllEnumCasesCovered();
249
250 S->setCond(Record.readSubExpr());
251 S->setBody(Record.readSubStmt());
252 if (HasInit)
253 S->setInit(Record.readSubStmt());
254 if (HasVar)
255 S->setConditionVariable(Record.getContext(), ReadDeclAs<VarDecl>());
256
257 S->setSwitchLoc(ReadSourceLocation());
258
259 SwitchCase *PrevSC = nullptr;
260 for (auto E = Record.size(); Record.getIdx() != E; ) {
261 SwitchCase *SC = Record.getSwitchCaseWithID(Record.readInt());
262 if (PrevSC)
263 PrevSC->setNextSwitchCase(SC);
264 else
265 S->setSwitchCaseList(SC);
266
267 PrevSC = SC;
268 }
269}
270
271void ASTStmtReader::VisitWhileStmt(WhileStmt *S) {
272 VisitStmt(S);
273
274 bool HasVar = Record.readInt();
275
276 S->setCond(Record.readSubExpr());
277 S->setBody(Record.readSubStmt());
278 if (HasVar)
279 S->setConditionVariable(Record.getContext(), ReadDeclAs<VarDecl>());
280
281 S->setWhileLoc(ReadSourceLocation());
282}
283
284void ASTStmtReader::VisitDoStmt(DoStmt *S) {
285 VisitStmt(S);
286 S->setCond(Record.readSubExpr());
287 S->setBody(Record.readSubStmt());
288 S->setDoLoc(ReadSourceLocation());
289 S->setWhileLoc(ReadSourceLocation());
290 S->setRParenLoc(ReadSourceLocation());
291}
292
293void ASTStmtReader::VisitForStmt(ForStmt *S) {
294 VisitStmt(S);
295 S->setInit(Record.readSubStmt());
296 S->setCond(Record.readSubExpr());
297 S->setConditionVariable(Record.getContext(), ReadDeclAs<VarDecl>());
298 S->setInc(Record.readSubExpr());
299 S->setBody(Record.readSubStmt());
300 S->setForLoc(ReadSourceLocation());
301 S->setLParenLoc(ReadSourceLocation());
302 S->setRParenLoc(ReadSourceLocation());
303}
304
305void ASTStmtReader::VisitGotoStmt(GotoStmt *S) {
306 VisitStmt(S);
307 S->setLabel(ReadDeclAs<LabelDecl>());
308 S->setGotoLoc(ReadSourceLocation());
309 S->setLabelLoc(ReadSourceLocation());
310}
311
312void ASTStmtReader::VisitIndirectGotoStmt(IndirectGotoStmt *S) {
313 VisitStmt(S);
314 S->setGotoLoc(ReadSourceLocation());
315 S->setStarLoc(ReadSourceLocation());
316 S->setTarget(Record.readSubExpr());
317}
318
319void ASTStmtReader::VisitContinueStmt(ContinueStmt *S) {
320 VisitStmt(S);
321 S->setContinueLoc(ReadSourceLocation());
322}
323
324void ASTStmtReader::VisitBreakStmt(BreakStmt *S) {
325 VisitStmt(S);
326 S->setBreakLoc(ReadSourceLocation());
327}
328
329void ASTStmtReader::VisitReturnStmt(ReturnStmt *S) {
330 VisitStmt(S);
331
332 bool HasNRVOCandidate = Record.readInt();
333
334 S->setRetValue(Record.readSubExpr());
335 if (HasNRVOCandidate)
336 S->setNRVOCandidate(ReadDeclAs<VarDecl>());
337
338 S->setReturnLoc(ReadSourceLocation());
339}
340
341void ASTStmtReader::VisitDeclStmt(DeclStmt *S) {
342 VisitStmt(S);
343 S->setStartLoc(ReadSourceLocation());
344 S->setEndLoc(ReadSourceLocation());
345
346 if (Record.size() - Record.getIdx() == 1) {
347 // Single declaration
348 S->setDeclGroup(DeclGroupRef(ReadDecl()));
349 } else {
350 SmallVector<Decl *, 16> Decls;
351 int N = Record.size() - Record.getIdx();
352 Decls.reserve(N);
353 for (int I = 0; I < N; ++I)
354 Decls.push_back(ReadDecl());
355 S->setDeclGroup(DeclGroupRef(DeclGroup::Create(Record.getContext(),
356 Decls.data(),
357 Decls.size())));
358 }
359}
360
361void ASTStmtReader::VisitAsmStmt(AsmStmt *S) {
362 VisitStmt(S);
363 S->NumOutputs = Record.readInt();
364 S->NumInputs = Record.readInt();
365 S->NumClobbers = Record.readInt();
366 S->setAsmLoc(ReadSourceLocation());
367 S->setVolatile(Record.readInt());
368 S->setSimple(Record.readInt());
369}
370
371void ASTStmtReader::VisitGCCAsmStmt(GCCAsmStmt *S) {
372 VisitAsmStmt(S);
373 S->setRParenLoc(ReadSourceLocation());
374 S->setAsmString(cast_or_null<StringLiteral>(Record.readSubStmt()));
375
376 unsigned NumOutputs = S->getNumOutputs();
377 unsigned NumInputs = S->getNumInputs();
378 unsigned NumClobbers = S->getNumClobbers();
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.getIdentifierInfo());
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 S->setOutputsAndInputsAndClobbers(Record.getContext(),
396 Names.data(), Constraints.data(),
397 Exprs.data(), NumOutputs, NumInputs,
398 Clobbers.data(), NumClobbers);
399}
400
401void ASTStmtReader::VisitMSAsmStmt(MSAsmStmt *S) {
402 VisitAsmStmt(S);
403 S->LBraceLoc = ReadSourceLocation();
404 S->EndLoc = ReadSourceLocation();
405 S->NumAsmToks = Record.readInt();
406 std::string AsmStr = ReadString();
407
408 // Read the tokens.
409 SmallVector<Token, 16> AsmToks;
410 AsmToks.reserve(S->NumAsmToks);
411 for (unsigned i = 0, e = S->NumAsmToks; i != e; ++i) {
412 AsmToks.push_back(Record.readToken());
413 }
414
415 // The calls to reserve() for the FooData vectors are mandatory to
416 // prevent dead StringRefs in the Foo vectors.
417
418 // Read the clobbers.
419 SmallVector<std::string, 16> ClobbersData;
420 SmallVector<StringRef, 16> Clobbers;
421 ClobbersData.reserve(S->NumClobbers);
422 Clobbers.reserve(S->NumClobbers);
423 for (unsigned i = 0, e = S->NumClobbers; i != e; ++i) {
424 ClobbersData.push_back(ReadString());
425 Clobbers.push_back(ClobbersData.back());
426 }
427
428 // Read the operands.
429 unsigned NumOperands = S->NumOutputs + S->NumInputs;
430 SmallVector<Expr*, 16> Exprs;
431 SmallVector<std::string, 16> ConstraintsData;
432 SmallVector<StringRef, 16> Constraints;
433 Exprs.reserve(NumOperands);
434 ConstraintsData.reserve(NumOperands);
435 Constraints.reserve(NumOperands);
436 for (unsigned i = 0; i != NumOperands; ++i) {
437 Exprs.push_back(cast<Expr>(Record.readSubStmt()));
438 ConstraintsData.push_back(ReadString());
439 Constraints.push_back(ConstraintsData.back());
440 }
441
442 S->initialize(Record.getContext(), AsmStr, AsmToks,
443 Constraints, Exprs, Clobbers);
444}
445
446void ASTStmtReader::VisitCoroutineBodyStmt(CoroutineBodyStmt *S) {
447 VisitStmt(S);
448 assert(Record.peekInt() == S->NumParams)((Record.peekInt() == S->NumParams) ? static_cast<void>
(0) : __assert_fail ("Record.peekInt() == S->NumParams", "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 448, __PRETTY_FUNCTION__))
;
449 Record.skipInts(1);
450 auto *StoredStmts = S->getStoredStmts();
451 for (unsigned i = 0;
452 i < CoroutineBodyStmt::SubStmt::FirstParamMove + S->NumParams; ++i)
453 StoredStmts[i] = Record.readSubStmt();
454}
455
456void ASTStmtReader::VisitCoreturnStmt(CoreturnStmt *S) {
457 VisitStmt(S);
458 S->CoreturnLoc = Record.readSourceLocation();
459 for (auto &SubStmt: S->SubStmts)
460 SubStmt = Record.readSubStmt();
461 S->IsImplicit = Record.readInt() != 0;
462}
463
464void ASTStmtReader::VisitCoawaitExpr(CoawaitExpr *E) {
465 VisitExpr(E);
466 E->KeywordLoc = ReadSourceLocation();
467 for (auto &SubExpr: E->SubExprs)
468 SubExpr = Record.readSubStmt();
469 E->OpaqueValue = cast_or_null<OpaqueValueExpr>(Record.readSubStmt());
470 E->setIsImplicit(Record.readInt() != 0);
471}
472
473void ASTStmtReader::VisitCoyieldExpr(CoyieldExpr *E) {
474 VisitExpr(E);
475 E->KeywordLoc = ReadSourceLocation();
476 for (auto &SubExpr: E->SubExprs)
477 SubExpr = Record.readSubStmt();
478 E->OpaqueValue = cast_or_null<OpaqueValueExpr>(Record.readSubStmt());
479}
480
481void ASTStmtReader::VisitDependentCoawaitExpr(DependentCoawaitExpr *E) {
482 VisitExpr(E);
483 E->KeywordLoc = ReadSourceLocation();
484 for (auto &SubExpr: E->SubExprs)
485 SubExpr = Record.readSubStmt();
486}
487
488void ASTStmtReader::VisitCapturedStmt(CapturedStmt *S) {
489 VisitStmt(S);
490 Record.skipInts(1);
491 S->setCapturedDecl(ReadDeclAs<CapturedDecl>());
492 S->setCapturedRegionKind(static_cast<CapturedRegionKind>(Record.readInt()));
493 S->setCapturedRecordDecl(ReadDeclAs<RecordDecl>());
494
495 // Capture inits
496 for (CapturedStmt::capture_init_iterator I = S->capture_init_begin(),
497 E = S->capture_init_end();
498 I != E; ++I)
499 *I = Record.readSubExpr();
500
501 // Body
502 S->setCapturedStmt(Record.readSubStmt());
503 S->getCapturedDecl()->setBody(S->getCapturedStmt());
504
505 // Captures
506 for (auto &I : S->captures()) {
507 I.VarAndKind.setPointer(ReadDeclAs<VarDecl>());
508 I.VarAndKind.setInt(
509 static_cast<CapturedStmt::VariableCaptureKind>(Record.readInt()));
510 I.Loc = ReadSourceLocation();
511 }
512}
513
514void ASTStmtReader::VisitExpr(Expr *E) {
515 VisitStmt(E);
516 E->setType(Record.readType());
517 E->setTypeDependent(Record.readInt());
518 E->setValueDependent(Record.readInt());
519 E->setInstantiationDependent(Record.readInt());
520 E->ExprBits.ContainsUnexpandedParameterPack = Record.readInt();
521 E->setValueKind(static_cast<ExprValueKind>(Record.readInt()));
522 E->setObjectKind(static_cast<ExprObjectKind>(Record.readInt()));
523 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-8~svn350071/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 524, __PRETTY_FUNCTION__))
524 "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-8~svn350071/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 524, __PRETTY_FUNCTION__))
;
525}
526
527void ASTStmtReader::VisitConstantExpr(ConstantExpr *E) {
528 VisitExpr(E);
529 E->setSubExpr(Record.readSubExpr());
530}
531
532void ASTStmtReader::VisitPredefinedExpr(PredefinedExpr *E) {
533 VisitExpr(E);
534 bool HasFunctionName = Record.readInt();
535 E->PredefinedExprBits.HasFunctionName = HasFunctionName;
536 E->PredefinedExprBits.Kind = Record.readInt();
537 E->setLocation(ReadSourceLocation());
538 if (HasFunctionName)
539 E->setFunctionName(cast<StringLiteral>(Record.readSubExpr()));
540}
541
542void ASTStmtReader::VisitDeclRefExpr(DeclRefExpr *E) {
543 VisitExpr(E);
544
545 E->DeclRefExprBits.HasQualifier = Record.readInt();
546 E->DeclRefExprBits.HasFoundDecl = Record.readInt();
547 E->DeclRefExprBits.HasTemplateKWAndArgsInfo = Record.readInt();
548 E->DeclRefExprBits.HadMultipleCandidates = Record.readInt();
549 E->DeclRefExprBits.RefersToEnclosingVariableOrCapture = Record.readInt();
550 unsigned NumTemplateArgs = 0;
551 if (E->hasTemplateKWAndArgsInfo())
552 NumTemplateArgs = Record.readInt();
553
554 if (E->hasQualifier())
555 new (E->getTrailingObjects<NestedNameSpecifierLoc>())
556 NestedNameSpecifierLoc(Record.readNestedNameSpecifierLoc());
557
558 if (E->hasFoundDecl())
559 *E->getTrailingObjects<NamedDecl *>() = ReadDeclAs<NamedDecl>();
560
561 if (E->hasTemplateKWAndArgsInfo())
562 ReadTemplateKWAndArgsInfo(
563 *E->getTrailingObjects<ASTTemplateKWAndArgsInfo>(),
564 E->getTrailingObjects<TemplateArgumentLoc>(), NumTemplateArgs);
565
566 E->setDecl(ReadDeclAs<ValueDecl>());
567 E->setLocation(ReadSourceLocation());
568 ReadDeclarationNameLoc(E->DNLoc, E->getDecl()->getDeclName());
569}
570
571void ASTStmtReader::VisitIntegerLiteral(IntegerLiteral *E) {
572 VisitExpr(E);
573 E->setLocation(ReadSourceLocation());
574 E->setValue(Record.getContext(), Record.readAPInt());
575}
576
577void ASTStmtReader::VisitFixedPointLiteral(FixedPointLiteral *E) {
578 VisitExpr(E);
579 E->setLocation(ReadSourceLocation());
580 E->setValue(Record.getContext(), Record.readAPInt());
581}
582
583void ASTStmtReader::VisitFloatingLiteral(FloatingLiteral *E) {
584 VisitExpr(E);
585 E->setRawSemantics(static_cast<Stmt::APFloatSemantics>(Record.readInt()));
586 E->setExact(Record.readInt());
587 E->setValue(Record.getContext(), Record.readAPFloat(E->getSemantics()));
588 E->setLocation(ReadSourceLocation());
589}
590
591void ASTStmtReader::VisitImaginaryLiteral(ImaginaryLiteral *E) {
592 VisitExpr(E);
593 E->setSubExpr(Record.readSubExpr());
594}
595
596void ASTStmtReader::VisitStringLiteral(StringLiteral *E) {
597 VisitExpr(E);
598
599 // NumConcatenated, Length and CharByteWidth are set by the empty
600 // ctor since they are needed to allocate storage for the trailing objects.
601 unsigned NumConcatenated = Record.readInt();
602 unsigned Length = Record.readInt();
603 unsigned CharByteWidth = Record.readInt();
604 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-8~svn350071/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 605, __PRETTY_FUNCTION__))
605 "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-8~svn350071/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 605, __PRETTY_FUNCTION__))
;
606 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-8~svn350071/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 606, __PRETTY_FUNCTION__))
;
607 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-8~svn350071/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 607, __PRETTY_FUNCTION__))
;
608 E->StringLiteralBits.Kind = Record.readInt();
609 E->StringLiteralBits.IsPascal = Record.readInt();
610
611 // The character width is originally computed via mapCharByteWidth.
612 // Check that the deserialized character width is consistant with the result
613 // of calling mapCharByteWidth.
614 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-8~svn350071/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 617, __PRETTY_FUNCTION__))
615 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-8~svn350071/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 617, __PRETTY_FUNCTION__))
616 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-8~svn350071/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 617, __PRETTY_FUNCTION__))
617 "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-8~svn350071/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 617, __PRETTY_FUNCTION__))
;
618
619 // Deserialize the trailing array of SourceLocation.
620 for (unsigned I = 0; I < NumConcatenated; ++I)
621 E->setStrTokenLoc(I, ReadSourceLocation());
622
623 // Deserialize the trailing array of char holding the string data.
624 char *StrData = E->getStrDataAsChar();
625 for (unsigned I = 0; I < Length * CharByteWidth; ++I)
626 StrData[I] = Record.readInt();
627}
628
629void ASTStmtReader::VisitCharacterLiteral(CharacterLiteral *E) {
630 VisitExpr(E);
631 E->setValue(Record.readInt());
632 E->setLocation(ReadSourceLocation());
633 E->setKind(static_cast<CharacterLiteral::CharacterKind>(Record.readInt()));
634}
635
636void ASTStmtReader::VisitParenExpr(ParenExpr *E) {
637 VisitExpr(E);
638 E->setLParen(ReadSourceLocation());
639 E->setRParen(ReadSourceLocation());
640 E->setSubExpr(Record.readSubExpr());
641}
642
643void ASTStmtReader::VisitParenListExpr(ParenListExpr *E) {
644 VisitExpr(E);
645 unsigned NumExprs = Record.readInt();
646 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-8~svn350071/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 646, __PRETTY_FUNCTION__))
;
647 for (unsigned I = 0; I != NumExprs; ++I)
648 E->getTrailingObjects<Stmt *>()[I] = Record.readSubStmt();
649 E->LParenLoc = ReadSourceLocation();
650 E->RParenLoc = ReadSourceLocation();
651}
652
653void ASTStmtReader::VisitUnaryOperator(UnaryOperator *E) {
654 VisitExpr(E);
655 E->setSubExpr(Record.readSubExpr());
656 E->setOpcode((UnaryOperator::Opcode)Record.readInt());
657 E->setOperatorLoc(ReadSourceLocation());
658 E->setCanOverflow(Record.readInt());
659}
660
661void ASTStmtReader::VisitOffsetOfExpr(OffsetOfExpr *E) {
662 VisitExpr(E);
663 assert(E->getNumComponents() == Record.peekInt())((E->getNumComponents() == Record.peekInt()) ? static_cast
<void> (0) : __assert_fail ("E->getNumComponents() == Record.peekInt()"
, "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 663, __PRETTY_FUNCTION__))
;
1
'?' condition is true
664 Record.skipInts(1);
665 assert(E->getNumExpressions() == Record.peekInt())((E->getNumExpressions() == Record.peekInt()) ? static_cast
<void> (0) : __assert_fail ("E->getNumExpressions() == Record.peekInt()"
, "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 665, __PRETTY_FUNCTION__))
;
2
'?' condition is true
666 Record.skipInts(1);
667 E->setOperatorLoc(ReadSourceLocation());
668 E->setRParenLoc(ReadSourceLocation());
669 E->setTypeSourceInfo(GetTypeSourceInfo());
670 for (unsigned I = 0, N = E->getNumComponents(); I != N; ++I) {
3
Assuming 'I' is not equal to 'N'
4
Loop condition is true. Entering loop body
671 auto Kind = static_cast<OffsetOfNode::Kind>(Record.readInt());
672 SourceLocation Start = ReadSourceLocation();
673 SourceLocation End = ReadSourceLocation();
674 switch (Kind) {
5
Control jumps to 'case Base:' at line 690
675 case OffsetOfNode::Array:
676 E->setComponent(I, OffsetOfNode(Start, Record.readInt(), End));
677 break;
678
679 case OffsetOfNode::Field:
680 E->setComponent(
681 I, OffsetOfNode(Start, ReadDeclAs<FieldDecl>(), End));
682 break;
683
684 case OffsetOfNode::Identifier:
685 E->setComponent(
686 I,
687 OffsetOfNode(Start, Record.getIdentifierInfo(), End));
688 break;
689
690 case OffsetOfNode::Base: {
691 auto *Base = new (Record.getContext()) CXXBaseSpecifier();
6
'Base' initialized to a null pointer value
692 *Base = Record.readCXXBaseSpecifier();
7
Called C++ object pointer is null
693 E->setComponent(I, OffsetOfNode(Base));
694 break;
695 }
696 }
697 }
698
699 for (unsigned I = 0, N = E->getNumExpressions(); I != N; ++I)
700 E->setIndexExpr(I, Record.readSubExpr());
701}
702
703void ASTStmtReader::VisitUnaryExprOrTypeTraitExpr(UnaryExprOrTypeTraitExpr *E) {
704 VisitExpr(E);
705 E->setKind(static_cast<UnaryExprOrTypeTrait>(Record.readInt()));
706 if (Record.peekInt() == 0) {
707 E->setArgument(Record.readSubExpr());
708 Record.skipInts(1);
709 } else {
710 E->setArgument(GetTypeSourceInfo());
711 }
712 E->setOperatorLoc(ReadSourceLocation());
713 E->setRParenLoc(ReadSourceLocation());
714}
715
716void ASTStmtReader::VisitArraySubscriptExpr(ArraySubscriptExpr *E) {
717 VisitExpr(E);
718 E->setLHS(Record.readSubExpr());
719 E->setRHS(Record.readSubExpr());
720 E->setRBracketLoc(ReadSourceLocation());
721}
722
723void ASTStmtReader::VisitOMPArraySectionExpr(OMPArraySectionExpr *E) {
724 VisitExpr(E);
725 E->setBase(Record.readSubExpr());
726 E->setLowerBound(Record.readSubExpr());
727 E->setLength(Record.readSubExpr());
728 E->setColonLoc(ReadSourceLocation());
729 E->setRBracketLoc(ReadSourceLocation());
730}
731
732void ASTStmtReader::VisitCallExpr(CallExpr *E) {
733 VisitExpr(E);
734 unsigned NumArgs = Record.readInt();
735 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-8~svn350071/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 735, __PRETTY_FUNCTION__))
;
736 E->setRParenLoc(ReadSourceLocation());
737 E->setCallee(Record.readSubExpr());
738 for (unsigned I = 0; I != NumArgs; ++I)
739 E->setArg(I, Record.readSubExpr());
740 E->setADLCallKind(static_cast<CallExpr::ADLCallKind>(Record.readInt()));
741}
742
743void ASTStmtReader::VisitCXXMemberCallExpr(CXXMemberCallExpr *E) {
744 VisitCallExpr(E);
745}
746
747void ASTStmtReader::VisitMemberExpr(MemberExpr *E) {
748 // Don't call VisitExpr, this is fully initialized at creation.
749 assert(E->getStmtClass() == Stmt::MemberExprClass &&((E->getStmtClass() == Stmt::MemberExprClass && "It's a subclass, we must advance Idx!"
) ? static_cast<void> (0) : __assert_fail ("E->getStmtClass() == Stmt::MemberExprClass && \"It's a subclass, we must advance Idx!\""
, "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 750, __PRETTY_FUNCTION__))
750 "It's a subclass, we must advance Idx!")((E->getStmtClass() == Stmt::MemberExprClass && "It's a subclass, we must advance Idx!"
) ? static_cast<void> (0) : __assert_fail ("E->getStmtClass() == Stmt::MemberExprClass && \"It's a subclass, we must advance Idx!\""
, "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 750, __PRETTY_FUNCTION__))
;
751}
752
753void ASTStmtReader::VisitObjCIsaExpr(ObjCIsaExpr *E) {
754 VisitExpr(E);
755 E->setBase(Record.readSubExpr());
756 E->setIsaMemberLoc(ReadSourceLocation());
757 E->setOpLoc(ReadSourceLocation());
758 E->setArrow(Record.readInt());
759}
760
761void ASTStmtReader::
762VisitObjCIndirectCopyRestoreExpr(ObjCIndirectCopyRestoreExpr *E) {
763 VisitExpr(E);
764 E->Operand = Record.readSubExpr();
765 E->setShouldCopy(Record.readInt());
766}
767
768void ASTStmtReader::VisitObjCBridgedCastExpr(ObjCBridgedCastExpr *E) {
769 VisitExplicitCastExpr(E);
770 E->LParenLoc = ReadSourceLocation();
771 E->BridgeKeywordLoc = ReadSourceLocation();
772 E->Kind = Record.readInt();
773}
774
775void ASTStmtReader::VisitCastExpr(CastExpr *E) {
776 VisitExpr(E);
777 unsigned NumBaseSpecs = Record.readInt();
778 assert(NumBaseSpecs == E->path_size())((NumBaseSpecs == E->path_size()) ? static_cast<void>
(0) : __assert_fail ("NumBaseSpecs == E->path_size()", "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 778, __PRETTY_FUNCTION__))
;
779 E->setSubExpr(Record.readSubExpr());
780 E->setCastKind((CastKind)Record.readInt());
781 CastExpr::path_iterator BaseI = E->path_begin();
782 while (NumBaseSpecs--) {
783 auto *BaseSpec = new (Record.getContext()) CXXBaseSpecifier;
784 *BaseSpec = Record.readCXXBaseSpecifier();
785 *BaseI++ = BaseSpec;
786 }
787}
788
789void ASTStmtReader::VisitBinaryOperator(BinaryOperator *E) {
790 VisitExpr(E);
791 E->setLHS(Record.readSubExpr());
792 E->setRHS(Record.readSubExpr());
793 E->setOpcode((BinaryOperator::Opcode)Record.readInt());
794 E->setOperatorLoc(ReadSourceLocation());
795 E->setFPFeatures(FPOptions(Record.readInt()));
796}
797
798void ASTStmtReader::VisitCompoundAssignOperator(CompoundAssignOperator *E) {
799 VisitBinaryOperator(E);
800 E->setComputationLHSType(Record.readType());
801 E->setComputationResultType(Record.readType());
802}
803
804void ASTStmtReader::VisitConditionalOperator(ConditionalOperator *E) {
805 VisitExpr(E);
806 E->SubExprs[ConditionalOperator::COND] = Record.readSubExpr();
807 E->SubExprs[ConditionalOperator::LHS] = Record.readSubExpr();
808 E->SubExprs[ConditionalOperator::RHS] = Record.readSubExpr();
809 E->QuestionLoc = ReadSourceLocation();
810 E->ColonLoc = ReadSourceLocation();
811}
812
813void
814ASTStmtReader::VisitBinaryConditionalOperator(BinaryConditionalOperator *E) {
815 VisitExpr(E);
816 E->OpaqueValue = cast<OpaqueValueExpr>(Record.readSubExpr());
817 E->SubExprs[BinaryConditionalOperator::COMMON] = Record.readSubExpr();
818 E->SubExprs[BinaryConditionalOperator::COND] = Record.readSubExpr();
819 E->SubExprs[BinaryConditionalOperator::LHS] = Record.readSubExpr();
820 E->SubExprs[BinaryConditionalOperator::RHS] = Record.readSubExpr();
821 E->QuestionLoc = ReadSourceLocation();
822 E->ColonLoc = ReadSourceLocation();
823}
824
825void ASTStmtReader::VisitImplicitCastExpr(ImplicitCastExpr *E) {
826 VisitCastExpr(E);
827 E->setIsPartOfExplicitCast(Record.readInt());
828}
829
830void ASTStmtReader::VisitExplicitCastExpr(ExplicitCastExpr *E) {
831 VisitCastExpr(E);
832 E->setTypeInfoAsWritten(GetTypeSourceInfo());
833}
834
835void ASTStmtReader::VisitCStyleCastExpr(CStyleCastExpr *E) {
836 VisitExplicitCastExpr(E);
837 E->setLParenLoc(ReadSourceLocation());
838 E->setRParenLoc(ReadSourceLocation());
839}
840
841void ASTStmtReader::VisitCompoundLiteralExpr(CompoundLiteralExpr *E) {
842 VisitExpr(E);
843 E->setLParenLoc(ReadSourceLocation());
844 E->setTypeSourceInfo(GetTypeSourceInfo());
845 E->setInitializer(Record.readSubExpr());
846 E->setFileScope(Record.readInt());
847}
848
849void ASTStmtReader::VisitExtVectorElementExpr(ExtVectorElementExpr *E) {
850 VisitExpr(E);
851 E->setBase(Record.readSubExpr());
852 E->setAccessor(Record.getIdentifierInfo());
853 E->setAccessorLoc(ReadSourceLocation());
854}
855
856void ASTStmtReader::VisitInitListExpr(InitListExpr *E) {
857 VisitExpr(E);
858 if (auto *SyntForm = cast_or_null<InitListExpr>(Record.readSubStmt()))
859 E->setSyntacticForm(SyntForm);
860 E->setLBraceLoc(ReadSourceLocation());
861 E->setRBraceLoc(ReadSourceLocation());
862 bool isArrayFiller = Record.readInt();
863 Expr *filler = nullptr;
864 if (isArrayFiller) {
865 filler = Record.readSubExpr();
866 E->ArrayFillerOrUnionFieldInit = filler;
867 } else
868 E->ArrayFillerOrUnionFieldInit = ReadDeclAs<FieldDecl>();
869 E->sawArrayRangeDesignator(Record.readInt());
870 unsigned NumInits = Record.readInt();
871 E->reserveInits(Record.getContext(), NumInits);
872 if (isArrayFiller) {
873 for (unsigned I = 0; I != NumInits; ++I) {
874 Expr *init = Record.readSubExpr();
875 E->updateInit(Record.getContext(), I, init ? init : filler);
876 }
877 } else {
878 for (unsigned I = 0; I != NumInits; ++I)
879 E->updateInit(Record.getContext(), I, Record.readSubExpr());
880 }
881}
882
883void ASTStmtReader::VisitDesignatedInitExpr(DesignatedInitExpr *E) {
884 using Designator = DesignatedInitExpr::Designator;
885
886 VisitExpr(E);
887 unsigned NumSubExprs = Record.readInt();
888 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-8~svn350071/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 888, __PRETTY_FUNCTION__))
;
889 for (unsigned I = 0; I != NumSubExprs; ++I)
890 E->setSubExpr(I, Record.readSubExpr());
891 E->setEqualOrColonLoc(ReadSourceLocation());
892 E->setGNUSyntax(Record.readInt());
893
894 SmallVector<Designator, 4> Designators;
895 while (Record.getIdx() < Record.size()) {
896 switch ((DesignatorTypes)Record.readInt()) {
897 case DESIG_FIELD_DECL: {
898 auto *Field = ReadDeclAs<FieldDecl>();
899 SourceLocation DotLoc = ReadSourceLocation();
900 SourceLocation FieldLoc = ReadSourceLocation();
901 Designators.push_back(Designator(Field->getIdentifier(), DotLoc,
902 FieldLoc));
903 Designators.back().setField(Field);
904 break;
905 }
906
907 case DESIG_FIELD_NAME: {
908 const IdentifierInfo *Name = Record.getIdentifierInfo();
909 SourceLocation DotLoc = ReadSourceLocation();
910 SourceLocation FieldLoc = ReadSourceLocation();
911 Designators.push_back(Designator(Name, DotLoc, FieldLoc));
912 break;
913 }
914
915 case DESIG_ARRAY: {
916 unsigned Index = Record.readInt();
917 SourceLocation LBracketLoc = ReadSourceLocation();
918 SourceLocation RBracketLoc = ReadSourceLocation();
919 Designators.push_back(Designator(Index, LBracketLoc, RBracketLoc));
920 break;
921 }
922
923 case DESIG_ARRAY_RANGE: {
924 unsigned Index = Record.readInt();
925 SourceLocation LBracketLoc = ReadSourceLocation();
926 SourceLocation EllipsisLoc = ReadSourceLocation();
927 SourceLocation RBracketLoc = ReadSourceLocation();
928 Designators.push_back(Designator(Index, LBracketLoc, EllipsisLoc,
929 RBracketLoc));
930 break;
931 }
932 }
933 }
934 E->setDesignators(Record.getContext(),
935 Designators.data(), Designators.size());
936}
937
938void ASTStmtReader::VisitDesignatedInitUpdateExpr(DesignatedInitUpdateExpr *E) {
939 VisitExpr(E);
940 E->setBase(Record.readSubExpr());
941 E->setUpdater(Record.readSubExpr());
942}
943
944void ASTStmtReader::VisitNoInitExpr(NoInitExpr *E) {
945 VisitExpr(E);
946}
947
948void ASTStmtReader::VisitArrayInitLoopExpr(ArrayInitLoopExpr *E) {
949 VisitExpr(E);
950 E->SubExprs[0] = Record.readSubExpr();
951 E->SubExprs[1] = Record.readSubExpr();
952}
953
954void ASTStmtReader::VisitArrayInitIndexExpr(ArrayInitIndexExpr *E) {
955 VisitExpr(E);
956}
957
958void ASTStmtReader::VisitImplicitValueInitExpr(ImplicitValueInitExpr *E) {
959 VisitExpr(E);
960}
961
962void ASTStmtReader::VisitVAArgExpr(VAArgExpr *E) {
963 VisitExpr(E);
964 E->setSubExpr(Record.readSubExpr());
965 E->setWrittenTypeInfo(GetTypeSourceInfo());
966 E->setBuiltinLoc(ReadSourceLocation());
967 E->setRParenLoc(ReadSourceLocation());
968 E->setIsMicrosoftABI(Record.readInt());
969}
970
971void ASTStmtReader::VisitAddrLabelExpr(AddrLabelExpr *E) {
972 VisitExpr(E);
973 E->setAmpAmpLoc(ReadSourceLocation());
974 E->setLabelLoc(ReadSourceLocation());
975 E->setLabel(ReadDeclAs<LabelDecl>());
976}
977
978void ASTStmtReader::VisitStmtExpr(StmtExpr *E) {
979 VisitExpr(E);
980 E->setLParenLoc(ReadSourceLocation());
981 E->setRParenLoc(ReadSourceLocation());
982 E->setSubStmt(cast_or_null<CompoundStmt>(Record.readSubStmt()));
983}
984
985void ASTStmtReader::VisitChooseExpr(ChooseExpr *E) {
986 VisitExpr(E);
987 E->setCond(Record.readSubExpr());
988 E->setLHS(Record.readSubExpr());
989 E->setRHS(Record.readSubExpr());
990 E->setBuiltinLoc(ReadSourceLocation());
991 E->setRParenLoc(ReadSourceLocation());
992 E->setIsConditionTrue(Record.readInt());
993}
994
995void ASTStmtReader::VisitGNUNullExpr(GNUNullExpr *E) {
996 VisitExpr(E);
997 E->setTokenLocation(ReadSourceLocation());
998}
999
1000void ASTStmtReader::VisitShuffleVectorExpr(ShuffleVectorExpr *E) {
1001 VisitExpr(E);
1002 SmallVector<Expr *, 16> Exprs;
1003 unsigned NumExprs = Record.readInt();
1004 while (NumExprs--)
1005 Exprs.push_back(Record.readSubExpr());
1006 E->setExprs(Record.getContext(), Exprs);
1007 E->setBuiltinLoc(ReadSourceLocation());
1008 E->setRParenLoc(ReadSourceLocation());
1009}
1010
1011void ASTStmtReader::VisitConvertVectorExpr(ConvertVectorExpr *E) {
1012 VisitExpr(E);
1013 E->BuiltinLoc = ReadSourceLocation();
1014 E->RParenLoc = ReadSourceLocation();
1015 E->TInfo = GetTypeSourceInfo();
1016 E->SrcExpr = Record.readSubExpr();
1017}
1018
1019void ASTStmtReader::VisitBlockExpr(BlockExpr *E) {
1020 VisitExpr(E);
1021 E->setBlockDecl(ReadDeclAs<BlockDecl>());
1022}
1023
1024void ASTStmtReader::VisitGenericSelectionExpr(GenericSelectionExpr *E) {
1025 VisitExpr(E);
1026 E->NumAssocs = Record.readInt();
1027 E->AssocTypes = new (Record.getContext()) TypeSourceInfo*[E->NumAssocs];
1028 E->SubExprs =
1029 new(Record.getContext()) Stmt*[GenericSelectionExpr::END_EXPR+E->NumAssocs];
1030
1031 E->SubExprs[GenericSelectionExpr::CONTROLLING] = Record.readSubExpr();
1032 for (unsigned I = 0, N = E->getNumAssocs(); I != N; ++I) {
1033 E->AssocTypes[I] = GetTypeSourceInfo();
1034 E->SubExprs[GenericSelectionExpr::END_EXPR+I] = Record.readSubExpr();
1035 }
1036 E->ResultIndex = Record.readInt();
1037
1038 E->GenericLoc = ReadSourceLocation();
1039 E->DefaultLoc = ReadSourceLocation();
1040 E->RParenLoc = ReadSourceLocation();
1041}
1042
1043void ASTStmtReader::VisitPseudoObjectExpr(PseudoObjectExpr *E) {
1044 VisitExpr(E);
1045 unsigned numSemanticExprs = Record.readInt();
1046 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-8~svn350071/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 1046, __PRETTY_FUNCTION__))
;
1047 E->PseudoObjectExprBits.ResultIndex = Record.readInt();
1048
1049 // Read the syntactic expression.
1050 E->getSubExprsBuffer()[0] = Record.readSubExpr();
1051
1052 // Read all the semantic expressions.
1053 for (unsigned i = 0; i != numSemanticExprs; ++i) {
1054 Expr *subExpr = Record.readSubExpr();
1055 E->getSubExprsBuffer()[i+1] = subExpr;
1056 }
1057}
1058
1059void ASTStmtReader::VisitAtomicExpr(AtomicExpr *E) {
1060 VisitExpr(E);
1061 E->Op = AtomicExpr::AtomicOp(Record.readInt());
1062 E->NumSubExprs = AtomicExpr::getNumSubExprs(E->Op);
1063 for (unsigned I = 0; I != E->NumSubExprs; ++I)
1064 E->SubExprs[I] = Record.readSubExpr();
1065 E->BuiltinLoc = ReadSourceLocation();
1066 E->RParenLoc = ReadSourceLocation();
1067}
1068
1069//===----------------------------------------------------------------------===//
1070// Objective-C Expressions and Statements
1071
1072void ASTStmtReader::VisitObjCStringLiteral(ObjCStringLiteral *E) {
1073 VisitExpr(E);
1074 E->setString(cast<StringLiteral>(Record.readSubStmt()));
1075 E->setAtLoc(ReadSourceLocation());
1076}
1077
1078void ASTStmtReader::VisitObjCBoxedExpr(ObjCBoxedExpr *E) {
1079 VisitExpr(E);
1080 // could be one of several IntegerLiteral, FloatLiteral, etc.
1081 E->SubExpr = Record.readSubStmt();
1082 E->BoxingMethod = ReadDeclAs<ObjCMethodDecl>();
1083 E->Range = ReadSourceRange();
1084}
1085
1086void ASTStmtReader::VisitObjCArrayLiteral(ObjCArrayLiteral *E) {
1087 VisitExpr(E);
1088 unsigned NumElements = Record.readInt();
1089 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-8~svn350071/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 1089, __PRETTY_FUNCTION__))
;
1090 Expr **Elements = E->getElements();
1091 for (unsigned I = 0, N = NumElements; I != N; ++I)
1092 Elements[I] = Record.readSubExpr();
1093 E->ArrayWithObjectsMethod = ReadDeclAs<ObjCMethodDecl>();
1094 E->Range = ReadSourceRange();
1095}
1096
1097void ASTStmtReader::VisitObjCDictionaryLiteral(ObjCDictionaryLiteral *E) {
1098 VisitExpr(E);
1099 unsigned NumElements = Record.readInt();
1100 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-8~svn350071/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 1100, __PRETTY_FUNCTION__))
;
1101 bool HasPackExpansions = Record.readInt();
1102 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-8~svn350071/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 1102, __PRETTY_FUNCTION__))
;
1103 auto *KeyValues =
1104 E->getTrailingObjects<ObjCDictionaryLiteral::KeyValuePair>();
1105 auto *Expansions =
1106 E->getTrailingObjects<ObjCDictionaryLiteral::ExpansionData>();
1107 for (unsigned I = 0; I != NumElements; ++I) {
1108 KeyValues[I].Key = Record.readSubExpr();
1109 KeyValues[I].Value = Record.readSubExpr();
1110 if (HasPackExpansions) {
1111 Expansions[I].EllipsisLoc = ReadSourceLocation();
1112 Expansions[I].NumExpansionsPlusOne = Record.readInt();
1113 }
1114 }
1115 E->DictWithObjectsMethod = ReadDeclAs<ObjCMethodDecl>();
1116 E->Range = ReadSourceRange();
1117}
1118
1119void ASTStmtReader::VisitObjCEncodeExpr(ObjCEncodeExpr *E) {
1120 VisitExpr(E);
1121 E->setEncodedTypeSourceInfo(GetTypeSourceInfo());
1122 E->setAtLoc(ReadSourceLocation());
1123 E->setRParenLoc(ReadSourceLocation());
1124}
1125
1126void ASTStmtReader::VisitObjCSelectorExpr(ObjCSelectorExpr *E) {
1127 VisitExpr(E);
1128 E->setSelector(Record.readSelector());
1129 E->setAtLoc(ReadSourceLocation());
1130 E->setRParenLoc(ReadSourceLocation());
1131}
1132
1133void ASTStmtReader::VisitObjCProtocolExpr(ObjCProtocolExpr *E) {
1134 VisitExpr(E);
1135 E->setProtocol(ReadDeclAs<ObjCProtocolDecl>());
1136 E->setAtLoc(ReadSourceLocation());
1137 E->ProtoLoc = ReadSourceLocation();
1138 E->setRParenLoc(ReadSourceLocation());
1139}
1140
1141void ASTStmtReader::VisitObjCIvarRefExpr(ObjCIvarRefExpr *E) {
1142 VisitExpr(E);
1143 E->setDecl(ReadDeclAs<ObjCIvarDecl>());
1144 E->setLocation(ReadSourceLocation());
1145 E->setOpLoc(ReadSourceLocation());
1146 E->setBase(Record.readSubExpr());
1147 E->setIsArrow(Record.readInt());
1148 E->setIsFreeIvar(Record.readInt());
1149}
1150
1151void ASTStmtReader::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *E) {
1152 VisitExpr(E);
1153 unsigned MethodRefFlags = Record.readInt();
1154 bool Implicit = Record.readInt() != 0;
1155 if (Implicit) {
1156 auto *Getter = ReadDeclAs<ObjCMethodDecl>();
1157 auto *Setter = ReadDeclAs<ObjCMethodDecl>();
1158 E->setImplicitProperty(Getter, Setter, MethodRefFlags);
1159 } else {
1160 E->setExplicitProperty(ReadDeclAs<ObjCPropertyDecl>(), MethodRefFlags);
1161 }
1162 E->setLocation(ReadSourceLocation());
1163 E->setReceiverLocation(ReadSourceLocation());
1164 switch (Record.readInt()) {
1165 case 0:
1166 E->setBase(Record.readSubExpr());
1167 break;
1168 case 1:
1169 E->setSuperReceiver(Record.readType());
1170 break;
1171 case 2:
1172 E->setClassReceiver(ReadDeclAs<ObjCInterfaceDecl>());
1173 break;
1174 }
1175}
1176
1177void ASTStmtReader::VisitObjCSubscriptRefExpr(ObjCSubscriptRefExpr *E) {
1178 VisitExpr(E);
1179 E->setRBracket(ReadSourceLocation());
1180 E->setBaseExpr(Record.readSubExpr());
1181 E->setKeyExpr(Record.readSubExpr());
1182 E->GetAtIndexMethodDecl = ReadDeclAs<ObjCMethodDecl>();
1183 E->SetAtIndexMethodDecl = ReadDeclAs<ObjCMethodDecl>();
1184}
1185
1186void ASTStmtReader::VisitObjCMessageExpr(ObjCMessageExpr *E) {
1187 VisitExpr(E);
1188 assert(Record.peekInt() == E->getNumArgs())((Record.peekInt() == E->getNumArgs()) ? static_cast<void
> (0) : __assert_fail ("Record.peekInt() == E->getNumArgs()"
, "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 1188, __PRETTY_FUNCTION__))
;
1189 Record.skipInts(1);
1190 unsigned NumStoredSelLocs = Record.readInt();
1191 E->SelLocsKind = Record.readInt();
1192 E->setDelegateInitCall(Record.readInt());
1193 E->IsImplicit = Record.readInt();
1194 auto Kind = static_cast<ObjCMessageExpr::ReceiverKind>(Record.readInt());
1195 switch (Kind) {
1196 case ObjCMessageExpr::Instance:
1197 E->setInstanceReceiver(Record.readSubExpr());
1198 break;
1199
1200 case ObjCMessageExpr::Class:
1201 E->setClassReceiver(GetTypeSourceInfo());
1202 break;
1203
1204 case ObjCMessageExpr::SuperClass:
1205 case ObjCMessageExpr::SuperInstance: {
1206 QualType T = Record.readType();
1207 SourceLocation SuperLoc = ReadSourceLocation();
1208 E->setSuper(SuperLoc, T, Kind == ObjCMessageExpr::SuperInstance);
1209 break;
1210 }
1211 }
1212
1213 assert(Kind == E->getReceiverKind())((Kind == E->getReceiverKind()) ? static_cast<void> (
0) : __assert_fail ("Kind == E->getReceiverKind()", "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 1213, __PRETTY_FUNCTION__))
;
1214
1215 if (Record.readInt())
1216 E->setMethodDecl(ReadDeclAs<ObjCMethodDecl>());
1217 else
1218 E->setSelector(Record.readSelector());
1219
1220 E->LBracLoc = ReadSourceLocation();
1221 E->RBracLoc = ReadSourceLocation();
1222
1223 for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
1224 E->setArg(I, Record.readSubExpr());
1225
1226 SourceLocation *Locs = E->getStoredSelLocs();
1227 for (unsigned I = 0; I != NumStoredSelLocs; ++I)
1228 Locs[I] = ReadSourceLocation();
1229}
1230
1231void ASTStmtReader::VisitObjCForCollectionStmt(ObjCForCollectionStmt *S) {
1232 VisitStmt(S);
1233 S->setElement(Record.readSubStmt());
1234 S->setCollection(Record.readSubExpr());
1235 S->setBody(Record.readSubStmt());
1236 S->setForLoc(ReadSourceLocation());
1237 S->setRParenLoc(ReadSourceLocation());
1238}
1239
1240void ASTStmtReader::VisitObjCAtCatchStmt(ObjCAtCatchStmt *S) {
1241 VisitStmt(S);
1242 S->setCatchBody(Record.readSubStmt());
1243 S->setCatchParamDecl(ReadDeclAs<VarDecl>());
1244 S->setAtCatchLoc(ReadSourceLocation());
1245 S->setRParenLoc(ReadSourceLocation());
1246}
1247
1248void ASTStmtReader::VisitObjCAtFinallyStmt(ObjCAtFinallyStmt *S) {
1249 VisitStmt(S);
1250 S->setFinallyBody(Record.readSubStmt());
1251 S->setAtFinallyLoc(ReadSourceLocation());
1252}
1253
1254void ASTStmtReader::VisitObjCAutoreleasePoolStmt(ObjCAutoreleasePoolStmt *S) {
1255 VisitStmt(S);
1256 S->setSubStmt(Record.readSubStmt());
1257 S->setAtLoc(ReadSourceLocation());
1258}
1259
1260void ASTStmtReader::VisitObjCAtTryStmt(ObjCAtTryStmt *S) {
1261 VisitStmt(S);
1262 assert(Record.peekInt() == S->getNumCatchStmts())((Record.peekInt() == S->getNumCatchStmts()) ? static_cast
<void> (0) : __assert_fail ("Record.peekInt() == S->getNumCatchStmts()"
, "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 1262, __PRETTY_FUNCTION__))
;
1263 Record.skipInts(1);
1264 bool HasFinally = Record.readInt();
1265 S->setTryBody(Record.readSubStmt());
1266 for (unsigned I = 0, N = S->getNumCatchStmts(); I != N; ++I)
1267 S->setCatchStmt(I, cast_or_null<ObjCAtCatchStmt>(Record.readSubStmt()));
1268
1269 if (HasFinally)
1270 S->setFinallyStmt(Record.readSubStmt());
1271 S->setAtTryLoc(ReadSourceLocation());
1272}
1273
1274void ASTStmtReader::VisitObjCAtSynchronizedStmt(ObjCAtSynchronizedStmt *S) {
1275 VisitStmt(S);
1276 S->setSynchExpr(Record.readSubStmt());
1277 S->setSynchBody(Record.readSubStmt());
1278 S->setAtSynchronizedLoc(ReadSourceLocation());
1279}
1280
1281void ASTStmtReader::VisitObjCAtThrowStmt(ObjCAtThrowStmt *S) {
1282 VisitStmt(S);
1283 S->setThrowExpr(Record.readSubStmt());
1284 S->setThrowLoc(ReadSourceLocation());
1285}
1286
1287void ASTStmtReader::VisitObjCBoolLiteralExpr(ObjCBoolLiteralExpr *E) {
1288 VisitExpr(E);
1289 E->setValue(Record.readInt());
1290 E->setLocation(ReadSourceLocation());
1291}
1292
1293void ASTStmtReader::VisitObjCAvailabilityCheckExpr(ObjCAvailabilityCheckExpr *E) {
1294 VisitExpr(E);
1295 SourceRange R = Record.readSourceRange();
1296 E->AtLoc = R.getBegin();
1297 E->RParen = R.getEnd();
1298 E->VersionToCheck = Record.readVersionTuple();
1299}
1300
1301//===----------------------------------------------------------------------===//
1302// C++ Expressions and Statements
1303//===----------------------------------------------------------------------===//
1304
1305void ASTStmtReader::VisitCXXCatchStmt(CXXCatchStmt *S) {
1306 VisitStmt(S);
1307 S->CatchLoc = ReadSourceLocation();
1308 S->ExceptionDecl = ReadDeclAs<VarDecl>();
1309 S->HandlerBlock = Record.readSubStmt();
1310}
1311
1312void ASTStmtReader::VisitCXXTryStmt(CXXTryStmt *S) {
1313 VisitStmt(S);
1314 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-8~svn350071/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 1314, __PRETTY_FUNCTION__))
;
1315 Record.skipInts(1);
1316 S->TryLoc = ReadSourceLocation();
1317 S->getStmts()[0] = Record.readSubStmt();
1318 for (unsigned i = 0, e = S->getNumHandlers(); i != e; ++i)
1319 S->getStmts()[i + 1] = Record.readSubStmt();
1320}
1321
1322void ASTStmtReader::VisitCXXForRangeStmt(CXXForRangeStmt *S) {
1323 VisitStmt(S);
1324 S->ForLoc = ReadSourceLocation();
1325 S->CoawaitLoc = ReadSourceLocation();
1326 S->ColonLoc = ReadSourceLocation();
1327 S->RParenLoc = ReadSourceLocation();
1328 S->setInit(Record.readSubStmt());
1329 S->setRangeStmt(Record.readSubStmt());
1330 S->setBeginStmt(Record.readSubStmt());
1331 S->setEndStmt(Record.readSubStmt());
1332 S->setCond(Record.readSubExpr());
1333 S->setInc(Record.readSubExpr());
1334 S->setLoopVarStmt(Record.readSubStmt());
1335 S->setBody(Record.readSubStmt());
1336}
1337
1338void ASTStmtReader::VisitMSDependentExistsStmt(MSDependentExistsStmt *S) {
1339 VisitStmt(S);
1340 S->KeywordLoc = ReadSourceLocation();
1341 S->IsIfExists = Record.readInt();
1342 S->QualifierLoc = Record.readNestedNameSpecifierLoc();
1343 ReadDeclarationNameInfo(S->NameInfo);
1344 S->SubStmt = Record.readSubStmt();
1345}
1346
1347void ASTStmtReader::VisitCXXOperatorCallExpr(CXXOperatorCallExpr *E) {
1348 VisitCallExpr(E);
1349 E->CXXOperatorCallExprBits.OperatorKind = Record.readInt();
1350 E->CXXOperatorCallExprBits.FPFeatures = Record.readInt();
1351 E->Range = Record.readSourceRange();
1352}
1353
1354void ASTStmtReader::VisitCXXConstructExpr(CXXConstructExpr *E) {
1355 VisitExpr(E);
1356
1357 unsigned NumArgs = Record.readInt();
1358 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-8~svn350071/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 1358, __PRETTY_FUNCTION__))
;
1359
1360 E->CXXConstructExprBits.Elidable = Record.readInt();
1361 E->CXXConstructExprBits.HadMultipleCandidates = Record.readInt();
1362 E->CXXConstructExprBits.ListInitialization = Record.readInt();
1363 E->CXXConstructExprBits.StdInitListInitialization = Record.readInt();
1364 E->CXXConstructExprBits.ZeroInitialization = Record.readInt();
1365 E->CXXConstructExprBits.ConstructionKind = Record.readInt();
1366 E->CXXConstructExprBits.Loc = ReadSourceLocation();
1367 E->Constructor = ReadDeclAs<CXXConstructorDecl>();
1368 E->ParenOrBraceRange = ReadSourceRange();
1369
1370 for (unsigned I = 0; I != NumArgs; ++I)
1371 E->setArg(I, Record.readSubExpr());
1372}
1373
1374void ASTStmtReader::VisitCXXInheritedCtorInitExpr(CXXInheritedCtorInitExpr *E) {
1375 VisitExpr(E);
1376 E->Constructor = ReadDeclAs<CXXConstructorDecl>();
1377 E->Loc = ReadSourceLocation();
1378 E->ConstructsVirtualBase = Record.readInt();
1379 E->InheritedFromVirtualBase = Record.readInt();
1380}
1381
1382void ASTStmtReader::VisitCXXTemporaryObjectExpr(CXXTemporaryObjectExpr *E) {
1383 VisitCXXConstructExpr(E);
1384 E->TSI = GetTypeSourceInfo();
1385}
1386
1387void ASTStmtReader::VisitLambdaExpr(LambdaExpr *E) {
1388 VisitExpr(E);
1389 unsigned NumCaptures = Record.readInt();
1390 assert(NumCaptures == E->NumCaptures)((NumCaptures == E->NumCaptures) ? static_cast<void>
(0) : __assert_fail ("NumCaptures == E->NumCaptures", "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 1390, __PRETTY_FUNCTION__))
;(void)NumCaptures;
1391 E->IntroducerRange = ReadSourceRange();
1392 E->CaptureDefault = static_cast<LambdaCaptureDefault>(Record.readInt());
1393 E->CaptureDefaultLoc = ReadSourceLocation();
1394 E->ExplicitParams = Record.readInt();
1395 E->ExplicitResultType = Record.readInt();
1396 E->ClosingBrace = ReadSourceLocation();
1397
1398 // Read capture initializers.
1399 for (LambdaExpr::capture_init_iterator C = E->capture_init_begin(),
1400 CEnd = E->capture_init_end();
1401 C != CEnd; ++C)
1402 *C = Record.readSubExpr();
1403}
1404
1405void
1406ASTStmtReader::VisitCXXStdInitializerListExpr(CXXStdInitializerListExpr *E) {
1407 VisitExpr(E);
1408 E->SubExpr = Record.readSubExpr();
1409}
1410
1411void ASTStmtReader::VisitCXXNamedCastExpr(CXXNamedCastExpr *E) {
1412 VisitExplicitCastExpr(E);
1413 SourceRange R = ReadSourceRange();
1414 E->Loc = R.getBegin();
1415 E->RParenLoc = R.getEnd();
1416 R = ReadSourceRange();
1417 E->AngleBrackets = R;
1418}
1419
1420void ASTStmtReader::VisitCXXStaticCastExpr(CXXStaticCastExpr *E) {
1421 return VisitCXXNamedCastExpr(E);
1422}
1423
1424void ASTStmtReader::VisitCXXDynamicCastExpr(CXXDynamicCastExpr *E) {
1425 return VisitCXXNamedCastExpr(E);
1426}
1427
1428void ASTStmtReader::VisitCXXReinterpretCastExpr(CXXReinterpretCastExpr *E) {
1429 return VisitCXXNamedCastExpr(E);
1430}
1431
1432void ASTStmtReader::VisitCXXConstCastExpr(CXXConstCastExpr *E) {
1433 return VisitCXXNamedCastExpr(E);
1434}
1435
1436void ASTStmtReader::VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr *E) {
1437 VisitExplicitCastExpr(E);
1438 E->setLParenLoc(ReadSourceLocation());
1439 E->setRParenLoc(ReadSourceLocation());
1440}
1441
1442void ASTStmtReader::VisitUserDefinedLiteral(UserDefinedLiteral *E) {
1443 VisitCallExpr(E);
1444 E->UDSuffixLoc = ReadSourceLocation();
1445}
1446
1447void ASTStmtReader::VisitCXXBoolLiteralExpr(CXXBoolLiteralExpr *E) {
1448 VisitExpr(E);
1449 E->setValue(Record.readInt());
1450 E->setLocation(ReadSourceLocation());
1451}
1452
1453void ASTStmtReader::VisitCXXNullPtrLiteralExpr(CXXNullPtrLiteralExpr *E) {
1454 VisitExpr(E);
1455 E->setLocation(ReadSourceLocation());
1456}
1457
1458void ASTStmtReader::VisitCXXTypeidExpr(CXXTypeidExpr *E) {
1459 VisitExpr(E);
1460 E->setSourceRange(ReadSourceRange());
1461 if (E->isTypeOperand()) { // typeid(int)
1462 E->setTypeOperandSourceInfo(
1463 GetTypeSourceInfo());
1464 return;
1465 }
1466
1467 // typeid(42+2)
1468 E->setExprOperand(Record.readSubExpr());
1469}
1470
1471void ASTStmtReader::VisitCXXThisExpr(CXXThisExpr *E) {
1472 VisitExpr(E);
1473 E->setLocation(ReadSourceLocation());
1474 E->setImplicit(Record.readInt());
1475}
1476
1477void ASTStmtReader::VisitCXXThrowExpr(CXXThrowExpr *E) {
1478 VisitExpr(E);
1479 E->CXXThrowExprBits.ThrowLoc = ReadSourceLocation();
1480 E->Operand = Record.readSubExpr();
1481 E->CXXThrowExprBits.IsThrownVariableInScope = Record.readInt();
1482}
1483
1484void ASTStmtReader::VisitCXXDefaultArgExpr(CXXDefaultArgExpr *E) {
1485 VisitExpr(E);
1486 E->Param = ReadDeclAs<ParmVarDecl>();
1487 E->CXXDefaultArgExprBits.Loc = ReadSourceLocation();
1488}
1489
1490void ASTStmtReader::VisitCXXDefaultInitExpr(CXXDefaultInitExpr *E) {
1491 VisitExpr(E);
1492 E->Field = ReadDeclAs<FieldDecl>();
1493 E->CXXDefaultInitExprBits.Loc = ReadSourceLocation();
1494}
1495
1496void ASTStmtReader::VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *E) {
1497 VisitExpr(E);
1498 E->setTemporary(Record.readCXXTemporary());
1499 E->setSubExpr(Record.readSubExpr());
1500}
1501
1502void ASTStmtReader::VisitCXXScalarValueInitExpr(CXXScalarValueInitExpr *E) {
1503 VisitExpr(E);
1504 E->TypeInfo = GetTypeSourceInfo();
1505 E->RParenLoc = ReadSourceLocation();
1506}
1507
1508void ASTStmtReader::VisitCXXNewExpr(CXXNewExpr *E) {
1509 VisitExpr(E);
1510 E->GlobalNew = Record.readInt();
1511 bool isArray = Record.readInt();
1512 E->PassAlignment = Record.readInt();
1513 E->UsualArrayDeleteWantsSize = Record.readInt();
1514 unsigned NumPlacementArgs = Record.readInt();
1515 E->StoredInitializationStyle = Record.readInt();
1516 E->setOperatorNew(ReadDeclAs<FunctionDecl>());
1517 E->setOperatorDelete(ReadDeclAs<FunctionDecl>());
1518 E->AllocatedTypeInfo = GetTypeSourceInfo();
1519 E->TypeIdParens = ReadSourceRange();
1520 E->Range = ReadSourceRange();
1521 E->DirectInitRange = ReadSourceRange();
1522
1523 E->AllocateArgsArray(Record.getContext(), isArray, NumPlacementArgs,
1524 E->StoredInitializationStyle != 0);
1525
1526 // Install all the subexpressions.
1527 for (CXXNewExpr::raw_arg_iterator I = E->raw_arg_begin(),e = E->raw_arg_end();
1528 I != e; ++I)
1529 *I = Record.readSubStmt();
1530}
1531
1532void ASTStmtReader::VisitCXXDeleteExpr(CXXDeleteExpr *E) {
1533 VisitExpr(E);
1534 E->CXXDeleteExprBits.GlobalDelete = Record.readInt();
1535 E->CXXDeleteExprBits.ArrayForm = Record.readInt();
1536 E->CXXDeleteExprBits.ArrayFormAsWritten = Record.readInt();
1537 E->CXXDeleteExprBits.UsualArrayDeleteWantsSize = Record.readInt();
1538 E->OperatorDelete = ReadDeclAs<FunctionDecl>();
1539 E->Argument = Record.readSubExpr();
1540 E->CXXDeleteExprBits.Loc = ReadSourceLocation();
1541}
1542
1543void ASTStmtReader::VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr *E) {
1544 VisitExpr(E);
1545
1546 E->Base = Record.readSubExpr();
1547 E->IsArrow = Record.readInt();
1548 E->OperatorLoc = ReadSourceLocation();
1549 E->QualifierLoc = Record.readNestedNameSpecifierLoc();
1550 E->ScopeType = GetTypeSourceInfo();
1551 E->ColonColonLoc = ReadSourceLocation();
1552 E->TildeLoc = ReadSourceLocation();
1553
1554 IdentifierInfo *II = Record.getIdentifierInfo();
1555 if (II)
1556 E->setDestroyedType(II, ReadSourceLocation());
1557 else
1558 E->setDestroyedType(GetTypeSourceInfo());
1559}
1560
1561void ASTStmtReader::VisitExprWithCleanups(ExprWithCleanups *E) {
1562 VisitExpr(E);
1563
1564 unsigned NumObjects = Record.readInt();
1565 assert(NumObjects == E->getNumObjects())((NumObjects == E->getNumObjects()) ? static_cast<void>
(0) : __assert_fail ("NumObjects == E->getNumObjects()", "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 1565, __PRETTY_FUNCTION__))
;
1566 for (unsigned i = 0; i != NumObjects; ++i)
1567 E->getTrailingObjects<BlockDecl *>()[i] =
1568 ReadDeclAs<BlockDecl>();
1569
1570 E->ExprWithCleanupsBits.CleanupsHaveSideEffects = Record.readInt();
1571 E->SubExpr = Record.readSubExpr();
1572}
1573
1574void
1575ASTStmtReader::VisitCXXDependentScopeMemberExpr(CXXDependentScopeMemberExpr *E){
1576 VisitExpr(E);
1577
1578 if (Record.readInt()) // HasTemplateKWAndArgsInfo
1579 ReadTemplateKWAndArgsInfo(
1580 *E->getTrailingObjects<ASTTemplateKWAndArgsInfo>(),
1581 E->getTrailingObjects<TemplateArgumentLoc>(),
1582 /*NumTemplateArgs=*/Record.readInt());
1583
1584 E->Base = Record.readSubExpr();
1585 E->BaseType = Record.readType();
1586 E->IsArrow = Record.readInt();
1587 E->OperatorLoc = ReadSourceLocation();
1588 E->QualifierLoc = Record.readNestedNameSpecifierLoc();
1589 E->FirstQualifierFoundInScope = ReadDeclAs<NamedDecl>();
1590 ReadDeclarationNameInfo(E->MemberNameInfo);
1591}
1592
1593void
1594ASTStmtReader::VisitDependentScopeDeclRefExpr(DependentScopeDeclRefExpr *E) {
1595 VisitExpr(E);
1596
1597 if (Record.readInt()) // HasTemplateKWAndArgsInfo
1598 ReadTemplateKWAndArgsInfo(
1599 *E->getTrailingObjects<ASTTemplateKWAndArgsInfo>(),
1600 E->getTrailingObjects<TemplateArgumentLoc>(),
1601 /*NumTemplateArgs=*/Record.readInt());
1602
1603 E->QualifierLoc = Record.readNestedNameSpecifierLoc();
1604 ReadDeclarationNameInfo(E->NameInfo);
1605}
1606
1607void
1608ASTStmtReader::VisitCXXUnresolvedConstructExpr(CXXUnresolvedConstructExpr *E) {
1609 VisitExpr(E);
1610 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-8~svn350071/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 1611, __PRETTY_FUNCTION__))
1611 "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-8~svn350071/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 1611, __PRETTY_FUNCTION__))
;
1612 Record.skipInts(1);
1613 for (unsigned I = 0, N = E->arg_size(); I != N; ++I)
1614 E->setArg(I, Record.readSubExpr());
1615 E->Type = GetTypeSourceInfo();
1616 E->setLParenLoc(ReadSourceLocation());
1617 E->setRParenLoc(ReadSourceLocation());
1618}
1619
1620void ASTStmtReader::VisitOverloadExpr(OverloadExpr *E) {
1621 VisitExpr(E);
1622
1623 if (Record.readInt()) // HasTemplateKWAndArgsInfo
1624 ReadTemplateKWAndArgsInfo(*E->getTrailingASTTemplateKWAndArgsInfo(),
1625 E->getTrailingTemplateArgumentLoc(),
1626 /*NumTemplateArgs=*/Record.readInt());
1627
1628 unsigned NumDecls = Record.readInt();
1629 UnresolvedSet<8> Decls;
1630 for (unsigned i = 0; i != NumDecls; ++i) {
1631 auto *D = ReadDeclAs<NamedDecl>();
1632 auto AS = (AccessSpecifier)Record.readInt();
1633 Decls.addDecl(D, AS);
1634 }
1635 E->initializeResults(Record.getContext(), Decls.begin(), Decls.end());
1636
1637 ReadDeclarationNameInfo(E->NameInfo);
1638 E->QualifierLoc = Record.readNestedNameSpecifierLoc();
1639}
1640
1641void ASTStmtReader::VisitUnresolvedMemberExpr(UnresolvedMemberExpr *E) {
1642 VisitOverloadExpr(E);
1643 E->IsArrow = Record.readInt();
1644 E->HasUnresolvedUsing = Record.readInt();
1645 E->Base = Record.readSubExpr();
1646 E->BaseType = Record.readType();
1647 E->OperatorLoc = ReadSourceLocation();
1648}
1649
1650void ASTStmtReader::VisitUnresolvedLookupExpr(UnresolvedLookupExpr *E) {
1651 VisitOverloadExpr(E);
1652 E->RequiresADL = Record.readInt();
1653 E->Overloaded = Record.readInt();
1654 E->NamingClass = ReadDeclAs<CXXRecordDecl>();
1655}
1656
1657void ASTStmtReader::VisitTypeTraitExpr(TypeTraitExpr *E) {
1658 VisitExpr(E);
1659 E->TypeTraitExprBits.NumArgs = Record.readInt();
1660 E->TypeTraitExprBits.Kind = Record.readInt();
1661 E->TypeTraitExprBits.Value = Record.readInt();
1662 SourceRange Range = ReadSourceRange();
1663 E->Loc = Range.getBegin();
1664 E->RParenLoc = Range.getEnd();
1665
1666 auto **Args = E->getTrailingObjects<TypeSourceInfo *>();
1667 for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
1668 Args[I] = GetTypeSourceInfo();
1669}
1670
1671void ASTStmtReader::VisitArrayTypeTraitExpr(ArrayTypeTraitExpr *E) {
1672 VisitExpr(E);
1673 E->ATT = (ArrayTypeTrait)Record.readInt();
1674 E->Value = (unsigned int)Record.readInt();
1675 SourceRange Range = ReadSourceRange();
1676 E->Loc = Range.getBegin();
1677 E->RParen = Range.getEnd();
1678 E->QueriedType = GetTypeSourceInfo();
1679 E->Dimension = Record.readSubExpr();
1680}
1681
1682void ASTStmtReader::VisitExpressionTraitExpr(ExpressionTraitExpr *E) {
1683 VisitExpr(E);
1684 E->ET = (ExpressionTrait)Record.readInt();
1685 E->Value = (bool)Record.readInt();
1686 SourceRange Range = ReadSourceRange();
1687 E->QueriedExpression = Record.readSubExpr();
1688 E->Loc = Range.getBegin();
1689 E->RParen = Range.getEnd();
1690}
1691
1692void ASTStmtReader::VisitCXXNoexceptExpr(CXXNoexceptExpr *E) {
1693 VisitExpr(E);
1694 E->Value = (bool)Record.readInt();
1695 E->Range = ReadSourceRange();
1696 E->Operand = Record.readSubExpr();
1697}
1698
1699void ASTStmtReader::VisitPackExpansionExpr(PackExpansionExpr *E) {
1700 VisitExpr(E);
1701 E->EllipsisLoc = ReadSourceLocation();
1702 E->NumExpansions = Record.readInt();
1703 E->Pattern = Record.readSubExpr();
1704}
1705
1706void ASTStmtReader::VisitSizeOfPackExpr(SizeOfPackExpr *E) {
1707 VisitExpr(E);
1708 unsigned NumPartialArgs = Record.readInt();
1709 E->OperatorLoc = ReadSourceLocation();
1710 E->PackLoc = ReadSourceLocation();
1711 E->RParenLoc = ReadSourceLocation();
1712 E->Pack = Record.readDeclAs<NamedDecl>();
1713 if (E->isPartiallySubstituted()) {
1714 assert(E->Length == NumPartialArgs)((E->Length == NumPartialArgs) ? static_cast<void> (
0) : __assert_fail ("E->Length == NumPartialArgs", "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 1714, __PRETTY_FUNCTION__))
;
1715 for (auto *I = E->getTrailingObjects<TemplateArgument>(),
1716 *E = I + NumPartialArgs;
1717 I != E; ++I)
1718 new (I) TemplateArgument(Record.readTemplateArgument());
1719 } else if (!E->isValueDependent()) {
1720 E->Length = Record.readInt();
1721 }
1722}
1723
1724void ASTStmtReader::VisitSubstNonTypeTemplateParmExpr(
1725 SubstNonTypeTemplateParmExpr *E) {
1726 VisitExpr(E);
1727 E->Param = ReadDeclAs<NonTypeTemplateParmDecl>();
1728 E->NameLoc = ReadSourceLocation();
1729 E->Replacement = Record.readSubExpr();
1730}
1731
1732void ASTStmtReader::VisitSubstNonTypeTemplateParmPackExpr(
1733 SubstNonTypeTemplateParmPackExpr *E) {
1734 VisitExpr(E);
1735 E->Param = ReadDeclAs<NonTypeTemplateParmDecl>();
1736 TemplateArgument ArgPack = Record.readTemplateArgument();
1737 if (ArgPack.getKind() != TemplateArgument::Pack)
1738 return;
1739
1740 E->Arguments = ArgPack.pack_begin();
1741 E->NumArguments = ArgPack.pack_size();
1742 E->NameLoc = ReadSourceLocation();
1743}
1744
1745void ASTStmtReader::VisitFunctionParmPackExpr(FunctionParmPackExpr *E) {
1746 VisitExpr(E);
1747 E->NumParameters = Record.readInt();
1748 E->ParamPack = ReadDeclAs<ParmVarDecl>();
1749 E->NameLoc = ReadSourceLocation();
1750 auto **Parms = E->getTrailingObjects<ParmVarDecl *>();
1751 for (unsigned i = 0, n = E->NumParameters; i != n; ++i)
1752 Parms[i] = ReadDeclAs<ParmVarDecl>();
1753}
1754
1755void ASTStmtReader::VisitMaterializeTemporaryExpr(MaterializeTemporaryExpr *E) {
1756 VisitExpr(E);
1757 E->State = Record.readSubExpr();
1758 auto *VD = ReadDeclAs<ValueDecl>();
1759 unsigned ManglingNumber = Record.readInt();
1760 E->setExtendingDecl(VD, ManglingNumber);
1761}
1762
1763void ASTStmtReader::VisitCXXFoldExpr(CXXFoldExpr *E) {
1764 VisitExpr(E);
1765 E->LParenLoc = ReadSourceLocation();
1766 E->EllipsisLoc = ReadSourceLocation();
1767 E->RParenLoc = ReadSourceLocation();
1768 E->SubExprs[0] = Record.readSubExpr();
1769 E->SubExprs[1] = Record.readSubExpr();
1770 E->Opcode = (BinaryOperatorKind)Record.readInt();
1771}
1772
1773void ASTStmtReader::VisitOpaqueValueExpr(OpaqueValueExpr *E) {
1774 VisitExpr(E);
1775 E->SourceExpr = Record.readSubExpr();
1776 E->Loc = ReadSourceLocation();
1777 E->setIsUnique(Record.readInt());
1778}
1779
1780void ASTStmtReader::VisitTypoExpr(TypoExpr *E) {
1781 llvm_unreachable("Cannot read TypoExpr nodes")::llvm::llvm_unreachable_internal("Cannot read TypoExpr nodes"
, "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 1781)
;
1782}
1783
1784//===----------------------------------------------------------------------===//
1785// Microsoft Expressions and Statements
1786//===----------------------------------------------------------------------===//
1787void ASTStmtReader::VisitMSPropertyRefExpr(MSPropertyRefExpr *E) {
1788 VisitExpr(E);
1789 E->IsArrow = (Record.readInt() != 0);
1790 E->BaseExpr = Record.readSubExpr();
1791 E->QualifierLoc = Record.readNestedNameSpecifierLoc();
1792 E->MemberLoc = ReadSourceLocation();
1793 E->TheDecl = ReadDeclAs<MSPropertyDecl>();
1794}
1795
1796void ASTStmtReader::VisitMSPropertySubscriptExpr(MSPropertySubscriptExpr *E) {
1797 VisitExpr(E);
1798 E->setBase(Record.readSubExpr());
1799 E->setIdx(Record.readSubExpr());
1800 E->setRBracketLoc(ReadSourceLocation());
1801}
1802
1803void ASTStmtReader::VisitCXXUuidofExpr(CXXUuidofExpr *E) {
1804 VisitExpr(E);
1805 E->setSourceRange(ReadSourceRange());
1806 std::string UuidStr = ReadString();
1807 E->setUuidStr(StringRef(UuidStr).copy(Record.getContext()));
1808 if (E->isTypeOperand()) { // __uuidof(ComType)
1809 E->setTypeOperandSourceInfo(
1810 GetTypeSourceInfo());
1811 return;
1812 }
1813
1814 // __uuidof(expr)
1815 E->setExprOperand(Record.readSubExpr());
1816}
1817
1818void ASTStmtReader::VisitSEHLeaveStmt(SEHLeaveStmt *S) {
1819 VisitStmt(S);
1820 S->setLeaveLoc(ReadSourceLocation());
1821}
1822
1823void ASTStmtReader::VisitSEHExceptStmt(SEHExceptStmt *S) {
1824 VisitStmt(S);
1825 S->Loc = ReadSourceLocation();
1826 S->Children[SEHExceptStmt::FILTER_EXPR] = Record.readSubStmt();
1827 S->Children[SEHExceptStmt::BLOCK] = Record.readSubStmt();
1828}
1829
1830void ASTStmtReader::VisitSEHFinallyStmt(SEHFinallyStmt *S) {
1831 VisitStmt(S);
1832 S->Loc = ReadSourceLocation();
1833 S->Block = Record.readSubStmt();
1834}
1835
1836void ASTStmtReader::VisitSEHTryStmt(SEHTryStmt *S) {
1837 VisitStmt(S);
1838 S->IsCXXTry = Record.readInt();
1839 S->TryLoc = ReadSourceLocation();
1840 S->Children[SEHTryStmt::TRY] = Record.readSubStmt();
1841 S->Children[SEHTryStmt::HANDLER] = Record.readSubStmt();
1842}
1843
1844//===----------------------------------------------------------------------===//
1845// CUDA Expressions and Statements
1846//===----------------------------------------------------------------------===//
1847
1848void ASTStmtReader::VisitCUDAKernelCallExpr(CUDAKernelCallExpr *E) {
1849 VisitCallExpr(E);
1850 E->setConfig(cast<CallExpr>(Record.readSubExpr()));
1851}
1852
1853//===----------------------------------------------------------------------===//
1854// OpenCL Expressions and Statements.
1855//===----------------------------------------------------------------------===//
1856void ASTStmtReader::VisitAsTypeExpr(AsTypeExpr *E) {
1857 VisitExpr(E);
1858 E->BuiltinLoc = ReadSourceLocation();
1859 E->RParenLoc = ReadSourceLocation();
1860 E->SrcExpr = Record.readSubExpr();
1861}
1862
1863//===----------------------------------------------------------------------===//
1864// OpenMP Directives.
1865//===----------------------------------------------------------------------===//
1866
1867void ASTStmtReader::VisitOMPExecutableDirective(OMPExecutableDirective *E) {
1868 E->setLocStart(ReadSourceLocation());
1869 E->setLocEnd(ReadSourceLocation());
1870 OMPClauseReader ClauseReader(Record);
1871 SmallVector<OMPClause *, 5> Clauses;
1872 for (unsigned i = 0; i < E->getNumClauses(); ++i)
1873 Clauses.push_back(ClauseReader.readClause());
1874 E->setClauses(Clauses);
1875 if (E->hasAssociatedStmt())
1876 E->setAssociatedStmt(Record.readSubStmt());
1877}
1878
1879void ASTStmtReader::VisitOMPLoopDirective(OMPLoopDirective *D) {
1880 VisitStmt(D);
1881 // Two fields (NumClauses and CollapsedNum) were read in ReadStmtFromStream.
1882 Record.skipInts(2);
1883 VisitOMPExecutableDirective(D);
1884 D->setIterationVariable(Record.readSubExpr());
1885 D->setLastIteration(Record.readSubExpr());
1886 D->setCalcLastIteration(Record.readSubExpr());
1887 D->setPreCond(Record.readSubExpr());
1888 D->setCond(Record.readSubExpr());
1889 D->setInit(Record.readSubExpr());
1890 D->setInc(Record.readSubExpr());
1891 D->setPreInits(Record.readSubStmt());
1892 if (isOpenMPWorksharingDirective(D->getDirectiveKind()) ||
1893 isOpenMPTaskLoopDirective(D->getDirectiveKind()) ||
1894 isOpenMPDistributeDirective(D->getDirectiveKind())) {
1895 D->setIsLastIterVariable(Record.readSubExpr());
1896 D->setLowerBoundVariable(Record.readSubExpr());
1897 D->setUpperBoundVariable(Record.readSubExpr());
1898 D->setStrideVariable(Record.readSubExpr());
1899 D->setEnsureUpperBound(Record.readSubExpr());
1900 D->setNextLowerBound(Record.readSubExpr());
1901 D->setNextUpperBound(Record.readSubExpr());
1902 D->setNumIterations(Record.readSubExpr());
1903 }
1904 if (isOpenMPLoopBoundSharingDirective(D->getDirectiveKind())) {
1905 D->setPrevLowerBoundVariable(Record.readSubExpr());
1906 D->setPrevUpperBoundVariable(Record.readSubExpr());
1907 D->setDistInc(Record.readSubExpr());
1908 D->setPrevEnsureUpperBound(Record.readSubExpr());
1909 D->setCombinedLowerBoundVariable(Record.readSubExpr());
1910 D->setCombinedUpperBoundVariable(Record.readSubExpr());
1911 D->setCombinedEnsureUpperBound(Record.readSubExpr());
1912 D->setCombinedInit(Record.readSubExpr());
1913 D->setCombinedCond(Record.readSubExpr());
1914 D->setCombinedNextLowerBound(Record.readSubExpr());
1915 D->setCombinedNextUpperBound(Record.readSubExpr());
1916 D->setCombinedDistCond(Record.readSubExpr());
1917 D->setCombinedParForInDistCond(Record.readSubExpr());
1918 }
1919 SmallVector<Expr *, 4> Sub;
1920 unsigned CollapsedNum = D->getCollapsedNumber();
1921 Sub.reserve(CollapsedNum);
1922 for (unsigned i = 0; i < CollapsedNum; ++i)
1923 Sub.push_back(Record.readSubExpr());
1924 D->setCounters(Sub);
1925 Sub.clear();
1926 for (unsigned i = 0; i < CollapsedNum; ++i)
1927 Sub.push_back(Record.readSubExpr());
1928 D->setPrivateCounters(Sub);
1929 Sub.clear();
1930 for (unsigned i = 0; i < CollapsedNum; ++i)
1931 Sub.push_back(Record.readSubExpr());
1932 D->setInits(Sub);
1933 Sub.clear();
1934 for (unsigned i = 0; i < CollapsedNum; ++i)
1935 Sub.push_back(Record.readSubExpr());
1936 D->setUpdates(Sub);
1937 Sub.clear();
1938 for (unsigned i = 0; i < CollapsedNum; ++i)
1939 Sub.push_back(Record.readSubExpr());
1940 D->setFinals(Sub);
1941}
1942
1943void ASTStmtReader::VisitOMPParallelDirective(OMPParallelDirective *D) {
1944 VisitStmt(D);
1945 // The NumClauses field was read in ReadStmtFromStream.
1946 Record.skipInts(1);
1947 VisitOMPExecutableDirective(D);
1948 D->setHasCancel(Record.readInt());
1949}
1950
1951void ASTStmtReader::VisitOMPSimdDirective(OMPSimdDirective *D) {
1952 VisitOMPLoopDirective(D);
1953}
1954
1955void ASTStmtReader::VisitOMPForDirective(OMPForDirective *D) {
1956 VisitOMPLoopDirective(D);
1957 D->setHasCancel(Record.readInt());
1958}
1959
1960void ASTStmtReader::VisitOMPForSimdDirective(OMPForSimdDirective *D) {
1961 VisitOMPLoopDirective(D);
1962}
1963
1964void ASTStmtReader::VisitOMPSectionsDirective(OMPSectionsDirective *D) {
1965 VisitStmt(D);
1966 // The NumClauses field was read in ReadStmtFromStream.
1967 Record.skipInts(1);
1968 VisitOMPExecutableDirective(D);
1969 D->setHasCancel(Record.readInt());
1970}
1971
1972void ASTStmtReader::VisitOMPSectionDirective(OMPSectionDirective *D) {
1973 VisitStmt(D);
1974 VisitOMPExecutableDirective(D);
1975 D->setHasCancel(Record.readInt());
1976}
1977
1978void ASTStmtReader::VisitOMPSingleDirective(OMPSingleDirective *D) {
1979 VisitStmt(D);
1980 // The NumClauses field was read in ReadStmtFromStream.
1981 Record.skipInts(1);
1982 VisitOMPExecutableDirective(D);
1983}
1984
1985void ASTStmtReader::VisitOMPMasterDirective(OMPMasterDirective *D) {
1986 VisitStmt(D);
1987 VisitOMPExecutableDirective(D);
1988}
1989
1990void ASTStmtReader::VisitOMPCriticalDirective(OMPCriticalDirective *D) {
1991 VisitStmt(D);
1992 // The NumClauses field was read in ReadStmtFromStream.
1993 Record.skipInts(1);
1994 VisitOMPExecutableDirective(D);
1995 ReadDeclarationNameInfo(D->DirName);
1996}
1997
1998void ASTStmtReader::VisitOMPParallelForDirective(OMPParallelForDirective *D) {
1999 VisitOMPLoopDirective(D);
2000 D->setHasCancel(Record.readInt());
2001}
2002
2003void ASTStmtReader::VisitOMPParallelForSimdDirective(
2004 OMPParallelForSimdDirective *D) {
2005 VisitOMPLoopDirective(D);
2006}
2007
2008void ASTStmtReader::VisitOMPParallelSectionsDirective(
2009 OMPParallelSectionsDirective *D) {
2010 VisitStmt(D);
2011 // The NumClauses field was read in ReadStmtFromStream.
2012 Record.skipInts(1);
2013 VisitOMPExecutableDirective(D);
2014 D->setHasCancel(Record.readInt());
2015}
2016
2017void ASTStmtReader::VisitOMPTaskDirective(OMPTaskDirective *D) {
2018 VisitStmt(D);
2019 // The NumClauses field was read in ReadStmtFromStream.
2020 Record.skipInts(1);
2021 VisitOMPExecutableDirective(D);
2022 D->setHasCancel(Record.readInt());
2023}
2024
2025void ASTStmtReader::VisitOMPTaskyieldDirective(OMPTaskyieldDirective *D) {
2026 VisitStmt(D);
2027 VisitOMPExecutableDirective(D);
2028}
2029
2030void ASTStmtReader::VisitOMPBarrierDirective(OMPBarrierDirective *D) {
2031 VisitStmt(D);
2032 VisitOMPExecutableDirective(D);
2033}
2034
2035void ASTStmtReader::VisitOMPTaskwaitDirective(OMPTaskwaitDirective *D) {
2036 VisitStmt(D);
2037 VisitOMPExecutableDirective(D);
2038}
2039
2040void ASTStmtReader::VisitOMPTaskgroupDirective(OMPTaskgroupDirective *D) {
2041 VisitStmt(D);
2042 // The NumClauses field was read in ReadStmtFromStream.
2043 Record.skipInts(1);
2044 VisitOMPExecutableDirective(D);
2045 D->setReductionRef(Record.readSubExpr());
2046}
2047
2048void ASTStmtReader::VisitOMPFlushDirective(OMPFlushDirective *D) {
2049 VisitStmt(D);
2050 // The NumClauses field was read in ReadStmtFromStream.
2051 Record.skipInts(1);
2052 VisitOMPExecutableDirective(D);
2053}
2054
2055void ASTStmtReader::VisitOMPOrderedDirective(OMPOrderedDirective *D) {
2056 VisitStmt(D);
2057 // The NumClauses field was read in ReadStmtFromStream.
2058 Record.skipInts(1);
2059 VisitOMPExecutableDirective(D);
2060}
2061
2062void ASTStmtReader::VisitOMPAtomicDirective(OMPAtomicDirective *D) {
2063 VisitStmt(D);
2064 // The NumClauses field was read in ReadStmtFromStream.
2065 Record.skipInts(1);
2066 VisitOMPExecutableDirective(D);
2067 D->setX(Record.readSubExpr());
2068 D->setV(Record.readSubExpr());
2069 D->setExpr(Record.readSubExpr());
2070 D->setUpdateExpr(Record.readSubExpr());
2071 D->IsXLHSInRHSPart = Record.readInt() != 0;
2072 D->IsPostfixUpdate = Record.readInt() != 0;
2073}
2074
2075void ASTStmtReader::VisitOMPTargetDirective(OMPTargetDirective *D) {
2076 VisitStmt(D);
2077 // The NumClauses field was read in ReadStmtFromStream.
2078 Record.skipInts(1);
2079 VisitOMPExecutableDirective(D);
2080}
2081
2082void ASTStmtReader::VisitOMPTargetDataDirective(OMPTargetDataDirective *D) {
2083 VisitStmt(D);
2084 Record.skipInts(1);
2085 VisitOMPExecutableDirective(D);
2086}
2087
2088void ASTStmtReader::VisitOMPTargetEnterDataDirective(
2089 OMPTargetEnterDataDirective *D) {
2090 VisitStmt(D);
2091 Record.skipInts(1);
2092 VisitOMPExecutableDirective(D);
2093}
2094
2095void ASTStmtReader::VisitOMPTargetExitDataDirective(
2096 OMPTargetExitDataDirective *D) {
2097 VisitStmt(D);
2098 Record.skipInts(1);
2099 VisitOMPExecutableDirective(D);
2100}
2101
2102void ASTStmtReader::VisitOMPTargetParallelDirective(
2103 OMPTargetParallelDirective *D) {
2104 VisitStmt(D);
2105 Record.skipInts(1);
2106 VisitOMPExecutableDirective(D);
2107}
2108
2109void ASTStmtReader::VisitOMPTargetParallelForDirective(
2110 OMPTargetParallelForDirective *D) {
2111 VisitOMPLoopDirective(D);
2112 D->setHasCancel(Record.readInt());
2113}
2114
2115void ASTStmtReader::VisitOMPTeamsDirective(OMPTeamsDirective *D) {
2116 VisitStmt(D);
2117 // The NumClauses field was read in ReadStmtFromStream.
2118 Record.skipInts(1);
2119 VisitOMPExecutableDirective(D);
2120}
2121
2122void ASTStmtReader::VisitOMPCancellationPointDirective(
2123 OMPCancellationPointDirective *D) {
2124 VisitStmt(D);
2125 VisitOMPExecutableDirective(D);
2126 D->setCancelRegion(static_cast<OpenMPDirectiveKind>(Record.readInt()));
2127}
2128
2129void ASTStmtReader::VisitOMPCancelDirective(OMPCancelDirective *D) {
2130 VisitStmt(D);
2131 // The NumClauses field was read in ReadStmtFromStream.
2132 Record.skipInts(1);
2133 VisitOMPExecutableDirective(D);
2134 D->setCancelRegion(static_cast<OpenMPDirectiveKind>(Record.readInt()));
2135}
2136
2137void ASTStmtReader::VisitOMPTaskLoopDirective(OMPTaskLoopDirective *D) {
2138 VisitOMPLoopDirective(D);
2139}
2140
2141void ASTStmtReader::VisitOMPTaskLoopSimdDirective(OMPTaskLoopSimdDirective *D) {
2142 VisitOMPLoopDirective(D);
2143}
2144
2145void ASTStmtReader::VisitOMPDistributeDirective(OMPDistributeDirective *D) {
2146 VisitOMPLoopDirective(D);
2147}
2148
2149void ASTStmtReader::VisitOMPTargetUpdateDirective(OMPTargetUpdateDirective *D) {
2150 VisitStmt(D);
2151 Record.skipInts(1);
2152 VisitOMPExecutableDirective(D);
2153}
2154
2155void ASTStmtReader::VisitOMPDistributeParallelForDirective(
2156 OMPDistributeParallelForDirective *D) {
2157 VisitOMPLoopDirective(D);
2158 D->setHasCancel(Record.readInt());
2159}
2160
2161void ASTStmtReader::VisitOMPDistributeParallelForSimdDirective(
2162 OMPDistributeParallelForSimdDirective *D) {
2163 VisitOMPLoopDirective(D);
2164}
2165
2166void ASTStmtReader::VisitOMPDistributeSimdDirective(
2167 OMPDistributeSimdDirective *D) {
2168 VisitOMPLoopDirective(D);
2169}
2170
2171void ASTStmtReader::VisitOMPTargetParallelForSimdDirective(
2172 OMPTargetParallelForSimdDirective *D) {
2173 VisitOMPLoopDirective(D);
2174}
2175
2176void ASTStmtReader::VisitOMPTargetSimdDirective(OMPTargetSimdDirective *D) {
2177 VisitOMPLoopDirective(D);
2178}
2179
2180void ASTStmtReader::VisitOMPTeamsDistributeDirective(
2181 OMPTeamsDistributeDirective *D) {
2182 VisitOMPLoopDirective(D);
2183}
2184
2185void ASTStmtReader::VisitOMPTeamsDistributeSimdDirective(
2186 OMPTeamsDistributeSimdDirective *D) {
2187 VisitOMPLoopDirective(D);
2188}
2189
2190void ASTStmtReader::VisitOMPTeamsDistributeParallelForSimdDirective(
2191 OMPTeamsDistributeParallelForSimdDirective *D) {
2192 VisitOMPLoopDirective(D);
2193}
2194
2195void ASTStmtReader::VisitOMPTeamsDistributeParallelForDirective(
2196 OMPTeamsDistributeParallelForDirective *D) {
2197 VisitOMPLoopDirective(D);
2198 D->setHasCancel(Record.readInt());
2199}
2200
2201void ASTStmtReader::VisitOMPTargetTeamsDirective(OMPTargetTeamsDirective *D) {
2202 VisitStmt(D);
2203 // The NumClauses field was read in ReadStmtFromStream.
2204 Record.skipInts(1);
2205 VisitOMPExecutableDirective(D);
2206}
2207
2208void ASTStmtReader::VisitOMPTargetTeamsDistributeDirective(
2209 OMPTargetTeamsDistributeDirective *D) {
2210 VisitOMPLoopDirective(D);
2211}
2212
2213void ASTStmtReader::VisitOMPTargetTeamsDistributeParallelForDirective(
2214 OMPTargetTeamsDistributeParallelForDirective *D) {
2215 VisitOMPLoopDirective(D);
2216 D->setHasCancel(Record.readInt());
2217}
2218
2219void ASTStmtReader::VisitOMPTargetTeamsDistributeParallelForSimdDirective(
2220 OMPTargetTeamsDistributeParallelForSimdDirective *D) {
2221 VisitOMPLoopDirective(D);
2222}
2223
2224void ASTStmtReader::VisitOMPTargetTeamsDistributeSimdDirective(
2225 OMPTargetTeamsDistributeSimdDirective *D) {
2226 VisitOMPLoopDirective(D);
2227}
2228
2229//===----------------------------------------------------------------------===//
2230// ASTReader Implementation
2231//===----------------------------------------------------------------------===//
2232
2233Stmt *ASTReader::ReadStmt(ModuleFile &F) {
2234 switch (ReadingKind) {
2235 case Read_None:
2236 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-8~svn350071/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 2236)
;
2237 case Read_Decl:
2238 case Read_Type:
2239 return ReadStmtFromStream(F);
2240 case Read_Stmt:
2241 return ReadSubStmt();
2242 }
2243
2244 llvm_unreachable("ReadingKind not set ?")::llvm::llvm_unreachable_internal("ReadingKind not set ?", "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 2244)
;
2245}
2246
2247Expr *ASTReader::ReadExpr(ModuleFile &F) {
2248 return cast_or_null<Expr>(ReadStmt(F));
2249}
2250
2251Expr *ASTReader::ReadSubExpr() {
2252 return cast_or_null<Expr>(ReadSubStmt());
2253}
2254
2255// Within the bitstream, expressions are stored in Reverse Polish
2256// Notation, with each of the subexpressions preceding the
2257// expression they are stored in. Subexpressions are stored from last to first.
2258// To evaluate expressions, we continue reading expressions and placing them on
2259// the stack, with expressions having operands removing those operands from the
2260// stack. Evaluation terminates when we see a STMT_STOP record, and
2261// the single remaining expression on the stack is our result.
2262Stmt *ASTReader::ReadStmtFromStream(ModuleFile &F) {
2263 ReadingKindTracker ReadingKind(Read_Stmt, *this);
2264 llvm::BitstreamCursor &Cursor = F.DeclsCursor;
2265
2266 // Map of offset to previously deserialized stmt. The offset points
2267 // just after the stmt record.
2268 llvm::DenseMap<uint64_t, Stmt *> StmtEntries;
2269
2270#ifndef NDEBUG
2271 unsigned PrevNumStmts = StmtStack.size();
2272#endif
2273
2274 ASTRecordReader Record(*this, F);
2275 ASTStmtReader Reader(Record, Cursor);
2276 Stmt::EmptyShell Empty;
2277
2278 while (true) {
2279 llvm::BitstreamEntry Entry = Cursor.advanceSkippingSubblocks();
2280
2281 switch (Entry.Kind) {
2282 case llvm::BitstreamEntry::SubBlock: // Handled for us already.
2283 case llvm::BitstreamEntry::Error:
2284 Error("malformed block record in AST file");
2285 return nullptr;
2286 case llvm::BitstreamEntry::EndBlock:
2287 goto Done;
2288 case llvm::BitstreamEntry::Record:
2289 // The interesting case.
2290 break;
2291 }
2292
2293 ASTContext &Context = getContext();
2294 Stmt *S = nullptr;
2295 bool Finished = false;
2296 bool IsStmtReference = false;
2297 switch ((StmtCode)Record.readRecord(Cursor, Entry.ID)) {
2298 case STMT_STOP:
2299 Finished = true;
2300 break;
2301
2302 case STMT_REF_PTR:
2303 IsStmtReference = true;
2304 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-8~svn350071/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 2305, __PRETTY_FUNCTION__))
2305 "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-8~svn350071/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 2305, __PRETTY_FUNCTION__))
;
2306 S = StmtEntries[Record.readInt()];
2307 break;
2308
2309 case STMT_NULL_PTR:
2310 S = nullptr;
2311 break;
2312
2313 case STMT_NULL:
2314 S = new (Context) NullStmt(Empty);
2315 break;
2316
2317 case STMT_COMPOUND:
2318 S = CompoundStmt::CreateEmpty(
2319 Context, /*NumStmts=*/Record[ASTStmtReader::NumStmtFields]);
2320 break;
2321
2322 case STMT_CASE:
2323 S = CaseStmt::CreateEmpty(
2324 Context,
2325 /*CaseStmtIsGNURange*/ Record[ASTStmtReader::NumStmtFields + 3]);
2326 break;
2327
2328 case STMT_DEFAULT:
2329 S = new (Context) DefaultStmt(Empty);
2330 break;
2331
2332 case STMT_LABEL:
2333 S = new (Context) LabelStmt(Empty);
2334 break;
2335
2336 case STMT_ATTRIBUTED:
2337 S = AttributedStmt::CreateEmpty(
2338 Context,
2339 /*NumAttrs*/Record[ASTStmtReader::NumStmtFields]);
2340 break;
2341
2342 case STMT_IF:
2343 S = IfStmt::CreateEmpty(
2344 Context,
2345 /* HasElse=*/Record[ASTStmtReader::NumStmtFields + 1],
2346 /* HasVar=*/Record[ASTStmtReader::NumStmtFields + 2],
2347 /* HasInit=*/Record[ASTStmtReader::NumStmtFields + 3]);
2348 break;
2349
2350 case STMT_SWITCH:
2351 S = SwitchStmt::CreateEmpty(
2352 Context,
2353 /* HasInit=*/Record[ASTStmtReader::NumStmtFields],
2354 /* HasVar=*/Record[ASTStmtReader::NumStmtFields + 1]);
2355 break;
2356
2357 case STMT_WHILE:
2358 S = WhileStmt::CreateEmpty(
2359 Context,
2360 /* HasVar=*/Record[ASTStmtReader::NumStmtFields]);
2361 break;
2362
2363 case STMT_DO:
2364 S = new (Context) DoStmt(Empty);
2365 break;
2366
2367 case STMT_FOR:
2368 S = new (Context) ForStmt(Empty);
2369 break;
2370
2371 case STMT_GOTO:
2372 S = new (Context) GotoStmt(Empty);
2373 break;
2374
2375 case STMT_INDIRECT_GOTO:
2376 S = new (Context) IndirectGotoStmt(Empty);
2377 break;
2378
2379 case STMT_CONTINUE:
2380 S = new (Context) ContinueStmt(Empty);
2381 break;
2382
2383 case STMT_BREAK:
2384 S = new (Context) BreakStmt(Empty);
2385 break;
2386
2387 case STMT_RETURN:
2388 S = ReturnStmt::CreateEmpty(
2389 Context, /* HasNRVOCandidate=*/Record[ASTStmtReader::NumStmtFields]);
2390 break;
2391
2392 case STMT_DECL:
2393 S = new (Context) DeclStmt(Empty);
2394 break;
2395
2396 case STMT_GCCASM:
2397 S = new (Context) GCCAsmStmt(Empty);
2398 break;
2399
2400 case STMT_MSASM:
2401 S = new (Context) MSAsmStmt(Empty);
2402 break;
2403
2404 case STMT_CAPTURED:
2405 S = CapturedStmt::CreateDeserialized(
2406 Context, Record[ASTStmtReader::NumStmtFields]);
2407 break;
2408
2409 case EXPR_CONSTANT:
2410 S = new (Context) ConstantExpr(Empty);
2411 break;
2412
2413 case EXPR_PREDEFINED:
2414 S = PredefinedExpr::CreateEmpty(
2415 Context,
2416 /*HasFunctionName*/ Record[ASTStmtReader::NumExprFields]);
2417 break;
2418
2419 case EXPR_DECL_REF:
2420 S = DeclRefExpr::CreateEmpty(
2421 Context,
2422 /*HasQualifier=*/Record[ASTStmtReader::NumExprFields],
2423 /*HasFoundDecl=*/Record[ASTStmtReader::NumExprFields + 1],
2424 /*HasTemplateKWAndArgsInfo=*/Record[ASTStmtReader::NumExprFields + 2],
2425 /*NumTemplateArgs=*/Record[ASTStmtReader::NumExprFields + 2] ?
2426 Record[ASTStmtReader::NumExprFields + 5] : 0);
2427 break;
2428
2429 case EXPR_INTEGER_LITERAL:
2430 S = IntegerLiteral::Create(Context, Empty);
2431 break;
2432
2433 case EXPR_FLOATING_LITERAL:
2434 S = FloatingLiteral::Create(Context, Empty);
2435 break;
2436
2437 case EXPR_IMAGINARY_LITERAL:
2438 S = new (Context) ImaginaryLiteral(Empty);
2439 break;
2440
2441 case EXPR_STRING_LITERAL:
2442 S = StringLiteral::CreateEmpty(
2443 Context,
2444 /* NumConcatenated=*/Record[ASTStmtReader::NumExprFields],
2445 /* Length=*/Record[ASTStmtReader::NumExprFields + 1],
2446 /* CharByteWidth=*/Record[ASTStmtReader::NumExprFields + 2]);
2447 break;
2448
2449 case EXPR_CHARACTER_LITERAL:
2450 S = new (Context) CharacterLiteral(Empty);
2451 break;
2452
2453 case EXPR_PAREN:
2454 S = new (Context) ParenExpr(Empty);
2455 break;
2456
2457 case EXPR_PAREN_LIST:
2458 S = ParenListExpr::CreateEmpty(
2459 Context,
2460 /* NumExprs=*/Record[ASTStmtReader::NumExprFields]);
2461 break;
2462
2463 case EXPR_UNARY_OPERATOR:
2464 S = new (Context) UnaryOperator(Empty);
2465 break;
2466
2467 case EXPR_OFFSETOF:
2468 S = OffsetOfExpr::CreateEmpty(Context,
2469 Record[ASTStmtReader::NumExprFields],
2470 Record[ASTStmtReader::NumExprFields + 1]);
2471 break;
2472
2473 case EXPR_SIZEOF_ALIGN_OF:
2474 S = new (Context) UnaryExprOrTypeTraitExpr(Empty);
2475 break;
2476
2477 case EXPR_ARRAY_SUBSCRIPT:
2478 S = new (Context) ArraySubscriptExpr(Empty);
2479 break;
2480
2481 case EXPR_OMP_ARRAY_SECTION:
2482 S = new (Context) OMPArraySectionExpr(Empty);
2483 break;
2484
2485 case EXPR_CALL:
2486 S = CallExpr::CreateEmpty(
2487 Context, /*NumArgs=*/Record[ASTStmtReader::NumExprFields], Empty);
2488 break;
2489
2490 case EXPR_MEMBER: {
2491 // We load everything here and fully initialize it at creation.
2492 // That way we can use MemberExpr::Create and don't have to duplicate its
2493 // logic with a MemberExpr::CreateEmpty.
2494
2495 assert(Record.getIdx() == 0)((Record.getIdx() == 0) ? static_cast<void> (0) : __assert_fail
("Record.getIdx() == 0", "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 2495, __PRETTY_FUNCTION__))
;
2496 NestedNameSpecifierLoc QualifierLoc;
2497 if (Record.readInt()) { // HasQualifier.
2498 QualifierLoc = Record.readNestedNameSpecifierLoc();
2499 }
2500
2501 SourceLocation TemplateKWLoc;
2502 TemplateArgumentListInfo ArgInfo;
2503 bool HasTemplateKWAndArgsInfo = Record.readInt();
2504 if (HasTemplateKWAndArgsInfo) {
2505 TemplateKWLoc = Record.readSourceLocation();
2506 unsigned NumTemplateArgs = Record.readInt();
2507 ArgInfo.setLAngleLoc(Record.readSourceLocation());
2508 ArgInfo.setRAngleLoc(Record.readSourceLocation());
2509 for (unsigned i = 0; i != NumTemplateArgs; ++i)
2510 ArgInfo.addArgument(Record.readTemplateArgumentLoc());
2511 }
2512
2513 bool HadMultipleCandidates = Record.readInt();
2514
2515 auto *FoundD = Record.readDeclAs<NamedDecl>();
2516 auto AS = (AccessSpecifier)Record.readInt();
2517 DeclAccessPair FoundDecl = DeclAccessPair::make(FoundD, AS);
2518
2519 QualType T = Record.readType();
2520 auto VK = static_cast<ExprValueKind>(Record.readInt());
2521 auto OK = static_cast<ExprObjectKind>(Record.readInt());
2522 Expr *Base = ReadSubExpr();
2523 auto *MemberD = Record.readDeclAs<ValueDecl>();
2524 SourceLocation MemberLoc = Record.readSourceLocation();
2525 DeclarationNameInfo MemberNameInfo(MemberD->getDeclName(), MemberLoc);
2526 bool IsArrow = Record.readInt();
2527 SourceLocation OperatorLoc = Record.readSourceLocation();
2528
2529 S = MemberExpr::Create(Context, Base, IsArrow, OperatorLoc, QualifierLoc,
2530 TemplateKWLoc, MemberD, FoundDecl, MemberNameInfo,
2531 HasTemplateKWAndArgsInfo ? &ArgInfo : nullptr, T,
2532 VK, OK);
2533 Record.readDeclarationNameLoc(cast<MemberExpr>(S)->MemberDNLoc,
2534 MemberD->getDeclName());
2535 if (HadMultipleCandidates)
2536 cast<MemberExpr>(S)->setHadMultipleCandidates(true);
2537 break;
2538 }
2539
2540 case EXPR_BINARY_OPERATOR:
2541 S = new (Context) BinaryOperator(Empty);
2542 break;
2543
2544 case EXPR_COMPOUND_ASSIGN_OPERATOR:
2545 S = new (Context) CompoundAssignOperator(Empty);
2546 break;
2547
2548 case EXPR_CONDITIONAL_OPERATOR:
2549 S = new (Context) ConditionalOperator(Empty);
2550 break;
2551
2552 case EXPR_BINARY_CONDITIONAL_OPERATOR:
2553 S = new (Context) BinaryConditionalOperator(Empty);
2554 break;
2555
2556 case EXPR_IMPLICIT_CAST:
2557 S = ImplicitCastExpr::CreateEmpty(Context,
2558 /*PathSize*/ Record[ASTStmtReader::NumExprFields]);
2559 break;
2560
2561 case EXPR_CSTYLE_CAST:
2562 S = CStyleCastExpr::CreateEmpty(Context,
2563 /*PathSize*/ Record[ASTStmtReader::NumExprFields]);
2564 break;
2565
2566 case EXPR_COMPOUND_LITERAL:
2567 S = new (Context) CompoundLiteralExpr(Empty);
2568 break;
2569
2570 case EXPR_EXT_VECTOR_ELEMENT:
2571 S = new (Context) ExtVectorElementExpr(Empty);
2572 break;
2573
2574 case EXPR_INIT_LIST:
2575 S = new (Context) InitListExpr(Empty);
2576 break;
2577
2578 case EXPR_DESIGNATED_INIT:
2579 S = DesignatedInitExpr::CreateEmpty(Context,
2580 Record[ASTStmtReader::NumExprFields] - 1);
2581
2582 break;
2583
2584 case EXPR_DESIGNATED_INIT_UPDATE:
2585 S = new (Context) DesignatedInitUpdateExpr(Empty);
2586 break;
2587
2588 case EXPR_IMPLICIT_VALUE_INIT:
2589 S = new (Context) ImplicitValueInitExpr(Empty);
2590 break;
2591
2592 case EXPR_NO_INIT:
2593 S = new (Context) NoInitExpr(Empty);
2594 break;
2595
2596 case EXPR_ARRAY_INIT_LOOP:
2597 S = new (Context) ArrayInitLoopExpr(Empty);
2598 break;
2599
2600 case EXPR_ARRAY_INIT_INDEX:
2601 S = new (Context) ArrayInitIndexExpr(Empty);
2602 break;
2603
2604 case EXPR_VA_ARG:
2605 S = new (Context) VAArgExpr(Empty);
2606 break;
2607
2608 case EXPR_ADDR_LABEL:
2609 S = new (Context) AddrLabelExpr(Empty);
2610 break;
2611
2612 case EXPR_STMT:
2613 S = new (Context) StmtExpr(Empty);
2614 break;
2615
2616 case EXPR_CHOOSE:
2617 S = new (Context) ChooseExpr(Empty);
2618 break;
2619
2620 case EXPR_GNU_NULL:
2621 S = new (Context) GNUNullExpr(Empty);
2622 break;
2623
2624 case EXPR_SHUFFLE_VECTOR:
2625 S = new (Context) ShuffleVectorExpr(Empty);
2626 break;
2627
2628 case EXPR_CONVERT_VECTOR:
2629 S = new (Context) ConvertVectorExpr(Empty);
2630 break;
2631
2632 case EXPR_BLOCK:
2633 S = new (Context) BlockExpr(Empty);
2634 break;
2635
2636 case EXPR_GENERIC_SELECTION:
2637 S = new (Context) GenericSelectionExpr(Empty);
2638 break;
2639
2640 case EXPR_OBJC_STRING_LITERAL:
2641 S = new (Context) ObjCStringLiteral(Empty);
2642 break;
2643
2644 case EXPR_OBJC_BOXED_EXPRESSION:
2645 S = new (Context) ObjCBoxedExpr(Empty);
2646 break;
2647
2648 case EXPR_OBJC_ARRAY_LITERAL:
2649 S = ObjCArrayLiteral::CreateEmpty(Context,
2650 Record[ASTStmtReader::NumExprFields]);
2651 break;
2652
2653 case EXPR_OBJC_DICTIONARY_LITERAL:
2654 S = ObjCDictionaryLiteral::CreateEmpty(Context,
2655 Record[ASTStmtReader::NumExprFields],
2656 Record[ASTStmtReader::NumExprFields + 1]);
2657 break;
2658
2659 case EXPR_OBJC_ENCODE:
2660 S = new (Context) ObjCEncodeExpr(Empty);
2661 break;
2662
2663 case EXPR_OBJC_SELECTOR_EXPR:
2664 S = new (Context) ObjCSelectorExpr(Empty);
2665 break;
2666
2667 case EXPR_OBJC_PROTOCOL_EXPR:
2668 S = new (Context) ObjCProtocolExpr(Empty);
2669 break;
2670
2671 case EXPR_OBJC_IVAR_REF_EXPR:
2672 S = new (Context) ObjCIvarRefExpr(Empty);
2673 break;
2674
2675 case EXPR_OBJC_PROPERTY_REF_EXPR:
2676 S = new (Context) ObjCPropertyRefExpr(Empty);
2677 break;
2678
2679 case EXPR_OBJC_SUBSCRIPT_REF_EXPR:
2680 S = new (Context) ObjCSubscriptRefExpr(Empty);
2681 break;
2682
2683 case EXPR_OBJC_KVC_REF_EXPR:
2684 llvm_unreachable("mismatching AST file")::llvm::llvm_unreachable_internal("mismatching AST file", "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 2684)
;
2685
2686 case EXPR_OBJC_MESSAGE_EXPR:
2687 S = ObjCMessageExpr::CreateEmpty(Context,
2688 Record[ASTStmtReader::NumExprFields],
2689 Record[ASTStmtReader::NumExprFields + 1]);
2690 break;
2691
2692 case EXPR_OBJC_ISA:
2693 S = new (Context) ObjCIsaExpr(Empty);
2694 break;
2695
2696 case EXPR_OBJC_INDIRECT_COPY_RESTORE:
2697 S = new (Context) ObjCIndirectCopyRestoreExpr(Empty);
2698 break;
2699
2700 case EXPR_OBJC_BRIDGED_CAST:
2701 S = new (Context) ObjCBridgedCastExpr(Empty);
2702 break;
2703
2704 case STMT_OBJC_FOR_COLLECTION:
2705 S = new (Context) ObjCForCollectionStmt(Empty);
2706 break;
2707
2708 case STMT_OBJC_CATCH:
2709 S = new (Context) ObjCAtCatchStmt(Empty);
2710 break;
2711
2712 case STMT_OBJC_FINALLY:
2713 S = new (Context) ObjCAtFinallyStmt(Empty);
2714 break;
2715
2716 case STMT_OBJC_AT_TRY:
2717 S = ObjCAtTryStmt::CreateEmpty(Context,
2718 Record[ASTStmtReader::NumStmtFields],
2719 Record[ASTStmtReader::NumStmtFields + 1]);
2720 break;
2721
2722 case STMT_OBJC_AT_SYNCHRONIZED:
2723 S = new (Context) ObjCAtSynchronizedStmt(Empty);
2724 break;
2725
2726 case STMT_OBJC_AT_THROW:
2727 S = new (Context) ObjCAtThrowStmt(Empty);
2728 break;
2729
2730 case STMT_OBJC_AUTORELEASE_POOL:
2731 S = new (Context) ObjCAutoreleasePoolStmt(Empty);
2732 break;
2733
2734 case EXPR_OBJC_BOOL_LITERAL:
2735 S = new (Context) ObjCBoolLiteralExpr(Empty);
2736 break;
2737
2738 case EXPR_OBJC_AVAILABILITY_CHECK:
2739 S = new (Context) ObjCAvailabilityCheckExpr(Empty);
2740 break;
2741
2742 case STMT_SEH_LEAVE:
2743 S = new (Context) SEHLeaveStmt(Empty);
2744 break;
2745
2746 case STMT_SEH_EXCEPT:
2747 S = new (Context) SEHExceptStmt(Empty);
2748 break;
2749
2750 case STMT_SEH_FINALLY:
2751 S = new (Context) SEHFinallyStmt(Empty);
2752 break;
2753
2754 case STMT_SEH_TRY:
2755 S = new (Context) SEHTryStmt(Empty);
2756 break;
2757
2758 case STMT_CXX_CATCH:
2759 S = new (Context) CXXCatchStmt(Empty);
2760 break;
2761
2762 case STMT_CXX_TRY:
2763 S = CXXTryStmt::Create(Context, Empty,
2764 /*NumHandlers=*/Record[ASTStmtReader::NumStmtFields]);
2765 break;
2766
2767 case STMT_CXX_FOR_RANGE:
2768 S = new (Context) CXXForRangeStmt(Empty);
2769 break;
2770
2771 case STMT_MS_DEPENDENT_EXISTS:
2772 S = new (Context) MSDependentExistsStmt(SourceLocation(), true,
2773 NestedNameSpecifierLoc(),
2774 DeclarationNameInfo(),
2775 nullptr);
2776 break;
2777
2778 case STMT_OMP_PARALLEL_DIRECTIVE:
2779 S =
2780 OMPParallelDirective::CreateEmpty(Context,
2781 Record[ASTStmtReader::NumStmtFields],
2782 Empty);
2783 break;
2784
2785 case STMT_OMP_SIMD_DIRECTIVE: {
2786 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
2787 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
2788 S = OMPSimdDirective::CreateEmpty(Context, NumClauses,
2789 CollapsedNum, Empty);
2790 break;
2791 }
2792
2793 case STMT_OMP_FOR_DIRECTIVE: {
2794 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
2795 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
2796 S = OMPForDirective::CreateEmpty(Context, NumClauses, CollapsedNum,
2797 Empty);
2798 break;
2799 }
2800
2801 case STMT_OMP_FOR_SIMD_DIRECTIVE: {
2802 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
2803 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
2804 S = OMPForSimdDirective::CreateEmpty(Context, NumClauses, CollapsedNum,
2805 Empty);
2806 break;
2807 }
2808
2809 case STMT_OMP_SECTIONS_DIRECTIVE:
2810 S = OMPSectionsDirective::CreateEmpty(
2811 Context, Record[ASTStmtReader::NumStmtFields], Empty);
2812 break;
2813
2814 case STMT_OMP_SECTION_DIRECTIVE:
2815 S = OMPSectionDirective::CreateEmpty(Context, Empty);
2816 break;
2817
2818 case STMT_OMP_SINGLE_DIRECTIVE:
2819 S = OMPSingleDirective::CreateEmpty(
2820 Context, Record[ASTStmtReader::NumStmtFields], Empty);
2821 break;
2822
2823 case STMT_OMP_MASTER_DIRECTIVE:
2824 S = OMPMasterDirective::CreateEmpty(Context, Empty);
2825 break;
2826
2827 case STMT_OMP_CRITICAL_DIRECTIVE:
2828 S = OMPCriticalDirective::CreateEmpty(
2829 Context, Record[ASTStmtReader::NumStmtFields], Empty);
2830 break;
2831
2832 case STMT_OMP_PARALLEL_FOR_DIRECTIVE: {
2833 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
2834 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
2835 S = OMPParallelForDirective::CreateEmpty(Context, NumClauses,
2836 CollapsedNum, Empty);
2837 break;
2838 }
2839
2840 case STMT_OMP_PARALLEL_FOR_SIMD_DIRECTIVE: {
2841 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
2842 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
2843 S = OMPParallelForSimdDirective::CreateEmpty(Context, NumClauses,
2844 CollapsedNum, Empty);
2845 break;
2846 }
2847
2848 case STMT_OMP_PARALLEL_SECTIONS_DIRECTIVE:
2849 S = OMPParallelSectionsDirective::CreateEmpty(
2850 Context, Record[ASTStmtReader::NumStmtFields], Empty);
2851 break;
2852
2853 case STMT_OMP_TASK_DIRECTIVE:
2854 S = OMPTaskDirective::CreateEmpty(
2855 Context, Record[ASTStmtReader::NumStmtFields], Empty);
2856 break;
2857
2858 case STMT_OMP_TASKYIELD_DIRECTIVE:
2859 S = OMPTaskyieldDirective::CreateEmpty(Context, Empty);
2860 break;
2861
2862 case STMT_OMP_BARRIER_DIRECTIVE:
2863 S = OMPBarrierDirective::CreateEmpty(Context, Empty);
2864 break;
2865
2866 case STMT_OMP_TASKWAIT_DIRECTIVE:
2867 S = OMPTaskwaitDirective::CreateEmpty(Context, Empty);
2868 break;
2869
2870 case STMT_OMP_TASKGROUP_DIRECTIVE:
2871 S = OMPTaskgroupDirective::CreateEmpty(
2872 Context, Record[ASTStmtReader::NumStmtFields], Empty);
2873 break;
2874
2875 case STMT_OMP_FLUSH_DIRECTIVE:
2876 S = OMPFlushDirective::CreateEmpty(
2877 Context, Record[ASTStmtReader::NumStmtFields], Empty);
2878 break;
2879
2880 case STMT_OMP_ORDERED_DIRECTIVE:
2881 S = OMPOrderedDirective::CreateEmpty(
2882 Context, Record[ASTStmtReader::NumStmtFields], Empty);
2883 break;
2884
2885 case STMT_OMP_ATOMIC_DIRECTIVE:
2886 S = OMPAtomicDirective::CreateEmpty(
2887 Context, Record[ASTStmtReader::NumStmtFields], Empty);
2888 break;
2889
2890 case STMT_OMP_TARGET_DIRECTIVE:
2891 S = OMPTargetDirective::CreateEmpty(
2892 Context, Record[ASTStmtReader::NumStmtFields], Empty);
2893 break;
2894
2895 case STMT_OMP_TARGET_DATA_DIRECTIVE:
2896 S = OMPTargetDataDirective::CreateEmpty(
2897 Context, Record[ASTStmtReader::NumStmtFields], Empty);
2898 break;
2899
2900 case STMT_OMP_TARGET_ENTER_DATA_DIRECTIVE:
2901 S = OMPTargetEnterDataDirective::CreateEmpty(
2902 Context, Record[ASTStmtReader::NumStmtFields], Empty);
2903 break;
2904
2905 case STMT_OMP_TARGET_EXIT_DATA_DIRECTIVE:
2906 S = OMPTargetExitDataDirective::CreateEmpty(
2907 Context, Record[ASTStmtReader::NumStmtFields], Empty);
2908 break;
2909
2910 case STMT_OMP_TARGET_PARALLEL_DIRECTIVE:
2911 S = OMPTargetParallelDirective::CreateEmpty(
2912 Context, Record[ASTStmtReader::NumStmtFields], Empty);
2913 break;
2914
2915 case STMT_OMP_TARGET_PARALLEL_FOR_DIRECTIVE: {
2916 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
2917 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
2918 S = OMPTargetParallelForDirective::CreateEmpty(Context, NumClauses,
2919 CollapsedNum, Empty);
2920 break;
2921 }
2922
2923 case STMT_OMP_TARGET_UPDATE_DIRECTIVE:
2924 S = OMPTargetUpdateDirective::CreateEmpty(
2925 Context, Record[ASTStmtReader::NumStmtFields], Empty);
2926 break;
2927
2928 case STMT_OMP_TEAMS_DIRECTIVE:
2929 S = OMPTeamsDirective::CreateEmpty(
2930 Context, Record[ASTStmtReader::NumStmtFields], Empty);
2931 break;
2932
2933 case STMT_OMP_CANCELLATION_POINT_DIRECTIVE:
2934 S = OMPCancellationPointDirective::CreateEmpty(Context, Empty);
2935 break;
2936
2937 case STMT_OMP_CANCEL_DIRECTIVE:
2938 S = OMPCancelDirective::CreateEmpty(
2939 Context, Record[ASTStmtReader::NumStmtFields], Empty);
2940 break;
2941
2942 case STMT_OMP_TASKLOOP_DIRECTIVE: {
2943 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
2944 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
2945 S = OMPTaskLoopDirective::CreateEmpty(Context, NumClauses, CollapsedNum,
2946 Empty);
2947 break;
2948 }
2949
2950 case STMT_OMP_TASKLOOP_SIMD_DIRECTIVE: {
2951 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
2952 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
2953 S = OMPTaskLoopSimdDirective::CreateEmpty(Context, NumClauses,
2954 CollapsedNum, Empty);
2955 break;
2956 }
2957
2958 case STMT_OMP_DISTRIBUTE_DIRECTIVE: {
2959 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
2960 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
2961 S = OMPDistributeDirective::CreateEmpty(Context, NumClauses, CollapsedNum,
2962 Empty);
2963 break;
2964 }
2965
2966 case STMT_OMP_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE: {
2967 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
2968 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
2969 S = OMPDistributeParallelForDirective::CreateEmpty(Context, NumClauses,
2970 CollapsedNum, Empty);
2971 break;
2972 }
2973
2974 case STMT_OMP_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE: {
2975 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
2976 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
2977 S = OMPDistributeParallelForSimdDirective::CreateEmpty(Context, NumClauses,
2978 CollapsedNum,
2979 Empty);
2980 break;
2981 }
2982
2983 case STMT_OMP_DISTRIBUTE_SIMD_DIRECTIVE: {
2984 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
2985 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
2986 S = OMPDistributeSimdDirective::CreateEmpty(Context, NumClauses,
2987 CollapsedNum, Empty);
2988 break;
2989 }
2990
2991 case STMT_OMP_TARGET_PARALLEL_FOR_SIMD_DIRECTIVE: {
2992 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
2993 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
2994 S = OMPTargetParallelForSimdDirective::CreateEmpty(Context, NumClauses,
2995 CollapsedNum, Empty);
2996 break;
2997 }
2998
2999 case STMT_OMP_TARGET_SIMD_DIRECTIVE: {
3000 auto NumClauses = Record[ASTStmtReader::NumStmtFields];
3001 auto CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
3002 S = OMPTargetSimdDirective::CreateEmpty(Context, NumClauses, CollapsedNum,
3003 Empty);
3004 break;
3005 }
3006
3007 case STMT_OMP_TEAMS_DISTRIBUTE_DIRECTIVE: {
3008 auto NumClauses = Record[ASTStmtReader::NumStmtFields];
3009 auto CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
3010 S = OMPTeamsDistributeDirective::CreateEmpty(Context, NumClauses,
3011 CollapsedNum, Empty);
3012 break;
3013 }
3014
3015 case STMT_OMP_TEAMS_DISTRIBUTE_SIMD_DIRECTIVE: {
3016 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
3017 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
3018 S = OMPTeamsDistributeSimdDirective::CreateEmpty(Context, NumClauses,
3019 CollapsedNum, Empty);
3020 break;
3021 }
3022
3023 case STMT_OMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE: {
3024 auto NumClauses = Record[ASTStmtReader::NumStmtFields];
3025 auto CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
3026 S = OMPTeamsDistributeParallelForSimdDirective::CreateEmpty(
3027 Context, NumClauses, CollapsedNum, Empty);
3028 break;
3029 }
3030
3031 case STMT_OMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE: {
3032 auto NumClauses = Record[ASTStmtReader::NumStmtFields];
3033 auto CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
3034 S = OMPTeamsDistributeParallelForDirective::CreateEmpty(
3035 Context, NumClauses, CollapsedNum, Empty);
3036 break;
3037 }
3038
3039 case STMT_OMP_TARGET_TEAMS_DIRECTIVE:
3040 S = OMPTargetTeamsDirective::CreateEmpty(
3041 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3042 break;
3043
3044 case STMT_OMP_TARGET_TEAMS_DISTRIBUTE_DIRECTIVE: {
3045 auto NumClauses = Record[ASTStmtReader::NumStmtFields];
3046 auto CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
3047 S = OMPTargetTeamsDistributeDirective::CreateEmpty(Context, NumClauses,
3048 CollapsedNum, Empty);
3049 break;
3050 }
3051
3052 case STMT_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE: {
3053 auto NumClauses = Record[ASTStmtReader::NumStmtFields];
3054 auto CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
3055 S = OMPTargetTeamsDistributeParallelForDirective::CreateEmpty(
3056 Context, NumClauses, CollapsedNum, Empty);
3057 break;
3058 }
3059
3060 case STMT_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE: {
3061 auto NumClauses = Record[ASTStmtReader::NumStmtFields];
3062 auto CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
3063 S = OMPTargetTeamsDistributeParallelForSimdDirective::CreateEmpty(
3064 Context, NumClauses, CollapsedNum, Empty);
3065 break;
3066 }
3067
3068 case STMT_OMP_TARGET_TEAMS_DISTRIBUTE_SIMD_DIRECTIVE: {
3069 auto NumClauses = Record[ASTStmtReader::NumStmtFields];
3070 auto CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
3071 S = OMPTargetTeamsDistributeSimdDirective::CreateEmpty(
3072 Context, NumClauses, CollapsedNum, Empty);
3073 break;
3074 }
3075
3076 case EXPR_CXX_OPERATOR_CALL:
3077 S = CXXOperatorCallExpr::CreateEmpty(
3078 Context, /*NumArgs=*/Record[ASTStmtReader::NumExprFields], Empty);
3079 break;
3080
3081 case EXPR_CXX_MEMBER_CALL:
3082 S = CXXMemberCallExpr::CreateEmpty(
3083 Context, /*NumArgs=*/Record[ASTStmtReader::NumExprFields], Empty);
3084 break;
3085
3086 case EXPR_CXX_CONSTRUCT:
3087 S = CXXConstructExpr::CreateEmpty(
3088 Context,
3089 /* NumArgs=*/Record[ASTStmtReader::NumExprFields]);
3090 break;
3091
3092 case EXPR_CXX_INHERITED_CTOR_INIT:
3093 S = new (Context) CXXInheritedCtorInitExpr(Empty);
3094 break;
3095
3096 case EXPR_CXX_TEMPORARY_OBJECT:
3097 S = CXXTemporaryObjectExpr::CreateEmpty(
3098 Context,
3099 /* NumArgs=*/Record[ASTStmtReader::NumExprFields]);
3100 break;
3101
3102 case EXPR_CXX_STATIC_CAST:
3103 S = CXXStaticCastExpr::CreateEmpty(Context,
3104 /*PathSize*/ Record[ASTStmtReader::NumExprFields]);
3105 break;
3106
3107 case EXPR_CXX_DYNAMIC_CAST:
3108 S = CXXDynamicCastExpr::CreateEmpty(Context,
3109 /*PathSize*/ Record[ASTStmtReader::NumExprFields]);
3110 break;
3111
3112 case EXPR_CXX_REINTERPRET_CAST:
3113 S = CXXReinterpretCastExpr::CreateEmpty(Context,
3114 /*PathSize*/ Record[ASTStmtReader::NumExprFields]);
3115 break;
3116
3117 case EXPR_CXX_CONST_CAST:
3118 S = CXXConstCastExpr::CreateEmpty(Context);
3119 break;
3120
3121 case EXPR_CXX_FUNCTIONAL_CAST:
3122 S = CXXFunctionalCastExpr::CreateEmpty(Context,
3123 /*PathSize*/ Record[ASTStmtReader::NumExprFields]);
3124 break;
3125
3126 case EXPR_USER_DEFINED_LITERAL:
3127 S = UserDefinedLiteral::CreateEmpty(
3128 Context, /*NumArgs=*/Record[ASTStmtReader::NumExprFields], Empty);
3129 break;
3130
3131 case EXPR_CXX_STD_INITIALIZER_LIST:
3132 S = new (Context) CXXStdInitializerListExpr(Empty);
3133 break;
3134
3135 case EXPR_CXX_BOOL_LITERAL:
3136 S = new (Context) CXXBoolLiteralExpr(Empty);
3137 break;
3138
3139 case EXPR_CXX_NULL_PTR_LITERAL:
3140 S = new (Context) CXXNullPtrLiteralExpr(Empty);
3141 break;
3142
3143 case EXPR_CXX_TYPEID_EXPR:
3144 S = new (Context) CXXTypeidExpr(Empty, true);
3145 break;
3146
3147 case EXPR_CXX_TYPEID_TYPE:
3148 S = new (Context) CXXTypeidExpr(Empty, false);
3149 break;
3150
3151 case EXPR_CXX_UUIDOF_EXPR:
3152 S = new (Context) CXXUuidofExpr(Empty, true);
3153 break;
3154
3155 case EXPR_CXX_PROPERTY_REF_EXPR:
3156 S = new (Context) MSPropertyRefExpr(Empty);
3157 break;
3158
3159 case EXPR_CXX_PROPERTY_SUBSCRIPT_EXPR:
3160 S = new (Context) MSPropertySubscriptExpr(Empty);
3161 break;
3162
3163 case EXPR_CXX_UUIDOF_TYPE:
3164 S = new (Context) CXXUuidofExpr(Empty, false);
3165 break;
3166
3167 case EXPR_CXX_THIS:
3168 S = new (Context) CXXThisExpr(Empty);
3169 break;
3170
3171 case EXPR_CXX_THROW:
3172 S = new (Context) CXXThrowExpr(Empty);
3173 break;
3174
3175 case EXPR_CXX_DEFAULT_ARG:
3176 S = new (Context) CXXDefaultArgExpr(Empty);
3177 break;
3178
3179 case EXPR_CXX_DEFAULT_INIT:
3180 S = new (Context) CXXDefaultInitExpr(Empty);
3181 break;
3182
3183 case EXPR_CXX_BIND_TEMPORARY:
3184 S = new (Context) CXXBindTemporaryExpr(Empty);
3185 break;
3186
3187 case EXPR_CXX_SCALAR_VALUE_INIT:
3188 S = new (Context) CXXScalarValueInitExpr(Empty);
3189 break;
3190
3191 case EXPR_CXX_NEW:
3192 S = new (Context) CXXNewExpr(Empty);
3193 break;
3194
3195 case EXPR_CXX_DELETE:
3196 S = new (Context) CXXDeleteExpr(Empty);
3197 break;
3198
3199 case EXPR_CXX_PSEUDO_DESTRUCTOR:
3200 S = new (Context) CXXPseudoDestructorExpr(Empty);
3201 break;
3202
3203 case EXPR_EXPR_WITH_CLEANUPS:
3204 S = ExprWithCleanups::Create(Context, Empty,
3205 Record[ASTStmtReader::NumExprFields]);
3206 break;
3207
3208 case EXPR_CXX_DEPENDENT_SCOPE_MEMBER:
3209 S = CXXDependentScopeMemberExpr::CreateEmpty(Context,
3210 /*HasTemplateKWAndArgsInfo=*/Record[ASTStmtReader::NumExprFields],
3211 /*NumTemplateArgs=*/Record[ASTStmtReader::NumExprFields]
3212 ? Record[ASTStmtReader::NumExprFields + 1]
3213 : 0);
3214 break;
3215
3216 case EXPR_CXX_DEPENDENT_SCOPE_DECL_REF:
3217 S = DependentScopeDeclRefExpr::CreateEmpty(Context,
3218 /*HasTemplateKWAndArgsInfo=*/Record[ASTStmtReader::NumExprFields],
3219 /*NumTemplateArgs=*/Record[ASTStmtReader::NumExprFields]
3220 ? Record[ASTStmtReader::NumExprFields + 1]
3221 : 0);
3222 break;
3223
3224 case EXPR_CXX_UNRESOLVED_CONSTRUCT:
3225 S = CXXUnresolvedConstructExpr::CreateEmpty(Context,
3226 /*NumArgs=*/Record[ASTStmtReader::NumExprFields]);
3227 break;
3228
3229 case EXPR_CXX_UNRESOLVED_MEMBER:
3230 S = UnresolvedMemberExpr::CreateEmpty(Context,
3231 /*HasTemplateKWAndArgsInfo=*/Record[ASTStmtReader::NumExprFields],
3232 /*NumTemplateArgs=*/Record[ASTStmtReader::NumExprFields]
3233 ? Record[ASTStmtReader::NumExprFields + 1]
3234 : 0);
3235 break;
3236
3237 case EXPR_CXX_UNRESOLVED_LOOKUP:
3238 S = UnresolvedLookupExpr::CreateEmpty(Context,
3239 /*HasTemplateKWAndArgsInfo=*/Record[ASTStmtReader::NumExprFields],
3240 /*NumTemplateArgs=*/Record[ASTStmtReader::NumExprFields]
3241 ? Record[ASTStmtReader::NumExprFields + 1]
3242 : 0);
3243 break;
3244
3245 case EXPR_TYPE_TRAIT:
3246 S = TypeTraitExpr::CreateDeserialized(Context,
3247 Record[ASTStmtReader::NumExprFields]);
3248 break;
3249
3250 case EXPR_ARRAY_TYPE_TRAIT:
3251 S = new (Context) ArrayTypeTraitExpr(Empty);
3252 break;
3253
3254 case EXPR_CXX_EXPRESSION_TRAIT:
3255 S = new (Context) ExpressionTraitExpr(Empty);
3256 break;
3257
3258 case EXPR_CXX_NOEXCEPT:
3259 S = new (Context) CXXNoexceptExpr(Empty);
3260 break;
3261
3262 case EXPR_PACK_EXPANSION:
3263 S = new (Context) PackExpansionExpr(Empty);
3264 break;
3265
3266 case EXPR_SIZEOF_PACK:
3267 S = SizeOfPackExpr::CreateDeserialized(
3268 Context,
3269 /*NumPartialArgs=*/Record[ASTStmtReader::NumExprFields]);
3270 break;
3271
3272 case EXPR_SUBST_NON_TYPE_TEMPLATE_PARM:
3273 S = new (Context) SubstNonTypeTemplateParmExpr(Empty);
3274 break;
3275
3276 case EXPR_SUBST_NON_TYPE_TEMPLATE_PARM_PACK:
3277 S = new (Context) SubstNonTypeTemplateParmPackExpr(Empty);
3278 break;
3279
3280 case EXPR_FUNCTION_PARM_PACK:
3281 S = FunctionParmPackExpr::CreateEmpty(Context,
3282 Record[ASTStmtReader::NumExprFields]);
3283 break;
3284
3285 case EXPR_MATERIALIZE_TEMPORARY:
3286 S = new (Context) MaterializeTemporaryExpr(Empty);
3287 break;
3288
3289 case EXPR_CXX_FOLD:
3290 S = new (Context) CXXFoldExpr(Empty);
3291 break;
3292
3293 case EXPR_OPAQUE_VALUE:
3294 S = new (Context) OpaqueValueExpr(Empty);
3295 break;
3296
3297 case EXPR_CUDA_KERNEL_CALL:
3298 S = CUDAKernelCallExpr::CreateEmpty(
3299 Context, /*NumArgs=*/Record[ASTStmtReader::NumExprFields], Empty);
3300 break;
3301
3302 case EXPR_ASTYPE:
3303 S = new (Context) AsTypeExpr(Empty);
3304 break;
3305
3306 case EXPR_PSEUDO_OBJECT: {
3307 unsigned numSemanticExprs = Record[ASTStmtReader::NumExprFields];
3308 S = PseudoObjectExpr::Create(Context, Empty, numSemanticExprs);
3309 break;
3310 }
3311
3312 case EXPR_ATOMIC:
3313 S = new (Context) AtomicExpr(Empty);
3314 break;
3315
3316 case EXPR_LAMBDA: {
3317 unsigned NumCaptures = Record[ASTStmtReader::NumExprFields];
3318 S = LambdaExpr::CreateDeserialized(Context, NumCaptures);
3319 break;
3320 }
3321
3322 case STMT_COROUTINE_BODY: {
3323 unsigned NumParams = Record[ASTStmtReader::NumStmtFields];
3324 S = CoroutineBodyStmt::Create(Context, Empty, NumParams);
3325 break;
3326 }
3327
3328 case STMT_CORETURN:
3329 S = new (Context) CoreturnStmt(Empty);
3330 break;
3331
3332 case EXPR_COAWAIT:
3333 S = new (Context) CoawaitExpr(Empty);
3334 break;
3335
3336 case EXPR_COYIELD:
3337 S = new (Context) CoyieldExpr(Empty);
3338 break;
3339
3340 case EXPR_DEPENDENT_COAWAIT:
3341 S = new (Context) DependentCoawaitExpr(Empty);
3342 break;
3343 }
3344
3345 // We hit a STMT_STOP, so we're done with this expression.
3346 if (Finished)
3347 break;
3348
3349 ++NumStatementsRead;
3350
3351 if (S && !IsStmtReference) {
3352 Reader.Visit(S);
3353 StmtEntries[Cursor.GetCurrentBitNo()] = S;
3354 }
3355
3356 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-8~svn350071/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 3357, __PRETTY_FUNCTION__))
3357 "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-8~svn350071/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 3357, __PRETTY_FUNCTION__))
;
3358 StmtStack.push_back(S);
3359 }
3360Done:
3361 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-8~svn350071/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 3361, __PRETTY_FUNCTION__))
;
3362 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-8~svn350071/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 3362, __PRETTY_FUNCTION__))
;
3363 return StmtStack.pop_back_val();
3364}