Bug Summary

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

Annotated Source Code

Press '?' to see keyboard shortcuts

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