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