Coverage Report

Created: 2022-01-22 13:19

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