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-config-compatibility-mode=true -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 -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~svn348900/build-llvm/tools/clang/lib/Serialization -I /build/llvm-toolchain-snapshot-8~svn348900/tools/clang/lib/Serialization -I /build/llvm-toolchain-snapshot-8~svn348900/tools/clang/include -I /build/llvm-toolchain-snapshot-8~svn348900/build-llvm/tools/clang/include -I /build/llvm-toolchain-snapshot-8~svn348900/build-llvm/include -I /build/llvm-toolchain-snapshot-8~svn348900/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-command-line-argument -Wno-unknown-warning-option -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~svn348900/build-llvm/tools/clang/lib/Serialization -ferror-limit 19 -fmessage-length 0 -fvisibility-inlines-hidden -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-12-042652-12204-1 -x c++ /build/llvm-toolchain-snapshot-8~svn348900/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~svn348900/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~svn348900/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~svn348900/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~svn348900/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~svn348900/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~svn348900/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~svn348900/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~svn348900/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~svn348900/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~svn348900/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~svn348900/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~svn348900/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~svn348900/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~svn348900/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~svn348900/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~svn348900/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~svn348900/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~svn348900/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}
741
742void ASTStmtReader::VisitCXXMemberCallExpr(CXXMemberCallExpr *E) {
743 VisitCallExpr(E);
744}
745
746void ASTStmtReader::VisitMemberExpr(MemberExpr *E) {
747 // Don't call VisitExpr, this is fully initialized at creation.
748 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~svn348900/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 749, __PRETTY_FUNCTION__))
749 "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~svn348900/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 749, __PRETTY_FUNCTION__))
;
750}
751
752void ASTStmtReader::VisitObjCIsaExpr(ObjCIsaExpr *E) {
753 VisitExpr(E);
754 E->setBase(Record.readSubExpr());
755 E->setIsaMemberLoc(ReadSourceLocation());
756 E->setOpLoc(ReadSourceLocation());
757 E->setArrow(Record.readInt());
758}
759
760void ASTStmtReader::
761VisitObjCIndirectCopyRestoreExpr(ObjCIndirectCopyRestoreExpr *E) {
762 VisitExpr(E);
763 E->Operand = Record.readSubExpr();
764 E->setShouldCopy(Record.readInt());
765}
766
767void ASTStmtReader::VisitObjCBridgedCastExpr(ObjCBridgedCastExpr *E) {
768 VisitExplicitCastExpr(E);
769 E->LParenLoc = ReadSourceLocation();
770 E->BridgeKeywordLoc = ReadSourceLocation();
771 E->Kind = Record.readInt();
772}
773
774void ASTStmtReader::VisitCastExpr(CastExpr *E) {
775 VisitExpr(E);
776 unsigned NumBaseSpecs = Record.readInt();
777 assert(NumBaseSpecs == E->path_size())((NumBaseSpecs == E->path_size()) ? static_cast<void>
(0) : __assert_fail ("NumBaseSpecs == E->path_size()", "/build/llvm-toolchain-snapshot-8~svn348900/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 777, __PRETTY_FUNCTION__))
;
778 E->setSubExpr(Record.readSubExpr());
779 E->setCastKind((CastKind)Record.readInt());
780 CastExpr::path_iterator BaseI = E->path_begin();
781 while (NumBaseSpecs--) {
782 auto *BaseSpec = new (Record.getContext()) CXXBaseSpecifier;
783 *BaseSpec = Record.readCXXBaseSpecifier();
784 *BaseI++ = BaseSpec;
785 }
786}
787
788void ASTStmtReader::VisitBinaryOperator(BinaryOperator *E) {
789 VisitExpr(E);
790 E->setLHS(Record.readSubExpr());
791 E->setRHS(Record.readSubExpr());
792 E->setOpcode((BinaryOperator::Opcode)Record.readInt());
793 E->setOperatorLoc(ReadSourceLocation());
794 E->setFPFeatures(FPOptions(Record.readInt()));
795}
796
797void ASTStmtReader::VisitCompoundAssignOperator(CompoundAssignOperator *E) {
798 VisitBinaryOperator(E);
799 E->setComputationLHSType(Record.readType());
800 E->setComputationResultType(Record.readType());
801}
802
803void ASTStmtReader::VisitConditionalOperator(ConditionalOperator *E) {
804 VisitExpr(E);
805 E->SubExprs[ConditionalOperator::COND] = Record.readSubExpr();
806 E->SubExprs[ConditionalOperator::LHS] = Record.readSubExpr();
807 E->SubExprs[ConditionalOperator::RHS] = Record.readSubExpr();
808 E->QuestionLoc = ReadSourceLocation();
809 E->ColonLoc = ReadSourceLocation();
810}
811
812void
813ASTStmtReader::VisitBinaryConditionalOperator(BinaryConditionalOperator *E) {
814 VisitExpr(E);
815 E->OpaqueValue = cast<OpaqueValueExpr>(Record.readSubExpr());
816 E->SubExprs[BinaryConditionalOperator::COMMON] = Record.readSubExpr();
817 E->SubExprs[BinaryConditionalOperator::COND] = Record.readSubExpr();
818 E->SubExprs[BinaryConditionalOperator::LHS] = Record.readSubExpr();
819 E->SubExprs[BinaryConditionalOperator::RHS] = Record.readSubExpr();
820 E->QuestionLoc = ReadSourceLocation();
821 E->ColonLoc = ReadSourceLocation();
822}
823
824void ASTStmtReader::VisitImplicitCastExpr(ImplicitCastExpr *E) {
825 VisitCastExpr(E);
826 E->setIsPartOfExplicitCast(Record.readInt());
827}
828
829void ASTStmtReader::VisitExplicitCastExpr(ExplicitCastExpr *E) {
830 VisitCastExpr(E);
831 E->setTypeInfoAsWritten(GetTypeSourceInfo());
832}
833
834void ASTStmtReader::VisitCStyleCastExpr(CStyleCastExpr *E) {
835 VisitExplicitCastExpr(E);
836 E->setLParenLoc(ReadSourceLocation());
837 E->setRParenLoc(ReadSourceLocation());
838}
839
840void ASTStmtReader::VisitCompoundLiteralExpr(CompoundLiteralExpr *E) {
841 VisitExpr(E);
842 E->setLParenLoc(ReadSourceLocation());
843 E->setTypeSourceInfo(GetTypeSourceInfo());
844 E->setInitializer(Record.readSubExpr());
845 E->setFileScope(Record.readInt());
846}
847
848void ASTStmtReader::VisitExtVectorElementExpr(ExtVectorElementExpr *E) {
849 VisitExpr(E);
850 E->setBase(Record.readSubExpr());
851 E->setAccessor(Record.getIdentifierInfo());
852 E->setAccessorLoc(ReadSourceLocation());
853}
854
855void ASTStmtReader::VisitInitListExpr(InitListExpr *E) {
856 VisitExpr(E);
857 if (auto *SyntForm = cast_or_null<InitListExpr>(Record.readSubStmt()))
858 E->setSyntacticForm(SyntForm);
859 E->setLBraceLoc(ReadSourceLocation());
860 E->setRBraceLoc(ReadSourceLocation());
861 bool isArrayFiller = Record.readInt();
862 Expr *filler = nullptr;
863 if (isArrayFiller) {
864 filler = Record.readSubExpr();
865 E->ArrayFillerOrUnionFieldInit = filler;
866 } else
867 E->ArrayFillerOrUnionFieldInit = ReadDeclAs<FieldDecl>();
868 E->sawArrayRangeDesignator(Record.readInt());
869 unsigned NumInits = Record.readInt();
870 E->reserveInits(Record.getContext(), NumInits);
871 if (isArrayFiller) {
872 for (unsigned I = 0; I != NumInits; ++I) {
873 Expr *init = Record.readSubExpr();
874 E->updateInit(Record.getContext(), I, init ? init : filler);
875 }
876 } else {
877 for (unsigned I = 0; I != NumInits; ++I)
878 E->updateInit(Record.getContext(), I, Record.readSubExpr());
879 }
880}
881
882void ASTStmtReader::VisitDesignatedInitExpr(DesignatedInitExpr *E) {
883 using Designator = DesignatedInitExpr::Designator;
884
885 VisitExpr(E);
886 unsigned NumSubExprs = Record.readInt();
887 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~svn348900/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 887, __PRETTY_FUNCTION__))
;
888 for (unsigned I = 0; I != NumSubExprs; ++I)
889 E->setSubExpr(I, Record.readSubExpr());
890 E->setEqualOrColonLoc(ReadSourceLocation());
891 E->setGNUSyntax(Record.readInt());
892
893 SmallVector<Designator, 4> Designators;
894 while (Record.getIdx() < Record.size()) {
895 switch ((DesignatorTypes)Record.readInt()) {
896 case DESIG_FIELD_DECL: {
897 auto *Field = ReadDeclAs<FieldDecl>();
898 SourceLocation DotLoc = ReadSourceLocation();
899 SourceLocation FieldLoc = ReadSourceLocation();
900 Designators.push_back(Designator(Field->getIdentifier(), DotLoc,
901 FieldLoc));
902 Designators.back().setField(Field);
903 break;
904 }
905
906 case DESIG_FIELD_NAME: {
907 const IdentifierInfo *Name = Record.getIdentifierInfo();
908 SourceLocation DotLoc = ReadSourceLocation();
909 SourceLocation FieldLoc = ReadSourceLocation();
910 Designators.push_back(Designator(Name, DotLoc, FieldLoc));
911 break;
912 }
913
914 case DESIG_ARRAY: {
915 unsigned Index = Record.readInt();
916 SourceLocation LBracketLoc = ReadSourceLocation();
917 SourceLocation RBracketLoc = ReadSourceLocation();
918 Designators.push_back(Designator(Index, LBracketLoc, RBracketLoc));
919 break;
920 }
921
922 case DESIG_ARRAY_RANGE: {
923 unsigned Index = Record.readInt();
924 SourceLocation LBracketLoc = ReadSourceLocation();
925 SourceLocation EllipsisLoc = ReadSourceLocation();
926 SourceLocation RBracketLoc = ReadSourceLocation();
927 Designators.push_back(Designator(Index, LBracketLoc, EllipsisLoc,
928 RBracketLoc));
929 break;
930 }
931 }
932 }
933 E->setDesignators(Record.getContext(),
934 Designators.data(), Designators.size());
935}
936
937void ASTStmtReader::VisitDesignatedInitUpdateExpr(DesignatedInitUpdateExpr *E) {
938 VisitExpr(E);
939 E->setBase(Record.readSubExpr());
940 E->setUpdater(Record.readSubExpr());
941}
942
943void ASTStmtReader::VisitNoInitExpr(NoInitExpr *E) {
944 VisitExpr(E);
945}
946
947void ASTStmtReader::VisitArrayInitLoopExpr(ArrayInitLoopExpr *E) {
948 VisitExpr(E);
949 E->SubExprs[0] = Record.readSubExpr();
950 E->SubExprs[1] = Record.readSubExpr();
951}
952
953void ASTStmtReader::VisitArrayInitIndexExpr(ArrayInitIndexExpr *E) {
954 VisitExpr(E);
955}
956
957void ASTStmtReader::VisitImplicitValueInitExpr(ImplicitValueInitExpr *E) {
958 VisitExpr(E);
959}
960
961void ASTStmtReader::VisitVAArgExpr(VAArgExpr *E) {
962 VisitExpr(E);
963 E->setSubExpr(Record.readSubExpr());
964 E->setWrittenTypeInfo(GetTypeSourceInfo());
965 E->setBuiltinLoc(ReadSourceLocation());
966 E->setRParenLoc(ReadSourceLocation());
967 E->setIsMicrosoftABI(Record.readInt());
968}
969
970void ASTStmtReader::VisitAddrLabelExpr(AddrLabelExpr *E) {
971 VisitExpr(E);
972 E->setAmpAmpLoc(ReadSourceLocation());
973 E->setLabelLoc(ReadSourceLocation());
974 E->setLabel(ReadDeclAs<LabelDecl>());
975}
976
977void ASTStmtReader::VisitStmtExpr(StmtExpr *E) {
978 VisitExpr(E);
979 E->setLParenLoc(ReadSourceLocation());
980 E->setRParenLoc(ReadSourceLocation());
981 E->setSubStmt(cast_or_null<CompoundStmt>(Record.readSubStmt()));
982}
983
984void ASTStmtReader::VisitChooseExpr(ChooseExpr *E) {
985 VisitExpr(E);
986 E->setCond(Record.readSubExpr());
987 E->setLHS(Record.readSubExpr());
988 E->setRHS(Record.readSubExpr());
989 E->setBuiltinLoc(ReadSourceLocation());
990 E->setRParenLoc(ReadSourceLocation());
991 E->setIsConditionTrue(Record.readInt());
992}
993
994void ASTStmtReader::VisitGNUNullExpr(GNUNullExpr *E) {
995 VisitExpr(E);
996 E->setTokenLocation(ReadSourceLocation());
997}
998
999void ASTStmtReader::VisitShuffleVectorExpr(ShuffleVectorExpr *E) {
1000 VisitExpr(E);
1001 SmallVector<Expr *, 16> Exprs;
1002 unsigned NumExprs = Record.readInt();
1003 while (NumExprs--)
1004 Exprs.push_back(Record.readSubExpr());
1005 E->setExprs(Record.getContext(), Exprs);
1006 E->setBuiltinLoc(ReadSourceLocation());
1007 E->setRParenLoc(ReadSourceLocation());
1008}
1009
1010void ASTStmtReader::VisitConvertVectorExpr(ConvertVectorExpr *E) {
1011 VisitExpr(E);
1012 E->BuiltinLoc = ReadSourceLocation();
1013 E->RParenLoc = ReadSourceLocation();
1014 E->TInfo = GetTypeSourceInfo();
1015 E->SrcExpr = Record.readSubExpr();
1016}
1017
1018void ASTStmtReader::VisitBlockExpr(BlockExpr *E) {
1019 VisitExpr(E);
1020 E->setBlockDecl(ReadDeclAs<BlockDecl>());
1021}
1022
1023void ASTStmtReader::VisitGenericSelectionExpr(GenericSelectionExpr *E) {
1024 VisitExpr(E);
1025 E->NumAssocs = Record.readInt();
1026 E->AssocTypes = new (Record.getContext()) TypeSourceInfo*[E->NumAssocs];
1027 E->SubExprs =
1028 new(Record.getContext()) Stmt*[GenericSelectionExpr::END_EXPR+E->NumAssocs];
1029
1030 E->SubExprs[GenericSelectionExpr::CONTROLLING] = Record.readSubExpr();
1031 for (unsigned I = 0, N = E->getNumAssocs(); I != N; ++I) {
1032 E->AssocTypes[I] = GetTypeSourceInfo();
1033 E->SubExprs[GenericSelectionExpr::END_EXPR+I] = Record.readSubExpr();
1034 }
1035 E->ResultIndex = Record.readInt();
1036
1037 E->GenericLoc = ReadSourceLocation();
1038 E->DefaultLoc = ReadSourceLocation();
1039 E->RParenLoc = ReadSourceLocation();
1040}
1041
1042void ASTStmtReader::VisitPseudoObjectExpr(PseudoObjectExpr *E) {
1043 VisitExpr(E);
1044 unsigned numSemanticExprs = Record.readInt();
1045 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~svn348900/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 1045, __PRETTY_FUNCTION__))
;
1046 E->PseudoObjectExprBits.ResultIndex = Record.readInt();
1047
1048 // Read the syntactic expression.
1049 E->getSubExprsBuffer()[0] = Record.readSubExpr();
1050
1051 // Read all the semantic expressions.
1052 for (unsigned i = 0; i != numSemanticExprs; ++i) {
1053 Expr *subExpr = Record.readSubExpr();
1054 E->getSubExprsBuffer()[i+1] = subExpr;
1055 }
1056}
1057
1058void ASTStmtReader::VisitAtomicExpr(AtomicExpr *E) {
1059 VisitExpr(E);
1060 E->Op = AtomicExpr::AtomicOp(Record.readInt());
1061 E->NumSubExprs = AtomicExpr::getNumSubExprs(E->Op);
1062 for (unsigned I = 0; I != E->NumSubExprs; ++I)
1063 E->SubExprs[I] = Record.readSubExpr();
1064 E->BuiltinLoc = ReadSourceLocation();
1065 E->RParenLoc = ReadSourceLocation();
1066}
1067
1068//===----------------------------------------------------------------------===//
1069// Objective-C Expressions and Statements
1070
1071void ASTStmtReader::VisitObjCStringLiteral(ObjCStringLiteral *E) {
1072 VisitExpr(E);
1073 E->setString(cast<StringLiteral>(Record.readSubStmt()));
1074 E->setAtLoc(ReadSourceLocation());
1075}
1076
1077void ASTStmtReader::VisitObjCBoxedExpr(ObjCBoxedExpr *E) {
1078 VisitExpr(E);
1079 // could be one of several IntegerLiteral, FloatLiteral, etc.
1080 E->SubExpr = Record.readSubStmt();
1081 E->BoxingMethod = ReadDeclAs<ObjCMethodDecl>();
1082 E->Range = ReadSourceRange();
1083}
1084
1085void ASTStmtReader::VisitObjCArrayLiteral(ObjCArrayLiteral *E) {
1086 VisitExpr(E);
1087 unsigned NumElements = Record.readInt();
1088 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~svn348900/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 1088, __PRETTY_FUNCTION__))
;
1089 Expr **Elements = E->getElements();
1090 for (unsigned I = 0, N = NumElements; I != N; ++I)
1091 Elements[I] = Record.readSubExpr();
1092 E->ArrayWithObjectsMethod = ReadDeclAs<ObjCMethodDecl>();
1093 E->Range = ReadSourceRange();
1094}
1095
1096void ASTStmtReader::VisitObjCDictionaryLiteral(ObjCDictionaryLiteral *E) {
1097 VisitExpr(E);
1098 unsigned NumElements = Record.readInt();
1099 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~svn348900/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 1099, __PRETTY_FUNCTION__))
;
1100 bool HasPackExpansions = Record.readInt();
1101 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~svn348900/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 1101, __PRETTY_FUNCTION__))
;
1102 auto *KeyValues =
1103 E->getTrailingObjects<ObjCDictionaryLiteral::KeyValuePair>();
1104 auto *Expansions =
1105 E->getTrailingObjects<ObjCDictionaryLiteral::ExpansionData>();
1106 for (unsigned I = 0; I != NumElements; ++I) {
1107 KeyValues[I].Key = Record.readSubExpr();
1108 KeyValues[I].Value = Record.readSubExpr();
1109 if (HasPackExpansions) {
1110 Expansions[I].EllipsisLoc = ReadSourceLocation();
1111 Expansions[I].NumExpansionsPlusOne = Record.readInt();
1112 }
1113 }
1114 E->DictWithObjectsMethod = ReadDeclAs<ObjCMethodDecl>();
1115 E->Range = ReadSourceRange();
1116}
1117
1118void ASTStmtReader::VisitObjCEncodeExpr(ObjCEncodeExpr *E) {
1119 VisitExpr(E);
1120 E->setEncodedTypeSourceInfo(GetTypeSourceInfo());
1121 E->setAtLoc(ReadSourceLocation());
1122 E->setRParenLoc(ReadSourceLocation());
1123}
1124
1125void ASTStmtReader::VisitObjCSelectorExpr(ObjCSelectorExpr *E) {
1126 VisitExpr(E);
1127 E->setSelector(Record.readSelector());
1128 E->setAtLoc(ReadSourceLocation());
1129 E->setRParenLoc(ReadSourceLocation());
1130}
1131
1132void ASTStmtReader::VisitObjCProtocolExpr(ObjCProtocolExpr *E) {
1133 VisitExpr(E);
1134 E->setProtocol(ReadDeclAs<ObjCProtocolDecl>());
1135 E->setAtLoc(ReadSourceLocation());
1136 E->ProtoLoc = ReadSourceLocation();
1137 E->setRParenLoc(ReadSourceLocation());
1138}
1139
1140void ASTStmtReader::VisitObjCIvarRefExpr(ObjCIvarRefExpr *E) {
1141 VisitExpr(E);
1142 E->setDecl(ReadDeclAs<ObjCIvarDecl>());
1143 E->setLocation(ReadSourceLocation());
1144 E->setOpLoc(ReadSourceLocation());
1145 E->setBase(Record.readSubExpr());
1146 E->setIsArrow(Record.readInt());
1147 E->setIsFreeIvar(Record.readInt());
1148}
1149
1150void ASTStmtReader::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *E) {
1151 VisitExpr(E);
1152 unsigned MethodRefFlags = Record.readInt();
1153 bool Implicit = Record.readInt() != 0;
1154 if (Implicit) {
1155 auto *Getter = ReadDeclAs<ObjCMethodDecl>();
1156 auto *Setter = ReadDeclAs<ObjCMethodDecl>();
1157 E->setImplicitProperty(Getter, Setter, MethodRefFlags);
1158 } else {
1159 E->setExplicitProperty(ReadDeclAs<ObjCPropertyDecl>(), MethodRefFlags);
1160 }
1161 E->setLocation(ReadSourceLocation());
1162 E->setReceiverLocation(ReadSourceLocation());
1163 switch (Record.readInt()) {
1164 case 0:
1165 E->setBase(Record.readSubExpr());
1166 break;
1167 case 1:
1168 E->setSuperReceiver(Record.readType());
1169 break;
1170 case 2:
1171 E->setClassReceiver(ReadDeclAs<ObjCInterfaceDecl>());
1172 break;
1173 }
1174}
1175
1176void ASTStmtReader::VisitObjCSubscriptRefExpr(ObjCSubscriptRefExpr *E) {
1177 VisitExpr(E);
1178 E->setRBracket(ReadSourceLocation());
1179 E->setBaseExpr(Record.readSubExpr());
1180 E->setKeyExpr(Record.readSubExpr());
1181 E->GetAtIndexMethodDecl = ReadDeclAs<ObjCMethodDecl>();
1182 E->SetAtIndexMethodDecl = ReadDeclAs<ObjCMethodDecl>();
1183}
1184
1185void ASTStmtReader::VisitObjCMessageExpr(ObjCMessageExpr *E) {
1186 VisitExpr(E);
1187 assert(Record.peekInt() == E->getNumArgs())((Record.peekInt() == E->getNumArgs()) ? static_cast<void
> (0) : __assert_fail ("Record.peekInt() == E->getNumArgs()"
, "/build/llvm-toolchain-snapshot-8~svn348900/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 1187, __PRETTY_FUNCTION__))
;
1188 Record.skipInts(1);
1189 unsigned NumStoredSelLocs = Record.readInt();
1190 E->SelLocsKind = Record.readInt();
1191 E->setDelegateInitCall(Record.readInt());
1192 E->IsImplicit = Record.readInt();
1193 auto Kind = static_cast<ObjCMessageExpr::ReceiverKind>(Record.readInt());
1194 switch (Kind) {
1195 case ObjCMessageExpr::Instance:
1196 E->setInstanceReceiver(Record.readSubExpr());
1197 break;
1198
1199 case ObjCMessageExpr::Class:
1200 E->setClassReceiver(GetTypeSourceInfo());
1201 break;
1202
1203 case ObjCMessageExpr::SuperClass:
1204 case ObjCMessageExpr::SuperInstance: {
1205 QualType T = Record.readType();
1206 SourceLocation SuperLoc = ReadSourceLocation();
1207 E->setSuper(SuperLoc, T, Kind == ObjCMessageExpr::SuperInstance);
1208 break;
1209 }
1210 }
1211
1212 assert(Kind == E->getReceiverKind())((Kind == E->getReceiverKind()) ? static_cast<void> (
0) : __assert_fail ("Kind == E->getReceiverKind()", "/build/llvm-toolchain-snapshot-8~svn348900/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 1212, __PRETTY_FUNCTION__))
;
1213
1214 if (Record.readInt())
1215 E->setMethodDecl(ReadDeclAs<ObjCMethodDecl>());
1216 else
1217 E->setSelector(Record.readSelector());
1218
1219 E->LBracLoc = ReadSourceLocation();
1220 E->RBracLoc = ReadSourceLocation();
1221
1222 for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
1223 E->setArg(I, Record.readSubExpr());
1224
1225 SourceLocation *Locs = E->getStoredSelLocs();
1226 for (unsigned I = 0; I != NumStoredSelLocs; ++I)
1227 Locs[I] = ReadSourceLocation();
1228}
1229
1230void ASTStmtReader::VisitObjCForCollectionStmt(ObjCForCollectionStmt *S) {
1231 VisitStmt(S);
1232 S->setElement(Record.readSubStmt());
1233 S->setCollection(Record.readSubExpr());
1234 S->setBody(Record.readSubStmt());
1235 S->setForLoc(ReadSourceLocation());
1236 S->setRParenLoc(ReadSourceLocation());
1237}
1238
1239void ASTStmtReader::VisitObjCAtCatchStmt(ObjCAtCatchStmt *S) {
1240 VisitStmt(S);
1241 S->setCatchBody(Record.readSubStmt());
1242 S->setCatchParamDecl(ReadDeclAs<VarDecl>());
1243 S->setAtCatchLoc(ReadSourceLocation());
1244 S->setRParenLoc(ReadSourceLocation());
1245}
1246
1247void ASTStmtReader::VisitObjCAtFinallyStmt(ObjCAtFinallyStmt *S) {
1248 VisitStmt(S);
1249 S->setFinallyBody(Record.readSubStmt());
1250 S->setAtFinallyLoc(ReadSourceLocation());
1251}
1252
1253void ASTStmtReader::VisitObjCAutoreleasePoolStmt(ObjCAutoreleasePoolStmt *S) {
1254 VisitStmt(S);
1255 S->setSubStmt(Record.readSubStmt());
1256 S->setAtLoc(ReadSourceLocation());
1257}
1258
1259void ASTStmtReader::VisitObjCAtTryStmt(ObjCAtTryStmt *S) {
1260 VisitStmt(S);
1261 assert(Record.peekInt() == S->getNumCatchStmts())((Record.peekInt() == S->getNumCatchStmts()) ? static_cast
<void> (0) : __assert_fail ("Record.peekInt() == S->getNumCatchStmts()"
, "/build/llvm-toolchain-snapshot-8~svn348900/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 1261, __PRETTY_FUNCTION__))
;
1262 Record.skipInts(1);
1263 bool HasFinally = Record.readInt();
1264 S->setTryBody(Record.readSubStmt());
1265 for (unsigned I = 0, N = S->getNumCatchStmts(); I != N; ++I)
1266 S->setCatchStmt(I, cast_or_null<ObjCAtCatchStmt>(Record.readSubStmt()));
1267
1268 if (HasFinally)
1269 S->setFinallyStmt(Record.readSubStmt());
1270 S->setAtTryLoc(ReadSourceLocation());
1271}
1272
1273void ASTStmtReader::VisitObjCAtSynchronizedStmt(ObjCAtSynchronizedStmt *S) {
1274 VisitStmt(S);
1275 S->setSynchExpr(Record.readSubStmt());
1276 S->setSynchBody(Record.readSubStmt());
1277 S->setAtSynchronizedLoc(ReadSourceLocation());
1278}
1279
1280void ASTStmtReader::VisitObjCAtThrowStmt(ObjCAtThrowStmt *S) {
1281 VisitStmt(S);
1282 S->setThrowExpr(Record.readSubStmt());
1283 S->setThrowLoc(ReadSourceLocation());
1284}
1285
1286void ASTStmtReader::VisitObjCBoolLiteralExpr(ObjCBoolLiteralExpr *E) {
1287 VisitExpr(E);
1288 E->setValue(Record.readInt());
1289 E->setLocation(ReadSourceLocation());
1290}
1291
1292void ASTStmtReader::VisitObjCAvailabilityCheckExpr(ObjCAvailabilityCheckExpr *E) {
1293 VisitExpr(E);
1294 SourceRange R = Record.readSourceRange();
1295 E->AtLoc = R.getBegin();
1296 E->RParen = R.getEnd();
1297 E->VersionToCheck = Record.readVersionTuple();
1298}
1299
1300//===----------------------------------------------------------------------===//
1301// C++ Expressions and Statements
1302//===----------------------------------------------------------------------===//
1303
1304void ASTStmtReader::VisitCXXCatchStmt(CXXCatchStmt *S) {
1305 VisitStmt(S);
1306 S->CatchLoc = ReadSourceLocation();
1307 S->ExceptionDecl = ReadDeclAs<VarDecl>();
1308 S->HandlerBlock = Record.readSubStmt();
1309}
1310
1311void ASTStmtReader::VisitCXXTryStmt(CXXTryStmt *S) {
1312 VisitStmt(S);
1313 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~svn348900/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 1313, __PRETTY_FUNCTION__))
;
1314 Record.skipInts(1);
1315 S->TryLoc = ReadSourceLocation();
1316 S->getStmts()[0] = Record.readSubStmt();
1317 for (unsigned i = 0, e = S->getNumHandlers(); i != e; ++i)
1318 S->getStmts()[i + 1] = Record.readSubStmt();
1319}
1320
1321void ASTStmtReader::VisitCXXForRangeStmt(CXXForRangeStmt *S) {
1322 VisitStmt(S);
1323 S->ForLoc = ReadSourceLocation();
1324 S->CoawaitLoc = ReadSourceLocation();
1325 S->ColonLoc = ReadSourceLocation();
1326 S->RParenLoc = ReadSourceLocation();
1327 S->setInit(Record.readSubStmt());
1328 S->setRangeStmt(Record.readSubStmt());
1329 S->setBeginStmt(Record.readSubStmt());
1330 S->setEndStmt(Record.readSubStmt());
1331 S->setCond(Record.readSubExpr());
1332 S->setInc(Record.readSubExpr());
1333 S->setLoopVarStmt(Record.readSubStmt());
1334 S->setBody(Record.readSubStmt());
1335}
1336
1337void ASTStmtReader::VisitMSDependentExistsStmt(MSDependentExistsStmt *S) {
1338 VisitStmt(S);
1339 S->KeywordLoc = ReadSourceLocation();
1340 S->IsIfExists = Record.readInt();
1341 S->QualifierLoc = Record.readNestedNameSpecifierLoc();
1342 ReadDeclarationNameInfo(S->NameInfo);
1343 S->SubStmt = Record.readSubStmt();
1344}
1345
1346void ASTStmtReader::VisitCXXOperatorCallExpr(CXXOperatorCallExpr *E) {
1347 VisitCallExpr(E);
1348 E->Operator = (OverloadedOperatorKind)Record.readInt();
1349 E->Range = Record.readSourceRange();
1350 E->setFPFeatures(FPOptions(Record.readInt()));
1351}
1352
1353void ASTStmtReader::VisitCXXConstructExpr(CXXConstructExpr *E) {
1354 VisitExpr(E);
1355 E->NumArgs = Record.readInt();
1356 if (E->NumArgs)
1357 E->Args = new (Record.getContext()) Stmt*[E->NumArgs];
1358 for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
1359 E->setArg(I, Record.readSubExpr());
1360 E->setConstructor(ReadDeclAs<CXXConstructorDecl>());
1361 E->setLocation(ReadSourceLocation());
1362 E->setElidable(Record.readInt());
1363 E->setHadMultipleCandidates(Record.readInt());
1364 E->setListInitialization(Record.readInt());
1365 E->setStdInitListInitialization(Record.readInt());
1366 E->setRequiresZeroInitialization(Record.readInt());
1367 E->setConstructionKind((CXXConstructExpr::ConstructionKind)Record.readInt());
1368 E->ParenOrBraceRange = ReadSourceRange();
1369}
1370
1371void ASTStmtReader::VisitCXXInheritedCtorInitExpr(CXXInheritedCtorInitExpr *E) {
1372 VisitExpr(E);
1373 E->Constructor = ReadDeclAs<CXXConstructorDecl>();
1374 E->Loc = ReadSourceLocation();
1375 E->ConstructsVirtualBase = Record.readInt();
1376 E->InheritedFromVirtualBase = Record.readInt();
1377}
1378
1379void ASTStmtReader::VisitCXXTemporaryObjectExpr(CXXTemporaryObjectExpr *E) {
1380 VisitCXXConstructExpr(E);
1381 E->Type = GetTypeSourceInfo();
1382}
1383
1384void ASTStmtReader::VisitLambdaExpr(LambdaExpr *E) {
1385 VisitExpr(E);
1386 unsigned NumCaptures = Record.readInt();
1387 assert(NumCaptures == E->NumCaptures)((NumCaptures == E->NumCaptures) ? static_cast<void>
(0) : __assert_fail ("NumCaptures == E->NumCaptures", "/build/llvm-toolchain-snapshot-8~svn348900/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 1387, __PRETTY_FUNCTION__))
;(void)NumCaptures;
1388 E->IntroducerRange = ReadSourceRange();
1389 E->CaptureDefault = static_cast<LambdaCaptureDefault>(Record.readInt());
1390 E->CaptureDefaultLoc = ReadSourceLocation();
1391 E->ExplicitParams = Record.readInt();
1392 E->ExplicitResultType = Record.readInt();
1393 E->ClosingBrace = ReadSourceLocation();
1394
1395 // Read capture initializers.
1396 for (LambdaExpr::capture_init_iterator C = E->capture_init_begin(),
1397 CEnd = E->capture_init_end();
1398 C != CEnd; ++C)
1399 *C = Record.readSubExpr();
1400}
1401
1402void
1403ASTStmtReader::VisitCXXStdInitializerListExpr(CXXStdInitializerListExpr *E) {
1404 VisitExpr(E);
1405 E->SubExpr = Record.readSubExpr();
1406}
1407
1408void ASTStmtReader::VisitCXXNamedCastExpr(CXXNamedCastExpr *E) {
1409 VisitExplicitCastExpr(E);
1410 SourceRange R = ReadSourceRange();
1411 E->Loc = R.getBegin();
1412 E->RParenLoc = R.getEnd();
1413 R = ReadSourceRange();
1414 E->AngleBrackets = R;
1415}
1416
1417void ASTStmtReader::VisitCXXStaticCastExpr(CXXStaticCastExpr *E) {
1418 return VisitCXXNamedCastExpr(E);
1419}
1420
1421void ASTStmtReader::VisitCXXDynamicCastExpr(CXXDynamicCastExpr *E) {
1422 return VisitCXXNamedCastExpr(E);
1423}
1424
1425void ASTStmtReader::VisitCXXReinterpretCastExpr(CXXReinterpretCastExpr *E) {
1426 return VisitCXXNamedCastExpr(E);
1427}
1428
1429void ASTStmtReader::VisitCXXConstCastExpr(CXXConstCastExpr *E) {
1430 return VisitCXXNamedCastExpr(E);
1431}
1432
1433void ASTStmtReader::VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr *E) {
1434 VisitExplicitCastExpr(E);
1435 E->setLParenLoc(ReadSourceLocation());
1436 E->setRParenLoc(ReadSourceLocation());
1437}
1438
1439void ASTStmtReader::VisitUserDefinedLiteral(UserDefinedLiteral *E) {
1440 VisitCallExpr(E);
1441 E->UDSuffixLoc = ReadSourceLocation();
1442}
1443
1444void ASTStmtReader::VisitCXXBoolLiteralExpr(CXXBoolLiteralExpr *E) {
1445 VisitExpr(E);
1446 E->setValue(Record.readInt());
1447 E->setLocation(ReadSourceLocation());
1448}
1449
1450void ASTStmtReader::VisitCXXNullPtrLiteralExpr(CXXNullPtrLiteralExpr *E) {
1451 VisitExpr(E);
1452 E->setLocation(ReadSourceLocation());
1453}
1454
1455void ASTStmtReader::VisitCXXTypeidExpr(CXXTypeidExpr *E) {
1456 VisitExpr(E);
1457 E->setSourceRange(ReadSourceRange());
1458 if (E->isTypeOperand()) { // typeid(int)
1459 E->setTypeOperandSourceInfo(
1460 GetTypeSourceInfo());
1461 return;
1462 }
1463
1464 // typeid(42+2)
1465 E->setExprOperand(Record.readSubExpr());
1466}
1467
1468void ASTStmtReader::VisitCXXThisExpr(CXXThisExpr *E) {
1469 VisitExpr(E);
1470 E->setLocation(ReadSourceLocation());
1471 E->setImplicit(Record.readInt());
1472}
1473
1474void ASTStmtReader::VisitCXXThrowExpr(CXXThrowExpr *E) {
1475 VisitExpr(E);
1476 E->CXXThrowExprBits.ThrowLoc = ReadSourceLocation();
1477 E->Operand = Record.readSubExpr();
1478 E->CXXThrowExprBits.IsThrownVariableInScope = Record.readInt();
1479}
1480
1481void ASTStmtReader::VisitCXXDefaultArgExpr(CXXDefaultArgExpr *E) {
1482 VisitExpr(E);
1483 E->Param = ReadDeclAs<ParmVarDecl>();
1484 E->CXXDefaultArgExprBits.Loc = ReadSourceLocation();
1485}
1486
1487void ASTStmtReader::VisitCXXDefaultInitExpr(CXXDefaultInitExpr *E) {
1488 VisitExpr(E);
1489 E->Field = ReadDeclAs<FieldDecl>();
1490 E->CXXDefaultInitExprBits.Loc = ReadSourceLocation();
1491}
1492
1493void ASTStmtReader::VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *E) {
1494 VisitExpr(E);
1495 E->setTemporary(Record.readCXXTemporary());
1496 E->setSubExpr(Record.readSubExpr());
1497}
1498
1499void ASTStmtReader::VisitCXXScalarValueInitExpr(CXXScalarValueInitExpr *E) {
1500 VisitExpr(E);
1501 E->TypeInfo = GetTypeSourceInfo();
1502 E->RParenLoc = ReadSourceLocation();
1503}
1504
1505void ASTStmtReader::VisitCXXNewExpr(CXXNewExpr *E) {
1506 VisitExpr(E);
1507 E->GlobalNew = Record.readInt();
1508 bool isArray = Record.readInt();
1509 E->PassAlignment = Record.readInt();
1510 E->UsualArrayDeleteWantsSize = Record.readInt();
1511 unsigned NumPlacementArgs = Record.readInt();
1512 E->StoredInitializationStyle = Record.readInt();
1513 E->setOperatorNew(ReadDeclAs<FunctionDecl>());
1514 E->setOperatorDelete(ReadDeclAs<FunctionDecl>());
1515 E->AllocatedTypeInfo = GetTypeSourceInfo();
1516 E->TypeIdParens = ReadSourceRange();
1517 E->Range = ReadSourceRange();
1518 E->DirectInitRange = ReadSourceRange();
1519
1520 E->AllocateArgsArray(Record.getContext(), isArray, NumPlacementArgs,
1521 E->StoredInitializationStyle != 0);
1522
1523 // Install all the subexpressions.
1524 for (CXXNewExpr::raw_arg_iterator I = E->raw_arg_begin(),e = E->raw_arg_end();
1525 I != e; ++I)
1526 *I = Record.readSubStmt();
1527}
1528
1529void ASTStmtReader::VisitCXXDeleteExpr(CXXDeleteExpr *E) {
1530 VisitExpr(E);
1531 E->CXXDeleteExprBits.GlobalDelete = Record.readInt();
1532 E->CXXDeleteExprBits.ArrayForm = Record.readInt();
1533 E->CXXDeleteExprBits.ArrayFormAsWritten = Record.readInt();
1534 E->CXXDeleteExprBits.UsualArrayDeleteWantsSize = Record.readInt();
1535 E->OperatorDelete = ReadDeclAs<FunctionDecl>();
1536 E->Argument = Record.readSubExpr();
1537 E->CXXDeleteExprBits.Loc = ReadSourceLocation();
1538}
1539
1540void ASTStmtReader::VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr *E) {
1541 VisitExpr(E);
1542
1543 E->Base = Record.readSubExpr();
1544 E->IsArrow = Record.readInt();
1545 E->OperatorLoc = ReadSourceLocation();
1546 E->QualifierLoc = Record.readNestedNameSpecifierLoc();
1547 E->ScopeType = GetTypeSourceInfo();
1548 E->ColonColonLoc = ReadSourceLocation();
1549 E->TildeLoc = ReadSourceLocation();
1550
1551 IdentifierInfo *II = Record.getIdentifierInfo();
1552 if (II)
1553 E->setDestroyedType(II, ReadSourceLocation());
1554 else
1555 E->setDestroyedType(GetTypeSourceInfo());
1556}
1557
1558void ASTStmtReader::VisitExprWithCleanups(ExprWithCleanups *E) {
1559 VisitExpr(E);
1560
1561 unsigned NumObjects = Record.readInt();
1562 assert(NumObjects == E->getNumObjects())((NumObjects == E->getNumObjects()) ? static_cast<void>
(0) : __assert_fail ("NumObjects == E->getNumObjects()", "/build/llvm-toolchain-snapshot-8~svn348900/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 1562, __PRETTY_FUNCTION__))
;
1563 for (unsigned i = 0; i != NumObjects; ++i)
1564 E->getTrailingObjects<BlockDecl *>()[i] =
1565 ReadDeclAs<BlockDecl>();
1566
1567 E->ExprWithCleanupsBits.CleanupsHaveSideEffects = Record.readInt();
1568 E->SubExpr = Record.readSubExpr();
1569}
1570
1571void
1572ASTStmtReader::VisitCXXDependentScopeMemberExpr(CXXDependentScopeMemberExpr *E){
1573 VisitExpr(E);
1574
1575 if (Record.readInt()) // HasTemplateKWAndArgsInfo
1576 ReadTemplateKWAndArgsInfo(
1577 *E->getTrailingObjects<ASTTemplateKWAndArgsInfo>(),
1578 E->getTrailingObjects<TemplateArgumentLoc>(),
1579 /*NumTemplateArgs=*/Record.readInt());
1580
1581 E->Base = Record.readSubExpr();
1582 E->BaseType = Record.readType();
1583 E->IsArrow = Record.readInt();
1584 E->OperatorLoc = ReadSourceLocation();
1585 E->QualifierLoc = Record.readNestedNameSpecifierLoc();
1586 E->FirstQualifierFoundInScope = ReadDeclAs<NamedDecl>();
1587 ReadDeclarationNameInfo(E->MemberNameInfo);
1588}
1589
1590void
1591ASTStmtReader::VisitDependentScopeDeclRefExpr(DependentScopeDeclRefExpr *E) {
1592 VisitExpr(E);
1593
1594 if (Record.readInt()) // HasTemplateKWAndArgsInfo
1595 ReadTemplateKWAndArgsInfo(
1596 *E->getTrailingObjects<ASTTemplateKWAndArgsInfo>(),
1597 E->getTrailingObjects<TemplateArgumentLoc>(),
1598 /*NumTemplateArgs=*/Record.readInt());
1599
1600 E->QualifierLoc = Record.readNestedNameSpecifierLoc();
1601 ReadDeclarationNameInfo(E->NameInfo);
1602}
1603
1604void
1605ASTStmtReader::VisitCXXUnresolvedConstructExpr(CXXUnresolvedConstructExpr *E) {
1606 VisitExpr(E);
1607 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~svn348900/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 1608, __PRETTY_FUNCTION__))
1608 "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~svn348900/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 1608, __PRETTY_FUNCTION__))
;
1609 Record.skipInts(1);
1610 for (unsigned I = 0, N = E->arg_size(); I != N; ++I)
1611 E->setArg(I, Record.readSubExpr());
1612 E->Type = GetTypeSourceInfo();
1613 E->setLParenLoc(ReadSourceLocation());
1614 E->setRParenLoc(ReadSourceLocation());
1615}
1616
1617void ASTStmtReader::VisitOverloadExpr(OverloadExpr *E) {
1618 VisitExpr(E);
1619
1620 if (Record.readInt()) // HasTemplateKWAndArgsInfo
1621 ReadTemplateKWAndArgsInfo(*E->getTrailingASTTemplateKWAndArgsInfo(),
1622 E->getTrailingTemplateArgumentLoc(),
1623 /*NumTemplateArgs=*/Record.readInt());
1624
1625 unsigned NumDecls = Record.readInt();
1626 UnresolvedSet<8> Decls;
1627 for (unsigned i = 0; i != NumDecls; ++i) {
1628 auto *D = ReadDeclAs<NamedDecl>();
1629 auto AS = (AccessSpecifier)Record.readInt();
1630 Decls.addDecl(D, AS);
1631 }
1632 E->initializeResults(Record.getContext(), Decls.begin(), Decls.end());
1633
1634 ReadDeclarationNameInfo(E->NameInfo);
1635 E->QualifierLoc = Record.readNestedNameSpecifierLoc();
1636}
1637
1638void ASTStmtReader::VisitUnresolvedMemberExpr(UnresolvedMemberExpr *E) {
1639 VisitOverloadExpr(E);
1640 E->IsArrow = Record.readInt();
1641 E->HasUnresolvedUsing = Record.readInt();
1642 E->Base = Record.readSubExpr();
1643 E->BaseType = Record.readType();
1644 E->OperatorLoc = ReadSourceLocation();
1645}
1646
1647void ASTStmtReader::VisitUnresolvedLookupExpr(UnresolvedLookupExpr *E) {
1648 VisitOverloadExpr(E);
1649 E->RequiresADL = Record.readInt();
1650 E->Overloaded = Record.readInt();
1651 E->NamingClass = ReadDeclAs<CXXRecordDecl>();
1652}
1653
1654void ASTStmtReader::VisitTypeTraitExpr(TypeTraitExpr *E) {
1655 VisitExpr(E);
1656 E->TypeTraitExprBits.NumArgs = Record.readInt();
1657 E->TypeTraitExprBits.Kind = Record.readInt();
1658 E->TypeTraitExprBits.Value = Record.readInt();
1659 SourceRange Range = ReadSourceRange();
1660 E->Loc = Range.getBegin();
1661 E->RParenLoc = Range.getEnd();
1662
1663 auto **Args = E->getTrailingObjects<TypeSourceInfo *>();
1664 for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
1665 Args[I] = GetTypeSourceInfo();
1666}
1667
1668void ASTStmtReader::VisitArrayTypeTraitExpr(ArrayTypeTraitExpr *E) {
1669 VisitExpr(E);
1670 E->ATT = (ArrayTypeTrait)Record.readInt();
1671 E->Value = (unsigned int)Record.readInt();
1672 SourceRange Range = ReadSourceRange();
1673 E->Loc = Range.getBegin();
1674 E->RParen = Range.getEnd();
1675 E->QueriedType = GetTypeSourceInfo();
1676 E->Dimension = Record.readSubExpr();
1677}
1678
1679void ASTStmtReader::VisitExpressionTraitExpr(ExpressionTraitExpr *E) {
1680 VisitExpr(E);
1681 E->ET = (ExpressionTrait)Record.readInt();
1682 E->Value = (bool)Record.readInt();
1683 SourceRange Range = ReadSourceRange();
1684 E->QueriedExpression = Record.readSubExpr();
1685 E->Loc = Range.getBegin();
1686 E->RParen = Range.getEnd();
1687}
1688
1689void ASTStmtReader::VisitCXXNoexceptExpr(CXXNoexceptExpr *E) {
1690 VisitExpr(E);
1691 E->Value = (bool)Record.readInt();
1692 E->Range = ReadSourceRange();
1693 E->Operand = Record.readSubExpr();
1694}
1695
1696void ASTStmtReader::VisitPackExpansionExpr(PackExpansionExpr *E) {
1697 VisitExpr(E);
1698 E->EllipsisLoc = ReadSourceLocation();
1699 E->NumExpansions = Record.readInt();
1700 E->Pattern = Record.readSubExpr();
1701}
1702
1703void ASTStmtReader::VisitSizeOfPackExpr(SizeOfPackExpr *E) {
1704 VisitExpr(E);
1705 unsigned NumPartialArgs = Record.readInt();
1706 E->OperatorLoc = ReadSourceLocation();
1707 E->PackLoc = ReadSourceLocation();
1708 E->RParenLoc = ReadSourceLocation();
1709 E->Pack = Record.readDeclAs<NamedDecl>();
1710 if (E->isPartiallySubstituted()) {
1711 assert(E->Length == NumPartialArgs)((E->Length == NumPartialArgs) ? static_cast<void> (
0) : __assert_fail ("E->Length == NumPartialArgs", "/build/llvm-toolchain-snapshot-8~svn348900/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 1711, __PRETTY_FUNCTION__))
;
1712 for (auto *I = E->getTrailingObjects<TemplateArgument>(),
1713 *E = I + NumPartialArgs;
1714 I != E; ++I)
1715 new (I) TemplateArgument(Record.readTemplateArgument());
1716 } else if (!E->isValueDependent()) {
1717 E->Length = Record.readInt();
1718 }
1719}
1720
1721void ASTStmtReader::VisitSubstNonTypeTemplateParmExpr(
1722 SubstNonTypeTemplateParmExpr *E) {
1723 VisitExpr(E);
1724 E->Param = ReadDeclAs<NonTypeTemplateParmDecl>();
1725 E->NameLoc = ReadSourceLocation();
1726 E->Replacement = Record.readSubExpr();
1727}
1728
1729void ASTStmtReader::VisitSubstNonTypeTemplateParmPackExpr(
1730 SubstNonTypeTemplateParmPackExpr *E) {
1731 VisitExpr(E);
1732 E->Param = ReadDeclAs<NonTypeTemplateParmDecl>();
1733 TemplateArgument ArgPack = Record.readTemplateArgument();
1734 if (ArgPack.getKind() != TemplateArgument::Pack)
1735 return;
1736
1737 E->Arguments = ArgPack.pack_begin();
1738 E->NumArguments = ArgPack.pack_size();
1739 E->NameLoc = ReadSourceLocation();
1740}
1741
1742void ASTStmtReader::VisitFunctionParmPackExpr(FunctionParmPackExpr *E) {
1743 VisitExpr(E);
1744 E->NumParameters = Record.readInt();
1745 E->ParamPack = ReadDeclAs<ParmVarDecl>();
1746 E->NameLoc = ReadSourceLocation();
1747 auto **Parms = E->getTrailingObjects<ParmVarDecl *>();
1748 for (unsigned i = 0, n = E->NumParameters; i != n; ++i)
1749 Parms[i] = ReadDeclAs<ParmVarDecl>();
1750}
1751
1752void ASTStmtReader::VisitMaterializeTemporaryExpr(MaterializeTemporaryExpr *E) {
1753 VisitExpr(E);
1754 E->State = Record.readSubExpr();
1755 auto *VD = ReadDeclAs<ValueDecl>();
1756 unsigned ManglingNumber = Record.readInt();
1757 E->setExtendingDecl(VD, ManglingNumber);
1758}
1759
1760void ASTStmtReader::VisitCXXFoldExpr(CXXFoldExpr *E) {
1761 VisitExpr(E);
1762 E->LParenLoc = ReadSourceLocation();
1763 E->EllipsisLoc = ReadSourceLocation();
1764 E->RParenLoc = ReadSourceLocation();
1765 E->SubExprs[0] = Record.readSubExpr();
1766 E->SubExprs[1] = Record.readSubExpr();
1767 E->Opcode = (BinaryOperatorKind)Record.readInt();
1768}
1769
1770void ASTStmtReader::VisitOpaqueValueExpr(OpaqueValueExpr *E) {
1771 VisitExpr(E);
1772 E->SourceExpr = Record.readSubExpr();
1773 E->Loc = ReadSourceLocation();
1774 E->setIsUnique(Record.readInt());
1775}
1776
1777void ASTStmtReader::VisitTypoExpr(TypoExpr *E) {
1778 llvm_unreachable("Cannot read TypoExpr nodes")::llvm::llvm_unreachable_internal("Cannot read TypoExpr nodes"
, "/build/llvm-toolchain-snapshot-8~svn348900/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 1778)
;
1779}
1780
1781//===----------------------------------------------------------------------===//
1782// Microsoft Expressions and Statements
1783//===----------------------------------------------------------------------===//
1784void ASTStmtReader::VisitMSPropertyRefExpr(MSPropertyRefExpr *E) {
1785 VisitExpr(E);
1786 E->IsArrow = (Record.readInt() != 0);
1787 E->BaseExpr = Record.readSubExpr();
1788 E->QualifierLoc = Record.readNestedNameSpecifierLoc();
1789 E->MemberLoc = ReadSourceLocation();
1790 E->TheDecl = ReadDeclAs<MSPropertyDecl>();
1791}
1792
1793void ASTStmtReader::VisitMSPropertySubscriptExpr(MSPropertySubscriptExpr *E) {
1794 VisitExpr(E);
1795 E->setBase(Record.readSubExpr());
1796 E->setIdx(Record.readSubExpr());
1797 E->setRBracketLoc(ReadSourceLocation());
1798}
1799
1800void ASTStmtReader::VisitCXXUuidofExpr(CXXUuidofExpr *E) {
1801 VisitExpr(E);
1802 E->setSourceRange(ReadSourceRange());
1803 std::string UuidStr = ReadString();
1804 E->setUuidStr(StringRef(UuidStr).copy(Record.getContext()));
1805 if (E->isTypeOperand()) { // __uuidof(ComType)
1806 E->setTypeOperandSourceInfo(
1807 GetTypeSourceInfo());
1808 return;
1809 }
1810
1811 // __uuidof(expr)
1812 E->setExprOperand(Record.readSubExpr());
1813}
1814
1815void ASTStmtReader::VisitSEHLeaveStmt(SEHLeaveStmt *S) {
1816 VisitStmt(S);
1817 S->setLeaveLoc(ReadSourceLocation());
1818}
1819
1820void ASTStmtReader::VisitSEHExceptStmt(SEHExceptStmt *S) {
1821 VisitStmt(S);
1822 S->Loc = ReadSourceLocation();
1823 S->Children[SEHExceptStmt::FILTER_EXPR] = Record.readSubStmt();
1824 S->Children[SEHExceptStmt::BLOCK] = Record.readSubStmt();
1825}
1826
1827void ASTStmtReader::VisitSEHFinallyStmt(SEHFinallyStmt *S) {
1828 VisitStmt(S);
1829 S->Loc = ReadSourceLocation();
1830 S->Block = Record.readSubStmt();
1831}
1832
1833void ASTStmtReader::VisitSEHTryStmt(SEHTryStmt *S) {
1834 VisitStmt(S);
1835 S->IsCXXTry = Record.readInt();
1836 S->TryLoc = ReadSourceLocation();
1837 S->Children[SEHTryStmt::TRY] = Record.readSubStmt();
1838 S->Children[SEHTryStmt::HANDLER] = Record.readSubStmt();
1839}
1840
1841//===----------------------------------------------------------------------===//
1842// CUDA Expressions and Statements
1843//===----------------------------------------------------------------------===//
1844
1845void ASTStmtReader::VisitCUDAKernelCallExpr(CUDAKernelCallExpr *E) {
1846 VisitCallExpr(E);
1847 E->setConfig(cast<CallExpr>(Record.readSubExpr()));
1848}
1849
1850//===----------------------------------------------------------------------===//
1851// OpenCL Expressions and Statements.
1852//===----------------------------------------------------------------------===//
1853void ASTStmtReader::VisitAsTypeExpr(AsTypeExpr *E) {
1854 VisitExpr(E);
1855 E->BuiltinLoc = ReadSourceLocation();
1856 E->RParenLoc = ReadSourceLocation();
1857 E->SrcExpr = Record.readSubExpr();
1858}
1859
1860//===----------------------------------------------------------------------===//
1861// OpenMP Directives.
1862//===----------------------------------------------------------------------===//
1863
1864void ASTStmtReader::VisitOMPExecutableDirective(OMPExecutableDirective *E) {
1865 E->setLocStart(ReadSourceLocation());
1866 E->setLocEnd(ReadSourceLocation());
1867 OMPClauseReader ClauseReader(Record);
1868 SmallVector<OMPClause *, 5> Clauses;
1869 for (unsigned i = 0; i < E->getNumClauses(); ++i)
1870 Clauses.push_back(ClauseReader.readClause());
1871 E->setClauses(Clauses);
1872 if (E->hasAssociatedStmt())
1873 E->setAssociatedStmt(Record.readSubStmt());
1874}
1875
1876void ASTStmtReader::VisitOMPLoopDirective(OMPLoopDirective *D) {
1877 VisitStmt(D);
1878 // Two fields (NumClauses and CollapsedNum) were read in ReadStmtFromStream.
1879 Record.skipInts(2);
1880 VisitOMPExecutableDirective(D);
1881 D->setIterationVariable(Record.readSubExpr());
1882 D->setLastIteration(Record.readSubExpr());
1883 D->setCalcLastIteration(Record.readSubExpr());
1884 D->setPreCond(Record.readSubExpr());
1885 D->setCond(Record.readSubExpr());
1886 D->setInit(Record.readSubExpr());
1887 D->setInc(Record.readSubExpr());
1888 D->setPreInits(Record.readSubStmt());
1889 if (isOpenMPWorksharingDirective(D->getDirectiveKind()) ||
1890 isOpenMPTaskLoopDirective(D->getDirectiveKind()) ||
1891 isOpenMPDistributeDirective(D->getDirectiveKind())) {
1892 D->setIsLastIterVariable(Record.readSubExpr());
1893 D->setLowerBoundVariable(Record.readSubExpr());
1894 D->setUpperBoundVariable(Record.readSubExpr());
1895 D->setStrideVariable(Record.readSubExpr());
1896 D->setEnsureUpperBound(Record.readSubExpr());
1897 D->setNextLowerBound(Record.readSubExpr());
1898 D->setNextUpperBound(Record.readSubExpr());
1899 D->setNumIterations(Record.readSubExpr());
1900 }
1901 if (isOpenMPLoopBoundSharingDirective(D->getDirectiveKind())) {
1902 D->setPrevLowerBoundVariable(Record.readSubExpr());
1903 D->setPrevUpperBoundVariable(Record.readSubExpr());
1904 D->setDistInc(Record.readSubExpr());
1905 D->setPrevEnsureUpperBound(Record.readSubExpr());
1906 D->setCombinedLowerBoundVariable(Record.readSubExpr());
1907 D->setCombinedUpperBoundVariable(Record.readSubExpr());
1908 D->setCombinedEnsureUpperBound(Record.readSubExpr());
1909 D->setCombinedInit(Record.readSubExpr());
1910 D->setCombinedCond(Record.readSubExpr());
1911 D->setCombinedNextLowerBound(Record.readSubExpr());
1912 D->setCombinedNextUpperBound(Record.readSubExpr());
1913 D->setCombinedDistCond(Record.readSubExpr());
1914 D->setCombinedParForInDistCond(Record.readSubExpr());
1915 }
1916 SmallVector<Expr *, 4> Sub;
1917 unsigned CollapsedNum = D->getCollapsedNumber();
1918 Sub.reserve(CollapsedNum);
1919 for (unsigned i = 0; i < CollapsedNum; ++i)
1920 Sub.push_back(Record.readSubExpr());
1921 D->setCounters(Sub);
1922 Sub.clear();
1923 for (unsigned i = 0; i < CollapsedNum; ++i)
1924 Sub.push_back(Record.readSubExpr());
1925 D->setPrivateCounters(Sub);
1926 Sub.clear();
1927 for (unsigned i = 0; i < CollapsedNum; ++i)
1928 Sub.push_back(Record.readSubExpr());
1929 D->setInits(Sub);
1930 Sub.clear();
1931 for (unsigned i = 0; i < CollapsedNum; ++i)
1932 Sub.push_back(Record.readSubExpr());
1933 D->setUpdates(Sub);
1934 Sub.clear();
1935 for (unsigned i = 0; i < CollapsedNum; ++i)
1936 Sub.push_back(Record.readSubExpr());
1937 D->setFinals(Sub);
1938}
1939
1940void ASTStmtReader::VisitOMPParallelDirective(OMPParallelDirective *D) {
1941 VisitStmt(D);
1942 // The NumClauses field was read in ReadStmtFromStream.
1943 Record.skipInts(1);
1944 VisitOMPExecutableDirective(D);
1945 D->setHasCancel(Record.readInt());
1946}
1947
1948void ASTStmtReader::VisitOMPSimdDirective(OMPSimdDirective *D) {
1949 VisitOMPLoopDirective(D);
1950}
1951
1952void ASTStmtReader::VisitOMPForDirective(OMPForDirective *D) {
1953 VisitOMPLoopDirective(D);
1954 D->setHasCancel(Record.readInt());
1955}
1956
1957void ASTStmtReader::VisitOMPForSimdDirective(OMPForSimdDirective *D) {
1958 VisitOMPLoopDirective(D);
1959}
1960
1961void ASTStmtReader::VisitOMPSectionsDirective(OMPSectionsDirective *D) {
1962 VisitStmt(D);
1963 // The NumClauses field was read in ReadStmtFromStream.
1964 Record.skipInts(1);
1965 VisitOMPExecutableDirective(D);
1966 D->setHasCancel(Record.readInt());
1967}
1968
1969void ASTStmtReader::VisitOMPSectionDirective(OMPSectionDirective *D) {
1970 VisitStmt(D);
1971 VisitOMPExecutableDirective(D);
1972 D->setHasCancel(Record.readInt());
1973}
1974
1975void ASTStmtReader::VisitOMPSingleDirective(OMPSingleDirective *D) {
1976 VisitStmt(D);
1977 // The NumClauses field was read in ReadStmtFromStream.
1978 Record.skipInts(1);
1979 VisitOMPExecutableDirective(D);
1980}
1981
1982void ASTStmtReader::VisitOMPMasterDirective(OMPMasterDirective *D) {
1983 VisitStmt(D);
1984 VisitOMPExecutableDirective(D);
1985}
1986
1987void ASTStmtReader::VisitOMPCriticalDirective(OMPCriticalDirective *D) {
1988 VisitStmt(D);
1989 // The NumClauses field was read in ReadStmtFromStream.
1990 Record.skipInts(1);
1991 VisitOMPExecutableDirective(D);
1992 ReadDeclarationNameInfo(D->DirName);
1993}
1994
1995void ASTStmtReader::VisitOMPParallelForDirective(OMPParallelForDirective *D) {
1996 VisitOMPLoopDirective(D);
1997 D->setHasCancel(Record.readInt());
1998}
1999
2000void ASTStmtReader::VisitOMPParallelForSimdDirective(
2001 OMPParallelForSimdDirective *D) {
2002 VisitOMPLoopDirective(D);
2003}
2004
2005void ASTStmtReader::VisitOMPParallelSectionsDirective(
2006 OMPParallelSectionsDirective *D) {
2007 VisitStmt(D);
2008 // The NumClauses field was read in ReadStmtFromStream.
2009 Record.skipInts(1);
2010 VisitOMPExecutableDirective(D);
2011 D->setHasCancel(Record.readInt());
2012}
2013
2014void ASTStmtReader::VisitOMPTaskDirective(OMPTaskDirective *D) {
2015 VisitStmt(D);
2016 // The NumClauses field was read in ReadStmtFromStream.
2017 Record.skipInts(1);
2018 VisitOMPExecutableDirective(D);
2019 D->setHasCancel(Record.readInt());
2020}
2021
2022void ASTStmtReader::VisitOMPTaskyieldDirective(OMPTaskyieldDirective *D) {
2023 VisitStmt(D);
2024 VisitOMPExecutableDirective(D);
2025}
2026
2027void ASTStmtReader::VisitOMPBarrierDirective(OMPBarrierDirective *D) {
2028 VisitStmt(D);
2029 VisitOMPExecutableDirective(D);
2030}
2031
2032void ASTStmtReader::VisitOMPTaskwaitDirective(OMPTaskwaitDirective *D) {
2033 VisitStmt(D);
2034 VisitOMPExecutableDirective(D);
2035}
2036
2037void ASTStmtReader::VisitOMPTaskgroupDirective(OMPTaskgroupDirective *D) {
2038 VisitStmt(D);
2039 // The NumClauses field was read in ReadStmtFromStream.
2040 Record.skipInts(1);
2041 VisitOMPExecutableDirective(D);
2042 D->setReductionRef(Record.readSubExpr());
2043}
2044
2045void ASTStmtReader::VisitOMPFlushDirective(OMPFlushDirective *D) {
2046 VisitStmt(D);
2047 // The NumClauses field was read in ReadStmtFromStream.
2048 Record.skipInts(1);
2049 VisitOMPExecutableDirective(D);
2050}
2051
2052void ASTStmtReader::VisitOMPOrderedDirective(OMPOrderedDirective *D) {
2053 VisitStmt(D);
2054 // The NumClauses field was read in ReadStmtFromStream.
2055 Record.skipInts(1);
2056 VisitOMPExecutableDirective(D);
2057}
2058
2059void ASTStmtReader::VisitOMPAtomicDirective(OMPAtomicDirective *D) {
2060 VisitStmt(D);
2061 // The NumClauses field was read in ReadStmtFromStream.
2062 Record.skipInts(1);
2063 VisitOMPExecutableDirective(D);
2064 D->setX(Record.readSubExpr());
2065 D->setV(Record.readSubExpr());
2066 D->setExpr(Record.readSubExpr());
2067 D->setUpdateExpr(Record.readSubExpr());
2068 D->IsXLHSInRHSPart = Record.readInt() != 0;
2069 D->IsPostfixUpdate = Record.readInt() != 0;
2070}
2071
2072void ASTStmtReader::VisitOMPTargetDirective(OMPTargetDirective *D) {
2073 VisitStmt(D);
2074 // The NumClauses field was read in ReadStmtFromStream.
2075 Record.skipInts(1);
2076 VisitOMPExecutableDirective(D);
2077}
2078
2079void ASTStmtReader::VisitOMPTargetDataDirective(OMPTargetDataDirective *D) {
2080 VisitStmt(D);
2081 Record.skipInts(1);
2082 VisitOMPExecutableDirective(D);
2083}
2084
2085void ASTStmtReader::VisitOMPTargetEnterDataDirective(
2086 OMPTargetEnterDataDirective *D) {
2087 VisitStmt(D);
2088 Record.skipInts(1);
2089 VisitOMPExecutableDirective(D);
2090}
2091
2092void ASTStmtReader::VisitOMPTargetExitDataDirective(
2093 OMPTargetExitDataDirective *D) {
2094 VisitStmt(D);
2095 Record.skipInts(1);
2096 VisitOMPExecutableDirective(D);
2097}
2098
2099void ASTStmtReader::VisitOMPTargetParallelDirective(
2100 OMPTargetParallelDirective *D) {
2101 VisitStmt(D);
2102 Record.skipInts(1);
2103 VisitOMPExecutableDirective(D);
2104}
2105
2106void ASTStmtReader::VisitOMPTargetParallelForDirective(
2107 OMPTargetParallelForDirective *D) {
2108 VisitOMPLoopDirective(D);
2109 D->setHasCancel(Record.readInt());
2110}
2111
2112void ASTStmtReader::VisitOMPTeamsDirective(OMPTeamsDirective *D) {
2113 VisitStmt(D);
2114 // The NumClauses field was read in ReadStmtFromStream.
2115 Record.skipInts(1);
2116 VisitOMPExecutableDirective(D);
2117}
2118
2119void ASTStmtReader::VisitOMPCancellationPointDirective(
2120 OMPCancellationPointDirective *D) {
2121 VisitStmt(D);
2122 VisitOMPExecutableDirective(D);
2123 D->setCancelRegion(static_cast<OpenMPDirectiveKind>(Record.readInt()));
2124}
2125
2126void ASTStmtReader::VisitOMPCancelDirective(OMPCancelDirective *D) {
2127 VisitStmt(D);
2128 // The NumClauses field was read in ReadStmtFromStream.
2129 Record.skipInts(1);
2130 VisitOMPExecutableDirective(D);
2131 D->setCancelRegion(static_cast<OpenMPDirectiveKind>(Record.readInt()));
2132}
2133
2134void ASTStmtReader::VisitOMPTaskLoopDirective(OMPTaskLoopDirective *D) {
2135 VisitOMPLoopDirective(D);
2136}
2137
2138void ASTStmtReader::VisitOMPTaskLoopSimdDirective(OMPTaskLoopSimdDirective *D) {
2139 VisitOMPLoopDirective(D);
2140}
2141
2142void ASTStmtReader::VisitOMPDistributeDirective(OMPDistributeDirective *D) {
2143 VisitOMPLoopDirective(D);
2144}
2145
2146void ASTStmtReader::VisitOMPTargetUpdateDirective(OMPTargetUpdateDirective *D) {
2147 VisitStmt(D);
2148 Record.skipInts(1);
2149 VisitOMPExecutableDirective(D);
2150}
2151
2152void ASTStmtReader::VisitOMPDistributeParallelForDirective(
2153 OMPDistributeParallelForDirective *D) {
2154 VisitOMPLoopDirective(D);
2155 D->setHasCancel(Record.readInt());
2156}
2157
2158void ASTStmtReader::VisitOMPDistributeParallelForSimdDirective(
2159 OMPDistributeParallelForSimdDirective *D) {
2160 VisitOMPLoopDirective(D);
2161}
2162
2163void ASTStmtReader::VisitOMPDistributeSimdDirective(
2164 OMPDistributeSimdDirective *D) {
2165 VisitOMPLoopDirective(D);
2166}
2167
2168void ASTStmtReader::VisitOMPTargetParallelForSimdDirective(
2169 OMPTargetParallelForSimdDirective *D) {
2170 VisitOMPLoopDirective(D);
2171}
2172
2173void ASTStmtReader::VisitOMPTargetSimdDirective(OMPTargetSimdDirective *D) {
2174 VisitOMPLoopDirective(D);
2175}
2176
2177void ASTStmtReader::VisitOMPTeamsDistributeDirective(
2178 OMPTeamsDistributeDirective *D) {
2179 VisitOMPLoopDirective(D);
2180}
2181
2182void ASTStmtReader::VisitOMPTeamsDistributeSimdDirective(
2183 OMPTeamsDistributeSimdDirective *D) {
2184 VisitOMPLoopDirective(D);
2185}
2186
2187void ASTStmtReader::VisitOMPTeamsDistributeParallelForSimdDirective(
2188 OMPTeamsDistributeParallelForSimdDirective *D) {
2189 VisitOMPLoopDirective(D);
2190}
2191
2192void ASTStmtReader::VisitOMPTeamsDistributeParallelForDirective(
2193 OMPTeamsDistributeParallelForDirective *D) {
2194 VisitOMPLoopDirective(D);
2195 D->setHasCancel(Record.readInt());
2196}
2197
2198void ASTStmtReader::VisitOMPTargetTeamsDirective(OMPTargetTeamsDirective *D) {
2199 VisitStmt(D);
2200 // The NumClauses field was read in ReadStmtFromStream.
2201 Record.skipInts(1);
2202 VisitOMPExecutableDirective(D);
2203}
2204
2205void ASTStmtReader::VisitOMPTargetTeamsDistributeDirective(
2206 OMPTargetTeamsDistributeDirective *D) {
2207 VisitOMPLoopDirective(D);
2208}
2209
2210void ASTStmtReader::VisitOMPTargetTeamsDistributeParallelForDirective(
2211 OMPTargetTeamsDistributeParallelForDirective *D) {
2212 VisitOMPLoopDirective(D);
2213 D->setHasCancel(Record.readInt());
2214}
2215
2216void ASTStmtReader::VisitOMPTargetTeamsDistributeParallelForSimdDirective(
2217 OMPTargetTeamsDistributeParallelForSimdDirective *D) {
2218 VisitOMPLoopDirective(D);
2219}
2220
2221void ASTStmtReader::VisitOMPTargetTeamsDistributeSimdDirective(
2222 OMPTargetTeamsDistributeSimdDirective *D) {
2223 VisitOMPLoopDirective(D);
2224}
2225
2226//===----------------------------------------------------------------------===//
2227// ASTReader Implementation
2228//===----------------------------------------------------------------------===//
2229
2230Stmt *ASTReader::ReadStmt(ModuleFile &F) {
2231 switch (ReadingKind) {
2232 case Read_None:
2233 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~svn348900/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 2233)
;
2234 case Read_Decl:
2235 case Read_Type:
2236 return ReadStmtFromStream(F);
2237 case Read_Stmt:
2238 return ReadSubStmt();
2239 }
2240
2241 llvm_unreachable("ReadingKind not set ?")::llvm::llvm_unreachable_internal("ReadingKind not set ?", "/build/llvm-toolchain-snapshot-8~svn348900/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 2241)
;
2242}
2243
2244Expr *ASTReader::ReadExpr(ModuleFile &F) {
2245 return cast_or_null<Expr>(ReadStmt(F));
2246}
2247
2248Expr *ASTReader::ReadSubExpr() {
2249 return cast_or_null<Expr>(ReadSubStmt());
2250}
2251
2252// Within the bitstream, expressions are stored in Reverse Polish
2253// Notation, with each of the subexpressions preceding the
2254// expression they are stored in. Subexpressions are stored from last to first.
2255// To evaluate expressions, we continue reading expressions and placing them on
2256// the stack, with expressions having operands removing those operands from the
2257// stack. Evaluation terminates when we see a STMT_STOP record, and
2258// the single remaining expression on the stack is our result.
2259Stmt *ASTReader::ReadStmtFromStream(ModuleFile &F) {
2260 ReadingKindTracker ReadingKind(Read_Stmt, *this);
2261 llvm::BitstreamCursor &Cursor = F.DeclsCursor;
2262
2263 // Map of offset to previously deserialized stmt. The offset points
2264 // just after the stmt record.
2265 llvm::DenseMap<uint64_t, Stmt *> StmtEntries;
2266
2267#ifndef NDEBUG
2268 unsigned PrevNumStmts = StmtStack.size();
2269#endif
2270
2271 ASTRecordReader Record(*this, F);
2272 ASTStmtReader Reader(Record, Cursor);
2273 Stmt::EmptyShell Empty;
2274
2275 while (true) {
2276 llvm::BitstreamEntry Entry = Cursor.advanceSkippingSubblocks();
2277
2278 switch (Entry.Kind) {
2279 case llvm::BitstreamEntry::SubBlock: // Handled for us already.
2280 case llvm::BitstreamEntry::Error:
2281 Error("malformed block record in AST file");
2282 return nullptr;
2283 case llvm::BitstreamEntry::EndBlock:
2284 goto Done;
2285 case llvm::BitstreamEntry::Record:
2286 // The interesting case.
2287 break;
2288 }
2289
2290 ASTContext &Context = getContext();
2291 Stmt *S = nullptr;
2292 bool Finished = false;
2293 bool IsStmtReference = false;
2294 switch ((StmtCode)Record.readRecord(Cursor, Entry.ID)) {
2295 case STMT_STOP:
2296 Finished = true;
2297 break;
2298
2299 case STMT_REF_PTR:
2300 IsStmtReference = true;
2301 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~svn348900/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 2302, __PRETTY_FUNCTION__))
2302 "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~svn348900/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 2302, __PRETTY_FUNCTION__))
;
2303 S = StmtEntries[Record.readInt()];
2304 break;
2305
2306 case STMT_NULL_PTR:
2307 S = nullptr;
2308 break;
2309
2310 case STMT_NULL:
2311 S = new (Context) NullStmt(Empty);
2312 break;
2313
2314 case STMT_COMPOUND:
2315 S = CompoundStmt::CreateEmpty(
2316 Context, /*NumStmts=*/Record[ASTStmtReader::NumStmtFields]);
2317 break;
2318
2319 case STMT_CASE:
2320 S = CaseStmt::CreateEmpty(
2321 Context,
2322 /*CaseStmtIsGNURange*/ Record[ASTStmtReader::NumStmtFields + 3]);
2323 break;
2324
2325 case STMT_DEFAULT:
2326 S = new (Context) DefaultStmt(Empty);
2327 break;
2328
2329 case STMT_LABEL:
2330 S = new (Context) LabelStmt(Empty);
2331 break;
2332
2333 case STMT_ATTRIBUTED:
2334 S = AttributedStmt::CreateEmpty(
2335 Context,
2336 /*NumAttrs*/Record[ASTStmtReader::NumStmtFields]);
2337 break;
2338
2339 case STMT_IF:
2340 S = IfStmt::CreateEmpty(
2341 Context,
2342 /* HasElse=*/Record[ASTStmtReader::NumStmtFields + 1],
2343 /* HasVar=*/Record[ASTStmtReader::NumStmtFields + 2],
2344 /* HasInit=*/Record[ASTStmtReader::NumStmtFields + 3]);
2345 break;
2346
2347 case STMT_SWITCH:
2348 S = SwitchStmt::CreateEmpty(
2349 Context,
2350 /* HasInit=*/Record[ASTStmtReader::NumStmtFields],
2351 /* HasVar=*/Record[ASTStmtReader::NumStmtFields + 1]);
2352 break;
2353
2354 case STMT_WHILE:
2355 S = WhileStmt::CreateEmpty(
2356 Context,
2357 /* HasVar=*/Record[ASTStmtReader::NumStmtFields]);
2358 break;
2359
2360 case STMT_DO:
2361 S = new (Context) DoStmt(Empty);
2362 break;
2363
2364 case STMT_FOR:
2365 S = new (Context) ForStmt(Empty);
2366 break;
2367
2368 case STMT_GOTO:
2369 S = new (Context) GotoStmt(Empty);
2370 break;
2371
2372 case STMT_INDIRECT_GOTO:
2373 S = new (Context) IndirectGotoStmt(Empty);
2374 break;
2375
2376 case STMT_CONTINUE:
2377 S = new (Context) ContinueStmt(Empty);
2378 break;
2379
2380 case STMT_BREAK:
2381 S = new (Context) BreakStmt(Empty);
2382 break;
2383
2384 case STMT_RETURN:
2385 S = ReturnStmt::CreateEmpty(
2386 Context, /* HasNRVOCandidate=*/Record[ASTStmtReader::NumStmtFields]);
2387 break;
2388
2389 case STMT_DECL:
2390 S = new (Context) DeclStmt(Empty);
2391 break;
2392
2393 case STMT_GCCASM:
2394 S = new (Context) GCCAsmStmt(Empty);
2395 break;
2396
2397 case STMT_MSASM:
2398 S = new (Context) MSAsmStmt(Empty);
2399 break;
2400
2401 case STMT_CAPTURED:
2402 S = CapturedStmt::CreateDeserialized(
2403 Context, Record[ASTStmtReader::NumStmtFields]);
2404 break;
2405
2406 case EXPR_CONSTANT:
2407 S = new (Context) ConstantExpr(Empty);
2408 break;
2409
2410 case EXPR_PREDEFINED:
2411 S = PredefinedExpr::CreateEmpty(
2412 Context,
2413 /*HasFunctionName*/ Record[ASTStmtReader::NumExprFields]);
2414 break;
2415
2416 case EXPR_DECL_REF:
2417 S = DeclRefExpr::CreateEmpty(
2418 Context,
2419 /*HasQualifier=*/Record[ASTStmtReader::NumExprFields],
2420 /*HasFoundDecl=*/Record[ASTStmtReader::NumExprFields + 1],
2421 /*HasTemplateKWAndArgsInfo=*/Record[ASTStmtReader::NumExprFields + 2],
2422 /*NumTemplateArgs=*/Record[ASTStmtReader::NumExprFields + 2] ?
2423 Record[ASTStmtReader::NumExprFields + 5] : 0);
2424 break;
2425
2426 case EXPR_INTEGER_LITERAL:
2427 S = IntegerLiteral::Create(Context, Empty);
2428 break;
2429
2430 case EXPR_FLOATING_LITERAL:
2431 S = FloatingLiteral::Create(Context, Empty);
2432 break;
2433
2434 case EXPR_IMAGINARY_LITERAL:
2435 S = new (Context) ImaginaryLiteral(Empty);
2436 break;
2437
2438 case EXPR_STRING_LITERAL:
2439 S = StringLiteral::CreateEmpty(
2440 Context,
2441 /* NumConcatenated=*/Record[ASTStmtReader::NumExprFields],
2442 /* Length=*/Record[ASTStmtReader::NumExprFields + 1],
2443 /* CharByteWidth=*/Record[ASTStmtReader::NumExprFields + 2]);
2444 break;
2445
2446 case EXPR_CHARACTER_LITERAL:
2447 S = new (Context) CharacterLiteral(Empty);
2448 break;
2449
2450 case EXPR_PAREN:
2451 S = new (Context) ParenExpr(Empty);
2452 break;
2453
2454 case EXPR_PAREN_LIST:
2455 S = ParenListExpr::CreateEmpty(
2456 Context,
2457 /* NumExprs=*/Record[ASTStmtReader::NumExprFields]);
2458 break;
2459
2460 case EXPR_UNARY_OPERATOR:
2461 S = new (Context) UnaryOperator(Empty);
2462 break;
2463
2464 case EXPR_OFFSETOF:
2465 S = OffsetOfExpr::CreateEmpty(Context,
2466 Record[ASTStmtReader::NumExprFields],
2467 Record[ASTStmtReader::NumExprFields + 1]);
2468 break;
2469
2470 case EXPR_SIZEOF_ALIGN_OF:
2471 S = new (Context) UnaryExprOrTypeTraitExpr(Empty);
2472 break;
2473
2474 case EXPR_ARRAY_SUBSCRIPT:
2475 S = new (Context) ArraySubscriptExpr(Empty);
2476 break;
2477
2478 case EXPR_OMP_ARRAY_SECTION:
2479 S = new (Context) OMPArraySectionExpr(Empty);
2480 break;
2481
2482 case EXPR_CALL:
2483 S = new (Context) CallExpr(
2484 Context, /* NumArgs=*/Record[ASTStmtReader::NumExprFields],
2485 Empty);
2486 break;
2487
2488 case EXPR_MEMBER: {
2489 // We load everything here and fully initialize it at creation.
2490 // That way we can use MemberExpr::Create and don't have to duplicate its
2491 // logic with a MemberExpr::CreateEmpty.
2492
2493 assert(Record.getIdx() == 0)((Record.getIdx() == 0) ? static_cast<void> (0) : __assert_fail
("Record.getIdx() == 0", "/build/llvm-toolchain-snapshot-8~svn348900/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 2493, __PRETTY_FUNCTION__))
;
2494 NestedNameSpecifierLoc QualifierLoc;
2495 if (Record.readInt()) { // HasQualifier.
2496 QualifierLoc = Record.readNestedNameSpecifierLoc();
2497 }
2498
2499 SourceLocation TemplateKWLoc;
2500 TemplateArgumentListInfo ArgInfo;
2501 bool HasTemplateKWAndArgsInfo = Record.readInt();
2502 if (HasTemplateKWAndArgsInfo) {
2503 TemplateKWLoc = Record.readSourceLocation();
2504 unsigned NumTemplateArgs = Record.readInt();
2505 ArgInfo.setLAngleLoc(Record.readSourceLocation());
2506 ArgInfo.setRAngleLoc(Record.readSourceLocation());
2507 for (unsigned i = 0; i != NumTemplateArgs; ++i)
2508 ArgInfo.addArgument(Record.readTemplateArgumentLoc());
2509 }
2510
2511 bool HadMultipleCandidates = Record.readInt();
2512
2513 auto *FoundD = Record.readDeclAs<NamedDecl>();
2514 auto AS = (AccessSpecifier)Record.readInt();
2515 DeclAccessPair FoundDecl = DeclAccessPair::make(FoundD, AS);
2516
2517 QualType T = Record.readType();
2518 auto VK = static_cast<ExprValueKind>(Record.readInt());
2519 auto OK = static_cast<ExprObjectKind>(Record.readInt());
2520 Expr *Base = ReadSubExpr();
2521 auto *MemberD = Record.readDeclAs<ValueDecl>();
2522 SourceLocation MemberLoc = Record.readSourceLocation();
2523 DeclarationNameInfo MemberNameInfo(MemberD->getDeclName(), MemberLoc);
2524 bool IsArrow = Record.readInt();
2525 SourceLocation OperatorLoc = Record.readSourceLocation();
2526
2527 S = MemberExpr::Create(Context, Base, IsArrow, OperatorLoc, QualifierLoc,
2528 TemplateKWLoc, MemberD, FoundDecl, MemberNameInfo,
2529 HasTemplateKWAndArgsInfo ? &ArgInfo : nullptr, T,
2530 VK, OK);
2531 Record.readDeclarationNameLoc(cast<MemberExpr>(S)->MemberDNLoc,
2532 MemberD->getDeclName());
2533 if (HadMultipleCandidates)
2534 cast<MemberExpr>(S)->setHadMultipleCandidates(true);
2535 break;
2536 }
2537
2538 case EXPR_BINARY_OPERATOR:
2539 S = new (Context) BinaryOperator(Empty);
2540 break;
2541
2542 case EXPR_COMPOUND_ASSIGN_OPERATOR:
2543 S = new (Context) CompoundAssignOperator(Empty);
2544 break;
2545
2546 case EXPR_CONDITIONAL_OPERATOR:
2547 S = new (Context) ConditionalOperator(Empty);
2548 break;
2549
2550 case EXPR_BINARY_CONDITIONAL_OPERATOR:
2551 S = new (Context) BinaryConditionalOperator(Empty);
2552 break;
2553
2554 case EXPR_IMPLICIT_CAST:
2555 S = ImplicitCastExpr::CreateEmpty(Context,
2556 /*PathSize*/ Record[ASTStmtReader::NumExprFields]);
2557 break;
2558
2559 case EXPR_CSTYLE_CAST:
2560 S = CStyleCastExpr::CreateEmpty(Context,
2561 /*PathSize*/ Record[ASTStmtReader::NumExprFields]);
2562 break;
2563
2564 case EXPR_COMPOUND_LITERAL:
2565 S = new (Context) CompoundLiteralExpr(Empty);
2566 break;
2567
2568 case EXPR_EXT_VECTOR_ELEMENT:
2569 S = new (Context) ExtVectorElementExpr(Empty);
2570 break;
2571
2572 case EXPR_INIT_LIST:
2573 S = new (Context) InitListExpr(Empty);
2574 break;
2575
2576 case EXPR_DESIGNATED_INIT:
2577 S = DesignatedInitExpr::CreateEmpty(Context,
2578 Record[ASTStmtReader::NumExprFields] - 1);
2579
2580 break;
2581
2582 case EXPR_DESIGNATED_INIT_UPDATE:
2583 S = new (Context) DesignatedInitUpdateExpr(Empty);
2584 break;
2585
2586 case EXPR_IMPLICIT_VALUE_INIT:
2587 S = new (Context) ImplicitValueInitExpr(Empty);
2588 break;
2589
2590 case EXPR_NO_INIT:
2591 S = new (Context) NoInitExpr(Empty);
2592 break;
2593
2594 case EXPR_ARRAY_INIT_LOOP:
2595 S = new (Context) ArrayInitLoopExpr(Empty);
2596 break;
2597
2598 case EXPR_ARRAY_INIT_INDEX:
2599 S = new (Context) ArrayInitIndexExpr(Empty);
2600 break;
2601
2602 case EXPR_VA_ARG:
2603 S = new (Context) VAArgExpr(Empty);
2604 break;
2605
2606 case EXPR_ADDR_LABEL:
2607 S = new (Context) AddrLabelExpr(Empty);
2608 break;
2609
2610 case EXPR_STMT:
2611 S = new (Context) StmtExpr(Empty);
2612 break;
2613
2614 case EXPR_CHOOSE:
2615 S = new (Context) ChooseExpr(Empty);
2616 break;
2617
2618 case EXPR_GNU_NULL:
2619 S = new (Context) GNUNullExpr(Empty);
2620 break;
2621
2622 case EXPR_SHUFFLE_VECTOR:
2623 S = new (Context) ShuffleVectorExpr(Empty);
2624 break;
2625
2626 case EXPR_CONVERT_VECTOR:
2627 S = new (Context) ConvertVectorExpr(Empty);
2628 break;
2629
2630 case EXPR_BLOCK:
2631 S = new (Context) BlockExpr(Empty);
2632 break;
2633
2634 case EXPR_GENERIC_SELECTION:
2635 S = new (Context) GenericSelectionExpr(Empty);
2636 break;
2637
2638 case EXPR_OBJC_STRING_LITERAL:
2639 S = new (Context) ObjCStringLiteral(Empty);
2640 break;
2641
2642 case EXPR_OBJC_BOXED_EXPRESSION:
2643 S = new (Context) ObjCBoxedExpr(Empty);
2644 break;
2645
2646 case EXPR_OBJC_ARRAY_LITERAL:
2647 S = ObjCArrayLiteral::CreateEmpty(Context,
2648 Record[ASTStmtReader::NumExprFields]);
2649 break;
2650
2651 case EXPR_OBJC_DICTIONARY_LITERAL:
2652 S = ObjCDictionaryLiteral::CreateEmpty(Context,
2653 Record[ASTStmtReader::NumExprFields],
2654 Record[ASTStmtReader::NumExprFields + 1]);
2655 break;
2656
2657 case EXPR_OBJC_ENCODE:
2658 S = new (Context) ObjCEncodeExpr(Empty);
2659 break;
2660
2661 case EXPR_OBJC_SELECTOR_EXPR:
2662 S = new (Context) ObjCSelectorExpr(Empty);
2663 break;
2664
2665 case EXPR_OBJC_PROTOCOL_EXPR:
2666 S = new (Context) ObjCProtocolExpr(Empty);
2667 break;
2668
2669 case EXPR_OBJC_IVAR_REF_EXPR:
2670 S = new (Context) ObjCIvarRefExpr(Empty);
2671 break;
2672
2673 case EXPR_OBJC_PROPERTY_REF_EXPR:
2674 S = new (Context) ObjCPropertyRefExpr(Empty);
2675 break;
2676
2677 case EXPR_OBJC_SUBSCRIPT_REF_EXPR:
2678 S = new (Context) ObjCSubscriptRefExpr(Empty);
2679 break;
2680
2681 case EXPR_OBJC_KVC_REF_EXPR:
2682 llvm_unreachable("mismatching AST file")::llvm::llvm_unreachable_internal("mismatching AST file", "/build/llvm-toolchain-snapshot-8~svn348900/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 2682)
;
2683
2684 case EXPR_OBJC_MESSAGE_EXPR:
2685 S = ObjCMessageExpr::CreateEmpty(Context,
2686 Record[ASTStmtReader::NumExprFields],
2687 Record[ASTStmtReader::NumExprFields + 1]);
2688 break;
2689
2690 case EXPR_OBJC_ISA:
2691 S = new (Context) ObjCIsaExpr(Empty);
2692 break;
2693
2694 case EXPR_OBJC_INDIRECT_COPY_RESTORE:
2695 S = new (Context) ObjCIndirectCopyRestoreExpr(Empty);
2696 break;
2697
2698 case EXPR_OBJC_BRIDGED_CAST:
2699 S = new (Context) ObjCBridgedCastExpr(Empty);
2700 break;
2701
2702 case STMT_OBJC_FOR_COLLECTION:
2703 S = new (Context) ObjCForCollectionStmt(Empty);
2704 break;
2705
2706 case STMT_OBJC_CATCH:
2707 S = new (Context) ObjCAtCatchStmt(Empty);
2708 break;
2709
2710 case STMT_OBJC_FINALLY:
2711 S = new (Context) ObjCAtFinallyStmt(Empty);
2712 break;
2713
2714 case STMT_OBJC_AT_TRY:
2715 S = ObjCAtTryStmt::CreateEmpty(Context,
2716 Record[ASTStmtReader::NumStmtFields],
2717 Record[ASTStmtReader::NumStmtFields + 1]);
2718 break;
2719
2720 case STMT_OBJC_AT_SYNCHRONIZED:
2721 S = new (Context) ObjCAtSynchronizedStmt(Empty);
2722 break;
2723
2724 case STMT_OBJC_AT_THROW:
2725 S = new (Context) ObjCAtThrowStmt(Empty);
2726 break;
2727
2728 case STMT_OBJC_AUTORELEASE_POOL:
2729 S = new (Context) ObjCAutoreleasePoolStmt(Empty);
2730 break;
2731
2732 case EXPR_OBJC_BOOL_LITERAL:
2733 S = new (Context) ObjCBoolLiteralExpr(Empty);
2734 break;
2735
2736 case EXPR_OBJC_AVAILABILITY_CHECK:
2737 S = new (Context) ObjCAvailabilityCheckExpr(Empty);
2738 break;
2739
2740 case STMT_SEH_LEAVE:
2741 S = new (Context) SEHLeaveStmt(Empty);
2742 break;
2743
2744 case STMT_SEH_EXCEPT:
2745 S = new (Context) SEHExceptStmt(Empty);
2746 break;
2747
2748 case STMT_SEH_FINALLY:
2749 S = new (Context) SEHFinallyStmt(Empty);
2750 break;
2751
2752 case STMT_SEH_TRY:
2753 S = new (Context) SEHTryStmt(Empty);
2754 break;
2755
2756 case STMT_CXX_CATCH:
2757 S = new (Context) CXXCatchStmt(Empty);
2758 break;
2759
2760 case STMT_CXX_TRY:
2761 S = CXXTryStmt::Create(Context, Empty,
2762 /*NumHandlers=*/Record[ASTStmtReader::NumStmtFields]);
2763 break;
2764
2765 case STMT_CXX_FOR_RANGE:
2766 S = new (Context) CXXForRangeStmt(Empty);
2767 break;
2768
2769 case STMT_MS_DEPENDENT_EXISTS:
2770 S = new (Context) MSDependentExistsStmt(SourceLocation(), true,
2771 NestedNameSpecifierLoc(),
2772 DeclarationNameInfo(),
2773 nullptr);
2774 break;
2775
2776 case STMT_OMP_PARALLEL_DIRECTIVE:
2777 S =
2778 OMPParallelDirective::CreateEmpty(Context,
2779 Record[ASTStmtReader::NumStmtFields],
2780 Empty);
2781 break;
2782
2783 case STMT_OMP_SIMD_DIRECTIVE: {
2784 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
2785 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
2786 S = OMPSimdDirective::CreateEmpty(Context, NumClauses,
2787 CollapsedNum, Empty);
2788 break;
2789 }
2790
2791 case STMT_OMP_FOR_DIRECTIVE: {
2792 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
2793 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
2794 S = OMPForDirective::CreateEmpty(Context, NumClauses, CollapsedNum,
2795 Empty);
2796 break;
2797 }
2798
2799 case STMT_OMP_FOR_SIMD_DIRECTIVE: {
2800 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
2801 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
2802 S = OMPForSimdDirective::CreateEmpty(Context, NumClauses, CollapsedNum,
2803 Empty);
2804 break;
2805 }
2806
2807 case STMT_OMP_SECTIONS_DIRECTIVE:
2808 S = OMPSectionsDirective::CreateEmpty(
2809 Context, Record[ASTStmtReader::NumStmtFields], Empty);
2810 break;
2811
2812 case STMT_OMP_SECTION_DIRECTIVE:
2813 S = OMPSectionDirective::CreateEmpty(Context, Empty);
2814 break;
2815
2816 case STMT_OMP_SINGLE_DIRECTIVE:
2817 S = OMPSingleDirective::CreateEmpty(
2818 Context, Record[ASTStmtReader::NumStmtFields], Empty);
2819 break;
2820
2821 case STMT_OMP_MASTER_DIRECTIVE:
2822 S = OMPMasterDirective::CreateEmpty(Context, Empty);
2823 break;
2824
2825 case STMT_OMP_CRITICAL_DIRECTIVE:
2826 S = OMPCriticalDirective::CreateEmpty(
2827 Context, Record[ASTStmtReader::NumStmtFields], Empty);
2828 break;
2829
2830 case STMT_OMP_PARALLEL_FOR_DIRECTIVE: {
2831 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
2832 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
2833 S = OMPParallelForDirective::CreateEmpty(Context, NumClauses,
2834 CollapsedNum, Empty);
2835 break;
2836 }
2837
2838 case STMT_OMP_PARALLEL_FOR_SIMD_DIRECTIVE: {
2839 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
2840 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
2841 S = OMPParallelForSimdDirective::CreateEmpty(Context, NumClauses,
2842 CollapsedNum, Empty);
2843 break;
2844 }
2845
2846 case STMT_OMP_PARALLEL_SECTIONS_DIRECTIVE:
2847 S = OMPParallelSectionsDirective::CreateEmpty(
2848 Context, Record[ASTStmtReader::NumStmtFields], Empty);
2849 break;
2850
2851 case STMT_OMP_TASK_DIRECTIVE:
2852 S = OMPTaskDirective::CreateEmpty(
2853 Context, Record[ASTStmtReader::NumStmtFields], Empty);
2854 break;
2855
2856 case STMT_OMP_TASKYIELD_DIRECTIVE:
2857 S = OMPTaskyieldDirective::CreateEmpty(Context, Empty);
2858 break;
2859
2860 case STMT_OMP_BARRIER_DIRECTIVE:
2861 S = OMPBarrierDirective::CreateEmpty(Context, Empty);
2862 break;
2863
2864 case STMT_OMP_TASKWAIT_DIRECTIVE:
2865 S = OMPTaskwaitDirective::CreateEmpty(Context, Empty);
2866 break;
2867
2868 case STMT_OMP_TASKGROUP_DIRECTIVE:
2869 S = OMPTaskgroupDirective::CreateEmpty(
2870 Context, Record[ASTStmtReader::NumStmtFields], Empty);
2871 break;
2872
2873 case STMT_OMP_FLUSH_DIRECTIVE:
2874 S = OMPFlushDirective::CreateEmpty(
2875 Context, Record[ASTStmtReader::NumStmtFields], Empty);
2876 break;
2877
2878 case STMT_OMP_ORDERED_DIRECTIVE:
2879 S = OMPOrderedDirective::CreateEmpty(
2880 Context, Record[ASTStmtReader::NumStmtFields], Empty);
2881 break;
2882
2883 case STMT_OMP_ATOMIC_DIRECTIVE:
2884 S = OMPAtomicDirective::CreateEmpty(
2885 Context, Record[ASTStmtReader::NumStmtFields], Empty);
2886 break;
2887
2888 case STMT_OMP_TARGET_DIRECTIVE:
2889 S = OMPTargetDirective::CreateEmpty(
2890 Context, Record[ASTStmtReader::NumStmtFields], Empty);
2891 break;
2892
2893 case STMT_OMP_TARGET_DATA_DIRECTIVE:
2894 S = OMPTargetDataDirective::CreateEmpty(
2895 Context, Record[ASTStmtReader::NumStmtFields], Empty);
2896 break;
2897
2898 case STMT_OMP_TARGET_ENTER_DATA_DIRECTIVE:
2899 S = OMPTargetEnterDataDirective::CreateEmpty(
2900 Context, Record[ASTStmtReader::NumStmtFields], Empty);
2901 break;
2902
2903 case STMT_OMP_TARGET_EXIT_DATA_DIRECTIVE:
2904 S = OMPTargetExitDataDirective::CreateEmpty(
2905 Context, Record[ASTStmtReader::NumStmtFields], Empty);
2906 break;
2907
2908 case STMT_OMP_TARGET_PARALLEL_DIRECTIVE:
2909 S = OMPTargetParallelDirective::CreateEmpty(
2910 Context, Record[ASTStmtReader::NumStmtFields], Empty);
2911 break;
2912
2913 case STMT_OMP_TARGET_PARALLEL_FOR_DIRECTIVE: {
2914 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
2915 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
2916 S = OMPTargetParallelForDirective::CreateEmpty(Context, NumClauses,
2917 CollapsedNum, Empty);
2918 break;
2919 }
2920
2921 case STMT_OMP_TARGET_UPDATE_DIRECTIVE:
2922 S = OMPTargetUpdateDirective::CreateEmpty(
2923 Context, Record[ASTStmtReader::NumStmtFields], Empty);
2924 break;
2925
2926 case STMT_OMP_TEAMS_DIRECTIVE:
2927 S = OMPTeamsDirective::CreateEmpty(
2928 Context, Record[ASTStmtReader::NumStmtFields], Empty);
2929 break;
2930
2931 case STMT_OMP_CANCELLATION_POINT_DIRECTIVE:
2932 S = OMPCancellationPointDirective::CreateEmpty(Context, Empty);
2933 break;
2934
2935 case STMT_OMP_CANCEL_DIRECTIVE:
2936 S = OMPCancelDirective::CreateEmpty(
2937 Context, Record[ASTStmtReader::NumStmtFields], Empty);
2938 break;
2939
2940 case STMT_OMP_TASKLOOP_DIRECTIVE: {
2941 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
2942 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
2943 S = OMPTaskLoopDirective::CreateEmpty(Context, NumClauses, CollapsedNum,
2944 Empty);
2945 break;
2946 }
2947
2948 case STMT_OMP_TASKLOOP_SIMD_DIRECTIVE: {
2949 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
2950 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
2951 S = OMPTaskLoopSimdDirective::CreateEmpty(Context, NumClauses,
2952 CollapsedNum, Empty);
2953 break;
2954 }
2955
2956 case STMT_OMP_DISTRIBUTE_DIRECTIVE: {
2957 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
2958 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
2959 S = OMPDistributeDirective::CreateEmpty(Context, NumClauses, CollapsedNum,
2960 Empty);
2961 break;
2962 }
2963
2964 case STMT_OMP_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE: {
2965 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
2966 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
2967 S = OMPDistributeParallelForDirective::CreateEmpty(Context, NumClauses,
2968 CollapsedNum, Empty);
2969 break;
2970 }
2971
2972 case STMT_OMP_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE: {
2973 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
2974 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
2975 S = OMPDistributeParallelForSimdDirective::CreateEmpty(Context, NumClauses,
2976 CollapsedNum,
2977 Empty);
2978 break;
2979 }
2980
2981 case STMT_OMP_DISTRIBUTE_SIMD_DIRECTIVE: {
2982 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
2983 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
2984 S = OMPDistributeSimdDirective::CreateEmpty(Context, NumClauses,
2985 CollapsedNum, Empty);
2986 break;
2987 }
2988
2989 case STMT_OMP_TARGET_PARALLEL_FOR_SIMD_DIRECTIVE: {
2990 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
2991 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
2992 S = OMPTargetParallelForSimdDirective::CreateEmpty(Context, NumClauses,
2993 CollapsedNum, Empty);
2994 break;
2995 }
2996
2997 case STMT_OMP_TARGET_SIMD_DIRECTIVE: {
2998 auto NumClauses = Record[ASTStmtReader::NumStmtFields];
2999 auto CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
3000 S = OMPTargetSimdDirective::CreateEmpty(Context, NumClauses, CollapsedNum,
3001 Empty);
3002 break;
3003 }
3004
3005 case STMT_OMP_TEAMS_DISTRIBUTE_DIRECTIVE: {
3006 auto NumClauses = Record[ASTStmtReader::NumStmtFields];
3007 auto CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
3008 S = OMPTeamsDistributeDirective::CreateEmpty(Context, NumClauses,
3009 CollapsedNum, Empty);
3010 break;
3011 }
3012
3013 case STMT_OMP_TEAMS_DISTRIBUTE_SIMD_DIRECTIVE: {
3014 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
3015 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
3016 S = OMPTeamsDistributeSimdDirective::CreateEmpty(Context, NumClauses,
3017 CollapsedNum, Empty);
3018 break;
3019 }
3020
3021 case STMT_OMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE: {
3022 auto NumClauses = Record[ASTStmtReader::NumStmtFields];
3023 auto CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
3024 S = OMPTeamsDistributeParallelForSimdDirective::CreateEmpty(
3025 Context, NumClauses, CollapsedNum, Empty);
3026 break;
3027 }
3028
3029 case STMT_OMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE: {
3030 auto NumClauses = Record[ASTStmtReader::NumStmtFields];
3031 auto CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
3032 S = OMPTeamsDistributeParallelForDirective::CreateEmpty(
3033 Context, NumClauses, CollapsedNum, Empty);
3034 break;
3035 }
3036
3037 case STMT_OMP_TARGET_TEAMS_DIRECTIVE:
3038 S = OMPTargetTeamsDirective::CreateEmpty(
3039 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3040 break;
3041
3042 case STMT_OMP_TARGET_TEAMS_DISTRIBUTE_DIRECTIVE: {
3043 auto NumClauses = Record[ASTStmtReader::NumStmtFields];
3044 auto CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
3045 S = OMPTargetTeamsDistributeDirective::CreateEmpty(Context, NumClauses,
3046 CollapsedNum, Empty);
3047 break;
3048 }
3049
3050 case STMT_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE: {
3051 auto NumClauses = Record[ASTStmtReader::NumStmtFields];
3052 auto CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
3053 S = OMPTargetTeamsDistributeParallelForDirective::CreateEmpty(
3054 Context, NumClauses, CollapsedNum, Empty);
3055 break;
3056 }
3057
3058 case STMT_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE: {
3059 auto NumClauses = Record[ASTStmtReader::NumStmtFields];
3060 auto CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
3061 S = OMPTargetTeamsDistributeParallelForSimdDirective::CreateEmpty(
3062 Context, NumClauses, CollapsedNum, Empty);
3063 break;
3064 }
3065
3066 case STMT_OMP_TARGET_TEAMS_DISTRIBUTE_SIMD_DIRECTIVE: {
3067 auto NumClauses = Record[ASTStmtReader::NumStmtFields];
3068 auto CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
3069 S = OMPTargetTeamsDistributeSimdDirective::CreateEmpty(
3070 Context, NumClauses, CollapsedNum, Empty);
3071 break;
3072 }
3073
3074 case EXPR_CXX_OPERATOR_CALL:
3075 S = new (Context) CXXOperatorCallExpr(
3076 Context, /*NumArgs=*/Record[ASTStmtReader::NumExprFields],
3077 Empty);
3078 break;
3079
3080 case EXPR_CXX_MEMBER_CALL:
3081 S = new (Context) CXXMemberCallExpr(
3082 Context, /*NumArgs=*/Record[ASTStmtReader::NumExprFields],
3083 Empty);
3084 break;
3085
3086 case EXPR_CXX_CONSTRUCT:
3087 S = new (Context) CXXConstructExpr(Empty);
3088 break;
3089
3090 case EXPR_CXX_INHERITED_CTOR_INIT:
3091 S = new (Context) CXXInheritedCtorInitExpr(Empty);
3092 break;
3093
3094 case EXPR_CXX_TEMPORARY_OBJECT:
3095 S = new (Context) CXXTemporaryObjectExpr(Empty);
3096 break;
3097
3098 case EXPR_CXX_STATIC_CAST:
3099 S = CXXStaticCastExpr::CreateEmpty(Context,
3100 /*PathSize*/ Record[ASTStmtReader::NumExprFields]);
3101 break;
3102
3103 case EXPR_CXX_DYNAMIC_CAST:
3104 S = CXXDynamicCastExpr::CreateEmpty(Context,
3105 /*PathSize*/ Record[ASTStmtReader::NumExprFields]);
3106 break;
3107
3108 case EXPR_CXX_REINTERPRET_CAST:
3109 S = CXXReinterpretCastExpr::CreateEmpty(Context,
3110 /*PathSize*/ Record[ASTStmtReader::NumExprFields]);
3111 break;
3112
3113 case EXPR_CXX_CONST_CAST:
3114 S = CXXConstCastExpr::CreateEmpty(Context);
3115 break;
3116
3117 case EXPR_CXX_FUNCTIONAL_CAST:
3118 S = CXXFunctionalCastExpr::CreateEmpty(Context,
3119 /*PathSize*/ Record[ASTStmtReader::NumExprFields]);
3120 break;
3121
3122 case EXPR_USER_DEFINED_LITERAL:
3123 S = new (Context) UserDefinedLiteral(
3124 Context, /*NumArgs=*/Record[ASTStmtReader::NumExprFields], Empty);
3125 break;
3126
3127 case EXPR_CXX_STD_INITIALIZER_LIST:
3128 S = new (Context) CXXStdInitializerListExpr(Empty);
3129 break;
3130
3131 case EXPR_CXX_BOOL_LITERAL:
3132 S = new (Context) CXXBoolLiteralExpr(Empty);
3133 break;
3134
3135 case EXPR_CXX_NULL_PTR_LITERAL:
3136 S = new (Context) CXXNullPtrLiteralExpr(Empty);
3137 break;
3138
3139 case EXPR_CXX_TYPEID_EXPR:
3140 S = new (Context) CXXTypeidExpr(Empty, true);
3141 break;
3142
3143 case EXPR_CXX_TYPEID_TYPE:
3144 S = new (Context) CXXTypeidExpr(Empty, false);
3145 break;
3146
3147 case EXPR_CXX_UUIDOF_EXPR:
3148 S = new (Context) CXXUuidofExpr(Empty, true);
3149 break;
3150
3151 case EXPR_CXX_PROPERTY_REF_EXPR:
3152 S = new (Context) MSPropertyRefExpr(Empty);
3153 break;
3154
3155 case EXPR_CXX_PROPERTY_SUBSCRIPT_EXPR:
3156 S = new (Context) MSPropertySubscriptExpr(Empty);
3157 break;
3158
3159 case EXPR_CXX_UUIDOF_TYPE:
3160 S = new (Context) CXXUuidofExpr(Empty, false);
3161 break;
3162
3163 case EXPR_CXX_THIS:
3164 S = new (Context) CXXThisExpr(Empty);
3165 break;
3166
3167 case EXPR_CXX_THROW:
3168 S = new (Context) CXXThrowExpr(Empty);
3169 break;
3170
3171 case EXPR_CXX_DEFAULT_ARG:
3172 S = new (Context) CXXDefaultArgExpr(Empty);
3173 break;
3174
3175 case EXPR_CXX_DEFAULT_INIT:
3176 S = new (Context) CXXDefaultInitExpr(Empty);
3177 break;
3178
3179 case EXPR_CXX_BIND_TEMPORARY:
3180 S = new (Context) CXXBindTemporaryExpr(Empty);
3181 break;
3182
3183 case EXPR_CXX_SCALAR_VALUE_INIT:
3184 S = new (Context) CXXScalarValueInitExpr(Empty);
3185 break;
3186
3187 case EXPR_CXX_NEW:
3188 S = new (Context) CXXNewExpr(Empty);
3189 break;
3190
3191 case EXPR_CXX_DELETE:
3192 S = new (Context) CXXDeleteExpr(Empty);
3193 break;
3194
3195 case EXPR_CXX_PSEUDO_DESTRUCTOR:
3196 S = new (Context) CXXPseudoDestructorExpr(Empty);
3197 break;
3198
3199 case EXPR_EXPR_WITH_CLEANUPS:
3200 S = ExprWithCleanups::Create(Context, Empty,
3201 Record[ASTStmtReader::NumExprFields]);
3202 break;
3203
3204 case EXPR_CXX_DEPENDENT_SCOPE_MEMBER:
3205 S = CXXDependentScopeMemberExpr::CreateEmpty(Context,
3206 /*HasTemplateKWAndArgsInfo=*/Record[ASTStmtReader::NumExprFields],
3207 /*NumTemplateArgs=*/Record[ASTStmtReader::NumExprFields]
3208 ? Record[ASTStmtReader::NumExprFields + 1]
3209 : 0);
3210 break;
3211
3212 case EXPR_CXX_DEPENDENT_SCOPE_DECL_REF:
3213 S = DependentScopeDeclRefExpr::CreateEmpty(Context,
3214 /*HasTemplateKWAndArgsInfo=*/Record[ASTStmtReader::NumExprFields],
3215 /*NumTemplateArgs=*/Record[ASTStmtReader::NumExprFields]
3216 ? Record[ASTStmtReader::NumExprFields + 1]
3217 : 0);
3218 break;
3219
3220 case EXPR_CXX_UNRESOLVED_CONSTRUCT:
3221 S = CXXUnresolvedConstructExpr::CreateEmpty(Context,
3222 /*NumArgs=*/Record[ASTStmtReader::NumExprFields]);
3223 break;
3224
3225 case EXPR_CXX_UNRESOLVED_MEMBER:
3226 S = UnresolvedMemberExpr::CreateEmpty(Context,
3227 /*HasTemplateKWAndArgsInfo=*/Record[ASTStmtReader::NumExprFields],
3228 /*NumTemplateArgs=*/Record[ASTStmtReader::NumExprFields]
3229 ? Record[ASTStmtReader::NumExprFields + 1]
3230 : 0);
3231 break;
3232
3233 case EXPR_CXX_UNRESOLVED_LOOKUP:
3234 S = UnresolvedLookupExpr::CreateEmpty(Context,
3235 /*HasTemplateKWAndArgsInfo=*/Record[ASTStmtReader::NumExprFields],
3236 /*NumTemplateArgs=*/Record[ASTStmtReader::NumExprFields]
3237 ? Record[ASTStmtReader::NumExprFields + 1]
3238 : 0);
3239 break;
3240
3241 case EXPR_TYPE_TRAIT:
3242 S = TypeTraitExpr::CreateDeserialized(Context,
3243 Record[ASTStmtReader::NumExprFields]);
3244 break;
3245
3246 case EXPR_ARRAY_TYPE_TRAIT:
3247 S = new (Context) ArrayTypeTraitExpr(Empty);
3248 break;
3249
3250 case EXPR_CXX_EXPRESSION_TRAIT:
3251 S = new (Context) ExpressionTraitExpr(Empty);
3252 break;
3253
3254 case EXPR_CXX_NOEXCEPT:
3255 S = new (Context) CXXNoexceptExpr(Empty);
3256 break;
3257
3258 case EXPR_PACK_EXPANSION:
3259 S = new (Context) PackExpansionExpr(Empty);
3260 break;
3261
3262 case EXPR_SIZEOF_PACK:
3263 S = SizeOfPackExpr::CreateDeserialized(
3264 Context,
3265 /*NumPartialArgs=*/Record[ASTStmtReader::NumExprFields]);
3266 break;
3267
3268 case EXPR_SUBST_NON_TYPE_TEMPLATE_PARM:
3269 S = new (Context) SubstNonTypeTemplateParmExpr(Empty);
3270 break;
3271
3272 case EXPR_SUBST_NON_TYPE_TEMPLATE_PARM_PACK:
3273 S = new (Context) SubstNonTypeTemplateParmPackExpr(Empty);
3274 break;
3275
3276 case EXPR_FUNCTION_PARM_PACK:
3277 S = FunctionParmPackExpr::CreateEmpty(Context,
3278 Record[ASTStmtReader::NumExprFields]);
3279 break;
3280
3281 case EXPR_MATERIALIZE_TEMPORARY:
3282 S = new (Context) MaterializeTemporaryExpr(Empty);
3283 break;
3284
3285 case EXPR_CXX_FOLD:
3286 S = new (Context) CXXFoldExpr(Empty);
3287 break;
3288
3289 case EXPR_OPAQUE_VALUE:
3290 S = new (Context) OpaqueValueExpr(Empty);
3291 break;
3292
3293 case EXPR_CUDA_KERNEL_CALL:
3294 S = new (Context) CUDAKernelCallExpr(
3295 Context, /*NumArgs=*/Record[ASTStmtReader::NumExprFields], Empty);
3296 break;
3297
3298 case EXPR_ASTYPE:
3299 S = new (Context) AsTypeExpr(Empty);
3300 break;
3301
3302 case EXPR_PSEUDO_OBJECT: {
3303 unsigned numSemanticExprs = Record[ASTStmtReader::NumExprFields];
3304 S = PseudoObjectExpr::Create(Context, Empty, numSemanticExprs);
3305 break;
3306 }
3307
3308 case EXPR_ATOMIC:
3309 S = new (Context) AtomicExpr(Empty);
3310 break;
3311
3312 case EXPR_LAMBDA: {
3313 unsigned NumCaptures = Record[ASTStmtReader::NumExprFields];
3314 S = LambdaExpr::CreateDeserialized(Context, NumCaptures);
3315 break;
3316 }
3317
3318 case STMT_COROUTINE_BODY: {
3319 unsigned NumParams = Record[ASTStmtReader::NumStmtFields];
3320 S = CoroutineBodyStmt::Create(Context, Empty, NumParams);
3321 break;
3322 }
3323
3324 case STMT_CORETURN:
3325 S = new (Context) CoreturnStmt(Empty);
3326 break;
3327
3328 case EXPR_COAWAIT:
3329 S = new (Context) CoawaitExpr(Empty);
3330 break;
3331
3332 case EXPR_COYIELD:
3333 S = new (Context) CoyieldExpr(Empty);
3334 break;
3335
3336 case EXPR_DEPENDENT_COAWAIT:
3337 S = new (Context) DependentCoawaitExpr(Empty);
3338 break;
3339 }
3340
3341 // We hit a STMT_STOP, so we're done with this expression.
3342 if (Finished)
3343 break;
3344
3345 ++NumStatementsRead;
3346
3347 if (S && !IsStmtReference) {
3348 Reader.Visit(S);
3349 StmtEntries[Cursor.GetCurrentBitNo()] = S;
3350 }
3351
3352 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~svn348900/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 3353, __PRETTY_FUNCTION__))
3353 "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~svn348900/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 3353, __PRETTY_FUNCTION__))
;
3354 StmtStack.push_back(S);
3355 }
3356Done:
3357 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~svn348900/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 3357, __PRETTY_FUNCTION__))
;
3358 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~svn348900/tools/clang/lib/Serialization/ASTReaderStmt.cpp"
, 3358, __PRETTY_FUNCTION__))
;
3359 return StmtStack.pop_back_val();
3360}