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