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 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // Statement/expression deserialization. This implements the |
Sebastian Redl | 2c499f6 | 2010-08-18 23:56:43 +0000 | [diff] [blame] | 11 | // ASTReader::ReadStmt method. |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 12 | // |
| 13 | //===----------------------------------------------------------------------===// |
| 14 | |
Sebastian Redl | f5b1346 | 2010-08-18 23:57:17 +0000 | [diff] [blame] | 15 | #include "clang/Serialization/ASTReader.h" |
Benjamin Kramer | 4ab984e | 2012-07-04 20:19:54 +0000 | [diff] [blame] | 16 | #include "clang/AST/ASTContext.h" |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 17 | #include "clang/AST/AttrIterator.h" |
| 18 | #include "clang/AST/Decl.h" |
| 19 | #include "clang/AST/DeclAccessPair.h" |
Douglas Gregor | 5d3507d | 2009-09-09 23:08:42 +0000 | [diff] [blame] | 20 | #include "clang/AST/DeclCXX.h" |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 21 | #include "clang/AST/DeclGroup.h" |
| 22 | #include "clang/AST/DeclObjC.h" |
Douglas Gregor | cdbc539 | 2011-01-15 01:15:58 +0000 | [diff] [blame] | 23 | #include "clang/AST/DeclTemplate.h" |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 24 | #include "clang/AST/DeclarationName.h" |
| 25 | #include "clang/AST/Expr.h" |
| 26 | #include "clang/AST/ExprCXX.h" |
| 27 | #include "clang/AST/ExprObjC.h" |
| 28 | #include "clang/AST/ExprOpenMP.h" |
| 29 | #include "clang/AST/NestedNameSpecifier.h" |
| 30 | #include "clang/AST/OpenMPClause.h" |
| 31 | #include "clang/AST/OperationKinds.h" |
| 32 | #include "clang/AST/Stmt.h" |
| 33 | #include "clang/AST/StmtCXX.h" |
| 34 | #include "clang/AST/StmtObjC.h" |
| 35 | #include "clang/AST/StmtOpenMP.h" |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 36 | #include "clang/AST/StmtVisitor.h" |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 37 | #include "clang/AST/TemplateBase.h" |
| 38 | #include "clang/AST/Type.h" |
| 39 | #include "clang/AST/UnresolvedSet.h" |
| 40 | #include "clang/Basic/CapturedStmt.h" |
| 41 | #include "clang/Basic/ExpressionTraits.h" |
| 42 | #include "clang/Basic/LLVM.h" |
| 43 | #include "clang/Basic/Lambda.h" |
| 44 | #include "clang/Basic/LangOptions.h" |
| 45 | #include "clang/Basic/OpenMPKinds.h" |
| 46 | #include "clang/Basic/OperatorKinds.h" |
| 47 | #include "clang/Basic/SourceLocation.h" |
| 48 | #include "clang/Basic/Specifiers.h" |
| 49 | #include "clang/Basic/TypeTraits.h" |
John McCall | f413f5e | 2013-05-03 00:10:13 +0000 | [diff] [blame] | 50 | #include "clang/Lex/Token.h" |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 51 | #include "clang/Serialization/ASTBitCodes.h" |
| 52 | #include "llvm/ADT/DenseMap.h" |
Benjamin Kramer | 4903802 | 2012-02-04 13:45:25 +0000 | [diff] [blame] | 53 | #include "llvm/ADT/SmallString.h" |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 54 | #include "llvm/ADT/SmallVector.h" |
| 55 | #include "llvm/ADT/StringRef.h" |
| 56 | #include "llvm/Bitcode/BitstreamReader.h" |
| 57 | #include "llvm/Support/Casting.h" |
| 58 | #include "llvm/Support/ErrorHandling.h" |
| 59 | #include <algorithm> |
| 60 | #include <cassert> |
| 61 | #include <cstdint> |
| 62 | #include <string> |
| 63 | |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 64 | using namespace clang; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 65 | using namespace serialization; |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 66 | |
Argyrios Kyrtzidis | f9f47c8 | 2010-06-30 08:49:18 +0000 | [diff] [blame] | 67 | namespace clang { |
Argyrios Kyrtzidis | ddf5f21 | 2010-06-28 09:31:42 +0000 | [diff] [blame] | 68 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 69 | class ASTStmtReader : public StmtVisitor<ASTStmtReader> { |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 70 | friend class OMPClauseReader; |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 71 | |
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 | |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [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 | |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [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 | |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [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 | |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 87 | TypeSourceInfo *GetTypeSourceInfo() { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 88 | return Record.getTypeSourceInfo(); |
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 | |
| 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> |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [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 | |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 100 | void ReadDeclarationNameLoc(DeclarationNameLoc &DNLoc, |
| 101 | DeclarationName Name) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 102 | Record.readDeclarationNameLoc(DNLoc, Name); |
Argyrios Kyrtzidis | 434383d | 2010-10-15 18:21:24 +0000 | [diff] [blame] | 103 | } |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 104 | |
| 105 | void ReadDeclarationNameInfo(DeclarationNameInfo &NameInfo) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 106 | Record.readDeclarationNameInfo(NameInfo); |
Argyrios Kyrtzidis | 434383d | 2010-10-15 18:21:24 +0000 | [diff] [blame] | 107 | } |
Sebastian Redl | 2c373b9 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 108 | |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 109 | public: |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 110 | ASTStmtReader(ASTRecordReader &Record, llvm::BitstreamCursor &Cursor) |
| 111 | : Record(Record), DeclsCursor(Cursor) {} |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 112 | |
Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame] | 113 | /// The number of record fields required for the Stmt class |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 114 | /// itself. |
| 115 | static const unsigned NumStmtFields = 0; |
| 116 | |
Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame] | 117 | /// The number of record fields required for the Expr class |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 118 | /// itself. |
Douglas Gregor | 678d76c | 2011-07-01 01:22:09 +0000 | [diff] [blame] | 119 | static const unsigned NumExprFields = NumStmtFields + 7; |
Abramo Bagnara | 7945c98 | 2012-01-27 09:46:47 +0000 | [diff] [blame] | 120 | |
Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame] | 121 | /// Read and initialize a ExplicitTemplateArgumentList structure. |
Abramo Bagnara | 7945c98 | 2012-01-27 09:46:47 +0000 | [diff] [blame] | 122 | void ReadTemplateKWAndArgsInfo(ASTTemplateKWAndArgsInfo &Args, |
James Y Knight | e7d8228 | 2015-12-29 18:15:14 +0000 | [diff] [blame] | 123 | TemplateArgumentLoc *ArgsLocArray, |
Abramo Bagnara | 7945c98 | 2012-01-27 09:46:47 +0000 | [diff] [blame] | 124 | unsigned NumTemplateArgs); |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 125 | |
Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame] | 126 | /// Read and initialize a ExplicitTemplateArgumentList structure. |
Argyrios Kyrtzidis | de6aa08 | 2011-09-22 20:07:03 +0000 | [diff] [blame] | 127 | void ReadExplicitTemplateArgumentList(ASTTemplateArgumentListInfo &ArgList, |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 128 | unsigned NumTemplateArgs); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 129 | |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 130 | void VisitStmt(Stmt *S); |
John McCall | fa19404 | 2011-07-15 07:00:14 +0000 | [diff] [blame] | 131 | #define STMT(Type, Base) \ |
| 132 | void Visit##Type(Type *); |
| 133 | #include "clang/AST/StmtNodes.inc" |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 134 | }; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 135 | |
| 136 | } // namespace clang |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 137 | |
James Y Knight | e7d8228 | 2015-12-29 18:15:14 +0000 | [diff] [blame] | 138 | void ASTStmtReader::ReadTemplateKWAndArgsInfo(ASTTemplateKWAndArgsInfo &Args, |
| 139 | TemplateArgumentLoc *ArgsLocArray, |
| 140 | unsigned NumTemplateArgs) { |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 141 | SourceLocation TemplateKWLoc = ReadSourceLocation(); |
Argyrios Kyrtzidis | b5288de | 2010-06-28 09:31:48 +0000 | [diff] [blame] | 142 | TemplateArgumentListInfo ArgInfo; |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 143 | ArgInfo.setLAngleLoc(ReadSourceLocation()); |
| 144 | ArgInfo.setRAngleLoc(ReadSourceLocation()); |
Argyrios Kyrtzidis | b5288de | 2010-06-28 09:31:48 +0000 | [diff] [blame] | 145 | for (unsigned i = 0; i != NumTemplateArgs; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 146 | ArgInfo.addArgument(Record.readTemplateArgumentLoc()); |
James Y Knight | e7d8228 | 2015-12-29 18:15:14 +0000 | [diff] [blame] | 147 | Args.initializeFrom(TemplateKWLoc, ArgInfo, ArgsLocArray); |
Argyrios Kyrtzidis | b5288de | 2010-06-28 09:31:48 +0000 | [diff] [blame] | 148 | } |
| 149 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 150 | void ASTStmtReader::VisitStmt(Stmt *S) { |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 151 | assert(Record.getIdx() == NumStmtFields && "Incorrect statement field count"); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 152 | } |
| 153 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 154 | void ASTStmtReader::VisitNullStmt(NullStmt *S) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 155 | VisitStmt(S); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 156 | S->setSemiLoc(ReadSourceLocation()); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 157 | S->HasLeadingEmptyMacro = Record.readInt(); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 158 | } |
| 159 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 160 | void ASTStmtReader::VisitCompoundStmt(CompoundStmt *S) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 161 | VisitStmt(S); |
Chris Lattner | 0e62c1c | 2011-07-23 10:55:15 +0000 | [diff] [blame] | 162 | SmallVector<Stmt *, 16> Stmts; |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 163 | unsigned NumStmts = Record.readInt(); |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 164 | while (NumStmts--) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 165 | Stmts.push_back(Record.readSubStmt()); |
Benjamin Kramer | 0742090 | 2017-12-24 16:24:20 +0000 | [diff] [blame] | 166 | S->setStmts(Stmts); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 167 | S->LBraceLoc = ReadSourceLocation(); |
| 168 | S->RBraceLoc = ReadSourceLocation(); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 169 | } |
| 170 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 171 | void ASTStmtReader::VisitSwitchCase(SwitchCase *S) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 172 | VisitStmt(S); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 173 | Record.recordSwitchCaseID(S, Record.readInt()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 174 | S->setKeywordLoc(ReadSourceLocation()); |
| 175 | S->setColonLoc(ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 176 | } |
| 177 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 178 | void ASTStmtReader::VisitCaseStmt(CaseStmt *S) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 179 | VisitSwitchCase(S); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 180 | S->setLHS(Record.readSubExpr()); |
| 181 | S->setRHS(Record.readSubExpr()); |
| 182 | S->setSubStmt(Record.readSubStmt()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 183 | S->setEllipsisLoc(ReadSourceLocation()); |
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::VisitDefaultStmt(DefaultStmt *S) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 187 | VisitSwitchCase(S); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 188 | S->setSubStmt(Record.readSubStmt()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 189 | } |
| 190 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 191 | void ASTStmtReader::VisitLabelStmt(LabelStmt *S) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 192 | VisitStmt(S); |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 193 | auto *LD = ReadDeclAs<LabelDecl>(); |
Chris Lattner | c8e630e | 2011-02-17 07:39:24 +0000 | [diff] [blame] | 194 | LD->setStmt(S); |
| 195 | S->setDecl(LD); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 196 | S->setSubStmt(Record.readSubStmt()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 197 | S->setIdentLoc(ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 198 | } |
| 199 | |
Richard Smith | c202b28 | 2012-04-14 00:33:13 +0000 | [diff] [blame] | 200 | void ASTStmtReader::VisitAttributedStmt(AttributedStmt *S) { |
| 201 | VisitStmt(S); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 202 | uint64_t NumAttrs = Record.readInt(); |
Richard Smith | c202b28 | 2012-04-14 00:33:13 +0000 | [diff] [blame] | 203 | AttrVec Attrs; |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 204 | Record.readAttributes(Attrs); |
Matt Beaumont-Gay | ad0bb8e | 2012-07-09 18:55:31 +0000 | [diff] [blame] | 205 | (void)NumAttrs; |
Alexander Kornienko | 20f6fc6 | 2012-07-09 10:04:07 +0000 | [diff] [blame] | 206 | assert(NumAttrs == S->NumAttrs); |
| 207 | assert(NumAttrs == Attrs.size()); |
Aaron Ballman | f3d9b09 | 2014-05-13 14:55:01 +0000 | [diff] [blame] | 208 | std::copy(Attrs.begin(), Attrs.end(), S->getAttrArrayPtr()); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 209 | S->SubStmt = Record.readSubStmt(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 210 | S->AttrLoc = ReadSourceLocation(); |
Richard Smith | c202b28 | 2012-04-14 00:33:13 +0000 | [diff] [blame] | 211 | } |
| 212 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 213 | void ASTStmtReader::VisitIfStmt(IfStmt *S) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 214 | VisitStmt(S); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 215 | S->setConstexpr(Record.readInt()); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 216 | S->setInit(Record.readSubStmt()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 217 | S->setConditionVariable(Record.getContext(), ReadDeclAs<VarDecl>()); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 218 | S->setCond(Record.readSubExpr()); |
| 219 | S->setThen(Record.readSubStmt()); |
| 220 | S->setElse(Record.readSubStmt()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 221 | S->setIfLoc(ReadSourceLocation()); |
| 222 | S->setElseLoc(ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 223 | } |
| 224 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 225 | void ASTStmtReader::VisitSwitchStmt(SwitchStmt *S) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 226 | VisitStmt(S); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 227 | S->setInit(Record.readSubStmt()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 228 | S->setConditionVariable(Record.getContext(), ReadDeclAs<VarDecl>()); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 229 | S->setCond(Record.readSubExpr()); |
| 230 | S->setBody(Record.readSubStmt()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 231 | S->setSwitchLoc(ReadSourceLocation()); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 232 | if (Record.readInt()) |
Ted Kremenek | c42f345 | 2010-09-09 00:05:53 +0000 | [diff] [blame] | 233 | S->setAllEnumCasesCovered(); |
| 234 | |
Craig Topper | a13603a | 2014-05-22 05:54:18 +0000 | [diff] [blame] | 235 | SwitchCase *PrevSC = nullptr; |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 236 | for (auto E = Record.size(); Record.getIdx() != E; ) { |
| 237 | SwitchCase *SC = Record.getSwitchCaseWithID(Record.readInt()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 238 | if (PrevSC) |
| 239 | PrevSC->setNextSwitchCase(SC); |
| 240 | else |
| 241 | S->setSwitchCaseList(SC); |
Mike Stump | 11289f4 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 242 | |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 243 | PrevSC = SC; |
| 244 | } |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 245 | } |
| 246 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 247 | void ASTStmtReader::VisitWhileStmt(WhileStmt *S) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 248 | VisitStmt(S); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 249 | S->setConditionVariable(Record.getContext(), ReadDeclAs<VarDecl>()); |
Douglas Gregor | 7fb0919 | 2011-07-21 22:35:25 +0000 | [diff] [blame] | 250 | |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 251 | S->setCond(Record.readSubExpr()); |
| 252 | S->setBody(Record.readSubStmt()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 253 | S->setWhileLoc(ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 254 | } |
| 255 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 256 | void ASTStmtReader::VisitDoStmt(DoStmt *S) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 257 | VisitStmt(S); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 258 | S->setCond(Record.readSubExpr()); |
| 259 | S->setBody(Record.readSubStmt()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 260 | S->setDoLoc(ReadSourceLocation()); |
| 261 | S->setWhileLoc(ReadSourceLocation()); |
| 262 | S->setRParenLoc(ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 263 | } |
| 264 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 265 | void ASTStmtReader::VisitForStmt(ForStmt *S) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 266 | VisitStmt(S); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 267 | S->setInit(Record.readSubStmt()); |
| 268 | S->setCond(Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 269 | S->setConditionVariable(Record.getContext(), ReadDeclAs<VarDecl>()); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 270 | S->setInc(Record.readSubExpr()); |
| 271 | S->setBody(Record.readSubStmt()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 272 | S->setForLoc(ReadSourceLocation()); |
| 273 | S->setLParenLoc(ReadSourceLocation()); |
| 274 | S->setRParenLoc(ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 275 | } |
| 276 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 277 | void ASTStmtReader::VisitGotoStmt(GotoStmt *S) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 278 | VisitStmt(S); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 279 | S->setLabel(ReadDeclAs<LabelDecl>()); |
| 280 | S->setGotoLoc(ReadSourceLocation()); |
| 281 | S->setLabelLoc(ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 282 | } |
| 283 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 284 | void ASTStmtReader::VisitIndirectGotoStmt(IndirectGotoStmt *S) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 285 | VisitStmt(S); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 286 | S->setGotoLoc(ReadSourceLocation()); |
| 287 | S->setStarLoc(ReadSourceLocation()); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 288 | S->setTarget(Record.readSubExpr()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 289 | } |
| 290 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 291 | void ASTStmtReader::VisitContinueStmt(ContinueStmt *S) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 292 | VisitStmt(S); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 293 | S->setContinueLoc(ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 294 | } |
| 295 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 296 | void ASTStmtReader::VisitBreakStmt(BreakStmt *S) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 297 | VisitStmt(S); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 298 | S->setBreakLoc(ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 299 | } |
| 300 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 301 | void ASTStmtReader::VisitReturnStmt(ReturnStmt *S) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 302 | VisitStmt(S); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 303 | S->setRetValue(Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 304 | S->setReturnLoc(ReadSourceLocation()); |
| 305 | S->setNRVOCandidate(ReadDeclAs<VarDecl>()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 306 | } |
| 307 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 308 | void ASTStmtReader::VisitDeclStmt(DeclStmt *S) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 309 | VisitStmt(S); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 310 | S->setStartLoc(ReadSourceLocation()); |
| 311 | S->setEndLoc(ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 312 | |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 313 | if (Record.size() - Record.getIdx() == 1) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 314 | // Single declaration |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 315 | S->setDeclGroup(DeclGroupRef(ReadDecl())); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 316 | } else { |
Chris Lattner | 0e62c1c | 2011-07-23 10:55:15 +0000 | [diff] [blame] | 317 | SmallVector<Decl *, 16> Decls; |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 318 | int N = Record.size() - Record.getIdx(); |
| 319 | Decls.reserve(N); |
| 320 | for (int I = 0; I < N; ++I) |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 321 | Decls.push_back(ReadDecl()); |
| 322 | S->setDeclGroup(DeclGroupRef(DeclGroup::Create(Record.getContext(), |
Douglas Gregor | 038c338 | 2009-05-22 22:45:36 +0000 | [diff] [blame] | 323 | Decls.data(), |
| 324 | Decls.size()))); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 325 | } |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 326 | } |
| 327 | |
John McCall | f413f5e | 2013-05-03 00:10:13 +0000 | [diff] [blame] | 328 | void ASTStmtReader::VisitAsmStmt(AsmStmt *S) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 329 | VisitStmt(S); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 330 | S->NumOutputs = Record.readInt(); |
| 331 | S->NumInputs = Record.readInt(); |
| 332 | S->NumClobbers = Record.readInt(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 333 | S->setAsmLoc(ReadSourceLocation()); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 334 | S->setVolatile(Record.readInt()); |
| 335 | S->setSimple(Record.readInt()); |
John McCall | f413f5e | 2013-05-03 00:10:13 +0000 | [diff] [blame] | 336 | } |
Mike Stump | 11289f4 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 337 | |
John McCall | f413f5e | 2013-05-03 00:10:13 +0000 | [diff] [blame] | 338 | void ASTStmtReader::VisitGCCAsmStmt(GCCAsmStmt *S) { |
| 339 | VisitAsmStmt(S); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 340 | S->setRParenLoc(ReadSourceLocation()); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 341 | S->setAsmString(cast_or_null<StringLiteral>(Record.readSubStmt())); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 342 | |
John McCall | f413f5e | 2013-05-03 00:10:13 +0000 | [diff] [blame] | 343 | unsigned NumOutputs = S->getNumOutputs(); |
| 344 | unsigned NumInputs = S->getNumInputs(); |
| 345 | unsigned NumClobbers = S->getNumClobbers(); |
| 346 | |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 347 | // Outputs and inputs |
Chris Lattner | 0e62c1c | 2011-07-23 10:55:15 +0000 | [diff] [blame] | 348 | SmallVector<IdentifierInfo *, 16> Names; |
| 349 | SmallVector<StringLiteral*, 16> Constraints; |
| 350 | SmallVector<Stmt*, 16> Exprs; |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 351 | for (unsigned I = 0, N = NumOutputs + NumInputs; I != N; ++I) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 352 | Names.push_back(Record.getIdentifierInfo()); |
| 353 | Constraints.push_back(cast_or_null<StringLiteral>(Record.readSubStmt())); |
| 354 | Exprs.push_back(Record.readSubStmt()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 355 | } |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 356 | |
| 357 | // Constraints |
Chris Lattner | 0e62c1c | 2011-07-23 10:55:15 +0000 | [diff] [blame] | 358 | SmallVector<StringLiteral*, 16> Clobbers; |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 359 | for (unsigned I = 0; I != NumClobbers; ++I) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 360 | Clobbers.push_back(cast_or_null<StringLiteral>(Record.readSubStmt())); |
Anders Carlsson | 96fe0b5 | 2010-01-30 19:34:25 +0000 | [diff] [blame] | 361 | |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 362 | S->setOutputsAndInputsAndClobbers(Record.getContext(), |
| 363 | Names.data(), Constraints.data(), |
| 364 | Exprs.data(), NumOutputs, NumInputs, |
Anders Carlsson | 96fe0b5 | 2010-01-30 19:34:25 +0000 | [diff] [blame] | 365 | Clobbers.data(), NumClobbers); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 366 | } |
| 367 | |
Chad Rosier | 3250302 | 2012-06-11 20:47:18 +0000 | [diff] [blame] | 368 | void ASTStmtReader::VisitMSAsmStmt(MSAsmStmt *S) { |
John McCall | f413f5e | 2013-05-03 00:10:13 +0000 | [diff] [blame] | 369 | VisitAsmStmt(S); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 370 | S->LBraceLoc = ReadSourceLocation(); |
| 371 | S->EndLoc = ReadSourceLocation(); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 372 | S->NumAsmToks = Record.readInt(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 373 | std::string AsmStr = ReadString(); |
John McCall | f413f5e | 2013-05-03 00:10:13 +0000 | [diff] [blame] | 374 | |
| 375 | // Read the tokens. |
| 376 | SmallVector<Token, 16> AsmToks; |
| 377 | AsmToks.reserve(S->NumAsmToks); |
| 378 | for (unsigned i = 0, e = S->NumAsmToks; i != e; ++i) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 379 | AsmToks.push_back(Record.readToken()); |
John McCall | f413f5e | 2013-05-03 00:10:13 +0000 | [diff] [blame] | 380 | } |
| 381 | |
| 382 | // The calls to reserve() for the FooData vectors are mandatory to |
| 383 | // prevent dead StringRefs in the Foo vectors. |
| 384 | |
| 385 | // Read the clobbers. |
| 386 | SmallVector<std::string, 16> ClobbersData; |
| 387 | SmallVector<StringRef, 16> Clobbers; |
| 388 | ClobbersData.reserve(S->NumClobbers); |
| 389 | Clobbers.reserve(S->NumClobbers); |
| 390 | for (unsigned i = 0, e = S->NumClobbers; i != e; ++i) { |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 391 | ClobbersData.push_back(ReadString()); |
John McCall | f413f5e | 2013-05-03 00:10:13 +0000 | [diff] [blame] | 392 | Clobbers.push_back(ClobbersData.back()); |
| 393 | } |
| 394 | |
| 395 | // Read the operands. |
| 396 | unsigned NumOperands = S->NumOutputs + S->NumInputs; |
| 397 | SmallVector<Expr*, 16> Exprs; |
| 398 | SmallVector<std::string, 16> ConstraintsData; |
| 399 | SmallVector<StringRef, 16> Constraints; |
| 400 | Exprs.reserve(NumOperands); |
| 401 | ConstraintsData.reserve(NumOperands); |
| 402 | Constraints.reserve(NumOperands); |
| 403 | for (unsigned i = 0; i != NumOperands; ++i) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 404 | Exprs.push_back(cast<Expr>(Record.readSubStmt())); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 405 | ConstraintsData.push_back(ReadString()); |
John McCall | f413f5e | 2013-05-03 00:10:13 +0000 | [diff] [blame] | 406 | Constraints.push_back(ConstraintsData.back()); |
| 407 | } |
| 408 | |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 409 | S->initialize(Record.getContext(), AsmStr, AsmToks, |
John McCall | f413f5e | 2013-05-03 00:10:13 +0000 | [diff] [blame] | 410 | Constraints, Exprs, Clobbers); |
Chad Rosier | 3250302 | 2012-06-11 20:47:18 +0000 | [diff] [blame] | 411 | } |
| 412 | |
Richard Smith | 9f690bd | 2015-10-27 06:02:45 +0000 | [diff] [blame] | 413 | void ASTStmtReader::VisitCoroutineBodyStmt(CoroutineBodyStmt *S) { |
Gor Nishanov | f5ecb5e | 2017-07-25 18:01:49 +0000 | [diff] [blame] | 414 | VisitStmt(S); |
| 415 | assert(Record.peekInt() == S->NumParams); |
| 416 | Record.skipInts(1); |
| 417 | auto *StoredStmts = S->getStoredStmts(); |
| 418 | for (unsigned i = 0; |
| 419 | i < CoroutineBodyStmt::SubStmt::FirstParamMove + S->NumParams; ++i) |
| 420 | StoredStmts[i] = Record.readSubStmt(); |
Richard Smith | 9f690bd | 2015-10-27 06:02:45 +0000 | [diff] [blame] | 421 | } |
| 422 | |
| 423 | void ASTStmtReader::VisitCoreturnStmt(CoreturnStmt *S) { |
Gor Nishanov | f5ecb5e | 2017-07-25 18:01:49 +0000 | [diff] [blame] | 424 | VisitStmt(S); |
| 425 | S->CoreturnLoc = Record.readSourceLocation(); |
| 426 | for (auto &SubStmt: S->SubStmts) |
| 427 | SubStmt = Record.readSubStmt(); |
| 428 | S->IsImplicit = Record.readInt() != 0; |
Richard Smith | 9f690bd | 2015-10-27 06:02:45 +0000 | [diff] [blame] | 429 | } |
| 430 | |
Gor Nishanov | f5ecb5e | 2017-07-25 18:01:49 +0000 | [diff] [blame] | 431 | void ASTStmtReader::VisitCoawaitExpr(CoawaitExpr *E) { |
| 432 | VisitExpr(E); |
| 433 | E->KeywordLoc = ReadSourceLocation(); |
| 434 | for (auto &SubExpr: E->SubExprs) |
| 435 | SubExpr = Record.readSubStmt(); |
| 436 | E->OpaqueValue = cast_or_null<OpaqueValueExpr>(Record.readSubStmt()); |
| 437 | E->setIsImplicit(Record.readInt() != 0); |
Richard Smith | 9f690bd | 2015-10-27 06:02:45 +0000 | [diff] [blame] | 438 | } |
| 439 | |
Gor Nishanov | f5ecb5e | 2017-07-25 18:01:49 +0000 | [diff] [blame] | 440 | void ASTStmtReader::VisitCoyieldExpr(CoyieldExpr *E) { |
| 441 | VisitExpr(E); |
| 442 | E->KeywordLoc = ReadSourceLocation(); |
| 443 | for (auto &SubExpr: E->SubExprs) |
| 444 | SubExpr = Record.readSubStmt(); |
| 445 | E->OpaqueValue = cast_or_null<OpaqueValueExpr>(Record.readSubStmt()); |
Eric Fiselier | 20f25cb | 2017-03-06 23:38:15 +0000 | [diff] [blame] | 446 | } |
| 447 | |
Gor Nishanov | f5ecb5e | 2017-07-25 18:01:49 +0000 | [diff] [blame] | 448 | void ASTStmtReader::VisitDependentCoawaitExpr(DependentCoawaitExpr *E) { |
| 449 | VisitExpr(E); |
| 450 | E->KeywordLoc = ReadSourceLocation(); |
| 451 | for (auto &SubExpr: E->SubExprs) |
| 452 | SubExpr = Record.readSubStmt(); |
Richard Smith | 9f690bd | 2015-10-27 06:02:45 +0000 | [diff] [blame] | 453 | } |
| 454 | |
Tareq A. Siraj | 24110cc | 2013-04-16 18:53:08 +0000 | [diff] [blame] | 455 | void ASTStmtReader::VisitCapturedStmt(CapturedStmt *S) { |
Ben Langmuir | ce914fc | 2013-05-03 19:20:19 +0000 | [diff] [blame] | 456 | VisitStmt(S); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 457 | Record.skipInts(1); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 458 | S->setCapturedDecl(ReadDeclAs<CapturedDecl>()); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 459 | S->setCapturedRegionKind(static_cast<CapturedRegionKind>(Record.readInt())); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 460 | S->setCapturedRecordDecl(ReadDeclAs<RecordDecl>()); |
Ben Langmuir | ce914fc | 2013-05-03 19:20:19 +0000 | [diff] [blame] | 461 | |
| 462 | // Capture inits |
| 463 | for (CapturedStmt::capture_init_iterator I = S->capture_init_begin(), |
| 464 | E = S->capture_init_end(); |
| 465 | I != E; ++I) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 466 | *I = Record.readSubExpr(); |
Ben Langmuir | ce914fc | 2013-05-03 19:20:19 +0000 | [diff] [blame] | 467 | |
| 468 | // Body |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 469 | S->setCapturedStmt(Record.readSubStmt()); |
Wei Pan | 17fbf6e | 2013-05-04 03:59:06 +0000 | [diff] [blame] | 470 | S->getCapturedDecl()->setBody(S->getCapturedStmt()); |
Ben Langmuir | ce914fc | 2013-05-03 19:20:19 +0000 | [diff] [blame] | 471 | |
| 472 | // Captures |
Aaron Ballman | c656303a | 2014-03-14 18:08:33 +0000 | [diff] [blame] | 473 | for (auto &I : S->captures()) { |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 474 | I.VarAndKind.setPointer(ReadDeclAs<VarDecl>()); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 475 | I.VarAndKind.setInt( |
| 476 | static_cast<CapturedStmt::VariableCaptureKind>(Record.readInt())); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 477 | I.Loc = ReadSourceLocation(); |
Ben Langmuir | ce914fc | 2013-05-03 19:20:19 +0000 | [diff] [blame] | 478 | } |
Tareq A. Siraj | 24110cc | 2013-04-16 18:53:08 +0000 | [diff] [blame] | 479 | } |
| 480 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 481 | void ASTStmtReader::VisitExpr(Expr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 482 | VisitStmt(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 483 | E->setType(Record.readType()); |
| 484 | E->setTypeDependent(Record.readInt()); |
| 485 | E->setValueDependent(Record.readInt()); |
| 486 | E->setInstantiationDependent(Record.readInt()); |
| 487 | E->ExprBits.ContainsUnexpandedParameterPack = Record.readInt(); |
| 488 | E->setValueKind(static_cast<ExprValueKind>(Record.readInt())); |
| 489 | E->setObjectKind(static_cast<ExprObjectKind>(Record.readInt())); |
| 490 | assert(Record.getIdx() == NumExprFields && |
| 491 | "Incorrect expression field count"); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 492 | } |
| 493 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 494 | void ASTStmtReader::VisitPredefinedExpr(PredefinedExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 495 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 496 | E->setLocation(ReadSourceLocation()); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 497 | E->Type = (PredefinedExpr::IdentType)Record.readInt(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 498 | E->FnName = cast_or_null<StringLiteral>(Record.readSubExpr()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 499 | } |
| 500 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 501 | void ASTStmtReader::VisitDeclRefExpr(DeclRefExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 502 | VisitExpr(E); |
Argyrios Kyrtzidis | 1985bb3 | 2010-07-08 13:09:47 +0000 | [diff] [blame] | 503 | |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 504 | E->DeclRefExprBits.HasQualifier = Record.readInt(); |
| 505 | E->DeclRefExprBits.HasFoundDecl = Record.readInt(); |
| 506 | E->DeclRefExprBits.HasTemplateKWAndArgsInfo = Record.readInt(); |
| 507 | E->DeclRefExprBits.HadMultipleCandidates = Record.readInt(); |
| 508 | E->DeclRefExprBits.RefersToEnclosingVariableOrCapture = Record.readInt(); |
Anders Carlsson | 80756f6 | 2011-03-06 18:19:42 +0000 | [diff] [blame] | 509 | unsigned NumTemplateArgs = 0; |
Abramo Bagnara | 7945c98 | 2012-01-27 09:46:47 +0000 | [diff] [blame] | 510 | if (E->hasTemplateKWAndArgsInfo()) |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 511 | NumTemplateArgs = Record.readInt(); |
Anders Carlsson | 80756f6 | 2011-03-06 18:19:42 +0000 | [diff] [blame] | 512 | |
Chandler Carruth | 0e43996 | 2011-05-01 21:29:53 +0000 | [diff] [blame] | 513 | if (E->hasQualifier()) |
James Y Knight | e7d8228 | 2015-12-29 18:15:14 +0000 | [diff] [blame] | 514 | new (E->getTrailingObjects<NestedNameSpecifierLoc>()) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 515 | NestedNameSpecifierLoc(Record.readNestedNameSpecifierLoc()); |
Argyrios Kyrtzidis | 1985bb3 | 2010-07-08 13:09:47 +0000 | [diff] [blame] | 516 | |
Chandler Carruth | 8d26bb0 | 2011-05-01 23:48:14 +0000 | [diff] [blame] | 517 | if (E->hasFoundDecl()) |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 518 | *E->getTrailingObjects<NamedDecl *>() = ReadDeclAs<NamedDecl>(); |
Chandler Carruth | 8d26bb0 | 2011-05-01 23:48:14 +0000 | [diff] [blame] | 519 | |
Abramo Bagnara | 7945c98 | 2012-01-27 09:46:47 +0000 | [diff] [blame] | 520 | if (E->hasTemplateKWAndArgsInfo()) |
James Y Knight | e7d8228 | 2015-12-29 18:15:14 +0000 | [diff] [blame] | 521 | ReadTemplateKWAndArgsInfo( |
| 522 | *E->getTrailingObjects<ASTTemplateKWAndArgsInfo>(), |
| 523 | E->getTrailingObjects<TemplateArgumentLoc>(), NumTemplateArgs); |
Argyrios Kyrtzidis | 1985bb3 | 2010-07-08 13:09:47 +0000 | [diff] [blame] | 524 | |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 525 | E->setDecl(ReadDeclAs<ValueDecl>()); |
| 526 | E->setLocation(ReadSourceLocation()); |
| 527 | ReadDeclarationNameLoc(E->DNLoc, E->getDecl()->getDeclName()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 528 | } |
| 529 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 530 | void ASTStmtReader::VisitIntegerLiteral(IntegerLiteral *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 531 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 532 | E->setLocation(ReadSourceLocation()); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 533 | E->setValue(Record.getContext(), Record.readAPInt()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 534 | } |
| 535 | |
Leonard Chan | db01c3a | 2018-06-20 17:19:40 +0000 | [diff] [blame] | 536 | void ASTStmtReader::VisitFixedPointLiteral(FixedPointLiteral *E) { |
| 537 | VisitExpr(E); |
| 538 | E->setLocation(ReadSourceLocation()); |
| 539 | E->setValue(Record.getContext(), Record.readAPInt()); |
| 540 | } |
| 541 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 542 | void ASTStmtReader::VisitFloatingLiteral(FloatingLiteral *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 543 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 544 | E->setRawSemantics(static_cast<Stmt::APFloatSemantics>(Record.readInt())); |
| 545 | E->setExact(Record.readInt()); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 546 | E->setValue(Record.getContext(), Record.readAPFloat(E->getSemantics())); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 547 | E->setLocation(ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 548 | } |
| 549 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 550 | void ASTStmtReader::VisitImaginaryLiteral(ImaginaryLiteral *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 551 | VisitExpr(E); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 552 | E->setSubExpr(Record.readSubExpr()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 553 | } |
| 554 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 555 | void ASTStmtReader::VisitStringLiteral(StringLiteral *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 556 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 557 | unsigned Len = Record.readInt(); |
| 558 | assert(Record.peekInt() == E->getNumConcatenated() && |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 559 | "Wrong number of concatenated tokens!"); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 560 | Record.skipInts(1); |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 561 | auto kind = static_cast<StringLiteral::StringKind>(Record.readInt()); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 562 | bool isPascal = Record.readInt(); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 563 | |
Mike Stump | 11289f4 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 564 | // Read string data |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 565 | auto B = &Record.peekInt(); |
| 566 | SmallString<16> Str(B, B + Len); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 567 | E->setString(Record.getContext(), Str, kind, isPascal); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 568 | Record.skipInts(Len); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 569 | |
| 570 | // Read source locations |
| 571 | for (unsigned I = 0, N = E->getNumConcatenated(); I != N; ++I) |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 572 | E->setStrTokenLoc(I, ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 573 | } |
| 574 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 575 | void ASTStmtReader::VisitCharacterLiteral(CharacterLiteral *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 576 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 577 | E->setValue(Record.readInt()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 578 | E->setLocation(ReadSourceLocation()); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 579 | E->setKind(static_cast<CharacterLiteral::CharacterKind>(Record.readInt())); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 580 | } |
| 581 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 582 | void ASTStmtReader::VisitParenExpr(ParenExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 583 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 584 | E->setLParen(ReadSourceLocation()); |
| 585 | E->setRParen(ReadSourceLocation()); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 586 | E->setSubExpr(Record.readSubExpr()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 587 | } |
| 588 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 589 | void ASTStmtReader::VisitParenListExpr(ParenListExpr *E) { |
Argyrios Kyrtzidis | f9f47c8 | 2010-06-30 08:49:18 +0000 | [diff] [blame] | 590 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 591 | unsigned NumExprs = Record.readInt(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 592 | E->Exprs = new (Record.getContext()) Stmt*[NumExprs]; |
Argyrios Kyrtzidis | f9f47c8 | 2010-06-30 08:49:18 +0000 | [diff] [blame] | 593 | for (unsigned i = 0; i != NumExprs; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 594 | E->Exprs[i] = Record.readSubStmt(); |
Argyrios Kyrtzidis | f9f47c8 | 2010-06-30 08:49:18 +0000 | [diff] [blame] | 595 | E->NumExprs = NumExprs; |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 596 | E->LParenLoc = ReadSourceLocation(); |
| 597 | E->RParenLoc = ReadSourceLocation(); |
Argyrios Kyrtzidis | f9f47c8 | 2010-06-30 08:49:18 +0000 | [diff] [blame] | 598 | } |
| 599 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 600 | void ASTStmtReader::VisitUnaryOperator(UnaryOperator *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 601 | VisitExpr(E); |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 602 | E->setSubExpr(Record.readSubExpr()); |
| 603 | E->setOpcode((UnaryOperator::Opcode)Record.readInt()); |
| 604 | E->setOperatorLoc(ReadSourceLocation()); |
| 605 | E->setCanOverflow(Record.readInt()); |
| 606 | } |
| 607 | |
| 608 | void ASTStmtReader::VisitOffsetOfExpr(OffsetOfExpr *E) { |
Douglas Gregor | 882211c | 2010-04-28 22:16:22 +0000 | [diff] [blame] | 609 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 610 | assert(E->getNumComponents() == Record.peekInt()); |
| 611 | Record.skipInts(1); |
| 612 | assert(E->getNumExpressions() == Record.peekInt()); |
| 613 | Record.skipInts(1); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 614 | E->setOperatorLoc(ReadSourceLocation()); |
| 615 | E->setRParenLoc(ReadSourceLocation()); |
| 616 | E->setTypeSourceInfo(GetTypeSourceInfo()); |
Douglas Gregor | 882211c | 2010-04-28 22:16:22 +0000 | [diff] [blame] | 617 | for (unsigned I = 0, N = E->getNumComponents(); I != N; ++I) { |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 618 | auto Kind = static_cast<OffsetOfNode::Kind>(Record.readInt()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 619 | SourceLocation Start = ReadSourceLocation(); |
| 620 | SourceLocation End = ReadSourceLocation(); |
Douglas Gregor | 882211c | 2010-04-28 22:16:22 +0000 | [diff] [blame] | 621 | switch (Kind) { |
James Y Knight | 7281c35 | 2015-12-29 22:31:18 +0000 | [diff] [blame] | 622 | case OffsetOfNode::Array: |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 623 | E->setComponent(I, OffsetOfNode(Start, Record.readInt(), End)); |
Douglas Gregor | 882211c | 2010-04-28 22:16:22 +0000 | [diff] [blame] | 624 | break; |
| 625 | |
James Y Knight | 7281c35 | 2015-12-29 22:31:18 +0000 | [diff] [blame] | 626 | case OffsetOfNode::Field: |
| 627 | E->setComponent( |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 628 | I, OffsetOfNode(Start, ReadDeclAs<FieldDecl>(), End)); |
Douglas Gregor | 882211c | 2010-04-28 22:16:22 +0000 | [diff] [blame] | 629 | break; |
James Y Knight | 7281c35 | 2015-12-29 22:31:18 +0000 | [diff] [blame] | 630 | |
| 631 | case OffsetOfNode::Identifier: |
| 632 | E->setComponent( |
| 633 | I, |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 634 | OffsetOfNode(Start, Record.getIdentifierInfo(), End)); |
James Y Knight | 7281c35 | 2015-12-29 22:31:18 +0000 | [diff] [blame] | 635 | break; |
| 636 | |
| 637 | case OffsetOfNode::Base: { |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 638 | auto *Base = new (Record.getContext()) CXXBaseSpecifier(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 639 | *Base = Record.readCXXBaseSpecifier(); |
James Y Knight | 7281c35 | 2015-12-29 22:31:18 +0000 | [diff] [blame] | 640 | E->setComponent(I, OffsetOfNode(Base)); |
Douglas Gregor | d170206 | 2010-04-29 00:18:15 +0000 | [diff] [blame] | 641 | break; |
Douglas Gregor | 882211c | 2010-04-28 22:16:22 +0000 | [diff] [blame] | 642 | } |
Argyrios Kyrtzidis | d67d4cc | 2010-07-29 18:16:10 +0000 | [diff] [blame] | 643 | } |
Douglas Gregor | 882211c | 2010-04-28 22:16:22 +0000 | [diff] [blame] | 644 | } |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 645 | |
Douglas Gregor | 882211c | 2010-04-28 22:16:22 +0000 | [diff] [blame] | 646 | for (unsigned I = 0, N = E->getNumExpressions(); I != N; ++I) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 647 | E->setIndexExpr(I, Record.readSubExpr()); |
Douglas Gregor | 882211c | 2010-04-28 22:16:22 +0000 | [diff] [blame] | 648 | } |
| 649 | |
Peter Collingbourne | e190dee | 2011-03-11 19:24:49 +0000 | [diff] [blame] | 650 | void ASTStmtReader::VisitUnaryExprOrTypeTraitExpr(UnaryExprOrTypeTraitExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 651 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 652 | E->setKind(static_cast<UnaryExprOrTypeTrait>(Record.readInt())); |
| 653 | if (Record.peekInt() == 0) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 654 | E->setArgument(Record.readSubExpr()); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 655 | Record.skipInts(1); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 656 | } else { |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 657 | E->setArgument(GetTypeSourceInfo()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 658 | } |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 659 | E->setOperatorLoc(ReadSourceLocation()); |
| 660 | E->setRParenLoc(ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 661 | } |
| 662 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 663 | void ASTStmtReader::VisitArraySubscriptExpr(ArraySubscriptExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 664 | VisitExpr(E); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 665 | E->setLHS(Record.readSubExpr()); |
| 666 | E->setRHS(Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 667 | E->setRBracketLoc(ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 668 | } |
| 669 | |
Alexey Bataev | 1a3320e | 2015-08-25 14:24:04 +0000 | [diff] [blame] | 670 | void ASTStmtReader::VisitOMPArraySectionExpr(OMPArraySectionExpr *E) { |
| 671 | VisitExpr(E); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 672 | E->setBase(Record.readSubExpr()); |
| 673 | E->setLowerBound(Record.readSubExpr()); |
| 674 | E->setLength(Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 675 | E->setColonLoc(ReadSourceLocation()); |
| 676 | E->setRBracketLoc(ReadSourceLocation()); |
Alexey Bataev | 1a3320e | 2015-08-25 14:24:04 +0000 | [diff] [blame] | 677 | } |
| 678 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 679 | void ASTStmtReader::VisitCallExpr(CallExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 680 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 681 | E->setNumArgs(Record.getContext(), Record.readInt()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 682 | E->setRParenLoc(ReadSourceLocation()); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 683 | E->setCallee(Record.readSubExpr()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 684 | for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 685 | E->setArg(I, Record.readSubExpr()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 686 | } |
| 687 | |
John McCall | fa19404 | 2011-07-15 07:00:14 +0000 | [diff] [blame] | 688 | void ASTStmtReader::VisitCXXMemberCallExpr(CXXMemberCallExpr *E) { |
| 689 | VisitCallExpr(E); |
| 690 | } |
| 691 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 692 | void ASTStmtReader::VisitMemberExpr(MemberExpr *E) { |
Argyrios Kyrtzidis | 1985bb3 | 2010-07-08 13:09:47 +0000 | [diff] [blame] | 693 | // Don't call VisitExpr, this is fully initialized at creation. |
| 694 | assert(E->getStmtClass() == Stmt::MemberExprClass && |
| 695 | "It's a subclass, we must advance Idx!"); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 696 | } |
| 697 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 698 | void ASTStmtReader::VisitObjCIsaExpr(ObjCIsaExpr *E) { |
Steve Naroff | e87026a | 2009-07-24 17:54:45 +0000 | [diff] [blame] | 699 | VisitExpr(E); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 700 | E->setBase(Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 701 | E->setIsaMemberLoc(ReadSourceLocation()); |
| 702 | E->setOpLoc(ReadSourceLocation()); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 703 | E->setArrow(Record.readInt()); |
Steve Naroff | e87026a | 2009-07-24 17:54:45 +0000 | [diff] [blame] | 704 | } |
| 705 | |
John McCall | 31168b0 | 2011-06-15 23:02:42 +0000 | [diff] [blame] | 706 | void ASTStmtReader:: |
| 707 | VisitObjCIndirectCopyRestoreExpr(ObjCIndirectCopyRestoreExpr *E) { |
| 708 | VisitExpr(E); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 709 | E->Operand = Record.readSubExpr(); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 710 | E->setShouldCopy(Record.readInt()); |
John McCall | 31168b0 | 2011-06-15 23:02:42 +0000 | [diff] [blame] | 711 | } |
| 712 | |
| 713 | void ASTStmtReader::VisitObjCBridgedCastExpr(ObjCBridgedCastExpr *E) { |
| 714 | VisitExplicitCastExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 715 | E->LParenLoc = ReadSourceLocation(); |
| 716 | E->BridgeKeywordLoc = ReadSourceLocation(); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 717 | E->Kind = Record.readInt(); |
John McCall | 31168b0 | 2011-06-15 23:02:42 +0000 | [diff] [blame] | 718 | } |
| 719 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 720 | void ASTStmtReader::VisitCastExpr(CastExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 721 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 722 | unsigned NumBaseSpecs = Record.readInt(); |
John McCall | cf14216 | 2010-08-07 06:22:56 +0000 | [diff] [blame] | 723 | assert(NumBaseSpecs == E->path_size()); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 724 | E->setSubExpr(Record.readSubExpr()); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 725 | E->setCastKind((CastKind)Record.readInt()); |
John McCall | cf14216 | 2010-08-07 06:22:56 +0000 | [diff] [blame] | 726 | CastExpr::path_iterator BaseI = E->path_begin(); |
Argyrios Kyrtzidis | 3701fcd | 2010-07-02 23:30:27 +0000 | [diff] [blame] | 727 | while (NumBaseSpecs--) { |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 728 | auto *BaseSpec = new (Record.getContext()) CXXBaseSpecifier; |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 729 | *BaseSpec = Record.readCXXBaseSpecifier(); |
John McCall | cf14216 | 2010-08-07 06:22:56 +0000 | [diff] [blame] | 730 | *BaseI++ = BaseSpec; |
Argyrios Kyrtzidis | 3701fcd | 2010-07-02 23:30:27 +0000 | [diff] [blame] | 731 | } |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 732 | } |
| 733 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 734 | void ASTStmtReader::VisitBinaryOperator(BinaryOperator *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 735 | VisitExpr(E); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 736 | E->setLHS(Record.readSubExpr()); |
| 737 | E->setRHS(Record.readSubExpr()); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 738 | E->setOpcode((BinaryOperator::Opcode)Record.readInt()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 739 | E->setOperatorLoc(ReadSourceLocation()); |
Adam Nemet | 484aa45 | 2017-03-27 19:17:25 +0000 | [diff] [blame] | 740 | E->setFPFeatures(FPOptions(Record.readInt())); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 741 | } |
| 742 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 743 | void ASTStmtReader::VisitCompoundAssignOperator(CompoundAssignOperator *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 744 | VisitBinaryOperator(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 745 | E->setComputationLHSType(Record.readType()); |
| 746 | E->setComputationResultType(Record.readType()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 747 | } |
| 748 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 749 | void ASTStmtReader::VisitConditionalOperator(ConditionalOperator *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 750 | VisitExpr(E); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 751 | E->SubExprs[ConditionalOperator::COND] = Record.readSubExpr(); |
| 752 | E->SubExprs[ConditionalOperator::LHS] = Record.readSubExpr(); |
| 753 | E->SubExprs[ConditionalOperator::RHS] = Record.readSubExpr(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 754 | E->QuestionLoc = ReadSourceLocation(); |
| 755 | E->ColonLoc = ReadSourceLocation(); |
John McCall | c07a0c7 | 2011-02-17 10:25:35 +0000 | [diff] [blame] | 756 | } |
| 757 | |
| 758 | void |
| 759 | ASTStmtReader::VisitBinaryConditionalOperator(BinaryConditionalOperator *E) { |
| 760 | VisitExpr(E); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 761 | E->OpaqueValue = cast<OpaqueValueExpr>(Record.readSubExpr()); |
| 762 | E->SubExprs[BinaryConditionalOperator::COMMON] = Record.readSubExpr(); |
| 763 | E->SubExprs[BinaryConditionalOperator::COND] = Record.readSubExpr(); |
| 764 | E->SubExprs[BinaryConditionalOperator::LHS] = Record.readSubExpr(); |
| 765 | E->SubExprs[BinaryConditionalOperator::RHS] = Record.readSubExpr(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 766 | E->QuestionLoc = ReadSourceLocation(); |
| 767 | E->ColonLoc = ReadSourceLocation(); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 768 | } |
| 769 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 770 | void ASTStmtReader::VisitImplicitCastExpr(ImplicitCastExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 771 | VisitCastExpr(E); |
Roman Lebedev | 12216f1 | 2018-07-27 07:27:14 +0000 | [diff] [blame^] | 772 | E->setIsPartOfExplicitCast(Record.readInt()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 773 | } |
| 774 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 775 | void ASTStmtReader::VisitExplicitCastExpr(ExplicitCastExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 776 | VisitCastExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 777 | E->setTypeInfoAsWritten(GetTypeSourceInfo()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 778 | } |
| 779 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 780 | void ASTStmtReader::VisitCStyleCastExpr(CStyleCastExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 781 | VisitExplicitCastExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 782 | E->setLParenLoc(ReadSourceLocation()); |
| 783 | E->setRParenLoc(ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 784 | } |
| 785 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 786 | void ASTStmtReader::VisitCompoundLiteralExpr(CompoundLiteralExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 787 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 788 | E->setLParenLoc(ReadSourceLocation()); |
| 789 | E->setTypeSourceInfo(GetTypeSourceInfo()); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 790 | E->setInitializer(Record.readSubExpr()); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 791 | E->setFileScope(Record.readInt()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 792 | } |
| 793 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 794 | void ASTStmtReader::VisitExtVectorElementExpr(ExtVectorElementExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 795 | VisitExpr(E); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 796 | E->setBase(Record.readSubExpr()); |
| 797 | E->setAccessor(Record.getIdentifierInfo()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 798 | E->setAccessorLoc(ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 799 | } |
| 800 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 801 | void ASTStmtReader::VisitInitListExpr(InitListExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 802 | VisitExpr(E); |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 803 | if (auto *SyntForm = cast_or_null<InitListExpr>(Record.readSubStmt())) |
Abramo Bagnara | 8d16bd4 | 2012-11-08 18:41:43 +0000 | [diff] [blame] | 804 | E->setSyntacticForm(SyntForm); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 805 | E->setLBraceLoc(ReadSourceLocation()); |
| 806 | E->setRBraceLoc(ReadSourceLocation()); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 807 | bool isArrayFiller = Record.readInt(); |
Craig Topper | a13603a | 2014-05-22 05:54:18 +0000 | [diff] [blame] | 808 | Expr *filler = nullptr; |
Argyrios Kyrtzidis | bbcefa7 | 2011-04-22 05:29:30 +0000 | [diff] [blame] | 809 | if (isArrayFiller) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 810 | filler = Record.readSubExpr(); |
Argyrios Kyrtzidis | bbcefa7 | 2011-04-22 05:29:30 +0000 | [diff] [blame] | 811 | E->ArrayFillerOrUnionFieldInit = filler; |
| 812 | } else |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 813 | E->ArrayFillerOrUnionFieldInit = ReadDeclAs<FieldDecl>(); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 814 | E->sawArrayRangeDesignator(Record.readInt()); |
| 815 | unsigned NumInits = Record.readInt(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 816 | E->reserveInits(Record.getContext(), NumInits); |
Argyrios Kyrtzidis | bbcefa7 | 2011-04-22 05:29:30 +0000 | [diff] [blame] | 817 | if (isArrayFiller) { |
| 818 | for (unsigned I = 0; I != NumInits; ++I) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 819 | Expr *init = Record.readSubExpr(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 820 | E->updateInit(Record.getContext(), I, init ? init : filler); |
Argyrios Kyrtzidis | bbcefa7 | 2011-04-22 05:29:30 +0000 | [diff] [blame] | 821 | } |
| 822 | } else { |
| 823 | for (unsigned I = 0; I != NumInits; ++I) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 824 | E->updateInit(Record.getContext(), I, Record.readSubExpr()); |
Argyrios Kyrtzidis | bbcefa7 | 2011-04-22 05:29:30 +0000 | [diff] [blame] | 825 | } |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 826 | } |
| 827 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 828 | void ASTStmtReader::VisitDesignatedInitExpr(DesignatedInitExpr *E) { |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 829 | using Designator = DesignatedInitExpr::Designator; |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 830 | |
| 831 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 832 | unsigned NumSubExprs = Record.readInt(); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 833 | assert(NumSubExprs == E->getNumSubExprs() && "Wrong number of subexprs"); |
| 834 | for (unsigned I = 0; I != NumSubExprs; ++I) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 835 | E->setSubExpr(I, Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 836 | E->setEqualOrColonLoc(ReadSourceLocation()); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 837 | E->setGNUSyntax(Record.readInt()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 838 | |
Chris Lattner | 0e62c1c | 2011-07-23 10:55:15 +0000 | [diff] [blame] | 839 | SmallVector<Designator, 4> Designators; |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 840 | while (Record.getIdx() < Record.size()) { |
| 841 | switch ((DesignatorTypes)Record.readInt()) { |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 842 | case DESIG_FIELD_DECL: { |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 843 | auto *Field = ReadDeclAs<FieldDecl>(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 844 | SourceLocation DotLoc = ReadSourceLocation(); |
| 845 | SourceLocation FieldLoc = ReadSourceLocation(); |
Mike Stump | 11289f4 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 846 | Designators.push_back(Designator(Field->getIdentifier(), DotLoc, |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 847 | FieldLoc)); |
| 848 | Designators.back().setField(Field); |
| 849 | break; |
| 850 | } |
| 851 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 852 | case DESIG_FIELD_NAME: { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 853 | const IdentifierInfo *Name = Record.getIdentifierInfo(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 854 | SourceLocation DotLoc = ReadSourceLocation(); |
| 855 | SourceLocation FieldLoc = ReadSourceLocation(); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 856 | Designators.push_back(Designator(Name, DotLoc, FieldLoc)); |
| 857 | break; |
| 858 | } |
Mike Stump | 11289f4 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 859 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 860 | case DESIG_ARRAY: { |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 861 | unsigned Index = Record.readInt(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 862 | SourceLocation LBracketLoc = ReadSourceLocation(); |
| 863 | SourceLocation RBracketLoc = ReadSourceLocation(); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 864 | Designators.push_back(Designator(Index, LBracketLoc, RBracketLoc)); |
| 865 | break; |
| 866 | } |
| 867 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 868 | case DESIG_ARRAY_RANGE: { |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 869 | unsigned Index = Record.readInt(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 870 | SourceLocation LBracketLoc = ReadSourceLocation(); |
| 871 | SourceLocation EllipsisLoc = ReadSourceLocation(); |
| 872 | SourceLocation RBracketLoc = ReadSourceLocation(); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 873 | Designators.push_back(Designator(Index, LBracketLoc, EllipsisLoc, |
| 874 | RBracketLoc)); |
| 875 | break; |
| 876 | } |
| 877 | } |
| 878 | } |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 879 | E->setDesignators(Record.getContext(), |
Douglas Gregor | 03e8bdc | 2010-01-06 23:17:19 +0000 | [diff] [blame] | 880 | Designators.data(), Designators.size()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 881 | } |
| 882 | |
Yunzhong Gao | cb77930 | 2015-06-10 00:27:52 +0000 | [diff] [blame] | 883 | void ASTStmtReader::VisitDesignatedInitUpdateExpr(DesignatedInitUpdateExpr *E) { |
| 884 | VisitExpr(E); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 885 | E->setBase(Record.readSubExpr()); |
| 886 | E->setUpdater(Record.readSubExpr()); |
Yunzhong Gao | cb77930 | 2015-06-10 00:27:52 +0000 | [diff] [blame] | 887 | } |
| 888 | |
| 889 | void ASTStmtReader::VisitNoInitExpr(NoInitExpr *E) { |
| 890 | VisitExpr(E); |
| 891 | } |
| 892 | |
Richard Smith | 410306b | 2016-12-12 02:53:20 +0000 | [diff] [blame] | 893 | void ASTStmtReader::VisitArrayInitLoopExpr(ArrayInitLoopExpr *E) { |
| 894 | VisitExpr(E); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 895 | E->SubExprs[0] = Record.readSubExpr(); |
| 896 | E->SubExprs[1] = Record.readSubExpr(); |
Richard Smith | 410306b | 2016-12-12 02:53:20 +0000 | [diff] [blame] | 897 | } |
| 898 | |
| 899 | void ASTStmtReader::VisitArrayInitIndexExpr(ArrayInitIndexExpr *E) { |
| 900 | VisitExpr(E); |
| 901 | } |
| 902 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 903 | void ASTStmtReader::VisitImplicitValueInitExpr(ImplicitValueInitExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 904 | VisitExpr(E); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 905 | } |
| 906 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 907 | void ASTStmtReader::VisitVAArgExpr(VAArgExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 908 | VisitExpr(E); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 909 | E->setSubExpr(Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 910 | E->setWrittenTypeInfo(GetTypeSourceInfo()); |
| 911 | E->setBuiltinLoc(ReadSourceLocation()); |
| 912 | E->setRParenLoc(ReadSourceLocation()); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 913 | E->setIsMicrosoftABI(Record.readInt()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 914 | } |
| 915 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 916 | void ASTStmtReader::VisitAddrLabelExpr(AddrLabelExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 917 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 918 | E->setAmpAmpLoc(ReadSourceLocation()); |
| 919 | E->setLabelLoc(ReadSourceLocation()); |
| 920 | E->setLabel(ReadDeclAs<LabelDecl>()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 921 | } |
| 922 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 923 | void ASTStmtReader::VisitStmtExpr(StmtExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 924 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 925 | E->setLParenLoc(ReadSourceLocation()); |
| 926 | E->setRParenLoc(ReadSourceLocation()); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 927 | E->setSubStmt(cast_or_null<CompoundStmt>(Record.readSubStmt())); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 928 | } |
| 929 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 930 | void ASTStmtReader::VisitChooseExpr(ChooseExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 931 | VisitExpr(E); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 932 | E->setCond(Record.readSubExpr()); |
| 933 | E->setLHS(Record.readSubExpr()); |
| 934 | E->setRHS(Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 935 | E->setBuiltinLoc(ReadSourceLocation()); |
| 936 | E->setRParenLoc(ReadSourceLocation()); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 937 | E->setIsConditionTrue(Record.readInt()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 938 | } |
| 939 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 940 | void ASTStmtReader::VisitGNUNullExpr(GNUNullExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 941 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 942 | E->setTokenLocation(ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 943 | } |
| 944 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 945 | void ASTStmtReader::VisitShuffleVectorExpr(ShuffleVectorExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 946 | VisitExpr(E); |
Chris Lattner | 0e62c1c | 2011-07-23 10:55:15 +0000 | [diff] [blame] | 947 | SmallVector<Expr *, 16> Exprs; |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 948 | unsigned NumExprs = Record.readInt(); |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 949 | while (NumExprs--) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 950 | Exprs.push_back(Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 951 | E->setExprs(Record.getContext(), Exprs); |
| 952 | E->setBuiltinLoc(ReadSourceLocation()); |
| 953 | E->setRParenLoc(ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 954 | } |
| 955 | |
Hal Finkel | c4d7c82 | 2013-09-18 03:29:45 +0000 | [diff] [blame] | 956 | void ASTStmtReader::VisitConvertVectorExpr(ConvertVectorExpr *E) { |
| 957 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 958 | E->BuiltinLoc = ReadSourceLocation(); |
| 959 | E->RParenLoc = ReadSourceLocation(); |
| 960 | E->TInfo = GetTypeSourceInfo(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 961 | E->SrcExpr = Record.readSubExpr(); |
Hal Finkel | c4d7c82 | 2013-09-18 03:29:45 +0000 | [diff] [blame] | 962 | } |
| 963 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 964 | void ASTStmtReader::VisitBlockExpr(BlockExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 965 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 966 | E->setBlockDecl(ReadDeclAs<BlockDecl>()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 967 | } |
| 968 | |
Peter Collingbourne | 9114759 | 2011-04-15 00:35:48 +0000 | [diff] [blame] | 969 | void ASTStmtReader::VisitGenericSelectionExpr(GenericSelectionExpr *E) { |
| 970 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 971 | E->NumAssocs = Record.readInt(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 972 | E->AssocTypes = new (Record.getContext()) TypeSourceInfo*[E->NumAssocs]; |
Peter Collingbourne | 9114759 | 2011-04-15 00:35:48 +0000 | [diff] [blame] | 973 | E->SubExprs = |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 974 | new(Record.getContext()) Stmt*[GenericSelectionExpr::END_EXPR+E->NumAssocs]; |
Peter Collingbourne | 9114759 | 2011-04-15 00:35:48 +0000 | [diff] [blame] | 975 | |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 976 | E->SubExprs[GenericSelectionExpr::CONTROLLING] = Record.readSubExpr(); |
Peter Collingbourne | 9114759 | 2011-04-15 00:35:48 +0000 | [diff] [blame] | 977 | for (unsigned I = 0, N = E->getNumAssocs(); I != N; ++I) { |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 978 | E->AssocTypes[I] = GetTypeSourceInfo(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 979 | E->SubExprs[GenericSelectionExpr::END_EXPR+I] = Record.readSubExpr(); |
Peter Collingbourne | 9114759 | 2011-04-15 00:35:48 +0000 | [diff] [blame] | 980 | } |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 981 | E->ResultIndex = Record.readInt(); |
Peter Collingbourne | 9114759 | 2011-04-15 00:35:48 +0000 | [diff] [blame] | 982 | |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 983 | E->GenericLoc = ReadSourceLocation(); |
| 984 | E->DefaultLoc = ReadSourceLocation(); |
| 985 | E->RParenLoc = ReadSourceLocation(); |
Peter Collingbourne | 9114759 | 2011-04-15 00:35:48 +0000 | [diff] [blame] | 986 | } |
| 987 | |
John McCall | fe96e0b | 2011-11-06 09:01:30 +0000 | [diff] [blame] | 988 | void ASTStmtReader::VisitPseudoObjectExpr(PseudoObjectExpr *E) { |
| 989 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 990 | unsigned numSemanticExprs = Record.readInt(); |
John McCall | fe96e0b | 2011-11-06 09:01:30 +0000 | [diff] [blame] | 991 | assert(numSemanticExprs + 1 == E->PseudoObjectExprBits.NumSubExprs); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 992 | E->PseudoObjectExprBits.ResultIndex = Record.readInt(); |
John McCall | fe96e0b | 2011-11-06 09:01:30 +0000 | [diff] [blame] | 993 | |
| 994 | // Read the syntactic expression. |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 995 | E->getSubExprsBuffer()[0] = Record.readSubExpr(); |
John McCall | fe96e0b | 2011-11-06 09:01:30 +0000 | [diff] [blame] | 996 | |
| 997 | // Read all the semantic expressions. |
| 998 | for (unsigned i = 0; i != numSemanticExprs; ++i) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 999 | Expr *subExpr = Record.readSubExpr(); |
John McCall | fe96e0b | 2011-11-06 09:01:30 +0000 | [diff] [blame] | 1000 | E->getSubExprsBuffer()[i+1] = subExpr; |
| 1001 | } |
| 1002 | } |
| 1003 | |
Eli Friedman | df14b3a | 2011-10-11 02:20:01 +0000 | [diff] [blame] | 1004 | void ASTStmtReader::VisitAtomicExpr(AtomicExpr *E) { |
| 1005 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1006 | E->Op = AtomicExpr::AtomicOp(Record.readInt()); |
Richard Smith | aa22a8c | 2012-04-10 22:49:28 +0000 | [diff] [blame] | 1007 | E->NumSubExprs = AtomicExpr::getNumSubExprs(E->Op); |
| 1008 | for (unsigned I = 0; I != E->NumSubExprs; ++I) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1009 | E->SubExprs[I] = Record.readSubExpr(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1010 | E->BuiltinLoc = ReadSourceLocation(); |
| 1011 | E->RParenLoc = ReadSourceLocation(); |
Eli Friedman | df14b3a | 2011-10-11 02:20:01 +0000 | [diff] [blame] | 1012 | } |
| 1013 | |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1014 | //===----------------------------------------------------------------------===// |
| 1015 | // Objective-C Expressions and Statements |
| 1016 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1017 | void ASTStmtReader::VisitObjCStringLiteral(ObjCStringLiteral *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1018 | VisitExpr(E); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1019 | E->setString(cast<StringLiteral>(Record.readSubStmt())); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1020 | E->setAtLoc(ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1021 | } |
| 1022 | |
Patrick Beard | 0caa394 | 2012-04-19 00:25:12 +0000 | [diff] [blame] | 1023 | void ASTStmtReader::VisitObjCBoxedExpr(ObjCBoxedExpr *E) { |
Ted Kremenek | e65b086 | 2012-03-06 20:05:56 +0000 | [diff] [blame] | 1024 | VisitExpr(E); |
| 1025 | // could be one of several IntegerLiteral, FloatLiteral, etc. |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1026 | E->SubExpr = Record.readSubStmt(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1027 | E->BoxingMethod = ReadDeclAs<ObjCMethodDecl>(); |
| 1028 | E->Range = ReadSourceRange(); |
Ted Kremenek | e65b086 | 2012-03-06 20:05:56 +0000 | [diff] [blame] | 1029 | } |
| 1030 | |
| 1031 | void ASTStmtReader::VisitObjCArrayLiteral(ObjCArrayLiteral *E) { |
| 1032 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1033 | unsigned NumElements = Record.readInt(); |
Ted Kremenek | e65b086 | 2012-03-06 20:05:56 +0000 | [diff] [blame] | 1034 | assert(NumElements == E->getNumElements() && "Wrong number of elements"); |
| 1035 | Expr **Elements = E->getElements(); |
| 1036 | for (unsigned I = 0, N = NumElements; I != N; ++I) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1037 | Elements[I] = Record.readSubExpr(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1038 | E->ArrayWithObjectsMethod = ReadDeclAs<ObjCMethodDecl>(); |
| 1039 | E->Range = ReadSourceRange(); |
Ted Kremenek | e65b086 | 2012-03-06 20:05:56 +0000 | [diff] [blame] | 1040 | } |
| 1041 | |
| 1042 | void ASTStmtReader::VisitObjCDictionaryLiteral(ObjCDictionaryLiteral *E) { |
| 1043 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1044 | unsigned NumElements = Record.readInt(); |
Ted Kremenek | e65b086 | 2012-03-06 20:05:56 +0000 | [diff] [blame] | 1045 | assert(NumElements == E->getNumElements() && "Wrong number of elements"); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1046 | bool HasPackExpansions = Record.readInt(); |
Ted Kremenek | e65b086 | 2012-03-06 20:05:56 +0000 | [diff] [blame] | 1047 | assert(HasPackExpansions == E->HasPackExpansions &&"Pack expansion mismatch"); |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 1048 | auto *KeyValues = |
James Y Knight | 6c2f06b | 2015-12-31 04:43:19 +0000 | [diff] [blame] | 1049 | E->getTrailingObjects<ObjCDictionaryLiteral::KeyValuePair>(); |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 1050 | auto *Expansions = |
James Y Knight | 6c2f06b | 2015-12-31 04:43:19 +0000 | [diff] [blame] | 1051 | E->getTrailingObjects<ObjCDictionaryLiteral::ExpansionData>(); |
Ted Kremenek | e65b086 | 2012-03-06 20:05:56 +0000 | [diff] [blame] | 1052 | for (unsigned I = 0; I != NumElements; ++I) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1053 | KeyValues[I].Key = Record.readSubExpr(); |
| 1054 | KeyValues[I].Value = Record.readSubExpr(); |
Ted Kremenek | e65b086 | 2012-03-06 20:05:56 +0000 | [diff] [blame] | 1055 | if (HasPackExpansions) { |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1056 | Expansions[I].EllipsisLoc = ReadSourceLocation(); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1057 | Expansions[I].NumExpansionsPlusOne = Record.readInt(); |
Ted Kremenek | e65b086 | 2012-03-06 20:05:56 +0000 | [diff] [blame] | 1058 | } |
| 1059 | } |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1060 | E->DictWithObjectsMethod = ReadDeclAs<ObjCMethodDecl>(); |
| 1061 | E->Range = ReadSourceRange(); |
Ted Kremenek | e65b086 | 2012-03-06 20:05:56 +0000 | [diff] [blame] | 1062 | } |
| 1063 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1064 | void ASTStmtReader::VisitObjCEncodeExpr(ObjCEncodeExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1065 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1066 | E->setEncodedTypeSourceInfo(GetTypeSourceInfo()); |
| 1067 | E->setAtLoc(ReadSourceLocation()); |
| 1068 | E->setRParenLoc(ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1069 | } |
| 1070 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1071 | void ASTStmtReader::VisitObjCSelectorExpr(ObjCSelectorExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1072 | VisitExpr(E); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1073 | E->setSelector(Record.readSelector()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1074 | E->setAtLoc(ReadSourceLocation()); |
| 1075 | E->setRParenLoc(ReadSourceLocation()); |
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::VisitObjCProtocolExpr(ObjCProtocolExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1079 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1080 | E->setProtocol(ReadDeclAs<ObjCProtocolDecl>()); |
| 1081 | E->setAtLoc(ReadSourceLocation()); |
| 1082 | E->ProtoLoc = ReadSourceLocation(); |
| 1083 | E->setRParenLoc(ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1084 | } |
| 1085 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1086 | void ASTStmtReader::VisitObjCIvarRefExpr(ObjCIvarRefExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1087 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1088 | E->setDecl(ReadDeclAs<ObjCIvarDecl>()); |
| 1089 | E->setLocation(ReadSourceLocation()); |
| 1090 | E->setOpLoc(ReadSourceLocation()); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1091 | E->setBase(Record.readSubExpr()); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1092 | E->setIsArrow(Record.readInt()); |
| 1093 | E->setIsFreeIvar(Record.readInt()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1094 | } |
| 1095 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1096 | void ASTStmtReader::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1097 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1098 | unsigned MethodRefFlags = Record.readInt(); |
| 1099 | bool Implicit = Record.readInt() != 0; |
John McCall | b7bd14f | 2010-12-02 01:19:52 +0000 | [diff] [blame] | 1100 | if (Implicit) { |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 1101 | auto *Getter = ReadDeclAs<ObjCMethodDecl>(); |
| 1102 | auto *Setter = ReadDeclAs<ObjCMethodDecl>(); |
Argyrios Kyrtzidis | ab468b0 | 2012-03-30 00:19:18 +0000 | [diff] [blame] | 1103 | E->setImplicitProperty(Getter, Setter, MethodRefFlags); |
John McCall | b7bd14f | 2010-12-02 01:19:52 +0000 | [diff] [blame] | 1104 | } else { |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1105 | E->setExplicitProperty(ReadDeclAs<ObjCPropertyDecl>(), MethodRefFlags); |
Fariborz Jahanian | 681c075 | 2010-10-14 16:04:05 +0000 | [diff] [blame] | 1106 | } |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1107 | E->setLocation(ReadSourceLocation()); |
| 1108 | E->setReceiverLocation(ReadSourceLocation()); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1109 | switch (Record.readInt()) { |
John McCall | b7bd14f | 2010-12-02 01:19:52 +0000 | [diff] [blame] | 1110 | case 0: |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1111 | E->setBase(Record.readSubExpr()); |
John McCall | b7bd14f | 2010-12-02 01:19:52 +0000 | [diff] [blame] | 1112 | break; |
| 1113 | case 1: |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1114 | E->setSuperReceiver(Record.readType()); |
John McCall | b7bd14f | 2010-12-02 01:19:52 +0000 | [diff] [blame] | 1115 | break; |
| 1116 | case 2: |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1117 | E->setClassReceiver(ReadDeclAs<ObjCInterfaceDecl>()); |
John McCall | b7bd14f | 2010-12-02 01:19:52 +0000 | [diff] [blame] | 1118 | break; |
| 1119 | } |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1120 | } |
| 1121 | |
Ted Kremenek | e65b086 | 2012-03-06 20:05:56 +0000 | [diff] [blame] | 1122 | void ASTStmtReader::VisitObjCSubscriptRefExpr(ObjCSubscriptRefExpr *E) { |
| 1123 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1124 | E->setRBracket(ReadSourceLocation()); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1125 | E->setBaseExpr(Record.readSubExpr()); |
| 1126 | E->setKeyExpr(Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1127 | E->GetAtIndexMethodDecl = ReadDeclAs<ObjCMethodDecl>(); |
| 1128 | E->SetAtIndexMethodDecl = ReadDeclAs<ObjCMethodDecl>(); |
Ted Kremenek | e65b086 | 2012-03-06 20:05:56 +0000 | [diff] [blame] | 1129 | } |
| 1130 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1131 | void ASTStmtReader::VisitObjCMessageExpr(ObjCMessageExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1132 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1133 | assert(Record.peekInt() == E->getNumArgs()); |
| 1134 | Record.skipInts(1); |
| 1135 | unsigned NumStoredSelLocs = Record.readInt(); |
| 1136 | E->SelLocsKind = Record.readInt(); |
| 1137 | E->setDelegateInitCall(Record.readInt()); |
| 1138 | E->IsImplicit = Record.readInt(); |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 1139 | auto Kind = static_cast<ObjCMessageExpr::ReceiverKind>(Record.readInt()); |
Douglas Gregor | 9a12919 | 2010-04-21 00:45:42 +0000 | [diff] [blame] | 1140 | switch (Kind) { |
| 1141 | case ObjCMessageExpr::Instance: |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1142 | E->setInstanceReceiver(Record.readSubExpr()); |
Douglas Gregor | 9a12919 | 2010-04-21 00:45:42 +0000 | [diff] [blame] | 1143 | break; |
| 1144 | |
| 1145 | case ObjCMessageExpr::Class: |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1146 | E->setClassReceiver(GetTypeSourceInfo()); |
Douglas Gregor | 9a12919 | 2010-04-21 00:45:42 +0000 | [diff] [blame] | 1147 | break; |
| 1148 | |
| 1149 | case ObjCMessageExpr::SuperClass: |
| 1150 | case ObjCMessageExpr::SuperInstance: { |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1151 | QualType T = Record.readType(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1152 | SourceLocation SuperLoc = ReadSourceLocation(); |
Douglas Gregor | 9a12919 | 2010-04-21 00:45:42 +0000 | [diff] [blame] | 1153 | E->setSuper(SuperLoc, T, Kind == ObjCMessageExpr::SuperInstance); |
| 1154 | break; |
| 1155 | } |
| 1156 | } |
| 1157 | |
| 1158 | assert(Kind == E->getReceiverKind()); |
| 1159 | |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1160 | if (Record.readInt()) |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1161 | E->setMethodDecl(ReadDeclAs<ObjCMethodDecl>()); |
Douglas Gregor | 9a12919 | 2010-04-21 00:45:42 +0000 | [diff] [blame] | 1162 | else |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1163 | E->setSelector(Record.readSelector()); |
Douglas Gregor | 9a12919 | 2010-04-21 00:45:42 +0000 | [diff] [blame] | 1164 | |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1165 | E->LBracLoc = ReadSourceLocation(); |
| 1166 | E->RBracLoc = ReadSourceLocation(); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1167 | |
| 1168 | for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1169 | E->setArg(I, Record.readSubExpr()); |
Argyrios Kyrtzidis | a6011e2 | 2011-10-03 06:36:51 +0000 | [diff] [blame] | 1170 | |
| 1171 | SourceLocation *Locs = E->getStoredSelLocs(); |
| 1172 | for (unsigned I = 0; I != NumStoredSelLocs; ++I) |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1173 | Locs[I] = ReadSourceLocation(); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1174 | } |
| 1175 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1176 | void ASTStmtReader::VisitObjCForCollectionStmt(ObjCForCollectionStmt *S) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1177 | VisitStmt(S); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1178 | S->setElement(Record.readSubStmt()); |
| 1179 | S->setCollection(Record.readSubExpr()); |
| 1180 | S->setBody(Record.readSubStmt()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1181 | S->setForLoc(ReadSourceLocation()); |
| 1182 | S->setRParenLoc(ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1183 | } |
| 1184 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1185 | void ASTStmtReader::VisitObjCAtCatchStmt(ObjCAtCatchStmt *S) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1186 | VisitStmt(S); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1187 | S->setCatchBody(Record.readSubStmt()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1188 | S->setCatchParamDecl(ReadDeclAs<VarDecl>()); |
| 1189 | S->setAtCatchLoc(ReadSourceLocation()); |
| 1190 | S->setRParenLoc(ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1191 | } |
| 1192 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1193 | void ASTStmtReader::VisitObjCAtFinallyStmt(ObjCAtFinallyStmt *S) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1194 | VisitStmt(S); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1195 | S->setFinallyBody(Record.readSubStmt()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1196 | S->setAtFinallyLoc(ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1197 | } |
| 1198 | |
John McCall | 31168b0 | 2011-06-15 23:02:42 +0000 | [diff] [blame] | 1199 | void ASTStmtReader::VisitObjCAutoreleasePoolStmt(ObjCAutoreleasePoolStmt *S) { |
| 1200 | VisitStmt(S); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1201 | S->setSubStmt(Record.readSubStmt()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1202 | S->setAtLoc(ReadSourceLocation()); |
John McCall | 31168b0 | 2011-06-15 23:02:42 +0000 | [diff] [blame] | 1203 | } |
| 1204 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1205 | void ASTStmtReader::VisitObjCAtTryStmt(ObjCAtTryStmt *S) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1206 | VisitStmt(S); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1207 | assert(Record.peekInt() == S->getNumCatchStmts()); |
| 1208 | Record.skipInts(1); |
| 1209 | bool HasFinally = Record.readInt(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1210 | S->setTryBody(Record.readSubStmt()); |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1211 | for (unsigned I = 0, N = S->getNumCatchStmts(); I != N; ++I) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1212 | S->setCatchStmt(I, cast_or_null<ObjCAtCatchStmt>(Record.readSubStmt())); |
Douglas Gregor | 96c7949 | 2010-04-23 22:50:49 +0000 | [diff] [blame] | 1213 | |
Douglas Gregor | 96c7949 | 2010-04-23 22:50:49 +0000 | [diff] [blame] | 1214 | if (HasFinally) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1215 | S->setFinallyStmt(Record.readSubStmt()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1216 | S->setAtTryLoc(ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1217 | } |
| 1218 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1219 | void ASTStmtReader::VisitObjCAtSynchronizedStmt(ObjCAtSynchronizedStmt *S) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1220 | VisitStmt(S); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1221 | S->setSynchExpr(Record.readSubStmt()); |
| 1222 | S->setSynchBody(Record.readSubStmt()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1223 | S->setAtSynchronizedLoc(ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1224 | } |
| 1225 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1226 | void ASTStmtReader::VisitObjCAtThrowStmt(ObjCAtThrowStmt *S) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1227 | VisitStmt(S); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1228 | S->setThrowExpr(Record.readSubStmt()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1229 | S->setThrowLoc(ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1230 | } |
| 1231 | |
Ted Kremenek | e65b086 | 2012-03-06 20:05:56 +0000 | [diff] [blame] | 1232 | void ASTStmtReader::VisitObjCBoolLiteralExpr(ObjCBoolLiteralExpr *E) { |
| 1233 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1234 | E->setValue(Record.readInt()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1235 | E->setLocation(ReadSourceLocation()); |
Ted Kremenek | e65b086 | 2012-03-06 20:05:56 +0000 | [diff] [blame] | 1236 | } |
| 1237 | |
Erik Pilkington | 29099de | 2016-07-16 00:35:23 +0000 | [diff] [blame] | 1238 | void ASTStmtReader::VisitObjCAvailabilityCheckExpr(ObjCAvailabilityCheckExpr *E) { |
| 1239 | VisitExpr(E); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1240 | SourceRange R = Record.readSourceRange(); |
Erik Pilkington | 29099de | 2016-07-16 00:35:23 +0000 | [diff] [blame] | 1241 | E->AtLoc = R.getBegin(); |
| 1242 | E->RParen = R.getEnd(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1243 | E->VersionToCheck = Record.readVersionTuple(); |
Erik Pilkington | 29099de | 2016-07-16 00:35:23 +0000 | [diff] [blame] | 1244 | } |
| 1245 | |
Argyrios Kyrtzidis | eeaaead | 2009-07-14 03:19:21 +0000 | [diff] [blame] | 1246 | //===----------------------------------------------------------------------===// |
| 1247 | // C++ Expressions and Statements |
Argyrios Kyrtzidis | 47cd7a9 | 2010-07-22 16:03:56 +0000 | [diff] [blame] | 1248 | //===----------------------------------------------------------------------===// |
| 1249 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1250 | void ASTStmtReader::VisitCXXCatchStmt(CXXCatchStmt *S) { |
Argyrios Kyrtzidis | 47cd7a9 | 2010-07-22 16:03:56 +0000 | [diff] [blame] | 1251 | VisitStmt(S); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1252 | S->CatchLoc = ReadSourceLocation(); |
| 1253 | S->ExceptionDecl = ReadDeclAs<VarDecl>(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1254 | S->HandlerBlock = Record.readSubStmt(); |
Argyrios Kyrtzidis | 47cd7a9 | 2010-07-22 16:03:56 +0000 | [diff] [blame] | 1255 | } |
| 1256 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1257 | void ASTStmtReader::VisitCXXTryStmt(CXXTryStmt *S) { |
Argyrios Kyrtzidis | 47cd7a9 | 2010-07-22 16:03:56 +0000 | [diff] [blame] | 1258 | VisitStmt(S); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1259 | assert(Record.peekInt() == S->getNumHandlers() && "NumStmtFields is wrong ?"); |
| 1260 | Record.skipInts(1); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1261 | S->TryLoc = ReadSourceLocation(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1262 | S->getStmts()[0] = Record.readSubStmt(); |
Argyrios Kyrtzidis | 47cd7a9 | 2010-07-22 16:03:56 +0000 | [diff] [blame] | 1263 | for (unsigned i = 0, e = S->getNumHandlers(); i != e; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1264 | S->getStmts()[i + 1] = Record.readSubStmt(); |
Argyrios Kyrtzidis | 47cd7a9 | 2010-07-22 16:03:56 +0000 | [diff] [blame] | 1265 | } |
Argyrios Kyrtzidis | eeaaead | 2009-07-14 03:19:21 +0000 | [diff] [blame] | 1266 | |
Richard Smith | 02e85f3 | 2011-04-14 22:09:26 +0000 | [diff] [blame] | 1267 | void ASTStmtReader::VisitCXXForRangeStmt(CXXForRangeStmt *S) { |
| 1268 | VisitStmt(S); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1269 | S->ForLoc = ReadSourceLocation(); |
| 1270 | S->CoawaitLoc = ReadSourceLocation(); |
| 1271 | S->ColonLoc = ReadSourceLocation(); |
| 1272 | S->RParenLoc = ReadSourceLocation(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1273 | S->setRangeStmt(Record.readSubStmt()); |
| 1274 | S->setBeginStmt(Record.readSubStmt()); |
| 1275 | S->setEndStmt(Record.readSubStmt()); |
| 1276 | S->setCond(Record.readSubExpr()); |
| 1277 | S->setInc(Record.readSubExpr()); |
| 1278 | S->setLoopVarStmt(Record.readSubStmt()); |
| 1279 | S->setBody(Record.readSubStmt()); |
Richard Smith | 02e85f3 | 2011-04-14 22:09:26 +0000 | [diff] [blame] | 1280 | } |
| 1281 | |
Douglas Gregor | deb4a2be | 2011-10-25 01:33:02 +0000 | [diff] [blame] | 1282 | void ASTStmtReader::VisitMSDependentExistsStmt(MSDependentExistsStmt *S) { |
| 1283 | VisitStmt(S); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1284 | S->KeywordLoc = ReadSourceLocation(); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1285 | S->IsIfExists = Record.readInt(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1286 | S->QualifierLoc = Record.readNestedNameSpecifierLoc(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1287 | ReadDeclarationNameInfo(S->NameInfo); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1288 | S->SubStmt = Record.readSubStmt(); |
Douglas Gregor | deb4a2be | 2011-10-25 01:33:02 +0000 | [diff] [blame] | 1289 | } |
| 1290 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1291 | void ASTStmtReader::VisitCXXOperatorCallExpr(CXXOperatorCallExpr *E) { |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1292 | VisitCallExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1293 | E->Operator = (OverloadedOperatorKind)Record.readInt(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1294 | E->Range = Record.readSourceRange(); |
Adam Nemet | 484aa45 | 2017-03-27 19:17:25 +0000 | [diff] [blame] | 1295 | E->setFPFeatures(FPOptions(Record.readInt())); |
Argyrios Kyrtzidis | eeaaead | 2009-07-14 03:19:21 +0000 | [diff] [blame] | 1296 | } |
| 1297 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1298 | void ASTStmtReader::VisitCXXConstructExpr(CXXConstructExpr *E) { |
Douglas Gregor | 5d3507d | 2009-09-09 23:08:42 +0000 | [diff] [blame] | 1299 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1300 | E->NumArgs = Record.readInt(); |
Argyrios Kyrtzidis | b8d77eb | 2010-07-10 11:46:15 +0000 | [diff] [blame] | 1301 | if (E->NumArgs) |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1302 | E->Args = new (Record.getContext()) Stmt*[E->NumArgs]; |
Argyrios Kyrtzidis | 30d98f3 | 2010-06-24 08:57:09 +0000 | [diff] [blame] | 1303 | for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1304 | E->setArg(I, Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1305 | E->setConstructor(ReadDeclAs<CXXConstructorDecl>()); |
| 1306 | E->setLocation(ReadSourceLocation()); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1307 | E->setElidable(Record.readInt()); |
| 1308 | E->setHadMultipleCandidates(Record.readInt()); |
| 1309 | E->setListInitialization(Record.readInt()); |
| 1310 | E->setStdInitListInitialization(Record.readInt()); |
| 1311 | E->setRequiresZeroInitialization(Record.readInt()); |
| 1312 | E->setConstructionKind((CXXConstructExpr::ConstructionKind)Record.readInt()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1313 | E->ParenOrBraceRange = ReadSourceRange(); |
Douglas Gregor | 5d3507d | 2009-09-09 23:08:42 +0000 | [diff] [blame] | 1314 | } |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1315 | |
Richard Smith | 5179eb7 | 2016-06-28 19:03:57 +0000 | [diff] [blame] | 1316 | void ASTStmtReader::VisitCXXInheritedCtorInitExpr(CXXInheritedCtorInitExpr *E) { |
| 1317 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1318 | E->Constructor = ReadDeclAs<CXXConstructorDecl>(); |
| 1319 | E->Loc = ReadSourceLocation(); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1320 | E->ConstructsVirtualBase = Record.readInt(); |
| 1321 | E->InheritedFromVirtualBase = Record.readInt(); |
Richard Smith | 5179eb7 | 2016-06-28 19:03:57 +0000 | [diff] [blame] | 1322 | } |
| 1323 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1324 | void ASTStmtReader::VisitCXXTemporaryObjectExpr(CXXTemporaryObjectExpr *E) { |
Argyrios Kyrtzidis | b8d77eb | 2010-07-10 11:46:15 +0000 | [diff] [blame] | 1325 | VisitCXXConstructExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1326 | E->Type = GetTypeSourceInfo(); |
Argyrios Kyrtzidis | b8d77eb | 2010-07-10 11:46:15 +0000 | [diff] [blame] | 1327 | } |
| 1328 | |
Douglas Gregor | e31e606 | 2012-02-07 10:09:13 +0000 | [diff] [blame] | 1329 | void ASTStmtReader::VisitLambdaExpr(LambdaExpr *E) { |
| 1330 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1331 | unsigned NumCaptures = Record.readInt(); |
Douglas Gregor | 99ae806 | 2012-02-14 17:54:36 +0000 | [diff] [blame] | 1332 | assert(NumCaptures == E->NumCaptures);(void)NumCaptures; |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1333 | E->IntroducerRange = ReadSourceRange(); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1334 | E->CaptureDefault = static_cast<LambdaCaptureDefault>(Record.readInt()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1335 | E->CaptureDefaultLoc = ReadSourceLocation(); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1336 | E->ExplicitParams = Record.readInt(); |
| 1337 | E->ExplicitResultType = Record.readInt(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1338 | E->ClosingBrace = ReadSourceLocation(); |
| 1339 | |
Douglas Gregor | 99ae806 | 2012-02-14 17:54:36 +0000 | [diff] [blame] | 1340 | // Read capture initializers. |
| 1341 | for (LambdaExpr::capture_init_iterator C = E->capture_init_begin(), |
| 1342 | CEnd = E->capture_init_end(); |
| 1343 | C != CEnd; ++C) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1344 | *C = Record.readSubExpr(); |
Douglas Gregor | e31e606 | 2012-02-07 10:09:13 +0000 | [diff] [blame] | 1345 | } |
| 1346 | |
Richard Smith | cc1b96d | 2013-06-12 22:31:48 +0000 | [diff] [blame] | 1347 | void |
| 1348 | ASTStmtReader::VisitCXXStdInitializerListExpr(CXXStdInitializerListExpr *E) { |
| 1349 | VisitExpr(E); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1350 | E->SubExpr = Record.readSubExpr(); |
Richard Smith | cc1b96d | 2013-06-12 22:31:48 +0000 | [diff] [blame] | 1351 | } |
| 1352 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1353 | void ASTStmtReader::VisitCXXNamedCastExpr(CXXNamedCastExpr *E) { |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1354 | VisitExplicitCastExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1355 | SourceRange R = ReadSourceRange(); |
Douglas Gregor | 4478f85 | 2011-01-12 22:41:29 +0000 | [diff] [blame] | 1356 | E->Loc = R.getBegin(); |
| 1357 | E->RParenLoc = R.getEnd(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1358 | R = ReadSourceRange(); |
Fariborz Jahanian | f073871 | 2013-02-22 22:02:53 +0000 | [diff] [blame] | 1359 | E->AngleBrackets = R; |
Sam Weinig | d01101e | 2010-01-16 21:21:01 +0000 | [diff] [blame] | 1360 | } |
| 1361 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1362 | void ASTStmtReader::VisitCXXStaticCastExpr(CXXStaticCastExpr *E) { |
Sam Weinig | d01101e | 2010-01-16 21:21:01 +0000 | [diff] [blame] | 1363 | return VisitCXXNamedCastExpr(E); |
| 1364 | } |
| 1365 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1366 | void ASTStmtReader::VisitCXXDynamicCastExpr(CXXDynamicCastExpr *E) { |
Sam Weinig | d01101e | 2010-01-16 21:21:01 +0000 | [diff] [blame] | 1367 | return VisitCXXNamedCastExpr(E); |
| 1368 | } |
| 1369 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1370 | void ASTStmtReader::VisitCXXReinterpretCastExpr(CXXReinterpretCastExpr *E) { |
Sam Weinig | d01101e | 2010-01-16 21:21:01 +0000 | [diff] [blame] | 1371 | return VisitCXXNamedCastExpr(E); |
| 1372 | } |
| 1373 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1374 | void ASTStmtReader::VisitCXXConstCastExpr(CXXConstCastExpr *E) { |
Sam Weinig | d01101e | 2010-01-16 21:21:01 +0000 | [diff] [blame] | 1375 | return VisitCXXNamedCastExpr(E); |
| 1376 | } |
| 1377 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1378 | void ASTStmtReader::VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr *E) { |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1379 | VisitExplicitCastExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1380 | E->setLParenLoc(ReadSourceLocation()); |
| 1381 | E->setRParenLoc(ReadSourceLocation()); |
Sam Weinig | d01101e | 2010-01-16 21:21:01 +0000 | [diff] [blame] | 1382 | } |
| 1383 | |
Richard Smith | c67fdd4 | 2012-03-07 08:35:16 +0000 | [diff] [blame] | 1384 | void ASTStmtReader::VisitUserDefinedLiteral(UserDefinedLiteral *E) { |
| 1385 | VisitCallExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1386 | E->UDSuffixLoc = ReadSourceLocation(); |
Richard Smith | c67fdd4 | 2012-03-07 08:35:16 +0000 | [diff] [blame] | 1387 | } |
| 1388 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1389 | void ASTStmtReader::VisitCXXBoolLiteralExpr(CXXBoolLiteralExpr *E) { |
Sam Weinig | e83b3ac | 2010-02-07 06:32:43 +0000 | [diff] [blame] | 1390 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1391 | E->setValue(Record.readInt()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1392 | E->setLocation(ReadSourceLocation()); |
Sam Weinig | e83b3ac | 2010-02-07 06:32:43 +0000 | [diff] [blame] | 1393 | } |
| 1394 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1395 | void ASTStmtReader::VisitCXXNullPtrLiteralExpr(CXXNullPtrLiteralExpr *E) { |
Sam Weinig | e83b3ac | 2010-02-07 06:32:43 +0000 | [diff] [blame] | 1396 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1397 | E->setLocation(ReadSourceLocation()); |
Sam Weinig | e83b3ac | 2010-02-07 06:32:43 +0000 | [diff] [blame] | 1398 | } |
| 1399 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1400 | void ASTStmtReader::VisitCXXTypeidExpr(CXXTypeidExpr *E) { |
Chris Lattner | 13a5ecc | 2010-05-09 06:03:39 +0000 | [diff] [blame] | 1401 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1402 | E->setSourceRange(ReadSourceRange()); |
Chris Lattner | 13a5ecc | 2010-05-09 06:03:39 +0000 | [diff] [blame] | 1403 | if (E->isTypeOperand()) { // typeid(int) |
Sebastian Redl | c67764e | 2010-07-22 22:43:28 +0000 | [diff] [blame] | 1404 | E->setTypeOperandSourceInfo( |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1405 | GetTypeSourceInfo()); |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1406 | return; |
Chris Lattner | 13a5ecc | 2010-05-09 06:03:39 +0000 | [diff] [blame] | 1407 | } |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1408 | |
Chris Lattner | 13a5ecc | 2010-05-09 06:03:39 +0000 | [diff] [blame] | 1409 | // typeid(42+2) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1410 | E->setExprOperand(Record.readSubExpr()); |
Chris Lattner | 13a5ecc | 2010-05-09 06:03:39 +0000 | [diff] [blame] | 1411 | } |
| 1412 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1413 | void ASTStmtReader::VisitCXXThisExpr(CXXThisExpr *E) { |
Chris Lattner | 9826733 | 2010-05-09 06:15:05 +0000 | [diff] [blame] | 1414 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1415 | E->setLocation(ReadSourceLocation()); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1416 | E->setImplicit(Record.readInt()); |
Chris Lattner | 9826733 | 2010-05-09 06:15:05 +0000 | [diff] [blame] | 1417 | } |
| 1418 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1419 | void ASTStmtReader::VisitCXXThrowExpr(CXXThrowExpr *E) { |
Chris Lattner | 9826733 | 2010-05-09 06:15:05 +0000 | [diff] [blame] | 1420 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1421 | E->ThrowLoc = ReadSourceLocation(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1422 | E->Op = Record.readSubExpr(); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1423 | E->IsThrownVariableInScope = Record.readInt(); |
Chris Lattner | 9826733 | 2010-05-09 06:15:05 +0000 | [diff] [blame] | 1424 | } |
Chris Lattner | 13a5ecc | 2010-05-09 06:03:39 +0000 | [diff] [blame] | 1425 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1426 | void ASTStmtReader::VisitCXXDefaultArgExpr(CXXDefaultArgExpr *E) { |
Chris Lattner | e2437f4 | 2010-05-09 06:40:08 +0000 | [diff] [blame] | 1427 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1428 | E->Param = ReadDeclAs<ParmVarDecl>(); |
| 1429 | E->Loc = ReadSourceLocation(); |
Chris Lattner | cba8614 | 2010-05-10 00:25:06 +0000 | [diff] [blame] | 1430 | } |
| 1431 | |
Richard Smith | 852c9db | 2013-04-20 22:23:05 +0000 | [diff] [blame] | 1432 | void ASTStmtReader::VisitCXXDefaultInitExpr(CXXDefaultInitExpr *E) { |
| 1433 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1434 | E->Field = ReadDeclAs<FieldDecl>(); |
| 1435 | E->Loc = ReadSourceLocation(); |
Richard Smith | 852c9db | 2013-04-20 22:23:05 +0000 | [diff] [blame] | 1436 | } |
| 1437 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1438 | void ASTStmtReader::VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *E) { |
Chris Lattner | cba8614 | 2010-05-10 00:25:06 +0000 | [diff] [blame] | 1439 | VisitExpr(E); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1440 | E->setTemporary(Record.readCXXTemporary()); |
| 1441 | E->setSubExpr(Record.readSubExpr()); |
Chris Lattner | cba8614 | 2010-05-10 00:25:06 +0000 | [diff] [blame] | 1442 | } |
| 1443 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1444 | void ASTStmtReader::VisitCXXScalarValueInitExpr(CXXScalarValueInitExpr *E) { |
Chris Lattner | abfb58d | 2010-05-10 01:22:27 +0000 | [diff] [blame] | 1445 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1446 | E->TypeInfo = GetTypeSourceInfo(); |
| 1447 | E->RParenLoc = ReadSourceLocation(); |
Chris Lattner | abfb58d | 2010-05-10 01:22:27 +0000 | [diff] [blame] | 1448 | } |
| 1449 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1450 | void ASTStmtReader::VisitCXXNewExpr(CXXNewExpr *E) { |
Chris Lattner | abfb58d | 2010-05-10 01:22:27 +0000 | [diff] [blame] | 1451 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1452 | E->GlobalNew = Record.readInt(); |
| 1453 | bool isArray = Record.readInt(); |
| 1454 | E->PassAlignment = Record.readInt(); |
| 1455 | E->UsualArrayDeleteWantsSize = Record.readInt(); |
| 1456 | unsigned NumPlacementArgs = Record.readInt(); |
| 1457 | E->StoredInitializationStyle = Record.readInt(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1458 | E->setOperatorNew(ReadDeclAs<FunctionDecl>()); |
| 1459 | E->setOperatorDelete(ReadDeclAs<FunctionDecl>()); |
| 1460 | E->AllocatedTypeInfo = GetTypeSourceInfo(); |
| 1461 | E->TypeIdParens = ReadSourceRange(); |
| 1462 | E->Range = ReadSourceRange(); |
| 1463 | E->DirectInitRange = ReadSourceRange(); |
Chandler Carruth | 0171815 | 2010-10-25 08:47:36 +0000 | [diff] [blame] | 1464 | |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1465 | E->AllocateArgsArray(Record.getContext(), isArray, NumPlacementArgs, |
Sebastian Redl | 6047f07 | 2012-02-16 12:22:20 +0000 | [diff] [blame] | 1466 | E->StoredInitializationStyle != 0); |
Chris Lattner | abfb58d | 2010-05-10 01:22:27 +0000 | [diff] [blame] | 1467 | |
| 1468 | // Install all the subexpressions. |
Chris Lattner | abfb58d | 2010-05-10 01:22:27 +0000 | [diff] [blame] | 1469 | for (CXXNewExpr::raw_arg_iterator I = E->raw_arg_begin(),e = E->raw_arg_end(); |
| 1470 | I != e; ++I) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1471 | *I = Record.readSubStmt(); |
Chris Lattner | abfb58d | 2010-05-10 01:22:27 +0000 | [diff] [blame] | 1472 | } |
| 1473 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1474 | void ASTStmtReader::VisitCXXDeleteExpr(CXXDeleteExpr *E) { |
Argyrios Kyrtzidis | 6e57c35 | 2010-06-22 17:07:59 +0000 | [diff] [blame] | 1475 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1476 | E->GlobalDelete = Record.readInt(); |
| 1477 | E->ArrayForm = Record.readInt(); |
| 1478 | E->ArrayFormAsWritten = Record.readInt(); |
| 1479 | E->UsualArrayDeleteWantsSize = Record.readInt(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1480 | E->OperatorDelete = ReadDeclAs<FunctionDecl>(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1481 | E->Argument = Record.readSubExpr(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1482 | E->Loc = ReadSourceLocation(); |
Argyrios Kyrtzidis | 6e57c35 | 2010-06-22 17:07:59 +0000 | [diff] [blame] | 1483 | } |
Chris Lattner | cba8614 | 2010-05-10 00:25:06 +0000 | [diff] [blame] | 1484 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1485 | void ASTStmtReader::VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr *E) { |
Argyrios Kyrtzidis | 99a226d | 2010-06-28 09:32:03 +0000 | [diff] [blame] | 1486 | VisitExpr(E); |
| 1487 | |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1488 | E->Base = Record.readSubExpr(); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1489 | E->IsArrow = Record.readInt(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1490 | E->OperatorLoc = ReadSourceLocation(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1491 | E->QualifierLoc = Record.readNestedNameSpecifierLoc(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1492 | E->ScopeType = GetTypeSourceInfo(); |
| 1493 | E->ColonColonLoc = ReadSourceLocation(); |
| 1494 | E->TildeLoc = ReadSourceLocation(); |
| 1495 | |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1496 | IdentifierInfo *II = Record.getIdentifierInfo(); |
Argyrios Kyrtzidis | 99a226d | 2010-06-28 09:32:03 +0000 | [diff] [blame] | 1497 | if (II) |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1498 | E->setDestroyedType(II, ReadSourceLocation()); |
Argyrios Kyrtzidis | 99a226d | 2010-06-28 09:32:03 +0000 | [diff] [blame] | 1499 | else |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1500 | E->setDestroyedType(GetTypeSourceInfo()); |
Argyrios Kyrtzidis | 99a226d | 2010-06-28 09:32:03 +0000 | [diff] [blame] | 1501 | } |
| 1502 | |
John McCall | 5d41378 | 2010-12-06 08:20:24 +0000 | [diff] [blame] | 1503 | void ASTStmtReader::VisitExprWithCleanups(ExprWithCleanups *E) { |
Chris Lattner | cba8614 | 2010-05-10 00:25:06 +0000 | [diff] [blame] | 1504 | VisitExpr(E); |
John McCall | 28fc709 | 2011-11-10 05:35:25 +0000 | [diff] [blame] | 1505 | |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1506 | unsigned NumObjects = Record.readInt(); |
John McCall | 28fc709 | 2011-11-10 05:35:25 +0000 | [diff] [blame] | 1507 | assert(NumObjects == E->getNumObjects()); |
| 1508 | for (unsigned i = 0; i != NumObjects; ++i) |
James Y Knight | e00a67e | 2015-12-31 04:18:25 +0000 | [diff] [blame] | 1509 | E->getTrailingObjects<BlockDecl *>()[i] = |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1510 | ReadDeclAs<BlockDecl>(); |
John McCall | 28fc709 | 2011-11-10 05:35:25 +0000 | [diff] [blame] | 1511 | |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1512 | E->ExprWithCleanupsBits.CleanupsHaveSideEffects = Record.readInt(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1513 | E->SubExpr = Record.readSubExpr(); |
Chris Lattner | e2437f4 | 2010-05-09 06:40:08 +0000 | [diff] [blame] | 1514 | } |
| 1515 | |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1516 | void |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1517 | ASTStmtReader::VisitCXXDependentScopeMemberExpr(CXXDependentScopeMemberExpr *E){ |
Argyrios Kyrtzidis | bfcacee | 2010-06-24 08:57:31 +0000 | [diff] [blame] | 1518 | VisitExpr(E); |
Abramo Bagnara | 7945c98 | 2012-01-27 09:46:47 +0000 | [diff] [blame] | 1519 | |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1520 | if (Record.readInt()) // HasTemplateKWAndArgsInfo |
James Y Knight | e7d8228 | 2015-12-29 18:15:14 +0000 | [diff] [blame] | 1521 | ReadTemplateKWAndArgsInfo( |
| 1522 | *E->getTrailingObjects<ASTTemplateKWAndArgsInfo>(), |
| 1523 | E->getTrailingObjects<TemplateArgumentLoc>(), |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1524 | /*NumTemplateArgs=*/Record.readInt()); |
Argyrios Kyrtzidis | bfcacee | 2010-06-24 08:57:31 +0000 | [diff] [blame] | 1525 | |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1526 | E->Base = Record.readSubExpr(); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1527 | E->BaseType = Record.readType(); |
| 1528 | E->IsArrow = Record.readInt(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1529 | E->OperatorLoc = ReadSourceLocation(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1530 | E->QualifierLoc = Record.readNestedNameSpecifierLoc(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1531 | E->FirstQualifierFoundInScope = ReadDeclAs<NamedDecl>(); |
| 1532 | ReadDeclarationNameInfo(E->MemberNameInfo); |
Argyrios Kyrtzidis | bfcacee | 2010-06-24 08:57:31 +0000 | [diff] [blame] | 1533 | } |
| 1534 | |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1535 | void |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1536 | ASTStmtReader::VisitDependentScopeDeclRefExpr(DependentScopeDeclRefExpr *E) { |
Argyrios Kyrtzidis | cd444d1a | 2010-06-28 09:31:56 +0000 | [diff] [blame] | 1537 | VisitExpr(E); |
Abramo Bagnara | 7945c98 | 2012-01-27 09:46:47 +0000 | [diff] [blame] | 1538 | |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1539 | if (Record.readInt()) // HasTemplateKWAndArgsInfo |
James Y Knight | e7d8228 | 2015-12-29 18:15:14 +0000 | [diff] [blame] | 1540 | ReadTemplateKWAndArgsInfo( |
| 1541 | *E->getTrailingObjects<ASTTemplateKWAndArgsInfo>(), |
| 1542 | E->getTrailingObjects<TemplateArgumentLoc>(), |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1543 | /*NumTemplateArgs=*/Record.readInt()); |
Douglas Gregor | 3a43fd6 | 2011-02-25 20:49:16 +0000 | [diff] [blame] | 1544 | |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1545 | E->QualifierLoc = Record.readNestedNameSpecifierLoc(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1546 | ReadDeclarationNameInfo(E->NameInfo); |
Argyrios Kyrtzidis | cd444d1a | 2010-06-28 09:31:56 +0000 | [diff] [blame] | 1547 | } |
| 1548 | |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1549 | void |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1550 | ASTStmtReader::VisitCXXUnresolvedConstructExpr(CXXUnresolvedConstructExpr *E) { |
Argyrios Kyrtzidis | bfcacee | 2010-06-24 08:57:31 +0000 | [diff] [blame] | 1551 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1552 | assert(Record.peekInt() == E->arg_size() && |
| 1553 | "Read wrong record during creation ?"); |
| 1554 | Record.skipInts(1); |
Argyrios Kyrtzidis | bfcacee | 2010-06-24 08:57:31 +0000 | [diff] [blame] | 1555 | for (unsigned I = 0, N = E->arg_size(); I != N; ++I) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1556 | E->setArg(I, Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1557 | E->Type = GetTypeSourceInfo(); |
| 1558 | E->setLParenLoc(ReadSourceLocation()); |
| 1559 | E->setRParenLoc(ReadSourceLocation()); |
Argyrios Kyrtzidis | bfcacee | 2010-06-24 08:57:31 +0000 | [diff] [blame] | 1560 | } |
| 1561 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1562 | void ASTStmtReader::VisitOverloadExpr(OverloadExpr *E) { |
Argyrios Kyrtzidis | b8d3c63 | 2010-06-25 09:03:26 +0000 | [diff] [blame] | 1563 | VisitExpr(E); |
Abramo Bagnara | 7945c98 | 2012-01-27 09:46:47 +0000 | [diff] [blame] | 1564 | |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1565 | if (Record.readInt()) // HasTemplateKWAndArgsInfo |
James Y Knight | e7d8228 | 2015-12-29 18:15:14 +0000 | [diff] [blame] | 1566 | ReadTemplateKWAndArgsInfo(*E->getTrailingASTTemplateKWAndArgsInfo(), |
| 1567 | E->getTrailingTemplateArgumentLoc(), |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1568 | /*NumTemplateArgs=*/Record.readInt()); |
Argyrios Kyrtzidis | b8d3c63 | 2010-06-25 09:03:26 +0000 | [diff] [blame] | 1569 | |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1570 | unsigned NumDecls = Record.readInt(); |
Argyrios Kyrtzidis | b8d3c63 | 2010-06-25 09:03:26 +0000 | [diff] [blame] | 1571 | UnresolvedSet<8> Decls; |
| 1572 | for (unsigned i = 0; i != NumDecls; ++i) { |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 1573 | auto *D = ReadDeclAs<NamedDecl>(); |
| 1574 | auto AS = (AccessSpecifier)Record.readInt(); |
Argyrios Kyrtzidis | b8d3c63 | 2010-06-25 09:03:26 +0000 | [diff] [blame] | 1575 | Decls.addDecl(D, AS); |
| 1576 | } |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1577 | E->initializeResults(Record.getContext(), Decls.begin(), Decls.end()); |
Argyrios Kyrtzidis | b8d3c63 | 2010-06-25 09:03:26 +0000 | [diff] [blame] | 1578 | |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1579 | ReadDeclarationNameInfo(E->NameInfo); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1580 | E->QualifierLoc = Record.readNestedNameSpecifierLoc(); |
Argyrios Kyrtzidis | b8d3c63 | 2010-06-25 09:03:26 +0000 | [diff] [blame] | 1581 | } |
| 1582 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1583 | void ASTStmtReader::VisitUnresolvedMemberExpr(UnresolvedMemberExpr *E) { |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1584 | VisitOverloadExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1585 | E->IsArrow = Record.readInt(); |
| 1586 | E->HasUnresolvedUsing = Record.readInt(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1587 | E->Base = Record.readSubExpr(); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1588 | E->BaseType = Record.readType(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1589 | E->OperatorLoc = ReadSourceLocation(); |
Argyrios Kyrtzidis | b8d3c63 | 2010-06-25 09:03:26 +0000 | [diff] [blame] | 1590 | } |
| 1591 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1592 | void ASTStmtReader::VisitUnresolvedLookupExpr(UnresolvedLookupExpr *E) { |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1593 | VisitOverloadExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1594 | E->RequiresADL = Record.readInt(); |
| 1595 | E->Overloaded = Record.readInt(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1596 | E->NamingClass = ReadDeclAs<CXXRecordDecl>(); |
Argyrios Kyrtzidis | 58e01ad | 2010-06-25 09:03:34 +0000 | [diff] [blame] | 1597 | } |
| 1598 | |
Douglas Gregor | 29c42f2 | 2012-02-24 07:38:34 +0000 | [diff] [blame] | 1599 | void ASTStmtReader::VisitTypeTraitExpr(TypeTraitExpr *E) { |
| 1600 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1601 | E->TypeTraitExprBits.NumArgs = Record.readInt(); |
| 1602 | E->TypeTraitExprBits.Kind = Record.readInt(); |
| 1603 | E->TypeTraitExprBits.Value = Record.readInt(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1604 | SourceRange Range = ReadSourceRange(); |
Jordan Rose | 99e80c1 | 2013-12-20 01:26:47 +0000 | [diff] [blame] | 1605 | E->Loc = Range.getBegin(); |
| 1606 | E->RParenLoc = Range.getEnd(); |
| 1607 | |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 1608 | auto **Args = E->getTrailingObjects<TypeSourceInfo *>(); |
Douglas Gregor | 29c42f2 | 2012-02-24 07:38:34 +0000 | [diff] [blame] | 1609 | for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I) |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1610 | Args[I] = GetTypeSourceInfo(); |
Douglas Gregor | 29c42f2 | 2012-02-24 07:38:34 +0000 | [diff] [blame] | 1611 | } |
| 1612 | |
John Wiegley | 6242b6a | 2011-04-28 00:16:57 +0000 | [diff] [blame] | 1613 | void ASTStmtReader::VisitArrayTypeTraitExpr(ArrayTypeTraitExpr *E) { |
| 1614 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1615 | E->ATT = (ArrayTypeTrait)Record.readInt(); |
| 1616 | E->Value = (unsigned int)Record.readInt(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1617 | SourceRange Range = ReadSourceRange(); |
John Wiegley | 6242b6a | 2011-04-28 00:16:57 +0000 | [diff] [blame] | 1618 | E->Loc = Range.getBegin(); |
| 1619 | E->RParen = Range.getEnd(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1620 | E->QueriedType = GetTypeSourceInfo(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1621 | E->Dimension = Record.readSubExpr(); |
John Wiegley | 6242b6a | 2011-04-28 00:16:57 +0000 | [diff] [blame] | 1622 | } |
| 1623 | |
John Wiegley | f9f6584 | 2011-04-25 06:54:41 +0000 | [diff] [blame] | 1624 | void ASTStmtReader::VisitExpressionTraitExpr(ExpressionTraitExpr *E) { |
| 1625 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1626 | E->ET = (ExpressionTrait)Record.readInt(); |
| 1627 | E->Value = (bool)Record.readInt(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1628 | SourceRange Range = ReadSourceRange(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1629 | E->QueriedExpression = Record.readSubExpr(); |
John Wiegley | f9f6584 | 2011-04-25 06:54:41 +0000 | [diff] [blame] | 1630 | E->Loc = Range.getBegin(); |
| 1631 | E->RParen = Range.getEnd(); |
| 1632 | } |
| 1633 | |
Sebastian Redl | 9ac55dd | 2010-09-10 20:55:54 +0000 | [diff] [blame] | 1634 | void ASTStmtReader::VisitCXXNoexceptExpr(CXXNoexceptExpr *E) { |
| 1635 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1636 | E->Value = (bool)Record.readInt(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1637 | E->Range = ReadSourceRange(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1638 | E->Operand = Record.readSubExpr(); |
Sebastian Redl | 9ac55dd | 2010-09-10 20:55:54 +0000 | [diff] [blame] | 1639 | } |
| 1640 | |
Douglas Gregor | e8e9dd6 | 2011-01-03 17:17:50 +0000 | [diff] [blame] | 1641 | void ASTStmtReader::VisitPackExpansionExpr(PackExpansionExpr *E) { |
| 1642 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1643 | E->EllipsisLoc = ReadSourceLocation(); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1644 | E->NumExpansions = Record.readInt(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1645 | E->Pattern = Record.readSubExpr(); |
Douglas Gregor | e8e9dd6 | 2011-01-03 17:17:50 +0000 | [diff] [blame] | 1646 | } |
| 1647 | |
Douglas Gregor | 820ba7b | 2011-01-04 17:33:58 +0000 | [diff] [blame] | 1648 | void ASTStmtReader::VisitSizeOfPackExpr(SizeOfPackExpr *E) { |
| 1649 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1650 | unsigned NumPartialArgs = Record.readInt(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1651 | E->OperatorLoc = ReadSourceLocation(); |
| 1652 | E->PackLoc = ReadSourceLocation(); |
| 1653 | E->RParenLoc = ReadSourceLocation(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1654 | E->Pack = Record.readDeclAs<NamedDecl>(); |
Richard Smith | d784e68 | 2015-09-23 21:41:42 +0000 | [diff] [blame] | 1655 | if (E->isPartiallySubstituted()) { |
| 1656 | assert(E->Length == NumPartialArgs); |
James Y Knight | e00a67e | 2015-12-31 04:18:25 +0000 | [diff] [blame] | 1657 | for (auto *I = E->getTrailingObjects<TemplateArgument>(), |
Richard Smith | d784e68 | 2015-09-23 21:41:42 +0000 | [diff] [blame] | 1658 | *E = I + NumPartialArgs; |
| 1659 | I != E; ++I) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1660 | new (I) TemplateArgument(Record.readTemplateArgument()); |
Richard Smith | d784e68 | 2015-09-23 21:41:42 +0000 | [diff] [blame] | 1661 | } else if (!E->isValueDependent()) { |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1662 | E->Length = Record.readInt(); |
Richard Smith | d784e68 | 2015-09-23 21:41:42 +0000 | [diff] [blame] | 1663 | } |
Douglas Gregor | 820ba7b | 2011-01-04 17:33:58 +0000 | [diff] [blame] | 1664 | } |
| 1665 | |
John McCall | fa19404 | 2011-07-15 07:00:14 +0000 | [diff] [blame] | 1666 | void ASTStmtReader::VisitSubstNonTypeTemplateParmExpr( |
| 1667 | SubstNonTypeTemplateParmExpr *E) { |
| 1668 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1669 | E->Param = ReadDeclAs<NonTypeTemplateParmDecl>(); |
| 1670 | E->NameLoc = ReadSourceLocation(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1671 | E->Replacement = Record.readSubExpr(); |
John McCall | fa19404 | 2011-07-15 07:00:14 +0000 | [diff] [blame] | 1672 | } |
| 1673 | |
Douglas Gregor | cdbc539 | 2011-01-15 01:15:58 +0000 | [diff] [blame] | 1674 | void ASTStmtReader::VisitSubstNonTypeTemplateParmPackExpr( |
| 1675 | SubstNonTypeTemplateParmPackExpr *E) { |
| 1676 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1677 | E->Param = ReadDeclAs<NonTypeTemplateParmDecl>(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1678 | TemplateArgument ArgPack = Record.readTemplateArgument(); |
Douglas Gregor | cdbc539 | 2011-01-15 01:15:58 +0000 | [diff] [blame] | 1679 | if (ArgPack.getKind() != TemplateArgument::Pack) |
| 1680 | return; |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1681 | |
Douglas Gregor | cdbc539 | 2011-01-15 01:15:58 +0000 | [diff] [blame] | 1682 | E->Arguments = ArgPack.pack_begin(); |
| 1683 | E->NumArguments = ArgPack.pack_size(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1684 | E->NameLoc = ReadSourceLocation(); |
Douglas Gregor | cdbc539 | 2011-01-15 01:15:58 +0000 | [diff] [blame] | 1685 | } |
| 1686 | |
Richard Smith | b15fe3a | 2012-09-12 00:56:43 +0000 | [diff] [blame] | 1687 | void ASTStmtReader::VisitFunctionParmPackExpr(FunctionParmPackExpr *E) { |
| 1688 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1689 | E->NumParameters = Record.readInt(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1690 | E->ParamPack = ReadDeclAs<ParmVarDecl>(); |
| 1691 | E->NameLoc = ReadSourceLocation(); |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 1692 | auto **Parms = E->getTrailingObjects<ParmVarDecl *>(); |
Richard Smith | b15fe3a | 2012-09-12 00:56:43 +0000 | [diff] [blame] | 1693 | for (unsigned i = 0, n = E->NumParameters; i != n; ++i) |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1694 | Parms[i] = ReadDeclAs<ParmVarDecl>(); |
Richard Smith | b15fe3a | 2012-09-12 00:56:43 +0000 | [diff] [blame] | 1695 | } |
| 1696 | |
Douglas Gregor | fe31481 | 2011-06-21 17:03:29 +0000 | [diff] [blame] | 1697 | void ASTStmtReader::VisitMaterializeTemporaryExpr(MaterializeTemporaryExpr *E) { |
| 1698 | VisitExpr(E); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1699 | E->State = Record.readSubExpr(); |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 1700 | auto *VD = ReadDeclAs<ValueDecl>(); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1701 | unsigned ManglingNumber = Record.readInt(); |
David Majnemer | daff370 | 2014-05-01 17:50:17 +0000 | [diff] [blame] | 1702 | E->setExtendingDecl(VD, ManglingNumber); |
Douglas Gregor | fe31481 | 2011-06-21 17:03:29 +0000 | [diff] [blame] | 1703 | } |
| 1704 | |
Richard Smith | 0f0af19 | 2014-11-08 05:07:16 +0000 | [diff] [blame] | 1705 | void ASTStmtReader::VisitCXXFoldExpr(CXXFoldExpr *E) { |
| 1706 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1707 | E->LParenLoc = ReadSourceLocation(); |
| 1708 | E->EllipsisLoc = ReadSourceLocation(); |
| 1709 | E->RParenLoc = ReadSourceLocation(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1710 | E->SubExprs[0] = Record.readSubExpr(); |
| 1711 | E->SubExprs[1] = Record.readSubExpr(); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1712 | E->Opcode = (BinaryOperatorKind)Record.readInt(); |
Richard Smith | 0f0af19 | 2014-11-08 05:07:16 +0000 | [diff] [blame] | 1713 | } |
| 1714 | |
John McCall | 8d69a21 | 2010-11-15 23:31:06 +0000 | [diff] [blame] | 1715 | void ASTStmtReader::VisitOpaqueValueExpr(OpaqueValueExpr *E) { |
| 1716 | VisitExpr(E); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1717 | E->SourceExpr = Record.readSubExpr(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1718 | E->Loc = ReadSourceLocation(); |
Akira Hatanaka | 797afe3 | 2018-03-20 01:47:58 +0000 | [diff] [blame] | 1719 | E->setIsUnique(Record.readInt()); |
John McCall | 8d69a21 | 2010-11-15 23:31:06 +0000 | [diff] [blame] | 1720 | } |
| 1721 | |
Kaelyn Takata | e1f49d5 | 2014-10-27 18:07:20 +0000 | [diff] [blame] | 1722 | void ASTStmtReader::VisitTypoExpr(TypoExpr *E) { |
| 1723 | llvm_unreachable("Cannot read TypoExpr nodes"); |
| 1724 | } |
| 1725 | |
Peter Collingbourne | 41f8546 | 2011-02-09 21:07:24 +0000 | [diff] [blame] | 1726 | //===----------------------------------------------------------------------===// |
John McCall | fa19404 | 2011-07-15 07:00:14 +0000 | [diff] [blame] | 1727 | // Microsoft Expressions and Statements |
| 1728 | //===----------------------------------------------------------------------===// |
John McCall | 5e77d76 | 2013-04-16 07:28:30 +0000 | [diff] [blame] | 1729 | void ASTStmtReader::VisitMSPropertyRefExpr(MSPropertyRefExpr *E) { |
| 1730 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1731 | E->IsArrow = (Record.readInt() != 0); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1732 | E->BaseExpr = Record.readSubExpr(); |
| 1733 | E->QualifierLoc = Record.readNestedNameSpecifierLoc(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1734 | E->MemberLoc = ReadSourceLocation(); |
| 1735 | E->TheDecl = ReadDeclAs<MSPropertyDecl>(); |
John McCall | 5e77d76 | 2013-04-16 07:28:30 +0000 | [diff] [blame] | 1736 | } |
| 1737 | |
Alexey Bataev | f763027 | 2015-11-25 12:01:00 +0000 | [diff] [blame] | 1738 | void ASTStmtReader::VisitMSPropertySubscriptExpr(MSPropertySubscriptExpr *E) { |
| 1739 | VisitExpr(E); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1740 | E->setBase(Record.readSubExpr()); |
| 1741 | E->setIdx(Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1742 | E->setRBracketLoc(ReadSourceLocation()); |
Alexey Bataev | f763027 | 2015-11-25 12:01:00 +0000 | [diff] [blame] | 1743 | } |
| 1744 | |
John McCall | fa19404 | 2011-07-15 07:00:14 +0000 | [diff] [blame] | 1745 | void ASTStmtReader::VisitCXXUuidofExpr(CXXUuidofExpr *E) { |
| 1746 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1747 | E->setSourceRange(ReadSourceRange()); |
| 1748 | std::string UuidStr = ReadString(); |
| 1749 | E->setUuidStr(StringRef(UuidStr).copy(Record.getContext())); |
John McCall | fa19404 | 2011-07-15 07:00:14 +0000 | [diff] [blame] | 1750 | if (E->isTypeOperand()) { // __uuidof(ComType) |
| 1751 | E->setTypeOperandSourceInfo( |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1752 | GetTypeSourceInfo()); |
John McCall | fa19404 | 2011-07-15 07:00:14 +0000 | [diff] [blame] | 1753 | return; |
| 1754 | } |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1755 | |
John McCall | fa19404 | 2011-07-15 07:00:14 +0000 | [diff] [blame] | 1756 | // __uuidof(expr) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1757 | E->setExprOperand(Record.readSubExpr()); |
John McCall | fa19404 | 2011-07-15 07:00:14 +0000 | [diff] [blame] | 1758 | } |
| 1759 | |
Nico Weber | 9b98207 | 2014-07-07 00:12:30 +0000 | [diff] [blame] | 1760 | void ASTStmtReader::VisitSEHLeaveStmt(SEHLeaveStmt *S) { |
| 1761 | VisitStmt(S); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1762 | S->setLeaveLoc(ReadSourceLocation()); |
Nico Weber | 9b98207 | 2014-07-07 00:12:30 +0000 | [diff] [blame] | 1763 | } |
| 1764 | |
John McCall | fa19404 | 2011-07-15 07:00:14 +0000 | [diff] [blame] | 1765 | void ASTStmtReader::VisitSEHExceptStmt(SEHExceptStmt *S) { |
| 1766 | VisitStmt(S); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1767 | S->Loc = ReadSourceLocation(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1768 | S->Children[SEHExceptStmt::FILTER_EXPR] = Record.readSubStmt(); |
| 1769 | S->Children[SEHExceptStmt::BLOCK] = Record.readSubStmt(); |
John McCall | fa19404 | 2011-07-15 07:00:14 +0000 | [diff] [blame] | 1770 | } |
| 1771 | |
| 1772 | void ASTStmtReader::VisitSEHFinallyStmt(SEHFinallyStmt *S) { |
| 1773 | VisitStmt(S); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1774 | S->Loc = ReadSourceLocation(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1775 | S->Block = Record.readSubStmt(); |
John McCall | fa19404 | 2011-07-15 07:00:14 +0000 | [diff] [blame] | 1776 | } |
| 1777 | |
| 1778 | void ASTStmtReader::VisitSEHTryStmt(SEHTryStmt *S) { |
| 1779 | VisitStmt(S); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1780 | S->IsCXXTry = Record.readInt(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1781 | S->TryLoc = ReadSourceLocation(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1782 | S->Children[SEHTryStmt::TRY] = Record.readSubStmt(); |
| 1783 | S->Children[SEHTryStmt::HANDLER] = Record.readSubStmt(); |
John McCall | fa19404 | 2011-07-15 07:00:14 +0000 | [diff] [blame] | 1784 | } |
| 1785 | |
| 1786 | //===----------------------------------------------------------------------===// |
Peter Collingbourne | 41f8546 | 2011-02-09 21:07:24 +0000 | [diff] [blame] | 1787 | // CUDA Expressions and Statements |
| 1788 | //===----------------------------------------------------------------------===// |
| 1789 | |
| 1790 | void ASTStmtReader::VisitCUDAKernelCallExpr(CUDAKernelCallExpr *E) { |
| 1791 | VisitCallExpr(E); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1792 | E->setConfig(cast<CallExpr>(Record.readSubExpr())); |
Peter Collingbourne | 41f8546 | 2011-02-09 21:07:24 +0000 | [diff] [blame] | 1793 | } |
| 1794 | |
John McCall | fa19404 | 2011-07-15 07:00:14 +0000 | [diff] [blame] | 1795 | //===----------------------------------------------------------------------===// |
| 1796 | // OpenCL Expressions and Statements. |
| 1797 | //===----------------------------------------------------------------------===// |
| 1798 | void ASTStmtReader::VisitAsTypeExpr(AsTypeExpr *E) { |
| 1799 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1800 | E->BuiltinLoc = ReadSourceLocation(); |
| 1801 | E->RParenLoc = ReadSourceLocation(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1802 | E->SrcExpr = Record.readSubExpr(); |
John McCall | fa19404 | 2011-07-15 07:00:14 +0000 | [diff] [blame] | 1803 | } |
| 1804 | |
| 1805 | //===----------------------------------------------------------------------===// |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 1806 | // OpenMP Clauses. |
| 1807 | //===----------------------------------------------------------------------===// |
| 1808 | |
| 1809 | namespace clang { |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 1810 | |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 1811 | class OMPClauseReader : public OMPClauseVisitor<OMPClauseReader> { |
| 1812 | ASTStmtReader *Reader; |
| 1813 | ASTContext &Context; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 1814 | |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 1815 | public: |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1816 | OMPClauseReader(ASTStmtReader *R, ASTRecordReader &Record) |
| 1817 | : Reader(R), Context(Record.getContext()) {} |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 1818 | |
Alexey Bataev | 417089f | 2016-02-17 13:19:37 +0000 | [diff] [blame] | 1819 | #define OPENMP_CLAUSE(Name, Class) void Visit##Class(Class *C); |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 1820 | #include "clang/Basic/OpenMPKinds.def" |
| 1821 | OMPClause *readClause(); |
Alexey Bataev | 3392d76 | 2016-02-16 11:18:12 +0000 | [diff] [blame] | 1822 | void VisitOMPClauseWithPreInit(OMPClauseWithPreInit *C); |
Alexey Bataev | 005248a | 2016-02-25 05:25:57 +0000 | [diff] [blame] | 1823 | void VisitOMPClauseWithPostUpdate(OMPClauseWithPostUpdate *C); |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 1824 | }; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 1825 | |
| 1826 | } // namespace clang |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 1827 | |
| 1828 | OMPClause *OMPClauseReader::readClause() { |
| 1829 | OMPClause *C; |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1830 | switch (Reader->Record.readInt()) { |
Alexey Bataev | aadd52e | 2014-02-13 05:29:23 +0000 | [diff] [blame] | 1831 | case OMPC_if: |
| 1832 | C = new (Context) OMPIfClause(); |
| 1833 | break; |
Alexey Bataev | 3778b60 | 2014-07-17 07:32:53 +0000 | [diff] [blame] | 1834 | case OMPC_final: |
| 1835 | C = new (Context) OMPFinalClause(); |
| 1836 | break; |
Alexey Bataev | 568a833 | 2014-03-06 06:15:19 +0000 | [diff] [blame] | 1837 | case OMPC_num_threads: |
| 1838 | C = new (Context) OMPNumThreadsClause(); |
| 1839 | break; |
Alexey Bataev | 62c87d2 | 2014-03-21 04:51:18 +0000 | [diff] [blame] | 1840 | case OMPC_safelen: |
| 1841 | C = new (Context) OMPSafelenClause(); |
| 1842 | break; |
Alexey Bataev | 66b15b5 | 2015-08-21 11:14:16 +0000 | [diff] [blame] | 1843 | case OMPC_simdlen: |
| 1844 | C = new (Context) OMPSimdlenClause(); |
| 1845 | break; |
Alexander Musman | 8bd31e6 | 2014-05-27 15:12:19 +0000 | [diff] [blame] | 1846 | case OMPC_collapse: |
| 1847 | C = new (Context) OMPCollapseClause(); |
| 1848 | break; |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 1849 | case OMPC_default: |
| 1850 | C = new (Context) OMPDefaultClause(); |
| 1851 | break; |
Alexey Bataev | bcbadb6 | 2014-05-06 06:04:14 +0000 | [diff] [blame] | 1852 | case OMPC_proc_bind: |
| 1853 | C = new (Context) OMPProcBindClause(); |
| 1854 | break; |
Alexey Bataev | 56dafe8 | 2014-06-20 07:16:17 +0000 | [diff] [blame] | 1855 | case OMPC_schedule: |
| 1856 | C = new (Context) OMPScheduleClause(); |
| 1857 | break; |
Alexey Bataev | 142e1fc | 2014-06-20 09:44:06 +0000 | [diff] [blame] | 1858 | case OMPC_ordered: |
| 1859 | C = new (Context) OMPOrderedClause(); |
| 1860 | break; |
Alexey Bataev | 236070f | 2014-06-20 11:19:47 +0000 | [diff] [blame] | 1861 | case OMPC_nowait: |
| 1862 | C = new (Context) OMPNowaitClause(); |
| 1863 | break; |
Alexey Bataev | 7aea99a | 2014-07-17 12:19:31 +0000 | [diff] [blame] | 1864 | case OMPC_untied: |
| 1865 | C = new (Context) OMPUntiedClause(); |
| 1866 | break; |
Alexey Bataev | 74ba3a5 | 2014-07-17 12:47:03 +0000 | [diff] [blame] | 1867 | case OMPC_mergeable: |
| 1868 | C = new (Context) OMPMergeableClause(); |
| 1869 | break; |
Alexey Bataev | f98b00c | 2014-07-23 02:27:21 +0000 | [diff] [blame] | 1870 | case OMPC_read: |
| 1871 | C = new (Context) OMPReadClause(); |
| 1872 | break; |
Alexey Bataev | dea4761 | 2014-07-23 07:46:59 +0000 | [diff] [blame] | 1873 | case OMPC_write: |
| 1874 | C = new (Context) OMPWriteClause(); |
| 1875 | break; |
Alexey Bataev | 67a4f22 | 2014-07-23 10:25:33 +0000 | [diff] [blame] | 1876 | case OMPC_update: |
| 1877 | C = new (Context) OMPUpdateClause(); |
| 1878 | break; |
Alexey Bataev | 459dec0 | 2014-07-24 06:46:57 +0000 | [diff] [blame] | 1879 | case OMPC_capture: |
| 1880 | C = new (Context) OMPCaptureClause(); |
| 1881 | break; |
Alexey Bataev | 82bad8b | 2014-07-24 08:55:34 +0000 | [diff] [blame] | 1882 | case OMPC_seq_cst: |
| 1883 | C = new (Context) OMPSeqCstClause(); |
| 1884 | break; |
Alexey Bataev | 346265e | 2015-09-25 10:37:12 +0000 | [diff] [blame] | 1885 | case OMPC_threads: |
| 1886 | C = new (Context) OMPThreadsClause(); |
| 1887 | break; |
Alexey Bataev | d14d1e6 | 2015-09-28 06:39:35 +0000 | [diff] [blame] | 1888 | case OMPC_simd: |
| 1889 | C = new (Context) OMPSIMDClause(); |
| 1890 | break; |
Alexey Bataev | b825de1 | 2015-12-07 10:51:44 +0000 | [diff] [blame] | 1891 | case OMPC_nogroup: |
| 1892 | C = new (Context) OMPNogroupClause(); |
| 1893 | break; |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 1894 | case OMPC_private: |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1895 | C = OMPPrivateClause::CreateEmpty(Context, Reader->Record.readInt()); |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 1896 | break; |
Alexey Bataev | d5af8e4 | 2013-10-01 05:32:34 +0000 | [diff] [blame] | 1897 | case OMPC_firstprivate: |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1898 | C = OMPFirstprivateClause::CreateEmpty(Context, Reader->Record.readInt()); |
Alexey Bataev | d5af8e4 | 2013-10-01 05:32:34 +0000 | [diff] [blame] | 1899 | break; |
Alexander Musman | 1bb328c | 2014-06-04 13:06:39 +0000 | [diff] [blame] | 1900 | case OMPC_lastprivate: |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1901 | C = OMPLastprivateClause::CreateEmpty(Context, Reader->Record.readInt()); |
Alexander Musman | 1bb328c | 2014-06-04 13:06:39 +0000 | [diff] [blame] | 1902 | break; |
Alexey Bataev | 758e55e | 2013-09-06 18:03:48 +0000 | [diff] [blame] | 1903 | case OMPC_shared: |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1904 | C = OMPSharedClause::CreateEmpty(Context, Reader->Record.readInt()); |
Alexey Bataev | 758e55e | 2013-09-06 18:03:48 +0000 | [diff] [blame] | 1905 | break; |
Alexey Bataev | c5e0258 | 2014-06-16 07:08:35 +0000 | [diff] [blame] | 1906 | case OMPC_reduction: |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1907 | C = OMPReductionClause::CreateEmpty(Context, Reader->Record.readInt()); |
Alexey Bataev | c5e0258 | 2014-06-16 07:08:35 +0000 | [diff] [blame] | 1908 | break; |
Alexey Bataev | 169d96a | 2017-07-18 20:17:46 +0000 | [diff] [blame] | 1909 | case OMPC_task_reduction: |
| 1910 | C = OMPTaskReductionClause::CreateEmpty(Context, Reader->Record.readInt()); |
| 1911 | break; |
Alexey Bataev | fa312f3 | 2017-07-21 18:48:21 +0000 | [diff] [blame] | 1912 | case OMPC_in_reduction: |
| 1913 | C = OMPInReductionClause::CreateEmpty(Context, Reader->Record.readInt()); |
| 1914 | break; |
Alexander Musman | 8dba664 | 2014-04-22 13:09:42 +0000 | [diff] [blame] | 1915 | case OMPC_linear: |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1916 | C = OMPLinearClause::CreateEmpty(Context, Reader->Record.readInt()); |
Alexander Musman | 8dba664 | 2014-04-22 13:09:42 +0000 | [diff] [blame] | 1917 | break; |
Alexander Musman | f0d76e7 | 2014-05-29 14:36:25 +0000 | [diff] [blame] | 1918 | case OMPC_aligned: |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1919 | C = OMPAlignedClause::CreateEmpty(Context, Reader->Record.readInt()); |
Alexander Musman | f0d76e7 | 2014-05-29 14:36:25 +0000 | [diff] [blame] | 1920 | break; |
Alexey Bataev | d48bcd8 | 2014-03-31 03:36:38 +0000 | [diff] [blame] | 1921 | case OMPC_copyin: |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1922 | C = OMPCopyinClause::CreateEmpty(Context, Reader->Record.readInt()); |
Alexey Bataev | d48bcd8 | 2014-03-31 03:36:38 +0000 | [diff] [blame] | 1923 | break; |
Alexey Bataev | bae9a79 | 2014-06-27 10:37:06 +0000 | [diff] [blame] | 1924 | case OMPC_copyprivate: |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1925 | C = OMPCopyprivateClause::CreateEmpty(Context, Reader->Record.readInt()); |
Alexey Bataev | bae9a79 | 2014-06-27 10:37:06 +0000 | [diff] [blame] | 1926 | break; |
Alexey Bataev | 6125da9 | 2014-07-21 11:26:11 +0000 | [diff] [blame] | 1927 | case OMPC_flush: |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1928 | C = OMPFlushClause::CreateEmpty(Context, Reader->Record.readInt()); |
Alexey Bataev | 6125da9 | 2014-07-21 11:26:11 +0000 | [diff] [blame] | 1929 | break; |
Alexey Bataev | 1c2cfbc | 2015-06-23 14:25:19 +0000 | [diff] [blame] | 1930 | case OMPC_depend: |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1931 | C = OMPDependClause::CreateEmpty(Context, Reader->Record.readInt()); |
Alexey Bataev | 1c2cfbc | 2015-06-23 14:25:19 +0000 | [diff] [blame] | 1932 | break; |
Michael Wong | e710d54 | 2015-08-07 16:16:36 +0000 | [diff] [blame] | 1933 | case OMPC_device: |
| 1934 | C = new (Context) OMPDeviceClause(); |
| 1935 | break; |
Samuel Antao | 9092700 | 2016-04-26 14:54:23 +0000 | [diff] [blame] | 1936 | case OMPC_map: { |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1937 | unsigned NumVars = Reader->Record.readInt(); |
| 1938 | unsigned NumDeclarations = Reader->Record.readInt(); |
| 1939 | unsigned NumLists = Reader->Record.readInt(); |
| 1940 | unsigned NumComponents = Reader->Record.readInt(); |
Samuel Antao | 9092700 | 2016-04-26 14:54:23 +0000 | [diff] [blame] | 1941 | C = OMPMapClause::CreateEmpty(Context, NumVars, NumDeclarations, NumLists, |
| 1942 | NumComponents); |
Kelvin Li | 0bff7af | 2015-11-23 05:32:03 +0000 | [diff] [blame] | 1943 | break; |
Samuel Antao | 9092700 | 2016-04-26 14:54:23 +0000 | [diff] [blame] | 1944 | } |
Kelvin Li | 099bb8c | 2015-11-24 20:50:12 +0000 | [diff] [blame] | 1945 | case OMPC_num_teams: |
| 1946 | C = new (Context) OMPNumTeamsClause(); |
| 1947 | break; |
Kelvin Li | a15fb1a | 2015-11-27 18:47:36 +0000 | [diff] [blame] | 1948 | case OMPC_thread_limit: |
| 1949 | C = new (Context) OMPThreadLimitClause(); |
| 1950 | break; |
Alexey Bataev | a056935 | 2015-12-01 10:17:31 +0000 | [diff] [blame] | 1951 | case OMPC_priority: |
| 1952 | C = new (Context) OMPPriorityClause(); |
| 1953 | break; |
Alexey Bataev | 1fd4aed | 2015-12-07 12:52:51 +0000 | [diff] [blame] | 1954 | case OMPC_grainsize: |
| 1955 | C = new (Context) OMPGrainsizeClause(); |
| 1956 | break; |
Alexey Bataev | 382967a | 2015-12-08 12:06:20 +0000 | [diff] [blame] | 1957 | case OMPC_num_tasks: |
| 1958 | C = new (Context) OMPNumTasksClause(); |
| 1959 | break; |
Alexey Bataev | 28c7541 | 2015-12-15 08:19:24 +0000 | [diff] [blame] | 1960 | case OMPC_hint: |
| 1961 | C = new (Context) OMPHintClause(); |
| 1962 | break; |
Carlo Bertolli | b4adf55 | 2016-01-15 18:50:31 +0000 | [diff] [blame] | 1963 | case OMPC_dist_schedule: |
| 1964 | C = new (Context) OMPDistScheduleClause(); |
| 1965 | break; |
Arpith Chacko Jacob | 3cf8904 | 2016-01-26 16:37:23 +0000 | [diff] [blame] | 1966 | case OMPC_defaultmap: |
| 1967 | C = new (Context) OMPDefaultmapClause(); |
| 1968 | break; |
Samuel Antao | 661c090 | 2016-05-26 17:39:58 +0000 | [diff] [blame] | 1969 | case OMPC_to: { |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1970 | unsigned NumVars = Reader->Record.readInt(); |
| 1971 | unsigned NumDeclarations = Reader->Record.readInt(); |
| 1972 | unsigned NumLists = Reader->Record.readInt(); |
| 1973 | unsigned NumComponents = Reader->Record.readInt(); |
Samuel Antao | 661c090 | 2016-05-26 17:39:58 +0000 | [diff] [blame] | 1974 | C = OMPToClause::CreateEmpty(Context, NumVars, NumDeclarations, NumLists, |
| 1975 | NumComponents); |
| 1976 | break; |
| 1977 | } |
Samuel Antao | ec172c6 | 2016-05-26 17:49:04 +0000 | [diff] [blame] | 1978 | case OMPC_from: { |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1979 | unsigned NumVars = Reader->Record.readInt(); |
| 1980 | unsigned NumDeclarations = Reader->Record.readInt(); |
| 1981 | unsigned NumLists = Reader->Record.readInt(); |
| 1982 | unsigned NumComponents = Reader->Record.readInt(); |
Samuel Antao | ec172c6 | 2016-05-26 17:49:04 +0000 | [diff] [blame] | 1983 | C = OMPFromClause::CreateEmpty(Context, NumVars, NumDeclarations, NumLists, |
| 1984 | NumComponents); |
| 1985 | break; |
| 1986 | } |
Samuel Antao | cc10b85 | 2016-07-28 14:23:26 +0000 | [diff] [blame] | 1987 | case OMPC_use_device_ptr: { |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1988 | unsigned NumVars = Reader->Record.readInt(); |
| 1989 | unsigned NumDeclarations = Reader->Record.readInt(); |
| 1990 | unsigned NumLists = Reader->Record.readInt(); |
| 1991 | unsigned NumComponents = Reader->Record.readInt(); |
Samuel Antao | cc10b85 | 2016-07-28 14:23:26 +0000 | [diff] [blame] | 1992 | C = OMPUseDevicePtrClause::CreateEmpty(Context, NumVars, NumDeclarations, |
| 1993 | NumLists, NumComponents); |
Carlo Bertolli | 2404b17 | 2016-07-13 15:37:16 +0000 | [diff] [blame] | 1994 | break; |
Samuel Antao | cc10b85 | 2016-07-28 14:23:26 +0000 | [diff] [blame] | 1995 | } |
Samuel Antao | 6890b09 | 2016-07-28 14:25:09 +0000 | [diff] [blame] | 1996 | case OMPC_is_device_ptr: { |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1997 | unsigned NumVars = Reader->Record.readInt(); |
| 1998 | unsigned NumDeclarations = Reader->Record.readInt(); |
| 1999 | unsigned NumLists = Reader->Record.readInt(); |
| 2000 | unsigned NumComponents = Reader->Record.readInt(); |
Samuel Antao | 6890b09 | 2016-07-28 14:25:09 +0000 | [diff] [blame] | 2001 | C = OMPIsDevicePtrClause::CreateEmpty(Context, NumVars, NumDeclarations, |
| 2002 | NumLists, NumComponents); |
Carlo Bertolli | 70594e9 | 2016-07-13 17:16:49 +0000 | [diff] [blame] | 2003 | break; |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 2004 | } |
Samuel Antao | 6890b09 | 2016-07-28 14:25:09 +0000 | [diff] [blame] | 2005 | } |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 2006 | Visit(C); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2007 | C->setLocStart(Reader->ReadSourceLocation()); |
| 2008 | C->setLocEnd(Reader->ReadSourceLocation()); |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 2009 | |
| 2010 | return C; |
| 2011 | } |
| 2012 | |
Alexey Bataev | 3392d76 | 2016-02-16 11:18:12 +0000 | [diff] [blame] | 2013 | void OMPClauseReader::VisitOMPClauseWithPreInit(OMPClauseWithPreInit *C) { |
Arpith Chacko Jacob | fe4890a | 2017-01-18 20:40:48 +0000 | [diff] [blame] | 2014 | C->setPreInitStmt(Reader->Record.readSubStmt(), |
| 2015 | static_cast<OpenMPDirectiveKind>(Reader->Record.readInt())); |
Alexey Bataev | 3392d76 | 2016-02-16 11:18:12 +0000 | [diff] [blame] | 2016 | } |
| 2017 | |
Alexey Bataev | 005248a | 2016-02-25 05:25:57 +0000 | [diff] [blame] | 2018 | void OMPClauseReader::VisitOMPClauseWithPostUpdate(OMPClauseWithPostUpdate *C) { |
Alexey Bataev | 37e594c | 2016-03-04 07:21:16 +0000 | [diff] [blame] | 2019 | VisitOMPClauseWithPreInit(C); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2020 | C->setPostUpdateExpr(Reader->Record.readSubExpr()); |
Alexey Bataev | 005248a | 2016-02-25 05:25:57 +0000 | [diff] [blame] | 2021 | } |
| 2022 | |
Alexey Bataev | aadd52e | 2014-02-13 05:29:23 +0000 | [diff] [blame] | 2023 | void OMPClauseReader::VisitOMPIfClause(OMPIfClause *C) { |
Arpith Chacko Jacob | fe4890a | 2017-01-18 20:40:48 +0000 | [diff] [blame] | 2024 | VisitOMPClauseWithPreInit(C); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2025 | C->setNameModifier(static_cast<OpenMPDirectiveKind>(Reader->Record.readInt())); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2026 | C->setNameModifierLoc(Reader->ReadSourceLocation()); |
| 2027 | C->setColonLoc(Reader->ReadSourceLocation()); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2028 | C->setCondition(Reader->Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2029 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Alexey Bataev | aadd52e | 2014-02-13 05:29:23 +0000 | [diff] [blame] | 2030 | } |
| 2031 | |
Alexey Bataev | 3778b60 | 2014-07-17 07:32:53 +0000 | [diff] [blame] | 2032 | void OMPClauseReader::VisitOMPFinalClause(OMPFinalClause *C) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2033 | C->setCondition(Reader->Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2034 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Alexey Bataev | 3778b60 | 2014-07-17 07:32:53 +0000 | [diff] [blame] | 2035 | } |
| 2036 | |
Alexey Bataev | 568a833 | 2014-03-06 06:15:19 +0000 | [diff] [blame] | 2037 | void OMPClauseReader::VisitOMPNumThreadsClause(OMPNumThreadsClause *C) { |
Arpith Chacko Jacob | 33c849a | 2017-01-25 00:57:16 +0000 | [diff] [blame] | 2038 | VisitOMPClauseWithPreInit(C); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2039 | C->setNumThreads(Reader->Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2040 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Alexey Bataev | 568a833 | 2014-03-06 06:15:19 +0000 | [diff] [blame] | 2041 | } |
| 2042 | |
Alexey Bataev | 62c87d2 | 2014-03-21 04:51:18 +0000 | [diff] [blame] | 2043 | void OMPClauseReader::VisitOMPSafelenClause(OMPSafelenClause *C) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2044 | C->setSafelen(Reader->Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2045 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Alexey Bataev | 62c87d2 | 2014-03-21 04:51:18 +0000 | [diff] [blame] | 2046 | } |
| 2047 | |
Alexey Bataev | 66b15b5 | 2015-08-21 11:14:16 +0000 | [diff] [blame] | 2048 | void OMPClauseReader::VisitOMPSimdlenClause(OMPSimdlenClause *C) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2049 | C->setSimdlen(Reader->Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2050 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Alexey Bataev | 66b15b5 | 2015-08-21 11:14:16 +0000 | [diff] [blame] | 2051 | } |
| 2052 | |
Alexander Musman | 8bd31e6 | 2014-05-27 15:12:19 +0000 | [diff] [blame] | 2053 | void OMPClauseReader::VisitOMPCollapseClause(OMPCollapseClause *C) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2054 | C->setNumForLoops(Reader->Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2055 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Alexander Musman | 8bd31e6 | 2014-05-27 15:12:19 +0000 | [diff] [blame] | 2056 | } |
| 2057 | |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 2058 | void OMPClauseReader::VisitOMPDefaultClause(OMPDefaultClause *C) { |
| 2059 | C->setDefaultKind( |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2060 | static_cast<OpenMPDefaultClauseKind>(Reader->Record.readInt())); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2061 | C->setLParenLoc(Reader->ReadSourceLocation()); |
| 2062 | C->setDefaultKindKwLoc(Reader->ReadSourceLocation()); |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 2063 | } |
| 2064 | |
Alexey Bataev | bcbadb6 | 2014-05-06 06:04:14 +0000 | [diff] [blame] | 2065 | void OMPClauseReader::VisitOMPProcBindClause(OMPProcBindClause *C) { |
| 2066 | C->setProcBindKind( |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2067 | static_cast<OpenMPProcBindClauseKind>(Reader->Record.readInt())); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2068 | C->setLParenLoc(Reader->ReadSourceLocation()); |
| 2069 | C->setProcBindKindKwLoc(Reader->ReadSourceLocation()); |
Alexey Bataev | bcbadb6 | 2014-05-06 06:04:14 +0000 | [diff] [blame] | 2070 | } |
| 2071 | |
Alexey Bataev | 56dafe8 | 2014-06-20 07:16:17 +0000 | [diff] [blame] | 2072 | void OMPClauseReader::VisitOMPScheduleClause(OMPScheduleClause *C) { |
Alexey Bataev | 3392d76 | 2016-02-16 11:18:12 +0000 | [diff] [blame] | 2073 | VisitOMPClauseWithPreInit(C); |
Alexey Bataev | 56dafe8 | 2014-06-20 07:16:17 +0000 | [diff] [blame] | 2074 | C->setScheduleKind( |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2075 | static_cast<OpenMPScheduleClauseKind>(Reader->Record.readInt())); |
Alexey Bataev | 6402bca | 2015-12-28 07:25:51 +0000 | [diff] [blame] | 2076 | C->setFirstScheduleModifier( |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2077 | static_cast<OpenMPScheduleClauseModifier>(Reader->Record.readInt())); |
Alexey Bataev | 6402bca | 2015-12-28 07:25:51 +0000 | [diff] [blame] | 2078 | C->setSecondScheduleModifier( |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2079 | static_cast<OpenMPScheduleClauseModifier>(Reader->Record.readInt())); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2080 | C->setChunkSize(Reader->Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2081 | C->setLParenLoc(Reader->ReadSourceLocation()); |
| 2082 | C->setFirstScheduleModifierLoc(Reader->ReadSourceLocation()); |
| 2083 | C->setSecondScheduleModifierLoc(Reader->ReadSourceLocation()); |
| 2084 | C->setScheduleKindLoc(Reader->ReadSourceLocation()); |
| 2085 | C->setCommaLoc(Reader->ReadSourceLocation()); |
Alexey Bataev | 56dafe8 | 2014-06-20 07:16:17 +0000 | [diff] [blame] | 2086 | } |
| 2087 | |
Alexey Bataev | 10e775f | 2015-07-30 11:36:16 +0000 | [diff] [blame] | 2088 | void OMPClauseReader::VisitOMPOrderedClause(OMPOrderedClause *C) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2089 | C->setNumForLoops(Reader->Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2090 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Alexey Bataev | 10e775f | 2015-07-30 11:36:16 +0000 | [diff] [blame] | 2091 | } |
Alexey Bataev | 142e1fc | 2014-06-20 09:44:06 +0000 | [diff] [blame] | 2092 | |
Alexey Bataev | 236070f | 2014-06-20 11:19:47 +0000 | [diff] [blame] | 2093 | void OMPClauseReader::VisitOMPNowaitClause(OMPNowaitClause *) {} |
| 2094 | |
Alexey Bataev | 7aea99a | 2014-07-17 12:19:31 +0000 | [diff] [blame] | 2095 | void OMPClauseReader::VisitOMPUntiedClause(OMPUntiedClause *) {} |
| 2096 | |
Alexey Bataev | 74ba3a5 | 2014-07-17 12:47:03 +0000 | [diff] [blame] | 2097 | void OMPClauseReader::VisitOMPMergeableClause(OMPMergeableClause *) {} |
| 2098 | |
Alexey Bataev | f98b00c | 2014-07-23 02:27:21 +0000 | [diff] [blame] | 2099 | void OMPClauseReader::VisitOMPReadClause(OMPReadClause *) {} |
| 2100 | |
Alexey Bataev | dea4761 | 2014-07-23 07:46:59 +0000 | [diff] [blame] | 2101 | void OMPClauseReader::VisitOMPWriteClause(OMPWriteClause *) {} |
| 2102 | |
Alexey Bataev | 67a4f22 | 2014-07-23 10:25:33 +0000 | [diff] [blame] | 2103 | void OMPClauseReader::VisitOMPUpdateClause(OMPUpdateClause *) {} |
| 2104 | |
Alexey Bataev | 459dec0 | 2014-07-24 06:46:57 +0000 | [diff] [blame] | 2105 | void OMPClauseReader::VisitOMPCaptureClause(OMPCaptureClause *) {} |
| 2106 | |
Alexey Bataev | 82bad8b | 2014-07-24 08:55:34 +0000 | [diff] [blame] | 2107 | void OMPClauseReader::VisitOMPSeqCstClause(OMPSeqCstClause *) {} |
| 2108 | |
Alexey Bataev | 346265e | 2015-09-25 10:37:12 +0000 | [diff] [blame] | 2109 | void OMPClauseReader::VisitOMPThreadsClause(OMPThreadsClause *) {} |
| 2110 | |
Alexey Bataev | d14d1e6 | 2015-09-28 06:39:35 +0000 | [diff] [blame] | 2111 | void OMPClauseReader::VisitOMPSIMDClause(OMPSIMDClause *) {} |
| 2112 | |
Alexey Bataev | b825de1 | 2015-12-07 10:51:44 +0000 | [diff] [blame] | 2113 | void OMPClauseReader::VisitOMPNogroupClause(OMPNogroupClause *) {} |
| 2114 | |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 2115 | void OMPClauseReader::VisitOMPPrivateClause(OMPPrivateClause *C) { |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2116 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 2117 | unsigned NumVars = C->varlist_size(); |
| 2118 | SmallVector<Expr *, 16> Vars; |
| 2119 | Vars.reserve(NumVars); |
| 2120 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2121 | Vars.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 2122 | C->setVarRefs(Vars); |
Alexey Bataev | 03b340a | 2014-10-21 03:16:40 +0000 | [diff] [blame] | 2123 | Vars.clear(); |
| 2124 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2125 | Vars.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | 03b340a | 2014-10-21 03:16:40 +0000 | [diff] [blame] | 2126 | C->setPrivateCopies(Vars); |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 2127 | } |
| 2128 | |
Alexey Bataev | d5af8e4 | 2013-10-01 05:32:34 +0000 | [diff] [blame] | 2129 | void OMPClauseReader::VisitOMPFirstprivateClause(OMPFirstprivateClause *C) { |
Alexey Bataev | 417089f | 2016-02-17 13:19:37 +0000 | [diff] [blame] | 2130 | VisitOMPClauseWithPreInit(C); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2131 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Alexey Bataev | d5af8e4 | 2013-10-01 05:32:34 +0000 | [diff] [blame] | 2132 | unsigned NumVars = C->varlist_size(); |
| 2133 | SmallVector<Expr *, 16> Vars; |
| 2134 | Vars.reserve(NumVars); |
| 2135 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2136 | Vars.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | d5af8e4 | 2013-10-01 05:32:34 +0000 | [diff] [blame] | 2137 | C->setVarRefs(Vars); |
Alexey Bataev | 4a5bb77 | 2014-10-08 14:01:46 +0000 | [diff] [blame] | 2138 | Vars.clear(); |
| 2139 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2140 | Vars.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | 4a5bb77 | 2014-10-08 14:01:46 +0000 | [diff] [blame] | 2141 | C->setPrivateCopies(Vars); |
| 2142 | Vars.clear(); |
| 2143 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2144 | Vars.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | 4a5bb77 | 2014-10-08 14:01:46 +0000 | [diff] [blame] | 2145 | C->setInits(Vars); |
Alexey Bataev | d5af8e4 | 2013-10-01 05:32:34 +0000 | [diff] [blame] | 2146 | } |
| 2147 | |
Alexander Musman | 1bb328c | 2014-06-04 13:06:39 +0000 | [diff] [blame] | 2148 | void OMPClauseReader::VisitOMPLastprivateClause(OMPLastprivateClause *C) { |
Alexey Bataev | 005248a | 2016-02-25 05:25:57 +0000 | [diff] [blame] | 2149 | VisitOMPClauseWithPostUpdate(C); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2150 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Alexander Musman | 1bb328c | 2014-06-04 13:06:39 +0000 | [diff] [blame] | 2151 | unsigned NumVars = C->varlist_size(); |
| 2152 | SmallVector<Expr *, 16> Vars; |
| 2153 | Vars.reserve(NumVars); |
| 2154 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2155 | Vars.push_back(Reader->Record.readSubExpr()); |
Alexander Musman | 1bb328c | 2014-06-04 13:06:39 +0000 | [diff] [blame] | 2156 | C->setVarRefs(Vars); |
Alexey Bataev | 38e8953 | 2015-04-16 04:54:05 +0000 | [diff] [blame] | 2157 | Vars.clear(); |
| 2158 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2159 | Vars.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | 38e8953 | 2015-04-16 04:54:05 +0000 | [diff] [blame] | 2160 | C->setPrivateCopies(Vars); |
| 2161 | Vars.clear(); |
| 2162 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2163 | Vars.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | 38e8953 | 2015-04-16 04:54:05 +0000 | [diff] [blame] | 2164 | C->setSourceExprs(Vars); |
| 2165 | Vars.clear(); |
| 2166 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2167 | Vars.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | 38e8953 | 2015-04-16 04:54:05 +0000 | [diff] [blame] | 2168 | C->setDestinationExprs(Vars); |
| 2169 | Vars.clear(); |
| 2170 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2171 | Vars.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | 38e8953 | 2015-04-16 04:54:05 +0000 | [diff] [blame] | 2172 | C->setAssignmentOps(Vars); |
Alexander Musman | 1bb328c | 2014-06-04 13:06:39 +0000 | [diff] [blame] | 2173 | } |
| 2174 | |
Alexey Bataev | 758e55e | 2013-09-06 18:03:48 +0000 | [diff] [blame] | 2175 | void OMPClauseReader::VisitOMPSharedClause(OMPSharedClause *C) { |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2176 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Alexey Bataev | 758e55e | 2013-09-06 18:03:48 +0000 | [diff] [blame] | 2177 | unsigned NumVars = C->varlist_size(); |
| 2178 | SmallVector<Expr *, 16> Vars; |
| 2179 | Vars.reserve(NumVars); |
| 2180 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2181 | Vars.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | 758e55e | 2013-09-06 18:03:48 +0000 | [diff] [blame] | 2182 | C->setVarRefs(Vars); |
| 2183 | } |
| 2184 | |
Alexey Bataev | c5e0258 | 2014-06-16 07:08:35 +0000 | [diff] [blame] | 2185 | void OMPClauseReader::VisitOMPReductionClause(OMPReductionClause *C) { |
Alexey Bataev | 6120507 | 2016-03-02 04:57:40 +0000 | [diff] [blame] | 2186 | VisitOMPClauseWithPostUpdate(C); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2187 | C->setLParenLoc(Reader->ReadSourceLocation()); |
| 2188 | C->setColonLoc(Reader->ReadSourceLocation()); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2189 | NestedNameSpecifierLoc NNSL = Reader->Record.readNestedNameSpecifierLoc(); |
Alexey Bataev | c5e0258 | 2014-06-16 07:08:35 +0000 | [diff] [blame] | 2190 | DeclarationNameInfo DNI; |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2191 | Reader->ReadDeclarationNameInfo(DNI); |
Alexey Bataev | c5e0258 | 2014-06-16 07:08:35 +0000 | [diff] [blame] | 2192 | C->setQualifierLoc(NNSL); |
| 2193 | C->setNameInfo(DNI); |
| 2194 | |
| 2195 | unsigned NumVars = C->varlist_size(); |
| 2196 | SmallVector<Expr *, 16> Vars; |
| 2197 | Vars.reserve(NumVars); |
| 2198 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2199 | Vars.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | c5e0258 | 2014-06-16 07:08:35 +0000 | [diff] [blame] | 2200 | C->setVarRefs(Vars); |
Alexey Bataev | 794ba0d | 2015-04-10 10:43:45 +0000 | [diff] [blame] | 2201 | Vars.clear(); |
| 2202 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2203 | Vars.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | f24e7b1 | 2015-10-08 09:10:53 +0000 | [diff] [blame] | 2204 | C->setPrivates(Vars); |
| 2205 | Vars.clear(); |
| 2206 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2207 | Vars.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | 794ba0d | 2015-04-10 10:43:45 +0000 | [diff] [blame] | 2208 | C->setLHSExprs(Vars); |
| 2209 | Vars.clear(); |
| 2210 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2211 | Vars.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | 794ba0d | 2015-04-10 10:43:45 +0000 | [diff] [blame] | 2212 | C->setRHSExprs(Vars); |
| 2213 | Vars.clear(); |
| 2214 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2215 | Vars.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | 794ba0d | 2015-04-10 10:43:45 +0000 | [diff] [blame] | 2216 | C->setReductionOps(Vars); |
Alexey Bataev | c5e0258 | 2014-06-16 07:08:35 +0000 | [diff] [blame] | 2217 | } |
| 2218 | |
Alexey Bataev | 169d96a | 2017-07-18 20:17:46 +0000 | [diff] [blame] | 2219 | void OMPClauseReader::VisitOMPTaskReductionClause(OMPTaskReductionClause *C) { |
| 2220 | VisitOMPClauseWithPostUpdate(C); |
| 2221 | C->setLParenLoc(Reader->ReadSourceLocation()); |
| 2222 | C->setColonLoc(Reader->ReadSourceLocation()); |
| 2223 | NestedNameSpecifierLoc NNSL = Reader->Record.readNestedNameSpecifierLoc(); |
| 2224 | DeclarationNameInfo DNI; |
| 2225 | Reader->ReadDeclarationNameInfo(DNI); |
| 2226 | C->setQualifierLoc(NNSL); |
| 2227 | C->setNameInfo(DNI); |
| 2228 | |
| 2229 | unsigned NumVars = C->varlist_size(); |
| 2230 | SmallVector<Expr *, 16> Vars; |
| 2231 | Vars.reserve(NumVars); |
| 2232 | for (unsigned I = 0; I != NumVars; ++I) |
| 2233 | Vars.push_back(Reader->Record.readSubExpr()); |
| 2234 | C->setVarRefs(Vars); |
| 2235 | Vars.clear(); |
| 2236 | for (unsigned I = 0; I != NumVars; ++I) |
| 2237 | Vars.push_back(Reader->Record.readSubExpr()); |
| 2238 | C->setPrivates(Vars); |
| 2239 | Vars.clear(); |
| 2240 | for (unsigned I = 0; I != NumVars; ++I) |
| 2241 | Vars.push_back(Reader->Record.readSubExpr()); |
| 2242 | C->setLHSExprs(Vars); |
| 2243 | Vars.clear(); |
| 2244 | for (unsigned I = 0; I != NumVars; ++I) |
| 2245 | Vars.push_back(Reader->Record.readSubExpr()); |
| 2246 | C->setRHSExprs(Vars); |
| 2247 | Vars.clear(); |
| 2248 | for (unsigned I = 0; I != NumVars; ++I) |
| 2249 | Vars.push_back(Reader->Record.readSubExpr()); |
| 2250 | C->setReductionOps(Vars); |
| 2251 | } |
| 2252 | |
Alexey Bataev | fa312f3 | 2017-07-21 18:48:21 +0000 | [diff] [blame] | 2253 | void OMPClauseReader::VisitOMPInReductionClause(OMPInReductionClause *C) { |
| 2254 | VisitOMPClauseWithPostUpdate(C); |
| 2255 | C->setLParenLoc(Reader->ReadSourceLocation()); |
| 2256 | C->setColonLoc(Reader->ReadSourceLocation()); |
| 2257 | NestedNameSpecifierLoc NNSL = Reader->Record.readNestedNameSpecifierLoc(); |
| 2258 | DeclarationNameInfo DNI; |
| 2259 | Reader->ReadDeclarationNameInfo(DNI); |
| 2260 | C->setQualifierLoc(NNSL); |
| 2261 | C->setNameInfo(DNI); |
| 2262 | |
| 2263 | unsigned NumVars = C->varlist_size(); |
| 2264 | SmallVector<Expr *, 16> Vars; |
| 2265 | Vars.reserve(NumVars); |
| 2266 | for (unsigned I = 0; I != NumVars; ++I) |
| 2267 | Vars.push_back(Reader->Record.readSubExpr()); |
| 2268 | C->setVarRefs(Vars); |
| 2269 | Vars.clear(); |
| 2270 | for (unsigned I = 0; I != NumVars; ++I) |
| 2271 | Vars.push_back(Reader->Record.readSubExpr()); |
| 2272 | C->setPrivates(Vars); |
| 2273 | Vars.clear(); |
| 2274 | for (unsigned I = 0; I != NumVars; ++I) |
| 2275 | Vars.push_back(Reader->Record.readSubExpr()); |
| 2276 | C->setLHSExprs(Vars); |
| 2277 | Vars.clear(); |
| 2278 | for (unsigned I = 0; I != NumVars; ++I) |
| 2279 | Vars.push_back(Reader->Record.readSubExpr()); |
| 2280 | C->setRHSExprs(Vars); |
| 2281 | Vars.clear(); |
| 2282 | for (unsigned I = 0; I != NumVars; ++I) |
| 2283 | Vars.push_back(Reader->Record.readSubExpr()); |
| 2284 | C->setReductionOps(Vars); |
Alexey Bataev | 88202be | 2017-07-27 13:20:36 +0000 | [diff] [blame] | 2285 | Vars.clear(); |
| 2286 | for (unsigned I = 0; I != NumVars; ++I) |
| 2287 | Vars.push_back(Reader->Record.readSubExpr()); |
| 2288 | C->setTaskgroupDescriptors(Vars); |
Alexey Bataev | fa312f3 | 2017-07-21 18:48:21 +0000 | [diff] [blame] | 2289 | } |
| 2290 | |
Alexander Musman | 8dba664 | 2014-04-22 13:09:42 +0000 | [diff] [blame] | 2291 | void OMPClauseReader::VisitOMPLinearClause(OMPLinearClause *C) { |
Alexey Bataev | 78849fb | 2016-03-09 09:49:00 +0000 | [diff] [blame] | 2292 | VisitOMPClauseWithPostUpdate(C); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2293 | C->setLParenLoc(Reader->ReadSourceLocation()); |
| 2294 | C->setColonLoc(Reader->ReadSourceLocation()); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2295 | C->setModifier(static_cast<OpenMPLinearClauseKind>(Reader->Record.readInt())); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2296 | C->setModifierLoc(Reader->ReadSourceLocation()); |
Alexander Musman | 8dba664 | 2014-04-22 13:09:42 +0000 | [diff] [blame] | 2297 | unsigned NumVars = C->varlist_size(); |
| 2298 | SmallVector<Expr *, 16> Vars; |
| 2299 | Vars.reserve(NumVars); |
| 2300 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2301 | Vars.push_back(Reader->Record.readSubExpr()); |
Alexander Musman | 8dba664 | 2014-04-22 13:09:42 +0000 | [diff] [blame] | 2302 | C->setVarRefs(Vars); |
Alexander Musman | 3276a27 | 2015-03-21 10:12:56 +0000 | [diff] [blame] | 2303 | Vars.clear(); |
| 2304 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2305 | Vars.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | bd9fec1 | 2015-08-18 06:47:21 +0000 | [diff] [blame] | 2306 | C->setPrivates(Vars); |
| 2307 | Vars.clear(); |
| 2308 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2309 | Vars.push_back(Reader->Record.readSubExpr()); |
Alexander Musman | 3276a27 | 2015-03-21 10:12:56 +0000 | [diff] [blame] | 2310 | C->setInits(Vars); |
| 2311 | Vars.clear(); |
| 2312 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2313 | Vars.push_back(Reader->Record.readSubExpr()); |
Alexander Musman | 3276a27 | 2015-03-21 10:12:56 +0000 | [diff] [blame] | 2314 | C->setUpdates(Vars); |
| 2315 | Vars.clear(); |
| 2316 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2317 | Vars.push_back(Reader->Record.readSubExpr()); |
Alexander Musman | 3276a27 | 2015-03-21 10:12:56 +0000 | [diff] [blame] | 2318 | C->setFinals(Vars); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2319 | C->setStep(Reader->Record.readSubExpr()); |
| 2320 | C->setCalcStep(Reader->Record.readSubExpr()); |
Alexander Musman | 8dba664 | 2014-04-22 13:09:42 +0000 | [diff] [blame] | 2321 | } |
| 2322 | |
Alexander Musman | f0d76e7 | 2014-05-29 14:36:25 +0000 | [diff] [blame] | 2323 | void OMPClauseReader::VisitOMPAlignedClause(OMPAlignedClause *C) { |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2324 | C->setLParenLoc(Reader->ReadSourceLocation()); |
| 2325 | C->setColonLoc(Reader->ReadSourceLocation()); |
Alexander Musman | f0d76e7 | 2014-05-29 14:36:25 +0000 | [diff] [blame] | 2326 | unsigned NumVars = C->varlist_size(); |
| 2327 | SmallVector<Expr *, 16> Vars; |
| 2328 | Vars.reserve(NumVars); |
| 2329 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2330 | Vars.push_back(Reader->Record.readSubExpr()); |
Alexander Musman | f0d76e7 | 2014-05-29 14:36:25 +0000 | [diff] [blame] | 2331 | C->setVarRefs(Vars); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2332 | C->setAlignment(Reader->Record.readSubExpr()); |
Alexander Musman | f0d76e7 | 2014-05-29 14:36:25 +0000 | [diff] [blame] | 2333 | } |
| 2334 | |
Alexey Bataev | d48bcd8 | 2014-03-31 03:36:38 +0000 | [diff] [blame] | 2335 | void OMPClauseReader::VisitOMPCopyinClause(OMPCopyinClause *C) { |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2336 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Alexey Bataev | d48bcd8 | 2014-03-31 03:36:38 +0000 | [diff] [blame] | 2337 | unsigned NumVars = C->varlist_size(); |
Alexey Bataev | f56f98c | 2015-04-16 05:39:01 +0000 | [diff] [blame] | 2338 | SmallVector<Expr *, 16> Exprs; |
| 2339 | Exprs.reserve(NumVars); |
Alexey Bataev | d48bcd8 | 2014-03-31 03:36:38 +0000 | [diff] [blame] | 2340 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2341 | Exprs.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | f56f98c | 2015-04-16 05:39:01 +0000 | [diff] [blame] | 2342 | C->setVarRefs(Exprs); |
| 2343 | Exprs.clear(); |
| 2344 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2345 | Exprs.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | f56f98c | 2015-04-16 05:39:01 +0000 | [diff] [blame] | 2346 | C->setSourceExprs(Exprs); |
| 2347 | Exprs.clear(); |
| 2348 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2349 | Exprs.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | f56f98c | 2015-04-16 05:39:01 +0000 | [diff] [blame] | 2350 | C->setDestinationExprs(Exprs); |
| 2351 | Exprs.clear(); |
| 2352 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2353 | Exprs.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | f56f98c | 2015-04-16 05:39:01 +0000 | [diff] [blame] | 2354 | C->setAssignmentOps(Exprs); |
Alexey Bataev | d48bcd8 | 2014-03-31 03:36:38 +0000 | [diff] [blame] | 2355 | } |
| 2356 | |
Alexey Bataev | bae9a79 | 2014-06-27 10:37:06 +0000 | [diff] [blame] | 2357 | void OMPClauseReader::VisitOMPCopyprivateClause(OMPCopyprivateClause *C) { |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2358 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Alexey Bataev | bae9a79 | 2014-06-27 10:37:06 +0000 | [diff] [blame] | 2359 | unsigned NumVars = C->varlist_size(); |
Alexey Bataev | a63048e | 2015-03-23 06:18:07 +0000 | [diff] [blame] | 2360 | SmallVector<Expr *, 16> Exprs; |
| 2361 | Exprs.reserve(NumVars); |
Alexey Bataev | bae9a79 | 2014-06-27 10:37:06 +0000 | [diff] [blame] | 2362 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2363 | Exprs.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | a63048e | 2015-03-23 06:18:07 +0000 | [diff] [blame] | 2364 | C->setVarRefs(Exprs); |
| 2365 | Exprs.clear(); |
| 2366 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2367 | Exprs.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | a63048e | 2015-03-23 06:18:07 +0000 | [diff] [blame] | 2368 | C->setSourceExprs(Exprs); |
| 2369 | Exprs.clear(); |
| 2370 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2371 | Exprs.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | a63048e | 2015-03-23 06:18:07 +0000 | [diff] [blame] | 2372 | C->setDestinationExprs(Exprs); |
| 2373 | Exprs.clear(); |
| 2374 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2375 | Exprs.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | a63048e | 2015-03-23 06:18:07 +0000 | [diff] [blame] | 2376 | C->setAssignmentOps(Exprs); |
Alexey Bataev | bae9a79 | 2014-06-27 10:37:06 +0000 | [diff] [blame] | 2377 | } |
| 2378 | |
Alexey Bataev | 6125da9 | 2014-07-21 11:26:11 +0000 | [diff] [blame] | 2379 | void OMPClauseReader::VisitOMPFlushClause(OMPFlushClause *C) { |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2380 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Alexey Bataev | 6125da9 | 2014-07-21 11:26:11 +0000 | [diff] [blame] | 2381 | unsigned NumVars = C->varlist_size(); |
| 2382 | SmallVector<Expr *, 16> Vars; |
| 2383 | Vars.reserve(NumVars); |
| 2384 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2385 | Vars.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | 6125da9 | 2014-07-21 11:26:11 +0000 | [diff] [blame] | 2386 | C->setVarRefs(Vars); |
| 2387 | } |
| 2388 | |
Alexey Bataev | 1c2cfbc | 2015-06-23 14:25:19 +0000 | [diff] [blame] | 2389 | void OMPClauseReader::VisitOMPDependClause(OMPDependClause *C) { |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2390 | C->setLParenLoc(Reader->ReadSourceLocation()); |
| 2391 | C->setDependencyKind( |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2392 | static_cast<OpenMPDependClauseKind>(Reader->Record.readInt())); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2393 | C->setDependencyLoc(Reader->ReadSourceLocation()); |
| 2394 | C->setColonLoc(Reader->ReadSourceLocation()); |
Alexey Bataev | 1c2cfbc | 2015-06-23 14:25:19 +0000 | [diff] [blame] | 2395 | unsigned NumVars = C->varlist_size(); |
| 2396 | SmallVector<Expr *, 16> Vars; |
| 2397 | Vars.reserve(NumVars); |
| 2398 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2399 | Vars.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | 1c2cfbc | 2015-06-23 14:25:19 +0000 | [diff] [blame] | 2400 | C->setVarRefs(Vars); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2401 | C->setCounterValue(Reader->Record.readSubExpr()); |
Alexey Bataev | 1c2cfbc | 2015-06-23 14:25:19 +0000 | [diff] [blame] | 2402 | } |
| 2403 | |
Michael Wong | e710d54 | 2015-08-07 16:16:36 +0000 | [diff] [blame] | 2404 | void OMPClauseReader::VisitOMPDeviceClause(OMPDeviceClause *C) { |
Alexey Bataev | 931e19b | 2017-10-02 16:32:39 +0000 | [diff] [blame] | 2405 | VisitOMPClauseWithPreInit(C); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2406 | C->setDevice(Reader->Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2407 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Michael Wong | e710d54 | 2015-08-07 16:16:36 +0000 | [diff] [blame] | 2408 | } |
| 2409 | |
Kelvin Li | 0bff7af | 2015-11-23 05:32:03 +0000 | [diff] [blame] | 2410 | void OMPClauseReader::VisitOMPMapClause(OMPMapClause *C) { |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2411 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Kelvin Li | 0bff7af | 2015-11-23 05:32:03 +0000 | [diff] [blame] | 2412 | C->setMapTypeModifier( |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2413 | static_cast<OpenMPMapClauseKind>(Reader->Record.readInt())); |
Kelvin Li | 0bff7af | 2015-11-23 05:32:03 +0000 | [diff] [blame] | 2414 | C->setMapType( |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2415 | static_cast<OpenMPMapClauseKind>(Reader->Record.readInt())); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2416 | C->setMapLoc(Reader->ReadSourceLocation()); |
| 2417 | C->setColonLoc(Reader->ReadSourceLocation()); |
Kelvin Li | 0bff7af | 2015-11-23 05:32:03 +0000 | [diff] [blame] | 2418 | auto NumVars = C->varlist_size(); |
Samuel Antao | 9092700 | 2016-04-26 14:54:23 +0000 | [diff] [blame] | 2419 | auto UniqueDecls = C->getUniqueDeclarationsNum(); |
| 2420 | auto TotalLists = C->getTotalComponentListNum(); |
| 2421 | auto TotalComponents = C->getTotalComponentsNum(); |
| 2422 | |
Kelvin Li | 0bff7af | 2015-11-23 05:32:03 +0000 | [diff] [blame] | 2423 | SmallVector<Expr *, 16> Vars; |
| 2424 | Vars.reserve(NumVars); |
Samuel Antao | 9092700 | 2016-04-26 14:54:23 +0000 | [diff] [blame] | 2425 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2426 | Vars.push_back(Reader->Record.readSubExpr()); |
Kelvin Li | 0bff7af | 2015-11-23 05:32:03 +0000 | [diff] [blame] | 2427 | C->setVarRefs(Vars); |
Samuel Antao | 9092700 | 2016-04-26 14:54:23 +0000 | [diff] [blame] | 2428 | |
| 2429 | SmallVector<ValueDecl *, 16> Decls; |
| 2430 | Decls.reserve(UniqueDecls); |
| 2431 | for (unsigned i = 0; i < UniqueDecls; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2432 | Decls.push_back(Reader->Record.readDeclAs<ValueDecl>()); |
Samuel Antao | 9092700 | 2016-04-26 14:54:23 +0000 | [diff] [blame] | 2433 | C->setUniqueDecls(Decls); |
| 2434 | |
| 2435 | SmallVector<unsigned, 16> ListsPerDecl; |
| 2436 | ListsPerDecl.reserve(UniqueDecls); |
| 2437 | for (unsigned i = 0; i < UniqueDecls; ++i) |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2438 | ListsPerDecl.push_back(Reader->Record.readInt()); |
Samuel Antao | 9092700 | 2016-04-26 14:54:23 +0000 | [diff] [blame] | 2439 | C->setDeclNumLists(ListsPerDecl); |
| 2440 | |
| 2441 | SmallVector<unsigned, 32> ListSizes; |
| 2442 | ListSizes.reserve(TotalLists); |
| 2443 | for (unsigned i = 0; i < TotalLists; ++i) |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2444 | ListSizes.push_back(Reader->Record.readInt()); |
Samuel Antao | 9092700 | 2016-04-26 14:54:23 +0000 | [diff] [blame] | 2445 | C->setComponentListSizes(ListSizes); |
| 2446 | |
| 2447 | SmallVector<OMPClauseMappableExprCommon::MappableComponent, 32> Components; |
| 2448 | Components.reserve(TotalComponents); |
| 2449 | for (unsigned i = 0; i < TotalComponents; ++i) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2450 | Expr *AssociatedExpr = Reader->Record.readSubExpr(); |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 2451 | auto *AssociatedDecl = Reader->Record.readDeclAs<ValueDecl>(); |
Samuel Antao | 9092700 | 2016-04-26 14:54:23 +0000 | [diff] [blame] | 2452 | Components.push_back(OMPClauseMappableExprCommon::MappableComponent( |
| 2453 | AssociatedExpr, AssociatedDecl)); |
| 2454 | } |
| 2455 | C->setComponents(Components, ListSizes); |
Kelvin Li | 0bff7af | 2015-11-23 05:32:03 +0000 | [diff] [blame] | 2456 | } |
| 2457 | |
Kelvin Li | 099bb8c | 2015-11-24 20:50:12 +0000 | [diff] [blame] | 2458 | void OMPClauseReader::VisitOMPNumTeamsClause(OMPNumTeamsClause *C) { |
Arpith Chacko Jacob | bc12634 | 2017-01-25 11:28:18 +0000 | [diff] [blame] | 2459 | VisitOMPClauseWithPreInit(C); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2460 | C->setNumTeams(Reader->Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2461 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Kelvin Li | 099bb8c | 2015-11-24 20:50:12 +0000 | [diff] [blame] | 2462 | } |
| 2463 | |
Kelvin Li | a15fb1a | 2015-11-27 18:47:36 +0000 | [diff] [blame] | 2464 | void OMPClauseReader::VisitOMPThreadLimitClause(OMPThreadLimitClause *C) { |
Arpith Chacko Jacob | 7ecc0b7 | 2017-01-25 11:44:35 +0000 | [diff] [blame] | 2465 | VisitOMPClauseWithPreInit(C); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2466 | C->setThreadLimit(Reader->Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2467 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Kelvin Li | a15fb1a | 2015-11-27 18:47:36 +0000 | [diff] [blame] | 2468 | } |
| 2469 | |
Alexey Bataev | a056935 | 2015-12-01 10:17:31 +0000 | [diff] [blame] | 2470 | void OMPClauseReader::VisitOMPPriorityClause(OMPPriorityClause *C) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2471 | C->setPriority(Reader->Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2472 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Alexey Bataev | a056935 | 2015-12-01 10:17:31 +0000 | [diff] [blame] | 2473 | } |
| 2474 | |
Alexey Bataev | 1fd4aed | 2015-12-07 12:52:51 +0000 | [diff] [blame] | 2475 | void OMPClauseReader::VisitOMPGrainsizeClause(OMPGrainsizeClause *C) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2476 | C->setGrainsize(Reader->Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2477 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Alexey Bataev | 1fd4aed | 2015-12-07 12:52:51 +0000 | [diff] [blame] | 2478 | } |
| 2479 | |
Alexey Bataev | 382967a | 2015-12-08 12:06:20 +0000 | [diff] [blame] | 2480 | void OMPClauseReader::VisitOMPNumTasksClause(OMPNumTasksClause *C) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2481 | C->setNumTasks(Reader->Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2482 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Alexey Bataev | 382967a | 2015-12-08 12:06:20 +0000 | [diff] [blame] | 2483 | } |
| 2484 | |
Alexey Bataev | 28c7541 | 2015-12-15 08:19:24 +0000 | [diff] [blame] | 2485 | void OMPClauseReader::VisitOMPHintClause(OMPHintClause *C) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2486 | C->setHint(Reader->Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2487 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Alexey Bataev | 28c7541 | 2015-12-15 08:19:24 +0000 | [diff] [blame] | 2488 | } |
| 2489 | |
Carlo Bertolli | b4adf55 | 2016-01-15 18:50:31 +0000 | [diff] [blame] | 2490 | void OMPClauseReader::VisitOMPDistScheduleClause(OMPDistScheduleClause *C) { |
Alexey Bataev | 3392d76 | 2016-02-16 11:18:12 +0000 | [diff] [blame] | 2491 | VisitOMPClauseWithPreInit(C); |
Carlo Bertolli | b4adf55 | 2016-01-15 18:50:31 +0000 | [diff] [blame] | 2492 | C->setDistScheduleKind( |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2493 | static_cast<OpenMPDistScheduleClauseKind>(Reader->Record.readInt())); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2494 | C->setChunkSize(Reader->Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2495 | C->setLParenLoc(Reader->ReadSourceLocation()); |
| 2496 | C->setDistScheduleKindLoc(Reader->ReadSourceLocation()); |
| 2497 | C->setCommaLoc(Reader->ReadSourceLocation()); |
Carlo Bertolli | b4adf55 | 2016-01-15 18:50:31 +0000 | [diff] [blame] | 2498 | } |
| 2499 | |
Arpith Chacko Jacob | 3cf8904 | 2016-01-26 16:37:23 +0000 | [diff] [blame] | 2500 | void OMPClauseReader::VisitOMPDefaultmapClause(OMPDefaultmapClause *C) { |
| 2501 | C->setDefaultmapKind( |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2502 | static_cast<OpenMPDefaultmapClauseKind>(Reader->Record.readInt())); |
Arpith Chacko Jacob | 3cf8904 | 2016-01-26 16:37:23 +0000 | [diff] [blame] | 2503 | C->setDefaultmapModifier( |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2504 | static_cast<OpenMPDefaultmapClauseModifier>(Reader->Record.readInt())); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2505 | C->setLParenLoc(Reader->ReadSourceLocation()); |
| 2506 | C->setDefaultmapModifierLoc(Reader->ReadSourceLocation()); |
| 2507 | C->setDefaultmapKindLoc(Reader->ReadSourceLocation()); |
Arpith Chacko Jacob | 3cf8904 | 2016-01-26 16:37:23 +0000 | [diff] [blame] | 2508 | } |
| 2509 | |
Samuel Antao | 661c090 | 2016-05-26 17:39:58 +0000 | [diff] [blame] | 2510 | void OMPClauseReader::VisitOMPToClause(OMPToClause *C) { |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2511 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Samuel Antao | 661c090 | 2016-05-26 17:39:58 +0000 | [diff] [blame] | 2512 | auto NumVars = C->varlist_size(); |
| 2513 | auto UniqueDecls = C->getUniqueDeclarationsNum(); |
| 2514 | auto TotalLists = C->getTotalComponentListNum(); |
| 2515 | auto TotalComponents = C->getTotalComponentsNum(); |
| 2516 | |
| 2517 | SmallVector<Expr *, 16> Vars; |
| 2518 | Vars.reserve(NumVars); |
| 2519 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2520 | Vars.push_back(Reader->Record.readSubExpr()); |
Samuel Antao | 661c090 | 2016-05-26 17:39:58 +0000 | [diff] [blame] | 2521 | C->setVarRefs(Vars); |
| 2522 | |
| 2523 | SmallVector<ValueDecl *, 16> Decls; |
| 2524 | Decls.reserve(UniqueDecls); |
| 2525 | for (unsigned i = 0; i < UniqueDecls; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2526 | Decls.push_back(Reader->Record.readDeclAs<ValueDecl>()); |
Samuel Antao | 661c090 | 2016-05-26 17:39:58 +0000 | [diff] [blame] | 2527 | C->setUniqueDecls(Decls); |
| 2528 | |
| 2529 | SmallVector<unsigned, 16> ListsPerDecl; |
| 2530 | ListsPerDecl.reserve(UniqueDecls); |
| 2531 | for (unsigned i = 0; i < UniqueDecls; ++i) |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2532 | ListsPerDecl.push_back(Reader->Record.readInt()); |
Samuel Antao | 661c090 | 2016-05-26 17:39:58 +0000 | [diff] [blame] | 2533 | C->setDeclNumLists(ListsPerDecl); |
| 2534 | |
| 2535 | SmallVector<unsigned, 32> ListSizes; |
| 2536 | ListSizes.reserve(TotalLists); |
| 2537 | for (unsigned i = 0; i < TotalLists; ++i) |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2538 | ListSizes.push_back(Reader->Record.readInt()); |
Samuel Antao | 661c090 | 2016-05-26 17:39:58 +0000 | [diff] [blame] | 2539 | C->setComponentListSizes(ListSizes); |
| 2540 | |
| 2541 | SmallVector<OMPClauseMappableExprCommon::MappableComponent, 32> Components; |
| 2542 | Components.reserve(TotalComponents); |
| 2543 | for (unsigned i = 0; i < TotalComponents; ++i) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2544 | Expr *AssociatedExpr = Reader->Record.readSubExpr(); |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 2545 | auto *AssociatedDecl = Reader->Record.readDeclAs<ValueDecl>(); |
Samuel Antao | 661c090 | 2016-05-26 17:39:58 +0000 | [diff] [blame] | 2546 | Components.push_back(OMPClauseMappableExprCommon::MappableComponent( |
| 2547 | AssociatedExpr, AssociatedDecl)); |
| 2548 | } |
| 2549 | C->setComponents(Components, ListSizes); |
| 2550 | } |
| 2551 | |
Samuel Antao | ec172c6 | 2016-05-26 17:49:04 +0000 | [diff] [blame] | 2552 | void OMPClauseReader::VisitOMPFromClause(OMPFromClause *C) { |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2553 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Samuel Antao | ec172c6 | 2016-05-26 17:49:04 +0000 | [diff] [blame] | 2554 | auto NumVars = C->varlist_size(); |
| 2555 | auto UniqueDecls = C->getUniqueDeclarationsNum(); |
| 2556 | auto TotalLists = C->getTotalComponentListNum(); |
| 2557 | auto TotalComponents = C->getTotalComponentsNum(); |
| 2558 | |
| 2559 | SmallVector<Expr *, 16> Vars; |
| 2560 | Vars.reserve(NumVars); |
| 2561 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2562 | Vars.push_back(Reader->Record.readSubExpr()); |
Samuel Antao | ec172c6 | 2016-05-26 17:49:04 +0000 | [diff] [blame] | 2563 | C->setVarRefs(Vars); |
| 2564 | |
| 2565 | SmallVector<ValueDecl *, 16> Decls; |
| 2566 | Decls.reserve(UniqueDecls); |
| 2567 | for (unsigned i = 0; i < UniqueDecls; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2568 | Decls.push_back(Reader->Record.readDeclAs<ValueDecl>()); |
Samuel Antao | ec172c6 | 2016-05-26 17:49:04 +0000 | [diff] [blame] | 2569 | C->setUniqueDecls(Decls); |
| 2570 | |
| 2571 | SmallVector<unsigned, 16> ListsPerDecl; |
| 2572 | ListsPerDecl.reserve(UniqueDecls); |
| 2573 | for (unsigned i = 0; i < UniqueDecls; ++i) |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2574 | ListsPerDecl.push_back(Reader->Record.readInt()); |
Samuel Antao | ec172c6 | 2016-05-26 17:49:04 +0000 | [diff] [blame] | 2575 | C->setDeclNumLists(ListsPerDecl); |
| 2576 | |
| 2577 | SmallVector<unsigned, 32> ListSizes; |
| 2578 | ListSizes.reserve(TotalLists); |
| 2579 | for (unsigned i = 0; i < TotalLists; ++i) |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2580 | ListSizes.push_back(Reader->Record.readInt()); |
Samuel Antao | ec172c6 | 2016-05-26 17:49:04 +0000 | [diff] [blame] | 2581 | C->setComponentListSizes(ListSizes); |
| 2582 | |
| 2583 | SmallVector<OMPClauseMappableExprCommon::MappableComponent, 32> Components; |
| 2584 | Components.reserve(TotalComponents); |
| 2585 | for (unsigned i = 0; i < TotalComponents; ++i) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2586 | Expr *AssociatedExpr = Reader->Record.readSubExpr(); |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 2587 | auto *AssociatedDecl = Reader->Record.readDeclAs<ValueDecl>(); |
Samuel Antao | ec172c6 | 2016-05-26 17:49:04 +0000 | [diff] [blame] | 2588 | Components.push_back(OMPClauseMappableExprCommon::MappableComponent( |
| 2589 | AssociatedExpr, AssociatedDecl)); |
| 2590 | } |
| 2591 | C->setComponents(Components, ListSizes); |
| 2592 | } |
| 2593 | |
Carlo Bertolli | 2404b17 | 2016-07-13 15:37:16 +0000 | [diff] [blame] | 2594 | void OMPClauseReader::VisitOMPUseDevicePtrClause(OMPUseDevicePtrClause *C) { |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2595 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Samuel Antao | cc10b85 | 2016-07-28 14:23:26 +0000 | [diff] [blame] | 2596 | auto NumVars = C->varlist_size(); |
| 2597 | auto UniqueDecls = C->getUniqueDeclarationsNum(); |
| 2598 | auto TotalLists = C->getTotalComponentListNum(); |
| 2599 | auto TotalComponents = C->getTotalComponentsNum(); |
| 2600 | |
Carlo Bertolli | 2404b17 | 2016-07-13 15:37:16 +0000 | [diff] [blame] | 2601 | SmallVector<Expr *, 16> Vars; |
| 2602 | Vars.reserve(NumVars); |
| 2603 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2604 | Vars.push_back(Reader->Record.readSubExpr()); |
Carlo Bertolli | 2404b17 | 2016-07-13 15:37:16 +0000 | [diff] [blame] | 2605 | C->setVarRefs(Vars); |
| 2606 | Vars.clear(); |
Samuel Antao | cc10b85 | 2016-07-28 14:23:26 +0000 | [diff] [blame] | 2607 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2608 | Vars.push_back(Reader->Record.readSubExpr()); |
Samuel Antao | cc10b85 | 2016-07-28 14:23:26 +0000 | [diff] [blame] | 2609 | C->setPrivateCopies(Vars); |
| 2610 | Vars.clear(); |
| 2611 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2612 | Vars.push_back(Reader->Record.readSubExpr()); |
Samuel Antao | cc10b85 | 2016-07-28 14:23:26 +0000 | [diff] [blame] | 2613 | C->setInits(Vars); |
| 2614 | |
| 2615 | SmallVector<ValueDecl *, 16> Decls; |
| 2616 | Decls.reserve(UniqueDecls); |
| 2617 | for (unsigned i = 0; i < UniqueDecls; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2618 | Decls.push_back(Reader->Record.readDeclAs<ValueDecl>()); |
Samuel Antao | cc10b85 | 2016-07-28 14:23:26 +0000 | [diff] [blame] | 2619 | C->setUniqueDecls(Decls); |
| 2620 | |
| 2621 | SmallVector<unsigned, 16> ListsPerDecl; |
| 2622 | ListsPerDecl.reserve(UniqueDecls); |
| 2623 | for (unsigned i = 0; i < UniqueDecls; ++i) |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2624 | ListsPerDecl.push_back(Reader->Record.readInt()); |
Samuel Antao | cc10b85 | 2016-07-28 14:23:26 +0000 | [diff] [blame] | 2625 | C->setDeclNumLists(ListsPerDecl); |
| 2626 | |
| 2627 | SmallVector<unsigned, 32> ListSizes; |
| 2628 | ListSizes.reserve(TotalLists); |
| 2629 | for (unsigned i = 0; i < TotalLists; ++i) |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2630 | ListSizes.push_back(Reader->Record.readInt()); |
Samuel Antao | cc10b85 | 2016-07-28 14:23:26 +0000 | [diff] [blame] | 2631 | C->setComponentListSizes(ListSizes); |
| 2632 | |
| 2633 | SmallVector<OMPClauseMappableExprCommon::MappableComponent, 32> Components; |
| 2634 | Components.reserve(TotalComponents); |
| 2635 | for (unsigned i = 0; i < TotalComponents; ++i) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2636 | Expr *AssociatedExpr = Reader->Record.readSubExpr(); |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 2637 | auto *AssociatedDecl = Reader->Record.readDeclAs<ValueDecl>(); |
Samuel Antao | cc10b85 | 2016-07-28 14:23:26 +0000 | [diff] [blame] | 2638 | Components.push_back(OMPClauseMappableExprCommon::MappableComponent( |
| 2639 | AssociatedExpr, AssociatedDecl)); |
| 2640 | } |
| 2641 | C->setComponents(Components, ListSizes); |
Carlo Bertolli | 2404b17 | 2016-07-13 15:37:16 +0000 | [diff] [blame] | 2642 | } |
| 2643 | |
Carlo Bertolli | 70594e9 | 2016-07-13 17:16:49 +0000 | [diff] [blame] | 2644 | void OMPClauseReader::VisitOMPIsDevicePtrClause(OMPIsDevicePtrClause *C) { |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2645 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Samuel Antao | 6890b09 | 2016-07-28 14:25:09 +0000 | [diff] [blame] | 2646 | auto NumVars = C->varlist_size(); |
| 2647 | auto UniqueDecls = C->getUniqueDeclarationsNum(); |
| 2648 | auto TotalLists = C->getTotalComponentListNum(); |
| 2649 | auto TotalComponents = C->getTotalComponentsNum(); |
| 2650 | |
Carlo Bertolli | 70594e9 | 2016-07-13 17:16:49 +0000 | [diff] [blame] | 2651 | SmallVector<Expr *, 16> Vars; |
| 2652 | Vars.reserve(NumVars); |
| 2653 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2654 | Vars.push_back(Reader->Record.readSubExpr()); |
Carlo Bertolli | 70594e9 | 2016-07-13 17:16:49 +0000 | [diff] [blame] | 2655 | C->setVarRefs(Vars); |
| 2656 | Vars.clear(); |
Samuel Antao | 6890b09 | 2016-07-28 14:25:09 +0000 | [diff] [blame] | 2657 | |
| 2658 | SmallVector<ValueDecl *, 16> Decls; |
| 2659 | Decls.reserve(UniqueDecls); |
| 2660 | for (unsigned i = 0; i < UniqueDecls; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2661 | Decls.push_back(Reader->Record.readDeclAs<ValueDecl>()); |
Samuel Antao | 6890b09 | 2016-07-28 14:25:09 +0000 | [diff] [blame] | 2662 | C->setUniqueDecls(Decls); |
| 2663 | |
| 2664 | SmallVector<unsigned, 16> ListsPerDecl; |
| 2665 | ListsPerDecl.reserve(UniqueDecls); |
| 2666 | for (unsigned i = 0; i < UniqueDecls; ++i) |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2667 | ListsPerDecl.push_back(Reader->Record.readInt()); |
Samuel Antao | 6890b09 | 2016-07-28 14:25:09 +0000 | [diff] [blame] | 2668 | C->setDeclNumLists(ListsPerDecl); |
| 2669 | |
| 2670 | SmallVector<unsigned, 32> ListSizes; |
| 2671 | ListSizes.reserve(TotalLists); |
| 2672 | for (unsigned i = 0; i < TotalLists; ++i) |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2673 | ListSizes.push_back(Reader->Record.readInt()); |
Samuel Antao | 6890b09 | 2016-07-28 14:25:09 +0000 | [diff] [blame] | 2674 | C->setComponentListSizes(ListSizes); |
| 2675 | |
| 2676 | SmallVector<OMPClauseMappableExprCommon::MappableComponent, 32> Components; |
| 2677 | Components.reserve(TotalComponents); |
| 2678 | for (unsigned i = 0; i < TotalComponents; ++i) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2679 | Expr *AssociatedExpr = Reader->Record.readSubExpr(); |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 2680 | auto *AssociatedDecl = Reader->Record.readDeclAs<ValueDecl>(); |
Samuel Antao | 6890b09 | 2016-07-28 14:25:09 +0000 | [diff] [blame] | 2681 | Components.push_back(OMPClauseMappableExprCommon::MappableComponent( |
| 2682 | AssociatedExpr, AssociatedDecl)); |
| 2683 | } |
| 2684 | C->setComponents(Components, ListSizes); |
Carlo Bertolli | 70594e9 | 2016-07-13 17:16:49 +0000 | [diff] [blame] | 2685 | } |
| 2686 | |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 2687 | //===----------------------------------------------------------------------===// |
| 2688 | // OpenMP Directives. |
| 2689 | //===----------------------------------------------------------------------===// |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 2690 | |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 2691 | void ASTStmtReader::VisitOMPExecutableDirective(OMPExecutableDirective *E) { |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2692 | E->setLocStart(ReadSourceLocation()); |
| 2693 | E->setLocEnd(ReadSourceLocation()); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2694 | OMPClauseReader ClauseReader(this, Record); |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 2695 | SmallVector<OMPClause *, 5> Clauses; |
| 2696 | for (unsigned i = 0; i < E->getNumClauses(); ++i) |
| 2697 | Clauses.push_back(ClauseReader.readClause()); |
| 2698 | E->setClauses(Clauses); |
Alexey Bataev | 68446b7 | 2014-07-18 07:47:19 +0000 | [diff] [blame] | 2699 | if (E->hasAssociatedStmt()) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2700 | E->setAssociatedStmt(Record.readSubStmt()); |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 2701 | } |
| 2702 | |
Alexander Musman | 3aaab66 | 2014-08-19 11:27:13 +0000 | [diff] [blame] | 2703 | void ASTStmtReader::VisitOMPLoopDirective(OMPLoopDirective *D) { |
| 2704 | VisitStmt(D); |
| 2705 | // Two fields (NumClauses and CollapsedNum) were read in ReadStmtFromStream. |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2706 | Record.skipInts(2); |
Alexander Musman | 3aaab66 | 2014-08-19 11:27:13 +0000 | [diff] [blame] | 2707 | VisitOMPExecutableDirective(D); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2708 | D->setIterationVariable(Record.readSubExpr()); |
| 2709 | D->setLastIteration(Record.readSubExpr()); |
| 2710 | D->setCalcLastIteration(Record.readSubExpr()); |
| 2711 | D->setPreCond(Record.readSubExpr()); |
| 2712 | D->setCond(Record.readSubExpr()); |
| 2713 | D->setInit(Record.readSubExpr()); |
| 2714 | D->setInc(Record.readSubExpr()); |
| 2715 | D->setPreInits(Record.readSubStmt()); |
Alexey Bataev | 3392d76 | 2016-02-16 11:18:12 +0000 | [diff] [blame] | 2716 | if (isOpenMPWorksharingDirective(D->getDirectiveKind()) || |
Carlo Bertolli | fc35ad2 | 2016-03-07 16:04:49 +0000 | [diff] [blame] | 2717 | isOpenMPTaskLoopDirective(D->getDirectiveKind()) || |
| 2718 | isOpenMPDistributeDirective(D->getDirectiveKind())) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2719 | D->setIsLastIterVariable(Record.readSubExpr()); |
| 2720 | D->setLowerBoundVariable(Record.readSubExpr()); |
| 2721 | D->setUpperBoundVariable(Record.readSubExpr()); |
| 2722 | D->setStrideVariable(Record.readSubExpr()); |
| 2723 | D->setEnsureUpperBound(Record.readSubExpr()); |
| 2724 | D->setNextLowerBound(Record.readSubExpr()); |
| 2725 | D->setNextUpperBound(Record.readSubExpr()); |
| 2726 | D->setNumIterations(Record.readSubExpr()); |
Alexander Musman | c638868 | 2014-12-15 07:07:06 +0000 | [diff] [blame] | 2727 | } |
Carlo Bertolli | 9925f15 | 2016-06-27 14:55:37 +0000 | [diff] [blame] | 2728 | if (isOpenMPLoopBoundSharingDirective(D->getDirectiveKind())) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2729 | D->setPrevLowerBoundVariable(Record.readSubExpr()); |
| 2730 | D->setPrevUpperBoundVariable(Record.readSubExpr()); |
Carlo Bertolli | 8429d81 | 2017-02-17 21:29:13 +0000 | [diff] [blame] | 2731 | D->setDistInc(Record.readSubExpr()); |
| 2732 | D->setPrevEnsureUpperBound(Record.readSubExpr()); |
Carlo Bertolli | ffafe10 | 2017-04-20 00:39:39 +0000 | [diff] [blame] | 2733 | D->setCombinedLowerBoundVariable(Record.readSubExpr()); |
| 2734 | D->setCombinedUpperBoundVariable(Record.readSubExpr()); |
| 2735 | D->setCombinedEnsureUpperBound(Record.readSubExpr()); |
| 2736 | D->setCombinedInit(Record.readSubExpr()); |
| 2737 | D->setCombinedCond(Record.readSubExpr()); |
| 2738 | D->setCombinedNextLowerBound(Record.readSubExpr()); |
| 2739 | D->setCombinedNextUpperBound(Record.readSubExpr()); |
Carlo Bertolli | 9925f15 | 2016-06-27 14:55:37 +0000 | [diff] [blame] | 2740 | } |
Alexander Musman | a5f070a | 2014-10-01 06:03:56 +0000 | [diff] [blame] | 2741 | SmallVector<Expr *, 4> Sub; |
| 2742 | unsigned CollapsedNum = D->getCollapsedNumber(); |
| 2743 | Sub.reserve(CollapsedNum); |
| 2744 | for (unsigned i = 0; i < CollapsedNum; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2745 | Sub.push_back(Record.readSubExpr()); |
Alexander Musman | a5f070a | 2014-10-01 06:03:56 +0000 | [diff] [blame] | 2746 | D->setCounters(Sub); |
| 2747 | Sub.clear(); |
| 2748 | for (unsigned i = 0; i < CollapsedNum; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2749 | Sub.push_back(Record.readSubExpr()); |
Alexey Bataev | a889917 | 2015-08-06 12:30:57 +0000 | [diff] [blame] | 2750 | D->setPrivateCounters(Sub); |
| 2751 | Sub.clear(); |
| 2752 | for (unsigned i = 0; i < CollapsedNum; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2753 | Sub.push_back(Record.readSubExpr()); |
Alexey Bataev | b08f89f | 2015-08-14 12:25:37 +0000 | [diff] [blame] | 2754 | D->setInits(Sub); |
| 2755 | Sub.clear(); |
| 2756 | for (unsigned i = 0; i < CollapsedNum; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2757 | Sub.push_back(Record.readSubExpr()); |
Alexander Musman | a5f070a | 2014-10-01 06:03:56 +0000 | [diff] [blame] | 2758 | D->setUpdates(Sub); |
| 2759 | Sub.clear(); |
| 2760 | for (unsigned i = 0; i < CollapsedNum; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2761 | Sub.push_back(Record.readSubExpr()); |
Alexander Musman | a5f070a | 2014-10-01 06:03:56 +0000 | [diff] [blame] | 2762 | D->setFinals(Sub); |
Alexander Musman | 3aaab66 | 2014-08-19 11:27:13 +0000 | [diff] [blame] | 2763 | } |
| 2764 | |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 2765 | void ASTStmtReader::VisitOMPParallelDirective(OMPParallelDirective *D) { |
Alexey Bataev | 1b59ab5 | 2014-02-27 08:29:12 +0000 | [diff] [blame] | 2766 | VisitStmt(D); |
| 2767 | // The NumClauses field was read in ReadStmtFromStream. |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2768 | Record.skipInts(1); |
Alexey Bataev | 1b59ab5 | 2014-02-27 08:29:12 +0000 | [diff] [blame] | 2769 | VisitOMPExecutableDirective(D); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2770 | D->setHasCancel(Record.readInt()); |
Alexey Bataev | 1b59ab5 | 2014-02-27 08:29:12 +0000 | [diff] [blame] | 2771 | } |
| 2772 | |
| 2773 | void ASTStmtReader::VisitOMPSimdDirective(OMPSimdDirective *D) { |
Alexander Musman | 3aaab66 | 2014-08-19 11:27:13 +0000 | [diff] [blame] | 2774 | VisitOMPLoopDirective(D); |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 2775 | } |
| 2776 | |
Alexey Bataev | f29276e | 2014-06-18 04:14:57 +0000 | [diff] [blame] | 2777 | void ASTStmtReader::VisitOMPForDirective(OMPForDirective *D) { |
Alexander Musman | 3aaab66 | 2014-08-19 11:27:13 +0000 | [diff] [blame] | 2778 | VisitOMPLoopDirective(D); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2779 | D->setHasCancel(Record.readInt()); |
Alexey Bataev | f29276e | 2014-06-18 04:14:57 +0000 | [diff] [blame] | 2780 | } |
| 2781 | |
Alexander Musman | f82886e | 2014-09-18 05:12:34 +0000 | [diff] [blame] | 2782 | void ASTStmtReader::VisitOMPForSimdDirective(OMPForSimdDirective *D) { |
| 2783 | VisitOMPLoopDirective(D); |
| 2784 | } |
| 2785 | |
Alexey Bataev | d3f8dd2 | 2014-06-25 11:44:49 +0000 | [diff] [blame] | 2786 | void ASTStmtReader::VisitOMPSectionsDirective(OMPSectionsDirective *D) { |
| 2787 | VisitStmt(D); |
| 2788 | // The NumClauses field was read in ReadStmtFromStream. |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2789 | Record.skipInts(1); |
Alexey Bataev | d3f8dd2 | 2014-06-25 11:44:49 +0000 | [diff] [blame] | 2790 | VisitOMPExecutableDirective(D); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2791 | D->setHasCancel(Record.readInt()); |
Alexey Bataev | d3f8dd2 | 2014-06-25 11:44:49 +0000 | [diff] [blame] | 2792 | } |
| 2793 | |
Alexey Bataev | 1e0498a | 2014-06-26 08:21:58 +0000 | [diff] [blame] | 2794 | void ASTStmtReader::VisitOMPSectionDirective(OMPSectionDirective *D) { |
| 2795 | VisitStmt(D); |
| 2796 | VisitOMPExecutableDirective(D); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2797 | D->setHasCancel(Record.readInt()); |
Alexey Bataev | 1e0498a | 2014-06-26 08:21:58 +0000 | [diff] [blame] | 2798 | } |
| 2799 | |
Alexey Bataev | d1e40fb | 2014-06-26 12:05:45 +0000 | [diff] [blame] | 2800 | void ASTStmtReader::VisitOMPSingleDirective(OMPSingleDirective *D) { |
| 2801 | VisitStmt(D); |
| 2802 | // The NumClauses field was read in ReadStmtFromStream. |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2803 | Record.skipInts(1); |
Alexey Bataev | d1e40fb | 2014-06-26 12:05:45 +0000 | [diff] [blame] | 2804 | VisitOMPExecutableDirective(D); |
| 2805 | } |
| 2806 | |
Alexander Musman | 80c2289 | 2014-07-17 08:54:58 +0000 | [diff] [blame] | 2807 | void ASTStmtReader::VisitOMPMasterDirective(OMPMasterDirective *D) { |
| 2808 | VisitStmt(D); |
| 2809 | VisitOMPExecutableDirective(D); |
| 2810 | } |
| 2811 | |
Alexander Musman | d9ed09f | 2014-07-21 09:42:05 +0000 | [diff] [blame] | 2812 | void ASTStmtReader::VisitOMPCriticalDirective(OMPCriticalDirective *D) { |
| 2813 | VisitStmt(D); |
Alexey Bataev | 28c7541 | 2015-12-15 08:19:24 +0000 | [diff] [blame] | 2814 | // The NumClauses field was read in ReadStmtFromStream. |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2815 | Record.skipInts(1); |
Alexander Musman | d9ed09f | 2014-07-21 09:42:05 +0000 | [diff] [blame] | 2816 | VisitOMPExecutableDirective(D); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2817 | ReadDeclarationNameInfo(D->DirName); |
Alexander Musman | d9ed09f | 2014-07-21 09:42:05 +0000 | [diff] [blame] | 2818 | } |
| 2819 | |
Alexey Bataev | 4acb859 | 2014-07-07 13:01:15 +0000 | [diff] [blame] | 2820 | void ASTStmtReader::VisitOMPParallelForDirective(OMPParallelForDirective *D) { |
Alexander Musman | 3aaab66 | 2014-08-19 11:27:13 +0000 | [diff] [blame] | 2821 | VisitOMPLoopDirective(D); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2822 | D->setHasCancel(Record.readInt()); |
Alexey Bataev | 4acb859 | 2014-07-07 13:01:15 +0000 | [diff] [blame] | 2823 | } |
| 2824 | |
Alexander Musman | e4e893b | 2014-09-23 09:33:00 +0000 | [diff] [blame] | 2825 | void ASTStmtReader::VisitOMPParallelForSimdDirective( |
| 2826 | OMPParallelForSimdDirective *D) { |
| 2827 | VisitOMPLoopDirective(D); |
| 2828 | } |
| 2829 | |
Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 2830 | void ASTStmtReader::VisitOMPParallelSectionsDirective( |
| 2831 | OMPParallelSectionsDirective *D) { |
| 2832 | VisitStmt(D); |
| 2833 | // The NumClauses field was read in ReadStmtFromStream. |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2834 | Record.skipInts(1); |
Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 2835 | VisitOMPExecutableDirective(D); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2836 | D->setHasCancel(Record.readInt()); |
Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 2837 | } |
| 2838 | |
Alexey Bataev | 9c2e8ee | 2014-07-11 11:25:16 +0000 | [diff] [blame] | 2839 | void ASTStmtReader::VisitOMPTaskDirective(OMPTaskDirective *D) { |
| 2840 | VisitStmt(D); |
| 2841 | // The NumClauses field was read in ReadStmtFromStream. |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2842 | Record.skipInts(1); |
Alexey Bataev | 9c2e8ee | 2014-07-11 11:25:16 +0000 | [diff] [blame] | 2843 | VisitOMPExecutableDirective(D); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2844 | D->setHasCancel(Record.readInt()); |
Alexey Bataev | 9c2e8ee | 2014-07-11 11:25:16 +0000 | [diff] [blame] | 2845 | } |
| 2846 | |
Alexey Bataev | 68446b7 | 2014-07-18 07:47:19 +0000 | [diff] [blame] | 2847 | void ASTStmtReader::VisitOMPTaskyieldDirective(OMPTaskyieldDirective *D) { |
| 2848 | VisitStmt(D); |
| 2849 | VisitOMPExecutableDirective(D); |
| 2850 | } |
| 2851 | |
Alexey Bataev | 4d1dfea | 2014-07-18 09:11:51 +0000 | [diff] [blame] | 2852 | void ASTStmtReader::VisitOMPBarrierDirective(OMPBarrierDirective *D) { |
| 2853 | VisitStmt(D); |
| 2854 | VisitOMPExecutableDirective(D); |
| 2855 | } |
| 2856 | |
Alexey Bataev | 2df347a | 2014-07-18 10:17:07 +0000 | [diff] [blame] | 2857 | void ASTStmtReader::VisitOMPTaskwaitDirective(OMPTaskwaitDirective *D) { |
| 2858 | VisitStmt(D); |
| 2859 | VisitOMPExecutableDirective(D); |
| 2860 | } |
| 2861 | |
Alexey Bataev | c30dd2d | 2015-06-18 12:14:09 +0000 | [diff] [blame] | 2862 | void ASTStmtReader::VisitOMPTaskgroupDirective(OMPTaskgroupDirective *D) { |
| 2863 | VisitStmt(D); |
Alexey Bataev | 169d96a | 2017-07-18 20:17:46 +0000 | [diff] [blame] | 2864 | // The NumClauses field was read in ReadStmtFromStream. |
| 2865 | Record.skipInts(1); |
Alexey Bataev | c30dd2d | 2015-06-18 12:14:09 +0000 | [diff] [blame] | 2866 | VisitOMPExecutableDirective(D); |
Alexey Bataev | 3b1b895 | 2017-07-25 15:53:26 +0000 | [diff] [blame] | 2867 | D->setReductionRef(Record.readSubExpr()); |
Alexey Bataev | c30dd2d | 2015-06-18 12:14:09 +0000 | [diff] [blame] | 2868 | } |
| 2869 | |
Alexey Bataev | 6125da9 | 2014-07-21 11:26:11 +0000 | [diff] [blame] | 2870 | void ASTStmtReader::VisitOMPFlushDirective(OMPFlushDirective *D) { |
| 2871 | VisitStmt(D); |
| 2872 | // The NumClauses field was read in ReadStmtFromStream. |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2873 | Record.skipInts(1); |
Alexey Bataev | 6125da9 | 2014-07-21 11:26:11 +0000 | [diff] [blame] | 2874 | VisitOMPExecutableDirective(D); |
| 2875 | } |
| 2876 | |
Alexey Bataev | 9fb6e64 | 2014-07-22 06:45:04 +0000 | [diff] [blame] | 2877 | void ASTStmtReader::VisitOMPOrderedDirective(OMPOrderedDirective *D) { |
| 2878 | VisitStmt(D); |
Alexey Bataev | 346265e | 2015-09-25 10:37:12 +0000 | [diff] [blame] | 2879 | // The NumClauses field was read in ReadStmtFromStream. |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2880 | Record.skipInts(1); |
Alexey Bataev | 9fb6e64 | 2014-07-22 06:45:04 +0000 | [diff] [blame] | 2881 | VisitOMPExecutableDirective(D); |
| 2882 | } |
| 2883 | |
Alexey Bataev | 0162e45 | 2014-07-22 10:10:35 +0000 | [diff] [blame] | 2884 | void ASTStmtReader::VisitOMPAtomicDirective(OMPAtomicDirective *D) { |
| 2885 | VisitStmt(D); |
| 2886 | // The NumClauses field was read in ReadStmtFromStream. |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2887 | Record.skipInts(1); |
Alexey Bataev | 0162e45 | 2014-07-22 10:10:35 +0000 | [diff] [blame] | 2888 | VisitOMPExecutableDirective(D); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2889 | D->setX(Record.readSubExpr()); |
| 2890 | D->setV(Record.readSubExpr()); |
| 2891 | D->setExpr(Record.readSubExpr()); |
| 2892 | D->setUpdateExpr(Record.readSubExpr()); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2893 | D->IsXLHSInRHSPart = Record.readInt() != 0; |
| 2894 | D->IsPostfixUpdate = Record.readInt() != 0; |
Alexey Bataev | 0162e45 | 2014-07-22 10:10:35 +0000 | [diff] [blame] | 2895 | } |
| 2896 | |
Alexey Bataev | 0bd520b | 2014-09-19 08:19:49 +0000 | [diff] [blame] | 2897 | void ASTStmtReader::VisitOMPTargetDirective(OMPTargetDirective *D) { |
| 2898 | VisitStmt(D); |
| 2899 | // The NumClauses field was read in ReadStmtFromStream. |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2900 | Record.skipInts(1); |
Alexey Bataev | 0bd520b | 2014-09-19 08:19:49 +0000 | [diff] [blame] | 2901 | VisitOMPExecutableDirective(D); |
| 2902 | } |
| 2903 | |
Michael Wong | 65f367f | 2015-07-21 13:44:28 +0000 | [diff] [blame] | 2904 | void ASTStmtReader::VisitOMPTargetDataDirective(OMPTargetDataDirective *D) { |
| 2905 | VisitStmt(D); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2906 | Record.skipInts(1); |
Michael Wong | 65f367f | 2015-07-21 13:44:28 +0000 | [diff] [blame] | 2907 | VisitOMPExecutableDirective(D); |
| 2908 | } |
| 2909 | |
Samuel Antao | df67fc4 | 2016-01-19 19:15:56 +0000 | [diff] [blame] | 2910 | void ASTStmtReader::VisitOMPTargetEnterDataDirective( |
| 2911 | OMPTargetEnterDataDirective *D) { |
| 2912 | VisitStmt(D); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2913 | Record.skipInts(1); |
Samuel Antao | df67fc4 | 2016-01-19 19:15:56 +0000 | [diff] [blame] | 2914 | VisitOMPExecutableDirective(D); |
| 2915 | } |
| 2916 | |
Samuel Antao | 7259076 | 2016-01-19 20:04:50 +0000 | [diff] [blame] | 2917 | void ASTStmtReader::VisitOMPTargetExitDataDirective( |
| 2918 | OMPTargetExitDataDirective *D) { |
| 2919 | VisitStmt(D); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2920 | Record.skipInts(1); |
Samuel Antao | 7259076 | 2016-01-19 20:04:50 +0000 | [diff] [blame] | 2921 | VisitOMPExecutableDirective(D); |
| 2922 | } |
| 2923 | |
Arpith Chacko Jacob | e955b3d | 2016-01-26 18:48:41 +0000 | [diff] [blame] | 2924 | void ASTStmtReader::VisitOMPTargetParallelDirective( |
| 2925 | OMPTargetParallelDirective *D) { |
| 2926 | VisitStmt(D); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2927 | Record.skipInts(1); |
Arpith Chacko Jacob | e955b3d | 2016-01-26 18:48:41 +0000 | [diff] [blame] | 2928 | VisitOMPExecutableDirective(D); |
| 2929 | } |
| 2930 | |
Arpith Chacko Jacob | 05bebb5 | 2016-02-03 15:46:42 +0000 | [diff] [blame] | 2931 | void ASTStmtReader::VisitOMPTargetParallelForDirective( |
| 2932 | OMPTargetParallelForDirective *D) { |
| 2933 | VisitOMPLoopDirective(D); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2934 | D->setHasCancel(Record.readInt()); |
Arpith Chacko Jacob | 05bebb5 | 2016-02-03 15:46:42 +0000 | [diff] [blame] | 2935 | } |
| 2936 | |
Alexey Bataev | 13314bf | 2014-10-09 04:18:56 +0000 | [diff] [blame] | 2937 | void ASTStmtReader::VisitOMPTeamsDirective(OMPTeamsDirective *D) { |
| 2938 | VisitStmt(D); |
| 2939 | // The NumClauses field was read in ReadStmtFromStream. |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2940 | Record.skipInts(1); |
Alexey Bataev | 13314bf | 2014-10-09 04:18:56 +0000 | [diff] [blame] | 2941 | VisitOMPExecutableDirective(D); |
| 2942 | } |
| 2943 | |
Alexey Bataev | 6d4ed05 | 2015-07-01 06:57:41 +0000 | [diff] [blame] | 2944 | void ASTStmtReader::VisitOMPCancellationPointDirective( |
| 2945 | OMPCancellationPointDirective *D) { |
| 2946 | VisitStmt(D); |
| 2947 | VisitOMPExecutableDirective(D); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2948 | D->setCancelRegion(static_cast<OpenMPDirectiveKind>(Record.readInt())); |
Alexey Bataev | 6d4ed05 | 2015-07-01 06:57:41 +0000 | [diff] [blame] | 2949 | } |
| 2950 | |
Alexey Bataev | 8090987 | 2015-07-02 11:25:17 +0000 | [diff] [blame] | 2951 | void ASTStmtReader::VisitOMPCancelDirective(OMPCancelDirective *D) { |
| 2952 | VisitStmt(D); |
Alexey Bataev | 87933c7 | 2015-09-18 08:07:34 +0000 | [diff] [blame] | 2953 | // The NumClauses field was read in ReadStmtFromStream. |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2954 | Record.skipInts(1); |
Alexey Bataev | 8090987 | 2015-07-02 11:25:17 +0000 | [diff] [blame] | 2955 | VisitOMPExecutableDirective(D); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2956 | D->setCancelRegion(static_cast<OpenMPDirectiveKind>(Record.readInt())); |
Alexey Bataev | 8090987 | 2015-07-02 11:25:17 +0000 | [diff] [blame] | 2957 | } |
| 2958 | |
Alexey Bataev | 49f6e78 | 2015-12-01 04:18:41 +0000 | [diff] [blame] | 2959 | void ASTStmtReader::VisitOMPTaskLoopDirective(OMPTaskLoopDirective *D) { |
| 2960 | VisitOMPLoopDirective(D); |
| 2961 | } |
| 2962 | |
Alexey Bataev | 0a6ed84 | 2015-12-03 09:40:15 +0000 | [diff] [blame] | 2963 | void ASTStmtReader::VisitOMPTaskLoopSimdDirective(OMPTaskLoopSimdDirective *D) { |
| 2964 | VisitOMPLoopDirective(D); |
| 2965 | } |
| 2966 | |
Carlo Bertolli | 6200a3d | 2015-12-14 14:51:25 +0000 | [diff] [blame] | 2967 | void ASTStmtReader::VisitOMPDistributeDirective(OMPDistributeDirective *D) { |
| 2968 | VisitOMPLoopDirective(D); |
| 2969 | } |
| 2970 | |
Samuel Antao | 686c70c | 2016-05-26 17:30:50 +0000 | [diff] [blame] | 2971 | void ASTStmtReader::VisitOMPTargetUpdateDirective(OMPTargetUpdateDirective *D) { |
| 2972 | VisitStmt(D); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2973 | Record.skipInts(1); |
Samuel Antao | 686c70c | 2016-05-26 17:30:50 +0000 | [diff] [blame] | 2974 | VisitOMPExecutableDirective(D); |
| 2975 | } |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 2976 | |
Carlo Bertolli | 9925f15 | 2016-06-27 14:55:37 +0000 | [diff] [blame] | 2977 | void ASTStmtReader::VisitOMPDistributeParallelForDirective( |
| 2978 | OMPDistributeParallelForDirective *D) { |
| 2979 | VisitOMPLoopDirective(D); |
Alexey Bataev | dcb4b8fb | 2017-11-22 20:19:50 +0000 | [diff] [blame] | 2980 | D->setHasCancel(Record.readInt()); |
Carlo Bertolli | 9925f15 | 2016-06-27 14:55:37 +0000 | [diff] [blame] | 2981 | } |
Samuel Antao | 686c70c | 2016-05-26 17:30:50 +0000 | [diff] [blame] | 2982 | |
Kelvin Li | 4a39add | 2016-07-05 05:00:15 +0000 | [diff] [blame] | 2983 | void ASTStmtReader::VisitOMPDistributeParallelForSimdDirective( |
| 2984 | OMPDistributeParallelForSimdDirective *D) { |
| 2985 | VisitOMPLoopDirective(D); |
| 2986 | } |
| 2987 | |
Kelvin Li | 787f3fc | 2016-07-06 04:45:38 +0000 | [diff] [blame] | 2988 | void ASTStmtReader::VisitOMPDistributeSimdDirective( |
| 2989 | OMPDistributeSimdDirective *D) { |
| 2990 | VisitOMPLoopDirective(D); |
| 2991 | } |
| 2992 | |
Kelvin Li | a579b91 | 2016-07-14 02:54:56 +0000 | [diff] [blame] | 2993 | void ASTStmtReader::VisitOMPTargetParallelForSimdDirective( |
| 2994 | OMPTargetParallelForSimdDirective *D) { |
| 2995 | VisitOMPLoopDirective(D); |
| 2996 | } |
| 2997 | |
Kelvin Li | 986330c | 2016-07-20 22:57:10 +0000 | [diff] [blame] | 2998 | void ASTStmtReader::VisitOMPTargetSimdDirective(OMPTargetSimdDirective *D) { |
| 2999 | VisitOMPLoopDirective(D); |
| 3000 | } |
| 3001 | |
Kelvin Li | 0253287 | 2016-08-05 14:37:37 +0000 | [diff] [blame] | 3002 | void ASTStmtReader::VisitOMPTeamsDistributeDirective( |
| 3003 | OMPTeamsDistributeDirective *D) { |
| 3004 | VisitOMPLoopDirective(D); |
| 3005 | } |
| 3006 | |
Kelvin Li | 4e325f7 | 2016-10-25 12:50:55 +0000 | [diff] [blame] | 3007 | void ASTStmtReader::VisitOMPTeamsDistributeSimdDirective( |
| 3008 | OMPTeamsDistributeSimdDirective *D) { |
| 3009 | VisitOMPLoopDirective(D); |
| 3010 | } |
| 3011 | |
Kelvin Li | 579e41c | 2016-11-30 23:51:03 +0000 | [diff] [blame] | 3012 | void ASTStmtReader::VisitOMPTeamsDistributeParallelForSimdDirective( |
| 3013 | OMPTeamsDistributeParallelForSimdDirective *D) { |
| 3014 | VisitOMPLoopDirective(D); |
| 3015 | } |
| 3016 | |
Kelvin Li | 7ade93f | 2016-12-09 03:24:30 +0000 | [diff] [blame] | 3017 | void ASTStmtReader::VisitOMPTeamsDistributeParallelForDirective( |
| 3018 | OMPTeamsDistributeParallelForDirective *D) { |
| 3019 | VisitOMPLoopDirective(D); |
Alexey Bataev | dcb4b8fb | 2017-11-22 20:19:50 +0000 | [diff] [blame] | 3020 | D->setHasCancel(Record.readInt()); |
Kelvin Li | 7ade93f | 2016-12-09 03:24:30 +0000 | [diff] [blame] | 3021 | } |
| 3022 | |
Kelvin Li | bf594a5 | 2016-12-17 05:48:59 +0000 | [diff] [blame] | 3023 | void ASTStmtReader::VisitOMPTargetTeamsDirective(OMPTargetTeamsDirective *D) { |
| 3024 | VisitStmt(D); |
| 3025 | // The NumClauses field was read in ReadStmtFromStream. |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 3026 | Record.skipInts(1); |
Kelvin Li | bf594a5 | 2016-12-17 05:48:59 +0000 | [diff] [blame] | 3027 | VisitOMPExecutableDirective(D); |
| 3028 | } |
| 3029 | |
Kelvin Li | 83c451e | 2016-12-25 04:52:54 +0000 | [diff] [blame] | 3030 | void ASTStmtReader::VisitOMPTargetTeamsDistributeDirective( |
| 3031 | OMPTargetTeamsDistributeDirective *D) { |
| 3032 | VisitOMPLoopDirective(D); |
| 3033 | } |
| 3034 | |
Kelvin Li | 80e8f56 | 2016-12-29 22:16:30 +0000 | [diff] [blame] | 3035 | void ASTStmtReader::VisitOMPTargetTeamsDistributeParallelForDirective( |
| 3036 | OMPTargetTeamsDistributeParallelForDirective *D) { |
| 3037 | VisitOMPLoopDirective(D); |
Alexey Bataev | 16e7988 | 2017-11-22 21:12:03 +0000 | [diff] [blame] | 3038 | D->setHasCancel(Record.readInt()); |
Kelvin Li | 80e8f56 | 2016-12-29 22:16:30 +0000 | [diff] [blame] | 3039 | } |
| 3040 | |
Kelvin Li | 1851df5 | 2017-01-03 05:23:48 +0000 | [diff] [blame] | 3041 | void ASTStmtReader::VisitOMPTargetTeamsDistributeParallelForSimdDirective( |
| 3042 | OMPTargetTeamsDistributeParallelForSimdDirective *D) { |
| 3043 | VisitOMPLoopDirective(D); |
| 3044 | } |
| 3045 | |
Kelvin Li | da68118 | 2017-01-10 18:08:18 +0000 | [diff] [blame] | 3046 | void ASTStmtReader::VisitOMPTargetTeamsDistributeSimdDirective( |
| 3047 | OMPTargetTeamsDistributeSimdDirective *D) { |
| 3048 | VisitOMPLoopDirective(D); |
| 3049 | } |
| 3050 | |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 3051 | //===----------------------------------------------------------------------===// |
John McCall | fa19404 | 2011-07-15 07:00:14 +0000 | [diff] [blame] | 3052 | // ASTReader Implementation |
| 3053 | //===----------------------------------------------------------------------===// |
| 3054 | |
Douglas Gregor | de3ef50 | 2011-11-30 23:21:26 +0000 | [diff] [blame] | 3055 | Stmt *ASTReader::ReadStmt(ModuleFile &F) { |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 3056 | switch (ReadingKind) { |
Richard Smith | 629ff36 | 2013-07-31 00:26:46 +0000 | [diff] [blame] | 3057 | case Read_None: |
| 3058 | llvm_unreachable("should not call this when not reading anything"); |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 3059 | case Read_Decl: |
| 3060 | case Read_Type: |
Sebastian Redl | 2c373b9 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 3061 | return ReadStmtFromStream(F); |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 3062 | case Read_Stmt: |
Argyrios Kyrtzidis | 26d7201 | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 3063 | return ReadSubStmt(); |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 3064 | } |
| 3065 | |
| 3066 | llvm_unreachable("ReadingKind not set ?"); |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 3067 | } |
| 3068 | |
Douglas Gregor | de3ef50 | 2011-11-30 23:21:26 +0000 | [diff] [blame] | 3069 | Expr *ASTReader::ReadExpr(ModuleFile &F) { |
Sebastian Redl | 2c373b9 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 3070 | return cast_or_null<Expr>(ReadStmt(F)); |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 3071 | } |
Chris Lattner | e2437f4 | 2010-05-09 06:40:08 +0000 | [diff] [blame] | 3072 | |
Sebastian Redl | 2c499f6 | 2010-08-18 23:56:43 +0000 | [diff] [blame] | 3073 | Expr *ASTReader::ReadSubExpr() { |
Argyrios Kyrtzidis | 26d7201 | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 3074 | return cast_or_null<Expr>(ReadSubStmt()); |
| 3075 | } |
| 3076 | |
Chris Lattner | f426253 | 2009-04-27 05:41:06 +0000 | [diff] [blame] | 3077 | // Within the bitstream, expressions are stored in Reverse Polish |
| 3078 | // Notation, with each of the subexpressions preceding the |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 3079 | // expression they are stored in. Subexpressions are stored from last to first. |
| 3080 | // To evaluate expressions, we continue reading expressions and placing them on |
| 3081 | // the stack, with expressions having operands removing those operands from the |
Chris Lattner | f426253 | 2009-04-27 05:41:06 +0000 | [diff] [blame] | 3082 | // stack. Evaluation terminates when we see a STMT_STOP record, and |
| 3083 | // the single remaining expression on the stack is our result. |
Douglas Gregor | de3ef50 | 2011-11-30 23:21:26 +0000 | [diff] [blame] | 3084 | Stmt *ASTReader::ReadStmtFromStream(ModuleFile &F) { |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 3085 | ReadingKindTracker ReadingKind(Read_Stmt, *this); |
Sebastian Redl | 2c373b9 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 3086 | llvm::BitstreamCursor &Cursor = F.DeclsCursor; |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 3087 | |
Argyrios Kyrtzidis | 6a59897 | 2011-10-21 23:02:28 +0000 | [diff] [blame] | 3088 | // Map of offset to previously deserialized stmt. The offset points |
George Burgess IV | 758cf9d | 2017-02-14 05:52:57 +0000 | [diff] [blame] | 3089 | // just after the stmt record. |
Argyrios Kyrtzidis | 6a59897 | 2011-10-21 23:02:28 +0000 | [diff] [blame] | 3090 | llvm::DenseMap<uint64_t, Stmt *> StmtEntries; |
Sebastian Redl | 2c373b9 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 3091 | |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 3092 | #ifndef NDEBUG |
| 3093 | unsigned PrevNumStmts = StmtStack.size(); |
| 3094 | #endif |
| 3095 | |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 3096 | ASTRecordReader Record(*this, F); |
| 3097 | ASTStmtReader Reader(Record, Cursor); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3098 | Stmt::EmptyShell Empty; |
| 3099 | |
| 3100 | while (true) { |
Chris Lattner | 0e6c940 | 2013-01-20 02:38:54 +0000 | [diff] [blame] | 3101 | llvm::BitstreamEntry Entry = Cursor.advanceSkippingSubblocks(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 3102 | |
Chris Lattner | 0e6c940 | 2013-01-20 02:38:54 +0000 | [diff] [blame] | 3103 | switch (Entry.Kind) { |
| 3104 | case llvm::BitstreamEntry::SubBlock: // Handled for us already. |
| 3105 | case llvm::BitstreamEntry::Error: |
| 3106 | Error("malformed block record in AST file"); |
Craig Topper | a13603a | 2014-05-22 05:54:18 +0000 | [diff] [blame] | 3107 | return nullptr; |
Chris Lattner | 0e6c940 | 2013-01-20 02:38:54 +0000 | [diff] [blame] | 3108 | case llvm::BitstreamEntry::EndBlock: |
| 3109 | goto Done; |
| 3110 | case llvm::BitstreamEntry::Record: |
| 3111 | // The interesting case. |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3112 | break; |
| 3113 | } |
| 3114 | |
Richard Smith | dbafb6c | 2017-06-29 23:23:46 +0000 | [diff] [blame] | 3115 | ASTContext &Context = getContext(); |
Craig Topper | a13603a | 2014-05-22 05:54:18 +0000 | [diff] [blame] | 3116 | Stmt *S = nullptr; |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3117 | bool Finished = false; |
Argyrios Kyrtzidis | 6a59897 | 2011-10-21 23:02:28 +0000 | [diff] [blame] | 3118 | bool IsStmtReference = false; |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 3119 | switch ((StmtCode)Record.readRecord(Cursor, Entry.ID)) { |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3120 | case STMT_STOP: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3121 | Finished = true; |
| 3122 | break; |
| 3123 | |
Argyrios Kyrtzidis | 6a59897 | 2011-10-21 23:02:28 +0000 | [diff] [blame] | 3124 | case STMT_REF_PTR: |
| 3125 | IsStmtReference = true; |
| 3126 | assert(StmtEntries.find(Record[0]) != StmtEntries.end() && |
| 3127 | "No stmt was recorded for this offset reference!"); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 3128 | S = StmtEntries[Record.readInt()]; |
Argyrios Kyrtzidis | 6a59897 | 2011-10-21 23:02:28 +0000 | [diff] [blame] | 3129 | break; |
| 3130 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3131 | case STMT_NULL_PTR: |
Craig Topper | a13603a | 2014-05-22 05:54:18 +0000 | [diff] [blame] | 3132 | S = nullptr; |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3133 | break; |
| 3134 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3135 | case STMT_NULL: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3136 | S = new (Context) NullStmt(Empty); |
| 3137 | break; |
| 3138 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3139 | case STMT_COMPOUND: |
Benjamin Kramer | 0742090 | 2017-12-24 16:24:20 +0000 | [diff] [blame] | 3140 | S = CompoundStmt::CreateEmpty( |
| 3141 | Context, /*NumStmts=*/Record[ASTStmtReader::NumStmtFields]); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3142 | break; |
| 3143 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3144 | case STMT_CASE: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3145 | S = new (Context) CaseStmt(Empty); |
| 3146 | break; |
| 3147 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3148 | case STMT_DEFAULT: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3149 | S = new (Context) DefaultStmt(Empty); |
| 3150 | break; |
| 3151 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3152 | case STMT_LABEL: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3153 | S = new (Context) LabelStmt(Empty); |
| 3154 | break; |
| 3155 | |
Richard Smith | c202b28 | 2012-04-14 00:33:13 +0000 | [diff] [blame] | 3156 | case STMT_ATTRIBUTED: |
Alexander Kornienko | 20f6fc6 | 2012-07-09 10:04:07 +0000 | [diff] [blame] | 3157 | S = AttributedStmt::CreateEmpty( |
| 3158 | Context, |
| 3159 | /*NumAttrs*/Record[ASTStmtReader::NumStmtFields]); |
Richard Smith | c202b28 | 2012-04-14 00:33:13 +0000 | [diff] [blame] | 3160 | break; |
| 3161 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3162 | case STMT_IF: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3163 | S = new (Context) IfStmt(Empty); |
| 3164 | break; |
| 3165 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3166 | case STMT_SWITCH: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3167 | S = new (Context) SwitchStmt(Empty); |
| 3168 | break; |
| 3169 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3170 | case STMT_WHILE: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3171 | S = new (Context) WhileStmt(Empty); |
| 3172 | break; |
| 3173 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3174 | case STMT_DO: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3175 | S = new (Context) DoStmt(Empty); |
| 3176 | break; |
Mike Stump | 11289f4 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 3177 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3178 | case STMT_FOR: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3179 | S = new (Context) ForStmt(Empty); |
| 3180 | break; |
| 3181 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3182 | case STMT_GOTO: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3183 | S = new (Context) GotoStmt(Empty); |
| 3184 | break; |
Mike Stump | 11289f4 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 3185 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3186 | case STMT_INDIRECT_GOTO: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3187 | S = new (Context) IndirectGotoStmt(Empty); |
| 3188 | break; |
| 3189 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3190 | case STMT_CONTINUE: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3191 | S = new (Context) ContinueStmt(Empty); |
| 3192 | break; |
| 3193 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3194 | case STMT_BREAK: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3195 | S = new (Context) BreakStmt(Empty); |
| 3196 | break; |
| 3197 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3198 | case STMT_RETURN: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3199 | S = new (Context) ReturnStmt(Empty); |
| 3200 | break; |
| 3201 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3202 | case STMT_DECL: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3203 | S = new (Context) DeclStmt(Empty); |
| 3204 | break; |
| 3205 | |
Chad Rosier | de70e0e | 2012-08-25 00:11:56 +0000 | [diff] [blame] | 3206 | case STMT_GCCASM: |
| 3207 | S = new (Context) GCCAsmStmt(Empty); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3208 | break; |
| 3209 | |
Chad Rosier | e30d499 | 2012-08-24 23:51:02 +0000 | [diff] [blame] | 3210 | case STMT_MSASM: |
| 3211 | S = new (Context) MSAsmStmt(Empty); |
| 3212 | break; |
| 3213 | |
Tareq A. Siraj | 24110cc | 2013-04-16 18:53:08 +0000 | [diff] [blame] | 3214 | case STMT_CAPTURED: |
Ben Langmuir | ce914fc | 2013-05-03 19:20:19 +0000 | [diff] [blame] | 3215 | S = CapturedStmt::CreateDeserialized(Context, |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 3216 | Record[ASTStmtReader::NumStmtFields]); |
Tareq A. Siraj | 24110cc | 2013-04-16 18:53:08 +0000 | [diff] [blame] | 3217 | break; |
| 3218 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3219 | case EXPR_PREDEFINED: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3220 | S = new (Context) PredefinedExpr(Empty); |
| 3221 | break; |
Mike Stump | 11289f4 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 3222 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3223 | case EXPR_DECL_REF: |
Chandler Carruth | 8d26bb0 | 2011-05-01 23:48:14 +0000 | [diff] [blame] | 3224 | S = DeclRefExpr::CreateEmpty( |
Douglas Gregor | 4163aca | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 3225 | Context, |
Chandler Carruth | 8d26bb0 | 2011-05-01 23:48:14 +0000 | [diff] [blame] | 3226 | /*HasQualifier=*/Record[ASTStmtReader::NumExprFields], |
| 3227 | /*HasFoundDecl=*/Record[ASTStmtReader::NumExprFields + 1], |
Abramo Bagnara | 7945c98 | 2012-01-27 09:46:47 +0000 | [diff] [blame] | 3228 | /*HasTemplateKWAndArgsInfo=*/Record[ASTStmtReader::NumExprFields + 2], |
Chandler Carruth | 8d26bb0 | 2011-05-01 23:48:14 +0000 | [diff] [blame] | 3229 | /*NumTemplateArgs=*/Record[ASTStmtReader::NumExprFields + 2] ? |
John McCall | 113bee0 | 2012-03-10 09:33:50 +0000 | [diff] [blame] | 3230 | Record[ASTStmtReader::NumExprFields + 5] : 0); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3231 | break; |
Mike Stump | 11289f4 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 3232 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3233 | case EXPR_INTEGER_LITERAL: |
Douglas Gregor | 4163aca | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 3234 | S = IntegerLiteral::Create(Context, Empty); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3235 | break; |
Mike Stump | 11289f4 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 3236 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3237 | case EXPR_FLOATING_LITERAL: |
Douglas Gregor | 4163aca | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 3238 | S = FloatingLiteral::Create(Context, Empty); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3239 | break; |
Mike Stump | 11289f4 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 3240 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3241 | case EXPR_IMAGINARY_LITERAL: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3242 | S = new (Context) ImaginaryLiteral(Empty); |
| 3243 | break; |
| 3244 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3245 | case EXPR_STRING_LITERAL: |
Douglas Gregor | 4163aca | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 3246 | S = StringLiteral::CreateEmpty(Context, |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 3247 | Record[ASTStmtReader::NumExprFields + 1]); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3248 | break; |
| 3249 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3250 | case EXPR_CHARACTER_LITERAL: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3251 | S = new (Context) CharacterLiteral(Empty); |
| 3252 | break; |
| 3253 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3254 | case EXPR_PAREN: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3255 | S = new (Context) ParenExpr(Empty); |
| 3256 | break; |
| 3257 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3258 | case EXPR_PAREN_LIST: |
Argyrios Kyrtzidis | f9f47c8 | 2010-06-30 08:49:18 +0000 | [diff] [blame] | 3259 | S = new (Context) ParenListExpr(Empty); |
| 3260 | break; |
| 3261 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3262 | case EXPR_UNARY_OPERATOR: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3263 | S = new (Context) UnaryOperator(Empty); |
| 3264 | break; |
| 3265 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3266 | case EXPR_OFFSETOF: |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 3267 | S = OffsetOfExpr::CreateEmpty(Context, |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 3268 | Record[ASTStmtReader::NumExprFields], |
| 3269 | Record[ASTStmtReader::NumExprFields + 1]); |
Douglas Gregor | 882211c | 2010-04-28 22:16:22 +0000 | [diff] [blame] | 3270 | break; |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 3271 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3272 | case EXPR_SIZEOF_ALIGN_OF: |
Peter Collingbourne | e190dee | 2011-03-11 19:24:49 +0000 | [diff] [blame] | 3273 | S = new (Context) UnaryExprOrTypeTraitExpr(Empty); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3274 | break; |
| 3275 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3276 | case EXPR_ARRAY_SUBSCRIPT: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3277 | S = new (Context) ArraySubscriptExpr(Empty); |
| 3278 | break; |
| 3279 | |
Alexey Bataev | 1a3320e | 2015-08-25 14:24:04 +0000 | [diff] [blame] | 3280 | case EXPR_OMP_ARRAY_SECTION: |
| 3281 | S = new (Context) OMPArraySectionExpr(Empty); |
| 3282 | break; |
| 3283 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3284 | case EXPR_CALL: |
Douglas Gregor | 4163aca | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 3285 | S = new (Context) CallExpr(Context, Stmt::CallExprClass, Empty); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3286 | break; |
| 3287 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3288 | case EXPR_MEMBER: { |
Argyrios Kyrtzidis | 1985bb3 | 2010-07-08 13:09:47 +0000 | [diff] [blame] | 3289 | // We load everything here and fully initialize it at creation. |
| 3290 | // That way we can use MemberExpr::Create and don't have to duplicate its |
| 3291 | // logic with a MemberExpr::CreateEmpty. |
| 3292 | |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 3293 | assert(Record.getIdx() == 0); |
Douglas Gregor | ea972d3 | 2011-02-28 21:54:11 +0000 | [diff] [blame] | 3294 | NestedNameSpecifierLoc QualifierLoc; |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 3295 | if (Record.readInt()) { // HasQualifier. |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 3296 | QualifierLoc = Record.readNestedNameSpecifierLoc(); |
Argyrios Kyrtzidis | 1985bb3 | 2010-07-08 13:09:47 +0000 | [diff] [blame] | 3297 | } |
| 3298 | |
Abramo Bagnara | 7945c98 | 2012-01-27 09:46:47 +0000 | [diff] [blame] | 3299 | SourceLocation TemplateKWLoc; |
Argyrios Kyrtzidis | 1985bb3 | 2010-07-08 13:09:47 +0000 | [diff] [blame] | 3300 | TemplateArgumentListInfo ArgInfo; |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 3301 | bool HasTemplateKWAndArgsInfo = Record.readInt(); |
Abramo Bagnara | 7945c98 | 2012-01-27 09:46:47 +0000 | [diff] [blame] | 3302 | if (HasTemplateKWAndArgsInfo) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 3303 | TemplateKWLoc = Record.readSourceLocation(); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 3304 | unsigned NumTemplateArgs = Record.readInt(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 3305 | ArgInfo.setLAngleLoc(Record.readSourceLocation()); |
| 3306 | ArgInfo.setRAngleLoc(Record.readSourceLocation()); |
Argyrios Kyrtzidis | 1985bb3 | 2010-07-08 13:09:47 +0000 | [diff] [blame] | 3307 | for (unsigned i = 0; i != NumTemplateArgs; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 3308 | ArgInfo.addArgument(Record.readTemplateArgumentLoc()); |
Argyrios Kyrtzidis | 1985bb3 | 2010-07-08 13:09:47 +0000 | [diff] [blame] | 3309 | } |
Abramo Bagnara | 635ed24e | 2011-10-05 07:56:41 +0000 | [diff] [blame] | 3310 | |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 3311 | bool HadMultipleCandidates = Record.readInt(); |
Abramo Bagnara | 635ed24e | 2011-10-05 07:56:41 +0000 | [diff] [blame] | 3312 | |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3313 | auto *FoundD = Record.readDeclAs<NamedDecl>(); |
| 3314 | auto AS = (AccessSpecifier)Record.readInt(); |
Argyrios Kyrtzidis | 1985bb3 | 2010-07-08 13:09:47 +0000 | [diff] [blame] | 3315 | DeclAccessPair FoundDecl = DeclAccessPair::make(FoundD, AS); |
| 3316 | |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 3317 | QualType T = Record.readType(); |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3318 | auto VK = static_cast<ExprValueKind>(Record.readInt()); |
| 3319 | auto OK = static_cast<ExprObjectKind>(Record.readInt()); |
Argyrios Kyrtzidis | 1985bb3 | 2010-07-08 13:09:47 +0000 | [diff] [blame] | 3320 | Expr *Base = ReadSubExpr(); |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3321 | auto *MemberD = Record.readDeclAs<ValueDecl>(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 3322 | SourceLocation MemberLoc = Record.readSourceLocation(); |
Yunzhong Gao | eba323a | 2015-05-01 02:04:32 +0000 | [diff] [blame] | 3323 | DeclarationNameInfo MemberNameInfo(MemberD->getDeclName(), MemberLoc); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 3324 | bool IsArrow = Record.readInt(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 3325 | SourceLocation OperatorLoc = Record.readSourceLocation(); |
Yunzhong Gao | eba323a | 2015-05-01 02:04:32 +0000 | [diff] [blame] | 3326 | |
| 3327 | S = MemberExpr::Create(Context, Base, IsArrow, OperatorLoc, QualifierLoc, |
| 3328 | TemplateKWLoc, MemberD, FoundDecl, MemberNameInfo, |
| 3329 | HasTemplateKWAndArgsInfo ? &ArgInfo : nullptr, T, |
| 3330 | VK, OK); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 3331 | Record.readDeclarationNameLoc(cast<MemberExpr>(S)->MemberDNLoc, |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 3332 | MemberD->getDeclName()); |
Yunzhong Gao | eba323a | 2015-05-01 02:04:32 +0000 | [diff] [blame] | 3333 | if (HadMultipleCandidates) |
Abramo Bagnara | 635ed24e | 2011-10-05 07:56:41 +0000 | [diff] [blame] | 3334 | cast<MemberExpr>(S)->setHadMultipleCandidates(true); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3335 | break; |
Argyrios Kyrtzidis | 1985bb3 | 2010-07-08 13:09:47 +0000 | [diff] [blame] | 3336 | } |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3337 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3338 | case EXPR_BINARY_OPERATOR: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3339 | S = new (Context) BinaryOperator(Empty); |
| 3340 | break; |
| 3341 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3342 | case EXPR_COMPOUND_ASSIGN_OPERATOR: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3343 | S = new (Context) CompoundAssignOperator(Empty); |
| 3344 | break; |
| 3345 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3346 | case EXPR_CONDITIONAL_OPERATOR: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3347 | S = new (Context) ConditionalOperator(Empty); |
| 3348 | break; |
| 3349 | |
John McCall | c07a0c7 | 2011-02-17 10:25:35 +0000 | [diff] [blame] | 3350 | case EXPR_BINARY_CONDITIONAL_OPERATOR: |
| 3351 | S = new (Context) BinaryConditionalOperator(Empty); |
| 3352 | break; |
| 3353 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3354 | case EXPR_IMPLICIT_CAST: |
Douglas Gregor | 4163aca | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 3355 | S = ImplicitCastExpr::CreateEmpty(Context, |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 3356 | /*PathSize*/ Record[ASTStmtReader::NumExprFields]); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3357 | break; |
| 3358 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3359 | case EXPR_CSTYLE_CAST: |
Douglas Gregor | 4163aca | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 3360 | S = CStyleCastExpr::CreateEmpty(Context, |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 3361 | /*PathSize*/ Record[ASTStmtReader::NumExprFields]); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3362 | break; |
| 3363 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3364 | case EXPR_COMPOUND_LITERAL: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3365 | S = new (Context) CompoundLiteralExpr(Empty); |
| 3366 | break; |
| 3367 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3368 | case EXPR_EXT_VECTOR_ELEMENT: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3369 | S = new (Context) ExtVectorElementExpr(Empty); |
| 3370 | break; |
| 3371 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3372 | case EXPR_INIT_LIST: |
Argyrios Kyrtzidis | 0f05fb9 | 2012-11-28 03:56:16 +0000 | [diff] [blame] | 3373 | S = new (Context) InitListExpr(Empty); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3374 | break; |
| 3375 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3376 | case EXPR_DESIGNATED_INIT: |
Douglas Gregor | 4163aca | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 3377 | S = DesignatedInitExpr::CreateEmpty(Context, |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 3378 | Record[ASTStmtReader::NumExprFields] - 1); |
Mike Stump | 11289f4 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 3379 | |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3380 | break; |
| 3381 | |
Yunzhong Gao | cb77930 | 2015-06-10 00:27:52 +0000 | [diff] [blame] | 3382 | case EXPR_DESIGNATED_INIT_UPDATE: |
| 3383 | S = new (Context) DesignatedInitUpdateExpr(Empty); |
| 3384 | break; |
| 3385 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3386 | case EXPR_IMPLICIT_VALUE_INIT: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3387 | S = new (Context) ImplicitValueInitExpr(Empty); |
| 3388 | break; |
| 3389 | |
Yunzhong Gao | cb77930 | 2015-06-10 00:27:52 +0000 | [diff] [blame] | 3390 | case EXPR_NO_INIT: |
| 3391 | S = new (Context) NoInitExpr(Empty); |
| 3392 | break; |
| 3393 | |
Richard Smith | 410306b | 2016-12-12 02:53:20 +0000 | [diff] [blame] | 3394 | case EXPR_ARRAY_INIT_LOOP: |
| 3395 | S = new (Context) ArrayInitLoopExpr(Empty); |
| 3396 | break; |
| 3397 | |
| 3398 | case EXPR_ARRAY_INIT_INDEX: |
| 3399 | S = new (Context) ArrayInitIndexExpr(Empty); |
| 3400 | break; |
| 3401 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3402 | case EXPR_VA_ARG: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3403 | S = new (Context) VAArgExpr(Empty); |
| 3404 | break; |
| 3405 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3406 | case EXPR_ADDR_LABEL: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3407 | S = new (Context) AddrLabelExpr(Empty); |
| 3408 | break; |
| 3409 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3410 | case EXPR_STMT: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3411 | S = new (Context) StmtExpr(Empty); |
| 3412 | break; |
| 3413 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3414 | case EXPR_CHOOSE: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3415 | S = new (Context) ChooseExpr(Empty); |
| 3416 | break; |
| 3417 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3418 | case EXPR_GNU_NULL: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3419 | S = new (Context) GNUNullExpr(Empty); |
| 3420 | break; |
| 3421 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3422 | case EXPR_SHUFFLE_VECTOR: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3423 | S = new (Context) ShuffleVectorExpr(Empty); |
| 3424 | break; |
Mike Stump | 11289f4 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 3425 | |
Hal Finkel | c4d7c82 | 2013-09-18 03:29:45 +0000 | [diff] [blame] | 3426 | case EXPR_CONVERT_VECTOR: |
| 3427 | S = new (Context) ConvertVectorExpr(Empty); |
| 3428 | break; |
| 3429 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3430 | case EXPR_BLOCK: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3431 | S = new (Context) BlockExpr(Empty); |
| 3432 | break; |
| 3433 | |
Peter Collingbourne | 9114759 | 2011-04-15 00:35:48 +0000 | [diff] [blame] | 3434 | case EXPR_GENERIC_SELECTION: |
| 3435 | S = new (Context) GenericSelectionExpr(Empty); |
| 3436 | break; |
| 3437 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3438 | case EXPR_OBJC_STRING_LITERAL: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3439 | S = new (Context) ObjCStringLiteral(Empty); |
| 3440 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3441 | |
Patrick Beard | 0caa394 | 2012-04-19 00:25:12 +0000 | [diff] [blame] | 3442 | case EXPR_OBJC_BOXED_EXPRESSION: |
| 3443 | S = new (Context) ObjCBoxedExpr(Empty); |
Ted Kremenek | e65b086 | 2012-03-06 20:05:56 +0000 | [diff] [blame] | 3444 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3445 | |
Ted Kremenek | e65b086 | 2012-03-06 20:05:56 +0000 | [diff] [blame] | 3446 | case EXPR_OBJC_ARRAY_LITERAL: |
| 3447 | S = ObjCArrayLiteral::CreateEmpty(Context, |
| 3448 | Record[ASTStmtReader::NumExprFields]); |
| 3449 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3450 | |
Ted Kremenek | e65b086 | 2012-03-06 20:05:56 +0000 | [diff] [blame] | 3451 | case EXPR_OBJC_DICTIONARY_LITERAL: |
| 3452 | S = ObjCDictionaryLiteral::CreateEmpty(Context, |
| 3453 | Record[ASTStmtReader::NumExprFields], |
| 3454 | Record[ASTStmtReader::NumExprFields + 1]); |
| 3455 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3456 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3457 | case EXPR_OBJC_ENCODE: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3458 | S = new (Context) ObjCEncodeExpr(Empty); |
| 3459 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3460 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3461 | case EXPR_OBJC_SELECTOR_EXPR: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3462 | S = new (Context) ObjCSelectorExpr(Empty); |
| 3463 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3464 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3465 | case EXPR_OBJC_PROTOCOL_EXPR: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3466 | S = new (Context) ObjCProtocolExpr(Empty); |
| 3467 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3468 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3469 | case EXPR_OBJC_IVAR_REF_EXPR: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3470 | S = new (Context) ObjCIvarRefExpr(Empty); |
| 3471 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3472 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3473 | case EXPR_OBJC_PROPERTY_REF_EXPR: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3474 | S = new (Context) ObjCPropertyRefExpr(Empty); |
| 3475 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3476 | |
Ted Kremenek | e65b086 | 2012-03-06 20:05:56 +0000 | [diff] [blame] | 3477 | case EXPR_OBJC_SUBSCRIPT_REF_EXPR: |
| 3478 | S = new (Context) ObjCSubscriptRefExpr(Empty); |
| 3479 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3480 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3481 | case EXPR_OBJC_KVC_REF_EXPR: |
John McCall | b7bd14f | 2010-12-02 01:19:52 +0000 | [diff] [blame] | 3482 | llvm_unreachable("mismatching AST file"); |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3483 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3484 | case EXPR_OBJC_MESSAGE_EXPR: |
Douglas Gregor | 4163aca | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 3485 | S = ObjCMessageExpr::CreateEmpty(Context, |
Argyrios Kyrtzidis | a6011e2 | 2011-10-03 06:36:51 +0000 | [diff] [blame] | 3486 | Record[ASTStmtReader::NumExprFields], |
| 3487 | Record[ASTStmtReader::NumExprFields + 1]); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3488 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3489 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3490 | case EXPR_OBJC_ISA: |
Steve Naroff | e87026a | 2009-07-24 17:54:45 +0000 | [diff] [blame] | 3491 | S = new (Context) ObjCIsaExpr(Empty); |
| 3492 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3493 | |
John McCall | 31168b0 | 2011-06-15 23:02:42 +0000 | [diff] [blame] | 3494 | case EXPR_OBJC_INDIRECT_COPY_RESTORE: |
| 3495 | S = new (Context) ObjCIndirectCopyRestoreExpr(Empty); |
| 3496 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3497 | |
John McCall | 31168b0 | 2011-06-15 23:02:42 +0000 | [diff] [blame] | 3498 | case EXPR_OBJC_BRIDGED_CAST: |
| 3499 | S = new (Context) ObjCBridgedCastExpr(Empty); |
| 3500 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3501 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3502 | case STMT_OBJC_FOR_COLLECTION: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3503 | S = new (Context) ObjCForCollectionStmt(Empty); |
| 3504 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3505 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3506 | case STMT_OBJC_CATCH: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3507 | S = new (Context) ObjCAtCatchStmt(Empty); |
| 3508 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3509 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3510 | case STMT_OBJC_FINALLY: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3511 | S = new (Context) ObjCAtFinallyStmt(Empty); |
| 3512 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3513 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3514 | case STMT_OBJC_AT_TRY: |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 3515 | S = ObjCAtTryStmt::CreateEmpty(Context, |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 3516 | Record[ASTStmtReader::NumStmtFields], |
| 3517 | Record[ASTStmtReader::NumStmtFields + 1]); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3518 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3519 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3520 | case STMT_OBJC_AT_SYNCHRONIZED: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3521 | S = new (Context) ObjCAtSynchronizedStmt(Empty); |
| 3522 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3523 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3524 | case STMT_OBJC_AT_THROW: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3525 | S = new (Context) ObjCAtThrowStmt(Empty); |
| 3526 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3527 | |
John McCall | 31168b0 | 2011-06-15 23:02:42 +0000 | [diff] [blame] | 3528 | case STMT_OBJC_AUTORELEASE_POOL: |
| 3529 | S = new (Context) ObjCAutoreleasePoolStmt(Empty); |
| 3530 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3531 | |
Ted Kremenek | e65b086 | 2012-03-06 20:05:56 +0000 | [diff] [blame] | 3532 | case EXPR_OBJC_BOOL_LITERAL: |
| 3533 | S = new (Context) ObjCBoolLiteralExpr(Empty); |
| 3534 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3535 | |
Erik Pilkington | 29099de | 2016-07-16 00:35:23 +0000 | [diff] [blame] | 3536 | case EXPR_OBJC_AVAILABILITY_CHECK: |
| 3537 | S = new (Context) ObjCAvailabilityCheckExpr(Empty); |
| 3538 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3539 | |
Nico Weber | 9b98207 | 2014-07-07 00:12:30 +0000 | [diff] [blame] | 3540 | case STMT_SEH_LEAVE: |
| 3541 | S = new (Context) SEHLeaveStmt(Empty); |
| 3542 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3543 | |
John McCall | fa19404 | 2011-07-15 07:00:14 +0000 | [diff] [blame] | 3544 | case STMT_SEH_EXCEPT: |
| 3545 | S = new (Context) SEHExceptStmt(Empty); |
| 3546 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3547 | |
John McCall | fa19404 | 2011-07-15 07:00:14 +0000 | [diff] [blame] | 3548 | case STMT_SEH_FINALLY: |
| 3549 | S = new (Context) SEHFinallyStmt(Empty); |
| 3550 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3551 | |
John McCall | fa19404 | 2011-07-15 07:00:14 +0000 | [diff] [blame] | 3552 | case STMT_SEH_TRY: |
| 3553 | S = new (Context) SEHTryStmt(Empty); |
| 3554 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3555 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3556 | case STMT_CXX_CATCH: |
Argyrios Kyrtzidis | 47cd7a9 | 2010-07-22 16:03:56 +0000 | [diff] [blame] | 3557 | S = new (Context) CXXCatchStmt(Empty); |
| 3558 | break; |
| 3559 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3560 | case STMT_CXX_TRY: |
Douglas Gregor | 4163aca | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 3561 | S = CXXTryStmt::Create(Context, Empty, |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 3562 | /*NumHandlers=*/Record[ASTStmtReader::NumStmtFields]); |
Argyrios Kyrtzidis | 47cd7a9 | 2010-07-22 16:03:56 +0000 | [diff] [blame] | 3563 | break; |
| 3564 | |
Richard Smith | 02e85f3 | 2011-04-14 22:09:26 +0000 | [diff] [blame] | 3565 | case STMT_CXX_FOR_RANGE: |
| 3566 | S = new (Context) CXXForRangeStmt(Empty); |
| 3567 | break; |
| 3568 | |
Douglas Gregor | deb4a2be | 2011-10-25 01:33:02 +0000 | [diff] [blame] | 3569 | case STMT_MS_DEPENDENT_EXISTS: |
| 3570 | S = new (Context) MSDependentExistsStmt(SourceLocation(), true, |
| 3571 | NestedNameSpecifierLoc(), |
| 3572 | DeclarationNameInfo(), |
Craig Topper | a13603a | 2014-05-22 05:54:18 +0000 | [diff] [blame] | 3573 | nullptr); |
Douglas Gregor | deb4a2be | 2011-10-25 01:33:02 +0000 | [diff] [blame] | 3574 | break; |
Alexey Bataev | 1b59ab5 | 2014-02-27 08:29:12 +0000 | [diff] [blame] | 3575 | |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 3576 | case STMT_OMP_PARALLEL_DIRECTIVE: |
| 3577 | S = |
| 3578 | OMPParallelDirective::CreateEmpty(Context, |
| 3579 | Record[ASTStmtReader::NumStmtFields], |
| 3580 | Empty); |
| 3581 | break; |
Alexey Bataev | 1b59ab5 | 2014-02-27 08:29:12 +0000 | [diff] [blame] | 3582 | |
| 3583 | case STMT_OMP_SIMD_DIRECTIVE: { |
| 3584 | unsigned NumClauses = Record[ASTStmtReader::NumStmtFields]; |
| 3585 | unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1]; |
| 3586 | S = OMPSimdDirective::CreateEmpty(Context, NumClauses, |
| 3587 | CollapsedNum, Empty); |
| 3588 | break; |
| 3589 | } |
| 3590 | |
Alexey Bataev | f29276e | 2014-06-18 04:14:57 +0000 | [diff] [blame] | 3591 | case STMT_OMP_FOR_DIRECTIVE: { |
| 3592 | unsigned NumClauses = Record[ASTStmtReader::NumStmtFields]; |
| 3593 | unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1]; |
| 3594 | S = OMPForDirective::CreateEmpty(Context, NumClauses, CollapsedNum, |
| 3595 | Empty); |
| 3596 | break; |
| 3597 | } |
| 3598 | |
Alexander Musman | f82886e | 2014-09-18 05:12:34 +0000 | [diff] [blame] | 3599 | case STMT_OMP_FOR_SIMD_DIRECTIVE: { |
| 3600 | unsigned NumClauses = Record[ASTStmtReader::NumStmtFields]; |
| 3601 | unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1]; |
| 3602 | S = OMPForSimdDirective::CreateEmpty(Context, NumClauses, CollapsedNum, |
| 3603 | Empty); |
| 3604 | break; |
| 3605 | } |
| 3606 | |
Alexey Bataev | d3f8dd2 | 2014-06-25 11:44:49 +0000 | [diff] [blame] | 3607 | case STMT_OMP_SECTIONS_DIRECTIVE: |
| 3608 | S = OMPSectionsDirective::CreateEmpty( |
| 3609 | Context, Record[ASTStmtReader::NumStmtFields], Empty); |
| 3610 | break; |
| 3611 | |
Alexey Bataev | 1e0498a | 2014-06-26 08:21:58 +0000 | [diff] [blame] | 3612 | case STMT_OMP_SECTION_DIRECTIVE: |
| 3613 | S = OMPSectionDirective::CreateEmpty(Context, Empty); |
| 3614 | break; |
| 3615 | |
Alexey Bataev | d1e40fb | 2014-06-26 12:05:45 +0000 | [diff] [blame] | 3616 | case STMT_OMP_SINGLE_DIRECTIVE: |
| 3617 | S = OMPSingleDirective::CreateEmpty( |
| 3618 | Context, Record[ASTStmtReader::NumStmtFields], Empty); |
| 3619 | break; |
| 3620 | |
Alexander Musman | 80c2289 | 2014-07-17 08:54:58 +0000 | [diff] [blame] | 3621 | case STMT_OMP_MASTER_DIRECTIVE: |
| 3622 | S = OMPMasterDirective::CreateEmpty(Context, Empty); |
| 3623 | break; |
| 3624 | |
Alexander Musman | d9ed09f | 2014-07-21 09:42:05 +0000 | [diff] [blame] | 3625 | case STMT_OMP_CRITICAL_DIRECTIVE: |
Alexey Bataev | 28c7541 | 2015-12-15 08:19:24 +0000 | [diff] [blame] | 3626 | S = OMPCriticalDirective::CreateEmpty( |
| 3627 | Context, Record[ASTStmtReader::NumStmtFields], Empty); |
Alexander Musman | d9ed09f | 2014-07-21 09:42:05 +0000 | [diff] [blame] | 3628 | break; |
| 3629 | |
Alexey Bataev | 4acb859 | 2014-07-07 13:01:15 +0000 | [diff] [blame] | 3630 | case STMT_OMP_PARALLEL_FOR_DIRECTIVE: { |
| 3631 | unsigned NumClauses = Record[ASTStmtReader::NumStmtFields]; |
| 3632 | unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1]; |
| 3633 | S = OMPParallelForDirective::CreateEmpty(Context, NumClauses, |
| 3634 | CollapsedNum, Empty); |
| 3635 | break; |
| 3636 | } |
| 3637 | |
Alexander Musman | e4e893b | 2014-09-23 09:33:00 +0000 | [diff] [blame] | 3638 | case STMT_OMP_PARALLEL_FOR_SIMD_DIRECTIVE: { |
| 3639 | unsigned NumClauses = Record[ASTStmtReader::NumStmtFields]; |
| 3640 | unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1]; |
| 3641 | S = OMPParallelForSimdDirective::CreateEmpty(Context, NumClauses, |
| 3642 | CollapsedNum, Empty); |
| 3643 | break; |
| 3644 | } |
| 3645 | |
Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 3646 | case STMT_OMP_PARALLEL_SECTIONS_DIRECTIVE: |
| 3647 | S = OMPParallelSectionsDirective::CreateEmpty( |
| 3648 | Context, Record[ASTStmtReader::NumStmtFields], Empty); |
| 3649 | break; |
| 3650 | |
Alexey Bataev | 9c2e8ee | 2014-07-11 11:25:16 +0000 | [diff] [blame] | 3651 | case STMT_OMP_TASK_DIRECTIVE: |
| 3652 | S = OMPTaskDirective::CreateEmpty( |
| 3653 | Context, Record[ASTStmtReader::NumStmtFields], Empty); |
| 3654 | break; |
| 3655 | |
Alexey Bataev | 68446b7 | 2014-07-18 07:47:19 +0000 | [diff] [blame] | 3656 | case STMT_OMP_TASKYIELD_DIRECTIVE: |
| 3657 | S = OMPTaskyieldDirective::CreateEmpty(Context, Empty); |
| 3658 | break; |
| 3659 | |
Alexey Bataev | 4d1dfea | 2014-07-18 09:11:51 +0000 | [diff] [blame] | 3660 | case STMT_OMP_BARRIER_DIRECTIVE: |
| 3661 | S = OMPBarrierDirective::CreateEmpty(Context, Empty); |
| 3662 | break; |
| 3663 | |
Alexey Bataev | 2df347a | 2014-07-18 10:17:07 +0000 | [diff] [blame] | 3664 | case STMT_OMP_TASKWAIT_DIRECTIVE: |
| 3665 | S = OMPTaskwaitDirective::CreateEmpty(Context, Empty); |
| 3666 | break; |
| 3667 | |
Alexey Bataev | c30dd2d | 2015-06-18 12:14:09 +0000 | [diff] [blame] | 3668 | case STMT_OMP_TASKGROUP_DIRECTIVE: |
Alexey Bataev | 169d96a | 2017-07-18 20:17:46 +0000 | [diff] [blame] | 3669 | S = OMPTaskgroupDirective::CreateEmpty( |
| 3670 | Context, Record[ASTStmtReader::NumStmtFields], Empty); |
Alexey Bataev | c30dd2d | 2015-06-18 12:14:09 +0000 | [diff] [blame] | 3671 | break; |
| 3672 | |
Alexey Bataev | 6125da9 | 2014-07-21 11:26:11 +0000 | [diff] [blame] | 3673 | case STMT_OMP_FLUSH_DIRECTIVE: |
| 3674 | S = OMPFlushDirective::CreateEmpty( |
| 3675 | Context, Record[ASTStmtReader::NumStmtFields], Empty); |
| 3676 | break; |
| 3677 | |
Alexey Bataev | 9fb6e64 | 2014-07-22 06:45:04 +0000 | [diff] [blame] | 3678 | case STMT_OMP_ORDERED_DIRECTIVE: |
Alexey Bataev | 346265e | 2015-09-25 10:37:12 +0000 | [diff] [blame] | 3679 | S = OMPOrderedDirective::CreateEmpty( |
| 3680 | Context, Record[ASTStmtReader::NumStmtFields], Empty); |
Alexey Bataev | 9fb6e64 | 2014-07-22 06:45:04 +0000 | [diff] [blame] | 3681 | break; |
| 3682 | |
Alexey Bataev | 0162e45 | 2014-07-22 10:10:35 +0000 | [diff] [blame] | 3683 | case STMT_OMP_ATOMIC_DIRECTIVE: |
| 3684 | S = OMPAtomicDirective::CreateEmpty( |
| 3685 | Context, Record[ASTStmtReader::NumStmtFields], Empty); |
| 3686 | break; |
| 3687 | |
Alexey Bataev | 0bd520b | 2014-09-19 08:19:49 +0000 | [diff] [blame] | 3688 | case STMT_OMP_TARGET_DIRECTIVE: |
| 3689 | S = OMPTargetDirective::CreateEmpty( |
| 3690 | Context, Record[ASTStmtReader::NumStmtFields], Empty); |
| 3691 | break; |
| 3692 | |
Michael Wong | 65f367f | 2015-07-21 13:44:28 +0000 | [diff] [blame] | 3693 | case STMT_OMP_TARGET_DATA_DIRECTIVE: |
| 3694 | S = OMPTargetDataDirective::CreateEmpty( |
| 3695 | Context, Record[ASTStmtReader::NumStmtFields], Empty); |
| 3696 | break; |
| 3697 | |
Samuel Antao | df67fc4 | 2016-01-19 19:15:56 +0000 | [diff] [blame] | 3698 | case STMT_OMP_TARGET_ENTER_DATA_DIRECTIVE: |
| 3699 | S = OMPTargetEnterDataDirective::CreateEmpty( |
| 3700 | Context, Record[ASTStmtReader::NumStmtFields], Empty); |
| 3701 | break; |
| 3702 | |
Samuel Antao | 7259076 | 2016-01-19 20:04:50 +0000 | [diff] [blame] | 3703 | case STMT_OMP_TARGET_EXIT_DATA_DIRECTIVE: |
| 3704 | S = OMPTargetExitDataDirective::CreateEmpty( |
| 3705 | Context, Record[ASTStmtReader::NumStmtFields], Empty); |
| 3706 | break; |
| 3707 | |
Arpith Chacko Jacob | e955b3d | 2016-01-26 18:48:41 +0000 | [diff] [blame] | 3708 | case STMT_OMP_TARGET_PARALLEL_DIRECTIVE: |
| 3709 | S = OMPTargetParallelDirective::CreateEmpty( |
| 3710 | Context, Record[ASTStmtReader::NumStmtFields], Empty); |
| 3711 | break; |
| 3712 | |
Arpith Chacko Jacob | 05bebb5 | 2016-02-03 15:46:42 +0000 | [diff] [blame] | 3713 | case STMT_OMP_TARGET_PARALLEL_FOR_DIRECTIVE: { |
| 3714 | unsigned NumClauses = Record[ASTStmtReader::NumStmtFields]; |
| 3715 | unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1]; |
| 3716 | S = OMPTargetParallelForDirective::CreateEmpty(Context, NumClauses, |
| 3717 | CollapsedNum, Empty); |
| 3718 | break; |
| 3719 | } |
| 3720 | |
Samuel Antao | 686c70c | 2016-05-26 17:30:50 +0000 | [diff] [blame] | 3721 | case STMT_OMP_TARGET_UPDATE_DIRECTIVE: |
| 3722 | S = OMPTargetUpdateDirective::CreateEmpty( |
| 3723 | Context, Record[ASTStmtReader::NumStmtFields], Empty); |
| 3724 | break; |
| 3725 | |
Alexey Bataev | 13314bf | 2014-10-09 04:18:56 +0000 | [diff] [blame] | 3726 | case STMT_OMP_TEAMS_DIRECTIVE: |
| 3727 | S = OMPTeamsDirective::CreateEmpty( |
| 3728 | Context, Record[ASTStmtReader::NumStmtFields], Empty); |
| 3729 | break; |
| 3730 | |
Alexey Bataev | 6d4ed05 | 2015-07-01 06:57:41 +0000 | [diff] [blame] | 3731 | case STMT_OMP_CANCELLATION_POINT_DIRECTIVE: |
| 3732 | S = OMPCancellationPointDirective::CreateEmpty(Context, Empty); |
| 3733 | break; |
| 3734 | |
Alexey Bataev | 8090987 | 2015-07-02 11:25:17 +0000 | [diff] [blame] | 3735 | case STMT_OMP_CANCEL_DIRECTIVE: |
Alexey Bataev | 87933c7 | 2015-09-18 08:07:34 +0000 | [diff] [blame] | 3736 | S = OMPCancelDirective::CreateEmpty( |
| 3737 | Context, Record[ASTStmtReader::NumStmtFields], Empty); |
Alexey Bataev | 8090987 | 2015-07-02 11:25:17 +0000 | [diff] [blame] | 3738 | break; |
| 3739 | |
Alexey Bataev | 49f6e78 | 2015-12-01 04:18:41 +0000 | [diff] [blame] | 3740 | case STMT_OMP_TASKLOOP_DIRECTIVE: { |
| 3741 | unsigned NumClauses = Record[ASTStmtReader::NumStmtFields]; |
| 3742 | unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1]; |
| 3743 | S = OMPTaskLoopDirective::CreateEmpty(Context, NumClauses, CollapsedNum, |
| 3744 | Empty); |
| 3745 | break; |
| 3746 | } |
| 3747 | |
Alexey Bataev | 0a6ed84 | 2015-12-03 09:40:15 +0000 | [diff] [blame] | 3748 | case STMT_OMP_TASKLOOP_SIMD_DIRECTIVE: { |
| 3749 | unsigned NumClauses = Record[ASTStmtReader::NumStmtFields]; |
| 3750 | unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1]; |
| 3751 | S = OMPTaskLoopSimdDirective::CreateEmpty(Context, NumClauses, |
| 3752 | CollapsedNum, Empty); |
| 3753 | break; |
| 3754 | } |
| 3755 | |
Carlo Bertolli | 6200a3d | 2015-12-14 14:51:25 +0000 | [diff] [blame] | 3756 | case STMT_OMP_DISTRIBUTE_DIRECTIVE: { |
| 3757 | unsigned NumClauses = Record[ASTStmtReader::NumStmtFields]; |
| 3758 | unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1]; |
| 3759 | S = OMPDistributeDirective::CreateEmpty(Context, NumClauses, CollapsedNum, |
| 3760 | Empty); |
| 3761 | break; |
| 3762 | } |
| 3763 | |
Carlo Bertolli | 9925f15 | 2016-06-27 14:55:37 +0000 | [diff] [blame] | 3764 | case STMT_OMP_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE: { |
| 3765 | unsigned NumClauses = Record[ASTStmtReader::NumStmtFields]; |
| 3766 | unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1]; |
| 3767 | S = OMPDistributeParallelForDirective::CreateEmpty(Context, NumClauses, |
| 3768 | CollapsedNum, Empty); |
| 3769 | break; |
| 3770 | } |
| 3771 | |
Kelvin Li | 4a39add | 2016-07-05 05:00:15 +0000 | [diff] [blame] | 3772 | case STMT_OMP_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE: { |
| 3773 | unsigned NumClauses = Record[ASTStmtReader::NumStmtFields]; |
| 3774 | unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1]; |
| 3775 | S = OMPDistributeParallelForSimdDirective::CreateEmpty(Context, NumClauses, |
| 3776 | CollapsedNum, |
| 3777 | Empty); |
| 3778 | break; |
| 3779 | } |
| 3780 | |
Kelvin Li | 787f3fc | 2016-07-06 04:45:38 +0000 | [diff] [blame] | 3781 | case STMT_OMP_DISTRIBUTE_SIMD_DIRECTIVE: { |
| 3782 | unsigned NumClauses = Record[ASTStmtReader::NumStmtFields]; |
| 3783 | unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1]; |
| 3784 | S = OMPDistributeSimdDirective::CreateEmpty(Context, NumClauses, |
| 3785 | CollapsedNum, Empty); |
| 3786 | break; |
| 3787 | } |
| 3788 | |
Kelvin Li | a579b91 | 2016-07-14 02:54:56 +0000 | [diff] [blame] | 3789 | case STMT_OMP_TARGET_PARALLEL_FOR_SIMD_DIRECTIVE: { |
| 3790 | unsigned NumClauses = Record[ASTStmtReader::NumStmtFields]; |
| 3791 | unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1]; |
| 3792 | S = OMPTargetParallelForSimdDirective::CreateEmpty(Context, NumClauses, |
| 3793 | CollapsedNum, Empty); |
| 3794 | break; |
| 3795 | } |
| 3796 | |
Kelvin Li | 986330c | 2016-07-20 22:57:10 +0000 | [diff] [blame] | 3797 | case STMT_OMP_TARGET_SIMD_DIRECTIVE: { |
| 3798 | auto NumClauses = Record[ASTStmtReader::NumStmtFields]; |
| 3799 | auto CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1]; |
| 3800 | S = OMPTargetSimdDirective::CreateEmpty(Context, NumClauses, CollapsedNum, |
| 3801 | Empty); |
| 3802 | break; |
| 3803 | } |
| 3804 | |
Kelvin Li | 83c451e | 2016-12-25 04:52:54 +0000 | [diff] [blame] | 3805 | case STMT_OMP_TEAMS_DISTRIBUTE_DIRECTIVE: { |
Kelvin Li | 0253287 | 2016-08-05 14:37:37 +0000 | [diff] [blame] | 3806 | auto NumClauses = Record[ASTStmtReader::NumStmtFields]; |
| 3807 | auto CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1]; |
| 3808 | S = OMPTeamsDistributeDirective::CreateEmpty(Context, NumClauses, |
| 3809 | CollapsedNum, Empty); |
| 3810 | break; |
| 3811 | } |
| 3812 | |
Kelvin Li | 4e325f7 | 2016-10-25 12:50:55 +0000 | [diff] [blame] | 3813 | case STMT_OMP_TEAMS_DISTRIBUTE_SIMD_DIRECTIVE: { |
| 3814 | unsigned NumClauses = Record[ASTStmtReader::NumStmtFields]; |
| 3815 | unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1]; |
| 3816 | S = OMPTeamsDistributeSimdDirective::CreateEmpty(Context, NumClauses, |
| 3817 | CollapsedNum, Empty); |
| 3818 | break; |
| 3819 | } |
| 3820 | |
Kelvin Li | 579e41c | 2016-11-30 23:51:03 +0000 | [diff] [blame] | 3821 | case STMT_OMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE: { |
| 3822 | auto NumClauses = Record[ASTStmtReader::NumStmtFields]; |
| 3823 | auto CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1]; |
| 3824 | S = OMPTeamsDistributeParallelForSimdDirective::CreateEmpty( |
| 3825 | Context, NumClauses, CollapsedNum, Empty); |
| 3826 | break; |
| 3827 | } |
| 3828 | |
Kelvin Li | 7ade93f | 2016-12-09 03:24:30 +0000 | [diff] [blame] | 3829 | case STMT_OMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE: { |
| 3830 | auto NumClauses = Record[ASTStmtReader::NumStmtFields]; |
| 3831 | auto CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1]; |
| 3832 | S = OMPTeamsDistributeParallelForDirective::CreateEmpty( |
| 3833 | Context, NumClauses, CollapsedNum, Empty); |
| 3834 | break; |
| 3835 | } |
| 3836 | |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3837 | case STMT_OMP_TARGET_TEAMS_DIRECTIVE: |
Kelvin Li | bf594a5 | 2016-12-17 05:48:59 +0000 | [diff] [blame] | 3838 | S = OMPTargetTeamsDirective::CreateEmpty( |
| 3839 | Context, Record[ASTStmtReader::NumStmtFields], Empty); |
| 3840 | break; |
Kelvin Li | 83c451e | 2016-12-25 04:52:54 +0000 | [diff] [blame] | 3841 | |
| 3842 | case STMT_OMP_TARGET_TEAMS_DISTRIBUTE_DIRECTIVE: { |
| 3843 | auto NumClauses = Record[ASTStmtReader::NumStmtFields]; |
| 3844 | auto CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1]; |
| 3845 | S = OMPTargetTeamsDistributeDirective::CreateEmpty(Context, NumClauses, |
| 3846 | CollapsedNum, Empty); |
| 3847 | break; |
| 3848 | } |
| 3849 | |
Kelvin Li | 80e8f56 | 2016-12-29 22:16:30 +0000 | [diff] [blame] | 3850 | case STMT_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE: { |
| 3851 | auto NumClauses = Record[ASTStmtReader::NumStmtFields]; |
| 3852 | auto CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1]; |
| 3853 | S = OMPTargetTeamsDistributeParallelForDirective::CreateEmpty( |
| 3854 | Context, NumClauses, CollapsedNum, Empty); |
| 3855 | break; |
| 3856 | } |
| 3857 | |
Kelvin Li | 1851df5 | 2017-01-03 05:23:48 +0000 | [diff] [blame] | 3858 | case STMT_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE: { |
| 3859 | auto NumClauses = Record[ASTStmtReader::NumStmtFields]; |
| 3860 | auto CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1]; |
| 3861 | S = OMPTargetTeamsDistributeParallelForSimdDirective::CreateEmpty( |
| 3862 | Context, NumClauses, CollapsedNum, Empty); |
| 3863 | break; |
| 3864 | } |
| 3865 | |
Kelvin Li | da68118 | 2017-01-10 18:08:18 +0000 | [diff] [blame] | 3866 | case STMT_OMP_TARGET_TEAMS_DISTRIBUTE_SIMD_DIRECTIVE: { |
| 3867 | auto NumClauses = Record[ASTStmtReader::NumStmtFields]; |
| 3868 | auto CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1]; |
| 3869 | S = OMPTargetTeamsDistributeSimdDirective::CreateEmpty( |
| 3870 | Context, NumClauses, CollapsedNum, Empty); |
| 3871 | break; |
| 3872 | } |
| 3873 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3874 | case EXPR_CXX_OPERATOR_CALL: |
Douglas Gregor | 4163aca | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 3875 | S = new (Context) CXXOperatorCallExpr(Context, Empty); |
Argyrios Kyrtzidis | eeaaead | 2009-07-14 03:19:21 +0000 | [diff] [blame] | 3876 | break; |
Chris Lattner | b7e7f72 | 2010-05-09 05:36:05 +0000 | [diff] [blame] | 3877 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3878 | case EXPR_CXX_MEMBER_CALL: |
Douglas Gregor | 4163aca | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 3879 | S = new (Context) CXXMemberCallExpr(Context, Empty); |
Chris Lattner | b7e7f72 | 2010-05-09 05:36:05 +0000 | [diff] [blame] | 3880 | break; |
Alexey Bataev | 1b59ab5 | 2014-02-27 08:29:12 +0000 | [diff] [blame] | 3881 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3882 | case EXPR_CXX_CONSTRUCT: |
Argyrios Kyrtzidis | b8d77eb | 2010-07-10 11:46:15 +0000 | [diff] [blame] | 3883 | S = new (Context) CXXConstructExpr(Empty); |
| 3884 | break; |
Alexey Bataev | 1b59ab5 | 2014-02-27 08:29:12 +0000 | [diff] [blame] | 3885 | |
Richard Smith | 5179eb7 | 2016-06-28 19:03:57 +0000 | [diff] [blame] | 3886 | case EXPR_CXX_INHERITED_CTOR_INIT: |
| 3887 | S = new (Context) CXXInheritedCtorInitExpr(Empty); |
| 3888 | break; |
| 3889 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3890 | case EXPR_CXX_TEMPORARY_OBJECT: |
Argyrios Kyrtzidis | b8d77eb | 2010-07-10 11:46:15 +0000 | [diff] [blame] | 3891 | S = new (Context) CXXTemporaryObjectExpr(Empty); |
Douglas Gregor | 5d3507d | 2009-09-09 23:08:42 +0000 | [diff] [blame] | 3892 | break; |
Sam Weinig | d01101e | 2010-01-16 21:21:01 +0000 | [diff] [blame] | 3893 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3894 | case EXPR_CXX_STATIC_CAST: |
Douglas Gregor | 4163aca | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 3895 | S = CXXStaticCastExpr::CreateEmpty(Context, |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 3896 | /*PathSize*/ Record[ASTStmtReader::NumExprFields]); |
Sam Weinig | d01101e | 2010-01-16 21:21:01 +0000 | [diff] [blame] | 3897 | break; |
| 3898 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3899 | case EXPR_CXX_DYNAMIC_CAST: |
Douglas Gregor | 4163aca | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 3900 | S = CXXDynamicCastExpr::CreateEmpty(Context, |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 3901 | /*PathSize*/ Record[ASTStmtReader::NumExprFields]); |
Sam Weinig | d01101e | 2010-01-16 21:21:01 +0000 | [diff] [blame] | 3902 | break; |
| 3903 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3904 | case EXPR_CXX_REINTERPRET_CAST: |
Douglas Gregor | 4163aca | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 3905 | S = CXXReinterpretCastExpr::CreateEmpty(Context, |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 3906 | /*PathSize*/ Record[ASTStmtReader::NumExprFields]); |
Sam Weinig | d01101e | 2010-01-16 21:21:01 +0000 | [diff] [blame] | 3907 | break; |
| 3908 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3909 | case EXPR_CXX_CONST_CAST: |
Douglas Gregor | 4163aca | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 3910 | S = CXXConstCastExpr::CreateEmpty(Context); |
Sam Weinig | d01101e | 2010-01-16 21:21:01 +0000 | [diff] [blame] | 3911 | break; |
| 3912 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3913 | case EXPR_CXX_FUNCTIONAL_CAST: |
Douglas Gregor | 4163aca | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 3914 | S = CXXFunctionalCastExpr::CreateEmpty(Context, |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 3915 | /*PathSize*/ Record[ASTStmtReader::NumExprFields]); |
Sam Weinig | d01101e | 2010-01-16 21:21:01 +0000 | [diff] [blame] | 3916 | break; |
| 3917 | |
Richard Smith | c67fdd4 | 2012-03-07 08:35:16 +0000 | [diff] [blame] | 3918 | case EXPR_USER_DEFINED_LITERAL: |
| 3919 | S = new (Context) UserDefinedLiteral(Context, Empty); |
| 3920 | break; |
| 3921 | |
Richard Smith | cc1b96d | 2013-06-12 22:31:48 +0000 | [diff] [blame] | 3922 | case EXPR_CXX_STD_INITIALIZER_LIST: |
| 3923 | S = new (Context) CXXStdInitializerListExpr(Empty); |
| 3924 | break; |
| 3925 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3926 | case EXPR_CXX_BOOL_LITERAL: |
Sam Weinig | e83b3ac | 2010-02-07 06:32:43 +0000 | [diff] [blame] | 3927 | S = new (Context) CXXBoolLiteralExpr(Empty); |
| 3928 | break; |
Sam Weinig | d01101e | 2010-01-16 21:21:01 +0000 | [diff] [blame] | 3929 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3930 | case EXPR_CXX_NULL_PTR_LITERAL: |
Sam Weinig | e83b3ac | 2010-02-07 06:32:43 +0000 | [diff] [blame] | 3931 | S = new (Context) CXXNullPtrLiteralExpr(Empty); |
| 3932 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3933 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3934 | case EXPR_CXX_TYPEID_EXPR: |
Chris Lattner | 13a5ecc | 2010-05-09 06:03:39 +0000 | [diff] [blame] | 3935 | S = new (Context) CXXTypeidExpr(Empty, true); |
| 3936 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3937 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3938 | case EXPR_CXX_TYPEID_TYPE: |
Chris Lattner | 13a5ecc | 2010-05-09 06:03:39 +0000 | [diff] [blame] | 3939 | S = new (Context) CXXTypeidExpr(Empty, false); |
| 3940 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3941 | |
Francois Pichet | 9f4f207 | 2010-09-08 12:20:18 +0000 | [diff] [blame] | 3942 | case EXPR_CXX_UUIDOF_EXPR: |
| 3943 | S = new (Context) CXXUuidofExpr(Empty, true); |
| 3944 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3945 | |
John McCall | 5e77d76 | 2013-04-16 07:28:30 +0000 | [diff] [blame] | 3946 | case EXPR_CXX_PROPERTY_REF_EXPR: |
| 3947 | S = new (Context) MSPropertyRefExpr(Empty); |
| 3948 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3949 | |
Alexey Bataev | f763027 | 2015-11-25 12:01:00 +0000 | [diff] [blame] | 3950 | case EXPR_CXX_PROPERTY_SUBSCRIPT_EXPR: |
| 3951 | S = new (Context) MSPropertySubscriptExpr(Empty); |
| 3952 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3953 | |
Francois Pichet | 9f4f207 | 2010-09-08 12:20:18 +0000 | [diff] [blame] | 3954 | case EXPR_CXX_UUIDOF_TYPE: |
| 3955 | S = new (Context) CXXUuidofExpr(Empty, false); |
| 3956 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3957 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3958 | case EXPR_CXX_THIS: |
Chris Lattner | 9826733 | 2010-05-09 06:15:05 +0000 | [diff] [blame] | 3959 | S = new (Context) CXXThisExpr(Empty); |
| 3960 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3961 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3962 | case EXPR_CXX_THROW: |
Chris Lattner | 9826733 | 2010-05-09 06:15:05 +0000 | [diff] [blame] | 3963 | S = new (Context) CXXThrowExpr(Empty); |
| 3964 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3965 | |
John McCall | 32791cc | 2016-01-06 22:34:54 +0000 | [diff] [blame] | 3966 | case EXPR_CXX_DEFAULT_ARG: |
| 3967 | S = new (Context) CXXDefaultArgExpr(Empty); |
Chris Lattner | e2437f4 | 2010-05-09 06:40:08 +0000 | [diff] [blame] | 3968 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3969 | |
Richard Smith | 852c9db | 2013-04-20 22:23:05 +0000 | [diff] [blame] | 3970 | case EXPR_CXX_DEFAULT_INIT: |
| 3971 | S = new (Context) CXXDefaultInitExpr(Empty); |
| 3972 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3973 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3974 | case EXPR_CXX_BIND_TEMPORARY: |
Chris Lattner | cba8614 | 2010-05-10 00:25:06 +0000 | [diff] [blame] | 3975 | S = new (Context) CXXBindTemporaryExpr(Empty); |
| 3976 | break; |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 3977 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3978 | case EXPR_CXX_SCALAR_VALUE_INIT: |
Douglas Gregor | 747eb78 | 2010-07-08 06:14:04 +0000 | [diff] [blame] | 3979 | S = new (Context) CXXScalarValueInitExpr(Empty); |
Chris Lattner | abfb58d | 2010-05-10 01:22:27 +0000 | [diff] [blame] | 3980 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3981 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3982 | case EXPR_CXX_NEW: |
Chris Lattner | abfb58d | 2010-05-10 01:22:27 +0000 | [diff] [blame] | 3983 | S = new (Context) CXXNewExpr(Empty); |
| 3984 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3985 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3986 | case EXPR_CXX_DELETE: |
Argyrios Kyrtzidis | 6e57c35 | 2010-06-22 17:07:59 +0000 | [diff] [blame] | 3987 | S = new (Context) CXXDeleteExpr(Empty); |
| 3988 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3989 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3990 | case EXPR_CXX_PSEUDO_DESTRUCTOR: |
Argyrios Kyrtzidis | 99a226d | 2010-06-28 09:32:03 +0000 | [diff] [blame] | 3991 | S = new (Context) CXXPseudoDestructorExpr(Empty); |
| 3992 | break; |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 3993 | |
John McCall | 5d41378 | 2010-12-06 08:20:24 +0000 | [diff] [blame] | 3994 | case EXPR_EXPR_WITH_CLEANUPS: |
John McCall | 28fc709 | 2011-11-10 05:35:25 +0000 | [diff] [blame] | 3995 | S = ExprWithCleanups::Create(Context, Empty, |
| 3996 | Record[ASTStmtReader::NumExprFields]); |
Chris Lattner | cba8614 | 2010-05-10 00:25:06 +0000 | [diff] [blame] | 3997 | break; |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 3998 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3999 | case EXPR_CXX_DEPENDENT_SCOPE_MEMBER: |
Douglas Gregor | 4163aca | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 4000 | S = CXXDependentScopeMemberExpr::CreateEmpty(Context, |
Abramo Bagnara | 7945c98 | 2012-01-27 09:46:47 +0000 | [diff] [blame] | 4001 | /*HasTemplateKWAndArgsInfo=*/Record[ASTStmtReader::NumExprFields], |
Douglas Gregor | 87866ce | 2011-02-04 12:01:24 +0000 | [diff] [blame] | 4002 | /*NumTemplateArgs=*/Record[ASTStmtReader::NumExprFields] |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 4003 | ? Record[ASTStmtReader::NumExprFields + 1] |
Douglas Gregor | 87866ce | 2011-02-04 12:01:24 +0000 | [diff] [blame] | 4004 | : 0); |
Argyrios Kyrtzidis | bfcacee | 2010-06-24 08:57:31 +0000 | [diff] [blame] | 4005 | break; |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 4006 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 4007 | case EXPR_CXX_DEPENDENT_SCOPE_DECL_REF: |
Douglas Gregor | 4163aca | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 4008 | S = DependentScopeDeclRefExpr::CreateEmpty(Context, |
Abramo Bagnara | 7945c98 | 2012-01-27 09:46:47 +0000 | [diff] [blame] | 4009 | /*HasTemplateKWAndArgsInfo=*/Record[ASTStmtReader::NumExprFields], |
Douglas Gregor | 87866ce | 2011-02-04 12:01:24 +0000 | [diff] [blame] | 4010 | /*NumTemplateArgs=*/Record[ASTStmtReader::NumExprFields] |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 4011 | ? Record[ASTStmtReader::NumExprFields + 1] |
Douglas Gregor | 87866ce | 2011-02-04 12:01:24 +0000 | [diff] [blame] | 4012 | : 0); |
Argyrios Kyrtzidis | cd444d1a | 2010-06-28 09:31:56 +0000 | [diff] [blame] | 4013 | break; |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 4014 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 4015 | case EXPR_CXX_UNRESOLVED_CONSTRUCT: |
Douglas Gregor | 4163aca | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 4016 | S = CXXUnresolvedConstructExpr::CreateEmpty(Context, |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 4017 | /*NumArgs=*/Record[ASTStmtReader::NumExprFields]); |
Argyrios Kyrtzidis | b8d3c63 | 2010-06-25 09:03:26 +0000 | [diff] [blame] | 4018 | break; |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 4019 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 4020 | case EXPR_CXX_UNRESOLVED_MEMBER: |
Douglas Gregor | 4163aca | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 4021 | S = UnresolvedMemberExpr::CreateEmpty(Context, |
Abramo Bagnara | 7945c98 | 2012-01-27 09:46:47 +0000 | [diff] [blame] | 4022 | /*HasTemplateKWAndArgsInfo=*/Record[ASTStmtReader::NumExprFields], |
Douglas Gregor | 87866ce | 2011-02-04 12:01:24 +0000 | [diff] [blame] | 4023 | /*NumTemplateArgs=*/Record[ASTStmtReader::NumExprFields] |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 4024 | ? Record[ASTStmtReader::NumExprFields + 1] |
Douglas Gregor | 87866ce | 2011-02-04 12:01:24 +0000 | [diff] [blame] | 4025 | : 0); |
Argyrios Kyrtzidis | bfcacee | 2010-06-24 08:57:31 +0000 | [diff] [blame] | 4026 | break; |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 4027 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 4028 | case EXPR_CXX_UNRESOLVED_LOOKUP: |
Douglas Gregor | 4163aca | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 4029 | S = UnresolvedLookupExpr::CreateEmpty(Context, |
Abramo Bagnara | 7945c98 | 2012-01-27 09:46:47 +0000 | [diff] [blame] | 4030 | /*HasTemplateKWAndArgsInfo=*/Record[ASTStmtReader::NumExprFields], |
Douglas Gregor | 87866ce | 2011-02-04 12:01:24 +0000 | [diff] [blame] | 4031 | /*NumTemplateArgs=*/Record[ASTStmtReader::NumExprFields] |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 4032 | ? Record[ASTStmtReader::NumExprFields + 1] |
Douglas Gregor | 87866ce | 2011-02-04 12:01:24 +0000 | [diff] [blame] | 4033 | : 0); |
Argyrios Kyrtzidis | 58e01ad | 2010-06-25 09:03:34 +0000 | [diff] [blame] | 4034 | break; |
Sebastian Redl | 9ac55dd | 2010-09-10 20:55:54 +0000 | [diff] [blame] | 4035 | |
Douglas Gregor | 29c42f2 | 2012-02-24 07:38:34 +0000 | [diff] [blame] | 4036 | case EXPR_TYPE_TRAIT: |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 4037 | S = TypeTraitExpr::CreateDeserialized(Context, |
Douglas Gregor | 29c42f2 | 2012-02-24 07:38:34 +0000 | [diff] [blame] | 4038 | Record[ASTStmtReader::NumExprFields]); |
| 4039 | break; |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 4040 | |
John Wiegley | 6242b6a | 2011-04-28 00:16:57 +0000 | [diff] [blame] | 4041 | case EXPR_ARRAY_TYPE_TRAIT: |
| 4042 | S = new (Context) ArrayTypeTraitExpr(Empty); |
| 4043 | break; |
| 4044 | |
John Wiegley | f9f6584 | 2011-04-25 06:54:41 +0000 | [diff] [blame] | 4045 | case EXPR_CXX_EXPRESSION_TRAIT: |
| 4046 | S = new (Context) ExpressionTraitExpr(Empty); |
| 4047 | break; |
| 4048 | |
Sebastian Redl | 9ac55dd | 2010-09-10 20:55:54 +0000 | [diff] [blame] | 4049 | case EXPR_CXX_NOEXCEPT: |
| 4050 | S = new (Context) CXXNoexceptExpr(Empty); |
| 4051 | break; |
John McCall | 8d69a21 | 2010-11-15 23:31:06 +0000 | [diff] [blame] | 4052 | |
Douglas Gregor | e8e9dd6 | 2011-01-03 17:17:50 +0000 | [diff] [blame] | 4053 | case EXPR_PACK_EXPANSION: |
| 4054 | S = new (Context) PackExpansionExpr(Empty); |
| 4055 | break; |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 4056 | |
Douglas Gregor | 820ba7b | 2011-01-04 17:33:58 +0000 | [diff] [blame] | 4057 | case EXPR_SIZEOF_PACK: |
Richard Smith | d784e68 | 2015-09-23 21:41:42 +0000 | [diff] [blame] | 4058 | S = SizeOfPackExpr::CreateDeserialized( |
| 4059 | Context, |
| 4060 | /*NumPartialArgs=*/Record[ASTStmtReader::NumExprFields]); |
Douglas Gregor | 820ba7b | 2011-01-04 17:33:58 +0000 | [diff] [blame] | 4061 | break; |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 4062 | |
John McCall | fa19404 | 2011-07-15 07:00:14 +0000 | [diff] [blame] | 4063 | case EXPR_SUBST_NON_TYPE_TEMPLATE_PARM: |
| 4064 | S = new (Context) SubstNonTypeTemplateParmExpr(Empty); |
| 4065 | break; |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 4066 | |
Douglas Gregor | cdbc539 | 2011-01-15 01:15:58 +0000 | [diff] [blame] | 4067 | case EXPR_SUBST_NON_TYPE_TEMPLATE_PARM_PACK: |
| 4068 | S = new (Context) SubstNonTypeTemplateParmPackExpr(Empty); |
| 4069 | break; |
Richard Smith | b15fe3a | 2012-09-12 00:56:43 +0000 | [diff] [blame] | 4070 | |
| 4071 | case EXPR_FUNCTION_PARM_PACK: |
| 4072 | S = FunctionParmPackExpr::CreateEmpty(Context, |
| 4073 | Record[ASTStmtReader::NumExprFields]); |
| 4074 | break; |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 4075 | |
Douglas Gregor | fe31481 | 2011-06-21 17:03:29 +0000 | [diff] [blame] | 4076 | case EXPR_MATERIALIZE_TEMPORARY: |
| 4077 | S = new (Context) MaterializeTemporaryExpr(Empty); |
| 4078 | break; |
Richard Smith | 0f0af19 | 2014-11-08 05:07:16 +0000 | [diff] [blame] | 4079 | |
| 4080 | case EXPR_CXX_FOLD: |
| 4081 | S = new (Context) CXXFoldExpr(Empty); |
| 4082 | break; |
| 4083 | |
Argyrios Kyrtzidis | b2b0795 | 2011-12-03 03:49:52 +0000 | [diff] [blame] | 4084 | case EXPR_OPAQUE_VALUE: |
| 4085 | S = new (Context) OpaqueValueExpr(Empty); |
John McCall | 8d69a21 | 2010-11-15 23:31:06 +0000 | [diff] [blame] | 4086 | break; |
Peter Collingbourne | 41f8546 | 2011-02-09 21:07:24 +0000 | [diff] [blame] | 4087 | |
| 4088 | case EXPR_CUDA_KERNEL_CALL: |
Douglas Gregor | 4163aca | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 4089 | S = new (Context) CUDAKernelCallExpr(Context, Empty); |
Peter Collingbourne | 41f8546 | 2011-02-09 21:07:24 +0000 | [diff] [blame] | 4090 | break; |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 4091 | |
Tanya Lattner | 55808c1 | 2011-06-04 00:47:47 +0000 | [diff] [blame] | 4092 | case EXPR_ASTYPE: |
| 4093 | S = new (Context) AsTypeExpr(Empty); |
| 4094 | break; |
Eli Friedman | df14b3a | 2011-10-11 02:20:01 +0000 | [diff] [blame] | 4095 | |
John McCall | fe96e0b | 2011-11-06 09:01:30 +0000 | [diff] [blame] | 4096 | case EXPR_PSEUDO_OBJECT: { |
| 4097 | unsigned numSemanticExprs = Record[ASTStmtReader::NumExprFields]; |
| 4098 | S = PseudoObjectExpr::Create(Context, Empty, numSemanticExprs); |
| 4099 | break; |
| 4100 | } |
| 4101 | |
Eli Friedman | df14b3a | 2011-10-11 02:20:01 +0000 | [diff] [blame] | 4102 | case EXPR_ATOMIC: |
| 4103 | S = new (Context) AtomicExpr(Empty); |
| 4104 | break; |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 4105 | |
Douglas Gregor | 99ae806 | 2012-02-14 17:54:36 +0000 | [diff] [blame] | 4106 | case EXPR_LAMBDA: { |
| 4107 | unsigned NumCaptures = Record[ASTStmtReader::NumExprFields]; |
Richard Smith | 30e304e | 2016-12-14 00:03:17 +0000 | [diff] [blame] | 4108 | S = LambdaExpr::CreateDeserialized(Context, NumCaptures); |
Douglas Gregor | 99ae806 | 2012-02-14 17:54:36 +0000 | [diff] [blame] | 4109 | break; |
| 4110 | } |
Gor Nishanov | f5ecb5e | 2017-07-25 18:01:49 +0000 | [diff] [blame] | 4111 | |
| 4112 | case STMT_COROUTINE_BODY: { |
| 4113 | unsigned NumParams = Record[ASTStmtReader::NumStmtFields]; |
| 4114 | S = CoroutineBodyStmt::Create(Context, Empty, NumParams); |
| 4115 | break; |
| 4116 | } |
| 4117 | |
| 4118 | case STMT_CORETURN: |
| 4119 | S = new (Context) CoreturnStmt(Empty); |
| 4120 | break; |
| 4121 | |
| 4122 | case EXPR_COAWAIT: |
| 4123 | S = new (Context) CoawaitExpr(Empty); |
| 4124 | break; |
| 4125 | |
| 4126 | case EXPR_COYIELD: |
| 4127 | S = new (Context) CoyieldExpr(Empty); |
| 4128 | break; |
| 4129 | |
| 4130 | case EXPR_DEPENDENT_COAWAIT: |
| 4131 | S = new (Context) DependentCoawaitExpr(Empty); |
| 4132 | break; |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 4133 | } |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 4134 | |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 4135 | // We hit a STMT_STOP, so we're done with this expression. |
| 4136 | if (Finished) |
| 4137 | break; |
| 4138 | |
| 4139 | ++NumStatementsRead; |
| 4140 | |
Argyrios Kyrtzidis | 6a59897 | 2011-10-21 23:02:28 +0000 | [diff] [blame] | 4141 | if (S && !IsStmtReference) { |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 4142 | Reader.Visit(S); |
Argyrios Kyrtzidis | 6a59897 | 2011-10-21 23:02:28 +0000 | [diff] [blame] | 4143 | StmtEntries[Cursor.GetCurrentBitNo()] = S; |
| 4144 | } |
| 4145 | |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 4146 | assert(Record.getIdx() == Record.size() && |
| 4147 | "Invalid deserialization of statement"); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 4148 | StmtStack.push_back(S); |
| 4149 | } |
Chris Lattner | 0e6c940 | 2013-01-20 02:38:54 +0000 | [diff] [blame] | 4150 | Done: |
Alp Toker | 028ed91 | 2013-12-06 17:56:43 +0000 | [diff] [blame] | 4151 | assert(StmtStack.size() > PrevNumStmts && "Read too many sub-stmts!"); |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 4152 | assert(StmtStack.size() == PrevNumStmts + 1 && "Extra expressions on stack!"); |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 4153 | return StmtStack.pop_back_val(); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 4154 | } |