Coverage Report

Created: 2019-07-24 05:18

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