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