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