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