blob: ce9ee292c7c9a1d0a56ddd09c692627e442ca4c7 [file] [log] [blame]
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +00001//===- ASTReaderStmt.cpp - Stmt/Expr Deserialization ----------------------===//
Chris Lattner92ba5ff2009-04-27 05:14:47 +00002//
Chandler Carruth2946cd72019-01-19 08:50:56 +00003// 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
Chris Lattner92ba5ff2009-04-27 05:14:47 +00006//
7//===----------------------------------------------------------------------===//
8//
9// Statement/expression deserialization. This implements the
Sebastian Redl2c499f62010-08-18 23:56:43 +000010// ASTReader::ReadStmt method.
Chris Lattner92ba5ff2009-04-27 05:14:47 +000011//
12//===----------------------------------------------------------------------===//
13
Saar Razfdf80e82019-12-06 01:30:21 +020014#include "clang/AST/ASTConcept.h"
Benjamin Kramer4ab984e2012-07-04 20:19:54 +000015#include "clang/AST/ASTContext.h"
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +000016#include "clang/AST/AttrIterator.h"
17#include "clang/AST/Decl.h"
18#include "clang/AST/DeclAccessPair.h"
Douglas Gregor5d3507d2009-09-09 23:08:42 +000019#include "clang/AST/DeclCXX.h"
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +000020#include "clang/AST/DeclGroup.h"
21#include "clang/AST/DeclObjC.h"
Douglas Gregorcdbc5392011-01-15 01:15:58 +000022#include "clang/AST/DeclTemplate.h"
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +000023#include "clang/AST/DeclarationName.h"
Haojian Wu67d25912020-03-16 13:43:40 +010024#include "clang/AST/DependenceFlags.h"
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +000025#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"
Chris Lattner92ba5ff2009-04-27 05:14:47 +000036#include "clang/AST/StmtVisitor.h"
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +000037#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"
John McCallf413f5e2013-05-03 00:10:13 +000050#include "clang/Lex/Token.h"
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +000051#include "clang/Serialization/ASTBitCodes.h"
Ilya Biryukovec3060c2020-03-02 16:07:09 +010052#include "clang/Serialization/ASTRecordReader.h"
Sam McCall6b3bede2020-03-27 19:42:49 +010053#include "llvm/ADT/BitmaskEnum.h"
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +000054#include "llvm/ADT/DenseMap.h"
Benjamin Kramer49038022012-02-04 13:45:25 +000055#include "llvm/ADT/SmallString.h"
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +000056#include "llvm/ADT/SmallVector.h"
57#include "llvm/ADT/StringRef.h"
Francis Visoiu Mistrihe0308272019-07-03 22:40:07 +000058#include "llvm/Bitstream/BitstreamReader.h"
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +000059#include "llvm/Support/Casting.h"
60#include "llvm/Support/ErrorHandling.h"
61#include <algorithm>
62#include <cassert>
63#include <cstdint>
64#include <string>
65
Chris Lattner92ba5ff2009-04-27 05:14:47 +000066using namespace clang;
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +000067using namespace serialization;
Chris Lattner92ba5ff2009-04-27 05:14:47 +000068
Argyrios Kyrtzidisf9f47c82010-06-30 08:49:18 +000069namespace clang {
Argyrios Kyrtzidisddf5f212010-06-28 09:31:42 +000070
Sebastian Redl70c751d2010-08-18 23:56:52 +000071 class ASTStmtReader : public StmtVisitor<ASTStmtReader> {
David L. Jonesbe1557a2016-12-21 00:17:49 +000072 ASTRecordReader &Record;
Sebastian Redlc67764e2010-07-22 22:43:28 +000073 llvm::BitstreamCursor &DeclsCursor;
Chris Lattner92ba5ff2009-04-27 05:14:47 +000074
John McCall3ce3d232019-12-13 03:37:23 -050075 SourceLocation readSourceLocation() {
David L. Jonesb6a8f022016-12-21 04:34:52 +000076 return Record.readSourceLocation();
John McCallf413f5e2013-05-03 00:10:13 +000077 }
78
John McCall3ce3d232019-12-13 03:37:23 -050079 SourceRange readSourceRange() {
David L. Jonesb6a8f022016-12-21 04:34:52 +000080 return Record.readSourceRange();
Sebastian Redl2c373b92010-10-05 15:59:54 +000081 }
John McCallf413f5e2013-05-03 00:10:13 +000082
John McCall3ce3d232019-12-13 03:37:23 -050083 std::string readString() {
David L. Jonesb6a8f022016-12-21 04:34:52 +000084 return Record.readString();
Sebastian Redl2c373b92010-10-05 15:59:54 +000085 }
John McCallf413f5e2013-05-03 00:10:13 +000086
John McCall3ce3d232019-12-13 03:37:23 -050087 TypeSourceInfo *readTypeSourceInfo() {
88 return Record.readTypeSourceInfo();
John McCallf413f5e2013-05-03 00:10:13 +000089 }
David L. Jonesc4808b9e2016-12-15 20:53:26 +000090
John McCall3ce3d232019-12-13 03:37:23 -050091 Decl *readDecl() {
David L. Jonesb6a8f022016-12-21 04:34:52 +000092 return Record.readDecl();
Sebastian Redl2c373b92010-10-05 15:59:54 +000093 }
David L. Jonesc4808b9e2016-12-15 20:53:26 +000094
Douglas Gregor7fb09192011-07-21 22:35:25 +000095 template<typename T>
John McCall3ce3d232019-12-13 03:37:23 -050096 T *readDeclAs() {
David L. Jonesb6a8f022016-12-21 04:34:52 +000097 return Record.readDeclAs<T>();
Douglas Gregor7fb09192011-07-21 22:35:25 +000098 }
99
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000100 public:
David L. Jonesbe1557a2016-12-21 00:17:49 +0000101 ASTStmtReader(ASTRecordReader &Record, llvm::BitstreamCursor &Cursor)
102 : Record(Record), DeclsCursor(Cursor) {}
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000103
Adrian Prantl9fc8faf2018-05-09 01:00:01 +0000104 /// The number of record fields required for the Stmt class
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000105 /// itself.
Roman Lebedevd5edcb92020-03-12 12:18:01 +0300106 static const unsigned NumStmtFields = 0;
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000107
Adrian Prantl9fc8faf2018-05-09 01:00:01 +0000108 /// The number of record fields required for the Expr class
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000109 /// itself.
Haojian Wu4b0f1e12020-03-17 10:36:19 +0100110 static const unsigned NumExprFields =
Sam McCall6b3bede2020-03-27 19:42:49 +0100111 NumStmtFields + llvm::BitWidth<ExprDependence> + 3;
Abramo Bagnara7945c982012-01-27 09:46:47 +0000112
Adrian Prantl9fc8faf2018-05-09 01:00:01 +0000113 /// Read and initialize a ExplicitTemplateArgumentList structure.
Abramo Bagnara7945c982012-01-27 09:46:47 +0000114 void ReadTemplateKWAndArgsInfo(ASTTemplateKWAndArgsInfo &Args,
James Y Knighte7d82282015-12-29 18:15:14 +0000115 TemplateArgumentLoc *ArgsLocArray,
Abramo Bagnara7945c982012-01-27 09:46:47 +0000116 unsigned NumTemplateArgs);
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +0000117
Adrian Prantl9fc8faf2018-05-09 01:00:01 +0000118 /// Read and initialize a ExplicitTemplateArgumentList structure.
Argyrios Kyrtzidisde6aa082011-09-22 20:07:03 +0000119 void ReadExplicitTemplateArgumentList(ASTTemplateArgumentListInfo &ArgList,
Argyrios Kyrtzidisd0795b22010-06-28 22:28:35 +0000120 unsigned NumTemplateArgs);
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000121
Argyrios Kyrtzidisd0795b22010-06-28 22:28:35 +0000122 void VisitStmt(Stmt *S);
John McCallfa194042011-07-15 07:00:14 +0000123#define STMT(Type, Base) \
124 void Visit##Type(Type *);
125#include "clang/AST/StmtNodes.inc"
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000126 };
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +0000127
128} // namespace clang
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000129
James Y Knighte7d82282015-12-29 18:15:14 +0000130void ASTStmtReader::ReadTemplateKWAndArgsInfo(ASTTemplateKWAndArgsInfo &Args,
131 TemplateArgumentLoc *ArgsLocArray,
132 unsigned NumTemplateArgs) {
John McCall3ce3d232019-12-13 03:37:23 -0500133 SourceLocation TemplateKWLoc = readSourceLocation();
Argyrios Kyrtzidisb5288de2010-06-28 09:31:48 +0000134 TemplateArgumentListInfo ArgInfo;
John McCall3ce3d232019-12-13 03:37:23 -0500135 ArgInfo.setLAngleLoc(readSourceLocation());
136 ArgInfo.setRAngleLoc(readSourceLocation());
Argyrios Kyrtzidisb5288de2010-06-28 09:31:48 +0000137 for (unsigned i = 0; i != NumTemplateArgs; ++i)
David L. Jonesb6a8f022016-12-21 04:34:52 +0000138 ArgInfo.addArgument(Record.readTemplateArgumentLoc());
James Y Knighte7d82282015-12-29 18:15:14 +0000139 Args.initializeFrom(TemplateKWLoc, ArgInfo, ArgsLocArray);
Argyrios Kyrtzidisb5288de2010-06-28 09:31:48 +0000140}
141
Sebastian Redl70c751d2010-08-18 23:56:52 +0000142void ASTStmtReader::VisitStmt(Stmt *S) {
David L. Jonesbe1557a2016-12-21 00:17:49 +0000143 assert(Record.getIdx() == NumStmtFields && "Incorrect statement field count");
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000144}
145
Sebastian Redl70c751d2010-08-18 23:56:52 +0000146void ASTStmtReader::VisitNullStmt(NullStmt *S) {
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000147 VisitStmt(S);
John McCall3ce3d232019-12-13 03:37:23 -0500148 S->setSemiLoc(readSourceLocation());
Bruno Ricci41d11c02018-10-27 18:43:27 +0000149 S->NullStmtBits.HasLeadingEmptyMacro = Record.readInt();
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000150}
151
Sebastian Redl70c751d2010-08-18 23:56:52 +0000152void ASTStmtReader::VisitCompoundStmt(CompoundStmt *S) {
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000153 VisitStmt(S);
Chris Lattner0e62c1c2011-07-23 10:55:15 +0000154 SmallVector<Stmt *, 16> Stmts;
David L. Jonesbe1557a2016-12-21 00:17:49 +0000155 unsigned NumStmts = Record.readInt();
Argyrios Kyrtzidisd0795b22010-06-28 22:28:35 +0000156 while (NumStmts--)
David L. Jonesb6a8f022016-12-21 04:34:52 +0000157 Stmts.push_back(Record.readSubStmt());
Benjamin Kramer07420902017-12-24 16:24:20 +0000158 S->setStmts(Stmts);
John McCall3ce3d232019-12-13 03:37:23 -0500159 S->CompoundStmtBits.LBraceLoc = readSourceLocation();
160 S->RBraceLoc = readSourceLocation();
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000161}
162
Sebastian Redl70c751d2010-08-18 23:56:52 +0000163void ASTStmtReader::VisitSwitchCase(SwitchCase *S) {
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000164 VisitStmt(S);
David L. Jonesb6a8f022016-12-21 04:34:52 +0000165 Record.recordSwitchCaseID(S, Record.readInt());
John McCall3ce3d232019-12-13 03:37:23 -0500166 S->setKeywordLoc(readSourceLocation());
167 S->setColonLoc(readSourceLocation());
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000168}
169
Sebastian Redl70c751d2010-08-18 23:56:52 +0000170void ASTStmtReader::VisitCaseStmt(CaseStmt *S) {
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000171 VisitSwitchCase(S);
Bruno Ricci5b30571752018-10-28 12:30:53 +0000172 bool CaseStmtIsGNURange = Record.readInt();
David L. Jonesb6a8f022016-12-21 04:34:52 +0000173 S->setLHS(Record.readSubExpr());
David L. Jonesb6a8f022016-12-21 04:34:52 +0000174 S->setSubStmt(Record.readSubStmt());
Bruno Ricci5b30571752018-10-28 12:30:53 +0000175 if (CaseStmtIsGNURange) {
176 S->setRHS(Record.readSubExpr());
John McCall3ce3d232019-12-13 03:37:23 -0500177 S->setEllipsisLoc(readSourceLocation());
Bruno Ricci5b30571752018-10-28 12:30:53 +0000178 }
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000179}
180
Sebastian Redl70c751d2010-08-18 23:56:52 +0000181void ASTStmtReader::VisitDefaultStmt(DefaultStmt *S) {
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000182 VisitSwitchCase(S);
David L. Jonesb6a8f022016-12-21 04:34:52 +0000183 S->setSubStmt(Record.readSubStmt());
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000184}
185
Sebastian Redl70c751d2010-08-18 23:56:52 +0000186void ASTStmtReader::VisitLabelStmt(LabelStmt *S) {
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000187 VisitStmt(S);
John McCall3ce3d232019-12-13 03:37:23 -0500188 auto *LD = readDeclAs<LabelDecl>();
Chris Lattnerc8e630e2011-02-17 07:39:24 +0000189 LD->setStmt(S);
190 S->setDecl(LD);
David L. Jonesb6a8f022016-12-21 04:34:52 +0000191 S->setSubStmt(Record.readSubStmt());
John McCall3ce3d232019-12-13 03:37:23 -0500192 S->setIdentLoc(readSourceLocation());
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000193}
194
Richard Smithc202b282012-04-14 00:33:13 +0000195void ASTStmtReader::VisitAttributedStmt(AttributedStmt *S) {
196 VisitStmt(S);
Bruno Ricci41d11c02018-10-27 18:43:27 +0000197 // NumAttrs in AttributedStmt is set when creating an empty
198 // AttributedStmt in AttributedStmt::CreateEmpty, since it is needed
199 // to allocate the right amount of space for the trailing Attr *.
David L. Jonesbe1557a2016-12-21 00:17:49 +0000200 uint64_t NumAttrs = Record.readInt();
Richard Smithc202b282012-04-14 00:33:13 +0000201 AttrVec Attrs;
David L. Jonesb6a8f022016-12-21 04:34:52 +0000202 Record.readAttributes(Attrs);
Matt Beaumont-Gayad0bb8e2012-07-09 18:55:31 +0000203 (void)NumAttrs;
Bruno Ricci41d11c02018-10-27 18:43:27 +0000204 assert(NumAttrs == S->AttributedStmtBits.NumAttrs);
Alexander Kornienko20f6fc62012-07-09 10:04:07 +0000205 assert(NumAttrs == Attrs.size());
Aaron Ballmanf3d9b092014-05-13 14:55:01 +0000206 std::copy(Attrs.begin(), Attrs.end(), S->getAttrArrayPtr());
David L. Jonesb6a8f022016-12-21 04:34:52 +0000207 S->SubStmt = Record.readSubStmt();
John McCall3ce3d232019-12-13 03:37:23 -0500208 S->AttributedStmtBits.AttrLoc = readSourceLocation();
Richard Smithc202b282012-04-14 00:33:13 +0000209}
210
Sebastian Redl70c751d2010-08-18 23:56:52 +0000211void ASTStmtReader::VisitIfStmt(IfStmt *S) {
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000212 VisitStmt(S);
Bruno Riccib1cc94b2018-10-27 21:12:20 +0000213
David L. Jonesbe1557a2016-12-21 00:17:49 +0000214 S->setConstexpr(Record.readInt());
Bruno Riccib1cc94b2018-10-27 21:12:20 +0000215 bool HasElse = Record.readInt();
216 bool HasVar = Record.readInt();
217 bool HasInit = Record.readInt();
218
David L. Jonesb6a8f022016-12-21 04:34:52 +0000219 S->setCond(Record.readSubExpr());
220 S->setThen(Record.readSubStmt());
Bruno Riccib1cc94b2018-10-27 21:12:20 +0000221 if (HasElse)
222 S->setElse(Record.readSubStmt());
223 if (HasVar)
John McCall3ce3d232019-12-13 03:37:23 -0500224 S->setConditionVariable(Record.getContext(), readDeclAs<VarDecl>());
Bruno Riccib1cc94b2018-10-27 21:12:20 +0000225 if (HasInit)
226 S->setInit(Record.readSubStmt());
227
John McCall3ce3d232019-12-13 03:37:23 -0500228 S->setIfLoc(readSourceLocation());
Bruno Riccib1cc94b2018-10-27 21:12:20 +0000229 if (HasElse)
John McCall3ce3d232019-12-13 03:37:23 -0500230 S->setElseLoc(readSourceLocation());
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000231}
232
Sebastian Redl70c751d2010-08-18 23:56:52 +0000233void ASTStmtReader::VisitSwitchStmt(SwitchStmt *S) {
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000234 VisitStmt(S);
Bruno Riccie2806f82018-10-29 16:12:37 +0000235
236 bool HasInit = Record.readInt();
237 bool HasVar = Record.readInt();
238 bool AllEnumCasesCovered = Record.readInt();
239 if (AllEnumCasesCovered)
240 S->setAllEnumCasesCovered();
241
David L. Jonesb6a8f022016-12-21 04:34:52 +0000242 S->setCond(Record.readSubExpr());
243 S->setBody(Record.readSubStmt());
Bruno Riccie2806f82018-10-29 16:12:37 +0000244 if (HasInit)
245 S->setInit(Record.readSubStmt());
246 if (HasVar)
John McCall3ce3d232019-12-13 03:37:23 -0500247 S->setConditionVariable(Record.getContext(), readDeclAs<VarDecl>());
Bruno Riccie2806f82018-10-29 16:12:37 +0000248
John McCall3ce3d232019-12-13 03:37:23 -0500249 S->setSwitchLoc(readSourceLocation());
Ted Kremenekc42f3452010-09-09 00:05:53 +0000250
Craig Toppera13603a2014-05-22 05:54:18 +0000251 SwitchCase *PrevSC = nullptr;
David L. Jonesbe1557a2016-12-21 00:17:49 +0000252 for (auto E = Record.size(); Record.getIdx() != E; ) {
253 SwitchCase *SC = Record.getSwitchCaseWithID(Record.readInt());
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000254 if (PrevSC)
255 PrevSC->setNextSwitchCase(SC);
256 else
257 S->setSwitchCaseList(SC);
Mike Stump11289f42009-09-09 15:08:12 +0000258
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000259 PrevSC = SC;
260 }
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000261}
262
Sebastian Redl70c751d2010-08-18 23:56:52 +0000263void ASTStmtReader::VisitWhileStmt(WhileStmt *S) {
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000264 VisitStmt(S);
Bruno Riccibacf7512018-10-30 13:42:41 +0000265
266 bool HasVar = Record.readInt();
Douglas Gregor7fb09192011-07-21 22:35:25 +0000267
David L. Jonesb6a8f022016-12-21 04:34:52 +0000268 S->setCond(Record.readSubExpr());
269 S->setBody(Record.readSubStmt());
Bruno Riccibacf7512018-10-30 13:42:41 +0000270 if (HasVar)
John McCall3ce3d232019-12-13 03:37:23 -0500271 S->setConditionVariable(Record.getContext(), readDeclAs<VarDecl>());
Bruno Riccibacf7512018-10-30 13:42:41 +0000272
John McCall3ce3d232019-12-13 03:37:23 -0500273 S->setWhileLoc(readSourceLocation());
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000274}
275
Sebastian Redl70c751d2010-08-18 23:56:52 +0000276void ASTStmtReader::VisitDoStmt(DoStmt *S) {
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000277 VisitStmt(S);
David L. Jonesb6a8f022016-12-21 04:34:52 +0000278 S->setCond(Record.readSubExpr());
279 S->setBody(Record.readSubStmt());
John McCall3ce3d232019-12-13 03:37:23 -0500280 S->setDoLoc(readSourceLocation());
281 S->setWhileLoc(readSourceLocation());
282 S->setRParenLoc(readSourceLocation());
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000283}
284
Sebastian Redl70c751d2010-08-18 23:56:52 +0000285void ASTStmtReader::VisitForStmt(ForStmt *S) {
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000286 VisitStmt(S);
David L. Jonesb6a8f022016-12-21 04:34:52 +0000287 S->setInit(Record.readSubStmt());
288 S->setCond(Record.readSubExpr());
John McCall3ce3d232019-12-13 03:37:23 -0500289 S->setConditionVariable(Record.getContext(), readDeclAs<VarDecl>());
David L. Jonesb6a8f022016-12-21 04:34:52 +0000290 S->setInc(Record.readSubExpr());
291 S->setBody(Record.readSubStmt());
John McCall3ce3d232019-12-13 03:37:23 -0500292 S->setForLoc(readSourceLocation());
293 S->setLParenLoc(readSourceLocation());
294 S->setRParenLoc(readSourceLocation());
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000295}
296
Sebastian Redl70c751d2010-08-18 23:56:52 +0000297void ASTStmtReader::VisitGotoStmt(GotoStmt *S) {
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000298 VisitStmt(S);
John McCall3ce3d232019-12-13 03:37:23 -0500299 S->setLabel(readDeclAs<LabelDecl>());
300 S->setGotoLoc(readSourceLocation());
301 S->setLabelLoc(readSourceLocation());
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000302}
303
Sebastian Redl70c751d2010-08-18 23:56:52 +0000304void ASTStmtReader::VisitIndirectGotoStmt(IndirectGotoStmt *S) {
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000305 VisitStmt(S);
John McCall3ce3d232019-12-13 03:37:23 -0500306 S->setGotoLoc(readSourceLocation());
307 S->setStarLoc(readSourceLocation());
David L. Jonesb6a8f022016-12-21 04:34:52 +0000308 S->setTarget(Record.readSubExpr());
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000309}
310
Sebastian Redl70c751d2010-08-18 23:56:52 +0000311void ASTStmtReader::VisitContinueStmt(ContinueStmt *S) {
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000312 VisitStmt(S);
John McCall3ce3d232019-12-13 03:37:23 -0500313 S->setContinueLoc(readSourceLocation());
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000314}
315
Sebastian Redl70c751d2010-08-18 23:56:52 +0000316void ASTStmtReader::VisitBreakStmt(BreakStmt *S) {
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000317 VisitStmt(S);
John McCall3ce3d232019-12-13 03:37:23 -0500318 S->setBreakLoc(readSourceLocation());
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000319}
320
Sebastian Redl70c751d2010-08-18 23:56:52 +0000321void ASTStmtReader::VisitReturnStmt(ReturnStmt *S) {
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000322 VisitStmt(S);
Bruno Ricci023b1d12018-10-30 14:40:49 +0000323
324 bool HasNRVOCandidate = Record.readInt();
325
David L. Jonesb6a8f022016-12-21 04:34:52 +0000326 S->setRetValue(Record.readSubExpr());
Bruno Ricci023b1d12018-10-30 14:40:49 +0000327 if (HasNRVOCandidate)
John McCall3ce3d232019-12-13 03:37:23 -0500328 S->setNRVOCandidate(readDeclAs<VarDecl>());
Bruno Ricci023b1d12018-10-30 14:40:49 +0000329
John McCall3ce3d232019-12-13 03:37:23 -0500330 S->setReturnLoc(readSourceLocation());
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000331}
332
Sebastian Redl70c751d2010-08-18 23:56:52 +0000333void ASTStmtReader::VisitDeclStmt(DeclStmt *S) {
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000334 VisitStmt(S);
John McCall3ce3d232019-12-13 03:37:23 -0500335 S->setStartLoc(readSourceLocation());
336 S->setEndLoc(readSourceLocation());
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000337
David L. Jonesbe1557a2016-12-21 00:17:49 +0000338 if (Record.size() - Record.getIdx() == 1) {
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000339 // Single declaration
John McCall3ce3d232019-12-13 03:37:23 -0500340 S->setDeclGroup(DeclGroupRef(readDecl()));
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000341 } else {
Chris Lattner0e62c1c2011-07-23 10:55:15 +0000342 SmallVector<Decl *, 16> Decls;
David L. Jonesbe1557a2016-12-21 00:17:49 +0000343 int N = Record.size() - Record.getIdx();
344 Decls.reserve(N);
345 for (int I = 0; I < N; ++I)
John McCall3ce3d232019-12-13 03:37:23 -0500346 Decls.push_back(readDecl());
David L. Jonesc4808b9e2016-12-15 20:53:26 +0000347 S->setDeclGroup(DeclGroupRef(DeclGroup::Create(Record.getContext(),
Douglas Gregor038c3382009-05-22 22:45:36 +0000348 Decls.data(),
349 Decls.size())));
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000350 }
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000351}
352
John McCallf413f5e2013-05-03 00:10:13 +0000353void ASTStmtReader::VisitAsmStmt(AsmStmt *S) {
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000354 VisitStmt(S);
David L. Jonesbe1557a2016-12-21 00:17:49 +0000355 S->NumOutputs = Record.readInt();
356 S->NumInputs = Record.readInt();
357 S->NumClobbers = Record.readInt();
John McCall3ce3d232019-12-13 03:37:23 -0500358 S->setAsmLoc(readSourceLocation());
David L. Jonesbe1557a2016-12-21 00:17:49 +0000359 S->setVolatile(Record.readInt());
360 S->setSimple(Record.readInt());
John McCallf413f5e2013-05-03 00:10:13 +0000361}
Mike Stump11289f42009-09-09 15:08:12 +0000362
John McCallf413f5e2013-05-03 00:10:13 +0000363void ASTStmtReader::VisitGCCAsmStmt(GCCAsmStmt *S) {
364 VisitAsmStmt(S);
Jennifer Yub8fee672019-06-03 15:57:25 +0000365 S->NumLabels = Record.readInt();
John McCall3ce3d232019-12-13 03:37:23 -0500366 S->setRParenLoc(readSourceLocation());
David L. Jonesb6a8f022016-12-21 04:34:52 +0000367 S->setAsmString(cast_or_null<StringLiteral>(Record.readSubStmt()));
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000368
John McCallf413f5e2013-05-03 00:10:13 +0000369 unsigned NumOutputs = S->getNumOutputs();
370 unsigned NumInputs = S->getNumInputs();
371 unsigned NumClobbers = S->getNumClobbers();
Jennifer Yub8fee672019-06-03 15:57:25 +0000372 unsigned NumLabels = S->getNumLabels();
John McCallf413f5e2013-05-03 00:10:13 +0000373
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000374 // Outputs and inputs
Chris Lattner0e62c1c2011-07-23 10:55:15 +0000375 SmallVector<IdentifierInfo *, 16> Names;
376 SmallVector<StringLiteral*, 16> Constraints;
377 SmallVector<Stmt*, 16> Exprs;
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000378 for (unsigned I = 0, N = NumOutputs + NumInputs; I != N; ++I) {
John McCall3ce3d232019-12-13 03:37:23 -0500379 Names.push_back(Record.readIdentifier());
David L. Jonesb6a8f022016-12-21 04:34:52 +0000380 Constraints.push_back(cast_or_null<StringLiteral>(Record.readSubStmt()));
381 Exprs.push_back(Record.readSubStmt());
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000382 }
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000383
384 // Constraints
Chris Lattner0e62c1c2011-07-23 10:55:15 +0000385 SmallVector<StringLiteral*, 16> Clobbers;
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000386 for (unsigned I = 0; I != NumClobbers; ++I)
David L. Jonesb6a8f022016-12-21 04:34:52 +0000387 Clobbers.push_back(cast_or_null<StringLiteral>(Record.readSubStmt()));
Anders Carlsson96fe0b52010-01-30 19:34:25 +0000388
Jennifer Yub8fee672019-06-03 15:57:25 +0000389 // Labels
390 for (unsigned I = 0, N = NumLabels; I != N; ++I)
391 Exprs.push_back(Record.readSubStmt());
392
David L. Jonesc4808b9e2016-12-15 20:53:26 +0000393 S->setOutputsAndInputsAndClobbers(Record.getContext(),
394 Names.data(), Constraints.data(),
395 Exprs.data(), NumOutputs, NumInputs,
Jennifer Yub8fee672019-06-03 15:57:25 +0000396 NumLabels,
Anders Carlsson96fe0b52010-01-30 19:34:25 +0000397 Clobbers.data(), NumClobbers);
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000398}
399
Chad Rosier32503022012-06-11 20:47:18 +0000400void ASTStmtReader::VisitMSAsmStmt(MSAsmStmt *S) {
John McCallf413f5e2013-05-03 00:10:13 +0000401 VisitAsmStmt(S);
John McCall3ce3d232019-12-13 03:37:23 -0500402 S->LBraceLoc = readSourceLocation();
403 S->EndLoc = readSourceLocation();
David L. Jonesbe1557a2016-12-21 00:17:49 +0000404 S->NumAsmToks = Record.readInt();
John McCall3ce3d232019-12-13 03:37:23 -0500405 std::string AsmStr = readString();
John McCallf413f5e2013-05-03 00:10:13 +0000406
407 // Read the tokens.
408 SmallVector<Token, 16> AsmToks;
409 AsmToks.reserve(S->NumAsmToks);
410 for (unsigned i = 0, e = S->NumAsmToks; i != e; ++i) {
David L. Jonesb6a8f022016-12-21 04:34:52 +0000411 AsmToks.push_back(Record.readToken());
John McCallf413f5e2013-05-03 00:10:13 +0000412 }
413
414 // The calls to reserve() for the FooData vectors are mandatory to
415 // prevent dead StringRefs in the Foo vectors.
416
417 // Read the clobbers.
418 SmallVector<std::string, 16> ClobbersData;
419 SmallVector<StringRef, 16> Clobbers;
420 ClobbersData.reserve(S->NumClobbers);
421 Clobbers.reserve(S->NumClobbers);
422 for (unsigned i = 0, e = S->NumClobbers; i != e; ++i) {
John McCall3ce3d232019-12-13 03:37:23 -0500423 ClobbersData.push_back(readString());
John McCallf413f5e2013-05-03 00:10:13 +0000424 Clobbers.push_back(ClobbersData.back());
425 }
426
427 // Read the operands.
428 unsigned NumOperands = S->NumOutputs + S->NumInputs;
429 SmallVector<Expr*, 16> Exprs;
430 SmallVector<std::string, 16> ConstraintsData;
431 SmallVector<StringRef, 16> Constraints;
432 Exprs.reserve(NumOperands);
433 ConstraintsData.reserve(NumOperands);
434 Constraints.reserve(NumOperands);
435 for (unsigned i = 0; i != NumOperands; ++i) {
David L. Jonesb6a8f022016-12-21 04:34:52 +0000436 Exprs.push_back(cast<Expr>(Record.readSubStmt()));
John McCall3ce3d232019-12-13 03:37:23 -0500437 ConstraintsData.push_back(readString());
John McCallf413f5e2013-05-03 00:10:13 +0000438 Constraints.push_back(ConstraintsData.back());
439 }
440
David L. Jonesc4808b9e2016-12-15 20:53:26 +0000441 S->initialize(Record.getContext(), AsmStr, AsmToks,
John McCallf413f5e2013-05-03 00:10:13 +0000442 Constraints, Exprs, Clobbers);
Chad Rosier32503022012-06-11 20:47:18 +0000443}
444
Richard Smith9f690bd2015-10-27 06:02:45 +0000445void ASTStmtReader::VisitCoroutineBodyStmt(CoroutineBodyStmt *S) {
Gor Nishanovf5ecb5e2017-07-25 18:01:49 +0000446 VisitStmt(S);
447 assert(Record.peekInt() == S->NumParams);
448 Record.skipInts(1);
449 auto *StoredStmts = S->getStoredStmts();
450 for (unsigned i = 0;
451 i < CoroutineBodyStmt::SubStmt::FirstParamMove + S->NumParams; ++i)
452 StoredStmts[i] = Record.readSubStmt();
Richard Smith9f690bd2015-10-27 06:02:45 +0000453}
454
455void ASTStmtReader::VisitCoreturnStmt(CoreturnStmt *S) {
Gor Nishanovf5ecb5e2017-07-25 18:01:49 +0000456 VisitStmt(S);
457 S->CoreturnLoc = Record.readSourceLocation();
458 for (auto &SubStmt: S->SubStmts)
459 SubStmt = Record.readSubStmt();
460 S->IsImplicit = Record.readInt() != 0;
Richard Smith9f690bd2015-10-27 06:02:45 +0000461}
462
Gor Nishanovf5ecb5e2017-07-25 18:01:49 +0000463void ASTStmtReader::VisitCoawaitExpr(CoawaitExpr *E) {
464 VisitExpr(E);
John McCall3ce3d232019-12-13 03:37:23 -0500465 E->KeywordLoc = readSourceLocation();
Gor Nishanovf5ecb5e2017-07-25 18:01:49 +0000466 for (auto &SubExpr: E->SubExprs)
467 SubExpr = Record.readSubStmt();
468 E->OpaqueValue = cast_or_null<OpaqueValueExpr>(Record.readSubStmt());
469 E->setIsImplicit(Record.readInt() != 0);
Richard Smith9f690bd2015-10-27 06:02:45 +0000470}
471
Gor Nishanovf5ecb5e2017-07-25 18:01:49 +0000472void ASTStmtReader::VisitCoyieldExpr(CoyieldExpr *E) {
473 VisitExpr(E);
John McCall3ce3d232019-12-13 03:37:23 -0500474 E->KeywordLoc = readSourceLocation();
Gor Nishanovf5ecb5e2017-07-25 18:01:49 +0000475 for (auto &SubExpr: E->SubExprs)
476 SubExpr = Record.readSubStmt();
477 E->OpaqueValue = cast_or_null<OpaqueValueExpr>(Record.readSubStmt());
Eric Fiselier20f25cb2017-03-06 23:38:15 +0000478}
479
Gor Nishanovf5ecb5e2017-07-25 18:01:49 +0000480void ASTStmtReader::VisitDependentCoawaitExpr(DependentCoawaitExpr *E) {
481 VisitExpr(E);
John McCall3ce3d232019-12-13 03:37:23 -0500482 E->KeywordLoc = readSourceLocation();
Gor Nishanovf5ecb5e2017-07-25 18:01:49 +0000483 for (auto &SubExpr: E->SubExprs)
484 SubExpr = Record.readSubStmt();
Richard Smith9f690bd2015-10-27 06:02:45 +0000485}
486
Tareq A. Siraj24110cc2013-04-16 18:53:08 +0000487void ASTStmtReader::VisitCapturedStmt(CapturedStmt *S) {
Ben Langmuirce914fc2013-05-03 19:20:19 +0000488 VisitStmt(S);
David L. Jonesbe1557a2016-12-21 00:17:49 +0000489 Record.skipInts(1);
John McCall3ce3d232019-12-13 03:37:23 -0500490 S->setCapturedDecl(readDeclAs<CapturedDecl>());
David L. Jonesbe1557a2016-12-21 00:17:49 +0000491 S->setCapturedRegionKind(static_cast<CapturedRegionKind>(Record.readInt()));
John McCall3ce3d232019-12-13 03:37:23 -0500492 S->setCapturedRecordDecl(readDeclAs<RecordDecl>());
Ben Langmuirce914fc2013-05-03 19:20:19 +0000493
494 // Capture inits
495 for (CapturedStmt::capture_init_iterator I = S->capture_init_begin(),
496 E = S->capture_init_end();
497 I != E; ++I)
David L. Jonesb6a8f022016-12-21 04:34:52 +0000498 *I = Record.readSubExpr();
Ben Langmuirce914fc2013-05-03 19:20:19 +0000499
500 // Body
David L. Jonesb6a8f022016-12-21 04:34:52 +0000501 S->setCapturedStmt(Record.readSubStmt());
Wei Pan17fbf6e2013-05-04 03:59:06 +0000502 S->getCapturedDecl()->setBody(S->getCapturedStmt());
Ben Langmuirce914fc2013-05-03 19:20:19 +0000503
504 // Captures
Aaron Ballmanc656303a2014-03-14 18:08:33 +0000505 for (auto &I : S->captures()) {
John McCall3ce3d232019-12-13 03:37:23 -0500506 I.VarAndKind.setPointer(readDeclAs<VarDecl>());
David L. Jonesbe1557a2016-12-21 00:17:49 +0000507 I.VarAndKind.setInt(
508 static_cast<CapturedStmt::VariableCaptureKind>(Record.readInt()));
John McCall3ce3d232019-12-13 03:37:23 -0500509 I.Loc = readSourceLocation();
Ben Langmuirce914fc2013-05-03 19:20:19 +0000510 }
Tareq A. Siraj24110cc2013-04-16 18:53:08 +0000511}
512
Sebastian Redl70c751d2010-08-18 23:56:52 +0000513void ASTStmtReader::VisitExpr(Expr *E) {
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000514 VisitStmt(E);
David L. Jonesbe1557a2016-12-21 00:17:49 +0000515 E->setType(Record.readType());
Ilya Biryukovec3060c2020-03-02 16:07:09 +0100516
517 // FIXME: write and read all DependentFlags with a single call.
518 bool TypeDependent = Record.readInt();
519 bool ValueDependent = Record.readInt();
520 bool InstantiationDependent = Record.readInt();
521 bool ContainsUnexpandedTemplateParameters = Record.readInt();
Haojian Wu4b0f1e12020-03-17 10:36:19 +0100522 bool ContainsErrors = Record.readInt();
Ilya Biryukovec3060c2020-03-02 16:07:09 +0100523 auto Deps = ExprDependence::None;
524 if (TypeDependent)
525 Deps |= ExprDependence::Type;
526 if (ValueDependent)
527 Deps |= ExprDependence::Value;
528 if (InstantiationDependent)
529 Deps |= ExprDependence::Instantiation;
530 if (ContainsUnexpandedTemplateParameters)
531 Deps |= ExprDependence::UnexpandedPack;
Haojian Wu4b0f1e12020-03-17 10:36:19 +0100532 if (ContainsErrors)
533 Deps |= ExprDependence::Error;
Ilya Biryukovec3060c2020-03-02 16:07:09 +0100534 E->setDependence(Deps);
535
David L. Jonesbe1557a2016-12-21 00:17:49 +0000536 E->setValueKind(static_cast<ExprValueKind>(Record.readInt()));
537 E->setObjectKind(static_cast<ExprObjectKind>(Record.readInt()));
538 assert(Record.getIdx() == NumExprFields &&
539 "Incorrect expression field count");
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000540}
541
Bill Wendling7c44da22018-10-31 03:48:47 +0000542void ASTStmtReader::VisitConstantExpr(ConstantExpr *E) {
543 VisitExpr(E);
Gauthier Harnisch83c7b612019-06-15 10:24:47 +0000544 E->ConstantExprBits.ResultKind = Record.readInt();
545 switch (E->ConstantExprBits.ResultKind) {
546 case ConstantExpr::RSK_Int64: {
547 E->Int64Result() = Record.readInt();
548 uint64_t tmp = Record.readInt();
549 E->ConstantExprBits.IsUnsigned = tmp & 0x1;
550 E->ConstantExprBits.BitWidth = tmp >> 1;
551 break;
552 }
553 case ConstantExpr::RSK_APValue:
554 E->APValueResult() = Record.readAPValue();
555 }
Bill Wendling7c44da22018-10-31 03:48:47 +0000556 E->setSubExpr(Record.readSubExpr());
557}
558
Sebastian Redl70c751d2010-08-18 23:56:52 +0000559void ASTStmtReader::VisitPredefinedExpr(PredefinedExpr *E) {
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000560 VisitExpr(E);
Bruno Ricci17ff0262018-10-27 19:21:19 +0000561 bool HasFunctionName = Record.readInt();
562 E->PredefinedExprBits.HasFunctionName = HasFunctionName;
563 E->PredefinedExprBits.Kind = Record.readInt();
John McCall3ce3d232019-12-13 03:37:23 -0500564 E->setLocation(readSourceLocation());
Bruno Ricci17ff0262018-10-27 19:21:19 +0000565 if (HasFunctionName)
566 E->setFunctionName(cast<StringLiteral>(Record.readSubExpr()));
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000567}
568
Sebastian Redl70c751d2010-08-18 23:56:52 +0000569void ASTStmtReader::VisitDeclRefExpr(DeclRefExpr *E) {
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000570 VisitExpr(E);
Argyrios Kyrtzidis1985bb32010-07-08 13:09:47 +0000571
David L. Jonesbe1557a2016-12-21 00:17:49 +0000572 E->DeclRefExprBits.HasQualifier = Record.readInt();
573 E->DeclRefExprBits.HasFoundDecl = Record.readInt();
574 E->DeclRefExprBits.HasTemplateKWAndArgsInfo = Record.readInt();
575 E->DeclRefExprBits.HadMultipleCandidates = Record.readInt();
576 E->DeclRefExprBits.RefersToEnclosingVariableOrCapture = Record.readInt();
Richard Smith715f7a12019-06-11 17:50:32 +0000577 E->DeclRefExprBits.NonOdrUseReason = Record.readInt();
Anders Carlsson80756f62011-03-06 18:19:42 +0000578 unsigned NumTemplateArgs = 0;
Abramo Bagnara7945c982012-01-27 09:46:47 +0000579 if (E->hasTemplateKWAndArgsInfo())
David L. Jonesbe1557a2016-12-21 00:17:49 +0000580 NumTemplateArgs = Record.readInt();
Anders Carlsson80756f62011-03-06 18:19:42 +0000581
Chandler Carruth0e439962011-05-01 21:29:53 +0000582 if (E->hasQualifier())
James Y Knighte7d82282015-12-29 18:15:14 +0000583 new (E->getTrailingObjects<NestedNameSpecifierLoc>())
David L. Jonesb6a8f022016-12-21 04:34:52 +0000584 NestedNameSpecifierLoc(Record.readNestedNameSpecifierLoc());
Argyrios Kyrtzidis1985bb32010-07-08 13:09:47 +0000585
Chandler Carruth8d26bb02011-05-01 23:48:14 +0000586 if (E->hasFoundDecl())
John McCall3ce3d232019-12-13 03:37:23 -0500587 *E->getTrailingObjects<NamedDecl *>() = readDeclAs<NamedDecl>();
Chandler Carruth8d26bb02011-05-01 23:48:14 +0000588
Abramo Bagnara7945c982012-01-27 09:46:47 +0000589 if (E->hasTemplateKWAndArgsInfo())
James Y Knighte7d82282015-12-29 18:15:14 +0000590 ReadTemplateKWAndArgsInfo(
591 *E->getTrailingObjects<ASTTemplateKWAndArgsInfo>(),
592 E->getTrailingObjects<TemplateArgumentLoc>(), NumTemplateArgs);
Argyrios Kyrtzidis1985bb32010-07-08 13:09:47 +0000593
John McCall3ce3d232019-12-13 03:37:23 -0500594 E->setDecl(readDeclAs<ValueDecl>());
595 E->setLocation(readSourceLocation());
596 E->DNLoc = Record.readDeclarationNameLoc(E->getDecl()->getDeclName());
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000597}
598
Sebastian Redl70c751d2010-08-18 23:56:52 +0000599void ASTStmtReader::VisitIntegerLiteral(IntegerLiteral *E) {
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000600 VisitExpr(E);
John McCall3ce3d232019-12-13 03:37:23 -0500601 E->setLocation(readSourceLocation());
David L. Jonesb6a8f022016-12-21 04:34:52 +0000602 E->setValue(Record.getContext(), Record.readAPInt());
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000603}
604
Leonard Chandb01c3a2018-06-20 17:19:40 +0000605void ASTStmtReader::VisitFixedPointLiteral(FixedPointLiteral *E) {
606 VisitExpr(E);
John McCall3ce3d232019-12-13 03:37:23 -0500607 E->setLocation(readSourceLocation());
Leonard Chandb01c3a2018-06-20 17:19:40 +0000608 E->setValue(Record.getContext(), Record.readAPInt());
609}
610
Sebastian Redl70c751d2010-08-18 23:56:52 +0000611void ASTStmtReader::VisitFloatingLiteral(FloatingLiteral *E) {
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000612 VisitExpr(E);
Gauthier Harnisch83c7b612019-06-15 10:24:47 +0000613 E->setRawSemantics(
614 static_cast<llvm::APFloatBase::Semantics>(Record.readInt()));
David L. Jonesbe1557a2016-12-21 00:17:49 +0000615 E->setExact(Record.readInt());
David L. Jonesb6a8f022016-12-21 04:34:52 +0000616 E->setValue(Record.getContext(), Record.readAPFloat(E->getSemantics()));
John McCall3ce3d232019-12-13 03:37:23 -0500617 E->setLocation(readSourceLocation());
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000618}
619
Sebastian Redl70c751d2010-08-18 23:56:52 +0000620void ASTStmtReader::VisitImaginaryLiteral(ImaginaryLiteral *E) {
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000621 VisitExpr(E);
David L. Jonesb6a8f022016-12-21 04:34:52 +0000622 E->setSubExpr(Record.readSubExpr());
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000623}
624
Sebastian Redl70c751d2010-08-18 23:56:52 +0000625void ASTStmtReader::VisitStringLiteral(StringLiteral *E) {
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000626 VisitExpr(E);
Bruno Riccib94ad1e2018-11-15 17:31:16 +0000627
628 // NumConcatenated, Length and CharByteWidth are set by the empty
629 // ctor since they are needed to allocate storage for the trailing objects.
630 unsigned NumConcatenated = Record.readInt();
631 unsigned Length = Record.readInt();
632 unsigned CharByteWidth = Record.readInt();
633 assert((NumConcatenated == E->getNumConcatenated()) &&
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000634 "Wrong number of concatenated tokens!");
Bruno Riccib94ad1e2018-11-15 17:31:16 +0000635 assert((Length == E->getLength()) && "Wrong Length!");
636 assert((CharByteWidth == E->getCharByteWidth()) && "Wrong character width!");
637 E->StringLiteralBits.Kind = Record.readInt();
638 E->StringLiteralBits.IsPascal = Record.readInt();
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000639
Bruno Riccib94ad1e2018-11-15 17:31:16 +0000640 // The character width is originally computed via mapCharByteWidth.
641 // Check that the deserialized character width is consistant with the result
642 // of calling mapCharByteWidth.
643 assert((CharByteWidth ==
644 StringLiteral::mapCharByteWidth(Record.getContext().getTargetInfo(),
645 E->getKind())) &&
646 "Wrong character width!");
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000647
Bruno Riccib94ad1e2018-11-15 17:31:16 +0000648 // Deserialize the trailing array of SourceLocation.
649 for (unsigned I = 0; I < NumConcatenated; ++I)
John McCall3ce3d232019-12-13 03:37:23 -0500650 E->setStrTokenLoc(I, readSourceLocation());
Bruno Riccib94ad1e2018-11-15 17:31:16 +0000651
652 // Deserialize the trailing array of char holding the string data.
653 char *StrData = E->getStrDataAsChar();
654 for (unsigned I = 0; I < Length * CharByteWidth; ++I)
655 StrData[I] = Record.readInt();
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000656}
657
Sebastian Redl70c751d2010-08-18 23:56:52 +0000658void ASTStmtReader::VisitCharacterLiteral(CharacterLiteral *E) {
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000659 VisitExpr(E);
David L. Jonesbe1557a2016-12-21 00:17:49 +0000660 E->setValue(Record.readInt());
John McCall3ce3d232019-12-13 03:37:23 -0500661 E->setLocation(readSourceLocation());
David L. Jonesbe1557a2016-12-21 00:17:49 +0000662 E->setKind(static_cast<CharacterLiteral::CharacterKind>(Record.readInt()));
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000663}
664
Sebastian Redl70c751d2010-08-18 23:56:52 +0000665void ASTStmtReader::VisitParenExpr(ParenExpr *E) {
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000666 VisitExpr(E);
John McCall3ce3d232019-12-13 03:37:23 -0500667 E->setLParen(readSourceLocation());
668 E->setRParen(readSourceLocation());
David L. Jonesb6a8f022016-12-21 04:34:52 +0000669 E->setSubExpr(Record.readSubExpr());
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000670}
671
Sebastian Redl70c751d2010-08-18 23:56:52 +0000672void ASTStmtReader::VisitParenListExpr(ParenListExpr *E) {
Argyrios Kyrtzidisf9f47c82010-06-30 08:49:18 +0000673 VisitExpr(E);
David L. Jonesbe1557a2016-12-21 00:17:49 +0000674 unsigned NumExprs = Record.readInt();
Bruno Riccif49e1ca2018-11-20 16:20:40 +0000675 assert((NumExprs == E->getNumExprs()) && "Wrong NumExprs!");
676 for (unsigned I = 0; I != NumExprs; ++I)
677 E->getTrailingObjects<Stmt *>()[I] = Record.readSubStmt();
John McCall3ce3d232019-12-13 03:37:23 -0500678 E->LParenLoc = readSourceLocation();
679 E->RParenLoc = readSourceLocation();
Argyrios Kyrtzidisf9f47c82010-06-30 08:49:18 +0000680}
681
Sebastian Redl70c751d2010-08-18 23:56:52 +0000682void ASTStmtReader::VisitUnaryOperator(UnaryOperator *E) {
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000683 VisitExpr(E);
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +0000684 E->setSubExpr(Record.readSubExpr());
685 E->setOpcode((UnaryOperator::Opcode)Record.readInt());
John McCall3ce3d232019-12-13 03:37:23 -0500686 E->setOperatorLoc(readSourceLocation());
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +0000687 E->setCanOverflow(Record.readInt());
688}
689
690void ASTStmtReader::VisitOffsetOfExpr(OffsetOfExpr *E) {
Douglas Gregor882211c2010-04-28 22:16:22 +0000691 VisitExpr(E);
David L. Jonesbe1557a2016-12-21 00:17:49 +0000692 assert(E->getNumComponents() == Record.peekInt());
693 Record.skipInts(1);
694 assert(E->getNumExpressions() == Record.peekInt());
695 Record.skipInts(1);
John McCall3ce3d232019-12-13 03:37:23 -0500696 E->setOperatorLoc(readSourceLocation());
697 E->setRParenLoc(readSourceLocation());
698 E->setTypeSourceInfo(readTypeSourceInfo());
Douglas Gregor882211c2010-04-28 22:16:22 +0000699 for (unsigned I = 0, N = E->getNumComponents(); I != N; ++I) {
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +0000700 auto Kind = static_cast<OffsetOfNode::Kind>(Record.readInt());
John McCall3ce3d232019-12-13 03:37:23 -0500701 SourceLocation Start = readSourceLocation();
702 SourceLocation End = readSourceLocation();
Douglas Gregor882211c2010-04-28 22:16:22 +0000703 switch (Kind) {
James Y Knight7281c352015-12-29 22:31:18 +0000704 case OffsetOfNode::Array:
David L. Jonesbe1557a2016-12-21 00:17:49 +0000705 E->setComponent(I, OffsetOfNode(Start, Record.readInt(), End));
Douglas Gregor882211c2010-04-28 22:16:22 +0000706 break;
707
James Y Knight7281c352015-12-29 22:31:18 +0000708 case OffsetOfNode::Field:
709 E->setComponent(
John McCall3ce3d232019-12-13 03:37:23 -0500710 I, OffsetOfNode(Start, readDeclAs<FieldDecl>(), End));
Douglas Gregor882211c2010-04-28 22:16:22 +0000711 break;
James Y Knight7281c352015-12-29 22:31:18 +0000712
713 case OffsetOfNode::Identifier:
714 E->setComponent(
715 I,
John McCall3ce3d232019-12-13 03:37:23 -0500716 OffsetOfNode(Start, Record.readIdentifier(), End));
James Y Knight7281c352015-12-29 22:31:18 +0000717 break;
718
719 case OffsetOfNode::Base: {
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +0000720 auto *Base = new (Record.getContext()) CXXBaseSpecifier();
David L. Jonesb6a8f022016-12-21 04:34:52 +0000721 *Base = Record.readCXXBaseSpecifier();
James Y Knight7281c352015-12-29 22:31:18 +0000722 E->setComponent(I, OffsetOfNode(Base));
Douglas Gregord1702062010-04-29 00:18:15 +0000723 break;
Douglas Gregor882211c2010-04-28 22:16:22 +0000724 }
Argyrios Kyrtzidisd67d4cc2010-07-29 18:16:10 +0000725 }
Douglas Gregor882211c2010-04-28 22:16:22 +0000726 }
David L. Jonesc4808b9e2016-12-15 20:53:26 +0000727
Douglas Gregor882211c2010-04-28 22:16:22 +0000728 for (unsigned I = 0, N = E->getNumExpressions(); I != N; ++I)
David L. Jonesb6a8f022016-12-21 04:34:52 +0000729 E->setIndexExpr(I, Record.readSubExpr());
Douglas Gregor882211c2010-04-28 22:16:22 +0000730}
731
Peter Collingbournee190dee2011-03-11 19:24:49 +0000732void ASTStmtReader::VisitUnaryExprOrTypeTraitExpr(UnaryExprOrTypeTraitExpr *E) {
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000733 VisitExpr(E);
David L. Jonesbe1557a2016-12-21 00:17:49 +0000734 E->setKind(static_cast<UnaryExprOrTypeTrait>(Record.readInt()));
735 if (Record.peekInt() == 0) {
David L. Jonesb6a8f022016-12-21 04:34:52 +0000736 E->setArgument(Record.readSubExpr());
David L. Jonesbe1557a2016-12-21 00:17:49 +0000737 Record.skipInts(1);
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000738 } else {
John McCall3ce3d232019-12-13 03:37:23 -0500739 E->setArgument(readTypeSourceInfo());
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000740 }
John McCall3ce3d232019-12-13 03:37:23 -0500741 E->setOperatorLoc(readSourceLocation());
742 E->setRParenLoc(readSourceLocation());
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000743}
744
Saar Raza0f50d72020-01-18 09:11:43 +0200745static ConstraintSatisfaction
746readConstraintSatisfaction(ASTRecordReader &Record) {
747 ConstraintSatisfaction Satisfaction;
748 Satisfaction.IsSatisfied = Record.readInt();
749 if (!Satisfaction.IsSatisfied) {
750 unsigned NumDetailRecords = Record.readInt();
751 for (unsigned i = 0; i != NumDetailRecords; ++i) {
752 Expr *ConstraintExpr = Record.readExpr();
Michael Liao70b53a302020-01-19 12:23:11 -0500753 if (/* IsDiagnostic */Record.readInt()) {
Saar Raza0f50d72020-01-18 09:11:43 +0200754 SourceLocation DiagLocation = Record.readSourceLocation();
755 std::string DiagMessage = Record.readString();
756 Satisfaction.Details.emplace_back(
757 ConstraintExpr, new (Record.getContext())
758 ConstraintSatisfaction::SubstitutionDiagnostic{
759 DiagLocation, DiagMessage});
760 } else
761 Satisfaction.Details.emplace_back(ConstraintExpr, Record.readExpr());
762 }
763 }
764 return Satisfaction;
765}
766
Saar Raz5d98ba62019-10-15 15:24:26 +0000767void ASTStmtReader::VisitConceptSpecializationExpr(
768 ConceptSpecializationExpr *E) {
769 VisitExpr(E);
770 unsigned NumTemplateArgs = Record.readInt();
771 E->NestedNameSpec = Record.readNestedNameSpecifierLoc();
772 E->TemplateKWLoc = Record.readSourceLocation();
Saar Razff1e0fc2020-01-15 02:48:42 +0200773 E->ConceptName = Record.readDeclarationNameInfo();
John McCall3ce3d232019-12-13 03:37:23 -0500774 E->NamedConcept = readDeclAs<ConceptDecl>();
Saar Razf9e63892020-03-10 22:04:11 +0200775 E->FoundDecl = Record.readDeclAs<NamedDecl>();
Saar Razff1e0fc2020-01-15 02:48:42 +0200776 E->ArgsAsWritten = Record.readASTTemplateArgumentListInfo();
Saar Raz5d98ba62019-10-15 15:24:26 +0000777 llvm::SmallVector<TemplateArgument, 4> Args;
778 for (unsigned I = 0; I < NumTemplateArgs; ++I)
779 Args.push_back(Record.readTemplateArgument());
Saar Razff1e0fc2020-01-15 02:48:42 +0200780 E->setTemplateArguments(Args);
Saar Raza0f50d72020-01-18 09:11:43 +0200781 E->Satisfaction = E->isValueDependent() ? nullptr :
782 ASTConstraintSatisfaction::Create(Record.getContext(),
783 readConstraintSatisfaction(Record));
784}
785
786static concepts::Requirement::SubstitutionDiagnostic *
787readSubstitutionDiagnostic(ASTRecordReader &Record) {
788 std::string SubstitutedEntity = Record.readString();
789 SourceLocation DiagLoc = Record.readSourceLocation();
790 std::string DiagMessage = Record.readString();
791 return new (Record.getContext())
792 concepts::Requirement::SubstitutionDiagnostic{SubstitutedEntity, DiagLoc,
793 DiagMessage};
794}
795
796void ASTStmtReader::VisitRequiresExpr(RequiresExpr *E) {
797 VisitExpr(E);
798 unsigned NumLocalParameters = Record.readInt();
799 unsigned NumRequirements = Record.readInt();
800 E->RequiresExprBits.RequiresKWLoc = Record.readSourceLocation();
801 E->RequiresExprBits.IsSatisfied = Record.readInt();
802 E->Body = Record.readDeclAs<RequiresExprBodyDecl>();
803 llvm::SmallVector<ParmVarDecl *, 4> LocalParameters;
804 for (unsigned i = 0; i < NumLocalParameters; ++i)
805 LocalParameters.push_back(cast<ParmVarDecl>(Record.readDecl()));
806 std::copy(LocalParameters.begin(), LocalParameters.end(),
807 E->getTrailingObjects<ParmVarDecl *>());
808 llvm::SmallVector<concepts::Requirement *, 4> Requirements;
809 for (unsigned i = 0; i < NumRequirements; ++i) {
810 auto RK =
811 static_cast<concepts::Requirement::RequirementKind>(Record.readInt());
812 concepts::Requirement *R = nullptr;
813 switch (RK) {
814 case concepts::Requirement::RK_Type: {
815 auto Status =
816 static_cast<concepts::TypeRequirement::SatisfactionStatus>(
817 Record.readInt());
818 if (Status == concepts::TypeRequirement::SS_SubstitutionFailure)
819 R = new (Record.getContext())
820 concepts::TypeRequirement(readSubstitutionDiagnostic(Record));
821 else
822 R = new (Record.getContext())
823 concepts::TypeRequirement(Record.readTypeSourceInfo());
824 } break;
825 case concepts::Requirement::RK_Simple:
826 case concepts::Requirement::RK_Compound: {
827 auto Status =
828 static_cast<concepts::ExprRequirement::SatisfactionStatus>(
829 Record.readInt());
830 llvm::PointerUnion<concepts::Requirement::SubstitutionDiagnostic *,
831 Expr *> E;
832 if (Status == concepts::ExprRequirement::SS_ExprSubstitutionFailure) {
833 E = readSubstitutionDiagnostic(Record);
834 } else
835 E = Record.readExpr();
836
837 llvm::Optional<concepts::ExprRequirement::ReturnTypeRequirement> Req;
838 ConceptSpecializationExpr *SubstitutedConstraintExpr = nullptr;
839 SourceLocation NoexceptLoc;
840 if (RK == concepts::Requirement::RK_Simple) {
841 Req.emplace();
842 } else {
843 NoexceptLoc = Record.readSourceLocation();
Michael Liao70b53a302020-01-19 12:23:11 -0500844 switch (/* returnTypeRequirementKind */Record.readInt()) {
Saar Raza0f50d72020-01-18 09:11:43 +0200845 case 0:
846 // No return type requirement.
847 Req.emplace();
848 break;
849 case 1: {
850 // type-constraint
851 TemplateParameterList *TPL = Record.readTemplateParameterList();
852 if (Status >=
853 concepts::ExprRequirement::SS_ConstraintsNotSatisfied)
854 SubstitutedConstraintExpr =
855 cast<ConceptSpecializationExpr>(Record.readExpr());
856 Req.emplace(TPL);
857 } break;
858 case 2:
859 // Substitution failure
860 Req.emplace(readSubstitutionDiagnostic(Record));
861 break;
862 }
863 }
864 if (Expr *Ex = E.dyn_cast<Expr *>())
865 R = new (Record.getContext()) concepts::ExprRequirement(
866 Ex, RK == concepts::Requirement::RK_Simple, NoexceptLoc,
867 std::move(*Req), Status, SubstitutedConstraintExpr);
868 else
869 R = new (Record.getContext()) concepts::ExprRequirement(
870 E.get<concepts::Requirement::SubstitutionDiagnostic *>(),
871 RK == concepts::Requirement::RK_Simple, NoexceptLoc,
872 std::move(*Req));
873 } break;
874 case concepts::Requirement::RK_Nested: {
Michael Liao70b53a302020-01-19 12:23:11 -0500875 if (/* IsSubstitutionDiagnostic */Record.readInt()) {
Saar Raza0f50d72020-01-18 09:11:43 +0200876 R = new (Record.getContext()) concepts::NestedRequirement(
877 readSubstitutionDiagnostic(Record));
878 break;
879 }
880 Expr *E = Record.readExpr();
881 if (E->isInstantiationDependent())
882 R = new (Record.getContext()) concepts::NestedRequirement(E);
883 else
884 R = new (Record.getContext())
885 concepts::NestedRequirement(Record.getContext(), E,
886 readConstraintSatisfaction(Record));
887 } break;
Saar Razfdf80e82019-12-06 01:30:21 +0200888 }
Saar Raza0f50d72020-01-18 09:11:43 +0200889 if (!R)
890 continue;
891 Requirements.push_back(R);
Saar Razfdf80e82019-12-06 01:30:21 +0200892 }
Saar Raza0f50d72020-01-18 09:11:43 +0200893 std::copy(Requirements.begin(), Requirements.end(),
894 E->getTrailingObjects<concepts::Requirement *>());
895 E->RBraceLoc = Record.readSourceLocation();
Saar Raz5d98ba62019-10-15 15:24:26 +0000896}
897
Sebastian Redl70c751d2010-08-18 23:56:52 +0000898void ASTStmtReader::VisitArraySubscriptExpr(ArraySubscriptExpr *E) {
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000899 VisitExpr(E);
David L. Jonesb6a8f022016-12-21 04:34:52 +0000900 E->setLHS(Record.readSubExpr());
901 E->setRHS(Record.readSubExpr());
John McCall3ce3d232019-12-13 03:37:23 -0500902 E->setRBracketLoc(readSourceLocation());
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000903}
904
Alexey Bataev1a3320e2015-08-25 14:24:04 +0000905void ASTStmtReader::VisitOMPArraySectionExpr(OMPArraySectionExpr *E) {
906 VisitExpr(E);
David L. Jonesb6a8f022016-12-21 04:34:52 +0000907 E->setBase(Record.readSubExpr());
908 E->setLowerBound(Record.readSubExpr());
909 E->setLength(Record.readSubExpr());
John McCall3ce3d232019-12-13 03:37:23 -0500910 E->setColonLoc(readSourceLocation());
911 E->setRBracketLoc(readSourceLocation());
Alexey Bataev1a3320e2015-08-25 14:24:04 +0000912}
913
Alexey Bataev7ac9efb2020-02-05 09:33:05 -0500914void ASTStmtReader::VisitOMPArrayShapingExpr(OMPArrayShapingExpr *E) {
915 VisitExpr(E);
916 unsigned NumDims = Record.readInt();
917 E->setBase(Record.readSubExpr());
918 SmallVector<Expr *, 4> Dims(NumDims);
919 for (unsigned I = 0; I < NumDims; ++I)
920 Dims[I] = Record.readSubExpr();
921 E->setDimensions(Dims);
922 SmallVector<SourceRange, 4> SRs(NumDims);
923 for (unsigned I = 0; I < NumDims; ++I)
924 SRs[I] = readSourceRange();
925 E->setBracketsRanges(SRs);
926 E->setLParenLoc(readSourceLocation());
927 E->setRParenLoc(readSourceLocation());
928}
929
Alexey Bataev13a15042020-04-01 15:06:38 -0400930void ASTStmtReader::VisitOMPIteratorExpr(OMPIteratorExpr *E) {
931 VisitExpr(E);
932 unsigned NumIters = Record.readInt();
933 E->setIteratorKwLoc(readSourceLocation());
934 E->setLParenLoc(readSourceLocation());
935 E->setRParenLoc(readSourceLocation());
936 for (unsigned I = 0; I < NumIters; ++I) {
937 E->setIteratorDeclaration(I, Record.readDeclRef());
938 E->setAssignmentLoc(I, readSourceLocation());
939 Expr *Begin = Record.readSubExpr();
940 Expr *End = Record.readSubExpr();
941 Expr *Step = Record.readSubExpr();
942 SourceLocation ColonLoc = readSourceLocation();
943 SourceLocation SecColonLoc;
944 if (Step)
945 SecColonLoc = readSourceLocation();
946 E->setIteratorRange(I, Begin, ColonLoc, End, SecColonLoc, Step);
Alexey Bataevbe99c612020-04-06 11:21:43 -0400947 // Deserialize helpers
948 OMPIteratorHelperData HD;
949 HD.CounterVD = cast_or_null<VarDecl>(Record.readDeclRef());
950 HD.Upper = Record.readSubExpr();
951 HD.Update = Record.readSubExpr();
952 HD.CounterUpdate = Record.readSubExpr();
953 E->setHelper(I, HD);
Alexey Bataev13a15042020-04-01 15:06:38 -0400954 }
955}
956
Sebastian Redl70c751d2010-08-18 23:56:52 +0000957void ASTStmtReader::VisitCallExpr(CallExpr *E) {
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000958 VisitExpr(E);
Bruno Ricci4c9a0192018-12-03 14:54:03 +0000959 unsigned NumArgs = Record.readInt();
960 assert((NumArgs == E->getNumArgs()) && "Wrong NumArgs!");
John McCall3ce3d232019-12-13 03:37:23 -0500961 E->setRParenLoc(readSourceLocation());
David L. Jonesb6a8f022016-12-21 04:34:52 +0000962 E->setCallee(Record.readSubExpr());
Bruno Ricci4c9a0192018-12-03 14:54:03 +0000963 for (unsigned I = 0; I != NumArgs; ++I)
David L. Jonesb6a8f022016-12-21 04:34:52 +0000964 E->setArg(I, Record.readSubExpr());
Eric Fiselier5cdc2cd2018-12-12 21:50:55 +0000965 E->setADLCallKind(static_cast<CallExpr::ADLCallKind>(Record.readInt()));
Chris Lattner92ba5ff2009-04-27 05:14:47 +0000966}
967
John McCallfa194042011-07-15 07:00:14 +0000968void ASTStmtReader::VisitCXXMemberCallExpr(CXXMemberCallExpr *E) {
969 VisitCallExpr(E);
970}
971
Sebastian Redl70c751d2010-08-18 23:56:52 +0000972void ASTStmtReader::VisitMemberExpr(MemberExpr *E) {
Richard Smithdcf17de2019-06-06 23:24:15 +0000973 VisitExpr(E);
974
975 bool HasQualifier = Record.readInt();
976 bool HasFoundDecl = Record.readInt();
977 bool HasTemplateInfo = Record.readInt();
978 unsigned NumTemplateArgs = Record.readInt();
979
980 E->Base = Record.readSubExpr();
981 E->MemberDecl = Record.readDeclAs<ValueDecl>();
John McCall3ce3d232019-12-13 03:37:23 -0500982 E->MemberDNLoc = Record.readDeclarationNameLoc(E->MemberDecl->getDeclName());
Richard Smithdcf17de2019-06-06 23:24:15 +0000983 E->MemberLoc = Record.readSourceLocation();
984 E->MemberExprBits.IsArrow = Record.readInt();
985 E->MemberExprBits.HasQualifierOrFoundDecl = HasQualifier || HasFoundDecl;
986 E->MemberExprBits.HasTemplateKWAndArgsInfo = HasTemplateInfo;
987 E->MemberExprBits.HadMultipleCandidates = Record.readInt();
Richard Smith1bbad592019-06-11 17:50:36 +0000988 E->MemberExprBits.NonOdrUseReason = Record.readInt();
Richard Smithdcf17de2019-06-06 23:24:15 +0000989 E->MemberExprBits.OperatorLoc = Record.readSourceLocation();
990
991 if (HasQualifier || HasFoundDecl) {
992 DeclAccessPair FoundDecl;
993 if (HasFoundDecl) {
994 auto *FoundD = Record.readDeclAs<NamedDecl>();
995 auto AS = (AccessSpecifier)Record.readInt();
996 FoundDecl = DeclAccessPair::make(FoundD, AS);
997 } else {
998 FoundDecl = DeclAccessPair::make(E->MemberDecl,
999 E->MemberDecl->getAccess());
1000 }
1001 E->getTrailingObjects<MemberExprNameQualifier>()->FoundDecl = FoundDecl;
1002
1003 NestedNameSpecifierLoc QualifierLoc;
1004 if (HasQualifier)
1005 QualifierLoc = Record.readNestedNameSpecifierLoc();
1006 E->getTrailingObjects<MemberExprNameQualifier>()->QualifierLoc =
1007 QualifierLoc;
1008 }
1009
1010 if (HasTemplateInfo)
1011 ReadTemplateKWAndArgsInfo(
1012 *E->getTrailingObjects<ASTTemplateKWAndArgsInfo>(),
1013 E->getTrailingObjects<TemplateArgumentLoc>(), NumTemplateArgs);
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001014}
1015
Sebastian Redl70c751d2010-08-18 23:56:52 +00001016void ASTStmtReader::VisitObjCIsaExpr(ObjCIsaExpr *E) {
Steve Naroffe87026a2009-07-24 17:54:45 +00001017 VisitExpr(E);
David L. Jonesb6a8f022016-12-21 04:34:52 +00001018 E->setBase(Record.readSubExpr());
John McCall3ce3d232019-12-13 03:37:23 -05001019 E->setIsaMemberLoc(readSourceLocation());
1020 E->setOpLoc(readSourceLocation());
David L. Jonesbe1557a2016-12-21 00:17:49 +00001021 E->setArrow(Record.readInt());
Steve Naroffe87026a2009-07-24 17:54:45 +00001022}
1023
John McCall31168b02011-06-15 23:02:42 +00001024void ASTStmtReader::
1025VisitObjCIndirectCopyRestoreExpr(ObjCIndirectCopyRestoreExpr *E) {
1026 VisitExpr(E);
David L. Jonesb6a8f022016-12-21 04:34:52 +00001027 E->Operand = Record.readSubExpr();
David L. Jonesbe1557a2016-12-21 00:17:49 +00001028 E->setShouldCopy(Record.readInt());
John McCall31168b02011-06-15 23:02:42 +00001029}
1030
1031void ASTStmtReader::VisitObjCBridgedCastExpr(ObjCBridgedCastExpr *E) {
1032 VisitExplicitCastExpr(E);
John McCall3ce3d232019-12-13 03:37:23 -05001033 E->LParenLoc = readSourceLocation();
1034 E->BridgeKeywordLoc = readSourceLocation();
David L. Jonesbe1557a2016-12-21 00:17:49 +00001035 E->Kind = Record.readInt();
John McCall31168b02011-06-15 23:02:42 +00001036}
1037
Sebastian Redl70c751d2010-08-18 23:56:52 +00001038void ASTStmtReader::VisitCastExpr(CastExpr *E) {
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001039 VisitExpr(E);
David L. Jonesbe1557a2016-12-21 00:17:49 +00001040 unsigned NumBaseSpecs = Record.readInt();
John McCallcf142162010-08-07 06:22:56 +00001041 assert(NumBaseSpecs == E->path_size());
David L. Jonesb6a8f022016-12-21 04:34:52 +00001042 E->setSubExpr(Record.readSubExpr());
David L. Jonesbe1557a2016-12-21 00:17:49 +00001043 E->setCastKind((CastKind)Record.readInt());
John McCallcf142162010-08-07 06:22:56 +00001044 CastExpr::path_iterator BaseI = E->path_begin();
Argyrios Kyrtzidis3701fcd2010-07-02 23:30:27 +00001045 while (NumBaseSpecs--) {
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +00001046 auto *BaseSpec = new (Record.getContext()) CXXBaseSpecifier;
David L. Jonesb6a8f022016-12-21 04:34:52 +00001047 *BaseSpec = Record.readCXXBaseSpecifier();
John McCallcf142162010-08-07 06:22:56 +00001048 *BaseI++ = BaseSpec;
Argyrios Kyrtzidis3701fcd2010-07-02 23:30:27 +00001049 }
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001050}
1051
Sebastian Redl70c751d2010-08-18 23:56:52 +00001052void ASTStmtReader::VisitBinaryOperator(BinaryOperator *E) {
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001053 VisitExpr(E);
David L. Jonesb6a8f022016-12-21 04:34:52 +00001054 E->setLHS(Record.readSubExpr());
1055 E->setRHS(Record.readSubExpr());
David L. Jonesbe1557a2016-12-21 00:17:49 +00001056 E->setOpcode((BinaryOperator::Opcode)Record.readInt());
John McCall3ce3d232019-12-13 03:37:23 -05001057 E->setOperatorLoc(readSourceLocation());
Adam Nemet484aa452017-03-27 19:17:25 +00001058 E->setFPFeatures(FPOptions(Record.readInt()));
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001059}
1060
Sebastian Redl70c751d2010-08-18 23:56:52 +00001061void ASTStmtReader::VisitCompoundAssignOperator(CompoundAssignOperator *E) {
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001062 VisitBinaryOperator(E);
David L. Jonesbe1557a2016-12-21 00:17:49 +00001063 E->setComputationLHSType(Record.readType());
1064 E->setComputationResultType(Record.readType());
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001065}
1066
Sebastian Redl70c751d2010-08-18 23:56:52 +00001067void ASTStmtReader::VisitConditionalOperator(ConditionalOperator *E) {
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001068 VisitExpr(E);
David L. Jonesb6a8f022016-12-21 04:34:52 +00001069 E->SubExprs[ConditionalOperator::COND] = Record.readSubExpr();
1070 E->SubExprs[ConditionalOperator::LHS] = Record.readSubExpr();
1071 E->SubExprs[ConditionalOperator::RHS] = Record.readSubExpr();
John McCall3ce3d232019-12-13 03:37:23 -05001072 E->QuestionLoc = readSourceLocation();
1073 E->ColonLoc = readSourceLocation();
John McCallc07a0c72011-02-17 10:25:35 +00001074}
1075
1076void
1077ASTStmtReader::VisitBinaryConditionalOperator(BinaryConditionalOperator *E) {
1078 VisitExpr(E);
David L. Jonesb6a8f022016-12-21 04:34:52 +00001079 E->OpaqueValue = cast<OpaqueValueExpr>(Record.readSubExpr());
1080 E->SubExprs[BinaryConditionalOperator::COMMON] = Record.readSubExpr();
1081 E->SubExprs[BinaryConditionalOperator::COND] = Record.readSubExpr();
1082 E->SubExprs[BinaryConditionalOperator::LHS] = Record.readSubExpr();
1083 E->SubExprs[BinaryConditionalOperator::RHS] = Record.readSubExpr();
John McCall3ce3d232019-12-13 03:37:23 -05001084 E->QuestionLoc = readSourceLocation();
1085 E->ColonLoc = readSourceLocation();
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001086}
1087
Sebastian Redl70c751d2010-08-18 23:56:52 +00001088void ASTStmtReader::VisitImplicitCastExpr(ImplicitCastExpr *E) {
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001089 VisitCastExpr(E);
Roman Lebedev12216f12018-07-27 07:27:14 +00001090 E->setIsPartOfExplicitCast(Record.readInt());
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001091}
1092
Sebastian Redl70c751d2010-08-18 23:56:52 +00001093void ASTStmtReader::VisitExplicitCastExpr(ExplicitCastExpr *E) {
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001094 VisitCastExpr(E);
John McCall3ce3d232019-12-13 03:37:23 -05001095 E->setTypeInfoAsWritten(readTypeSourceInfo());
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001096}
1097
Sebastian Redl70c751d2010-08-18 23:56:52 +00001098void ASTStmtReader::VisitCStyleCastExpr(CStyleCastExpr *E) {
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001099 VisitExplicitCastExpr(E);
John McCall3ce3d232019-12-13 03:37:23 -05001100 E->setLParenLoc(readSourceLocation());
1101 E->setRParenLoc(readSourceLocation());
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001102}
1103
Sebastian Redl70c751d2010-08-18 23:56:52 +00001104void ASTStmtReader::VisitCompoundLiteralExpr(CompoundLiteralExpr *E) {
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001105 VisitExpr(E);
John McCall3ce3d232019-12-13 03:37:23 -05001106 E->setLParenLoc(readSourceLocation());
1107 E->setTypeSourceInfo(readTypeSourceInfo());
David L. Jonesb6a8f022016-12-21 04:34:52 +00001108 E->setInitializer(Record.readSubExpr());
David L. Jonesbe1557a2016-12-21 00:17:49 +00001109 E->setFileScope(Record.readInt());
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001110}
1111
Sebastian Redl70c751d2010-08-18 23:56:52 +00001112void ASTStmtReader::VisitExtVectorElementExpr(ExtVectorElementExpr *E) {
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001113 VisitExpr(E);
David L. Jonesb6a8f022016-12-21 04:34:52 +00001114 E->setBase(Record.readSubExpr());
John McCall3ce3d232019-12-13 03:37:23 -05001115 E->setAccessor(Record.readIdentifier());
1116 E->setAccessorLoc(readSourceLocation());
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001117}
1118
Sebastian Redl70c751d2010-08-18 23:56:52 +00001119void ASTStmtReader::VisitInitListExpr(InitListExpr *E) {
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001120 VisitExpr(E);
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +00001121 if (auto *SyntForm = cast_or_null<InitListExpr>(Record.readSubStmt()))
Abramo Bagnara8d16bd42012-11-08 18:41:43 +00001122 E->setSyntacticForm(SyntForm);
John McCall3ce3d232019-12-13 03:37:23 -05001123 E->setLBraceLoc(readSourceLocation());
1124 E->setRBraceLoc(readSourceLocation());
David L. Jonesbe1557a2016-12-21 00:17:49 +00001125 bool isArrayFiller = Record.readInt();
Craig Toppera13603a2014-05-22 05:54:18 +00001126 Expr *filler = nullptr;
Argyrios Kyrtzidisbbcefa72011-04-22 05:29:30 +00001127 if (isArrayFiller) {
David L. Jonesb6a8f022016-12-21 04:34:52 +00001128 filler = Record.readSubExpr();
Argyrios Kyrtzidisbbcefa72011-04-22 05:29:30 +00001129 E->ArrayFillerOrUnionFieldInit = filler;
1130 } else
John McCall3ce3d232019-12-13 03:37:23 -05001131 E->ArrayFillerOrUnionFieldInit = readDeclAs<FieldDecl>();
David L. Jonesbe1557a2016-12-21 00:17:49 +00001132 E->sawArrayRangeDesignator(Record.readInt());
1133 unsigned NumInits = Record.readInt();
David L. Jonesc4808b9e2016-12-15 20:53:26 +00001134 E->reserveInits(Record.getContext(), NumInits);
Argyrios Kyrtzidisbbcefa72011-04-22 05:29:30 +00001135 if (isArrayFiller) {
1136 for (unsigned I = 0; I != NumInits; ++I) {
David L. Jonesb6a8f022016-12-21 04:34:52 +00001137 Expr *init = Record.readSubExpr();
David L. Jonesc4808b9e2016-12-15 20:53:26 +00001138 E->updateInit(Record.getContext(), I, init ? init : filler);
Argyrios Kyrtzidisbbcefa72011-04-22 05:29:30 +00001139 }
1140 } else {
1141 for (unsigned I = 0; I != NumInits; ++I)
David L. Jonesb6a8f022016-12-21 04:34:52 +00001142 E->updateInit(Record.getContext(), I, Record.readSubExpr());
Argyrios Kyrtzidisbbcefa72011-04-22 05:29:30 +00001143 }
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001144}
1145
Sebastian Redl70c751d2010-08-18 23:56:52 +00001146void ASTStmtReader::VisitDesignatedInitExpr(DesignatedInitExpr *E) {
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +00001147 using Designator = DesignatedInitExpr::Designator;
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001148
1149 VisitExpr(E);
David L. Jonesbe1557a2016-12-21 00:17:49 +00001150 unsigned NumSubExprs = Record.readInt();
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001151 assert(NumSubExprs == E->getNumSubExprs() && "Wrong number of subexprs");
1152 for (unsigned I = 0; I != NumSubExprs; ++I)
David L. Jonesb6a8f022016-12-21 04:34:52 +00001153 E->setSubExpr(I, Record.readSubExpr());
John McCall3ce3d232019-12-13 03:37:23 -05001154 E->setEqualOrColonLoc(readSourceLocation());
David L. Jonesbe1557a2016-12-21 00:17:49 +00001155 E->setGNUSyntax(Record.readInt());
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001156
Chris Lattner0e62c1c2011-07-23 10:55:15 +00001157 SmallVector<Designator, 4> Designators;
David L. Jonesbe1557a2016-12-21 00:17:49 +00001158 while (Record.getIdx() < Record.size()) {
1159 switch ((DesignatorTypes)Record.readInt()) {
Sebastian Redl539c5062010-08-18 23:57:32 +00001160 case DESIG_FIELD_DECL: {
John McCall3ce3d232019-12-13 03:37:23 -05001161 auto *Field = readDeclAs<FieldDecl>();
1162 SourceLocation DotLoc = readSourceLocation();
1163 SourceLocation FieldLoc = readSourceLocation();
Mike Stump11289f42009-09-09 15:08:12 +00001164 Designators.push_back(Designator(Field->getIdentifier(), DotLoc,
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001165 FieldLoc));
1166 Designators.back().setField(Field);
1167 break;
1168 }
1169
Sebastian Redl539c5062010-08-18 23:57:32 +00001170 case DESIG_FIELD_NAME: {
John McCall3ce3d232019-12-13 03:37:23 -05001171 const IdentifierInfo *Name = Record.readIdentifier();
1172 SourceLocation DotLoc = readSourceLocation();
1173 SourceLocation FieldLoc = readSourceLocation();
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001174 Designators.push_back(Designator(Name, DotLoc, FieldLoc));
1175 break;
1176 }
Mike Stump11289f42009-09-09 15:08:12 +00001177
Sebastian Redl539c5062010-08-18 23:57:32 +00001178 case DESIG_ARRAY: {
David L. Jonesbe1557a2016-12-21 00:17:49 +00001179 unsigned Index = Record.readInt();
John McCall3ce3d232019-12-13 03:37:23 -05001180 SourceLocation LBracketLoc = readSourceLocation();
1181 SourceLocation RBracketLoc = readSourceLocation();
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001182 Designators.push_back(Designator(Index, LBracketLoc, RBracketLoc));
1183 break;
1184 }
1185
Sebastian Redl539c5062010-08-18 23:57:32 +00001186 case DESIG_ARRAY_RANGE: {
David L. Jonesbe1557a2016-12-21 00:17:49 +00001187 unsigned Index = Record.readInt();
John McCall3ce3d232019-12-13 03:37:23 -05001188 SourceLocation LBracketLoc = readSourceLocation();
1189 SourceLocation EllipsisLoc = readSourceLocation();
1190 SourceLocation RBracketLoc = readSourceLocation();
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001191 Designators.push_back(Designator(Index, LBracketLoc, EllipsisLoc,
1192 RBracketLoc));
1193 break;
1194 }
1195 }
1196 }
David L. Jonesc4808b9e2016-12-15 20:53:26 +00001197 E->setDesignators(Record.getContext(),
Douglas Gregor03e8bdc2010-01-06 23:17:19 +00001198 Designators.data(), Designators.size());
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001199}
1200
Yunzhong Gaocb779302015-06-10 00:27:52 +00001201void ASTStmtReader::VisitDesignatedInitUpdateExpr(DesignatedInitUpdateExpr *E) {
1202 VisitExpr(E);
David L. Jonesb6a8f022016-12-21 04:34:52 +00001203 E->setBase(Record.readSubExpr());
1204 E->setUpdater(Record.readSubExpr());
Yunzhong Gaocb779302015-06-10 00:27:52 +00001205}
1206
1207void ASTStmtReader::VisitNoInitExpr(NoInitExpr *E) {
1208 VisitExpr(E);
1209}
1210
Richard Smith410306b2016-12-12 02:53:20 +00001211void ASTStmtReader::VisitArrayInitLoopExpr(ArrayInitLoopExpr *E) {
1212 VisitExpr(E);
David L. Jonesb6a8f022016-12-21 04:34:52 +00001213 E->SubExprs[0] = Record.readSubExpr();
1214 E->SubExprs[1] = Record.readSubExpr();
Richard Smith410306b2016-12-12 02:53:20 +00001215}
1216
1217void ASTStmtReader::VisitArrayInitIndexExpr(ArrayInitIndexExpr *E) {
1218 VisitExpr(E);
1219}
1220
Sebastian Redl70c751d2010-08-18 23:56:52 +00001221void ASTStmtReader::VisitImplicitValueInitExpr(ImplicitValueInitExpr *E) {
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001222 VisitExpr(E);
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001223}
1224
Sebastian Redl70c751d2010-08-18 23:56:52 +00001225void ASTStmtReader::VisitVAArgExpr(VAArgExpr *E) {
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001226 VisitExpr(E);
David L. Jonesb6a8f022016-12-21 04:34:52 +00001227 E->setSubExpr(Record.readSubExpr());
John McCall3ce3d232019-12-13 03:37:23 -05001228 E->setWrittenTypeInfo(readTypeSourceInfo());
1229 E->setBuiltinLoc(readSourceLocation());
1230 E->setRParenLoc(readSourceLocation());
David L. Jonesbe1557a2016-12-21 00:17:49 +00001231 E->setIsMicrosoftABI(Record.readInt());
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001232}
1233
Eric Fiselier708afb52019-05-16 21:04:15 +00001234void ASTStmtReader::VisitSourceLocExpr(SourceLocExpr *E) {
1235 VisitExpr(E);
John McCall3ce3d232019-12-13 03:37:23 -05001236 E->ParentContext = readDeclAs<DeclContext>();
1237 E->BuiltinLoc = readSourceLocation();
1238 E->RParenLoc = readSourceLocation();
Eric Fiselier708afb52019-05-16 21:04:15 +00001239 E->SourceLocExprBits.Kind =
1240 static_cast<SourceLocExpr::IdentKind>(Record.readInt());
1241}
1242
Sebastian Redl70c751d2010-08-18 23:56:52 +00001243void ASTStmtReader::VisitAddrLabelExpr(AddrLabelExpr *E) {
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001244 VisitExpr(E);
John McCall3ce3d232019-12-13 03:37:23 -05001245 E->setAmpAmpLoc(readSourceLocation());
1246 E->setLabelLoc(readSourceLocation());
1247 E->setLabel(readDeclAs<LabelDecl>());
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001248}
1249
Sebastian Redl70c751d2010-08-18 23:56:52 +00001250void ASTStmtReader::VisitStmtExpr(StmtExpr *E) {
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001251 VisitExpr(E);
John McCall3ce3d232019-12-13 03:37:23 -05001252 E->setLParenLoc(readSourceLocation());
1253 E->setRParenLoc(readSourceLocation());
David L. Jonesb6a8f022016-12-21 04:34:52 +00001254 E->setSubStmt(cast_or_null<CompoundStmt>(Record.readSubStmt()));
Richard Smith5c845c12020-03-09 17:34:33 -07001255 E->StmtExprBits.TemplateDepth = Record.readInt();
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001256}
1257
Sebastian Redl70c751d2010-08-18 23:56:52 +00001258void ASTStmtReader::VisitChooseExpr(ChooseExpr *E) {
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001259 VisitExpr(E);
David L. Jonesb6a8f022016-12-21 04:34:52 +00001260 E->setCond(Record.readSubExpr());
1261 E->setLHS(Record.readSubExpr());
1262 E->setRHS(Record.readSubExpr());
John McCall3ce3d232019-12-13 03:37:23 -05001263 E->setBuiltinLoc(readSourceLocation());
1264 E->setRParenLoc(readSourceLocation());
David L. Jonesbe1557a2016-12-21 00:17:49 +00001265 E->setIsConditionTrue(Record.readInt());
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001266}
1267
Sebastian Redl70c751d2010-08-18 23:56:52 +00001268void ASTStmtReader::VisitGNUNullExpr(GNUNullExpr *E) {
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001269 VisitExpr(E);
John McCall3ce3d232019-12-13 03:37:23 -05001270 E->setTokenLocation(readSourceLocation());
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001271}
1272
Sebastian Redl70c751d2010-08-18 23:56:52 +00001273void ASTStmtReader::VisitShuffleVectorExpr(ShuffleVectorExpr *E) {
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001274 VisitExpr(E);
Chris Lattner0e62c1c2011-07-23 10:55:15 +00001275 SmallVector<Expr *, 16> Exprs;
David L. Jonesbe1557a2016-12-21 00:17:49 +00001276 unsigned NumExprs = Record.readInt();
Argyrios Kyrtzidisd0795b22010-06-28 22:28:35 +00001277 while (NumExprs--)
David L. Jonesb6a8f022016-12-21 04:34:52 +00001278 Exprs.push_back(Record.readSubExpr());
David L. Jonesc4808b9e2016-12-15 20:53:26 +00001279 E->setExprs(Record.getContext(), Exprs);
John McCall3ce3d232019-12-13 03:37:23 -05001280 E->setBuiltinLoc(readSourceLocation());
1281 E->setRParenLoc(readSourceLocation());
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001282}
1283
Hal Finkelc4d7c822013-09-18 03:29:45 +00001284void ASTStmtReader::VisitConvertVectorExpr(ConvertVectorExpr *E) {
1285 VisitExpr(E);
John McCall3ce3d232019-12-13 03:37:23 -05001286 E->BuiltinLoc = readSourceLocation();
1287 E->RParenLoc = readSourceLocation();
1288 E->TInfo = readTypeSourceInfo();
David L. Jonesb6a8f022016-12-21 04:34:52 +00001289 E->SrcExpr = Record.readSubExpr();
Hal Finkelc4d7c822013-09-18 03:29:45 +00001290}
1291
Sebastian Redl70c751d2010-08-18 23:56:52 +00001292void ASTStmtReader::VisitBlockExpr(BlockExpr *E) {
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001293 VisitExpr(E);
John McCall3ce3d232019-12-13 03:37:23 -05001294 E->setBlockDecl(readDeclAs<BlockDecl>());
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001295}
1296
Peter Collingbourne91147592011-04-15 00:35:48 +00001297void ASTStmtReader::VisitGenericSelectionExpr(GenericSelectionExpr *E) {
1298 VisitExpr(E);
Bruno Riccidb076832019-01-26 14:15:10 +00001299
1300 unsigned NumAssocs = Record.readInt();
1301 assert(NumAssocs == E->getNumAssocs() && "Wrong NumAssocs!");
Bruno Ricci94498c72019-01-26 13:58:15 +00001302 E->ResultIndex = Record.readInt();
John McCall3ce3d232019-12-13 03:37:23 -05001303 E->GenericSelectionExprBits.GenericLoc = readSourceLocation();
1304 E->DefaultLoc = readSourceLocation();
1305 E->RParenLoc = readSourceLocation();
Bruno Riccidb076832019-01-26 14:15:10 +00001306
1307 Stmt **Stmts = E->getTrailingObjects<Stmt *>();
1308 // Add 1 to account for the controlling expression which is the first
1309 // expression in the trailing array of Stmt *. This is not needed for
1310 // the trailing array of TypeSourceInfo *.
1311 for (unsigned I = 0, N = NumAssocs + 1; I < N; ++I)
1312 Stmts[I] = Record.readSubExpr();
1313
1314 TypeSourceInfo **TSIs = E->getTrailingObjects<TypeSourceInfo *>();
1315 for (unsigned I = 0, N = NumAssocs; I < N; ++I)
John McCall3ce3d232019-12-13 03:37:23 -05001316 TSIs[I] = readTypeSourceInfo();
Peter Collingbourne91147592011-04-15 00:35:48 +00001317}
1318
John McCallfe96e0b2011-11-06 09:01:30 +00001319void ASTStmtReader::VisitPseudoObjectExpr(PseudoObjectExpr *E) {
1320 VisitExpr(E);
David L. Jonesbe1557a2016-12-21 00:17:49 +00001321 unsigned numSemanticExprs = Record.readInt();
John McCallfe96e0b2011-11-06 09:01:30 +00001322 assert(numSemanticExprs + 1 == E->PseudoObjectExprBits.NumSubExprs);
David L. Jonesbe1557a2016-12-21 00:17:49 +00001323 E->PseudoObjectExprBits.ResultIndex = Record.readInt();
John McCallfe96e0b2011-11-06 09:01:30 +00001324
1325 // Read the syntactic expression.
David L. Jonesb6a8f022016-12-21 04:34:52 +00001326 E->getSubExprsBuffer()[0] = Record.readSubExpr();
John McCallfe96e0b2011-11-06 09:01:30 +00001327
1328 // Read all the semantic expressions.
1329 for (unsigned i = 0; i != numSemanticExprs; ++i) {
David L. Jonesb6a8f022016-12-21 04:34:52 +00001330 Expr *subExpr = Record.readSubExpr();
John McCallfe96e0b2011-11-06 09:01:30 +00001331 E->getSubExprsBuffer()[i+1] = subExpr;
1332 }
1333}
1334
Eli Friedmandf14b3a2011-10-11 02:20:01 +00001335void ASTStmtReader::VisitAtomicExpr(AtomicExpr *E) {
1336 VisitExpr(E);
David L. Jonesbe1557a2016-12-21 00:17:49 +00001337 E->Op = AtomicExpr::AtomicOp(Record.readInt());
Richard Smithaa22a8c2012-04-10 22:49:28 +00001338 E->NumSubExprs = AtomicExpr::getNumSubExprs(E->Op);
1339 for (unsigned I = 0; I != E->NumSubExprs; ++I)
David L. Jonesb6a8f022016-12-21 04:34:52 +00001340 E->SubExprs[I] = Record.readSubExpr();
John McCall3ce3d232019-12-13 03:37:23 -05001341 E->BuiltinLoc = readSourceLocation();
1342 E->RParenLoc = readSourceLocation();
Eli Friedmandf14b3a2011-10-11 02:20:01 +00001343}
1344
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001345//===----------------------------------------------------------------------===//
1346// Objective-C Expressions and Statements
1347
Sebastian Redl70c751d2010-08-18 23:56:52 +00001348void ASTStmtReader::VisitObjCStringLiteral(ObjCStringLiteral *E) {
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001349 VisitExpr(E);
David L. Jonesb6a8f022016-12-21 04:34:52 +00001350 E->setString(cast<StringLiteral>(Record.readSubStmt()));
John McCall3ce3d232019-12-13 03:37:23 -05001351 E->setAtLoc(readSourceLocation());
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001352}
1353
Patrick Beard0caa3942012-04-19 00:25:12 +00001354void ASTStmtReader::VisitObjCBoxedExpr(ObjCBoxedExpr *E) {
Ted Kremeneke65b0862012-03-06 20:05:56 +00001355 VisitExpr(E);
1356 // could be one of several IntegerLiteral, FloatLiteral, etc.
David L. Jonesb6a8f022016-12-21 04:34:52 +00001357 E->SubExpr = Record.readSubStmt();
John McCall3ce3d232019-12-13 03:37:23 -05001358 E->BoxingMethod = readDeclAs<ObjCMethodDecl>();
1359 E->Range = readSourceRange();
Ted Kremeneke65b0862012-03-06 20:05:56 +00001360}
1361
1362void ASTStmtReader::VisitObjCArrayLiteral(ObjCArrayLiteral *E) {
1363 VisitExpr(E);
David L. Jonesbe1557a2016-12-21 00:17:49 +00001364 unsigned NumElements = Record.readInt();
Ted Kremeneke65b0862012-03-06 20:05:56 +00001365 assert(NumElements == E->getNumElements() && "Wrong number of elements");
1366 Expr **Elements = E->getElements();
1367 for (unsigned I = 0, N = NumElements; I != N; ++I)
David L. Jonesb6a8f022016-12-21 04:34:52 +00001368 Elements[I] = Record.readSubExpr();
John McCall3ce3d232019-12-13 03:37:23 -05001369 E->ArrayWithObjectsMethod = readDeclAs<ObjCMethodDecl>();
1370 E->Range = readSourceRange();
Ted Kremeneke65b0862012-03-06 20:05:56 +00001371}
1372
1373void ASTStmtReader::VisitObjCDictionaryLiteral(ObjCDictionaryLiteral *E) {
1374 VisitExpr(E);
David L. Jonesbe1557a2016-12-21 00:17:49 +00001375 unsigned NumElements = Record.readInt();
Ted Kremeneke65b0862012-03-06 20:05:56 +00001376 assert(NumElements == E->getNumElements() && "Wrong number of elements");
David L. Jonesbe1557a2016-12-21 00:17:49 +00001377 bool HasPackExpansions = Record.readInt();
Ted Kremeneke65b0862012-03-06 20:05:56 +00001378 assert(HasPackExpansions == E->HasPackExpansions &&"Pack expansion mismatch");
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +00001379 auto *KeyValues =
James Y Knight6c2f06b2015-12-31 04:43:19 +00001380 E->getTrailingObjects<ObjCDictionaryLiteral::KeyValuePair>();
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +00001381 auto *Expansions =
James Y Knight6c2f06b2015-12-31 04:43:19 +00001382 E->getTrailingObjects<ObjCDictionaryLiteral::ExpansionData>();
Ted Kremeneke65b0862012-03-06 20:05:56 +00001383 for (unsigned I = 0; I != NumElements; ++I) {
David L. Jonesb6a8f022016-12-21 04:34:52 +00001384 KeyValues[I].Key = Record.readSubExpr();
1385 KeyValues[I].Value = Record.readSubExpr();
Ted Kremeneke65b0862012-03-06 20:05:56 +00001386 if (HasPackExpansions) {
John McCall3ce3d232019-12-13 03:37:23 -05001387 Expansions[I].EllipsisLoc = readSourceLocation();
David L. Jonesbe1557a2016-12-21 00:17:49 +00001388 Expansions[I].NumExpansionsPlusOne = Record.readInt();
Ted Kremeneke65b0862012-03-06 20:05:56 +00001389 }
1390 }
John McCall3ce3d232019-12-13 03:37:23 -05001391 E->DictWithObjectsMethod = readDeclAs<ObjCMethodDecl>();
1392 E->Range = readSourceRange();
Ted Kremeneke65b0862012-03-06 20:05:56 +00001393}
1394
Sebastian Redl70c751d2010-08-18 23:56:52 +00001395void ASTStmtReader::VisitObjCEncodeExpr(ObjCEncodeExpr *E) {
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001396 VisitExpr(E);
John McCall3ce3d232019-12-13 03:37:23 -05001397 E->setEncodedTypeSourceInfo(readTypeSourceInfo());
1398 E->setAtLoc(readSourceLocation());
1399 E->setRParenLoc(readSourceLocation());
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001400}
1401
Sebastian Redl70c751d2010-08-18 23:56:52 +00001402void ASTStmtReader::VisitObjCSelectorExpr(ObjCSelectorExpr *E) {
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001403 VisitExpr(E);
David L. Jonesb6a8f022016-12-21 04:34:52 +00001404 E->setSelector(Record.readSelector());
John McCall3ce3d232019-12-13 03:37:23 -05001405 E->setAtLoc(readSourceLocation());
1406 E->setRParenLoc(readSourceLocation());
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001407}
1408
Sebastian Redl70c751d2010-08-18 23:56:52 +00001409void ASTStmtReader::VisitObjCProtocolExpr(ObjCProtocolExpr *E) {
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001410 VisitExpr(E);
John McCall3ce3d232019-12-13 03:37:23 -05001411 E->setProtocol(readDeclAs<ObjCProtocolDecl>());
1412 E->setAtLoc(readSourceLocation());
1413 E->ProtoLoc = readSourceLocation();
1414 E->setRParenLoc(readSourceLocation());
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001415}
1416
Sebastian Redl70c751d2010-08-18 23:56:52 +00001417void ASTStmtReader::VisitObjCIvarRefExpr(ObjCIvarRefExpr *E) {
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001418 VisitExpr(E);
John McCall3ce3d232019-12-13 03:37:23 -05001419 E->setDecl(readDeclAs<ObjCIvarDecl>());
1420 E->setLocation(readSourceLocation());
1421 E->setOpLoc(readSourceLocation());
David L. Jonesb6a8f022016-12-21 04:34:52 +00001422 E->setBase(Record.readSubExpr());
David L. Jonesbe1557a2016-12-21 00:17:49 +00001423 E->setIsArrow(Record.readInt());
1424 E->setIsFreeIvar(Record.readInt());
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001425}
1426
Sebastian Redl70c751d2010-08-18 23:56:52 +00001427void ASTStmtReader::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *E) {
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001428 VisitExpr(E);
David L. Jonesbe1557a2016-12-21 00:17:49 +00001429 unsigned MethodRefFlags = Record.readInt();
1430 bool Implicit = Record.readInt() != 0;
John McCallb7bd14f2010-12-02 01:19:52 +00001431 if (Implicit) {
John McCall3ce3d232019-12-13 03:37:23 -05001432 auto *Getter = readDeclAs<ObjCMethodDecl>();
1433 auto *Setter = readDeclAs<ObjCMethodDecl>();
Argyrios Kyrtzidisab468b02012-03-30 00:19:18 +00001434 E->setImplicitProperty(Getter, Setter, MethodRefFlags);
John McCallb7bd14f2010-12-02 01:19:52 +00001435 } else {
John McCall3ce3d232019-12-13 03:37:23 -05001436 E->setExplicitProperty(readDeclAs<ObjCPropertyDecl>(), MethodRefFlags);
Fariborz Jahanian681c0752010-10-14 16:04:05 +00001437 }
John McCall3ce3d232019-12-13 03:37:23 -05001438 E->setLocation(readSourceLocation());
1439 E->setReceiverLocation(readSourceLocation());
David L. Jonesbe1557a2016-12-21 00:17:49 +00001440 switch (Record.readInt()) {
John McCallb7bd14f2010-12-02 01:19:52 +00001441 case 0:
David L. Jonesb6a8f022016-12-21 04:34:52 +00001442 E->setBase(Record.readSubExpr());
John McCallb7bd14f2010-12-02 01:19:52 +00001443 break;
1444 case 1:
David L. Jonesbe1557a2016-12-21 00:17:49 +00001445 E->setSuperReceiver(Record.readType());
John McCallb7bd14f2010-12-02 01:19:52 +00001446 break;
1447 case 2:
John McCall3ce3d232019-12-13 03:37:23 -05001448 E->setClassReceiver(readDeclAs<ObjCInterfaceDecl>());
John McCallb7bd14f2010-12-02 01:19:52 +00001449 break;
1450 }
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001451}
1452
Ted Kremeneke65b0862012-03-06 20:05:56 +00001453void ASTStmtReader::VisitObjCSubscriptRefExpr(ObjCSubscriptRefExpr *E) {
1454 VisitExpr(E);
John McCall3ce3d232019-12-13 03:37:23 -05001455 E->setRBracket(readSourceLocation());
David L. Jonesb6a8f022016-12-21 04:34:52 +00001456 E->setBaseExpr(Record.readSubExpr());
1457 E->setKeyExpr(Record.readSubExpr());
John McCall3ce3d232019-12-13 03:37:23 -05001458 E->GetAtIndexMethodDecl = readDeclAs<ObjCMethodDecl>();
1459 E->SetAtIndexMethodDecl = readDeclAs<ObjCMethodDecl>();
Ted Kremeneke65b0862012-03-06 20:05:56 +00001460}
1461
Sebastian Redl70c751d2010-08-18 23:56:52 +00001462void ASTStmtReader::VisitObjCMessageExpr(ObjCMessageExpr *E) {
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001463 VisitExpr(E);
David L. Jonesbe1557a2016-12-21 00:17:49 +00001464 assert(Record.peekInt() == E->getNumArgs());
1465 Record.skipInts(1);
1466 unsigned NumStoredSelLocs = Record.readInt();
1467 E->SelLocsKind = Record.readInt();
1468 E->setDelegateInitCall(Record.readInt());
1469 E->IsImplicit = Record.readInt();
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +00001470 auto Kind = static_cast<ObjCMessageExpr::ReceiverKind>(Record.readInt());
Douglas Gregor9a129192010-04-21 00:45:42 +00001471 switch (Kind) {
1472 case ObjCMessageExpr::Instance:
David L. Jonesb6a8f022016-12-21 04:34:52 +00001473 E->setInstanceReceiver(Record.readSubExpr());
Douglas Gregor9a129192010-04-21 00:45:42 +00001474 break;
1475
1476 case ObjCMessageExpr::Class:
John McCall3ce3d232019-12-13 03:37:23 -05001477 E->setClassReceiver(readTypeSourceInfo());
Douglas Gregor9a129192010-04-21 00:45:42 +00001478 break;
1479
1480 case ObjCMessageExpr::SuperClass:
1481 case ObjCMessageExpr::SuperInstance: {
David L. Jonesbe1557a2016-12-21 00:17:49 +00001482 QualType T = Record.readType();
John McCall3ce3d232019-12-13 03:37:23 -05001483 SourceLocation SuperLoc = readSourceLocation();
Douglas Gregor9a129192010-04-21 00:45:42 +00001484 E->setSuper(SuperLoc, T, Kind == ObjCMessageExpr::SuperInstance);
1485 break;
1486 }
1487 }
1488
1489 assert(Kind == E->getReceiverKind());
1490
David L. Jonesbe1557a2016-12-21 00:17:49 +00001491 if (Record.readInt())
John McCall3ce3d232019-12-13 03:37:23 -05001492 E->setMethodDecl(readDeclAs<ObjCMethodDecl>());
Douglas Gregor9a129192010-04-21 00:45:42 +00001493 else
David L. Jonesb6a8f022016-12-21 04:34:52 +00001494 E->setSelector(Record.readSelector());
Douglas Gregor9a129192010-04-21 00:45:42 +00001495
John McCall3ce3d232019-12-13 03:37:23 -05001496 E->LBracLoc = readSourceLocation();
1497 E->RBracLoc = readSourceLocation();
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001498
1499 for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
David L. Jonesb6a8f022016-12-21 04:34:52 +00001500 E->setArg(I, Record.readSubExpr());
Argyrios Kyrtzidisa6011e22011-10-03 06:36:51 +00001501
1502 SourceLocation *Locs = E->getStoredSelLocs();
1503 for (unsigned I = 0; I != NumStoredSelLocs; ++I)
John McCall3ce3d232019-12-13 03:37:23 -05001504 Locs[I] = readSourceLocation();
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001505}
1506
Sebastian Redl70c751d2010-08-18 23:56:52 +00001507void ASTStmtReader::VisitObjCForCollectionStmt(ObjCForCollectionStmt *S) {
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001508 VisitStmt(S);
David L. Jonesb6a8f022016-12-21 04:34:52 +00001509 S->setElement(Record.readSubStmt());
1510 S->setCollection(Record.readSubExpr());
1511 S->setBody(Record.readSubStmt());
John McCall3ce3d232019-12-13 03:37:23 -05001512 S->setForLoc(readSourceLocation());
1513 S->setRParenLoc(readSourceLocation());
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001514}
1515
Sebastian Redl70c751d2010-08-18 23:56:52 +00001516void ASTStmtReader::VisitObjCAtCatchStmt(ObjCAtCatchStmt *S) {
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001517 VisitStmt(S);
David L. Jonesb6a8f022016-12-21 04:34:52 +00001518 S->setCatchBody(Record.readSubStmt());
John McCall3ce3d232019-12-13 03:37:23 -05001519 S->setCatchParamDecl(readDeclAs<VarDecl>());
1520 S->setAtCatchLoc(readSourceLocation());
1521 S->setRParenLoc(readSourceLocation());
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001522}
1523
Sebastian Redl70c751d2010-08-18 23:56:52 +00001524void ASTStmtReader::VisitObjCAtFinallyStmt(ObjCAtFinallyStmt *S) {
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001525 VisitStmt(S);
David L. Jonesb6a8f022016-12-21 04:34:52 +00001526 S->setFinallyBody(Record.readSubStmt());
John McCall3ce3d232019-12-13 03:37:23 -05001527 S->setAtFinallyLoc(readSourceLocation());
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001528}
1529
John McCall31168b02011-06-15 23:02:42 +00001530void ASTStmtReader::VisitObjCAutoreleasePoolStmt(ObjCAutoreleasePoolStmt *S) {
Roman Lebedev773c3912019-03-12 21:31:00 +00001531 VisitStmt(S); // FIXME: no test coverage.
David L. Jonesb6a8f022016-12-21 04:34:52 +00001532 S->setSubStmt(Record.readSubStmt());
John McCall3ce3d232019-12-13 03:37:23 -05001533 S->setAtLoc(readSourceLocation());
John McCall31168b02011-06-15 23:02:42 +00001534}
1535
Sebastian Redl70c751d2010-08-18 23:56:52 +00001536void ASTStmtReader::VisitObjCAtTryStmt(ObjCAtTryStmt *S) {
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001537 VisitStmt(S);
David L. Jonesbe1557a2016-12-21 00:17:49 +00001538 assert(Record.peekInt() == S->getNumCatchStmts());
1539 Record.skipInts(1);
1540 bool HasFinally = Record.readInt();
David L. Jonesb6a8f022016-12-21 04:34:52 +00001541 S->setTryBody(Record.readSubStmt());
Argyrios Kyrtzidisd0795b22010-06-28 22:28:35 +00001542 for (unsigned I = 0, N = S->getNumCatchStmts(); I != N; ++I)
David L. Jonesb6a8f022016-12-21 04:34:52 +00001543 S->setCatchStmt(I, cast_or_null<ObjCAtCatchStmt>(Record.readSubStmt()));
Douglas Gregor96c79492010-04-23 22:50:49 +00001544
Douglas Gregor96c79492010-04-23 22:50:49 +00001545 if (HasFinally)
David L. Jonesb6a8f022016-12-21 04:34:52 +00001546 S->setFinallyStmt(Record.readSubStmt());
John McCall3ce3d232019-12-13 03:37:23 -05001547 S->setAtTryLoc(readSourceLocation());
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001548}
1549
Sebastian Redl70c751d2010-08-18 23:56:52 +00001550void ASTStmtReader::VisitObjCAtSynchronizedStmt(ObjCAtSynchronizedStmt *S) {
Roman Lebedev773c3912019-03-12 21:31:00 +00001551 VisitStmt(S); // FIXME: no test coverage.
David L. Jonesb6a8f022016-12-21 04:34:52 +00001552 S->setSynchExpr(Record.readSubStmt());
1553 S->setSynchBody(Record.readSubStmt());
John McCall3ce3d232019-12-13 03:37:23 -05001554 S->setAtSynchronizedLoc(readSourceLocation());
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001555}
1556
Sebastian Redl70c751d2010-08-18 23:56:52 +00001557void ASTStmtReader::VisitObjCAtThrowStmt(ObjCAtThrowStmt *S) {
Roman Lebedev773c3912019-03-12 21:31:00 +00001558 VisitStmt(S); // FIXME: no test coverage.
David L. Jonesb6a8f022016-12-21 04:34:52 +00001559 S->setThrowExpr(Record.readSubStmt());
John McCall3ce3d232019-12-13 03:37:23 -05001560 S->setThrowLoc(readSourceLocation());
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001561}
1562
Ted Kremeneke65b0862012-03-06 20:05:56 +00001563void ASTStmtReader::VisitObjCBoolLiteralExpr(ObjCBoolLiteralExpr *E) {
1564 VisitExpr(E);
David L. Jonesbe1557a2016-12-21 00:17:49 +00001565 E->setValue(Record.readInt());
John McCall3ce3d232019-12-13 03:37:23 -05001566 E->setLocation(readSourceLocation());
Ted Kremeneke65b0862012-03-06 20:05:56 +00001567}
1568
Erik Pilkington29099de2016-07-16 00:35:23 +00001569void ASTStmtReader::VisitObjCAvailabilityCheckExpr(ObjCAvailabilityCheckExpr *E) {
1570 VisitExpr(E);
David L. Jonesb6a8f022016-12-21 04:34:52 +00001571 SourceRange R = Record.readSourceRange();
Erik Pilkington29099de2016-07-16 00:35:23 +00001572 E->AtLoc = R.getBegin();
1573 E->RParen = R.getEnd();
David L. Jonesb6a8f022016-12-21 04:34:52 +00001574 E->VersionToCheck = Record.readVersionTuple();
Erik Pilkington29099de2016-07-16 00:35:23 +00001575}
1576
Argyrios Kyrtzidiseeaaead2009-07-14 03:19:21 +00001577//===----------------------------------------------------------------------===//
1578// C++ Expressions and Statements
Argyrios Kyrtzidis47cd7a92010-07-22 16:03:56 +00001579//===----------------------------------------------------------------------===//
1580
Sebastian Redl70c751d2010-08-18 23:56:52 +00001581void ASTStmtReader::VisitCXXCatchStmt(CXXCatchStmt *S) {
Argyrios Kyrtzidis47cd7a92010-07-22 16:03:56 +00001582 VisitStmt(S);
John McCall3ce3d232019-12-13 03:37:23 -05001583 S->CatchLoc = readSourceLocation();
1584 S->ExceptionDecl = readDeclAs<VarDecl>();
David L. Jonesb6a8f022016-12-21 04:34:52 +00001585 S->HandlerBlock = Record.readSubStmt();
Argyrios Kyrtzidis47cd7a92010-07-22 16:03:56 +00001586}
1587
Sebastian Redl70c751d2010-08-18 23:56:52 +00001588void ASTStmtReader::VisitCXXTryStmt(CXXTryStmt *S) {
Argyrios Kyrtzidis47cd7a92010-07-22 16:03:56 +00001589 VisitStmt(S);
David L. Jonesbe1557a2016-12-21 00:17:49 +00001590 assert(Record.peekInt() == S->getNumHandlers() && "NumStmtFields is wrong ?");
1591 Record.skipInts(1);
John McCall3ce3d232019-12-13 03:37:23 -05001592 S->TryLoc = readSourceLocation();
David L. Jonesb6a8f022016-12-21 04:34:52 +00001593 S->getStmts()[0] = Record.readSubStmt();
Argyrios Kyrtzidis47cd7a92010-07-22 16:03:56 +00001594 for (unsigned i = 0, e = S->getNumHandlers(); i != e; ++i)
David L. Jonesb6a8f022016-12-21 04:34:52 +00001595 S->getStmts()[i + 1] = Record.readSubStmt();
Argyrios Kyrtzidis47cd7a92010-07-22 16:03:56 +00001596}
Argyrios Kyrtzidiseeaaead2009-07-14 03:19:21 +00001597
Richard Smith02e85f32011-04-14 22:09:26 +00001598void ASTStmtReader::VisitCXXForRangeStmt(CXXForRangeStmt *S) {
1599 VisitStmt(S);
John McCall3ce3d232019-12-13 03:37:23 -05001600 S->ForLoc = readSourceLocation();
1601 S->CoawaitLoc = readSourceLocation();
1602 S->ColonLoc = readSourceLocation();
1603 S->RParenLoc = readSourceLocation();
Richard Smith8baa5002018-09-28 18:44:09 +00001604 S->setInit(Record.readSubStmt());
David L. Jonesb6a8f022016-12-21 04:34:52 +00001605 S->setRangeStmt(Record.readSubStmt());
1606 S->setBeginStmt(Record.readSubStmt());
1607 S->setEndStmt(Record.readSubStmt());
1608 S->setCond(Record.readSubExpr());
1609 S->setInc(Record.readSubExpr());
1610 S->setLoopVarStmt(Record.readSubStmt());
1611 S->setBody(Record.readSubStmt());
Richard Smith02e85f32011-04-14 22:09:26 +00001612}
1613
Douglas Gregordeb4a2be2011-10-25 01:33:02 +00001614void ASTStmtReader::VisitMSDependentExistsStmt(MSDependentExistsStmt *S) {
1615 VisitStmt(S);
John McCall3ce3d232019-12-13 03:37:23 -05001616 S->KeywordLoc = readSourceLocation();
David L. Jonesbe1557a2016-12-21 00:17:49 +00001617 S->IsIfExists = Record.readInt();
David L. Jonesb6a8f022016-12-21 04:34:52 +00001618 S->QualifierLoc = Record.readNestedNameSpecifierLoc();
John McCall3ce3d232019-12-13 03:37:23 -05001619 S->NameInfo = Record.readDeclarationNameInfo();
David L. Jonesb6a8f022016-12-21 04:34:52 +00001620 S->SubStmt = Record.readSubStmt();
Douglas Gregordeb4a2be2011-10-25 01:33:02 +00001621}
1622
Sebastian Redl70c751d2010-08-18 23:56:52 +00001623void ASTStmtReader::VisitCXXOperatorCallExpr(CXXOperatorCallExpr *E) {
Argyrios Kyrtzidisd0795b22010-06-28 22:28:35 +00001624 VisitCallExpr(E);
Bruno Riccifeb19232018-12-21 16:51:57 +00001625 E->CXXOperatorCallExprBits.OperatorKind = Record.readInt();
1626 E->CXXOperatorCallExprBits.FPFeatures = Record.readInt();
David L. Jonesb6a8f022016-12-21 04:34:52 +00001627 E->Range = Record.readSourceRange();
Argyrios Kyrtzidiseeaaead2009-07-14 03:19:21 +00001628}
1629
Richard Smith778dc0f2019-10-19 00:04:38 +00001630void ASTStmtReader::VisitCXXRewrittenBinaryOperator(
1631 CXXRewrittenBinaryOperator *E) {
1632 VisitExpr(E);
1633 E->CXXRewrittenBinaryOperatorBits.IsReversed = Record.readInt();
1634 E->SemanticForm = Record.readSubExpr();
1635}
1636
Sebastian Redl70c751d2010-08-18 23:56:52 +00001637void ASTStmtReader::VisitCXXConstructExpr(CXXConstructExpr *E) {
Douglas Gregor5d3507d2009-09-09 23:08:42 +00001638 VisitExpr(E);
Bruno Ricciddb8f6b2018-12-22 14:39:30 +00001639
1640 unsigned NumArgs = Record.readInt();
1641 assert((NumArgs == E->getNumArgs()) && "Wrong NumArgs!");
1642
1643 E->CXXConstructExprBits.Elidable = Record.readInt();
1644 E->CXXConstructExprBits.HadMultipleCandidates = Record.readInt();
1645 E->CXXConstructExprBits.ListInitialization = Record.readInt();
1646 E->CXXConstructExprBits.StdInitListInitialization = Record.readInt();
1647 E->CXXConstructExprBits.ZeroInitialization = Record.readInt();
1648 E->CXXConstructExprBits.ConstructionKind = Record.readInt();
John McCall3ce3d232019-12-13 03:37:23 -05001649 E->CXXConstructExprBits.Loc = readSourceLocation();
1650 E->Constructor = readDeclAs<CXXConstructorDecl>();
1651 E->ParenOrBraceRange = readSourceRange();
Bruno Ricciddb8f6b2018-12-22 14:39:30 +00001652
1653 for (unsigned I = 0; I != NumArgs; ++I)
1654 E->setArg(I, Record.readSubExpr());
Douglas Gregor5d3507d2009-09-09 23:08:42 +00001655}
Chris Lattner92ba5ff2009-04-27 05:14:47 +00001656
Richard Smith5179eb72016-06-28 19:03:57 +00001657void ASTStmtReader::VisitCXXInheritedCtorInitExpr(CXXInheritedCtorInitExpr *E) {
1658 VisitExpr(E);
John McCall3ce3d232019-12-13 03:37:23 -05001659 E->Constructor = readDeclAs<CXXConstructorDecl>();
1660 E->Loc = readSourceLocation();
David L. Jonesbe1557a2016-12-21 00:17:49 +00001661 E->ConstructsVirtualBase = Record.readInt();
1662 E->InheritedFromVirtualBase = Record.readInt();
Richard Smith5179eb72016-06-28 19:03:57 +00001663}
1664
Sebastian Redl70c751d2010-08-18 23:56:52 +00001665void ASTStmtReader::VisitCXXTemporaryObjectExpr(CXXTemporaryObjectExpr *E) {
Argyrios Kyrtzidisb8d77eb2010-07-10 11:46:15 +00001666 VisitCXXConstructExpr(E);
John McCall3ce3d232019-12-13 03:37:23 -05001667 E->TSI = readTypeSourceInfo();
Argyrios Kyrtzidisb8d77eb2010-07-10 11:46:15 +00001668}
1669
Douglas Gregore31e6062012-02-07 10:09:13 +00001670void ASTStmtReader::VisitLambdaExpr(LambdaExpr *E) {
1671 VisitExpr(E);
David L. Jonesbe1557a2016-12-21 00:17:49 +00001672 unsigned NumCaptures = Record.readInt();
Douglas Gregor99ae8062012-02-14 17:54:36 +00001673 assert(NumCaptures == E->NumCaptures);(void)NumCaptures;
John McCall3ce3d232019-12-13 03:37:23 -05001674 E->IntroducerRange = readSourceRange();
David L. Jonesbe1557a2016-12-21 00:17:49 +00001675 E->CaptureDefault = static_cast<LambdaCaptureDefault>(Record.readInt());
John McCall3ce3d232019-12-13 03:37:23 -05001676 E->CaptureDefaultLoc = readSourceLocation();
David L. Jonesbe1557a2016-12-21 00:17:49 +00001677 E->ExplicitParams = Record.readInt();
1678 E->ExplicitResultType = Record.readInt();
John McCall3ce3d232019-12-13 03:37:23 -05001679 E->ClosingBrace = readSourceLocation();
David L. Jonesc4808b9e2016-12-15 20:53:26 +00001680
Douglas Gregor99ae8062012-02-14 17:54:36 +00001681 // Read capture initializers.
1682 for (LambdaExpr::capture_init_iterator C = E->capture_init_begin(),
1683 CEnd = E->capture_init_end();
1684 C != CEnd; ++C)
David L. Jonesb6a8f022016-12-21 04:34:52 +00001685 *C = Record.readSubExpr();
Douglas Gregore31e6062012-02-07 10:09:13 +00001686}
1687
Richard Smithcc1b96d2013-06-12 22:31:48 +00001688void
1689ASTStmtReader::VisitCXXStdInitializerListExpr(CXXStdInitializerListExpr *E) {
1690 VisitExpr(E);
David L. Jonesb6a8f022016-12-21 04:34:52 +00001691 E->SubExpr = Record.readSubExpr();
Richard Smithcc1b96d2013-06-12 22:31:48 +00001692}
1693
Sebastian Redl70c751d2010-08-18 23:56:52 +00001694void ASTStmtReader::VisitCXXNamedCastExpr(CXXNamedCastExpr *E) {
Argyrios Kyrtzidisd0795b22010-06-28 22:28:35 +00001695 VisitExplicitCastExpr(E);
John McCall3ce3d232019-12-13 03:37:23 -05001696 SourceRange R = readSourceRange();
Douglas Gregor4478f852011-01-12 22:41:29 +00001697 E->Loc = R.getBegin();
1698 E->RParenLoc = R.getEnd();
John McCall3ce3d232019-12-13 03:37:23 -05001699 R = readSourceRange();
Fariborz Jahanianf0738712013-02-22 22:02:53 +00001700 E->AngleBrackets = R;
Sam Weinigd01101e2010-01-16 21:21:01 +00001701}
1702
Sebastian Redl70c751d2010-08-18 23:56:52 +00001703void ASTStmtReader::VisitCXXStaticCastExpr(CXXStaticCastExpr *E) {
Sam Weinigd01101e2010-01-16 21:21:01 +00001704 return VisitCXXNamedCastExpr(E);
1705}
1706
Sebastian Redl70c751d2010-08-18 23:56:52 +00001707void ASTStmtReader::VisitCXXDynamicCastExpr(CXXDynamicCastExpr *E) {
Sam Weinigd01101e2010-01-16 21:21:01 +00001708 return VisitCXXNamedCastExpr(E);
1709}
1710
Sebastian Redl70c751d2010-08-18 23:56:52 +00001711void ASTStmtReader::VisitCXXReinterpretCastExpr(CXXReinterpretCastExpr *E) {
Sam Weinigd01101e2010-01-16 21:21:01 +00001712 return VisitCXXNamedCastExpr(E);
1713}
1714
Sebastian Redl70c751d2010-08-18 23:56:52 +00001715void ASTStmtReader::VisitCXXConstCastExpr(CXXConstCastExpr *E) {
Sam Weinigd01101e2010-01-16 21:21:01 +00001716 return VisitCXXNamedCastExpr(E);
1717}
1718
Sebastian Redl70c751d2010-08-18 23:56:52 +00001719void ASTStmtReader::VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr *E) {
Argyrios Kyrtzidisd0795b22010-06-28 22:28:35 +00001720 VisitExplicitCastExpr(E);
John McCall3ce3d232019-12-13 03:37:23 -05001721 E->setLParenLoc(readSourceLocation());
1722 E->setRParenLoc(readSourceLocation());
Sam Weinigd01101e2010-01-16 21:21:01 +00001723}
1724
Erik Pilkingtoneee944e2019-07-02 18:28:13 +00001725void ASTStmtReader::VisitBuiltinBitCastExpr(BuiltinBitCastExpr *E) {
1726 VisitExplicitCastExpr(E);
John McCall3ce3d232019-12-13 03:37:23 -05001727 E->KWLoc = readSourceLocation();
1728 E->RParenLoc = readSourceLocation();
Erik Pilkingtoneee944e2019-07-02 18:28:13 +00001729}
1730
Richard Smithc67fdd42012-03-07 08:35:16 +00001731void ASTStmtReader::VisitUserDefinedLiteral(UserDefinedLiteral *E) {
1732 VisitCallExpr(E);
John McCall3ce3d232019-12-13 03:37:23 -05001733 E->UDSuffixLoc = readSourceLocation();
Richard Smithc67fdd42012-03-07 08:35:16 +00001734}
1735
Sebastian Redl70c751d2010-08-18 23:56:52 +00001736void ASTStmtReader::VisitCXXBoolLiteralExpr(CXXBoolLiteralExpr *E) {
Sam Weinige83b3ac2010-02-07 06:32:43 +00001737 VisitExpr(E);
David L. Jonesbe1557a2016-12-21 00:17:49 +00001738 E->setValue(Record.readInt());
John McCall3ce3d232019-12-13 03:37:23 -05001739 E->setLocation(readSourceLocation());
Sam Weinige83b3ac2010-02-07 06:32:43 +00001740}
1741
Sebastian Redl70c751d2010-08-18 23:56:52 +00001742void ASTStmtReader::VisitCXXNullPtrLiteralExpr(CXXNullPtrLiteralExpr *E) {
Sam Weinige83b3ac2010-02-07 06:32:43 +00001743 VisitExpr(E);
John McCall3ce3d232019-12-13 03:37:23 -05001744 E->setLocation(readSourceLocation());
Sam Weinige83b3ac2010-02-07 06:32:43 +00001745}
1746
Sebastian Redl70c751d2010-08-18 23:56:52 +00001747void ASTStmtReader::VisitCXXTypeidExpr(CXXTypeidExpr *E) {
Chris Lattner13a5ecc2010-05-09 06:03:39 +00001748 VisitExpr(E);
John McCall3ce3d232019-12-13 03:37:23 -05001749 E->setSourceRange(readSourceRange());
Chris Lattner13a5ecc2010-05-09 06:03:39 +00001750 if (E->isTypeOperand()) { // typeid(int)
Sebastian Redlc67764e2010-07-22 22:43:28 +00001751 E->setTypeOperandSourceInfo(
John McCall3ce3d232019-12-13 03:37:23 -05001752 readTypeSourceInfo());
Argyrios Kyrtzidisd0795b22010-06-28 22:28:35 +00001753 return;
Chris Lattner13a5ecc2010-05-09 06:03:39 +00001754 }
David L. Jonesc4808b9e2016-12-15 20:53:26 +00001755
Chris Lattner13a5ecc2010-05-09 06:03:39 +00001756 // typeid(42+2)
David L. Jonesb6a8f022016-12-21 04:34:52 +00001757 E->setExprOperand(Record.readSubExpr());
Chris Lattner13a5ecc2010-05-09 06:03:39 +00001758}
1759
Sebastian Redl70c751d2010-08-18 23:56:52 +00001760void ASTStmtReader::VisitCXXThisExpr(CXXThisExpr *E) {
Chris Lattner98267332010-05-09 06:15:05 +00001761 VisitExpr(E);
John McCall3ce3d232019-12-13 03:37:23 -05001762 E->setLocation(readSourceLocation());
David L. Jonesbe1557a2016-12-21 00:17:49 +00001763 E->setImplicit(Record.readInt());
Chris Lattner98267332010-05-09 06:15:05 +00001764}
1765
Sebastian Redl70c751d2010-08-18 23:56:52 +00001766void ASTStmtReader::VisitCXXThrowExpr(CXXThrowExpr *E) {
Chris Lattner98267332010-05-09 06:15:05 +00001767 VisitExpr(E);
John McCall3ce3d232019-12-13 03:37:23 -05001768 E->CXXThrowExprBits.ThrowLoc = readSourceLocation();
Bruno Riccib7de97b2018-11-17 12:53:56 +00001769 E->Operand = Record.readSubExpr();
1770 E->CXXThrowExprBits.IsThrownVariableInScope = Record.readInt();
Chris Lattner98267332010-05-09 06:15:05 +00001771}
Chris Lattner13a5ecc2010-05-09 06:03:39 +00001772
Sebastian Redl70c751d2010-08-18 23:56:52 +00001773void ASTStmtReader::VisitCXXDefaultArgExpr(CXXDefaultArgExpr *E) {
Chris Lattnere2437f42010-05-09 06:40:08 +00001774 VisitExpr(E);
John McCall3ce3d232019-12-13 03:37:23 -05001775 E->Param = readDeclAs<ParmVarDecl>();
1776 E->UsedContext = readDeclAs<DeclContext>();
1777 E->CXXDefaultArgExprBits.Loc = readSourceLocation();
Chris Lattnercba86142010-05-10 00:25:06 +00001778}
1779
Richard Smith852c9db2013-04-20 22:23:05 +00001780void ASTStmtReader::VisitCXXDefaultInitExpr(CXXDefaultInitExpr *E) {
1781 VisitExpr(E);
John McCall3ce3d232019-12-13 03:37:23 -05001782 E->Field = readDeclAs<FieldDecl>();
1783 E->UsedContext = readDeclAs<DeclContext>();
1784 E->CXXDefaultInitExprBits.Loc = readSourceLocation();
Richard Smith852c9db2013-04-20 22:23:05 +00001785}
1786
Sebastian Redl70c751d2010-08-18 23:56:52 +00001787void ASTStmtReader::VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *E) {
Chris Lattnercba86142010-05-10 00:25:06 +00001788 VisitExpr(E);
David L. Jonesb6a8f022016-12-21 04:34:52 +00001789 E->setTemporary(Record.readCXXTemporary());
1790 E->setSubExpr(Record.readSubExpr());
Chris Lattnercba86142010-05-10 00:25:06 +00001791}
1792
Sebastian Redl70c751d2010-08-18 23:56:52 +00001793void ASTStmtReader::VisitCXXScalarValueInitExpr(CXXScalarValueInitExpr *E) {
Chris Lattnerabfb58d2010-05-10 01:22:27 +00001794 VisitExpr(E);
John McCall3ce3d232019-12-13 03:37:23 -05001795 E->TypeInfo = readTypeSourceInfo();
1796 E->CXXScalarValueInitExprBits.RParenLoc = readSourceLocation();
Chris Lattnerabfb58d2010-05-10 01:22:27 +00001797}
1798
Sebastian Redl70c751d2010-08-18 23:56:52 +00001799void ASTStmtReader::VisitCXXNewExpr(CXXNewExpr *E) {
Chris Lattnerabfb58d2010-05-10 01:22:27 +00001800 VisitExpr(E);
Bruno Ricci9b6dfac2019-01-07 15:04:45 +00001801
1802 bool IsArray = Record.readInt();
1803 bool HasInit = Record.readInt();
David L. Jonesbe1557a2016-12-21 00:17:49 +00001804 unsigned NumPlacementArgs = Record.readInt();
Bruno Ricci9b6dfac2019-01-07 15:04:45 +00001805 bool IsParenTypeId = Record.readInt();
1806
1807 E->CXXNewExprBits.IsGlobalNew = Record.readInt();
1808 E->CXXNewExprBits.ShouldPassAlignment = Record.readInt();
1809 E->CXXNewExprBits.UsualArrayDeleteWantsSize = Record.readInt();
1810 E->CXXNewExprBits.StoredInitializationStyle = Record.readInt();
1811
1812 assert((IsArray == E->isArray()) && "Wrong IsArray!");
1813 assert((HasInit == E->hasInitializer()) && "Wrong HasInit!");
1814 assert((NumPlacementArgs == E->getNumPlacementArgs()) &&
1815 "Wrong NumPlacementArgs!");
1816 assert((IsParenTypeId == E->isParenTypeId()) && "Wrong IsParenTypeId!");
1817 (void)IsArray;
1818 (void)HasInit;
1819 (void)NumPlacementArgs;
1820
John McCall3ce3d232019-12-13 03:37:23 -05001821 E->setOperatorNew(readDeclAs<FunctionDecl>());
1822 E->setOperatorDelete(readDeclAs<FunctionDecl>());
1823 E->AllocatedTypeInfo = readTypeSourceInfo();
Bruno Ricci9b6dfac2019-01-07 15:04:45 +00001824 if (IsParenTypeId)
John McCall3ce3d232019-12-13 03:37:23 -05001825 E->getTrailingObjects<SourceRange>()[0] = readSourceRange();
1826 E->Range = readSourceRange();
1827 E->DirectInitRange = readSourceRange();
Chandler Carruth01718152010-10-25 08:47:36 +00001828
Chris Lattnerabfb58d2010-05-10 01:22:27 +00001829 // Install all the subexpressions.
Bruno Ricci9b6dfac2019-01-07 15:04:45 +00001830 for (CXXNewExpr::raw_arg_iterator I = E->raw_arg_begin(),
1831 N = E->raw_arg_end();
1832 I != N; ++I)
David L. Jonesb6a8f022016-12-21 04:34:52 +00001833 *I = Record.readSubStmt();
Chris Lattnerabfb58d2010-05-10 01:22:27 +00001834}
1835
Sebastian Redl70c751d2010-08-18 23:56:52 +00001836void ASTStmtReader::VisitCXXDeleteExpr(CXXDeleteExpr *E) {
Argyrios Kyrtzidis6e57c352010-06-22 17:07:59 +00001837 VisitExpr(E);
Bruno Ricci91728fc2018-12-03 12:32:32 +00001838 E->CXXDeleteExprBits.GlobalDelete = Record.readInt();
1839 E->CXXDeleteExprBits.ArrayForm = Record.readInt();
1840 E->CXXDeleteExprBits.ArrayFormAsWritten = Record.readInt();
1841 E->CXXDeleteExprBits.UsualArrayDeleteWantsSize = Record.readInt();
John McCall3ce3d232019-12-13 03:37:23 -05001842 E->OperatorDelete = readDeclAs<FunctionDecl>();
David L. Jonesb6a8f022016-12-21 04:34:52 +00001843 E->Argument = Record.readSubExpr();
John McCall3ce3d232019-12-13 03:37:23 -05001844 E->CXXDeleteExprBits.Loc = readSourceLocation();
Argyrios Kyrtzidis6e57c352010-06-22 17:07:59 +00001845}
Chris Lattnercba86142010-05-10 00:25:06 +00001846
Sebastian Redl70c751d2010-08-18 23:56:52 +00001847void ASTStmtReader::VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr *E) {
Argyrios Kyrtzidis99a226d2010-06-28 09:32:03 +00001848 VisitExpr(E);
1849
David L. Jonesb6a8f022016-12-21 04:34:52 +00001850 E->Base = Record.readSubExpr();
David L. Jonesbe1557a2016-12-21 00:17:49 +00001851 E->IsArrow = Record.readInt();
John McCall3ce3d232019-12-13 03:37:23 -05001852 E->OperatorLoc = readSourceLocation();
David L. Jonesb6a8f022016-12-21 04:34:52 +00001853 E->QualifierLoc = Record.readNestedNameSpecifierLoc();
John McCall3ce3d232019-12-13 03:37:23 -05001854 E->ScopeType = readTypeSourceInfo();
1855 E->ColonColonLoc = readSourceLocation();
1856 E->TildeLoc = readSourceLocation();
David L. Jonesc4808b9e2016-12-15 20:53:26 +00001857
John McCall3ce3d232019-12-13 03:37:23 -05001858 IdentifierInfo *II = Record.readIdentifier();
Argyrios Kyrtzidis99a226d2010-06-28 09:32:03 +00001859 if (II)
John McCall3ce3d232019-12-13 03:37:23 -05001860 E->setDestroyedType(II, readSourceLocation());
Argyrios Kyrtzidis99a226d2010-06-28 09:32:03 +00001861 else
John McCall3ce3d232019-12-13 03:37:23 -05001862 E->setDestroyedType(readTypeSourceInfo());
Argyrios Kyrtzidis99a226d2010-06-28 09:32:03 +00001863}
1864
John McCall5d413782010-12-06 08:20:24 +00001865void ASTStmtReader::VisitExprWithCleanups(ExprWithCleanups *E) {
Chris Lattnercba86142010-05-10 00:25:06 +00001866 VisitExpr(E);
John McCall28fc7092011-11-10 05:35:25 +00001867
David L. Jonesbe1557a2016-12-21 00:17:49 +00001868 unsigned NumObjects = Record.readInt();
John McCall28fc7092011-11-10 05:35:25 +00001869 assert(NumObjects == E->getNumObjects());
Akira Hatanaka40568fe2020-03-10 14:06:25 -07001870 for (unsigned i = 0; i != NumObjects; ++i) {
1871 unsigned CleanupKind = Record.readInt();
1872 ExprWithCleanups::CleanupObject Obj;
1873 if (CleanupKind == COK_Block)
1874 Obj = readDeclAs<BlockDecl>();
1875 else if (CleanupKind == COK_CompoundLiteral)
1876 Obj = cast<CompoundLiteralExpr>(Record.readSubExpr());
1877 else
1878 llvm_unreachable("unexpected cleanup object type");
1879 E->getTrailingObjects<ExprWithCleanups::CleanupObject>()[i] = Obj;
1880 }
John McCall28fc7092011-11-10 05:35:25 +00001881
David L. Jonesbe1557a2016-12-21 00:17:49 +00001882 E->ExprWithCleanupsBits.CleanupsHaveSideEffects = Record.readInt();
David L. Jonesb6a8f022016-12-21 04:34:52 +00001883 E->SubExpr = Record.readSubExpr();
Chris Lattnere2437f42010-05-09 06:40:08 +00001884}
1885
Bruno Ricci2e6dc532019-01-08 14:17:00 +00001886void ASTStmtReader::VisitCXXDependentScopeMemberExpr(
1887 CXXDependentScopeMemberExpr *E) {
Argyrios Kyrtzidisbfcacee2010-06-24 08:57:31 +00001888 VisitExpr(E);
Abramo Bagnara7945c982012-01-27 09:46:47 +00001889
Bruno Ricci2e6dc532019-01-08 14:17:00 +00001890 bool HasTemplateKWAndArgsInfo = Record.readInt();
1891 unsigned NumTemplateArgs = Record.readInt();
1892 bool HasFirstQualifierFoundInScope = Record.readInt();
1893
1894 assert((HasTemplateKWAndArgsInfo == E->hasTemplateKWAndArgsInfo()) &&
1895 "Wrong HasTemplateKWAndArgsInfo!");
1896 assert(
1897 (HasFirstQualifierFoundInScope == E->hasFirstQualifierFoundInScope()) &&
1898 "Wrong HasFirstQualifierFoundInScope!");
1899
1900 if (HasTemplateKWAndArgsInfo)
James Y Knighte7d82282015-12-29 18:15:14 +00001901 ReadTemplateKWAndArgsInfo(
1902 *E->getTrailingObjects<ASTTemplateKWAndArgsInfo>(),
Bruno Ricci2e6dc532019-01-08 14:17:00 +00001903 E->getTrailingObjects<TemplateArgumentLoc>(), NumTemplateArgs);
Argyrios Kyrtzidisbfcacee2010-06-24 08:57:31 +00001904
Bruno Ricci2e6dc532019-01-08 14:17:00 +00001905 assert((NumTemplateArgs == E->getNumTemplateArgs()) &&
1906 "Wrong NumTemplateArgs!");
1907
1908 E->CXXDependentScopeMemberExprBits.IsArrow = Record.readInt();
John McCall3ce3d232019-12-13 03:37:23 -05001909 E->CXXDependentScopeMemberExprBits.OperatorLoc = readSourceLocation();
David L. Jonesbe1557a2016-12-21 00:17:49 +00001910 E->BaseType = Record.readType();
David L. Jonesb6a8f022016-12-21 04:34:52 +00001911 E->QualifierLoc = Record.readNestedNameSpecifierLoc();
Bruno Ricci2e6dc532019-01-08 14:17:00 +00001912 E->Base = Record.readSubExpr();
1913
1914 if (HasFirstQualifierFoundInScope)
John McCall3ce3d232019-12-13 03:37:23 -05001915 *E->getTrailingObjects<NamedDecl *>() = readDeclAs<NamedDecl>();
Bruno Ricci2e6dc532019-01-08 14:17:00 +00001916
John McCall3ce3d232019-12-13 03:37:23 -05001917 E->MemberNameInfo = Record.readDeclarationNameInfo();
Argyrios Kyrtzidisbfcacee2010-06-24 08:57:31 +00001918}
1919
Argyrios Kyrtzidisd0795b22010-06-28 22:28:35 +00001920void
Sebastian Redl70c751d2010-08-18 23:56:52 +00001921ASTStmtReader::VisitDependentScopeDeclRefExpr(DependentScopeDeclRefExpr *E) {
Argyrios Kyrtzidiscd444d1a2010-06-28 09:31:56 +00001922 VisitExpr(E);
Abramo Bagnara7945c982012-01-27 09:46:47 +00001923
David L. Jonesbe1557a2016-12-21 00:17:49 +00001924 if (Record.readInt()) // HasTemplateKWAndArgsInfo
James Y Knighte7d82282015-12-29 18:15:14 +00001925 ReadTemplateKWAndArgsInfo(
1926 *E->getTrailingObjects<ASTTemplateKWAndArgsInfo>(),
1927 E->getTrailingObjects<TemplateArgumentLoc>(),
David L. Jonesbe1557a2016-12-21 00:17:49 +00001928 /*NumTemplateArgs=*/Record.readInt());
Douglas Gregor3a43fd62011-02-25 20:49:16 +00001929
David L. Jonesb6a8f022016-12-21 04:34:52 +00001930 E->QualifierLoc = Record.readNestedNameSpecifierLoc();
John McCall3ce3d232019-12-13 03:37:23 -05001931 E->NameInfo = Record.readDeclarationNameInfo();
Argyrios Kyrtzidiscd444d1a2010-06-28 09:31:56 +00001932}
1933
Argyrios Kyrtzidisd0795b22010-06-28 22:28:35 +00001934void
Sebastian Redl70c751d2010-08-18 23:56:52 +00001935ASTStmtReader::VisitCXXUnresolvedConstructExpr(CXXUnresolvedConstructExpr *E) {
Argyrios Kyrtzidisbfcacee2010-06-24 08:57:31 +00001936 VisitExpr(E);
David L. Jonesbe1557a2016-12-21 00:17:49 +00001937 assert(Record.peekInt() == E->arg_size() &&
1938 "Read wrong record during creation ?");
1939 Record.skipInts(1);
Argyrios Kyrtzidisbfcacee2010-06-24 08:57:31 +00001940 for (unsigned I = 0, N = E->arg_size(); I != N; ++I)
David L. Jonesb6a8f022016-12-21 04:34:52 +00001941 E->setArg(I, Record.readSubExpr());
John McCall3ce3d232019-12-13 03:37:23 -05001942 E->TSI = readTypeSourceInfo();
1943 E->setLParenLoc(readSourceLocation());
1944 E->setRParenLoc(readSourceLocation());
Argyrios Kyrtzidisbfcacee2010-06-24 08:57:31 +00001945}
1946
Sebastian Redl70c751d2010-08-18 23:56:52 +00001947void ASTStmtReader::VisitOverloadExpr(OverloadExpr *E) {
Argyrios Kyrtzidisb8d3c632010-06-25 09:03:26 +00001948 VisitExpr(E);
Abramo Bagnara7945c982012-01-27 09:46:47 +00001949
Bruno Riccid7628d92019-01-09 15:43:19 +00001950 unsigned NumResults = Record.readInt();
1951 bool HasTemplateKWAndArgsInfo = Record.readInt();
1952 assert((E->getNumDecls() == NumResults) && "Wrong NumResults!");
1953 assert((E->hasTemplateKWAndArgsInfo() == HasTemplateKWAndArgsInfo) &&
1954 "Wrong HasTemplateKWAndArgsInfo!");
1955
1956 if (HasTemplateKWAndArgsInfo) {
1957 unsigned NumTemplateArgs = Record.readInt();
James Y Knighte7d82282015-12-29 18:15:14 +00001958 ReadTemplateKWAndArgsInfo(*E->getTrailingASTTemplateKWAndArgsInfo(),
1959 E->getTrailingTemplateArgumentLoc(),
Bruno Riccid7628d92019-01-09 15:43:19 +00001960 NumTemplateArgs);
1961 assert((E->getNumTemplateArgs() == NumTemplateArgs) &&
1962 "Wrong NumTemplateArgs!");
1963 }
Argyrios Kyrtzidisb8d3c632010-06-25 09:03:26 +00001964
Argyrios Kyrtzidisb8d3c632010-06-25 09:03:26 +00001965 UnresolvedSet<8> Decls;
Bruno Riccid7628d92019-01-09 15:43:19 +00001966 for (unsigned I = 0; I != NumResults; ++I) {
John McCall3ce3d232019-12-13 03:37:23 -05001967 auto *D = readDeclAs<NamedDecl>();
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +00001968 auto AS = (AccessSpecifier)Record.readInt();
Argyrios Kyrtzidisb8d3c632010-06-25 09:03:26 +00001969 Decls.addDecl(D, AS);
1970 }
Bruno Riccid7628d92019-01-09 15:43:19 +00001971
1972 DeclAccessPair *Results = E->getTrailingResults();
1973 UnresolvedSetIterator Iter = Decls.begin();
1974 for (unsigned I = 0; I != NumResults; ++I) {
1975 Results[I] = (Iter + I).getPair();
1976 }
Argyrios Kyrtzidisb8d3c632010-06-25 09:03:26 +00001977
John McCall3ce3d232019-12-13 03:37:23 -05001978 E->NameInfo = Record.readDeclarationNameInfo();
David L. Jonesb6a8f022016-12-21 04:34:52 +00001979 E->QualifierLoc = Record.readNestedNameSpecifierLoc();
Argyrios Kyrtzidisb8d3c632010-06-25 09:03:26 +00001980}
1981
Sebastian Redl70c751d2010-08-18 23:56:52 +00001982void ASTStmtReader::VisitUnresolvedMemberExpr(UnresolvedMemberExpr *E) {
Argyrios Kyrtzidisd0795b22010-06-28 22:28:35 +00001983 VisitOverloadExpr(E);
Bruno Riccid7628d92019-01-09 15:43:19 +00001984 E->UnresolvedMemberExprBits.IsArrow = Record.readInt();
1985 E->UnresolvedMemberExprBits.HasUnresolvedUsing = Record.readInt();
David L. Jonesb6a8f022016-12-21 04:34:52 +00001986 E->Base = Record.readSubExpr();
David L. Jonesbe1557a2016-12-21 00:17:49 +00001987 E->BaseType = Record.readType();
John McCall3ce3d232019-12-13 03:37:23 -05001988 E->OperatorLoc = readSourceLocation();
Argyrios Kyrtzidisb8d3c632010-06-25 09:03:26 +00001989}
1990
Sebastian Redl70c751d2010-08-18 23:56:52 +00001991void ASTStmtReader::VisitUnresolvedLookupExpr(UnresolvedLookupExpr *E) {
Argyrios Kyrtzidisd0795b22010-06-28 22:28:35 +00001992 VisitOverloadExpr(E);
Bruno Riccid7628d92019-01-09 15:43:19 +00001993 E->UnresolvedLookupExprBits.RequiresADL = Record.readInt();
1994 E->UnresolvedLookupExprBits.Overloaded = Record.readInt();
John McCall3ce3d232019-12-13 03:37:23 -05001995 E->NamingClass = readDeclAs<CXXRecordDecl>();
Argyrios Kyrtzidis58e01ad2010-06-25 09:03:34 +00001996}
1997
Douglas Gregor29c42f22012-02-24 07:38:34 +00001998void ASTStmtReader::VisitTypeTraitExpr(TypeTraitExpr *E) {
1999 VisitExpr(E);
David L. Jonesbe1557a2016-12-21 00:17:49 +00002000 E->TypeTraitExprBits.NumArgs = Record.readInt();
2001 E->TypeTraitExprBits.Kind = Record.readInt();
2002 E->TypeTraitExprBits.Value = Record.readInt();
John McCall3ce3d232019-12-13 03:37:23 -05002003 SourceRange Range = readSourceRange();
Jordan Rose99e80c12013-12-20 01:26:47 +00002004 E->Loc = Range.getBegin();
2005 E->RParenLoc = Range.getEnd();
2006
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +00002007 auto **Args = E->getTrailingObjects<TypeSourceInfo *>();
Douglas Gregor29c42f22012-02-24 07:38:34 +00002008 for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
John McCall3ce3d232019-12-13 03:37:23 -05002009 Args[I] = readTypeSourceInfo();
Douglas Gregor29c42f22012-02-24 07:38:34 +00002010}
2011
John Wiegley6242b6a2011-04-28 00:16:57 +00002012void ASTStmtReader::VisitArrayTypeTraitExpr(ArrayTypeTraitExpr *E) {
2013 VisitExpr(E);
David L. Jonesbe1557a2016-12-21 00:17:49 +00002014 E->ATT = (ArrayTypeTrait)Record.readInt();
2015 E->Value = (unsigned int)Record.readInt();
John McCall3ce3d232019-12-13 03:37:23 -05002016 SourceRange Range = readSourceRange();
John Wiegley6242b6a2011-04-28 00:16:57 +00002017 E->Loc = Range.getBegin();
2018 E->RParen = Range.getEnd();
John McCall3ce3d232019-12-13 03:37:23 -05002019 E->QueriedType = readTypeSourceInfo();
David L. Jonesb6a8f022016-12-21 04:34:52 +00002020 E->Dimension = Record.readSubExpr();
John Wiegley6242b6a2011-04-28 00:16:57 +00002021}
2022
John Wiegleyf9f65842011-04-25 06:54:41 +00002023void ASTStmtReader::VisitExpressionTraitExpr(ExpressionTraitExpr *E) {
2024 VisitExpr(E);
David L. Jonesbe1557a2016-12-21 00:17:49 +00002025 E->ET = (ExpressionTrait)Record.readInt();
2026 E->Value = (bool)Record.readInt();
John McCall3ce3d232019-12-13 03:37:23 -05002027 SourceRange Range = readSourceRange();
David L. Jonesb6a8f022016-12-21 04:34:52 +00002028 E->QueriedExpression = Record.readSubExpr();
John Wiegleyf9f65842011-04-25 06:54:41 +00002029 E->Loc = Range.getBegin();
2030 E->RParen = Range.getEnd();
2031}
2032
Sebastian Redl9ac55dd2010-09-10 20:55:54 +00002033void ASTStmtReader::VisitCXXNoexceptExpr(CXXNoexceptExpr *E) {
2034 VisitExpr(E);
Bruno Riccid56edfe2019-01-08 14:44:34 +00002035 E->CXXNoexceptExprBits.Value = Record.readInt();
John McCall3ce3d232019-12-13 03:37:23 -05002036 E->Range = readSourceRange();
David L. Jonesb6a8f022016-12-21 04:34:52 +00002037 E->Operand = Record.readSubExpr();
Sebastian Redl9ac55dd2010-09-10 20:55:54 +00002038}
2039
Douglas Gregore8e9dd62011-01-03 17:17:50 +00002040void ASTStmtReader::VisitPackExpansionExpr(PackExpansionExpr *E) {
2041 VisitExpr(E);
John McCall3ce3d232019-12-13 03:37:23 -05002042 E->EllipsisLoc = readSourceLocation();
David L. Jonesbe1557a2016-12-21 00:17:49 +00002043 E->NumExpansions = Record.readInt();
David L. Jonesb6a8f022016-12-21 04:34:52 +00002044 E->Pattern = Record.readSubExpr();
Douglas Gregore8e9dd62011-01-03 17:17:50 +00002045}
2046
Douglas Gregor820ba7b2011-01-04 17:33:58 +00002047void ASTStmtReader::VisitSizeOfPackExpr(SizeOfPackExpr *E) {
2048 VisitExpr(E);
David L. Jonesbe1557a2016-12-21 00:17:49 +00002049 unsigned NumPartialArgs = Record.readInt();
John McCall3ce3d232019-12-13 03:37:23 -05002050 E->OperatorLoc = readSourceLocation();
2051 E->PackLoc = readSourceLocation();
2052 E->RParenLoc = readSourceLocation();
David L. Jonesb6a8f022016-12-21 04:34:52 +00002053 E->Pack = Record.readDeclAs<NamedDecl>();
Richard Smithd784e682015-09-23 21:41:42 +00002054 if (E->isPartiallySubstituted()) {
2055 assert(E->Length == NumPartialArgs);
James Y Knighte00a67e2015-12-31 04:18:25 +00002056 for (auto *I = E->getTrailingObjects<TemplateArgument>(),
Richard Smithd784e682015-09-23 21:41:42 +00002057 *E = I + NumPartialArgs;
2058 I != E; ++I)
David L. Jonesb6a8f022016-12-21 04:34:52 +00002059 new (I) TemplateArgument(Record.readTemplateArgument());
Richard Smithd784e682015-09-23 21:41:42 +00002060 } else if (!E->isValueDependent()) {
David L. Jonesbe1557a2016-12-21 00:17:49 +00002061 E->Length = Record.readInt();
Richard Smithd784e682015-09-23 21:41:42 +00002062 }
Douglas Gregor820ba7b2011-01-04 17:33:58 +00002063}
2064
John McCallfa194042011-07-15 07:00:14 +00002065void ASTStmtReader::VisitSubstNonTypeTemplateParmExpr(
2066 SubstNonTypeTemplateParmExpr *E) {
2067 VisitExpr(E);
John McCall3ce3d232019-12-13 03:37:23 -05002068 E->Param = readDeclAs<NonTypeTemplateParmDecl>();
2069 E->SubstNonTypeTemplateParmExprBits.NameLoc = readSourceLocation();
David L. Jonesb6a8f022016-12-21 04:34:52 +00002070 E->Replacement = Record.readSubExpr();
John McCallfa194042011-07-15 07:00:14 +00002071}
2072
Douglas Gregorcdbc5392011-01-15 01:15:58 +00002073void ASTStmtReader::VisitSubstNonTypeTemplateParmPackExpr(
2074 SubstNonTypeTemplateParmPackExpr *E) {
2075 VisitExpr(E);
John McCall3ce3d232019-12-13 03:37:23 -05002076 E->Param = readDeclAs<NonTypeTemplateParmDecl>();
David L. Jonesb6a8f022016-12-21 04:34:52 +00002077 TemplateArgument ArgPack = Record.readTemplateArgument();
Douglas Gregorcdbc5392011-01-15 01:15:58 +00002078 if (ArgPack.getKind() != TemplateArgument::Pack)
2079 return;
David L. Jonesc4808b9e2016-12-15 20:53:26 +00002080
Douglas Gregorcdbc5392011-01-15 01:15:58 +00002081 E->Arguments = ArgPack.pack_begin();
2082 E->NumArguments = ArgPack.pack_size();
John McCall3ce3d232019-12-13 03:37:23 -05002083 E->NameLoc = readSourceLocation();
Douglas Gregorcdbc5392011-01-15 01:15:58 +00002084}
2085
Richard Smithb15fe3a2012-09-12 00:56:43 +00002086void ASTStmtReader::VisitFunctionParmPackExpr(FunctionParmPackExpr *E) {
2087 VisitExpr(E);
David L. Jonesbe1557a2016-12-21 00:17:49 +00002088 E->NumParameters = Record.readInt();
John McCall3ce3d232019-12-13 03:37:23 -05002089 E->ParamPack = readDeclAs<ParmVarDecl>();
2090 E->NameLoc = readSourceLocation();
Richard Smithb2997f52019-05-21 20:10:50 +00002091 auto **Parms = E->getTrailingObjects<VarDecl *>();
Richard Smithb15fe3a2012-09-12 00:56:43 +00002092 for (unsigned i = 0, n = E->NumParameters; i != n; ++i)
John McCall3ce3d232019-12-13 03:37:23 -05002093 Parms[i] = readDeclAs<VarDecl>();
Richard Smithb15fe3a2012-09-12 00:56:43 +00002094}
2095
Douglas Gregorfe314812011-06-21 17:03:29 +00002096void ASTStmtReader::VisitMaterializeTemporaryExpr(MaterializeTemporaryExpr *E) {
2097 VisitExpr(E);
Tykerb0561b32019-11-17 11:41:55 +01002098 bool HasMaterialzedDecl = Record.readInt();
2099 if (HasMaterialzedDecl)
2100 E->State = cast<LifetimeExtendedTemporaryDecl>(Record.readDecl());
2101 else
2102 E->State = Record.readSubExpr();
Douglas Gregorfe314812011-06-21 17:03:29 +00002103}
2104
Richard Smith0f0af192014-11-08 05:07:16 +00002105void ASTStmtReader::VisitCXXFoldExpr(CXXFoldExpr *E) {
2106 VisitExpr(E);
John McCall3ce3d232019-12-13 03:37:23 -05002107 E->LParenLoc = readSourceLocation();
2108 E->EllipsisLoc = readSourceLocation();
2109 E->RParenLoc = readSourceLocation();
Richard Smithc7214f62019-05-13 08:31:14 +00002110 E->NumExpansions = Record.readInt();
David L. Jonesb6a8f022016-12-21 04:34:52 +00002111 E->SubExprs[0] = Record.readSubExpr();
2112 E->SubExprs[1] = Record.readSubExpr();
David L. Jonesbe1557a2016-12-21 00:17:49 +00002113 E->Opcode = (BinaryOperatorKind)Record.readInt();
Richard Smith0f0af192014-11-08 05:07:16 +00002114}
2115
John McCall8d69a212010-11-15 23:31:06 +00002116void ASTStmtReader::VisitOpaqueValueExpr(OpaqueValueExpr *E) {
2117 VisitExpr(E);
David L. Jonesb6a8f022016-12-21 04:34:52 +00002118 E->SourceExpr = Record.readSubExpr();
John McCall3ce3d232019-12-13 03:37:23 -05002119 E->OpaqueValueExprBits.Loc = readSourceLocation();
Akira Hatanaka797afe32018-03-20 01:47:58 +00002120 E->setIsUnique(Record.readInt());
John McCall8d69a212010-11-15 23:31:06 +00002121}
2122
Kaelyn Takatae1f49d52014-10-27 18:07:20 +00002123void ASTStmtReader::VisitTypoExpr(TypoExpr *E) {
2124 llvm_unreachable("Cannot read TypoExpr nodes");
2125}
2126
Haojian Wu733edf92020-03-19 16:30:40 +01002127void ASTStmtReader::VisitRecoveryExpr(RecoveryExpr *E) {
2128 VisitExpr(E);
2129 unsigned NumArgs = Record.readInt();
2130 E->BeginLoc = readSourceLocation();
2131 E->EndLoc = readSourceLocation();
2132 assert(
2133 (NumArgs == std::distance(E->children().begin(), E->children().end())) &&
2134 "Wrong NumArgs!");
2135 (void)NumArgs;
2136 for (Stmt *&Child : E->children())
2137 Child = Record.readSubStmt();
2138}
2139
Peter Collingbourne41f85462011-02-09 21:07:24 +00002140//===----------------------------------------------------------------------===//
John McCallfa194042011-07-15 07:00:14 +00002141// Microsoft Expressions and Statements
2142//===----------------------------------------------------------------------===//
John McCall5e77d762013-04-16 07:28:30 +00002143void ASTStmtReader::VisitMSPropertyRefExpr(MSPropertyRefExpr *E) {
2144 VisitExpr(E);
David L. Jonesbe1557a2016-12-21 00:17:49 +00002145 E->IsArrow = (Record.readInt() != 0);
David L. Jonesb6a8f022016-12-21 04:34:52 +00002146 E->BaseExpr = Record.readSubExpr();
2147 E->QualifierLoc = Record.readNestedNameSpecifierLoc();
John McCall3ce3d232019-12-13 03:37:23 -05002148 E->MemberLoc = readSourceLocation();
2149 E->TheDecl = readDeclAs<MSPropertyDecl>();
John McCall5e77d762013-04-16 07:28:30 +00002150}
2151
Alexey Bataevf7630272015-11-25 12:01:00 +00002152void ASTStmtReader::VisitMSPropertySubscriptExpr(MSPropertySubscriptExpr *E) {
2153 VisitExpr(E);
David L. Jonesb6a8f022016-12-21 04:34:52 +00002154 E->setBase(Record.readSubExpr());
2155 E->setIdx(Record.readSubExpr());
John McCall3ce3d232019-12-13 03:37:23 -05002156 E->setRBracketLoc(readSourceLocation());
Alexey Bataevf7630272015-11-25 12:01:00 +00002157}
2158
John McCallfa194042011-07-15 07:00:14 +00002159void ASTStmtReader::VisitCXXUuidofExpr(CXXUuidofExpr *E) {
2160 VisitExpr(E);
John McCall3ce3d232019-12-13 03:37:23 -05002161 E->setSourceRange(readSourceRange());
2162 std::string UuidStr = readString();
David L. Jonesc4808b9e2016-12-15 20:53:26 +00002163 E->setUuidStr(StringRef(UuidStr).copy(Record.getContext()));
John McCallfa194042011-07-15 07:00:14 +00002164 if (E->isTypeOperand()) { // __uuidof(ComType)
2165 E->setTypeOperandSourceInfo(
John McCall3ce3d232019-12-13 03:37:23 -05002166 readTypeSourceInfo());
John McCallfa194042011-07-15 07:00:14 +00002167 return;
2168 }
David L. Jonesc4808b9e2016-12-15 20:53:26 +00002169
John McCallfa194042011-07-15 07:00:14 +00002170 // __uuidof(expr)
David L. Jonesb6a8f022016-12-21 04:34:52 +00002171 E->setExprOperand(Record.readSubExpr());
John McCallfa194042011-07-15 07:00:14 +00002172}
2173
Nico Weber9b982072014-07-07 00:12:30 +00002174void ASTStmtReader::VisitSEHLeaveStmt(SEHLeaveStmt *S) {
2175 VisitStmt(S);
John McCall3ce3d232019-12-13 03:37:23 -05002176 S->setLeaveLoc(readSourceLocation());
Nico Weber9b982072014-07-07 00:12:30 +00002177}
2178
John McCallfa194042011-07-15 07:00:14 +00002179void ASTStmtReader::VisitSEHExceptStmt(SEHExceptStmt *S) {
2180 VisitStmt(S);
John McCall3ce3d232019-12-13 03:37:23 -05002181 S->Loc = readSourceLocation();
David L. Jonesb6a8f022016-12-21 04:34:52 +00002182 S->Children[SEHExceptStmt::FILTER_EXPR] = Record.readSubStmt();
2183 S->Children[SEHExceptStmt::BLOCK] = Record.readSubStmt();
John McCallfa194042011-07-15 07:00:14 +00002184}
2185
2186void ASTStmtReader::VisitSEHFinallyStmt(SEHFinallyStmt *S) {
2187 VisitStmt(S);
John McCall3ce3d232019-12-13 03:37:23 -05002188 S->Loc = readSourceLocation();
David L. Jonesb6a8f022016-12-21 04:34:52 +00002189 S->Block = Record.readSubStmt();
John McCallfa194042011-07-15 07:00:14 +00002190}
2191
2192void ASTStmtReader::VisitSEHTryStmt(SEHTryStmt *S) {
2193 VisitStmt(S);
David L. Jonesbe1557a2016-12-21 00:17:49 +00002194 S->IsCXXTry = Record.readInt();
John McCall3ce3d232019-12-13 03:37:23 -05002195 S->TryLoc = readSourceLocation();
David L. Jonesb6a8f022016-12-21 04:34:52 +00002196 S->Children[SEHTryStmt::TRY] = Record.readSubStmt();
2197 S->Children[SEHTryStmt::HANDLER] = Record.readSubStmt();
John McCallfa194042011-07-15 07:00:14 +00002198}
2199
2200//===----------------------------------------------------------------------===//
Peter Collingbourne41f85462011-02-09 21:07:24 +00002201// CUDA Expressions and Statements
2202//===----------------------------------------------------------------------===//
2203
2204void ASTStmtReader::VisitCUDAKernelCallExpr(CUDAKernelCallExpr *E) {
2205 VisitCallExpr(E);
Richard Smithfd420792019-05-24 23:26:07 +00002206 E->setPreArg(CUDAKernelCallExpr::CONFIG, Record.readSubExpr());
Peter Collingbourne41f85462011-02-09 21:07:24 +00002207}
2208
John McCallfa194042011-07-15 07:00:14 +00002209//===----------------------------------------------------------------------===//
2210// OpenCL Expressions and Statements.
2211//===----------------------------------------------------------------------===//
2212void ASTStmtReader::VisitAsTypeExpr(AsTypeExpr *E) {
2213 VisitExpr(E);
John McCall3ce3d232019-12-13 03:37:23 -05002214 E->BuiltinLoc = readSourceLocation();
2215 E->RParenLoc = readSourceLocation();
David L. Jonesb6a8f022016-12-21 04:34:52 +00002216 E->SrcExpr = Record.readSubExpr();
John McCallfa194042011-07-15 07:00:14 +00002217}
2218
2219//===----------------------------------------------------------------------===//
Alexey Bataev5ec3eb12013-07-19 03:13:43 +00002220// OpenMP Directives.
2221//===----------------------------------------------------------------------===//
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +00002222
Alexey Bataev5ec3eb12013-07-19 03:13:43 +00002223void ASTStmtReader::VisitOMPExecutableDirective(OMPExecutableDirective *E) {
John McCall3ce3d232019-12-13 03:37:23 -05002224 E->setLocStart(readSourceLocation());
2225 E->setLocEnd(readSourceLocation());
Alexey Bataev5ec3eb12013-07-19 03:13:43 +00002226 SmallVector<OMPClause *, 5> Clauses;
2227 for (unsigned i = 0; i < E->getNumClauses(); ++i)
John McCallc2f18312019-12-14 03:01:28 -05002228 Clauses.push_back(Record.readOMPClause());
Alexey Bataev5ec3eb12013-07-19 03:13:43 +00002229 E->setClauses(Clauses);
Alexey Bataev68446b72014-07-18 07:47:19 +00002230 if (E->hasAssociatedStmt())
David L. Jonesb6a8f022016-12-21 04:34:52 +00002231 E->setAssociatedStmt(Record.readSubStmt());
Alexey Bataev5ec3eb12013-07-19 03:13:43 +00002232}
2233
Alexander Musman3aaab662014-08-19 11:27:13 +00002234void ASTStmtReader::VisitOMPLoopDirective(OMPLoopDirective *D) {
2235 VisitStmt(D);
2236 // Two fields (NumClauses and CollapsedNum) were read in ReadStmtFromStream.
David L. Jonesbe1557a2016-12-21 00:17:49 +00002237 Record.skipInts(2);
Alexander Musman3aaab662014-08-19 11:27:13 +00002238 VisitOMPExecutableDirective(D);
David L. Jonesb6a8f022016-12-21 04:34:52 +00002239 D->setIterationVariable(Record.readSubExpr());
2240 D->setLastIteration(Record.readSubExpr());
2241 D->setCalcLastIteration(Record.readSubExpr());
2242 D->setPreCond(Record.readSubExpr());
2243 D->setCond(Record.readSubExpr());
2244 D->setInit(Record.readSubExpr());
2245 D->setInc(Record.readSubExpr());
2246 D->setPreInits(Record.readSubStmt());
Alexey Bataev3392d762016-02-16 11:18:12 +00002247 if (isOpenMPWorksharingDirective(D->getDirectiveKind()) ||
Carlo Bertollifc35ad22016-03-07 16:04:49 +00002248 isOpenMPTaskLoopDirective(D->getDirectiveKind()) ||
2249 isOpenMPDistributeDirective(D->getDirectiveKind())) {
David L. Jonesb6a8f022016-12-21 04:34:52 +00002250 D->setIsLastIterVariable(Record.readSubExpr());
2251 D->setLowerBoundVariable(Record.readSubExpr());
2252 D->setUpperBoundVariable(Record.readSubExpr());
2253 D->setStrideVariable(Record.readSubExpr());
2254 D->setEnsureUpperBound(Record.readSubExpr());
2255 D->setNextLowerBound(Record.readSubExpr());
2256 D->setNextUpperBound(Record.readSubExpr());
2257 D->setNumIterations(Record.readSubExpr());
Alexander Musmanc6388682014-12-15 07:07:06 +00002258 }
Carlo Bertolli9925f152016-06-27 14:55:37 +00002259 if (isOpenMPLoopBoundSharingDirective(D->getDirectiveKind())) {
David L. Jonesb6a8f022016-12-21 04:34:52 +00002260 D->setPrevLowerBoundVariable(Record.readSubExpr());
2261 D->setPrevUpperBoundVariable(Record.readSubExpr());
Carlo Bertolli8429d812017-02-17 21:29:13 +00002262 D->setDistInc(Record.readSubExpr());
2263 D->setPrevEnsureUpperBound(Record.readSubExpr());
Carlo Bertolliffafe102017-04-20 00:39:39 +00002264 D->setCombinedLowerBoundVariable(Record.readSubExpr());
2265 D->setCombinedUpperBoundVariable(Record.readSubExpr());
2266 D->setCombinedEnsureUpperBound(Record.readSubExpr());
2267 D->setCombinedInit(Record.readSubExpr());
2268 D->setCombinedCond(Record.readSubExpr());
2269 D->setCombinedNextLowerBound(Record.readSubExpr());
2270 D->setCombinedNextUpperBound(Record.readSubExpr());
Gheorghe-Teodor Berceae9256762018-10-29 15:45:47 +00002271 D->setCombinedDistCond(Record.readSubExpr());
2272 D->setCombinedParForInDistCond(Record.readSubExpr());
Carlo Bertolli9925f152016-06-27 14:55:37 +00002273 }
Alexander Musmana5f070a2014-10-01 06:03:56 +00002274 SmallVector<Expr *, 4> Sub;
2275 unsigned CollapsedNum = D->getCollapsedNumber();
2276 Sub.reserve(CollapsedNum);
2277 for (unsigned i = 0; i < CollapsedNum; ++i)
David L. Jonesb6a8f022016-12-21 04:34:52 +00002278 Sub.push_back(Record.readSubExpr());
Alexander Musmana5f070a2014-10-01 06:03:56 +00002279 D->setCounters(Sub);
2280 Sub.clear();
2281 for (unsigned i = 0; i < CollapsedNum; ++i)
David L. Jonesb6a8f022016-12-21 04:34:52 +00002282 Sub.push_back(Record.readSubExpr());
Alexey Bataeva8899172015-08-06 12:30:57 +00002283 D->setPrivateCounters(Sub);
2284 Sub.clear();
2285 for (unsigned i = 0; i < CollapsedNum; ++i)
David L. Jonesb6a8f022016-12-21 04:34:52 +00002286 Sub.push_back(Record.readSubExpr());
Alexey Bataevb08f89f2015-08-14 12:25:37 +00002287 D->setInits(Sub);
2288 Sub.clear();
2289 for (unsigned i = 0; i < CollapsedNum; ++i)
David L. Jonesb6a8f022016-12-21 04:34:52 +00002290 Sub.push_back(Record.readSubExpr());
Alexander Musmana5f070a2014-10-01 06:03:56 +00002291 D->setUpdates(Sub);
2292 Sub.clear();
2293 for (unsigned i = 0; i < CollapsedNum; ++i)
David L. Jonesb6a8f022016-12-21 04:34:52 +00002294 Sub.push_back(Record.readSubExpr());
Alexander Musmana5f070a2014-10-01 06:03:56 +00002295 D->setFinals(Sub);
Alexey Bataevf8be4762019-08-14 19:30:06 +00002296 Sub.clear();
2297 for (unsigned i = 0; i < CollapsedNum; ++i)
2298 Sub.push_back(Record.readSubExpr());
2299 D->setDependentCounters(Sub);
2300 Sub.clear();
2301 for (unsigned i = 0; i < CollapsedNum; ++i)
2302 Sub.push_back(Record.readSubExpr());
2303 D->setDependentInits(Sub);
2304 Sub.clear();
2305 for (unsigned i = 0; i < CollapsedNum; ++i)
2306 Sub.push_back(Record.readSubExpr());
2307 D->setFinalsConditions(Sub);
Alexander Musman3aaab662014-08-19 11:27:13 +00002308}
2309
Alexey Bataev5ec3eb12013-07-19 03:13:43 +00002310void ASTStmtReader::VisitOMPParallelDirective(OMPParallelDirective *D) {
Alexey Bataev1b59ab52014-02-27 08:29:12 +00002311 VisitStmt(D);
2312 // The NumClauses field was read in ReadStmtFromStream.
David L. Jonesbe1557a2016-12-21 00:17:49 +00002313 Record.skipInts(1);
Alexey Bataev1b59ab52014-02-27 08:29:12 +00002314 VisitOMPExecutableDirective(D);
David L. Jonesbe1557a2016-12-21 00:17:49 +00002315 D->setHasCancel(Record.readInt());
Alexey Bataev1b59ab52014-02-27 08:29:12 +00002316}
2317
2318void ASTStmtReader::VisitOMPSimdDirective(OMPSimdDirective *D) {
Alexander Musman3aaab662014-08-19 11:27:13 +00002319 VisitOMPLoopDirective(D);
Alexey Bataev5ec3eb12013-07-19 03:13:43 +00002320}
2321
Alexey Bataevf29276e2014-06-18 04:14:57 +00002322void ASTStmtReader::VisitOMPForDirective(OMPForDirective *D) {
Alexander Musman3aaab662014-08-19 11:27:13 +00002323 VisitOMPLoopDirective(D);
David L. Jonesbe1557a2016-12-21 00:17:49 +00002324 D->setHasCancel(Record.readInt());
Alexey Bataevf29276e2014-06-18 04:14:57 +00002325}
2326
Alexander Musmanf82886e2014-09-18 05:12:34 +00002327void ASTStmtReader::VisitOMPForSimdDirective(OMPForSimdDirective *D) {
2328 VisitOMPLoopDirective(D);
2329}
2330
Alexey Bataevd3f8dd22014-06-25 11:44:49 +00002331void ASTStmtReader::VisitOMPSectionsDirective(OMPSectionsDirective *D) {
2332 VisitStmt(D);
2333 // The NumClauses field was read in ReadStmtFromStream.
David L. Jonesbe1557a2016-12-21 00:17:49 +00002334 Record.skipInts(1);
Alexey Bataevd3f8dd22014-06-25 11:44:49 +00002335 VisitOMPExecutableDirective(D);
David L. Jonesbe1557a2016-12-21 00:17:49 +00002336 D->setHasCancel(Record.readInt());
Alexey Bataevd3f8dd22014-06-25 11:44:49 +00002337}
2338
Alexey Bataev1e0498a2014-06-26 08:21:58 +00002339void ASTStmtReader::VisitOMPSectionDirective(OMPSectionDirective *D) {
2340 VisitStmt(D);
2341 VisitOMPExecutableDirective(D);
David L. Jonesbe1557a2016-12-21 00:17:49 +00002342 D->setHasCancel(Record.readInt());
Alexey Bataev1e0498a2014-06-26 08:21:58 +00002343}
2344
Alexey Bataevd1e40fb2014-06-26 12:05:45 +00002345void ASTStmtReader::VisitOMPSingleDirective(OMPSingleDirective *D) {
2346 VisitStmt(D);
2347 // The NumClauses field was read in ReadStmtFromStream.
David L. Jonesbe1557a2016-12-21 00:17:49 +00002348 Record.skipInts(1);
Alexey Bataevd1e40fb2014-06-26 12:05:45 +00002349 VisitOMPExecutableDirective(D);
2350}
2351
Alexander Musman80c22892014-07-17 08:54:58 +00002352void ASTStmtReader::VisitOMPMasterDirective(OMPMasterDirective *D) {
2353 VisitStmt(D);
2354 VisitOMPExecutableDirective(D);
2355}
2356
Alexander Musmand9ed09f2014-07-21 09:42:05 +00002357void ASTStmtReader::VisitOMPCriticalDirective(OMPCriticalDirective *D) {
2358 VisitStmt(D);
Alexey Bataev28c75412015-12-15 08:19:24 +00002359 // The NumClauses field was read in ReadStmtFromStream.
David L. Jonesbe1557a2016-12-21 00:17:49 +00002360 Record.skipInts(1);
Alexander Musmand9ed09f2014-07-21 09:42:05 +00002361 VisitOMPExecutableDirective(D);
John McCall3ce3d232019-12-13 03:37:23 -05002362 D->DirName = Record.readDeclarationNameInfo();
Alexander Musmand9ed09f2014-07-21 09:42:05 +00002363}
2364
Alexey Bataev4acb8592014-07-07 13:01:15 +00002365void ASTStmtReader::VisitOMPParallelForDirective(OMPParallelForDirective *D) {
Alexander Musman3aaab662014-08-19 11:27:13 +00002366 VisitOMPLoopDirective(D);
David L. Jonesbe1557a2016-12-21 00:17:49 +00002367 D->setHasCancel(Record.readInt());
Alexey Bataev4acb8592014-07-07 13:01:15 +00002368}
2369
Alexander Musmane4e893b2014-09-23 09:33:00 +00002370void ASTStmtReader::VisitOMPParallelForSimdDirective(
2371 OMPParallelForSimdDirective *D) {
2372 VisitOMPLoopDirective(D);
2373}
2374
cchen47d60942019-12-05 13:43:48 -05002375void ASTStmtReader::VisitOMPParallelMasterDirective(
2376 OMPParallelMasterDirective *D) {
2377 VisitStmt(D);
2378 // The NumClauses field was read in ReadStmtFromStream.
2379 Record.skipInts(1);
2380 VisitOMPExecutableDirective(D);
2381}
2382
Alexey Bataev84d0b3e2014-07-08 08:12:03 +00002383void ASTStmtReader::VisitOMPParallelSectionsDirective(
2384 OMPParallelSectionsDirective *D) {
2385 VisitStmt(D);
2386 // The NumClauses field was read in ReadStmtFromStream.
David L. Jonesbe1557a2016-12-21 00:17:49 +00002387 Record.skipInts(1);
Alexey Bataev84d0b3e2014-07-08 08:12:03 +00002388 VisitOMPExecutableDirective(D);
David L. Jonesbe1557a2016-12-21 00:17:49 +00002389 D->setHasCancel(Record.readInt());
Alexey Bataev84d0b3e2014-07-08 08:12:03 +00002390}
2391
Alexey Bataev9c2e8ee2014-07-11 11:25:16 +00002392void ASTStmtReader::VisitOMPTaskDirective(OMPTaskDirective *D) {
2393 VisitStmt(D);
2394 // The NumClauses field was read in ReadStmtFromStream.
David L. Jonesbe1557a2016-12-21 00:17:49 +00002395 Record.skipInts(1);
Alexey Bataev9c2e8ee2014-07-11 11:25:16 +00002396 VisitOMPExecutableDirective(D);
David L. Jonesbe1557a2016-12-21 00:17:49 +00002397 D->setHasCancel(Record.readInt());
Alexey Bataev9c2e8ee2014-07-11 11:25:16 +00002398}
2399
Alexey Bataev68446b72014-07-18 07:47:19 +00002400void ASTStmtReader::VisitOMPTaskyieldDirective(OMPTaskyieldDirective *D) {
2401 VisitStmt(D);
2402 VisitOMPExecutableDirective(D);
2403}
2404
Alexey Bataev4d1dfea2014-07-18 09:11:51 +00002405void ASTStmtReader::VisitOMPBarrierDirective(OMPBarrierDirective *D) {
2406 VisitStmt(D);
2407 VisitOMPExecutableDirective(D);
2408}
2409
Alexey Bataev2df347a2014-07-18 10:17:07 +00002410void ASTStmtReader::VisitOMPTaskwaitDirective(OMPTaskwaitDirective *D) {
2411 VisitStmt(D);
2412 VisitOMPExecutableDirective(D);
2413}
2414
Alexey Bataevc30dd2d2015-06-18 12:14:09 +00002415void ASTStmtReader::VisitOMPTaskgroupDirective(OMPTaskgroupDirective *D) {
2416 VisitStmt(D);
Alexey Bataev169d96a2017-07-18 20:17:46 +00002417 // The NumClauses field was read in ReadStmtFromStream.
2418 Record.skipInts(1);
Alexey Bataevc30dd2d2015-06-18 12:14:09 +00002419 VisitOMPExecutableDirective(D);
Alexey Bataev3b1b8952017-07-25 15:53:26 +00002420 D->setReductionRef(Record.readSubExpr());
Alexey Bataevc30dd2d2015-06-18 12:14:09 +00002421}
2422
Alexey Bataev6125da92014-07-21 11:26:11 +00002423void ASTStmtReader::VisitOMPFlushDirective(OMPFlushDirective *D) {
2424 VisitStmt(D);
2425 // The NumClauses field was read in ReadStmtFromStream.
David L. Jonesbe1557a2016-12-21 00:17:49 +00002426 Record.skipInts(1);
Alexey Bataev6125da92014-07-21 11:26:11 +00002427 VisitOMPExecutableDirective(D);
2428}
2429
Alexey Bataevc112e942020-02-28 09:52:15 -05002430void ASTStmtReader::VisitOMPDepobjDirective(OMPDepobjDirective *D) {
2431 VisitStmt(D);
2432 // The NumClauses field was read in ReadStmtFromStream.
2433 Record.skipInts(1);
2434 VisitOMPExecutableDirective(D);
2435}
2436
Alexey Bataevfcba7c32020-03-20 07:03:01 -04002437void ASTStmtReader::VisitOMPScanDirective(OMPScanDirective *D) {
2438 VisitStmt(D);
2439 // The NumClauses field was read in ReadStmtFromStream.
2440 Record.skipInts(1);
2441 VisitOMPExecutableDirective(D);
2442}
2443
Alexey Bataev9fb6e642014-07-22 06:45:04 +00002444void ASTStmtReader::VisitOMPOrderedDirective(OMPOrderedDirective *D) {
2445 VisitStmt(D);
Alexey Bataev346265e2015-09-25 10:37:12 +00002446 // The NumClauses field was read in ReadStmtFromStream.
David L. Jonesbe1557a2016-12-21 00:17:49 +00002447 Record.skipInts(1);
Alexey Bataev9fb6e642014-07-22 06:45:04 +00002448 VisitOMPExecutableDirective(D);
2449}
2450
Alexey Bataev0162e452014-07-22 10:10:35 +00002451void ASTStmtReader::VisitOMPAtomicDirective(OMPAtomicDirective *D) {
2452 VisitStmt(D);
2453 // The NumClauses field was read in ReadStmtFromStream.
David L. Jonesbe1557a2016-12-21 00:17:49 +00002454 Record.skipInts(1);
Alexey Bataev0162e452014-07-22 10:10:35 +00002455 VisitOMPExecutableDirective(D);
David L. Jonesb6a8f022016-12-21 04:34:52 +00002456 D->setX(Record.readSubExpr());
2457 D->setV(Record.readSubExpr());
2458 D->setExpr(Record.readSubExpr());
2459 D->setUpdateExpr(Record.readSubExpr());
David L. Jonesbe1557a2016-12-21 00:17:49 +00002460 D->IsXLHSInRHSPart = Record.readInt() != 0;
2461 D->IsPostfixUpdate = Record.readInt() != 0;
Alexey Bataev0162e452014-07-22 10:10:35 +00002462}
2463
Alexey Bataev0bd520b2014-09-19 08:19:49 +00002464void ASTStmtReader::VisitOMPTargetDirective(OMPTargetDirective *D) {
2465 VisitStmt(D);
2466 // The NumClauses field was read in ReadStmtFromStream.
David L. Jonesbe1557a2016-12-21 00:17:49 +00002467 Record.skipInts(1);
Alexey Bataev0bd520b2014-09-19 08:19:49 +00002468 VisitOMPExecutableDirective(D);
2469}
2470
Michael Wong65f367f2015-07-21 13:44:28 +00002471void ASTStmtReader::VisitOMPTargetDataDirective(OMPTargetDataDirective *D) {
2472 VisitStmt(D);
David L. Jonesbe1557a2016-12-21 00:17:49 +00002473 Record.skipInts(1);
Michael Wong65f367f2015-07-21 13:44:28 +00002474 VisitOMPExecutableDirective(D);
2475}
2476
Samuel Antaodf67fc42016-01-19 19:15:56 +00002477void ASTStmtReader::VisitOMPTargetEnterDataDirective(
2478 OMPTargetEnterDataDirective *D) {
2479 VisitStmt(D);
David L. Jonesbe1557a2016-12-21 00:17:49 +00002480 Record.skipInts(1);
Samuel Antaodf67fc42016-01-19 19:15:56 +00002481 VisitOMPExecutableDirective(D);
2482}
2483
Samuel Antao72590762016-01-19 20:04:50 +00002484void ASTStmtReader::VisitOMPTargetExitDataDirective(
2485 OMPTargetExitDataDirective *D) {
2486 VisitStmt(D);
David L. Jonesbe1557a2016-12-21 00:17:49 +00002487 Record.skipInts(1);
Samuel Antao72590762016-01-19 20:04:50 +00002488 VisitOMPExecutableDirective(D);
2489}
2490
Arpith Chacko Jacobe955b3d2016-01-26 18:48:41 +00002491void ASTStmtReader::VisitOMPTargetParallelDirective(
2492 OMPTargetParallelDirective *D) {
2493 VisitStmt(D);
David L. Jonesbe1557a2016-12-21 00:17:49 +00002494 Record.skipInts(1);
Arpith Chacko Jacobe955b3d2016-01-26 18:48:41 +00002495 VisitOMPExecutableDirective(D);
2496}
2497
Arpith Chacko Jacob05bebb52016-02-03 15:46:42 +00002498void ASTStmtReader::VisitOMPTargetParallelForDirective(
2499 OMPTargetParallelForDirective *D) {
2500 VisitOMPLoopDirective(D);
David L. Jonesbe1557a2016-12-21 00:17:49 +00002501 D->setHasCancel(Record.readInt());
Arpith Chacko Jacob05bebb52016-02-03 15:46:42 +00002502}
2503
Alexey Bataev13314bf2014-10-09 04:18:56 +00002504void ASTStmtReader::VisitOMPTeamsDirective(OMPTeamsDirective *D) {
2505 VisitStmt(D);
2506 // The NumClauses field was read in ReadStmtFromStream.
David L. Jonesbe1557a2016-12-21 00:17:49 +00002507 Record.skipInts(1);
Alexey Bataev13314bf2014-10-09 04:18:56 +00002508 VisitOMPExecutableDirective(D);
2509}
2510
Alexey Bataev6d4ed052015-07-01 06:57:41 +00002511void ASTStmtReader::VisitOMPCancellationPointDirective(
2512 OMPCancellationPointDirective *D) {
2513 VisitStmt(D);
2514 VisitOMPExecutableDirective(D);
David L. Jonesbe1557a2016-12-21 00:17:49 +00002515 D->setCancelRegion(static_cast<OpenMPDirectiveKind>(Record.readInt()));
Alexey Bataev6d4ed052015-07-01 06:57:41 +00002516}
2517
Alexey Bataev80909872015-07-02 11:25:17 +00002518void ASTStmtReader::VisitOMPCancelDirective(OMPCancelDirective *D) {
2519 VisitStmt(D);
Alexey Bataev87933c72015-09-18 08:07:34 +00002520 // The NumClauses field was read in ReadStmtFromStream.
David L. Jonesbe1557a2016-12-21 00:17:49 +00002521 Record.skipInts(1);
Alexey Bataev80909872015-07-02 11:25:17 +00002522 VisitOMPExecutableDirective(D);
David L. Jonesbe1557a2016-12-21 00:17:49 +00002523 D->setCancelRegion(static_cast<OpenMPDirectiveKind>(Record.readInt()));
Alexey Bataev80909872015-07-02 11:25:17 +00002524}
2525
Alexey Bataev49f6e782015-12-01 04:18:41 +00002526void ASTStmtReader::VisitOMPTaskLoopDirective(OMPTaskLoopDirective *D) {
2527 VisitOMPLoopDirective(D);
Alexey Bataeve0ca4792020-02-12 16:12:53 -05002528 D->setHasCancel(Record.readInt());
Alexey Bataev49f6e782015-12-01 04:18:41 +00002529}
2530
Alexey Bataev0a6ed842015-12-03 09:40:15 +00002531void ASTStmtReader::VisitOMPTaskLoopSimdDirective(OMPTaskLoopSimdDirective *D) {
2532 VisitOMPLoopDirective(D);
2533}
2534
Alexey Bataev60e51c42019-10-10 20:13:02 +00002535void ASTStmtReader::VisitOMPMasterTaskLoopDirective(
2536 OMPMasterTaskLoopDirective *D) {
2537 VisitOMPLoopDirective(D);
Alexey Bataeve0ca4792020-02-12 16:12:53 -05002538 D->setHasCancel(Record.readInt());
Alexey Bataev60e51c42019-10-10 20:13:02 +00002539}
2540
Alexey Bataevb8552ab2019-10-18 16:47:35 +00002541void ASTStmtReader::VisitOMPMasterTaskLoopSimdDirective(
2542 OMPMasterTaskLoopSimdDirective *D) {
2543 VisitOMPLoopDirective(D);
2544}
2545
Alexey Bataev5bbcead2019-10-14 17:17:41 +00002546void ASTStmtReader::VisitOMPParallelMasterTaskLoopDirective(
2547 OMPParallelMasterTaskLoopDirective *D) {
2548 VisitOMPLoopDirective(D);
Alexey Bataeve0ca4792020-02-12 16:12:53 -05002549 D->setHasCancel(Record.readInt());
Alexey Bataev5bbcead2019-10-14 17:17:41 +00002550}
2551
Alexey Bataev14a388f2019-10-25 10:27:13 -04002552void ASTStmtReader::VisitOMPParallelMasterTaskLoopSimdDirective(
2553 OMPParallelMasterTaskLoopSimdDirective *D) {
2554 VisitOMPLoopDirective(D);
2555}
2556
Carlo Bertolli6200a3d2015-12-14 14:51:25 +00002557void ASTStmtReader::VisitOMPDistributeDirective(OMPDistributeDirective *D) {
2558 VisitOMPLoopDirective(D);
2559}
2560
Samuel Antao686c70c2016-05-26 17:30:50 +00002561void ASTStmtReader::VisitOMPTargetUpdateDirective(OMPTargetUpdateDirective *D) {
2562 VisitStmt(D);
David L. Jonesbe1557a2016-12-21 00:17:49 +00002563 Record.skipInts(1);
Samuel Antao686c70c2016-05-26 17:30:50 +00002564 VisitOMPExecutableDirective(D);
2565}
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +00002566
Carlo Bertolli9925f152016-06-27 14:55:37 +00002567void ASTStmtReader::VisitOMPDistributeParallelForDirective(
2568 OMPDistributeParallelForDirective *D) {
2569 VisitOMPLoopDirective(D);
Alexey Bataevdcb4b8fb2017-11-22 20:19:50 +00002570 D->setHasCancel(Record.readInt());
Carlo Bertolli9925f152016-06-27 14:55:37 +00002571}
Samuel Antao686c70c2016-05-26 17:30:50 +00002572
Kelvin Li4a39add2016-07-05 05:00:15 +00002573void ASTStmtReader::VisitOMPDistributeParallelForSimdDirective(
2574 OMPDistributeParallelForSimdDirective *D) {
2575 VisitOMPLoopDirective(D);
2576}
2577
Kelvin Li787f3fc2016-07-06 04:45:38 +00002578void ASTStmtReader::VisitOMPDistributeSimdDirective(
2579 OMPDistributeSimdDirective *D) {
2580 VisitOMPLoopDirective(D);
2581}
2582
Kelvin Lia579b912016-07-14 02:54:56 +00002583void ASTStmtReader::VisitOMPTargetParallelForSimdDirective(
2584 OMPTargetParallelForSimdDirective *D) {
2585 VisitOMPLoopDirective(D);
2586}
2587
Kelvin Li986330c2016-07-20 22:57:10 +00002588void ASTStmtReader::VisitOMPTargetSimdDirective(OMPTargetSimdDirective *D) {
2589 VisitOMPLoopDirective(D);
2590}
2591
Kelvin Li02532872016-08-05 14:37:37 +00002592void ASTStmtReader::VisitOMPTeamsDistributeDirective(
2593 OMPTeamsDistributeDirective *D) {
2594 VisitOMPLoopDirective(D);
2595}
2596
Kelvin Li4e325f72016-10-25 12:50:55 +00002597void ASTStmtReader::VisitOMPTeamsDistributeSimdDirective(
2598 OMPTeamsDistributeSimdDirective *D) {
2599 VisitOMPLoopDirective(D);
2600}
2601
Kelvin Li579e41c2016-11-30 23:51:03 +00002602void ASTStmtReader::VisitOMPTeamsDistributeParallelForSimdDirective(
2603 OMPTeamsDistributeParallelForSimdDirective *D) {
2604 VisitOMPLoopDirective(D);
2605}
2606
Kelvin Li7ade93f2016-12-09 03:24:30 +00002607void ASTStmtReader::VisitOMPTeamsDistributeParallelForDirective(
2608 OMPTeamsDistributeParallelForDirective *D) {
2609 VisitOMPLoopDirective(D);
Alexey Bataevdcb4b8fb2017-11-22 20:19:50 +00002610 D->setHasCancel(Record.readInt());
Kelvin Li7ade93f2016-12-09 03:24:30 +00002611}
2612
Kelvin Libf594a52016-12-17 05:48:59 +00002613void ASTStmtReader::VisitOMPTargetTeamsDirective(OMPTargetTeamsDirective *D) {
2614 VisitStmt(D);
2615 // The NumClauses field was read in ReadStmtFromStream.
David L. Jonesbe1557a2016-12-21 00:17:49 +00002616 Record.skipInts(1);
Kelvin Libf594a52016-12-17 05:48:59 +00002617 VisitOMPExecutableDirective(D);
2618}
2619
Kelvin Li83c451e2016-12-25 04:52:54 +00002620void ASTStmtReader::VisitOMPTargetTeamsDistributeDirective(
2621 OMPTargetTeamsDistributeDirective *D) {
2622 VisitOMPLoopDirective(D);
2623}
2624
Kelvin Li80e8f562016-12-29 22:16:30 +00002625void ASTStmtReader::VisitOMPTargetTeamsDistributeParallelForDirective(
2626 OMPTargetTeamsDistributeParallelForDirective *D) {
2627 VisitOMPLoopDirective(D);
Alexey Bataev16e79882017-11-22 21:12:03 +00002628 D->setHasCancel(Record.readInt());
Kelvin Li80e8f562016-12-29 22:16:30 +00002629}
2630
Kelvin Li1851df52017-01-03 05:23:48 +00002631void ASTStmtReader::VisitOMPTargetTeamsDistributeParallelForSimdDirective(
2632 OMPTargetTeamsDistributeParallelForSimdDirective *D) {
2633 VisitOMPLoopDirective(D);
2634}
2635
Kelvin Lida681182017-01-10 18:08:18 +00002636void ASTStmtReader::VisitOMPTargetTeamsDistributeSimdDirective(
2637 OMPTargetTeamsDistributeSimdDirective *D) {
2638 VisitOMPLoopDirective(D);
2639}
2640
Alexey Bataev5ec3eb12013-07-19 03:13:43 +00002641//===----------------------------------------------------------------------===//
John McCallfa194042011-07-15 07:00:14 +00002642// ASTReader Implementation
2643//===----------------------------------------------------------------------===//
2644
Douglas Gregorde3ef502011-11-30 23:21:26 +00002645Stmt *ASTReader::ReadStmt(ModuleFile &F) {
Argyrios Kyrtzidisd0795b22010-06-28 22:28:35 +00002646 switch (ReadingKind) {
Richard Smith629ff362013-07-31 00:26:46 +00002647 case Read_None:
2648 llvm_unreachable("should not call this when not reading anything");
Argyrios Kyrtzidisd0795b22010-06-28 22:28:35 +00002649 case Read_Decl:
2650 case Read_Type:
Sebastian Redl2c373b92010-10-05 15:59:54 +00002651 return ReadStmtFromStream(F);
Argyrios Kyrtzidisd0795b22010-06-28 22:28:35 +00002652 case Read_Stmt:
Argyrios Kyrtzidis26d72012010-06-29 22:46:25 +00002653 return ReadSubStmt();
Argyrios Kyrtzidisd0795b22010-06-28 22:28:35 +00002654 }
2655
2656 llvm_unreachable("ReadingKind not set ?");
Argyrios Kyrtzidisd0795b22010-06-28 22:28:35 +00002657}
2658
Douglas Gregorde3ef502011-11-30 23:21:26 +00002659Expr *ASTReader::ReadExpr(ModuleFile &F) {
Sebastian Redl2c373b92010-10-05 15:59:54 +00002660 return cast_or_null<Expr>(ReadStmt(F));
Argyrios Kyrtzidisd0795b22010-06-28 22:28:35 +00002661}
Chris Lattnere2437f42010-05-09 06:40:08 +00002662
Sebastian Redl2c499f62010-08-18 23:56:43 +00002663Expr *ASTReader::ReadSubExpr() {
Argyrios Kyrtzidis26d72012010-06-29 22:46:25 +00002664 return cast_or_null<Expr>(ReadSubStmt());
2665}
2666
Chris Lattnerf4262532009-04-27 05:41:06 +00002667// Within the bitstream, expressions are stored in Reverse Polish
2668// Notation, with each of the subexpressions preceding the
Argyrios Kyrtzidisd0795b22010-06-28 22:28:35 +00002669// expression they are stored in. Subexpressions are stored from last to first.
2670// To evaluate expressions, we continue reading expressions and placing them on
2671// the stack, with expressions having operands removing those operands from the
Chris Lattnerf4262532009-04-27 05:41:06 +00002672// stack. Evaluation terminates when we see a STMT_STOP record, and
2673// the single remaining expression on the stack is our result.
Douglas Gregorde3ef502011-11-30 23:21:26 +00002674Stmt *ASTReader::ReadStmtFromStream(ModuleFile &F) {
Argyrios Kyrtzidisd0795b22010-06-28 22:28:35 +00002675 ReadingKindTracker ReadingKind(Read_Stmt, *this);
Sebastian Redl2c373b92010-10-05 15:59:54 +00002676 llvm::BitstreamCursor &Cursor = F.DeclsCursor;
David L. Jonesc4808b9e2016-12-15 20:53:26 +00002677
Argyrios Kyrtzidis6a598972011-10-21 23:02:28 +00002678 // Map of offset to previously deserialized stmt. The offset points
George Burgess IV758cf9d2017-02-14 05:52:57 +00002679 // just after the stmt record.
Argyrios Kyrtzidis6a598972011-10-21 23:02:28 +00002680 llvm::DenseMap<uint64_t, Stmt *> StmtEntries;
Sebastian Redl2c373b92010-10-05 15:59:54 +00002681
Argyrios Kyrtzidisd0795b22010-06-28 22:28:35 +00002682#ifndef NDEBUG
2683 unsigned PrevNumStmts = StmtStack.size();
2684#endif
2685
David L. Jonesbe1557a2016-12-21 00:17:49 +00002686 ASTRecordReader Record(*this, F);
2687 ASTStmtReader Reader(Record, Cursor);
Chris Lattner92ba5ff2009-04-27 05:14:47 +00002688 Stmt::EmptyShell Empty;
2689
2690 while (true) {
JF Bastien0e828952019-06-26 19:50:12 +00002691 llvm::Expected<llvm::BitstreamEntry> MaybeEntry =
2692 Cursor.advanceSkippingSubblocks();
2693 if (!MaybeEntry) {
2694 Error(toString(MaybeEntry.takeError()));
2695 return nullptr;
2696 }
2697 llvm::BitstreamEntry Entry = MaybeEntry.get();
David L. Jonesc4808b9e2016-12-15 20:53:26 +00002698
Chris Lattner0e6c9402013-01-20 02:38:54 +00002699 switch (Entry.Kind) {
2700 case llvm::BitstreamEntry::SubBlock: // Handled for us already.
2701 case llvm::BitstreamEntry::Error:
2702 Error("malformed block record in AST file");
Craig Toppera13603a2014-05-22 05:54:18 +00002703 return nullptr;
Chris Lattner0e6c9402013-01-20 02:38:54 +00002704 case llvm::BitstreamEntry::EndBlock:
2705 goto Done;
2706 case llvm::BitstreamEntry::Record:
2707 // The interesting case.
Chris Lattner92ba5ff2009-04-27 05:14:47 +00002708 break;
2709 }
2710
Richard Smithdbafb6c2017-06-29 23:23:46 +00002711 ASTContext &Context = getContext();
Craig Toppera13603a2014-05-22 05:54:18 +00002712 Stmt *S = nullptr;
Chris Lattner92ba5ff2009-04-27 05:14:47 +00002713 bool Finished = false;
Argyrios Kyrtzidis6a598972011-10-21 23:02:28 +00002714 bool IsStmtReference = false;
JF Bastien0e828952019-06-26 19:50:12 +00002715 Expected<unsigned> MaybeStmtCode = Record.readRecord(Cursor, Entry.ID);
2716 if (!MaybeStmtCode) {
2717 Error(toString(MaybeStmtCode.takeError()));
2718 return nullptr;
2719 }
2720 switch ((StmtCode)MaybeStmtCode.get()) {
Sebastian Redl539c5062010-08-18 23:57:32 +00002721 case STMT_STOP:
Chris Lattner92ba5ff2009-04-27 05:14:47 +00002722 Finished = true;
2723 break;
2724
Argyrios Kyrtzidis6a598972011-10-21 23:02:28 +00002725 case STMT_REF_PTR:
2726 IsStmtReference = true;
2727 assert(StmtEntries.find(Record[0]) != StmtEntries.end() &&
2728 "No stmt was recorded for this offset reference!");
David L. Jonesbe1557a2016-12-21 00:17:49 +00002729 S = StmtEntries[Record.readInt()];
Argyrios Kyrtzidis6a598972011-10-21 23:02:28 +00002730 break;
2731
Sebastian Redl539c5062010-08-18 23:57:32 +00002732 case STMT_NULL_PTR:
Craig Toppera13603a2014-05-22 05:54:18 +00002733 S = nullptr;
Chris Lattner92ba5ff2009-04-27 05:14:47 +00002734 break;
2735
Sebastian Redl539c5062010-08-18 23:57:32 +00002736 case STMT_NULL:
Chris Lattner92ba5ff2009-04-27 05:14:47 +00002737 S = new (Context) NullStmt(Empty);
2738 break;
2739
Sebastian Redl539c5062010-08-18 23:57:32 +00002740 case STMT_COMPOUND:
Benjamin Kramer07420902017-12-24 16:24:20 +00002741 S = CompoundStmt::CreateEmpty(
2742 Context, /*NumStmts=*/Record[ASTStmtReader::NumStmtFields]);
Chris Lattner92ba5ff2009-04-27 05:14:47 +00002743 break;
2744
Sebastian Redl539c5062010-08-18 23:57:32 +00002745 case STMT_CASE:
Bruno Ricci5b30571752018-10-28 12:30:53 +00002746 S = CaseStmt::CreateEmpty(
2747 Context,
2748 /*CaseStmtIsGNURange*/ Record[ASTStmtReader::NumStmtFields + 3]);
Chris Lattner92ba5ff2009-04-27 05:14:47 +00002749 break;
2750
Sebastian Redl539c5062010-08-18 23:57:32 +00002751 case STMT_DEFAULT:
Chris Lattner92ba5ff2009-04-27 05:14:47 +00002752 S = new (Context) DefaultStmt(Empty);
2753 break;
2754
Sebastian Redl539c5062010-08-18 23:57:32 +00002755 case STMT_LABEL:
Chris Lattner92ba5ff2009-04-27 05:14:47 +00002756 S = new (Context) LabelStmt(Empty);
2757 break;
2758
Richard Smithc202b282012-04-14 00:33:13 +00002759 case STMT_ATTRIBUTED:
Alexander Kornienko20f6fc62012-07-09 10:04:07 +00002760 S = AttributedStmt::CreateEmpty(
2761 Context,
2762 /*NumAttrs*/Record[ASTStmtReader::NumStmtFields]);
Richard Smithc202b282012-04-14 00:33:13 +00002763 break;
2764
Sebastian Redl539c5062010-08-18 23:57:32 +00002765 case STMT_IF:
Bruno Riccib1cc94b2018-10-27 21:12:20 +00002766 S = IfStmt::CreateEmpty(
2767 Context,
2768 /* HasElse=*/Record[ASTStmtReader::NumStmtFields + 1],
2769 /* HasVar=*/Record[ASTStmtReader::NumStmtFields + 2],
2770 /* HasInit=*/Record[ASTStmtReader::NumStmtFields + 3]);
Chris Lattner92ba5ff2009-04-27 05:14:47 +00002771 break;
2772
Sebastian Redl539c5062010-08-18 23:57:32 +00002773 case STMT_SWITCH:
Bruno Riccie2806f82018-10-29 16:12:37 +00002774 S = SwitchStmt::CreateEmpty(
2775 Context,
Bruno Ricci9b1afac2018-12-03 16:17:45 +00002776 /* HasInit=*/Record[ASTStmtReader::NumStmtFields],
Bruno Riccie2806f82018-10-29 16:12:37 +00002777 /* HasVar=*/Record[ASTStmtReader::NumStmtFields + 1]);
Chris Lattner92ba5ff2009-04-27 05:14:47 +00002778 break;
2779
Sebastian Redl539c5062010-08-18 23:57:32 +00002780 case STMT_WHILE:
Bruno Riccibacf7512018-10-30 13:42:41 +00002781 S = WhileStmt::CreateEmpty(
2782 Context,
Bruno Ricci9b1afac2018-12-03 16:17:45 +00002783 /* HasVar=*/Record[ASTStmtReader::NumStmtFields]);
Chris Lattner92ba5ff2009-04-27 05:14:47 +00002784 break;
2785
Sebastian Redl539c5062010-08-18 23:57:32 +00002786 case STMT_DO:
Chris Lattner92ba5ff2009-04-27 05:14:47 +00002787 S = new (Context) DoStmt(Empty);
2788 break;
Mike Stump11289f42009-09-09 15:08:12 +00002789
Sebastian Redl539c5062010-08-18 23:57:32 +00002790 case STMT_FOR:
Chris Lattner92ba5ff2009-04-27 05:14:47 +00002791 S = new (Context) ForStmt(Empty);
2792 break;
2793
Sebastian Redl539c5062010-08-18 23:57:32 +00002794 case STMT_GOTO:
Chris Lattner92ba5ff2009-04-27 05:14:47 +00002795 S = new (Context) GotoStmt(Empty);
2796 break;
Mike Stump11289f42009-09-09 15:08:12 +00002797
Sebastian Redl539c5062010-08-18 23:57:32 +00002798 case STMT_INDIRECT_GOTO:
Chris Lattner92ba5ff2009-04-27 05:14:47 +00002799 S = new (Context) IndirectGotoStmt(Empty);
2800 break;
2801
Sebastian Redl539c5062010-08-18 23:57:32 +00002802 case STMT_CONTINUE:
Chris Lattner92ba5ff2009-04-27 05:14:47 +00002803 S = new (Context) ContinueStmt(Empty);
2804 break;
2805
Sebastian Redl539c5062010-08-18 23:57:32 +00002806 case STMT_BREAK:
Chris Lattner92ba5ff2009-04-27 05:14:47 +00002807 S = new (Context) BreakStmt(Empty);
2808 break;
2809
Sebastian Redl539c5062010-08-18 23:57:32 +00002810 case STMT_RETURN:
Bruno Ricci023b1d12018-10-30 14:40:49 +00002811 S = ReturnStmt::CreateEmpty(
2812 Context, /* HasNRVOCandidate=*/Record[ASTStmtReader::NumStmtFields]);
Chris Lattner92ba5ff2009-04-27 05:14:47 +00002813 break;
2814
Sebastian Redl539c5062010-08-18 23:57:32 +00002815 case STMT_DECL:
Chris Lattner92ba5ff2009-04-27 05:14:47 +00002816 S = new (Context) DeclStmt(Empty);
2817 break;
2818
Chad Rosierde70e0e2012-08-25 00:11:56 +00002819 case STMT_GCCASM:
2820 S = new (Context) GCCAsmStmt(Empty);
Chris Lattner92ba5ff2009-04-27 05:14:47 +00002821 break;
2822
Chad Rosiere30d4992012-08-24 23:51:02 +00002823 case STMT_MSASM:
2824 S = new (Context) MSAsmStmt(Empty);
2825 break;
2826
Tareq A. Siraj24110cc2013-04-16 18:53:08 +00002827 case STMT_CAPTURED:
Bruno Ricci17ff0262018-10-27 19:21:19 +00002828 S = CapturedStmt::CreateDeserialized(
2829 Context, Record[ASTStmtReader::NumStmtFields]);
Tareq A. Siraj24110cc2013-04-16 18:53:08 +00002830 break;
2831
Bill Wendling7c44da22018-10-31 03:48:47 +00002832 case EXPR_CONSTANT:
Gauthier Harnisch83c7b612019-06-15 10:24:47 +00002833 S = ConstantExpr::CreateEmpty(
2834 Context,
2835 static_cast<ConstantExpr::ResultStorageKind>(
2836 Record[ASTStmtReader::NumExprFields]),
2837 Empty);
Bill Wendling7c44da22018-10-31 03:48:47 +00002838 break;
2839
Sebastian Redl539c5062010-08-18 23:57:32 +00002840 case EXPR_PREDEFINED:
Bruno Ricci17ff0262018-10-27 19:21:19 +00002841 S = PredefinedExpr::CreateEmpty(
2842 Context,
2843 /*HasFunctionName*/ Record[ASTStmtReader::NumExprFields]);
Chris Lattner92ba5ff2009-04-27 05:14:47 +00002844 break;
Mike Stump11289f42009-09-09 15:08:12 +00002845
Sebastian Redl539c5062010-08-18 23:57:32 +00002846 case EXPR_DECL_REF:
Chandler Carruth8d26bb02011-05-01 23:48:14 +00002847 S = DeclRefExpr::CreateEmpty(
Douglas Gregor4163aca2011-09-09 21:34:22 +00002848 Context,
Chandler Carruth8d26bb02011-05-01 23:48:14 +00002849 /*HasQualifier=*/Record[ASTStmtReader::NumExprFields],
2850 /*HasFoundDecl=*/Record[ASTStmtReader::NumExprFields + 1],
Abramo Bagnara7945c982012-01-27 09:46:47 +00002851 /*HasTemplateKWAndArgsInfo=*/Record[ASTStmtReader::NumExprFields + 2],
Chandler Carruth8d26bb02011-05-01 23:48:14 +00002852 /*NumTemplateArgs=*/Record[ASTStmtReader::NumExprFields + 2] ?
Richard Smith715f7a12019-06-11 17:50:32 +00002853 Record[ASTStmtReader::NumExprFields + 6] : 0);
Chris Lattner92ba5ff2009-04-27 05:14:47 +00002854 break;
Mike Stump11289f42009-09-09 15:08:12 +00002855
Sebastian Redl539c5062010-08-18 23:57:32 +00002856 case EXPR_INTEGER_LITERAL:
Douglas Gregor4163aca2011-09-09 21:34:22 +00002857 S = IntegerLiteral::Create(Context, Empty);
Chris Lattner92ba5ff2009-04-27 05:14:47 +00002858 break;
Mike Stump11289f42009-09-09 15:08:12 +00002859
Sebastian Redl539c5062010-08-18 23:57:32 +00002860 case EXPR_FLOATING_LITERAL:
Douglas Gregor4163aca2011-09-09 21:34:22 +00002861 S = FloatingLiteral::Create(Context, Empty);
Chris Lattner92ba5ff2009-04-27 05:14:47 +00002862 break;
Mike Stump11289f42009-09-09 15:08:12 +00002863
Sebastian Redl539c5062010-08-18 23:57:32 +00002864 case EXPR_IMAGINARY_LITERAL:
Chris Lattner92ba5ff2009-04-27 05:14:47 +00002865 S = new (Context) ImaginaryLiteral(Empty);
2866 break;
2867
Sebastian Redl539c5062010-08-18 23:57:32 +00002868 case EXPR_STRING_LITERAL:
Bruno Riccib94ad1e2018-11-15 17:31:16 +00002869 S = StringLiteral::CreateEmpty(
2870 Context,
Bruno Ricci9b1afac2018-12-03 16:17:45 +00002871 /* NumConcatenated=*/Record[ASTStmtReader::NumExprFields],
Bruno Riccib94ad1e2018-11-15 17:31:16 +00002872 /* Length=*/Record[ASTStmtReader::NumExprFields + 1],
2873 /* CharByteWidth=*/Record[ASTStmtReader::NumExprFields + 2]);
Chris Lattner92ba5ff2009-04-27 05:14:47 +00002874 break;
2875
Sebastian Redl539c5062010-08-18 23:57:32 +00002876 case EXPR_CHARACTER_LITERAL:
Chris Lattner92ba5ff2009-04-27 05:14:47 +00002877 S = new (Context) CharacterLiteral(Empty);
2878 break;
2879
Sebastian Redl539c5062010-08-18 23:57:32 +00002880 case EXPR_PAREN:
Chris Lattner92ba5ff2009-04-27 05:14:47 +00002881 S = new (Context) ParenExpr(Empty);
2882 break;
2883
Sebastian Redl539c5062010-08-18 23:57:32 +00002884 case EXPR_PAREN_LIST:
Bruno Riccif49e1ca2018-11-20 16:20:40 +00002885 S = ParenListExpr::CreateEmpty(
2886 Context,
Bruno Ricci9b1afac2018-12-03 16:17:45 +00002887 /* NumExprs=*/Record[ASTStmtReader::NumExprFields]);
Argyrios Kyrtzidisf9f47c82010-06-30 08:49:18 +00002888 break;
2889
Sebastian Redl539c5062010-08-18 23:57:32 +00002890 case EXPR_UNARY_OPERATOR:
Chris Lattner92ba5ff2009-04-27 05:14:47 +00002891 S = new (Context) UnaryOperator(Empty);
2892 break;
2893
Sebastian Redl539c5062010-08-18 23:57:32 +00002894 case EXPR_OFFSETOF:
David L. Jonesc4808b9e2016-12-15 20:53:26 +00002895 S = OffsetOfExpr::CreateEmpty(Context,
Sebastian Redl70c751d2010-08-18 23:56:52 +00002896 Record[ASTStmtReader::NumExprFields],
2897 Record[ASTStmtReader::NumExprFields + 1]);
Douglas Gregor882211c2010-04-28 22:16:22 +00002898 break;
David L. Jonesc4808b9e2016-12-15 20:53:26 +00002899
Sebastian Redl539c5062010-08-18 23:57:32 +00002900 case EXPR_SIZEOF_ALIGN_OF:
Peter Collingbournee190dee2011-03-11 19:24:49 +00002901 S = new (Context) UnaryExprOrTypeTraitExpr(Empty);
Chris Lattner92ba5ff2009-04-27 05:14:47 +00002902 break;
2903
Sebastian Redl539c5062010-08-18 23:57:32 +00002904 case EXPR_ARRAY_SUBSCRIPT:
Chris Lattner92ba5ff2009-04-27 05:14:47 +00002905 S = new (Context) ArraySubscriptExpr(Empty);
2906 break;
2907
Alexey Bataev1a3320e2015-08-25 14:24:04 +00002908 case EXPR_OMP_ARRAY_SECTION:
2909 S = new (Context) OMPArraySectionExpr(Empty);
2910 break;
2911
Alexey Bataev7ac9efb2020-02-05 09:33:05 -05002912 case EXPR_OMP_ARRAY_SHAPING:
2913 S = OMPArrayShapingExpr::CreateEmpty(
2914 Context, Record[ASTStmtReader::NumExprFields]);
2915 break;
2916
Alexey Bataev13a15042020-04-01 15:06:38 -04002917 case EXPR_OMP_ITERATOR:
2918 S = OMPIteratorExpr::CreateEmpty(Context,
2919 Record[ASTStmtReader::NumExprFields]);
2920 break;
2921
Sebastian Redl539c5062010-08-18 23:57:32 +00002922 case EXPR_CALL:
Bruno Riccic5885cf2018-12-21 15:20:32 +00002923 S = CallExpr::CreateEmpty(
2924 Context, /*NumArgs=*/Record[ASTStmtReader::NumExprFields], Empty);
Chris Lattner92ba5ff2009-04-27 05:14:47 +00002925 break;
2926
Haojian Wu733edf92020-03-19 16:30:40 +01002927 case EXPR_RECOVERY:
2928 S = RecoveryExpr::CreateEmpty(
2929 Context, /*NumArgs=*/Record[ASTStmtReader::NumExprFields]);
2930 break;
2931
Richard Smithdcf17de2019-06-06 23:24:15 +00002932 case EXPR_MEMBER:
2933 S = MemberExpr::CreateEmpty(Context, Record[ASTStmtReader::NumExprFields],
2934 Record[ASTStmtReader::NumExprFields + 1],
2935 Record[ASTStmtReader::NumExprFields + 2],
2936 Record[ASTStmtReader::NumExprFields + 3]);
Chris Lattner92ba5ff2009-04-27 05:14:47 +00002937 break;
2938
Sebastian Redl539c5062010-08-18 23:57:32 +00002939 case EXPR_BINARY_OPERATOR:
Chris Lattner92ba5ff2009-04-27 05:14:47 +00002940 S = new (Context) BinaryOperator(Empty);
2941 break;
2942
Sebastian Redl539c5062010-08-18 23:57:32 +00002943 case EXPR_COMPOUND_ASSIGN_OPERATOR:
Chris Lattner92ba5ff2009-04-27 05:14:47 +00002944 S = new (Context) CompoundAssignOperator(Empty);
2945 break;
2946
Sebastian Redl539c5062010-08-18 23:57:32 +00002947 case EXPR_CONDITIONAL_OPERATOR:
Chris Lattner92ba5ff2009-04-27 05:14:47 +00002948 S = new (Context) ConditionalOperator(Empty);
2949 break;
2950
John McCallc07a0c72011-02-17 10:25:35 +00002951 case EXPR_BINARY_CONDITIONAL_OPERATOR:
2952 S = new (Context) BinaryConditionalOperator(Empty);
2953 break;
2954
Sebastian Redl539c5062010-08-18 23:57:32 +00002955 case EXPR_IMPLICIT_CAST:
Douglas Gregor4163aca2011-09-09 21:34:22 +00002956 S = ImplicitCastExpr::CreateEmpty(Context,
Sebastian Redl70c751d2010-08-18 23:56:52 +00002957 /*PathSize*/ Record[ASTStmtReader::NumExprFields]);
Chris Lattner92ba5ff2009-04-27 05:14:47 +00002958 break;
2959
Sebastian Redl539c5062010-08-18 23:57:32 +00002960 case EXPR_CSTYLE_CAST:
Douglas Gregor4163aca2011-09-09 21:34:22 +00002961 S = CStyleCastExpr::CreateEmpty(Context,
Sebastian Redl70c751d2010-08-18 23:56:52 +00002962 /*PathSize*/ Record[ASTStmtReader::NumExprFields]);
Chris Lattner92ba5ff2009-04-27 05:14:47 +00002963 break;
2964
Sebastian Redl539c5062010-08-18 23:57:32 +00002965 case EXPR_COMPOUND_LITERAL:
Chris Lattner92ba5ff2009-04-27 05:14:47 +00002966 S = new (Context) CompoundLiteralExpr(Empty);
2967 break;
2968
Sebastian Redl539c5062010-08-18 23:57:32 +00002969 case EXPR_EXT_VECTOR_ELEMENT:
Chris Lattner92ba5ff2009-04-27 05:14:47 +00002970 S = new (Context) ExtVectorElementExpr(Empty);
2971 break;
2972
Sebastian Redl539c5062010-08-18 23:57:32 +00002973 case EXPR_INIT_LIST:
Argyrios Kyrtzidis0f05fb92012-11-28 03:56:16 +00002974 S = new (Context) InitListExpr(Empty);
Chris Lattner92ba5ff2009-04-27 05:14:47 +00002975 break;
2976
Sebastian Redl539c5062010-08-18 23:57:32 +00002977 case EXPR_DESIGNATED_INIT:
Douglas Gregor4163aca2011-09-09 21:34:22 +00002978 S = DesignatedInitExpr::CreateEmpty(Context,
Sebastian Redl70c751d2010-08-18 23:56:52 +00002979 Record[ASTStmtReader::NumExprFields] - 1);
Mike Stump11289f42009-09-09 15:08:12 +00002980
Chris Lattner92ba5ff2009-04-27 05:14:47 +00002981 break;
2982
Yunzhong Gaocb779302015-06-10 00:27:52 +00002983 case EXPR_DESIGNATED_INIT_UPDATE:
2984 S = new (Context) DesignatedInitUpdateExpr(Empty);
2985 break;
2986
Sebastian Redl539c5062010-08-18 23:57:32 +00002987 case EXPR_IMPLICIT_VALUE_INIT:
Chris Lattner92ba5ff2009-04-27 05:14:47 +00002988 S = new (Context) ImplicitValueInitExpr(Empty);
2989 break;
2990
Yunzhong Gaocb779302015-06-10 00:27:52 +00002991 case EXPR_NO_INIT:
2992 S = new (Context) NoInitExpr(Empty);
2993 break;
2994
Richard Smith410306b2016-12-12 02:53:20 +00002995 case EXPR_ARRAY_INIT_LOOP:
2996 S = new (Context) ArrayInitLoopExpr(Empty);
2997 break;
2998
2999 case EXPR_ARRAY_INIT_INDEX:
3000 S = new (Context) ArrayInitIndexExpr(Empty);
3001 break;
3002
Sebastian Redl539c5062010-08-18 23:57:32 +00003003 case EXPR_VA_ARG:
Chris Lattner92ba5ff2009-04-27 05:14:47 +00003004 S = new (Context) VAArgExpr(Empty);
3005 break;
3006
Eric Fiselier708afb52019-05-16 21:04:15 +00003007 case EXPR_SOURCE_LOC:
3008 S = new (Context) SourceLocExpr(Empty);
3009 break;
3010
Sebastian Redl539c5062010-08-18 23:57:32 +00003011 case EXPR_ADDR_LABEL:
Chris Lattner92ba5ff2009-04-27 05:14:47 +00003012 S = new (Context) AddrLabelExpr(Empty);
3013 break;
3014
Sebastian Redl539c5062010-08-18 23:57:32 +00003015 case EXPR_STMT:
Chris Lattner92ba5ff2009-04-27 05:14:47 +00003016 S = new (Context) StmtExpr(Empty);
3017 break;
3018
Sebastian Redl539c5062010-08-18 23:57:32 +00003019 case EXPR_CHOOSE:
Chris Lattner92ba5ff2009-04-27 05:14:47 +00003020 S = new (Context) ChooseExpr(Empty);
3021 break;
3022
Sebastian Redl539c5062010-08-18 23:57:32 +00003023 case EXPR_GNU_NULL:
Chris Lattner92ba5ff2009-04-27 05:14:47 +00003024 S = new (Context) GNUNullExpr(Empty);
3025 break;
3026
Sebastian Redl539c5062010-08-18 23:57:32 +00003027 case EXPR_SHUFFLE_VECTOR:
Chris Lattner92ba5ff2009-04-27 05:14:47 +00003028 S = new (Context) ShuffleVectorExpr(Empty);
3029 break;
Mike Stump11289f42009-09-09 15:08:12 +00003030
Hal Finkelc4d7c822013-09-18 03:29:45 +00003031 case EXPR_CONVERT_VECTOR:
3032 S = new (Context) ConvertVectorExpr(Empty);
3033 break;
3034
Sebastian Redl539c5062010-08-18 23:57:32 +00003035 case EXPR_BLOCK:
Chris Lattner92ba5ff2009-04-27 05:14:47 +00003036 S = new (Context) BlockExpr(Empty);
3037 break;
3038
Peter Collingbourne91147592011-04-15 00:35:48 +00003039 case EXPR_GENERIC_SELECTION:
Bruno Riccidb076832019-01-26 14:15:10 +00003040 S = GenericSelectionExpr::CreateEmpty(
3041 Context,
3042 /*NumAssocs=*/Record[ASTStmtReader::NumExprFields]);
Peter Collingbourne91147592011-04-15 00:35:48 +00003043 break;
3044
Sebastian Redl539c5062010-08-18 23:57:32 +00003045 case EXPR_OBJC_STRING_LITERAL:
Chris Lattner92ba5ff2009-04-27 05:14:47 +00003046 S = new (Context) ObjCStringLiteral(Empty);
3047 break;
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +00003048
Patrick Beard0caa3942012-04-19 00:25:12 +00003049 case EXPR_OBJC_BOXED_EXPRESSION:
3050 S = new (Context) ObjCBoxedExpr(Empty);
Ted Kremeneke65b0862012-03-06 20:05:56 +00003051 break;
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +00003052
Ted Kremeneke65b0862012-03-06 20:05:56 +00003053 case EXPR_OBJC_ARRAY_LITERAL:
3054 S = ObjCArrayLiteral::CreateEmpty(Context,
3055 Record[ASTStmtReader::NumExprFields]);
3056 break;
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +00003057
Ted Kremeneke65b0862012-03-06 20:05:56 +00003058 case EXPR_OBJC_DICTIONARY_LITERAL:
3059 S = ObjCDictionaryLiteral::CreateEmpty(Context,
3060 Record[ASTStmtReader::NumExprFields],
3061 Record[ASTStmtReader::NumExprFields + 1]);
3062 break;
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +00003063
Sebastian Redl539c5062010-08-18 23:57:32 +00003064 case EXPR_OBJC_ENCODE:
Chris Lattner92ba5ff2009-04-27 05:14:47 +00003065 S = new (Context) ObjCEncodeExpr(Empty);
3066 break;
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +00003067
Sebastian Redl539c5062010-08-18 23:57:32 +00003068 case EXPR_OBJC_SELECTOR_EXPR:
Chris Lattner92ba5ff2009-04-27 05:14:47 +00003069 S = new (Context) ObjCSelectorExpr(Empty);
3070 break;
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +00003071
Sebastian Redl539c5062010-08-18 23:57:32 +00003072 case EXPR_OBJC_PROTOCOL_EXPR:
Chris Lattner92ba5ff2009-04-27 05:14:47 +00003073 S = new (Context) ObjCProtocolExpr(Empty);
3074 break;
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +00003075
Sebastian Redl539c5062010-08-18 23:57:32 +00003076 case EXPR_OBJC_IVAR_REF_EXPR:
Chris Lattner92ba5ff2009-04-27 05:14:47 +00003077 S = new (Context) ObjCIvarRefExpr(Empty);
3078 break;
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +00003079
Sebastian Redl539c5062010-08-18 23:57:32 +00003080 case EXPR_OBJC_PROPERTY_REF_EXPR:
Chris Lattner92ba5ff2009-04-27 05:14:47 +00003081 S = new (Context) ObjCPropertyRefExpr(Empty);
3082 break;
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +00003083
Ted Kremeneke65b0862012-03-06 20:05:56 +00003084 case EXPR_OBJC_SUBSCRIPT_REF_EXPR:
3085 S = new (Context) ObjCSubscriptRefExpr(Empty);
3086 break;
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +00003087
Sebastian Redl539c5062010-08-18 23:57:32 +00003088 case EXPR_OBJC_KVC_REF_EXPR:
John McCallb7bd14f2010-12-02 01:19:52 +00003089 llvm_unreachable("mismatching AST file");
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +00003090
Sebastian Redl539c5062010-08-18 23:57:32 +00003091 case EXPR_OBJC_MESSAGE_EXPR:
Douglas Gregor4163aca2011-09-09 21:34:22 +00003092 S = ObjCMessageExpr::CreateEmpty(Context,
Argyrios Kyrtzidisa6011e22011-10-03 06:36:51 +00003093 Record[ASTStmtReader::NumExprFields],
3094 Record[ASTStmtReader::NumExprFields + 1]);
Chris Lattner92ba5ff2009-04-27 05:14:47 +00003095 break;
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +00003096
Sebastian Redl539c5062010-08-18 23:57:32 +00003097 case EXPR_OBJC_ISA:
Steve Naroffe87026a2009-07-24 17:54:45 +00003098 S = new (Context) ObjCIsaExpr(Empty);
3099 break;
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +00003100
John McCall31168b02011-06-15 23:02:42 +00003101 case EXPR_OBJC_INDIRECT_COPY_RESTORE:
3102 S = new (Context) ObjCIndirectCopyRestoreExpr(Empty);
3103 break;
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +00003104
John McCall31168b02011-06-15 23:02:42 +00003105 case EXPR_OBJC_BRIDGED_CAST:
3106 S = new (Context) ObjCBridgedCastExpr(Empty);
3107 break;
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +00003108
Sebastian Redl539c5062010-08-18 23:57:32 +00003109 case STMT_OBJC_FOR_COLLECTION:
Chris Lattner92ba5ff2009-04-27 05:14:47 +00003110 S = new (Context) ObjCForCollectionStmt(Empty);
3111 break;
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +00003112
Sebastian Redl539c5062010-08-18 23:57:32 +00003113 case STMT_OBJC_CATCH:
Chris Lattner92ba5ff2009-04-27 05:14:47 +00003114 S = new (Context) ObjCAtCatchStmt(Empty);
3115 break;
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +00003116
Sebastian Redl539c5062010-08-18 23:57:32 +00003117 case STMT_OBJC_FINALLY:
Chris Lattner92ba5ff2009-04-27 05:14:47 +00003118 S = new (Context) ObjCAtFinallyStmt(Empty);
3119 break;
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +00003120
Sebastian Redl539c5062010-08-18 23:57:32 +00003121 case STMT_OBJC_AT_TRY:
David L. Jonesc4808b9e2016-12-15 20:53:26 +00003122 S = ObjCAtTryStmt::CreateEmpty(Context,
Sebastian Redl70c751d2010-08-18 23:56:52 +00003123 Record[ASTStmtReader::NumStmtFields],
3124 Record[ASTStmtReader::NumStmtFields + 1]);
Chris Lattner92ba5ff2009-04-27 05:14:47 +00003125 break;
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +00003126
Sebastian Redl539c5062010-08-18 23:57:32 +00003127 case STMT_OBJC_AT_SYNCHRONIZED:
Chris Lattner92ba5ff2009-04-27 05:14:47 +00003128 S = new (Context) ObjCAtSynchronizedStmt(Empty);
3129 break;
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +00003130
Sebastian Redl539c5062010-08-18 23:57:32 +00003131 case STMT_OBJC_AT_THROW:
Chris Lattner92ba5ff2009-04-27 05:14:47 +00003132 S = new (Context) ObjCAtThrowStmt(Empty);
3133 break;
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +00003134
John McCall31168b02011-06-15 23:02:42 +00003135 case STMT_OBJC_AUTORELEASE_POOL:
3136 S = new (Context) ObjCAutoreleasePoolStmt(Empty);
3137 break;
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +00003138
Ted Kremeneke65b0862012-03-06 20:05:56 +00003139 case EXPR_OBJC_BOOL_LITERAL:
3140 S = new (Context) ObjCBoolLiteralExpr(Empty);
3141 break;
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +00003142
Erik Pilkington29099de2016-07-16 00:35:23 +00003143 case EXPR_OBJC_AVAILABILITY_CHECK:
3144 S = new (Context) ObjCAvailabilityCheckExpr(Empty);
3145 break;
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +00003146
Nico Weber9b982072014-07-07 00:12:30 +00003147 case STMT_SEH_LEAVE:
3148 S = new (Context) SEHLeaveStmt(Empty);
3149 break;
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +00003150
John McCallfa194042011-07-15 07:00:14 +00003151 case STMT_SEH_EXCEPT:
3152 S = new (Context) SEHExceptStmt(Empty);
3153 break;
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +00003154
John McCallfa194042011-07-15 07:00:14 +00003155 case STMT_SEH_FINALLY:
3156 S = new (Context) SEHFinallyStmt(Empty);
3157 break;
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +00003158
John McCallfa194042011-07-15 07:00:14 +00003159 case STMT_SEH_TRY:
3160 S = new (Context) SEHTryStmt(Empty);
3161 break;
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +00003162
Sebastian Redl539c5062010-08-18 23:57:32 +00003163 case STMT_CXX_CATCH:
Argyrios Kyrtzidis47cd7a92010-07-22 16:03:56 +00003164 S = new (Context) CXXCatchStmt(Empty);
3165 break;
3166
Sebastian Redl539c5062010-08-18 23:57:32 +00003167 case STMT_CXX_TRY:
Douglas Gregor4163aca2011-09-09 21:34:22 +00003168 S = CXXTryStmt::Create(Context, Empty,
Rui Ueyama49a3ad22019-07-16 04:46:31 +00003169 /*numHandlers=*/Record[ASTStmtReader::NumStmtFields]);
Argyrios Kyrtzidis47cd7a92010-07-22 16:03:56 +00003170 break;
3171
Richard Smith02e85f32011-04-14 22:09:26 +00003172 case STMT_CXX_FOR_RANGE:
3173 S = new (Context) CXXForRangeStmt(Empty);
3174 break;
3175
Douglas Gregordeb4a2be2011-10-25 01:33:02 +00003176 case STMT_MS_DEPENDENT_EXISTS:
3177 S = new (Context) MSDependentExistsStmt(SourceLocation(), true,
3178 NestedNameSpecifierLoc(),
3179 DeclarationNameInfo(),
Craig Toppera13603a2014-05-22 05:54:18 +00003180 nullptr);
Douglas Gregordeb4a2be2011-10-25 01:33:02 +00003181 break;
Alexey Bataev1b59ab52014-02-27 08:29:12 +00003182
Alexey Bataev5ec3eb12013-07-19 03:13:43 +00003183 case STMT_OMP_PARALLEL_DIRECTIVE:
3184 S =
3185 OMPParallelDirective::CreateEmpty(Context,
3186 Record[ASTStmtReader::NumStmtFields],
3187 Empty);
3188 break;
Alexey Bataev1b59ab52014-02-27 08:29:12 +00003189
3190 case STMT_OMP_SIMD_DIRECTIVE: {
3191 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
3192 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
3193 S = OMPSimdDirective::CreateEmpty(Context, NumClauses,
3194 CollapsedNum, Empty);
3195 break;
3196 }
3197
Alexey Bataevf29276e2014-06-18 04:14:57 +00003198 case STMT_OMP_FOR_DIRECTIVE: {
3199 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
3200 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
3201 S = OMPForDirective::CreateEmpty(Context, NumClauses, CollapsedNum,
3202 Empty);
3203 break;
3204 }
3205
Alexander Musmanf82886e2014-09-18 05:12:34 +00003206 case STMT_OMP_FOR_SIMD_DIRECTIVE: {
3207 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
3208 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
3209 S = OMPForSimdDirective::CreateEmpty(Context, NumClauses, CollapsedNum,
3210 Empty);
3211 break;
3212 }
3213
Alexey Bataevd3f8dd22014-06-25 11:44:49 +00003214 case STMT_OMP_SECTIONS_DIRECTIVE:
3215 S = OMPSectionsDirective::CreateEmpty(
3216 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3217 break;
3218
Alexey Bataev1e0498a2014-06-26 08:21:58 +00003219 case STMT_OMP_SECTION_DIRECTIVE:
3220 S = OMPSectionDirective::CreateEmpty(Context, Empty);
3221 break;
3222
Alexey Bataevd1e40fb2014-06-26 12:05:45 +00003223 case STMT_OMP_SINGLE_DIRECTIVE:
3224 S = OMPSingleDirective::CreateEmpty(
3225 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3226 break;
3227
Alexander Musman80c22892014-07-17 08:54:58 +00003228 case STMT_OMP_MASTER_DIRECTIVE:
3229 S = OMPMasterDirective::CreateEmpty(Context, Empty);
3230 break;
3231
Alexander Musmand9ed09f2014-07-21 09:42:05 +00003232 case STMT_OMP_CRITICAL_DIRECTIVE:
Alexey Bataev28c75412015-12-15 08:19:24 +00003233 S = OMPCriticalDirective::CreateEmpty(
3234 Context, Record[ASTStmtReader::NumStmtFields], Empty);
Alexander Musmand9ed09f2014-07-21 09:42:05 +00003235 break;
3236
Alexey Bataev4acb8592014-07-07 13:01:15 +00003237 case STMT_OMP_PARALLEL_FOR_DIRECTIVE: {
3238 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
3239 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
3240 S = OMPParallelForDirective::CreateEmpty(Context, NumClauses,
3241 CollapsedNum, Empty);
3242 break;
3243 }
3244
Alexander Musmane4e893b2014-09-23 09:33:00 +00003245 case STMT_OMP_PARALLEL_FOR_SIMD_DIRECTIVE: {
3246 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
3247 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
3248 S = OMPParallelForSimdDirective::CreateEmpty(Context, NumClauses,
3249 CollapsedNum, Empty);
3250 break;
3251 }
3252
cchen47d60942019-12-05 13:43:48 -05003253 case STMT_OMP_PARALLEL_MASTER_DIRECTIVE:
3254 S = OMPParallelMasterDirective::CreateEmpty(
3255 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3256 break;
3257
Alexey Bataev84d0b3e2014-07-08 08:12:03 +00003258 case STMT_OMP_PARALLEL_SECTIONS_DIRECTIVE:
3259 S = OMPParallelSectionsDirective::CreateEmpty(
3260 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3261 break;
3262
Alexey Bataev9c2e8ee2014-07-11 11:25:16 +00003263 case STMT_OMP_TASK_DIRECTIVE:
3264 S = OMPTaskDirective::CreateEmpty(
3265 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3266 break;
3267
Alexey Bataev68446b72014-07-18 07:47:19 +00003268 case STMT_OMP_TASKYIELD_DIRECTIVE:
3269 S = OMPTaskyieldDirective::CreateEmpty(Context, Empty);
3270 break;
3271
Alexey Bataev4d1dfea2014-07-18 09:11:51 +00003272 case STMT_OMP_BARRIER_DIRECTIVE:
3273 S = OMPBarrierDirective::CreateEmpty(Context, Empty);
3274 break;
3275
Alexey Bataev2df347a2014-07-18 10:17:07 +00003276 case STMT_OMP_TASKWAIT_DIRECTIVE:
3277 S = OMPTaskwaitDirective::CreateEmpty(Context, Empty);
3278 break;
3279
Alexey Bataevc30dd2d2015-06-18 12:14:09 +00003280 case STMT_OMP_TASKGROUP_DIRECTIVE:
Alexey Bataev169d96a2017-07-18 20:17:46 +00003281 S = OMPTaskgroupDirective::CreateEmpty(
3282 Context, Record[ASTStmtReader::NumStmtFields], Empty);
Alexey Bataevc30dd2d2015-06-18 12:14:09 +00003283 break;
3284
Alexey Bataev6125da92014-07-21 11:26:11 +00003285 case STMT_OMP_FLUSH_DIRECTIVE:
3286 S = OMPFlushDirective::CreateEmpty(
3287 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3288 break;
3289
Alexey Bataevc112e942020-02-28 09:52:15 -05003290 case STMT_OMP_DEPOBJ_DIRECTIVE:
3291 S = OMPDepobjDirective::CreateEmpty(
3292 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3293 break;
3294
Alexey Bataevfcba7c32020-03-20 07:03:01 -04003295 case STMT_OMP_SCAN_DIRECTIVE:
3296 S = OMPScanDirective::CreateEmpty(
3297 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3298 break;
3299
Alexey Bataev9fb6e642014-07-22 06:45:04 +00003300 case STMT_OMP_ORDERED_DIRECTIVE:
Alexey Bataev346265e2015-09-25 10:37:12 +00003301 S = OMPOrderedDirective::CreateEmpty(
3302 Context, Record[ASTStmtReader::NumStmtFields], Empty);
Alexey Bataev9fb6e642014-07-22 06:45:04 +00003303 break;
3304
Alexey Bataev0162e452014-07-22 10:10:35 +00003305 case STMT_OMP_ATOMIC_DIRECTIVE:
3306 S = OMPAtomicDirective::CreateEmpty(
3307 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3308 break;
3309
Alexey Bataev0bd520b2014-09-19 08:19:49 +00003310 case STMT_OMP_TARGET_DIRECTIVE:
3311 S = OMPTargetDirective::CreateEmpty(
3312 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3313 break;
3314
Michael Wong65f367f2015-07-21 13:44:28 +00003315 case STMT_OMP_TARGET_DATA_DIRECTIVE:
3316 S = OMPTargetDataDirective::CreateEmpty(
3317 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3318 break;
3319
Samuel Antaodf67fc42016-01-19 19:15:56 +00003320 case STMT_OMP_TARGET_ENTER_DATA_DIRECTIVE:
3321 S = OMPTargetEnterDataDirective::CreateEmpty(
3322 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3323 break;
3324
Samuel Antao72590762016-01-19 20:04:50 +00003325 case STMT_OMP_TARGET_EXIT_DATA_DIRECTIVE:
3326 S = OMPTargetExitDataDirective::CreateEmpty(
3327 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3328 break;
3329
Arpith Chacko Jacobe955b3d2016-01-26 18:48:41 +00003330 case STMT_OMP_TARGET_PARALLEL_DIRECTIVE:
3331 S = OMPTargetParallelDirective::CreateEmpty(
3332 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3333 break;
3334
Arpith Chacko Jacob05bebb52016-02-03 15:46:42 +00003335 case STMT_OMP_TARGET_PARALLEL_FOR_DIRECTIVE: {
3336 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
3337 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
3338 S = OMPTargetParallelForDirective::CreateEmpty(Context, NumClauses,
3339 CollapsedNum, Empty);
3340 break;
3341 }
3342
Samuel Antao686c70c2016-05-26 17:30:50 +00003343 case STMT_OMP_TARGET_UPDATE_DIRECTIVE:
3344 S = OMPTargetUpdateDirective::CreateEmpty(
3345 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3346 break;
3347
Alexey Bataev13314bf2014-10-09 04:18:56 +00003348 case STMT_OMP_TEAMS_DIRECTIVE:
3349 S = OMPTeamsDirective::CreateEmpty(
3350 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3351 break;
3352
Alexey Bataev6d4ed052015-07-01 06:57:41 +00003353 case STMT_OMP_CANCELLATION_POINT_DIRECTIVE:
3354 S = OMPCancellationPointDirective::CreateEmpty(Context, Empty);
3355 break;
3356
Alexey Bataev80909872015-07-02 11:25:17 +00003357 case STMT_OMP_CANCEL_DIRECTIVE:
Alexey Bataev87933c72015-09-18 08:07:34 +00003358 S = OMPCancelDirective::CreateEmpty(
3359 Context, Record[ASTStmtReader::NumStmtFields], Empty);
Alexey Bataev80909872015-07-02 11:25:17 +00003360 break;
3361
Alexey Bataev49f6e782015-12-01 04:18:41 +00003362 case STMT_OMP_TASKLOOP_DIRECTIVE: {
3363 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
3364 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
3365 S = OMPTaskLoopDirective::CreateEmpty(Context, NumClauses, CollapsedNum,
3366 Empty);
3367 break;
3368 }
3369
Alexey Bataev0a6ed842015-12-03 09:40:15 +00003370 case STMT_OMP_TASKLOOP_SIMD_DIRECTIVE: {
3371 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
3372 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
3373 S = OMPTaskLoopSimdDirective::CreateEmpty(Context, NumClauses,
3374 CollapsedNum, Empty);
3375 break;
3376 }
3377
Alexey Bataev60e51c42019-10-10 20:13:02 +00003378 case STMT_OMP_MASTER_TASKLOOP_DIRECTIVE: {
3379 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
3380 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
3381 S = OMPMasterTaskLoopDirective::CreateEmpty(Context, NumClauses,
3382 CollapsedNum, Empty);
3383 break;
3384 }
3385
Alexey Bataevb8552ab2019-10-18 16:47:35 +00003386 case STMT_OMP_MASTER_TASKLOOP_SIMD_DIRECTIVE: {
3387 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
3388 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
3389 S = OMPMasterTaskLoopSimdDirective::CreateEmpty(Context, NumClauses,
3390 CollapsedNum, Empty);
3391 break;
3392 }
3393
Alexey Bataev5bbcead2019-10-14 17:17:41 +00003394 case STMT_OMP_PARALLEL_MASTER_TASKLOOP_DIRECTIVE: {
3395 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
3396 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
3397 S = OMPParallelMasterTaskLoopDirective::CreateEmpty(Context, NumClauses,
3398 CollapsedNum, Empty);
3399 break;
3400 }
3401
Alexey Bataev14a388f2019-10-25 10:27:13 -04003402 case STMT_OMP_PARALLEL_MASTER_TASKLOOP_SIMD_DIRECTIVE: {
3403 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
3404 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
3405 S = OMPParallelMasterTaskLoopSimdDirective::CreateEmpty(
3406 Context, NumClauses, CollapsedNum, Empty);
3407 break;
3408 }
3409
Carlo Bertolli6200a3d2015-12-14 14:51:25 +00003410 case STMT_OMP_DISTRIBUTE_DIRECTIVE: {
3411 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
3412 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
3413 S = OMPDistributeDirective::CreateEmpty(Context, NumClauses, CollapsedNum,
3414 Empty);
3415 break;
3416 }
3417
Carlo Bertolli9925f152016-06-27 14:55:37 +00003418 case STMT_OMP_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE: {
3419 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
3420 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
3421 S = OMPDistributeParallelForDirective::CreateEmpty(Context, NumClauses,
3422 CollapsedNum, Empty);
3423 break;
3424 }
3425
Kelvin Li4a39add2016-07-05 05:00:15 +00003426 case STMT_OMP_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE: {
3427 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
3428 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
3429 S = OMPDistributeParallelForSimdDirective::CreateEmpty(Context, NumClauses,
3430 CollapsedNum,
3431 Empty);
3432 break;
3433 }
3434
Kelvin Li787f3fc2016-07-06 04:45:38 +00003435 case STMT_OMP_DISTRIBUTE_SIMD_DIRECTIVE: {
3436 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
3437 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
3438 S = OMPDistributeSimdDirective::CreateEmpty(Context, NumClauses,
3439 CollapsedNum, Empty);
3440 break;
3441 }
3442
Kelvin Lia579b912016-07-14 02:54:56 +00003443 case STMT_OMP_TARGET_PARALLEL_FOR_SIMD_DIRECTIVE: {
3444 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
3445 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
3446 S = OMPTargetParallelForSimdDirective::CreateEmpty(Context, NumClauses,
3447 CollapsedNum, Empty);
3448 break;
3449 }
3450
Kelvin Li986330c2016-07-20 22:57:10 +00003451 case STMT_OMP_TARGET_SIMD_DIRECTIVE: {
3452 auto NumClauses = Record[ASTStmtReader::NumStmtFields];
3453 auto CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
3454 S = OMPTargetSimdDirective::CreateEmpty(Context, NumClauses, CollapsedNum,
3455 Empty);
3456 break;
3457 }
3458
Kelvin Li83c451e2016-12-25 04:52:54 +00003459 case STMT_OMP_TEAMS_DISTRIBUTE_DIRECTIVE: {
Kelvin Li02532872016-08-05 14:37:37 +00003460 auto NumClauses = Record[ASTStmtReader::NumStmtFields];
3461 auto CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
3462 S = OMPTeamsDistributeDirective::CreateEmpty(Context, NumClauses,
3463 CollapsedNum, Empty);
3464 break;
3465 }
3466
Kelvin Li4e325f72016-10-25 12:50:55 +00003467 case STMT_OMP_TEAMS_DISTRIBUTE_SIMD_DIRECTIVE: {
3468 unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
3469 unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
3470 S = OMPTeamsDistributeSimdDirective::CreateEmpty(Context, NumClauses,
3471 CollapsedNum, Empty);
3472 break;
3473 }
3474
Kelvin Li579e41c2016-11-30 23:51:03 +00003475 case STMT_OMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE: {
3476 auto NumClauses = Record[ASTStmtReader::NumStmtFields];
3477 auto CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
3478 S = OMPTeamsDistributeParallelForSimdDirective::CreateEmpty(
3479 Context, NumClauses, CollapsedNum, Empty);
3480 break;
3481 }
3482
Kelvin Li7ade93f2016-12-09 03:24:30 +00003483 case STMT_OMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE: {
3484 auto NumClauses = Record[ASTStmtReader::NumStmtFields];
3485 auto CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
3486 S = OMPTeamsDistributeParallelForDirective::CreateEmpty(
3487 Context, NumClauses, CollapsedNum, Empty);
3488 break;
3489 }
3490
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +00003491 case STMT_OMP_TARGET_TEAMS_DIRECTIVE:
Kelvin Libf594a52016-12-17 05:48:59 +00003492 S = OMPTargetTeamsDirective::CreateEmpty(
3493 Context, Record[ASTStmtReader::NumStmtFields], Empty);
3494 break;
Kelvin Li83c451e2016-12-25 04:52:54 +00003495
3496 case STMT_OMP_TARGET_TEAMS_DISTRIBUTE_DIRECTIVE: {
3497 auto NumClauses = Record[ASTStmtReader::NumStmtFields];
3498 auto CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
3499 S = OMPTargetTeamsDistributeDirective::CreateEmpty(Context, NumClauses,
3500 CollapsedNum, Empty);
3501 break;
3502 }
3503
Kelvin Li80e8f562016-12-29 22:16:30 +00003504 case STMT_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE: {
3505 auto NumClauses = Record[ASTStmtReader::NumStmtFields];
3506 auto CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
3507 S = OMPTargetTeamsDistributeParallelForDirective::CreateEmpty(
3508 Context, NumClauses, CollapsedNum, Empty);
3509 break;
3510 }
3511
Kelvin Li1851df52017-01-03 05:23:48 +00003512 case STMT_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE: {
3513 auto NumClauses = Record[ASTStmtReader::NumStmtFields];
3514 auto CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
3515 S = OMPTargetTeamsDistributeParallelForSimdDirective::CreateEmpty(
3516 Context, NumClauses, CollapsedNum, Empty);
3517 break;
3518 }
3519
Kelvin Lida681182017-01-10 18:08:18 +00003520 case STMT_OMP_TARGET_TEAMS_DISTRIBUTE_SIMD_DIRECTIVE: {
3521 auto NumClauses = Record[ASTStmtReader::NumStmtFields];
3522 auto CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
3523 S = OMPTargetTeamsDistributeSimdDirective::CreateEmpty(
3524 Context, NumClauses, CollapsedNum, Empty);
3525 break;
3526 }
3527
Sebastian Redl539c5062010-08-18 23:57:32 +00003528 case EXPR_CXX_OPERATOR_CALL:
Bruno Riccic5885cf2018-12-21 15:20:32 +00003529 S = CXXOperatorCallExpr::CreateEmpty(
3530 Context, /*NumArgs=*/Record[ASTStmtReader::NumExprFields], Empty);
Argyrios Kyrtzidiseeaaead2009-07-14 03:19:21 +00003531 break;
Chris Lattnerb7e7f722010-05-09 05:36:05 +00003532
Sebastian Redl539c5062010-08-18 23:57:32 +00003533 case EXPR_CXX_MEMBER_CALL:
Bruno Riccic5885cf2018-12-21 15:20:32 +00003534 S = CXXMemberCallExpr::CreateEmpty(
3535 Context, /*NumArgs=*/Record[ASTStmtReader::NumExprFields], Empty);
Chris Lattnerb7e7f722010-05-09 05:36:05 +00003536 break;
Alexey Bataev1b59ab52014-02-27 08:29:12 +00003537
Richard Smith778dc0f2019-10-19 00:04:38 +00003538 case EXPR_CXX_REWRITTEN_BINARY_OPERATOR:
3539 S = new (Context) CXXRewrittenBinaryOperator(Empty);
3540 break;
3541
Sebastian Redl539c5062010-08-18 23:57:32 +00003542 case EXPR_CXX_CONSTRUCT:
Bruno Ricciddb8f6b2018-12-22 14:39:30 +00003543 S = CXXConstructExpr::CreateEmpty(
3544 Context,
3545 /* NumArgs=*/Record[ASTStmtReader::NumExprFields]);
Argyrios Kyrtzidisb8d77eb2010-07-10 11:46:15 +00003546 break;
Alexey Bataev1b59ab52014-02-27 08:29:12 +00003547
Richard Smith5179eb72016-06-28 19:03:57 +00003548 case EXPR_CXX_INHERITED_CTOR_INIT:
3549 S = new (Context) CXXInheritedCtorInitExpr(Empty);
3550 break;
3551
Sebastian Redl539c5062010-08-18 23:57:32 +00003552 case EXPR_CXX_TEMPORARY_OBJECT:
Bruno Ricciddb8f6b2018-12-22 14:39:30 +00003553 S = CXXTemporaryObjectExpr::CreateEmpty(
3554 Context,
3555 /* NumArgs=*/Record[ASTStmtReader::NumExprFields]);
Douglas Gregor5d3507d2009-09-09 23:08:42 +00003556 break;
Sam Weinigd01101e2010-01-16 21:21:01 +00003557
Sebastian Redl539c5062010-08-18 23:57:32 +00003558 case EXPR_CXX_STATIC_CAST:
Douglas Gregor4163aca2011-09-09 21:34:22 +00003559 S = CXXStaticCastExpr::CreateEmpty(Context,
Sebastian Redl70c751d2010-08-18 23:56:52 +00003560 /*PathSize*/ Record[ASTStmtReader::NumExprFields]);
Sam Weinigd01101e2010-01-16 21:21:01 +00003561 break;
3562
Sebastian Redl539c5062010-08-18 23:57:32 +00003563 case EXPR_CXX_DYNAMIC_CAST:
Douglas Gregor4163aca2011-09-09 21:34:22 +00003564 S = CXXDynamicCastExpr::CreateEmpty(Context,
Sebastian Redl70c751d2010-08-18 23:56:52 +00003565 /*PathSize*/ Record[ASTStmtReader::NumExprFields]);
Sam Weinigd01101e2010-01-16 21:21:01 +00003566 break;
3567
Sebastian Redl539c5062010-08-18 23:57:32 +00003568 case EXPR_CXX_REINTERPRET_CAST:
Douglas Gregor4163aca2011-09-09 21:34:22 +00003569 S = CXXReinterpretCastExpr::CreateEmpty(Context,
Sebastian Redl70c751d2010-08-18 23:56:52 +00003570 /*PathSize*/ Record[ASTStmtReader::NumExprFields]);
Sam Weinigd01101e2010-01-16 21:21:01 +00003571 break;
3572
Sebastian Redl539c5062010-08-18 23:57:32 +00003573 case EXPR_CXX_CONST_CAST:
Douglas Gregor4163aca2011-09-09 21:34:22 +00003574 S = CXXConstCastExpr::CreateEmpty(Context);
Sam Weinigd01101e2010-01-16 21:21:01 +00003575 break;
3576
Sebastian Redl539c5062010-08-18 23:57:32 +00003577 case EXPR_CXX_FUNCTIONAL_CAST:
Douglas Gregor4163aca2011-09-09 21:34:22 +00003578 S = CXXFunctionalCastExpr::CreateEmpty(Context,
Sebastian Redl70c751d2010-08-18 23:56:52 +00003579 /*PathSize*/ Record[ASTStmtReader::NumExprFields]);
Sam Weinigd01101e2010-01-16 21:21:01 +00003580 break;
3581
Richard Smithc67fdd42012-03-07 08:35:16 +00003582 case EXPR_USER_DEFINED_LITERAL:
Bruno Riccic5885cf2018-12-21 15:20:32 +00003583 S = UserDefinedLiteral::CreateEmpty(
Bruno Ricci9b1afac2018-12-03 16:17:45 +00003584 Context, /*NumArgs=*/Record[ASTStmtReader::NumExprFields], Empty);
Richard Smithc67fdd42012-03-07 08:35:16 +00003585 break;
3586
Richard Smithcc1b96d2013-06-12 22:31:48 +00003587 case EXPR_CXX_STD_INITIALIZER_LIST:
3588 S = new (Context) CXXStdInitializerListExpr(Empty);
3589 break;
3590
Sebastian Redl539c5062010-08-18 23:57:32 +00003591 case EXPR_CXX_BOOL_LITERAL:
Sam Weinige83b3ac2010-02-07 06:32:43 +00003592 S = new (Context) CXXBoolLiteralExpr(Empty);
3593 break;
Sam Weinigd01101e2010-01-16 21:21:01 +00003594
Sebastian Redl539c5062010-08-18 23:57:32 +00003595 case EXPR_CXX_NULL_PTR_LITERAL:
Sam Weinige83b3ac2010-02-07 06:32:43 +00003596 S = new (Context) CXXNullPtrLiteralExpr(Empty);
3597 break;
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +00003598
Sebastian Redl539c5062010-08-18 23:57:32 +00003599 case EXPR_CXX_TYPEID_EXPR:
Chris Lattner13a5ecc2010-05-09 06:03:39 +00003600 S = new (Context) CXXTypeidExpr(Empty, true);
3601 break;
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +00003602
Sebastian Redl539c5062010-08-18 23:57:32 +00003603 case EXPR_CXX_TYPEID_TYPE:
Chris Lattner13a5ecc2010-05-09 06:03:39 +00003604 S = new (Context) CXXTypeidExpr(Empty, false);
3605 break;
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +00003606
Francois Pichet9f4f2072010-09-08 12:20:18 +00003607 case EXPR_CXX_UUIDOF_EXPR:
3608 S = new (Context) CXXUuidofExpr(Empty, true);
3609 break;
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +00003610
John McCall5e77d762013-04-16 07:28:30 +00003611 case EXPR_CXX_PROPERTY_REF_EXPR:
3612 S = new (Context) MSPropertyRefExpr(Empty);
3613 break;
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +00003614
Alexey Bataevf7630272015-11-25 12:01:00 +00003615 case EXPR_CXX_PROPERTY_SUBSCRIPT_EXPR:
3616 S = new (Context) MSPropertySubscriptExpr(Empty);
3617 break;
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +00003618
Francois Pichet9f4f2072010-09-08 12:20:18 +00003619 case EXPR_CXX_UUIDOF_TYPE:
3620 S = new (Context) CXXUuidofExpr(Empty, false);
3621 break;
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +00003622
Sebastian Redl539c5062010-08-18 23:57:32 +00003623 case EXPR_CXX_THIS:
Chris Lattner98267332010-05-09 06:15:05 +00003624 S = new (Context) CXXThisExpr(Empty);
3625 break;
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +00003626
Sebastian Redl539c5062010-08-18 23:57:32 +00003627 case EXPR_CXX_THROW:
Chris Lattner98267332010-05-09 06:15:05 +00003628 S = new (Context) CXXThrowExpr(Empty);
3629 break;
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +00003630
John McCall32791cc2016-01-06 22:34:54 +00003631 case EXPR_CXX_DEFAULT_ARG:
3632 S = new (Context) CXXDefaultArgExpr(Empty);
Chris Lattnere2437f42010-05-09 06:40:08 +00003633 break;
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +00003634
Richard Smith852c9db2013-04-20 22:23:05 +00003635 case EXPR_CXX_DEFAULT_INIT:
3636 S = new (Context) CXXDefaultInitExpr(Empty);
3637 break;
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +00003638
Sebastian Redl539c5062010-08-18 23:57:32 +00003639 case EXPR_CXX_BIND_TEMPORARY:
Chris Lattnercba86142010-05-10 00:25:06 +00003640 S = new (Context) CXXBindTemporaryExpr(Empty);
3641 break;
David L. Jonesc4808b9e2016-12-15 20:53:26 +00003642
Sebastian Redl539c5062010-08-18 23:57:32 +00003643 case EXPR_CXX_SCALAR_VALUE_INIT:
Douglas Gregor747eb782010-07-08 06:14:04 +00003644 S = new (Context) CXXScalarValueInitExpr(Empty);
Chris Lattnerabfb58d2010-05-10 01:22:27 +00003645 break;
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +00003646
Sebastian Redl539c5062010-08-18 23:57:32 +00003647 case EXPR_CXX_NEW:
Bruno Ricci9b6dfac2019-01-07 15:04:45 +00003648 S = CXXNewExpr::CreateEmpty(
3649 Context,
3650 /*IsArray=*/Record[ASTStmtReader::NumExprFields],
3651 /*HasInit=*/Record[ASTStmtReader::NumExprFields + 1],
3652 /*NumPlacementArgs=*/Record[ASTStmtReader::NumExprFields + 2],
3653 /*IsParenTypeId=*/Record[ASTStmtReader::NumExprFields + 3]);
Chris Lattnerabfb58d2010-05-10 01:22:27 +00003654 break;
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +00003655
Sebastian Redl539c5062010-08-18 23:57:32 +00003656 case EXPR_CXX_DELETE:
Argyrios Kyrtzidis6e57c352010-06-22 17:07:59 +00003657 S = new (Context) CXXDeleteExpr(Empty);
3658 break;
Eugene Zelenkoe69b33f2018-04-11 20:57:28 +00003659
Sebastian Redl539c5062010-08-18 23:57:32 +00003660 case EXPR_CXX_PSEUDO_DESTRUCTOR:
Argyrios Kyrtzidis99a226d2010-06-28 09:32:03 +00003661 S = new (Context) CXXPseudoDestructorExpr(Empty);
3662 break;
David L. Jonesc4808b9e2016-12-15 20:53:26 +00003663
John McCall5d413782010-12-06 08:20:24 +00003664 case EXPR_EXPR_WITH_CLEANUPS:
John McCall28fc7092011-11-10 05:35:25 +00003665 S = ExprWithCleanups::Create(Context, Empty,
3666 Record[ASTStmtReader::NumExprFields]);
Chris Lattnercba86142010-05-10 00:25:06 +00003667 break;
David L. Jonesc4808b9e2016-12-15 20:53:26 +00003668
Sebastian Redl539c5062010-08-18 23:57:32 +00003669 case EXPR_CXX_DEPENDENT_SCOPE_MEMBER:
Bruno Ricci2e6dc532019-01-08 14:17:00 +00003670 S = CXXDependentScopeMemberExpr::CreateEmpty(
3671 Context,
3672 /*HasTemplateKWAndArgsInfo=*/Record[ASTStmtReader::NumExprFields],
3673 /*NumTemplateArgs=*/Record[ASTStmtReader::NumExprFields + 1],
3674 /*HasFirstQualifierFoundInScope=*/
3675 Record[ASTStmtReader::NumExprFields + 2]);
Argyrios Kyrtzidisbfcacee2010-06-24 08:57:31 +00003676 break;
David L. Jonesc4808b9e2016-12-15 20:53:26 +00003677
Sebastian Redl539c5062010-08-18 23:57:32 +00003678 case EXPR_CXX_DEPENDENT_SCOPE_DECL_REF:
Douglas Gregor4163aca2011-09-09 21:34:22 +00003679 S = DependentScopeDeclRefExpr::CreateEmpty(Context,
Abramo Bagnara7945c982012-01-27 09:46:47 +00003680 /*HasTemplateKWAndArgsInfo=*/Record[ASTStmtReader::NumExprFields],
Douglas Gregor87866ce2011-02-04 12:01:24 +00003681 /*NumTemplateArgs=*/Record[ASTStmtReader::NumExprFields]
David L. Jonesc4808b9e2016-12-15 20:53:26 +00003682 ? Record[ASTStmtReader::NumExprFields + 1]
Douglas Gregor87866ce2011-02-04 12:01:24 +00003683 : 0);
Argyrios Kyrtzidiscd444d1a2010-06-28 09:31:56 +00003684 break;
David L. Jonesc4808b9e2016-12-15 20:53:26 +00003685
Sebastian Redl539c5062010-08-18 23:57:32 +00003686 case EXPR_CXX_UNRESOLVED_CONSTRUCT:
Douglas Gregor4163aca2011-09-09 21:34:22 +00003687 S = CXXUnresolvedConstructExpr::CreateEmpty(Context,
Sebastian Redl70c751d2010-08-18 23:56:52 +00003688 /*NumArgs=*/Record[ASTStmtReader::NumExprFields]);
Argyrios Kyrtzidisb8d3c632010-06-25 09:03:26 +00003689 break;
David L. Jonesc4808b9e2016-12-15 20:53:26 +00003690
Sebastian Redl539c5062010-08-18 23:57:32 +00003691 case EXPR_CXX_UNRESOLVED_MEMBER:
Bruno Riccid7628d92019-01-09 15:43:19 +00003692 S = UnresolvedMemberExpr::CreateEmpty(
3693 Context,
3694 /*NumResults=*/Record[ASTStmtReader::NumExprFields],
3695 /*HasTemplateKWAndArgsInfo=*/Record[ASTStmtReader::NumExprFields + 1],
3696 /*NumTemplateArgs=*/
3697 Record[ASTStmtReader::NumExprFields + 1]
3698 ? Record[ASTStmtReader::NumExprFields + 2]
3699 : 0);
Argyrios Kyrtzidisbfcacee2010-06-24 08:57:31 +00003700 break;
David L. Jonesc4808b9e2016-12-15 20:53:26 +00003701
Sebastian Redl539c5062010-08-18 23:57:32 +00003702 case EXPR_CXX_UNRESOLVED_LOOKUP:
Bruno Riccid7628d92019-01-09 15:43:19 +00003703 S = UnresolvedLookupExpr::CreateEmpty(
3704 Context,
3705 /*NumResults=*/Record[ASTStmtReader::NumExprFields],
3706 /*HasTemplateKWAndArgsInfo=*/Record[ASTStmtReader::NumExprFields + 1],
3707 /*NumTemplateArgs=*/
3708 Record[ASTStmtReader::NumExprFields + 1]
3709 ? Record[ASTStmtReader::NumExprFields + 2]
3710 : 0);
Argyrios Kyrtzidis58e01ad2010-06-25 09:03:34 +00003711 break;
Sebastian Redl9ac55dd2010-09-10 20:55:54 +00003712
Douglas Gregor29c42f22012-02-24 07:38:34 +00003713 case EXPR_TYPE_TRAIT:
David L. Jonesc4808b9e2016-12-15 20:53:26 +00003714 S = TypeTraitExpr::CreateDeserialized(Context,
Douglas Gregor29c42f22012-02-24 07:38:34 +00003715 Record[ASTStmtReader::NumExprFields]);
3716 break;
David L. Jonesc4808b9e2016-12-15 20:53:26 +00003717
John Wiegley6242b6a2011-04-28 00:16:57 +00003718 case EXPR_ARRAY_TYPE_TRAIT:
3719 S = new (Context) ArrayTypeTraitExpr(Empty);
3720 break;
3721
John Wiegleyf9f65842011-04-25 06:54:41 +00003722 case EXPR_CXX_EXPRESSION_TRAIT:
3723 S = new (Context) ExpressionTraitExpr(Empty);
3724 break;
3725
Sebastian Redl9ac55dd2010-09-10 20:55:54 +00003726 case EXPR_CXX_NOEXCEPT:
3727 S = new (Context) CXXNoexceptExpr(Empty);
3728 break;
John McCall8d69a212010-11-15 23:31:06 +00003729
Douglas Gregore8e9dd62011-01-03 17:17:50 +00003730 case EXPR_PACK_EXPANSION:
3731 S = new (Context) PackExpansionExpr(Empty);
3732 break;
David L. Jonesc4808b9e2016-12-15 20:53:26 +00003733
Douglas Gregor820ba7b2011-01-04 17:33:58 +00003734 case EXPR_SIZEOF_PACK:
Richard Smithd784e682015-09-23 21:41:42 +00003735 S = SizeOfPackExpr::CreateDeserialized(
3736 Context,
3737 /*NumPartialArgs=*/Record[ASTStmtReader::NumExprFields]);
Douglas Gregor820ba7b2011-01-04 17:33:58 +00003738 break;
David L. Jonesc4808b9e2016-12-15 20:53:26 +00003739
John McCallfa194042011-07-15 07:00:14 +00003740 case EXPR_SUBST_NON_TYPE_TEMPLATE_PARM:
3741 S = new (Context) SubstNonTypeTemplateParmExpr(Empty);
3742 break;
David L. Jonesc4808b9e2016-12-15 20:53:26 +00003743
Douglas Gregorcdbc5392011-01-15 01:15:58 +00003744 case EXPR_SUBST_NON_TYPE_TEMPLATE_PARM_PACK:
3745 S = new (Context) SubstNonTypeTemplateParmPackExpr(Empty);
3746 break;
Richard Smithb15fe3a2012-09-12 00:56:43 +00003747
3748 case EXPR_FUNCTION_PARM_PACK:
3749 S = FunctionParmPackExpr::CreateEmpty(Context,
3750 Record[ASTStmtReader::NumExprFields]);
3751 break;
David L. Jonesc4808b9e2016-12-15 20:53:26 +00003752
Douglas Gregorfe314812011-06-21 17:03:29 +00003753 case EXPR_MATERIALIZE_TEMPORARY:
3754 S = new (Context) MaterializeTemporaryExpr(Empty);
3755 break;
Richard Smith0f0af192014-11-08 05:07:16 +00003756
3757 case EXPR_CXX_FOLD:
3758 S = new (Context) CXXFoldExpr(Empty);
3759 break;
3760
Argyrios Kyrtzidisb2b07952011-12-03 03:49:52 +00003761 case EXPR_OPAQUE_VALUE:
3762 S = new (Context) OpaqueValueExpr(Empty);
John McCall8d69a212010-11-15 23:31:06 +00003763 break;
Peter Collingbourne41f85462011-02-09 21:07:24 +00003764
3765 case EXPR_CUDA_KERNEL_CALL:
Bruno Riccic5885cf2018-12-21 15:20:32 +00003766 S = CUDAKernelCallExpr::CreateEmpty(
Bruno Ricci9b1afac2018-12-03 16:17:45 +00003767 Context, /*NumArgs=*/Record[ASTStmtReader::NumExprFields], Empty);
Peter Collingbourne41f85462011-02-09 21:07:24 +00003768 break;
David L. Jonesc4808b9e2016-12-15 20:53:26 +00003769
Tanya Lattner55808c12011-06-04 00:47:47 +00003770 case EXPR_ASTYPE:
3771 S = new (Context) AsTypeExpr(Empty);
3772 break;
Eli Friedmandf14b3a2011-10-11 02:20:01 +00003773
John McCallfe96e0b2011-11-06 09:01:30 +00003774 case EXPR_PSEUDO_OBJECT: {
3775 unsigned numSemanticExprs = Record[ASTStmtReader::NumExprFields];
3776 S = PseudoObjectExpr::Create(Context, Empty, numSemanticExprs);
3777 break;
3778 }
3779
Eli Friedmandf14b3a2011-10-11 02:20:01 +00003780 case EXPR_ATOMIC:
3781 S = new (Context) AtomicExpr(Empty);
3782 break;
David L. Jonesc4808b9e2016-12-15 20:53:26 +00003783
Douglas Gregor99ae8062012-02-14 17:54:36 +00003784 case EXPR_LAMBDA: {
3785 unsigned NumCaptures = Record[ASTStmtReader::NumExprFields];
Richard Smith30e304e2016-12-14 00:03:17 +00003786 S = LambdaExpr::CreateDeserialized(Context, NumCaptures);
Douglas Gregor99ae8062012-02-14 17:54:36 +00003787 break;
3788 }
Gor Nishanovf5ecb5e2017-07-25 18:01:49 +00003789
3790 case STMT_COROUTINE_BODY: {
3791 unsigned NumParams = Record[ASTStmtReader::NumStmtFields];
3792 S = CoroutineBodyStmt::Create(Context, Empty, NumParams);
3793 break;
3794 }
3795
3796 case STMT_CORETURN:
3797 S = new (Context) CoreturnStmt(Empty);
3798 break;
3799
3800 case EXPR_COAWAIT:
3801 S = new (Context) CoawaitExpr(Empty);
3802 break;
3803
3804 case EXPR_COYIELD:
3805 S = new (Context) CoyieldExpr(Empty);
3806 break;
3807
3808 case EXPR_DEPENDENT_COAWAIT:
3809 S = new (Context) DependentCoawaitExpr(Empty);
3810 break;
Saar Raz5d98ba62019-10-15 15:24:26 +00003811
Saar Raza0f50d72020-01-18 09:11:43 +02003812 case EXPR_CONCEPT_SPECIALIZATION: {
Saar Raz5d98ba62019-10-15 15:24:26 +00003813 unsigned numTemplateArgs = Record[ASTStmtReader::NumExprFields];
3814 S = ConceptSpecializationExpr::Create(Context, Empty, numTemplateArgs);
3815 break;
Saar Raza0f50d72020-01-18 09:11:43 +02003816 }
3817
3818 case EXPR_REQUIRES:
3819 unsigned numLocalParameters = Record[ASTStmtReader::NumExprFields];
3820 unsigned numRequirement = Record[ASTStmtReader::NumExprFields + 1];
3821 S = RequiresExpr::Create(Context, Empty, numLocalParameters,
3822 numRequirement);
3823 break;
Chris Lattner92ba5ff2009-04-27 05:14:47 +00003824 }
David L. Jonesc4808b9e2016-12-15 20:53:26 +00003825
Chris Lattner92ba5ff2009-04-27 05:14:47 +00003826 // We hit a STMT_STOP, so we're done with this expression.
3827 if (Finished)
3828 break;
3829
3830 ++NumStatementsRead;
3831
Argyrios Kyrtzidis6a598972011-10-21 23:02:28 +00003832 if (S && !IsStmtReference) {
Argyrios Kyrtzidisd0795b22010-06-28 22:28:35 +00003833 Reader.Visit(S);
Argyrios Kyrtzidis6a598972011-10-21 23:02:28 +00003834 StmtEntries[Cursor.GetCurrentBitNo()] = S;
3835 }
3836
David L. Jonesbe1557a2016-12-21 00:17:49 +00003837 assert(Record.getIdx() == Record.size() &&
3838 "Invalid deserialization of statement");
Chris Lattner92ba5ff2009-04-27 05:14:47 +00003839 StmtStack.push_back(S);
3840 }
Chris Lattner0e6c9402013-01-20 02:38:54 +00003841Done:
Alp Toker028ed912013-12-06 17:56:43 +00003842 assert(StmtStack.size() > PrevNumStmts && "Read too many sub-stmts!");
Argyrios Kyrtzidisd0795b22010-06-28 22:28:35 +00003843 assert(StmtStack.size() == PrevNumStmts + 1 && "Extra expressions on stack!");
Argyrios Kyrtzidisd0795b22010-06-28 22:28:35 +00003844 return StmtStack.pop_back_val();
Chris Lattner92ba5ff2009-04-27 05:14:47 +00003845}