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 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 536 | void ASTStmtReader::VisitFloatingLiteral(FloatingLiteral *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 537 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 538 | E->setRawSemantics(static_cast<Stmt::APFloatSemantics>(Record.readInt())); |
| 539 | E->setExact(Record.readInt()); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 540 | E->setValue(Record.getContext(), Record.readAPFloat(E->getSemantics())); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 541 | E->setLocation(ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 542 | } |
| 543 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 544 | void ASTStmtReader::VisitImaginaryLiteral(ImaginaryLiteral *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 545 | VisitExpr(E); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 546 | E->setSubExpr(Record.readSubExpr()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 547 | } |
| 548 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 549 | void ASTStmtReader::VisitStringLiteral(StringLiteral *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 550 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 551 | unsigned Len = Record.readInt(); |
| 552 | assert(Record.peekInt() == E->getNumConcatenated() && |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 553 | "Wrong number of concatenated tokens!"); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 554 | Record.skipInts(1); |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 555 | auto kind = static_cast<StringLiteral::StringKind>(Record.readInt()); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 556 | bool isPascal = Record.readInt(); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 557 | |
Mike Stump | 11289f4 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 558 | // Read string data |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 559 | auto B = &Record.peekInt(); |
| 560 | SmallString<16> Str(B, B + Len); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 561 | E->setString(Record.getContext(), Str, kind, isPascal); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 562 | Record.skipInts(Len); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 563 | |
| 564 | // Read source locations |
| 565 | for (unsigned I = 0, N = E->getNumConcatenated(); I != N; ++I) |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 566 | E->setStrTokenLoc(I, ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 567 | } |
| 568 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 569 | void ASTStmtReader::VisitCharacterLiteral(CharacterLiteral *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 570 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 571 | E->setValue(Record.readInt()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 572 | E->setLocation(ReadSourceLocation()); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 573 | E->setKind(static_cast<CharacterLiteral::CharacterKind>(Record.readInt())); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 574 | } |
| 575 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 576 | void ASTStmtReader::VisitParenExpr(ParenExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 577 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 578 | E->setLParen(ReadSourceLocation()); |
| 579 | E->setRParen(ReadSourceLocation()); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 580 | E->setSubExpr(Record.readSubExpr()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 581 | } |
| 582 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 583 | void ASTStmtReader::VisitParenListExpr(ParenListExpr *E) { |
Argyrios Kyrtzidis | f9f47c8 | 2010-06-30 08:49:18 +0000 | [diff] [blame] | 584 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 585 | unsigned NumExprs = Record.readInt(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 586 | E->Exprs = new (Record.getContext()) Stmt*[NumExprs]; |
Argyrios Kyrtzidis | f9f47c8 | 2010-06-30 08:49:18 +0000 | [diff] [blame] | 587 | for (unsigned i = 0; i != NumExprs; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 588 | E->Exprs[i] = Record.readSubStmt(); |
Argyrios Kyrtzidis | f9f47c8 | 2010-06-30 08:49:18 +0000 | [diff] [blame] | 589 | E->NumExprs = NumExprs; |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 590 | E->LParenLoc = ReadSourceLocation(); |
| 591 | E->RParenLoc = ReadSourceLocation(); |
Argyrios Kyrtzidis | f9f47c8 | 2010-06-30 08:49:18 +0000 | [diff] [blame] | 592 | } |
| 593 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 594 | void ASTStmtReader::VisitUnaryOperator(UnaryOperator *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 595 | VisitExpr(E); |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 596 | E->setSubExpr(Record.readSubExpr()); |
| 597 | E->setOpcode((UnaryOperator::Opcode)Record.readInt()); |
| 598 | E->setOperatorLoc(ReadSourceLocation()); |
| 599 | E->setCanOverflow(Record.readInt()); |
| 600 | } |
| 601 | |
| 602 | void ASTStmtReader::VisitOffsetOfExpr(OffsetOfExpr *E) { |
Douglas Gregor | 882211c | 2010-04-28 22:16:22 +0000 | [diff] [blame] | 603 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 604 | assert(E->getNumComponents() == Record.peekInt()); |
| 605 | Record.skipInts(1); |
| 606 | assert(E->getNumExpressions() == Record.peekInt()); |
| 607 | Record.skipInts(1); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 608 | E->setOperatorLoc(ReadSourceLocation()); |
| 609 | E->setRParenLoc(ReadSourceLocation()); |
| 610 | E->setTypeSourceInfo(GetTypeSourceInfo()); |
Douglas Gregor | 882211c | 2010-04-28 22:16:22 +0000 | [diff] [blame] | 611 | for (unsigned I = 0, N = E->getNumComponents(); I != N; ++I) { |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 612 | auto Kind = static_cast<OffsetOfNode::Kind>(Record.readInt()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 613 | SourceLocation Start = ReadSourceLocation(); |
| 614 | SourceLocation End = ReadSourceLocation(); |
Douglas Gregor | 882211c | 2010-04-28 22:16:22 +0000 | [diff] [blame] | 615 | switch (Kind) { |
James Y Knight | 7281c35 | 2015-12-29 22:31:18 +0000 | [diff] [blame] | 616 | case OffsetOfNode::Array: |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 617 | E->setComponent(I, OffsetOfNode(Start, Record.readInt(), End)); |
Douglas Gregor | 882211c | 2010-04-28 22:16:22 +0000 | [diff] [blame] | 618 | break; |
| 619 | |
James Y Knight | 7281c35 | 2015-12-29 22:31:18 +0000 | [diff] [blame] | 620 | case OffsetOfNode::Field: |
| 621 | E->setComponent( |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 622 | I, OffsetOfNode(Start, ReadDeclAs<FieldDecl>(), End)); |
Douglas Gregor | 882211c | 2010-04-28 22:16:22 +0000 | [diff] [blame] | 623 | break; |
James Y Knight | 7281c35 | 2015-12-29 22:31:18 +0000 | [diff] [blame] | 624 | |
| 625 | case OffsetOfNode::Identifier: |
| 626 | E->setComponent( |
| 627 | I, |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 628 | OffsetOfNode(Start, Record.getIdentifierInfo(), End)); |
James Y Knight | 7281c35 | 2015-12-29 22:31:18 +0000 | [diff] [blame] | 629 | break; |
| 630 | |
| 631 | case OffsetOfNode::Base: { |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 632 | auto *Base = new (Record.getContext()) CXXBaseSpecifier(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 633 | *Base = Record.readCXXBaseSpecifier(); |
James Y Knight | 7281c35 | 2015-12-29 22:31:18 +0000 | [diff] [blame] | 634 | E->setComponent(I, OffsetOfNode(Base)); |
Douglas Gregor | d170206 | 2010-04-29 00:18:15 +0000 | [diff] [blame] | 635 | break; |
Douglas Gregor | 882211c | 2010-04-28 22:16:22 +0000 | [diff] [blame] | 636 | } |
Argyrios Kyrtzidis | d67d4cc | 2010-07-29 18:16:10 +0000 | [diff] [blame] | 637 | } |
Douglas Gregor | 882211c | 2010-04-28 22:16:22 +0000 | [diff] [blame] | 638 | } |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 639 | |
Douglas Gregor | 882211c | 2010-04-28 22:16:22 +0000 | [diff] [blame] | 640 | for (unsigned I = 0, N = E->getNumExpressions(); I != N; ++I) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 641 | E->setIndexExpr(I, Record.readSubExpr()); |
Douglas Gregor | 882211c | 2010-04-28 22:16:22 +0000 | [diff] [blame] | 642 | } |
| 643 | |
Peter Collingbourne | e190dee | 2011-03-11 19:24:49 +0000 | [diff] [blame] | 644 | void ASTStmtReader::VisitUnaryExprOrTypeTraitExpr(UnaryExprOrTypeTraitExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 645 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 646 | E->setKind(static_cast<UnaryExprOrTypeTrait>(Record.readInt())); |
| 647 | if (Record.peekInt() == 0) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 648 | E->setArgument(Record.readSubExpr()); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 649 | Record.skipInts(1); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 650 | } else { |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 651 | E->setArgument(GetTypeSourceInfo()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 652 | } |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 653 | E->setOperatorLoc(ReadSourceLocation()); |
| 654 | E->setRParenLoc(ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 655 | } |
| 656 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 657 | void ASTStmtReader::VisitArraySubscriptExpr(ArraySubscriptExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 658 | VisitExpr(E); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 659 | E->setLHS(Record.readSubExpr()); |
| 660 | E->setRHS(Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 661 | E->setRBracketLoc(ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 662 | } |
| 663 | |
Alexey Bataev | 1a3320e | 2015-08-25 14:24:04 +0000 | [diff] [blame] | 664 | void ASTStmtReader::VisitOMPArraySectionExpr(OMPArraySectionExpr *E) { |
| 665 | VisitExpr(E); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 666 | E->setBase(Record.readSubExpr()); |
| 667 | E->setLowerBound(Record.readSubExpr()); |
| 668 | E->setLength(Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 669 | E->setColonLoc(ReadSourceLocation()); |
| 670 | E->setRBracketLoc(ReadSourceLocation()); |
Alexey Bataev | 1a3320e | 2015-08-25 14:24:04 +0000 | [diff] [blame] | 671 | } |
| 672 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 673 | void ASTStmtReader::VisitCallExpr(CallExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 674 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 675 | E->setNumArgs(Record.getContext(), Record.readInt()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 676 | E->setRParenLoc(ReadSourceLocation()); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 677 | E->setCallee(Record.readSubExpr()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 678 | for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 679 | E->setArg(I, Record.readSubExpr()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 680 | } |
| 681 | |
John McCall | fa19404 | 2011-07-15 07:00:14 +0000 | [diff] [blame] | 682 | void ASTStmtReader::VisitCXXMemberCallExpr(CXXMemberCallExpr *E) { |
| 683 | VisitCallExpr(E); |
| 684 | } |
| 685 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 686 | void ASTStmtReader::VisitMemberExpr(MemberExpr *E) { |
Argyrios Kyrtzidis | 1985bb3 | 2010-07-08 13:09:47 +0000 | [diff] [blame] | 687 | // Don't call VisitExpr, this is fully initialized at creation. |
| 688 | assert(E->getStmtClass() == Stmt::MemberExprClass && |
| 689 | "It's a subclass, we must advance Idx!"); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 690 | } |
| 691 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 692 | void ASTStmtReader::VisitObjCIsaExpr(ObjCIsaExpr *E) { |
Steve Naroff | e87026a | 2009-07-24 17:54:45 +0000 | [diff] [blame] | 693 | VisitExpr(E); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 694 | E->setBase(Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 695 | E->setIsaMemberLoc(ReadSourceLocation()); |
| 696 | E->setOpLoc(ReadSourceLocation()); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 697 | E->setArrow(Record.readInt()); |
Steve Naroff | e87026a | 2009-07-24 17:54:45 +0000 | [diff] [blame] | 698 | } |
| 699 | |
John McCall | 31168b0 | 2011-06-15 23:02:42 +0000 | [diff] [blame] | 700 | void ASTStmtReader:: |
| 701 | VisitObjCIndirectCopyRestoreExpr(ObjCIndirectCopyRestoreExpr *E) { |
| 702 | VisitExpr(E); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 703 | E->Operand = Record.readSubExpr(); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 704 | E->setShouldCopy(Record.readInt()); |
John McCall | 31168b0 | 2011-06-15 23:02:42 +0000 | [diff] [blame] | 705 | } |
| 706 | |
| 707 | void ASTStmtReader::VisitObjCBridgedCastExpr(ObjCBridgedCastExpr *E) { |
| 708 | VisitExplicitCastExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 709 | E->LParenLoc = ReadSourceLocation(); |
| 710 | E->BridgeKeywordLoc = ReadSourceLocation(); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 711 | E->Kind = Record.readInt(); |
John McCall | 31168b0 | 2011-06-15 23:02:42 +0000 | [diff] [blame] | 712 | } |
| 713 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 714 | void ASTStmtReader::VisitCastExpr(CastExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 715 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 716 | unsigned NumBaseSpecs = Record.readInt(); |
John McCall | cf14216 | 2010-08-07 06:22:56 +0000 | [diff] [blame] | 717 | assert(NumBaseSpecs == E->path_size()); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 718 | E->setSubExpr(Record.readSubExpr()); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 719 | E->setCastKind((CastKind)Record.readInt()); |
John McCall | cf14216 | 2010-08-07 06:22:56 +0000 | [diff] [blame] | 720 | CastExpr::path_iterator BaseI = E->path_begin(); |
Argyrios Kyrtzidis | 3701fcd | 2010-07-02 23:30:27 +0000 | [diff] [blame] | 721 | while (NumBaseSpecs--) { |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 722 | auto *BaseSpec = new (Record.getContext()) CXXBaseSpecifier; |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 723 | *BaseSpec = Record.readCXXBaseSpecifier(); |
John McCall | cf14216 | 2010-08-07 06:22:56 +0000 | [diff] [blame] | 724 | *BaseI++ = BaseSpec; |
Argyrios Kyrtzidis | 3701fcd | 2010-07-02 23:30:27 +0000 | [diff] [blame] | 725 | } |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 726 | } |
| 727 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 728 | void ASTStmtReader::VisitBinaryOperator(BinaryOperator *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 729 | VisitExpr(E); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 730 | E->setLHS(Record.readSubExpr()); |
| 731 | E->setRHS(Record.readSubExpr()); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 732 | E->setOpcode((BinaryOperator::Opcode)Record.readInt()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 733 | E->setOperatorLoc(ReadSourceLocation()); |
Adam Nemet | 484aa45 | 2017-03-27 19:17:25 +0000 | [diff] [blame] | 734 | E->setFPFeatures(FPOptions(Record.readInt())); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 735 | } |
| 736 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 737 | void ASTStmtReader::VisitCompoundAssignOperator(CompoundAssignOperator *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 738 | VisitBinaryOperator(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 739 | E->setComputationLHSType(Record.readType()); |
| 740 | E->setComputationResultType(Record.readType()); |
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::VisitConditionalOperator(ConditionalOperator *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 744 | VisitExpr(E); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 745 | E->SubExprs[ConditionalOperator::COND] = Record.readSubExpr(); |
| 746 | E->SubExprs[ConditionalOperator::LHS] = Record.readSubExpr(); |
| 747 | E->SubExprs[ConditionalOperator::RHS] = Record.readSubExpr(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 748 | E->QuestionLoc = ReadSourceLocation(); |
| 749 | E->ColonLoc = ReadSourceLocation(); |
John McCall | c07a0c7 | 2011-02-17 10:25:35 +0000 | [diff] [blame] | 750 | } |
| 751 | |
| 752 | void |
| 753 | ASTStmtReader::VisitBinaryConditionalOperator(BinaryConditionalOperator *E) { |
| 754 | VisitExpr(E); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 755 | E->OpaqueValue = cast<OpaqueValueExpr>(Record.readSubExpr()); |
| 756 | E->SubExprs[BinaryConditionalOperator::COMMON] = Record.readSubExpr(); |
| 757 | E->SubExprs[BinaryConditionalOperator::COND] = Record.readSubExpr(); |
| 758 | E->SubExprs[BinaryConditionalOperator::LHS] = Record.readSubExpr(); |
| 759 | E->SubExprs[BinaryConditionalOperator::RHS] = Record.readSubExpr(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 760 | E->QuestionLoc = ReadSourceLocation(); |
| 761 | E->ColonLoc = ReadSourceLocation(); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 762 | } |
| 763 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 764 | void ASTStmtReader::VisitImplicitCastExpr(ImplicitCastExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 765 | VisitCastExpr(E); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 766 | } |
| 767 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 768 | void ASTStmtReader::VisitExplicitCastExpr(ExplicitCastExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 769 | VisitCastExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 770 | E->setTypeInfoAsWritten(GetTypeSourceInfo()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 771 | } |
| 772 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 773 | void ASTStmtReader::VisitCStyleCastExpr(CStyleCastExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 774 | VisitExplicitCastExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 775 | E->setLParenLoc(ReadSourceLocation()); |
| 776 | E->setRParenLoc(ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 777 | } |
| 778 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 779 | void ASTStmtReader::VisitCompoundLiteralExpr(CompoundLiteralExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 780 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 781 | E->setLParenLoc(ReadSourceLocation()); |
| 782 | E->setTypeSourceInfo(GetTypeSourceInfo()); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 783 | E->setInitializer(Record.readSubExpr()); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 784 | E->setFileScope(Record.readInt()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 785 | } |
| 786 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 787 | void ASTStmtReader::VisitExtVectorElementExpr(ExtVectorElementExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 788 | VisitExpr(E); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 789 | E->setBase(Record.readSubExpr()); |
| 790 | E->setAccessor(Record.getIdentifierInfo()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 791 | E->setAccessorLoc(ReadSourceLocation()); |
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::VisitInitListExpr(InitListExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 795 | VisitExpr(E); |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 796 | if (auto *SyntForm = cast_or_null<InitListExpr>(Record.readSubStmt())) |
Abramo Bagnara | 8d16bd4 | 2012-11-08 18:41:43 +0000 | [diff] [blame] | 797 | E->setSyntacticForm(SyntForm); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 798 | E->setLBraceLoc(ReadSourceLocation()); |
| 799 | E->setRBraceLoc(ReadSourceLocation()); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 800 | bool isArrayFiller = Record.readInt(); |
Craig Topper | a13603a | 2014-05-22 05:54:18 +0000 | [diff] [blame] | 801 | Expr *filler = nullptr; |
Argyrios Kyrtzidis | bbcefa7 | 2011-04-22 05:29:30 +0000 | [diff] [blame] | 802 | if (isArrayFiller) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 803 | filler = Record.readSubExpr(); |
Argyrios Kyrtzidis | bbcefa7 | 2011-04-22 05:29:30 +0000 | [diff] [blame] | 804 | E->ArrayFillerOrUnionFieldInit = filler; |
| 805 | } else |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 806 | E->ArrayFillerOrUnionFieldInit = ReadDeclAs<FieldDecl>(); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 807 | E->sawArrayRangeDesignator(Record.readInt()); |
| 808 | unsigned NumInits = Record.readInt(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 809 | E->reserveInits(Record.getContext(), NumInits); |
Argyrios Kyrtzidis | bbcefa7 | 2011-04-22 05:29:30 +0000 | [diff] [blame] | 810 | if (isArrayFiller) { |
| 811 | for (unsigned I = 0; I != NumInits; ++I) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 812 | Expr *init = Record.readSubExpr(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 813 | E->updateInit(Record.getContext(), I, init ? init : filler); |
Argyrios Kyrtzidis | bbcefa7 | 2011-04-22 05:29:30 +0000 | [diff] [blame] | 814 | } |
| 815 | } else { |
| 816 | for (unsigned I = 0; I != NumInits; ++I) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 817 | E->updateInit(Record.getContext(), I, Record.readSubExpr()); |
Argyrios Kyrtzidis | bbcefa7 | 2011-04-22 05:29:30 +0000 | [diff] [blame] | 818 | } |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 819 | } |
| 820 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 821 | void ASTStmtReader::VisitDesignatedInitExpr(DesignatedInitExpr *E) { |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 822 | using Designator = DesignatedInitExpr::Designator; |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 823 | |
| 824 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 825 | unsigned NumSubExprs = Record.readInt(); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 826 | assert(NumSubExprs == E->getNumSubExprs() && "Wrong number of subexprs"); |
| 827 | for (unsigned I = 0; I != NumSubExprs; ++I) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 828 | E->setSubExpr(I, Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 829 | E->setEqualOrColonLoc(ReadSourceLocation()); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 830 | E->setGNUSyntax(Record.readInt()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 831 | |
Chris Lattner | 0e62c1c | 2011-07-23 10:55:15 +0000 | [diff] [blame] | 832 | SmallVector<Designator, 4> Designators; |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 833 | while (Record.getIdx() < Record.size()) { |
| 834 | switch ((DesignatorTypes)Record.readInt()) { |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 835 | case DESIG_FIELD_DECL: { |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 836 | auto *Field = ReadDeclAs<FieldDecl>(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 837 | SourceLocation DotLoc = ReadSourceLocation(); |
| 838 | SourceLocation FieldLoc = ReadSourceLocation(); |
Mike Stump | 11289f4 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 839 | Designators.push_back(Designator(Field->getIdentifier(), DotLoc, |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 840 | FieldLoc)); |
| 841 | Designators.back().setField(Field); |
| 842 | break; |
| 843 | } |
| 844 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 845 | case DESIG_FIELD_NAME: { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 846 | const IdentifierInfo *Name = Record.getIdentifierInfo(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 847 | SourceLocation DotLoc = ReadSourceLocation(); |
| 848 | SourceLocation FieldLoc = ReadSourceLocation(); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 849 | Designators.push_back(Designator(Name, DotLoc, FieldLoc)); |
| 850 | break; |
| 851 | } |
Mike Stump | 11289f4 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 852 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 853 | case DESIG_ARRAY: { |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 854 | unsigned Index = Record.readInt(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 855 | SourceLocation LBracketLoc = ReadSourceLocation(); |
| 856 | SourceLocation RBracketLoc = ReadSourceLocation(); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 857 | Designators.push_back(Designator(Index, LBracketLoc, RBracketLoc)); |
| 858 | break; |
| 859 | } |
| 860 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 861 | case DESIG_ARRAY_RANGE: { |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 862 | unsigned Index = Record.readInt(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 863 | SourceLocation LBracketLoc = ReadSourceLocation(); |
| 864 | SourceLocation EllipsisLoc = ReadSourceLocation(); |
| 865 | SourceLocation RBracketLoc = ReadSourceLocation(); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 866 | Designators.push_back(Designator(Index, LBracketLoc, EllipsisLoc, |
| 867 | RBracketLoc)); |
| 868 | break; |
| 869 | } |
| 870 | } |
| 871 | } |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 872 | E->setDesignators(Record.getContext(), |
Douglas Gregor | 03e8bdc | 2010-01-06 23:17:19 +0000 | [diff] [blame] | 873 | Designators.data(), Designators.size()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 874 | } |
| 875 | |
Yunzhong Gao | cb77930 | 2015-06-10 00:27:52 +0000 | [diff] [blame] | 876 | void ASTStmtReader::VisitDesignatedInitUpdateExpr(DesignatedInitUpdateExpr *E) { |
| 877 | VisitExpr(E); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 878 | E->setBase(Record.readSubExpr()); |
| 879 | E->setUpdater(Record.readSubExpr()); |
Yunzhong Gao | cb77930 | 2015-06-10 00:27:52 +0000 | [diff] [blame] | 880 | } |
| 881 | |
| 882 | void ASTStmtReader::VisitNoInitExpr(NoInitExpr *E) { |
| 883 | VisitExpr(E); |
| 884 | } |
| 885 | |
Richard Smith | 410306b | 2016-12-12 02:53:20 +0000 | [diff] [blame] | 886 | void ASTStmtReader::VisitArrayInitLoopExpr(ArrayInitLoopExpr *E) { |
| 887 | VisitExpr(E); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 888 | E->SubExprs[0] = Record.readSubExpr(); |
| 889 | E->SubExprs[1] = Record.readSubExpr(); |
Richard Smith | 410306b | 2016-12-12 02:53:20 +0000 | [diff] [blame] | 890 | } |
| 891 | |
| 892 | void ASTStmtReader::VisitArrayInitIndexExpr(ArrayInitIndexExpr *E) { |
| 893 | VisitExpr(E); |
| 894 | } |
| 895 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 896 | void ASTStmtReader::VisitImplicitValueInitExpr(ImplicitValueInitExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 897 | VisitExpr(E); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 898 | } |
| 899 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 900 | void ASTStmtReader::VisitVAArgExpr(VAArgExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 901 | VisitExpr(E); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 902 | E->setSubExpr(Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 903 | E->setWrittenTypeInfo(GetTypeSourceInfo()); |
| 904 | E->setBuiltinLoc(ReadSourceLocation()); |
| 905 | E->setRParenLoc(ReadSourceLocation()); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 906 | E->setIsMicrosoftABI(Record.readInt()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 907 | } |
| 908 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 909 | void ASTStmtReader::VisitAddrLabelExpr(AddrLabelExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 910 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 911 | E->setAmpAmpLoc(ReadSourceLocation()); |
| 912 | E->setLabelLoc(ReadSourceLocation()); |
| 913 | E->setLabel(ReadDeclAs<LabelDecl>()); |
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::VisitStmtExpr(StmtExpr *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->setLParenLoc(ReadSourceLocation()); |
| 919 | E->setRParenLoc(ReadSourceLocation()); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 920 | E->setSubStmt(cast_or_null<CompoundStmt>(Record.readSubStmt())); |
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::VisitChooseExpr(ChooseExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 924 | VisitExpr(E); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 925 | E->setCond(Record.readSubExpr()); |
| 926 | E->setLHS(Record.readSubExpr()); |
| 927 | E->setRHS(Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 928 | E->setBuiltinLoc(ReadSourceLocation()); |
| 929 | E->setRParenLoc(ReadSourceLocation()); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 930 | E->setIsConditionTrue(Record.readInt()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 931 | } |
| 932 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 933 | void ASTStmtReader::VisitGNUNullExpr(GNUNullExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 934 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 935 | E->setTokenLocation(ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 936 | } |
| 937 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 938 | void ASTStmtReader::VisitShuffleVectorExpr(ShuffleVectorExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 939 | VisitExpr(E); |
Chris Lattner | 0e62c1c | 2011-07-23 10:55:15 +0000 | [diff] [blame] | 940 | SmallVector<Expr *, 16> Exprs; |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 941 | unsigned NumExprs = Record.readInt(); |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 942 | while (NumExprs--) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 943 | Exprs.push_back(Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 944 | E->setExprs(Record.getContext(), Exprs); |
| 945 | E->setBuiltinLoc(ReadSourceLocation()); |
| 946 | E->setRParenLoc(ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 947 | } |
| 948 | |
Hal Finkel | c4d7c82 | 2013-09-18 03:29:45 +0000 | [diff] [blame] | 949 | void ASTStmtReader::VisitConvertVectorExpr(ConvertVectorExpr *E) { |
| 950 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 951 | E->BuiltinLoc = ReadSourceLocation(); |
| 952 | E->RParenLoc = ReadSourceLocation(); |
| 953 | E->TInfo = GetTypeSourceInfo(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 954 | E->SrcExpr = Record.readSubExpr(); |
Hal Finkel | c4d7c82 | 2013-09-18 03:29:45 +0000 | [diff] [blame] | 955 | } |
| 956 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 957 | void ASTStmtReader::VisitBlockExpr(BlockExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 958 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 959 | E->setBlockDecl(ReadDeclAs<BlockDecl>()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 960 | } |
| 961 | |
Peter Collingbourne | 9114759 | 2011-04-15 00:35:48 +0000 | [diff] [blame] | 962 | void ASTStmtReader::VisitGenericSelectionExpr(GenericSelectionExpr *E) { |
| 963 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 964 | E->NumAssocs = Record.readInt(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 965 | E->AssocTypes = new (Record.getContext()) TypeSourceInfo*[E->NumAssocs]; |
Peter Collingbourne | 9114759 | 2011-04-15 00:35:48 +0000 | [diff] [blame] | 966 | E->SubExprs = |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 967 | new(Record.getContext()) Stmt*[GenericSelectionExpr::END_EXPR+E->NumAssocs]; |
Peter Collingbourne | 9114759 | 2011-04-15 00:35:48 +0000 | [diff] [blame] | 968 | |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 969 | E->SubExprs[GenericSelectionExpr::CONTROLLING] = Record.readSubExpr(); |
Peter Collingbourne | 9114759 | 2011-04-15 00:35:48 +0000 | [diff] [blame] | 970 | for (unsigned I = 0, N = E->getNumAssocs(); I != N; ++I) { |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 971 | E->AssocTypes[I] = GetTypeSourceInfo(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 972 | E->SubExprs[GenericSelectionExpr::END_EXPR+I] = Record.readSubExpr(); |
Peter Collingbourne | 9114759 | 2011-04-15 00:35:48 +0000 | [diff] [blame] | 973 | } |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 974 | E->ResultIndex = Record.readInt(); |
Peter Collingbourne | 9114759 | 2011-04-15 00:35:48 +0000 | [diff] [blame] | 975 | |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 976 | E->GenericLoc = ReadSourceLocation(); |
| 977 | E->DefaultLoc = ReadSourceLocation(); |
| 978 | E->RParenLoc = ReadSourceLocation(); |
Peter Collingbourne | 9114759 | 2011-04-15 00:35:48 +0000 | [diff] [blame] | 979 | } |
| 980 | |
John McCall | fe96e0b | 2011-11-06 09:01:30 +0000 | [diff] [blame] | 981 | void ASTStmtReader::VisitPseudoObjectExpr(PseudoObjectExpr *E) { |
| 982 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 983 | unsigned numSemanticExprs = Record.readInt(); |
John McCall | fe96e0b | 2011-11-06 09:01:30 +0000 | [diff] [blame] | 984 | assert(numSemanticExprs + 1 == E->PseudoObjectExprBits.NumSubExprs); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 985 | E->PseudoObjectExprBits.ResultIndex = Record.readInt(); |
John McCall | fe96e0b | 2011-11-06 09:01:30 +0000 | [diff] [blame] | 986 | |
| 987 | // Read the syntactic expression. |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 988 | E->getSubExprsBuffer()[0] = Record.readSubExpr(); |
John McCall | fe96e0b | 2011-11-06 09:01:30 +0000 | [diff] [blame] | 989 | |
| 990 | // Read all the semantic expressions. |
| 991 | for (unsigned i = 0; i != numSemanticExprs; ++i) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 992 | Expr *subExpr = Record.readSubExpr(); |
John McCall | fe96e0b | 2011-11-06 09:01:30 +0000 | [diff] [blame] | 993 | E->getSubExprsBuffer()[i+1] = subExpr; |
| 994 | } |
| 995 | } |
| 996 | |
Eli Friedman | df14b3a | 2011-10-11 02:20:01 +0000 | [diff] [blame] | 997 | void ASTStmtReader::VisitAtomicExpr(AtomicExpr *E) { |
| 998 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 999 | E->Op = AtomicExpr::AtomicOp(Record.readInt()); |
Richard Smith | aa22a8c | 2012-04-10 22:49:28 +0000 | [diff] [blame] | 1000 | E->NumSubExprs = AtomicExpr::getNumSubExprs(E->Op); |
| 1001 | for (unsigned I = 0; I != E->NumSubExprs; ++I) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1002 | E->SubExprs[I] = Record.readSubExpr(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1003 | E->BuiltinLoc = ReadSourceLocation(); |
| 1004 | E->RParenLoc = ReadSourceLocation(); |
Eli Friedman | df14b3a | 2011-10-11 02:20:01 +0000 | [diff] [blame] | 1005 | } |
| 1006 | |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1007 | //===----------------------------------------------------------------------===// |
| 1008 | // Objective-C Expressions and Statements |
| 1009 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1010 | void ASTStmtReader::VisitObjCStringLiteral(ObjCStringLiteral *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1011 | VisitExpr(E); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1012 | E->setString(cast<StringLiteral>(Record.readSubStmt())); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1013 | E->setAtLoc(ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1014 | } |
| 1015 | |
Patrick Beard | 0caa394 | 2012-04-19 00:25:12 +0000 | [diff] [blame] | 1016 | void ASTStmtReader::VisitObjCBoxedExpr(ObjCBoxedExpr *E) { |
Ted Kremenek | e65b086 | 2012-03-06 20:05:56 +0000 | [diff] [blame] | 1017 | VisitExpr(E); |
| 1018 | // could be one of several IntegerLiteral, FloatLiteral, etc. |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1019 | E->SubExpr = Record.readSubStmt(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1020 | E->BoxingMethod = ReadDeclAs<ObjCMethodDecl>(); |
| 1021 | E->Range = ReadSourceRange(); |
Ted Kremenek | e65b086 | 2012-03-06 20:05:56 +0000 | [diff] [blame] | 1022 | } |
| 1023 | |
| 1024 | void ASTStmtReader::VisitObjCArrayLiteral(ObjCArrayLiteral *E) { |
| 1025 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1026 | unsigned NumElements = Record.readInt(); |
Ted Kremenek | e65b086 | 2012-03-06 20:05:56 +0000 | [diff] [blame] | 1027 | assert(NumElements == E->getNumElements() && "Wrong number of elements"); |
| 1028 | Expr **Elements = E->getElements(); |
| 1029 | for (unsigned I = 0, N = NumElements; I != N; ++I) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1030 | Elements[I] = Record.readSubExpr(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1031 | E->ArrayWithObjectsMethod = ReadDeclAs<ObjCMethodDecl>(); |
| 1032 | E->Range = ReadSourceRange(); |
Ted Kremenek | e65b086 | 2012-03-06 20:05:56 +0000 | [diff] [blame] | 1033 | } |
| 1034 | |
| 1035 | void ASTStmtReader::VisitObjCDictionaryLiteral(ObjCDictionaryLiteral *E) { |
| 1036 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1037 | unsigned NumElements = Record.readInt(); |
Ted Kremenek | e65b086 | 2012-03-06 20:05:56 +0000 | [diff] [blame] | 1038 | assert(NumElements == E->getNumElements() && "Wrong number of elements"); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1039 | bool HasPackExpansions = Record.readInt(); |
Ted Kremenek | e65b086 | 2012-03-06 20:05:56 +0000 | [diff] [blame] | 1040 | assert(HasPackExpansions == E->HasPackExpansions &&"Pack expansion mismatch"); |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 1041 | auto *KeyValues = |
James Y Knight | 6c2f06b | 2015-12-31 04:43:19 +0000 | [diff] [blame] | 1042 | E->getTrailingObjects<ObjCDictionaryLiteral::KeyValuePair>(); |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 1043 | auto *Expansions = |
James Y Knight | 6c2f06b | 2015-12-31 04:43:19 +0000 | [diff] [blame] | 1044 | E->getTrailingObjects<ObjCDictionaryLiteral::ExpansionData>(); |
Ted Kremenek | e65b086 | 2012-03-06 20:05:56 +0000 | [diff] [blame] | 1045 | for (unsigned I = 0; I != NumElements; ++I) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1046 | KeyValues[I].Key = Record.readSubExpr(); |
| 1047 | KeyValues[I].Value = Record.readSubExpr(); |
Ted Kremenek | e65b086 | 2012-03-06 20:05:56 +0000 | [diff] [blame] | 1048 | if (HasPackExpansions) { |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1049 | Expansions[I].EllipsisLoc = ReadSourceLocation(); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1050 | Expansions[I].NumExpansionsPlusOne = Record.readInt(); |
Ted Kremenek | e65b086 | 2012-03-06 20:05:56 +0000 | [diff] [blame] | 1051 | } |
| 1052 | } |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1053 | E->DictWithObjectsMethod = ReadDeclAs<ObjCMethodDecl>(); |
| 1054 | E->Range = ReadSourceRange(); |
Ted Kremenek | e65b086 | 2012-03-06 20:05:56 +0000 | [diff] [blame] | 1055 | } |
| 1056 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1057 | void ASTStmtReader::VisitObjCEncodeExpr(ObjCEncodeExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1058 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1059 | E->setEncodedTypeSourceInfo(GetTypeSourceInfo()); |
| 1060 | E->setAtLoc(ReadSourceLocation()); |
| 1061 | E->setRParenLoc(ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1062 | } |
| 1063 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1064 | void ASTStmtReader::VisitObjCSelectorExpr(ObjCSelectorExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1065 | VisitExpr(E); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1066 | E->setSelector(Record.readSelector()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 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::VisitObjCProtocolExpr(ObjCProtocolExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1072 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1073 | E->setProtocol(ReadDeclAs<ObjCProtocolDecl>()); |
| 1074 | E->setAtLoc(ReadSourceLocation()); |
| 1075 | E->ProtoLoc = ReadSourceLocation(); |
| 1076 | E->setRParenLoc(ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1077 | } |
| 1078 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1079 | void ASTStmtReader::VisitObjCIvarRefExpr(ObjCIvarRefExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1080 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1081 | E->setDecl(ReadDeclAs<ObjCIvarDecl>()); |
| 1082 | E->setLocation(ReadSourceLocation()); |
| 1083 | E->setOpLoc(ReadSourceLocation()); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1084 | E->setBase(Record.readSubExpr()); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1085 | E->setIsArrow(Record.readInt()); |
| 1086 | E->setIsFreeIvar(Record.readInt()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1087 | } |
| 1088 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1089 | void ASTStmtReader::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1090 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1091 | unsigned MethodRefFlags = Record.readInt(); |
| 1092 | bool Implicit = Record.readInt() != 0; |
John McCall | b7bd14f | 2010-12-02 01:19:52 +0000 | [diff] [blame] | 1093 | if (Implicit) { |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 1094 | auto *Getter = ReadDeclAs<ObjCMethodDecl>(); |
| 1095 | auto *Setter = ReadDeclAs<ObjCMethodDecl>(); |
Argyrios Kyrtzidis | ab468b0 | 2012-03-30 00:19:18 +0000 | [diff] [blame] | 1096 | E->setImplicitProperty(Getter, Setter, MethodRefFlags); |
John McCall | b7bd14f | 2010-12-02 01:19:52 +0000 | [diff] [blame] | 1097 | } else { |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1098 | E->setExplicitProperty(ReadDeclAs<ObjCPropertyDecl>(), MethodRefFlags); |
Fariborz Jahanian | 681c075 | 2010-10-14 16:04:05 +0000 | [diff] [blame] | 1099 | } |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1100 | E->setLocation(ReadSourceLocation()); |
| 1101 | E->setReceiverLocation(ReadSourceLocation()); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1102 | switch (Record.readInt()) { |
John McCall | b7bd14f | 2010-12-02 01:19:52 +0000 | [diff] [blame] | 1103 | case 0: |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1104 | E->setBase(Record.readSubExpr()); |
John McCall | b7bd14f | 2010-12-02 01:19:52 +0000 | [diff] [blame] | 1105 | break; |
| 1106 | case 1: |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1107 | E->setSuperReceiver(Record.readType()); |
John McCall | b7bd14f | 2010-12-02 01:19:52 +0000 | [diff] [blame] | 1108 | break; |
| 1109 | case 2: |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1110 | E->setClassReceiver(ReadDeclAs<ObjCInterfaceDecl>()); |
John McCall | b7bd14f | 2010-12-02 01:19:52 +0000 | [diff] [blame] | 1111 | break; |
| 1112 | } |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1113 | } |
| 1114 | |
Ted Kremenek | e65b086 | 2012-03-06 20:05:56 +0000 | [diff] [blame] | 1115 | void ASTStmtReader::VisitObjCSubscriptRefExpr(ObjCSubscriptRefExpr *E) { |
| 1116 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1117 | E->setRBracket(ReadSourceLocation()); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1118 | E->setBaseExpr(Record.readSubExpr()); |
| 1119 | E->setKeyExpr(Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1120 | E->GetAtIndexMethodDecl = ReadDeclAs<ObjCMethodDecl>(); |
| 1121 | E->SetAtIndexMethodDecl = ReadDeclAs<ObjCMethodDecl>(); |
Ted Kremenek | e65b086 | 2012-03-06 20:05:56 +0000 | [diff] [blame] | 1122 | } |
| 1123 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1124 | void ASTStmtReader::VisitObjCMessageExpr(ObjCMessageExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1125 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1126 | assert(Record.peekInt() == E->getNumArgs()); |
| 1127 | Record.skipInts(1); |
| 1128 | unsigned NumStoredSelLocs = Record.readInt(); |
| 1129 | E->SelLocsKind = Record.readInt(); |
| 1130 | E->setDelegateInitCall(Record.readInt()); |
| 1131 | E->IsImplicit = Record.readInt(); |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 1132 | auto Kind = static_cast<ObjCMessageExpr::ReceiverKind>(Record.readInt()); |
Douglas Gregor | 9a12919 | 2010-04-21 00:45:42 +0000 | [diff] [blame] | 1133 | switch (Kind) { |
| 1134 | case ObjCMessageExpr::Instance: |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1135 | E->setInstanceReceiver(Record.readSubExpr()); |
Douglas Gregor | 9a12919 | 2010-04-21 00:45:42 +0000 | [diff] [blame] | 1136 | break; |
| 1137 | |
| 1138 | case ObjCMessageExpr::Class: |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1139 | E->setClassReceiver(GetTypeSourceInfo()); |
Douglas Gregor | 9a12919 | 2010-04-21 00:45:42 +0000 | [diff] [blame] | 1140 | break; |
| 1141 | |
| 1142 | case ObjCMessageExpr::SuperClass: |
| 1143 | case ObjCMessageExpr::SuperInstance: { |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1144 | QualType T = Record.readType(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1145 | SourceLocation SuperLoc = ReadSourceLocation(); |
Douglas Gregor | 9a12919 | 2010-04-21 00:45:42 +0000 | [diff] [blame] | 1146 | E->setSuper(SuperLoc, T, Kind == ObjCMessageExpr::SuperInstance); |
| 1147 | break; |
| 1148 | } |
| 1149 | } |
| 1150 | |
| 1151 | assert(Kind == E->getReceiverKind()); |
| 1152 | |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1153 | if (Record.readInt()) |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1154 | E->setMethodDecl(ReadDeclAs<ObjCMethodDecl>()); |
Douglas Gregor | 9a12919 | 2010-04-21 00:45:42 +0000 | [diff] [blame] | 1155 | else |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1156 | E->setSelector(Record.readSelector()); |
Douglas Gregor | 9a12919 | 2010-04-21 00:45:42 +0000 | [diff] [blame] | 1157 | |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1158 | E->LBracLoc = ReadSourceLocation(); |
| 1159 | E->RBracLoc = ReadSourceLocation(); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1160 | |
| 1161 | for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1162 | E->setArg(I, Record.readSubExpr()); |
Argyrios Kyrtzidis | a6011e2 | 2011-10-03 06:36:51 +0000 | [diff] [blame] | 1163 | |
| 1164 | SourceLocation *Locs = E->getStoredSelLocs(); |
| 1165 | for (unsigned I = 0; I != NumStoredSelLocs; ++I) |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1166 | Locs[I] = ReadSourceLocation(); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1167 | } |
| 1168 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1169 | void ASTStmtReader::VisitObjCForCollectionStmt(ObjCForCollectionStmt *S) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1170 | VisitStmt(S); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1171 | S->setElement(Record.readSubStmt()); |
| 1172 | S->setCollection(Record.readSubExpr()); |
| 1173 | S->setBody(Record.readSubStmt()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1174 | S->setForLoc(ReadSourceLocation()); |
| 1175 | S->setRParenLoc(ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1176 | } |
| 1177 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1178 | void ASTStmtReader::VisitObjCAtCatchStmt(ObjCAtCatchStmt *S) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1179 | VisitStmt(S); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1180 | S->setCatchBody(Record.readSubStmt()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1181 | S->setCatchParamDecl(ReadDeclAs<VarDecl>()); |
| 1182 | S->setAtCatchLoc(ReadSourceLocation()); |
| 1183 | S->setRParenLoc(ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1184 | } |
| 1185 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1186 | void ASTStmtReader::VisitObjCAtFinallyStmt(ObjCAtFinallyStmt *S) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1187 | VisitStmt(S); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1188 | S->setFinallyBody(Record.readSubStmt()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1189 | S->setAtFinallyLoc(ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1190 | } |
| 1191 | |
John McCall | 31168b0 | 2011-06-15 23:02:42 +0000 | [diff] [blame] | 1192 | void ASTStmtReader::VisitObjCAutoreleasePoolStmt(ObjCAutoreleasePoolStmt *S) { |
| 1193 | VisitStmt(S); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1194 | S->setSubStmt(Record.readSubStmt()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1195 | S->setAtLoc(ReadSourceLocation()); |
John McCall | 31168b0 | 2011-06-15 23:02:42 +0000 | [diff] [blame] | 1196 | } |
| 1197 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1198 | void ASTStmtReader::VisitObjCAtTryStmt(ObjCAtTryStmt *S) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1199 | VisitStmt(S); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1200 | assert(Record.peekInt() == S->getNumCatchStmts()); |
| 1201 | Record.skipInts(1); |
| 1202 | bool HasFinally = Record.readInt(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1203 | S->setTryBody(Record.readSubStmt()); |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1204 | for (unsigned I = 0, N = S->getNumCatchStmts(); I != N; ++I) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1205 | S->setCatchStmt(I, cast_or_null<ObjCAtCatchStmt>(Record.readSubStmt())); |
Douglas Gregor | 96c7949 | 2010-04-23 22:50:49 +0000 | [diff] [blame] | 1206 | |
Douglas Gregor | 96c7949 | 2010-04-23 22:50:49 +0000 | [diff] [blame] | 1207 | if (HasFinally) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1208 | S->setFinallyStmt(Record.readSubStmt()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1209 | S->setAtTryLoc(ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1210 | } |
| 1211 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1212 | void ASTStmtReader::VisitObjCAtSynchronizedStmt(ObjCAtSynchronizedStmt *S) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1213 | VisitStmt(S); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1214 | S->setSynchExpr(Record.readSubStmt()); |
| 1215 | S->setSynchBody(Record.readSubStmt()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1216 | S->setAtSynchronizedLoc(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::VisitObjCAtThrowStmt(ObjCAtThrowStmt *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->setThrowExpr(Record.readSubStmt()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1222 | S->setThrowLoc(ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1223 | } |
| 1224 | |
Ted Kremenek | e65b086 | 2012-03-06 20:05:56 +0000 | [diff] [blame] | 1225 | void ASTStmtReader::VisitObjCBoolLiteralExpr(ObjCBoolLiteralExpr *E) { |
| 1226 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1227 | E->setValue(Record.readInt()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1228 | E->setLocation(ReadSourceLocation()); |
Ted Kremenek | e65b086 | 2012-03-06 20:05:56 +0000 | [diff] [blame] | 1229 | } |
| 1230 | |
Erik Pilkington | 29099de | 2016-07-16 00:35:23 +0000 | [diff] [blame] | 1231 | void ASTStmtReader::VisitObjCAvailabilityCheckExpr(ObjCAvailabilityCheckExpr *E) { |
| 1232 | VisitExpr(E); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1233 | SourceRange R = Record.readSourceRange(); |
Erik Pilkington | 29099de | 2016-07-16 00:35:23 +0000 | [diff] [blame] | 1234 | E->AtLoc = R.getBegin(); |
| 1235 | E->RParen = R.getEnd(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1236 | E->VersionToCheck = Record.readVersionTuple(); |
Erik Pilkington | 29099de | 2016-07-16 00:35:23 +0000 | [diff] [blame] | 1237 | } |
| 1238 | |
Argyrios Kyrtzidis | eeaaead | 2009-07-14 03:19:21 +0000 | [diff] [blame] | 1239 | //===----------------------------------------------------------------------===// |
| 1240 | // C++ Expressions and Statements |
Argyrios Kyrtzidis | 47cd7a9 | 2010-07-22 16:03:56 +0000 | [diff] [blame] | 1241 | //===----------------------------------------------------------------------===// |
| 1242 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1243 | void ASTStmtReader::VisitCXXCatchStmt(CXXCatchStmt *S) { |
Argyrios Kyrtzidis | 47cd7a9 | 2010-07-22 16:03:56 +0000 | [diff] [blame] | 1244 | VisitStmt(S); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1245 | S->CatchLoc = ReadSourceLocation(); |
| 1246 | S->ExceptionDecl = ReadDeclAs<VarDecl>(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1247 | S->HandlerBlock = Record.readSubStmt(); |
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::VisitCXXTryStmt(CXXTryStmt *S) { |
Argyrios Kyrtzidis | 47cd7a9 | 2010-07-22 16:03:56 +0000 | [diff] [blame] | 1251 | VisitStmt(S); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1252 | assert(Record.peekInt() == S->getNumHandlers() && "NumStmtFields is wrong ?"); |
| 1253 | Record.skipInts(1); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1254 | S->TryLoc = ReadSourceLocation(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1255 | S->getStmts()[0] = Record.readSubStmt(); |
Argyrios Kyrtzidis | 47cd7a9 | 2010-07-22 16:03:56 +0000 | [diff] [blame] | 1256 | for (unsigned i = 0, e = S->getNumHandlers(); i != e; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1257 | S->getStmts()[i + 1] = Record.readSubStmt(); |
Argyrios Kyrtzidis | 47cd7a9 | 2010-07-22 16:03:56 +0000 | [diff] [blame] | 1258 | } |
Argyrios Kyrtzidis | eeaaead | 2009-07-14 03:19:21 +0000 | [diff] [blame] | 1259 | |
Richard Smith | 02e85f3 | 2011-04-14 22:09:26 +0000 | [diff] [blame] | 1260 | void ASTStmtReader::VisitCXXForRangeStmt(CXXForRangeStmt *S) { |
| 1261 | VisitStmt(S); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1262 | S->ForLoc = ReadSourceLocation(); |
| 1263 | S->CoawaitLoc = ReadSourceLocation(); |
| 1264 | S->ColonLoc = ReadSourceLocation(); |
| 1265 | S->RParenLoc = ReadSourceLocation(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1266 | S->setRangeStmt(Record.readSubStmt()); |
| 1267 | S->setBeginStmt(Record.readSubStmt()); |
| 1268 | S->setEndStmt(Record.readSubStmt()); |
| 1269 | S->setCond(Record.readSubExpr()); |
| 1270 | S->setInc(Record.readSubExpr()); |
| 1271 | S->setLoopVarStmt(Record.readSubStmt()); |
| 1272 | S->setBody(Record.readSubStmt()); |
Richard Smith | 02e85f3 | 2011-04-14 22:09:26 +0000 | [diff] [blame] | 1273 | } |
| 1274 | |
Douglas Gregor | deb4a2be | 2011-10-25 01:33:02 +0000 | [diff] [blame] | 1275 | void ASTStmtReader::VisitMSDependentExistsStmt(MSDependentExistsStmt *S) { |
| 1276 | VisitStmt(S); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1277 | S->KeywordLoc = ReadSourceLocation(); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1278 | S->IsIfExists = Record.readInt(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1279 | S->QualifierLoc = Record.readNestedNameSpecifierLoc(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1280 | ReadDeclarationNameInfo(S->NameInfo); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1281 | S->SubStmt = Record.readSubStmt(); |
Douglas Gregor | deb4a2be | 2011-10-25 01:33:02 +0000 | [diff] [blame] | 1282 | } |
| 1283 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1284 | void ASTStmtReader::VisitCXXOperatorCallExpr(CXXOperatorCallExpr *E) { |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1285 | VisitCallExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1286 | E->Operator = (OverloadedOperatorKind)Record.readInt(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1287 | E->Range = Record.readSourceRange(); |
Adam Nemet | 484aa45 | 2017-03-27 19:17:25 +0000 | [diff] [blame] | 1288 | E->setFPFeatures(FPOptions(Record.readInt())); |
Argyrios Kyrtzidis | eeaaead | 2009-07-14 03:19:21 +0000 | [diff] [blame] | 1289 | } |
| 1290 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1291 | void ASTStmtReader::VisitCXXConstructExpr(CXXConstructExpr *E) { |
Douglas Gregor | 5d3507d | 2009-09-09 23:08:42 +0000 | [diff] [blame] | 1292 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1293 | E->NumArgs = Record.readInt(); |
Argyrios Kyrtzidis | b8d77eb | 2010-07-10 11:46:15 +0000 | [diff] [blame] | 1294 | if (E->NumArgs) |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1295 | E->Args = new (Record.getContext()) Stmt*[E->NumArgs]; |
Argyrios Kyrtzidis | 30d98f3 | 2010-06-24 08:57:09 +0000 | [diff] [blame] | 1296 | for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1297 | E->setArg(I, Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1298 | E->setConstructor(ReadDeclAs<CXXConstructorDecl>()); |
| 1299 | E->setLocation(ReadSourceLocation()); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1300 | E->setElidable(Record.readInt()); |
| 1301 | E->setHadMultipleCandidates(Record.readInt()); |
| 1302 | E->setListInitialization(Record.readInt()); |
| 1303 | E->setStdInitListInitialization(Record.readInt()); |
| 1304 | E->setRequiresZeroInitialization(Record.readInt()); |
| 1305 | E->setConstructionKind((CXXConstructExpr::ConstructionKind)Record.readInt()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1306 | E->ParenOrBraceRange = ReadSourceRange(); |
Douglas Gregor | 5d3507d | 2009-09-09 23:08:42 +0000 | [diff] [blame] | 1307 | } |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1308 | |
Richard Smith | 5179eb7 | 2016-06-28 19:03:57 +0000 | [diff] [blame] | 1309 | void ASTStmtReader::VisitCXXInheritedCtorInitExpr(CXXInheritedCtorInitExpr *E) { |
| 1310 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1311 | E->Constructor = ReadDeclAs<CXXConstructorDecl>(); |
| 1312 | E->Loc = ReadSourceLocation(); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1313 | E->ConstructsVirtualBase = Record.readInt(); |
| 1314 | E->InheritedFromVirtualBase = Record.readInt(); |
Richard Smith | 5179eb7 | 2016-06-28 19:03:57 +0000 | [diff] [blame] | 1315 | } |
| 1316 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1317 | void ASTStmtReader::VisitCXXTemporaryObjectExpr(CXXTemporaryObjectExpr *E) { |
Argyrios Kyrtzidis | b8d77eb | 2010-07-10 11:46:15 +0000 | [diff] [blame] | 1318 | VisitCXXConstructExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1319 | E->Type = GetTypeSourceInfo(); |
Argyrios Kyrtzidis | b8d77eb | 2010-07-10 11:46:15 +0000 | [diff] [blame] | 1320 | } |
| 1321 | |
Douglas Gregor | e31e606 | 2012-02-07 10:09:13 +0000 | [diff] [blame] | 1322 | void ASTStmtReader::VisitLambdaExpr(LambdaExpr *E) { |
| 1323 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1324 | unsigned NumCaptures = Record.readInt(); |
Douglas Gregor | 99ae806 | 2012-02-14 17:54:36 +0000 | [diff] [blame] | 1325 | assert(NumCaptures == E->NumCaptures);(void)NumCaptures; |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1326 | E->IntroducerRange = ReadSourceRange(); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1327 | E->CaptureDefault = static_cast<LambdaCaptureDefault>(Record.readInt()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1328 | E->CaptureDefaultLoc = ReadSourceLocation(); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1329 | E->ExplicitParams = Record.readInt(); |
| 1330 | E->ExplicitResultType = Record.readInt(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1331 | E->ClosingBrace = ReadSourceLocation(); |
| 1332 | |
Douglas Gregor | 99ae806 | 2012-02-14 17:54:36 +0000 | [diff] [blame] | 1333 | // Read capture initializers. |
| 1334 | for (LambdaExpr::capture_init_iterator C = E->capture_init_begin(), |
| 1335 | CEnd = E->capture_init_end(); |
| 1336 | C != CEnd; ++C) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1337 | *C = Record.readSubExpr(); |
Douglas Gregor | e31e606 | 2012-02-07 10:09:13 +0000 | [diff] [blame] | 1338 | } |
| 1339 | |
Richard Smith | cc1b96d | 2013-06-12 22:31:48 +0000 | [diff] [blame] | 1340 | void |
| 1341 | ASTStmtReader::VisitCXXStdInitializerListExpr(CXXStdInitializerListExpr *E) { |
| 1342 | VisitExpr(E); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1343 | E->SubExpr = Record.readSubExpr(); |
Richard Smith | cc1b96d | 2013-06-12 22:31:48 +0000 | [diff] [blame] | 1344 | } |
| 1345 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1346 | void ASTStmtReader::VisitCXXNamedCastExpr(CXXNamedCastExpr *E) { |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1347 | VisitExplicitCastExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1348 | SourceRange R = ReadSourceRange(); |
Douglas Gregor | 4478f85 | 2011-01-12 22:41:29 +0000 | [diff] [blame] | 1349 | E->Loc = R.getBegin(); |
| 1350 | E->RParenLoc = R.getEnd(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1351 | R = ReadSourceRange(); |
Fariborz Jahanian | f073871 | 2013-02-22 22:02:53 +0000 | [diff] [blame] | 1352 | E->AngleBrackets = R; |
Sam Weinig | d01101e | 2010-01-16 21:21:01 +0000 | [diff] [blame] | 1353 | } |
| 1354 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1355 | void ASTStmtReader::VisitCXXStaticCastExpr(CXXStaticCastExpr *E) { |
Sam Weinig | d01101e | 2010-01-16 21:21:01 +0000 | [diff] [blame] | 1356 | return VisitCXXNamedCastExpr(E); |
| 1357 | } |
| 1358 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1359 | void ASTStmtReader::VisitCXXDynamicCastExpr(CXXDynamicCastExpr *E) { |
Sam Weinig | d01101e | 2010-01-16 21:21:01 +0000 | [diff] [blame] | 1360 | return VisitCXXNamedCastExpr(E); |
| 1361 | } |
| 1362 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1363 | void ASTStmtReader::VisitCXXReinterpretCastExpr(CXXReinterpretCastExpr *E) { |
Sam Weinig | d01101e | 2010-01-16 21:21:01 +0000 | [diff] [blame] | 1364 | return VisitCXXNamedCastExpr(E); |
| 1365 | } |
| 1366 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1367 | void ASTStmtReader::VisitCXXConstCastExpr(CXXConstCastExpr *E) { |
Sam Weinig | d01101e | 2010-01-16 21:21:01 +0000 | [diff] [blame] | 1368 | return VisitCXXNamedCastExpr(E); |
| 1369 | } |
| 1370 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1371 | void ASTStmtReader::VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr *E) { |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1372 | VisitExplicitCastExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1373 | E->setLParenLoc(ReadSourceLocation()); |
| 1374 | E->setRParenLoc(ReadSourceLocation()); |
Sam Weinig | d01101e | 2010-01-16 21:21:01 +0000 | [diff] [blame] | 1375 | } |
| 1376 | |
Richard Smith | c67fdd4 | 2012-03-07 08:35:16 +0000 | [diff] [blame] | 1377 | void ASTStmtReader::VisitUserDefinedLiteral(UserDefinedLiteral *E) { |
| 1378 | VisitCallExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1379 | E->UDSuffixLoc = ReadSourceLocation(); |
Richard Smith | c67fdd4 | 2012-03-07 08:35:16 +0000 | [diff] [blame] | 1380 | } |
| 1381 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1382 | void ASTStmtReader::VisitCXXBoolLiteralExpr(CXXBoolLiteralExpr *E) { |
Sam Weinig | e83b3ac | 2010-02-07 06:32:43 +0000 | [diff] [blame] | 1383 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1384 | E->setValue(Record.readInt()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1385 | E->setLocation(ReadSourceLocation()); |
Sam Weinig | e83b3ac | 2010-02-07 06:32:43 +0000 | [diff] [blame] | 1386 | } |
| 1387 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1388 | void ASTStmtReader::VisitCXXNullPtrLiteralExpr(CXXNullPtrLiteralExpr *E) { |
Sam Weinig | e83b3ac | 2010-02-07 06:32:43 +0000 | [diff] [blame] | 1389 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1390 | E->setLocation(ReadSourceLocation()); |
Sam Weinig | e83b3ac | 2010-02-07 06:32:43 +0000 | [diff] [blame] | 1391 | } |
| 1392 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1393 | void ASTStmtReader::VisitCXXTypeidExpr(CXXTypeidExpr *E) { |
Chris Lattner | 13a5ecc | 2010-05-09 06:03:39 +0000 | [diff] [blame] | 1394 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1395 | E->setSourceRange(ReadSourceRange()); |
Chris Lattner | 13a5ecc | 2010-05-09 06:03:39 +0000 | [diff] [blame] | 1396 | if (E->isTypeOperand()) { // typeid(int) |
Sebastian Redl | c67764e | 2010-07-22 22:43:28 +0000 | [diff] [blame] | 1397 | E->setTypeOperandSourceInfo( |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1398 | GetTypeSourceInfo()); |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1399 | return; |
Chris Lattner | 13a5ecc | 2010-05-09 06:03:39 +0000 | [diff] [blame] | 1400 | } |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1401 | |
Chris Lattner | 13a5ecc | 2010-05-09 06:03:39 +0000 | [diff] [blame] | 1402 | // typeid(42+2) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1403 | E->setExprOperand(Record.readSubExpr()); |
Chris Lattner | 13a5ecc | 2010-05-09 06:03:39 +0000 | [diff] [blame] | 1404 | } |
| 1405 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1406 | void ASTStmtReader::VisitCXXThisExpr(CXXThisExpr *E) { |
Chris Lattner | 9826733 | 2010-05-09 06:15:05 +0000 | [diff] [blame] | 1407 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1408 | E->setLocation(ReadSourceLocation()); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1409 | E->setImplicit(Record.readInt()); |
Chris Lattner | 9826733 | 2010-05-09 06:15:05 +0000 | [diff] [blame] | 1410 | } |
| 1411 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1412 | void ASTStmtReader::VisitCXXThrowExpr(CXXThrowExpr *E) { |
Chris Lattner | 9826733 | 2010-05-09 06:15:05 +0000 | [diff] [blame] | 1413 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1414 | E->ThrowLoc = ReadSourceLocation(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1415 | E->Op = Record.readSubExpr(); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1416 | E->IsThrownVariableInScope = Record.readInt(); |
Chris Lattner | 9826733 | 2010-05-09 06:15:05 +0000 | [diff] [blame] | 1417 | } |
Chris Lattner | 13a5ecc | 2010-05-09 06:03:39 +0000 | [diff] [blame] | 1418 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1419 | void ASTStmtReader::VisitCXXDefaultArgExpr(CXXDefaultArgExpr *E) { |
Chris Lattner | e2437f4 | 2010-05-09 06:40:08 +0000 | [diff] [blame] | 1420 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1421 | E->Param = ReadDeclAs<ParmVarDecl>(); |
| 1422 | E->Loc = ReadSourceLocation(); |
Chris Lattner | cba8614 | 2010-05-10 00:25:06 +0000 | [diff] [blame] | 1423 | } |
| 1424 | |
Richard Smith | 852c9db | 2013-04-20 22:23:05 +0000 | [diff] [blame] | 1425 | void ASTStmtReader::VisitCXXDefaultInitExpr(CXXDefaultInitExpr *E) { |
| 1426 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1427 | E->Field = ReadDeclAs<FieldDecl>(); |
| 1428 | E->Loc = ReadSourceLocation(); |
Richard Smith | 852c9db | 2013-04-20 22:23:05 +0000 | [diff] [blame] | 1429 | } |
| 1430 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1431 | void ASTStmtReader::VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *E) { |
Chris Lattner | cba8614 | 2010-05-10 00:25:06 +0000 | [diff] [blame] | 1432 | VisitExpr(E); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1433 | E->setTemporary(Record.readCXXTemporary()); |
| 1434 | E->setSubExpr(Record.readSubExpr()); |
Chris Lattner | cba8614 | 2010-05-10 00:25:06 +0000 | [diff] [blame] | 1435 | } |
| 1436 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1437 | void ASTStmtReader::VisitCXXScalarValueInitExpr(CXXScalarValueInitExpr *E) { |
Chris Lattner | abfb58d | 2010-05-10 01:22:27 +0000 | [diff] [blame] | 1438 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1439 | E->TypeInfo = GetTypeSourceInfo(); |
| 1440 | E->RParenLoc = ReadSourceLocation(); |
Chris Lattner | abfb58d | 2010-05-10 01:22:27 +0000 | [diff] [blame] | 1441 | } |
| 1442 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1443 | void ASTStmtReader::VisitCXXNewExpr(CXXNewExpr *E) { |
Chris Lattner | abfb58d | 2010-05-10 01:22:27 +0000 | [diff] [blame] | 1444 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1445 | E->GlobalNew = Record.readInt(); |
| 1446 | bool isArray = Record.readInt(); |
| 1447 | E->PassAlignment = Record.readInt(); |
| 1448 | E->UsualArrayDeleteWantsSize = Record.readInt(); |
| 1449 | unsigned NumPlacementArgs = Record.readInt(); |
| 1450 | E->StoredInitializationStyle = Record.readInt(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1451 | E->setOperatorNew(ReadDeclAs<FunctionDecl>()); |
| 1452 | E->setOperatorDelete(ReadDeclAs<FunctionDecl>()); |
| 1453 | E->AllocatedTypeInfo = GetTypeSourceInfo(); |
| 1454 | E->TypeIdParens = ReadSourceRange(); |
| 1455 | E->Range = ReadSourceRange(); |
| 1456 | E->DirectInitRange = ReadSourceRange(); |
Chandler Carruth | 0171815 | 2010-10-25 08:47:36 +0000 | [diff] [blame] | 1457 | |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1458 | E->AllocateArgsArray(Record.getContext(), isArray, NumPlacementArgs, |
Sebastian Redl | 6047f07 | 2012-02-16 12:22:20 +0000 | [diff] [blame] | 1459 | E->StoredInitializationStyle != 0); |
Chris Lattner | abfb58d | 2010-05-10 01:22:27 +0000 | [diff] [blame] | 1460 | |
| 1461 | // Install all the subexpressions. |
Chris Lattner | abfb58d | 2010-05-10 01:22:27 +0000 | [diff] [blame] | 1462 | for (CXXNewExpr::raw_arg_iterator I = E->raw_arg_begin(),e = E->raw_arg_end(); |
| 1463 | I != e; ++I) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1464 | *I = Record.readSubStmt(); |
Chris Lattner | abfb58d | 2010-05-10 01:22:27 +0000 | [diff] [blame] | 1465 | } |
| 1466 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1467 | void ASTStmtReader::VisitCXXDeleteExpr(CXXDeleteExpr *E) { |
Argyrios Kyrtzidis | 6e57c35 | 2010-06-22 17:07:59 +0000 | [diff] [blame] | 1468 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1469 | E->GlobalDelete = Record.readInt(); |
| 1470 | E->ArrayForm = Record.readInt(); |
| 1471 | E->ArrayFormAsWritten = Record.readInt(); |
| 1472 | E->UsualArrayDeleteWantsSize = Record.readInt(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1473 | E->OperatorDelete = ReadDeclAs<FunctionDecl>(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1474 | E->Argument = Record.readSubExpr(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1475 | E->Loc = ReadSourceLocation(); |
Argyrios Kyrtzidis | 6e57c35 | 2010-06-22 17:07:59 +0000 | [diff] [blame] | 1476 | } |
Chris Lattner | cba8614 | 2010-05-10 00:25:06 +0000 | [diff] [blame] | 1477 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1478 | void ASTStmtReader::VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr *E) { |
Argyrios Kyrtzidis | 99a226d | 2010-06-28 09:32:03 +0000 | [diff] [blame] | 1479 | VisitExpr(E); |
| 1480 | |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1481 | E->Base = Record.readSubExpr(); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1482 | E->IsArrow = Record.readInt(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1483 | E->OperatorLoc = ReadSourceLocation(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1484 | E->QualifierLoc = Record.readNestedNameSpecifierLoc(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1485 | E->ScopeType = GetTypeSourceInfo(); |
| 1486 | E->ColonColonLoc = ReadSourceLocation(); |
| 1487 | E->TildeLoc = ReadSourceLocation(); |
| 1488 | |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1489 | IdentifierInfo *II = Record.getIdentifierInfo(); |
Argyrios Kyrtzidis | 99a226d | 2010-06-28 09:32:03 +0000 | [diff] [blame] | 1490 | if (II) |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1491 | E->setDestroyedType(II, ReadSourceLocation()); |
Argyrios Kyrtzidis | 99a226d | 2010-06-28 09:32:03 +0000 | [diff] [blame] | 1492 | else |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1493 | E->setDestroyedType(GetTypeSourceInfo()); |
Argyrios Kyrtzidis | 99a226d | 2010-06-28 09:32:03 +0000 | [diff] [blame] | 1494 | } |
| 1495 | |
John McCall | 5d41378 | 2010-12-06 08:20:24 +0000 | [diff] [blame] | 1496 | void ASTStmtReader::VisitExprWithCleanups(ExprWithCleanups *E) { |
Chris Lattner | cba8614 | 2010-05-10 00:25:06 +0000 | [diff] [blame] | 1497 | VisitExpr(E); |
John McCall | 28fc709 | 2011-11-10 05:35:25 +0000 | [diff] [blame] | 1498 | |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1499 | unsigned NumObjects = Record.readInt(); |
John McCall | 28fc709 | 2011-11-10 05:35:25 +0000 | [diff] [blame] | 1500 | assert(NumObjects == E->getNumObjects()); |
| 1501 | for (unsigned i = 0; i != NumObjects; ++i) |
James Y Knight | e00a67e | 2015-12-31 04:18:25 +0000 | [diff] [blame] | 1502 | E->getTrailingObjects<BlockDecl *>()[i] = |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1503 | ReadDeclAs<BlockDecl>(); |
John McCall | 28fc709 | 2011-11-10 05:35:25 +0000 | [diff] [blame] | 1504 | |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1505 | E->ExprWithCleanupsBits.CleanupsHaveSideEffects = Record.readInt(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1506 | E->SubExpr = Record.readSubExpr(); |
Chris Lattner | e2437f4 | 2010-05-09 06:40:08 +0000 | [diff] [blame] | 1507 | } |
| 1508 | |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1509 | void |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1510 | ASTStmtReader::VisitCXXDependentScopeMemberExpr(CXXDependentScopeMemberExpr *E){ |
Argyrios Kyrtzidis | bfcacee | 2010-06-24 08:57:31 +0000 | [diff] [blame] | 1511 | VisitExpr(E); |
Abramo Bagnara | 7945c98 | 2012-01-27 09:46:47 +0000 | [diff] [blame] | 1512 | |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1513 | if (Record.readInt()) // HasTemplateKWAndArgsInfo |
James Y Knight | e7d8228 | 2015-12-29 18:15:14 +0000 | [diff] [blame] | 1514 | ReadTemplateKWAndArgsInfo( |
| 1515 | *E->getTrailingObjects<ASTTemplateKWAndArgsInfo>(), |
| 1516 | E->getTrailingObjects<TemplateArgumentLoc>(), |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1517 | /*NumTemplateArgs=*/Record.readInt()); |
Argyrios Kyrtzidis | bfcacee | 2010-06-24 08:57:31 +0000 | [diff] [blame] | 1518 | |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1519 | E->Base = Record.readSubExpr(); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1520 | E->BaseType = Record.readType(); |
| 1521 | E->IsArrow = Record.readInt(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1522 | E->OperatorLoc = ReadSourceLocation(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1523 | E->QualifierLoc = Record.readNestedNameSpecifierLoc(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1524 | E->FirstQualifierFoundInScope = ReadDeclAs<NamedDecl>(); |
| 1525 | ReadDeclarationNameInfo(E->MemberNameInfo); |
Argyrios Kyrtzidis | bfcacee | 2010-06-24 08:57:31 +0000 | [diff] [blame] | 1526 | } |
| 1527 | |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1528 | void |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1529 | ASTStmtReader::VisitDependentScopeDeclRefExpr(DependentScopeDeclRefExpr *E) { |
Argyrios Kyrtzidis | cd444d1a | 2010-06-28 09:31:56 +0000 | [diff] [blame] | 1530 | VisitExpr(E); |
Abramo Bagnara | 7945c98 | 2012-01-27 09:46:47 +0000 | [diff] [blame] | 1531 | |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1532 | if (Record.readInt()) // HasTemplateKWAndArgsInfo |
James Y Knight | e7d8228 | 2015-12-29 18:15:14 +0000 | [diff] [blame] | 1533 | ReadTemplateKWAndArgsInfo( |
| 1534 | *E->getTrailingObjects<ASTTemplateKWAndArgsInfo>(), |
| 1535 | E->getTrailingObjects<TemplateArgumentLoc>(), |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1536 | /*NumTemplateArgs=*/Record.readInt()); |
Douglas Gregor | 3a43fd6 | 2011-02-25 20:49:16 +0000 | [diff] [blame] | 1537 | |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1538 | E->QualifierLoc = Record.readNestedNameSpecifierLoc(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1539 | ReadDeclarationNameInfo(E->NameInfo); |
Argyrios Kyrtzidis | cd444d1a | 2010-06-28 09:31:56 +0000 | [diff] [blame] | 1540 | } |
| 1541 | |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1542 | void |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1543 | ASTStmtReader::VisitCXXUnresolvedConstructExpr(CXXUnresolvedConstructExpr *E) { |
Argyrios Kyrtzidis | bfcacee | 2010-06-24 08:57:31 +0000 | [diff] [blame] | 1544 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1545 | assert(Record.peekInt() == E->arg_size() && |
| 1546 | "Read wrong record during creation ?"); |
| 1547 | Record.skipInts(1); |
Argyrios Kyrtzidis | bfcacee | 2010-06-24 08:57:31 +0000 | [diff] [blame] | 1548 | for (unsigned I = 0, N = E->arg_size(); I != N; ++I) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1549 | E->setArg(I, Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1550 | E->Type = GetTypeSourceInfo(); |
| 1551 | E->setLParenLoc(ReadSourceLocation()); |
| 1552 | E->setRParenLoc(ReadSourceLocation()); |
Argyrios Kyrtzidis | bfcacee | 2010-06-24 08:57:31 +0000 | [diff] [blame] | 1553 | } |
| 1554 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1555 | void ASTStmtReader::VisitOverloadExpr(OverloadExpr *E) { |
Argyrios Kyrtzidis | b8d3c63 | 2010-06-25 09:03:26 +0000 | [diff] [blame] | 1556 | VisitExpr(E); |
Abramo Bagnara | 7945c98 | 2012-01-27 09:46:47 +0000 | [diff] [blame] | 1557 | |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1558 | if (Record.readInt()) // HasTemplateKWAndArgsInfo |
James Y Knight | e7d8228 | 2015-12-29 18:15:14 +0000 | [diff] [blame] | 1559 | ReadTemplateKWAndArgsInfo(*E->getTrailingASTTemplateKWAndArgsInfo(), |
| 1560 | E->getTrailingTemplateArgumentLoc(), |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1561 | /*NumTemplateArgs=*/Record.readInt()); |
Argyrios Kyrtzidis | b8d3c63 | 2010-06-25 09:03:26 +0000 | [diff] [blame] | 1562 | |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1563 | unsigned NumDecls = Record.readInt(); |
Argyrios Kyrtzidis | b8d3c63 | 2010-06-25 09:03:26 +0000 | [diff] [blame] | 1564 | UnresolvedSet<8> Decls; |
| 1565 | for (unsigned i = 0; i != NumDecls; ++i) { |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 1566 | auto *D = ReadDeclAs<NamedDecl>(); |
| 1567 | auto AS = (AccessSpecifier)Record.readInt(); |
Argyrios Kyrtzidis | b8d3c63 | 2010-06-25 09:03:26 +0000 | [diff] [blame] | 1568 | Decls.addDecl(D, AS); |
| 1569 | } |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1570 | E->initializeResults(Record.getContext(), Decls.begin(), Decls.end()); |
Argyrios Kyrtzidis | b8d3c63 | 2010-06-25 09:03:26 +0000 | [diff] [blame] | 1571 | |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1572 | ReadDeclarationNameInfo(E->NameInfo); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1573 | E->QualifierLoc = Record.readNestedNameSpecifierLoc(); |
Argyrios Kyrtzidis | b8d3c63 | 2010-06-25 09:03:26 +0000 | [diff] [blame] | 1574 | } |
| 1575 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1576 | void ASTStmtReader::VisitUnresolvedMemberExpr(UnresolvedMemberExpr *E) { |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1577 | VisitOverloadExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1578 | E->IsArrow = Record.readInt(); |
| 1579 | E->HasUnresolvedUsing = Record.readInt(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1580 | E->Base = Record.readSubExpr(); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1581 | E->BaseType = Record.readType(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1582 | E->OperatorLoc = ReadSourceLocation(); |
Argyrios Kyrtzidis | b8d3c63 | 2010-06-25 09:03:26 +0000 | [diff] [blame] | 1583 | } |
| 1584 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1585 | void ASTStmtReader::VisitUnresolvedLookupExpr(UnresolvedLookupExpr *E) { |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1586 | VisitOverloadExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1587 | E->RequiresADL = Record.readInt(); |
| 1588 | E->Overloaded = Record.readInt(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1589 | E->NamingClass = ReadDeclAs<CXXRecordDecl>(); |
Argyrios Kyrtzidis | 58e01ad | 2010-06-25 09:03:34 +0000 | [diff] [blame] | 1590 | } |
| 1591 | |
Douglas Gregor | 29c42f2 | 2012-02-24 07:38:34 +0000 | [diff] [blame] | 1592 | void ASTStmtReader::VisitTypeTraitExpr(TypeTraitExpr *E) { |
| 1593 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1594 | E->TypeTraitExprBits.NumArgs = Record.readInt(); |
| 1595 | E->TypeTraitExprBits.Kind = Record.readInt(); |
| 1596 | E->TypeTraitExprBits.Value = Record.readInt(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1597 | SourceRange Range = ReadSourceRange(); |
Jordan Rose | 99e80c1 | 2013-12-20 01:26:47 +0000 | [diff] [blame] | 1598 | E->Loc = Range.getBegin(); |
| 1599 | E->RParenLoc = Range.getEnd(); |
| 1600 | |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 1601 | auto **Args = E->getTrailingObjects<TypeSourceInfo *>(); |
Douglas Gregor | 29c42f2 | 2012-02-24 07:38:34 +0000 | [diff] [blame] | 1602 | for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I) |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1603 | Args[I] = GetTypeSourceInfo(); |
Douglas Gregor | 29c42f2 | 2012-02-24 07:38:34 +0000 | [diff] [blame] | 1604 | } |
| 1605 | |
John Wiegley | 6242b6a | 2011-04-28 00:16:57 +0000 | [diff] [blame] | 1606 | void ASTStmtReader::VisitArrayTypeTraitExpr(ArrayTypeTraitExpr *E) { |
| 1607 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1608 | E->ATT = (ArrayTypeTrait)Record.readInt(); |
| 1609 | E->Value = (unsigned int)Record.readInt(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1610 | SourceRange Range = ReadSourceRange(); |
John Wiegley | 6242b6a | 2011-04-28 00:16:57 +0000 | [diff] [blame] | 1611 | E->Loc = Range.getBegin(); |
| 1612 | E->RParen = Range.getEnd(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1613 | E->QueriedType = GetTypeSourceInfo(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1614 | E->Dimension = Record.readSubExpr(); |
John Wiegley | 6242b6a | 2011-04-28 00:16:57 +0000 | [diff] [blame] | 1615 | } |
| 1616 | |
John Wiegley | f9f6584 | 2011-04-25 06:54:41 +0000 | [diff] [blame] | 1617 | void ASTStmtReader::VisitExpressionTraitExpr(ExpressionTraitExpr *E) { |
| 1618 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1619 | E->ET = (ExpressionTrait)Record.readInt(); |
| 1620 | E->Value = (bool)Record.readInt(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1621 | SourceRange Range = ReadSourceRange(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1622 | E->QueriedExpression = Record.readSubExpr(); |
John Wiegley | f9f6584 | 2011-04-25 06:54:41 +0000 | [diff] [blame] | 1623 | E->Loc = Range.getBegin(); |
| 1624 | E->RParen = Range.getEnd(); |
| 1625 | } |
| 1626 | |
Sebastian Redl | 9ac55dd | 2010-09-10 20:55:54 +0000 | [diff] [blame] | 1627 | void ASTStmtReader::VisitCXXNoexceptExpr(CXXNoexceptExpr *E) { |
| 1628 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1629 | E->Value = (bool)Record.readInt(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1630 | E->Range = ReadSourceRange(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1631 | E->Operand = Record.readSubExpr(); |
Sebastian Redl | 9ac55dd | 2010-09-10 20:55:54 +0000 | [diff] [blame] | 1632 | } |
| 1633 | |
Douglas Gregor | e8e9dd6 | 2011-01-03 17:17:50 +0000 | [diff] [blame] | 1634 | void ASTStmtReader::VisitPackExpansionExpr(PackExpansionExpr *E) { |
| 1635 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1636 | E->EllipsisLoc = ReadSourceLocation(); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1637 | E->NumExpansions = Record.readInt(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1638 | E->Pattern = Record.readSubExpr(); |
Douglas Gregor | e8e9dd6 | 2011-01-03 17:17:50 +0000 | [diff] [blame] | 1639 | } |
| 1640 | |
Douglas Gregor | 820ba7b | 2011-01-04 17:33:58 +0000 | [diff] [blame] | 1641 | void ASTStmtReader::VisitSizeOfPackExpr(SizeOfPackExpr *E) { |
| 1642 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1643 | unsigned NumPartialArgs = Record.readInt(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1644 | E->OperatorLoc = ReadSourceLocation(); |
| 1645 | E->PackLoc = ReadSourceLocation(); |
| 1646 | E->RParenLoc = ReadSourceLocation(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1647 | E->Pack = Record.readDeclAs<NamedDecl>(); |
Richard Smith | d784e68 | 2015-09-23 21:41:42 +0000 | [diff] [blame] | 1648 | if (E->isPartiallySubstituted()) { |
| 1649 | assert(E->Length == NumPartialArgs); |
James Y Knight | e00a67e | 2015-12-31 04:18:25 +0000 | [diff] [blame] | 1650 | for (auto *I = E->getTrailingObjects<TemplateArgument>(), |
Richard Smith | d784e68 | 2015-09-23 21:41:42 +0000 | [diff] [blame] | 1651 | *E = I + NumPartialArgs; |
| 1652 | I != E; ++I) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1653 | new (I) TemplateArgument(Record.readTemplateArgument()); |
Richard Smith | d784e68 | 2015-09-23 21:41:42 +0000 | [diff] [blame] | 1654 | } else if (!E->isValueDependent()) { |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1655 | E->Length = Record.readInt(); |
Richard Smith | d784e68 | 2015-09-23 21:41:42 +0000 | [diff] [blame] | 1656 | } |
Douglas Gregor | 820ba7b | 2011-01-04 17:33:58 +0000 | [diff] [blame] | 1657 | } |
| 1658 | |
John McCall | fa19404 | 2011-07-15 07:00:14 +0000 | [diff] [blame] | 1659 | void ASTStmtReader::VisitSubstNonTypeTemplateParmExpr( |
| 1660 | SubstNonTypeTemplateParmExpr *E) { |
| 1661 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1662 | E->Param = ReadDeclAs<NonTypeTemplateParmDecl>(); |
| 1663 | E->NameLoc = ReadSourceLocation(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1664 | E->Replacement = Record.readSubExpr(); |
John McCall | fa19404 | 2011-07-15 07:00:14 +0000 | [diff] [blame] | 1665 | } |
| 1666 | |
Douglas Gregor | cdbc539 | 2011-01-15 01:15:58 +0000 | [diff] [blame] | 1667 | void ASTStmtReader::VisitSubstNonTypeTemplateParmPackExpr( |
| 1668 | SubstNonTypeTemplateParmPackExpr *E) { |
| 1669 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1670 | E->Param = ReadDeclAs<NonTypeTemplateParmDecl>(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1671 | TemplateArgument ArgPack = Record.readTemplateArgument(); |
Douglas Gregor | cdbc539 | 2011-01-15 01:15:58 +0000 | [diff] [blame] | 1672 | if (ArgPack.getKind() != TemplateArgument::Pack) |
| 1673 | return; |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1674 | |
Douglas Gregor | cdbc539 | 2011-01-15 01:15:58 +0000 | [diff] [blame] | 1675 | E->Arguments = ArgPack.pack_begin(); |
| 1676 | E->NumArguments = ArgPack.pack_size(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1677 | E->NameLoc = ReadSourceLocation(); |
Douglas Gregor | cdbc539 | 2011-01-15 01:15:58 +0000 | [diff] [blame] | 1678 | } |
| 1679 | |
Richard Smith | b15fe3a | 2012-09-12 00:56:43 +0000 | [diff] [blame] | 1680 | void ASTStmtReader::VisitFunctionParmPackExpr(FunctionParmPackExpr *E) { |
| 1681 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1682 | E->NumParameters = Record.readInt(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1683 | E->ParamPack = ReadDeclAs<ParmVarDecl>(); |
| 1684 | E->NameLoc = ReadSourceLocation(); |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 1685 | auto **Parms = E->getTrailingObjects<ParmVarDecl *>(); |
Richard Smith | b15fe3a | 2012-09-12 00:56:43 +0000 | [diff] [blame] | 1686 | for (unsigned i = 0, n = E->NumParameters; i != n; ++i) |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1687 | Parms[i] = ReadDeclAs<ParmVarDecl>(); |
Richard Smith | b15fe3a | 2012-09-12 00:56:43 +0000 | [diff] [blame] | 1688 | } |
| 1689 | |
Douglas Gregor | fe31481 | 2011-06-21 17:03:29 +0000 | [diff] [blame] | 1690 | void ASTStmtReader::VisitMaterializeTemporaryExpr(MaterializeTemporaryExpr *E) { |
| 1691 | VisitExpr(E); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1692 | E->State = Record.readSubExpr(); |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 1693 | auto *VD = ReadDeclAs<ValueDecl>(); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1694 | unsigned ManglingNumber = Record.readInt(); |
David Majnemer | daff370 | 2014-05-01 17:50:17 +0000 | [diff] [blame] | 1695 | E->setExtendingDecl(VD, ManglingNumber); |
Douglas Gregor | fe31481 | 2011-06-21 17:03:29 +0000 | [diff] [blame] | 1696 | } |
| 1697 | |
Richard Smith | 0f0af19 | 2014-11-08 05:07:16 +0000 | [diff] [blame] | 1698 | void ASTStmtReader::VisitCXXFoldExpr(CXXFoldExpr *E) { |
| 1699 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1700 | E->LParenLoc = ReadSourceLocation(); |
| 1701 | E->EllipsisLoc = ReadSourceLocation(); |
| 1702 | E->RParenLoc = ReadSourceLocation(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1703 | E->SubExprs[0] = Record.readSubExpr(); |
| 1704 | E->SubExprs[1] = Record.readSubExpr(); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1705 | E->Opcode = (BinaryOperatorKind)Record.readInt(); |
Richard Smith | 0f0af19 | 2014-11-08 05:07:16 +0000 | [diff] [blame] | 1706 | } |
| 1707 | |
John McCall | 8d69a21 | 2010-11-15 23:31:06 +0000 | [diff] [blame] | 1708 | void ASTStmtReader::VisitOpaqueValueExpr(OpaqueValueExpr *E) { |
| 1709 | VisitExpr(E); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1710 | E->SourceExpr = Record.readSubExpr(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1711 | E->Loc = ReadSourceLocation(); |
Akira Hatanaka | 797afe3 | 2018-03-20 01:47:58 +0000 | [diff] [blame] | 1712 | E->setIsUnique(Record.readInt()); |
John McCall | 8d69a21 | 2010-11-15 23:31:06 +0000 | [diff] [blame] | 1713 | } |
| 1714 | |
Kaelyn Takata | e1f49d5 | 2014-10-27 18:07:20 +0000 | [diff] [blame] | 1715 | void ASTStmtReader::VisitTypoExpr(TypoExpr *E) { |
| 1716 | llvm_unreachable("Cannot read TypoExpr nodes"); |
| 1717 | } |
| 1718 | |
Peter Collingbourne | 41f8546 | 2011-02-09 21:07:24 +0000 | [diff] [blame] | 1719 | //===----------------------------------------------------------------------===// |
John McCall | fa19404 | 2011-07-15 07:00:14 +0000 | [diff] [blame] | 1720 | // Microsoft Expressions and Statements |
| 1721 | //===----------------------------------------------------------------------===// |
John McCall | 5e77d76 | 2013-04-16 07:28:30 +0000 | [diff] [blame] | 1722 | void ASTStmtReader::VisitMSPropertyRefExpr(MSPropertyRefExpr *E) { |
| 1723 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1724 | E->IsArrow = (Record.readInt() != 0); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1725 | E->BaseExpr = Record.readSubExpr(); |
| 1726 | E->QualifierLoc = Record.readNestedNameSpecifierLoc(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1727 | E->MemberLoc = ReadSourceLocation(); |
| 1728 | E->TheDecl = ReadDeclAs<MSPropertyDecl>(); |
John McCall | 5e77d76 | 2013-04-16 07:28:30 +0000 | [diff] [blame] | 1729 | } |
| 1730 | |
Alexey Bataev | f763027 | 2015-11-25 12:01:00 +0000 | [diff] [blame] | 1731 | void ASTStmtReader::VisitMSPropertySubscriptExpr(MSPropertySubscriptExpr *E) { |
| 1732 | VisitExpr(E); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1733 | E->setBase(Record.readSubExpr()); |
| 1734 | E->setIdx(Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1735 | E->setRBracketLoc(ReadSourceLocation()); |
Alexey Bataev | f763027 | 2015-11-25 12:01:00 +0000 | [diff] [blame] | 1736 | } |
| 1737 | |
John McCall | fa19404 | 2011-07-15 07:00:14 +0000 | [diff] [blame] | 1738 | void ASTStmtReader::VisitCXXUuidofExpr(CXXUuidofExpr *E) { |
| 1739 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1740 | E->setSourceRange(ReadSourceRange()); |
| 1741 | std::string UuidStr = ReadString(); |
| 1742 | E->setUuidStr(StringRef(UuidStr).copy(Record.getContext())); |
John McCall | fa19404 | 2011-07-15 07:00:14 +0000 | [diff] [blame] | 1743 | if (E->isTypeOperand()) { // __uuidof(ComType) |
| 1744 | E->setTypeOperandSourceInfo( |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1745 | GetTypeSourceInfo()); |
John McCall | fa19404 | 2011-07-15 07:00:14 +0000 | [diff] [blame] | 1746 | return; |
| 1747 | } |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1748 | |
John McCall | fa19404 | 2011-07-15 07:00:14 +0000 | [diff] [blame] | 1749 | // __uuidof(expr) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1750 | E->setExprOperand(Record.readSubExpr()); |
John McCall | fa19404 | 2011-07-15 07:00:14 +0000 | [diff] [blame] | 1751 | } |
| 1752 | |
Nico Weber | 9b98207 | 2014-07-07 00:12:30 +0000 | [diff] [blame] | 1753 | void ASTStmtReader::VisitSEHLeaveStmt(SEHLeaveStmt *S) { |
| 1754 | VisitStmt(S); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1755 | S->setLeaveLoc(ReadSourceLocation()); |
Nico Weber | 9b98207 | 2014-07-07 00:12:30 +0000 | [diff] [blame] | 1756 | } |
| 1757 | |
John McCall | fa19404 | 2011-07-15 07:00:14 +0000 | [diff] [blame] | 1758 | void ASTStmtReader::VisitSEHExceptStmt(SEHExceptStmt *S) { |
| 1759 | VisitStmt(S); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1760 | S->Loc = ReadSourceLocation(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1761 | S->Children[SEHExceptStmt::FILTER_EXPR] = Record.readSubStmt(); |
| 1762 | S->Children[SEHExceptStmt::BLOCK] = Record.readSubStmt(); |
John McCall | fa19404 | 2011-07-15 07:00:14 +0000 | [diff] [blame] | 1763 | } |
| 1764 | |
| 1765 | void ASTStmtReader::VisitSEHFinallyStmt(SEHFinallyStmt *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->Block = Record.readSubStmt(); |
John McCall | fa19404 | 2011-07-15 07:00:14 +0000 | [diff] [blame] | 1769 | } |
| 1770 | |
| 1771 | void ASTStmtReader::VisitSEHTryStmt(SEHTryStmt *S) { |
| 1772 | VisitStmt(S); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1773 | S->IsCXXTry = Record.readInt(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1774 | S->TryLoc = ReadSourceLocation(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1775 | S->Children[SEHTryStmt::TRY] = Record.readSubStmt(); |
| 1776 | S->Children[SEHTryStmt::HANDLER] = Record.readSubStmt(); |
John McCall | fa19404 | 2011-07-15 07:00:14 +0000 | [diff] [blame] | 1777 | } |
| 1778 | |
| 1779 | //===----------------------------------------------------------------------===// |
Peter Collingbourne | 41f8546 | 2011-02-09 21:07:24 +0000 | [diff] [blame] | 1780 | // CUDA Expressions and Statements |
| 1781 | //===----------------------------------------------------------------------===// |
| 1782 | |
| 1783 | void ASTStmtReader::VisitCUDAKernelCallExpr(CUDAKernelCallExpr *E) { |
| 1784 | VisitCallExpr(E); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1785 | E->setConfig(cast<CallExpr>(Record.readSubExpr())); |
Peter Collingbourne | 41f8546 | 2011-02-09 21:07:24 +0000 | [diff] [blame] | 1786 | } |
| 1787 | |
John McCall | fa19404 | 2011-07-15 07:00:14 +0000 | [diff] [blame] | 1788 | //===----------------------------------------------------------------------===// |
| 1789 | // OpenCL Expressions and Statements. |
| 1790 | //===----------------------------------------------------------------------===// |
| 1791 | void ASTStmtReader::VisitAsTypeExpr(AsTypeExpr *E) { |
| 1792 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1793 | E->BuiltinLoc = ReadSourceLocation(); |
| 1794 | E->RParenLoc = ReadSourceLocation(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1795 | E->SrcExpr = Record.readSubExpr(); |
John McCall | fa19404 | 2011-07-15 07:00:14 +0000 | [diff] [blame] | 1796 | } |
| 1797 | |
| 1798 | //===----------------------------------------------------------------------===// |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 1799 | // OpenMP Clauses. |
| 1800 | //===----------------------------------------------------------------------===// |
| 1801 | |
| 1802 | namespace clang { |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 1803 | |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 1804 | class OMPClauseReader : public OMPClauseVisitor<OMPClauseReader> { |
| 1805 | ASTStmtReader *Reader; |
| 1806 | ASTContext &Context; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 1807 | |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 1808 | public: |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1809 | OMPClauseReader(ASTStmtReader *R, ASTRecordReader &Record) |
| 1810 | : Reader(R), Context(Record.getContext()) {} |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 1811 | |
Alexey Bataev | 417089f | 2016-02-17 13:19:37 +0000 | [diff] [blame] | 1812 | #define OPENMP_CLAUSE(Name, Class) void Visit##Class(Class *C); |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 1813 | #include "clang/Basic/OpenMPKinds.def" |
| 1814 | OMPClause *readClause(); |
Alexey Bataev | 3392d76 | 2016-02-16 11:18:12 +0000 | [diff] [blame] | 1815 | void VisitOMPClauseWithPreInit(OMPClauseWithPreInit *C); |
Alexey Bataev | 005248a | 2016-02-25 05:25:57 +0000 | [diff] [blame] | 1816 | void VisitOMPClauseWithPostUpdate(OMPClauseWithPostUpdate *C); |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 1817 | }; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 1818 | |
| 1819 | } // namespace clang |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 1820 | |
| 1821 | OMPClause *OMPClauseReader::readClause() { |
| 1822 | OMPClause *C; |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1823 | switch (Reader->Record.readInt()) { |
Alexey Bataev | aadd52e | 2014-02-13 05:29:23 +0000 | [diff] [blame] | 1824 | case OMPC_if: |
| 1825 | C = new (Context) OMPIfClause(); |
| 1826 | break; |
Alexey Bataev | 3778b60 | 2014-07-17 07:32:53 +0000 | [diff] [blame] | 1827 | case OMPC_final: |
| 1828 | C = new (Context) OMPFinalClause(); |
| 1829 | break; |
Alexey Bataev | 568a833 | 2014-03-06 06:15:19 +0000 | [diff] [blame] | 1830 | case OMPC_num_threads: |
| 1831 | C = new (Context) OMPNumThreadsClause(); |
| 1832 | break; |
Alexey Bataev | 62c87d2 | 2014-03-21 04:51:18 +0000 | [diff] [blame] | 1833 | case OMPC_safelen: |
| 1834 | C = new (Context) OMPSafelenClause(); |
| 1835 | break; |
Alexey Bataev | 66b15b5 | 2015-08-21 11:14:16 +0000 | [diff] [blame] | 1836 | case OMPC_simdlen: |
| 1837 | C = new (Context) OMPSimdlenClause(); |
| 1838 | break; |
Alexander Musman | 8bd31e6 | 2014-05-27 15:12:19 +0000 | [diff] [blame] | 1839 | case OMPC_collapse: |
| 1840 | C = new (Context) OMPCollapseClause(); |
| 1841 | break; |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 1842 | case OMPC_default: |
| 1843 | C = new (Context) OMPDefaultClause(); |
| 1844 | break; |
Alexey Bataev | bcbadb6 | 2014-05-06 06:04:14 +0000 | [diff] [blame] | 1845 | case OMPC_proc_bind: |
| 1846 | C = new (Context) OMPProcBindClause(); |
| 1847 | break; |
Alexey Bataev | 56dafe8 | 2014-06-20 07:16:17 +0000 | [diff] [blame] | 1848 | case OMPC_schedule: |
| 1849 | C = new (Context) OMPScheduleClause(); |
| 1850 | break; |
Alexey Bataev | 142e1fc | 2014-06-20 09:44:06 +0000 | [diff] [blame] | 1851 | case OMPC_ordered: |
| 1852 | C = new (Context) OMPOrderedClause(); |
| 1853 | break; |
Alexey Bataev | 236070f | 2014-06-20 11:19:47 +0000 | [diff] [blame] | 1854 | case OMPC_nowait: |
| 1855 | C = new (Context) OMPNowaitClause(); |
| 1856 | break; |
Alexey Bataev | 7aea99a | 2014-07-17 12:19:31 +0000 | [diff] [blame] | 1857 | case OMPC_untied: |
| 1858 | C = new (Context) OMPUntiedClause(); |
| 1859 | break; |
Alexey Bataev | 74ba3a5 | 2014-07-17 12:47:03 +0000 | [diff] [blame] | 1860 | case OMPC_mergeable: |
| 1861 | C = new (Context) OMPMergeableClause(); |
| 1862 | break; |
Alexey Bataev | f98b00c | 2014-07-23 02:27:21 +0000 | [diff] [blame] | 1863 | case OMPC_read: |
| 1864 | C = new (Context) OMPReadClause(); |
| 1865 | break; |
Alexey Bataev | dea4761 | 2014-07-23 07:46:59 +0000 | [diff] [blame] | 1866 | case OMPC_write: |
| 1867 | C = new (Context) OMPWriteClause(); |
| 1868 | break; |
Alexey Bataev | 67a4f22 | 2014-07-23 10:25:33 +0000 | [diff] [blame] | 1869 | case OMPC_update: |
| 1870 | C = new (Context) OMPUpdateClause(); |
| 1871 | break; |
Alexey Bataev | 459dec0 | 2014-07-24 06:46:57 +0000 | [diff] [blame] | 1872 | case OMPC_capture: |
| 1873 | C = new (Context) OMPCaptureClause(); |
| 1874 | break; |
Alexey Bataev | 82bad8b | 2014-07-24 08:55:34 +0000 | [diff] [blame] | 1875 | case OMPC_seq_cst: |
| 1876 | C = new (Context) OMPSeqCstClause(); |
| 1877 | break; |
Alexey Bataev | 346265e | 2015-09-25 10:37:12 +0000 | [diff] [blame] | 1878 | case OMPC_threads: |
| 1879 | C = new (Context) OMPThreadsClause(); |
| 1880 | break; |
Alexey Bataev | d14d1e6 | 2015-09-28 06:39:35 +0000 | [diff] [blame] | 1881 | case OMPC_simd: |
| 1882 | C = new (Context) OMPSIMDClause(); |
| 1883 | break; |
Alexey Bataev | b825de1 | 2015-12-07 10:51:44 +0000 | [diff] [blame] | 1884 | case OMPC_nogroup: |
| 1885 | C = new (Context) OMPNogroupClause(); |
| 1886 | break; |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 1887 | case OMPC_private: |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1888 | C = OMPPrivateClause::CreateEmpty(Context, Reader->Record.readInt()); |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 1889 | break; |
Alexey Bataev | d5af8e4 | 2013-10-01 05:32:34 +0000 | [diff] [blame] | 1890 | case OMPC_firstprivate: |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1891 | C = OMPFirstprivateClause::CreateEmpty(Context, Reader->Record.readInt()); |
Alexey Bataev | d5af8e4 | 2013-10-01 05:32:34 +0000 | [diff] [blame] | 1892 | break; |
Alexander Musman | 1bb328c | 2014-06-04 13:06:39 +0000 | [diff] [blame] | 1893 | case OMPC_lastprivate: |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1894 | C = OMPLastprivateClause::CreateEmpty(Context, Reader->Record.readInt()); |
Alexander Musman | 1bb328c | 2014-06-04 13:06:39 +0000 | [diff] [blame] | 1895 | break; |
Alexey Bataev | 758e55e | 2013-09-06 18:03:48 +0000 | [diff] [blame] | 1896 | case OMPC_shared: |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1897 | C = OMPSharedClause::CreateEmpty(Context, Reader->Record.readInt()); |
Alexey Bataev | 758e55e | 2013-09-06 18:03:48 +0000 | [diff] [blame] | 1898 | break; |
Alexey Bataev | c5e0258 | 2014-06-16 07:08:35 +0000 | [diff] [blame] | 1899 | case OMPC_reduction: |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1900 | C = OMPReductionClause::CreateEmpty(Context, Reader->Record.readInt()); |
Alexey Bataev | c5e0258 | 2014-06-16 07:08:35 +0000 | [diff] [blame] | 1901 | break; |
Alexey Bataev | 169d96a | 2017-07-18 20:17:46 +0000 | [diff] [blame] | 1902 | case OMPC_task_reduction: |
| 1903 | C = OMPTaskReductionClause::CreateEmpty(Context, Reader->Record.readInt()); |
| 1904 | break; |
Alexey Bataev | fa312f3 | 2017-07-21 18:48:21 +0000 | [diff] [blame] | 1905 | case OMPC_in_reduction: |
| 1906 | C = OMPInReductionClause::CreateEmpty(Context, Reader->Record.readInt()); |
| 1907 | break; |
Alexander Musman | 8dba664 | 2014-04-22 13:09:42 +0000 | [diff] [blame] | 1908 | case OMPC_linear: |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1909 | C = OMPLinearClause::CreateEmpty(Context, Reader->Record.readInt()); |
Alexander Musman | 8dba664 | 2014-04-22 13:09:42 +0000 | [diff] [blame] | 1910 | break; |
Alexander Musman | f0d76e7 | 2014-05-29 14:36:25 +0000 | [diff] [blame] | 1911 | case OMPC_aligned: |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1912 | C = OMPAlignedClause::CreateEmpty(Context, Reader->Record.readInt()); |
Alexander Musman | f0d76e7 | 2014-05-29 14:36:25 +0000 | [diff] [blame] | 1913 | break; |
Alexey Bataev | d48bcd8 | 2014-03-31 03:36:38 +0000 | [diff] [blame] | 1914 | case OMPC_copyin: |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1915 | C = OMPCopyinClause::CreateEmpty(Context, Reader->Record.readInt()); |
Alexey Bataev | d48bcd8 | 2014-03-31 03:36:38 +0000 | [diff] [blame] | 1916 | break; |
Alexey Bataev | bae9a79 | 2014-06-27 10:37:06 +0000 | [diff] [blame] | 1917 | case OMPC_copyprivate: |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1918 | C = OMPCopyprivateClause::CreateEmpty(Context, Reader->Record.readInt()); |
Alexey Bataev | bae9a79 | 2014-06-27 10:37:06 +0000 | [diff] [blame] | 1919 | break; |
Alexey Bataev | 6125da9 | 2014-07-21 11:26:11 +0000 | [diff] [blame] | 1920 | case OMPC_flush: |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1921 | C = OMPFlushClause::CreateEmpty(Context, Reader->Record.readInt()); |
Alexey Bataev | 6125da9 | 2014-07-21 11:26:11 +0000 | [diff] [blame] | 1922 | break; |
Alexey Bataev | 1c2cfbc | 2015-06-23 14:25:19 +0000 | [diff] [blame] | 1923 | case OMPC_depend: |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1924 | C = OMPDependClause::CreateEmpty(Context, Reader->Record.readInt()); |
Alexey Bataev | 1c2cfbc | 2015-06-23 14:25:19 +0000 | [diff] [blame] | 1925 | break; |
Michael Wong | e710d54 | 2015-08-07 16:16:36 +0000 | [diff] [blame] | 1926 | case OMPC_device: |
| 1927 | C = new (Context) OMPDeviceClause(); |
| 1928 | break; |
Samuel Antao | 9092700 | 2016-04-26 14:54:23 +0000 | [diff] [blame] | 1929 | case OMPC_map: { |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1930 | unsigned NumVars = Reader->Record.readInt(); |
| 1931 | unsigned NumDeclarations = Reader->Record.readInt(); |
| 1932 | unsigned NumLists = Reader->Record.readInt(); |
| 1933 | unsigned NumComponents = Reader->Record.readInt(); |
Samuel Antao | 9092700 | 2016-04-26 14:54:23 +0000 | [diff] [blame] | 1934 | C = OMPMapClause::CreateEmpty(Context, NumVars, NumDeclarations, NumLists, |
| 1935 | NumComponents); |
Kelvin Li | 0bff7af | 2015-11-23 05:32:03 +0000 | [diff] [blame] | 1936 | break; |
Samuel Antao | 9092700 | 2016-04-26 14:54:23 +0000 | [diff] [blame] | 1937 | } |
Kelvin Li | 099bb8c | 2015-11-24 20:50:12 +0000 | [diff] [blame] | 1938 | case OMPC_num_teams: |
| 1939 | C = new (Context) OMPNumTeamsClause(); |
| 1940 | break; |
Kelvin Li | a15fb1a | 2015-11-27 18:47:36 +0000 | [diff] [blame] | 1941 | case OMPC_thread_limit: |
| 1942 | C = new (Context) OMPThreadLimitClause(); |
| 1943 | break; |
Alexey Bataev | a056935 | 2015-12-01 10:17:31 +0000 | [diff] [blame] | 1944 | case OMPC_priority: |
| 1945 | C = new (Context) OMPPriorityClause(); |
| 1946 | break; |
Alexey Bataev | 1fd4aed | 2015-12-07 12:52:51 +0000 | [diff] [blame] | 1947 | case OMPC_grainsize: |
| 1948 | C = new (Context) OMPGrainsizeClause(); |
| 1949 | break; |
Alexey Bataev | 382967a | 2015-12-08 12:06:20 +0000 | [diff] [blame] | 1950 | case OMPC_num_tasks: |
| 1951 | C = new (Context) OMPNumTasksClause(); |
| 1952 | break; |
Alexey Bataev | 28c7541 | 2015-12-15 08:19:24 +0000 | [diff] [blame] | 1953 | case OMPC_hint: |
| 1954 | C = new (Context) OMPHintClause(); |
| 1955 | break; |
Carlo Bertolli | b4adf55 | 2016-01-15 18:50:31 +0000 | [diff] [blame] | 1956 | case OMPC_dist_schedule: |
| 1957 | C = new (Context) OMPDistScheduleClause(); |
| 1958 | break; |
Arpith Chacko Jacob | 3cf8904 | 2016-01-26 16:37:23 +0000 | [diff] [blame] | 1959 | case OMPC_defaultmap: |
| 1960 | C = new (Context) OMPDefaultmapClause(); |
| 1961 | break; |
Samuel Antao | 661c090 | 2016-05-26 17:39:58 +0000 | [diff] [blame] | 1962 | case OMPC_to: { |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1963 | unsigned NumVars = Reader->Record.readInt(); |
| 1964 | unsigned NumDeclarations = Reader->Record.readInt(); |
| 1965 | unsigned NumLists = Reader->Record.readInt(); |
| 1966 | unsigned NumComponents = Reader->Record.readInt(); |
Samuel Antao | 661c090 | 2016-05-26 17:39:58 +0000 | [diff] [blame] | 1967 | C = OMPToClause::CreateEmpty(Context, NumVars, NumDeclarations, NumLists, |
| 1968 | NumComponents); |
| 1969 | break; |
| 1970 | } |
Samuel Antao | ec172c6 | 2016-05-26 17:49:04 +0000 | [diff] [blame] | 1971 | case OMPC_from: { |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1972 | unsigned NumVars = Reader->Record.readInt(); |
| 1973 | unsigned NumDeclarations = Reader->Record.readInt(); |
| 1974 | unsigned NumLists = Reader->Record.readInt(); |
| 1975 | unsigned NumComponents = Reader->Record.readInt(); |
Samuel Antao | ec172c6 | 2016-05-26 17:49:04 +0000 | [diff] [blame] | 1976 | C = OMPFromClause::CreateEmpty(Context, NumVars, NumDeclarations, NumLists, |
| 1977 | NumComponents); |
| 1978 | break; |
| 1979 | } |
Samuel Antao | cc10b85 | 2016-07-28 14:23:26 +0000 | [diff] [blame] | 1980 | case OMPC_use_device_ptr: { |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1981 | unsigned NumVars = Reader->Record.readInt(); |
| 1982 | unsigned NumDeclarations = Reader->Record.readInt(); |
| 1983 | unsigned NumLists = Reader->Record.readInt(); |
| 1984 | unsigned NumComponents = Reader->Record.readInt(); |
Samuel Antao | cc10b85 | 2016-07-28 14:23:26 +0000 | [diff] [blame] | 1985 | C = OMPUseDevicePtrClause::CreateEmpty(Context, NumVars, NumDeclarations, |
| 1986 | NumLists, NumComponents); |
Carlo Bertolli | 2404b17 | 2016-07-13 15:37:16 +0000 | [diff] [blame] | 1987 | break; |
Samuel Antao | cc10b85 | 2016-07-28 14:23:26 +0000 | [diff] [blame] | 1988 | } |
Samuel Antao | 6890b09 | 2016-07-28 14:25:09 +0000 | [diff] [blame] | 1989 | case OMPC_is_device_ptr: { |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1990 | unsigned NumVars = Reader->Record.readInt(); |
| 1991 | unsigned NumDeclarations = Reader->Record.readInt(); |
| 1992 | unsigned NumLists = Reader->Record.readInt(); |
| 1993 | unsigned NumComponents = Reader->Record.readInt(); |
Samuel Antao | 6890b09 | 2016-07-28 14:25:09 +0000 | [diff] [blame] | 1994 | C = OMPIsDevicePtrClause::CreateEmpty(Context, NumVars, NumDeclarations, |
| 1995 | NumLists, NumComponents); |
Carlo Bertolli | 70594e9 | 2016-07-13 17:16:49 +0000 | [diff] [blame] | 1996 | break; |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 1997 | } |
Samuel Antao | 6890b09 | 2016-07-28 14:25:09 +0000 | [diff] [blame] | 1998 | } |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 1999 | Visit(C); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2000 | C->setLocStart(Reader->ReadSourceLocation()); |
| 2001 | C->setLocEnd(Reader->ReadSourceLocation()); |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 2002 | |
| 2003 | return C; |
| 2004 | } |
| 2005 | |
Alexey Bataev | 3392d76 | 2016-02-16 11:18:12 +0000 | [diff] [blame] | 2006 | void OMPClauseReader::VisitOMPClauseWithPreInit(OMPClauseWithPreInit *C) { |
Arpith Chacko Jacob | fe4890a | 2017-01-18 20:40:48 +0000 | [diff] [blame] | 2007 | C->setPreInitStmt(Reader->Record.readSubStmt(), |
| 2008 | static_cast<OpenMPDirectiveKind>(Reader->Record.readInt())); |
Alexey Bataev | 3392d76 | 2016-02-16 11:18:12 +0000 | [diff] [blame] | 2009 | } |
| 2010 | |
Alexey Bataev | 005248a | 2016-02-25 05:25:57 +0000 | [diff] [blame] | 2011 | void OMPClauseReader::VisitOMPClauseWithPostUpdate(OMPClauseWithPostUpdate *C) { |
Alexey Bataev | 37e594c | 2016-03-04 07:21:16 +0000 | [diff] [blame] | 2012 | VisitOMPClauseWithPreInit(C); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2013 | C->setPostUpdateExpr(Reader->Record.readSubExpr()); |
Alexey Bataev | 005248a | 2016-02-25 05:25:57 +0000 | [diff] [blame] | 2014 | } |
| 2015 | |
Alexey Bataev | aadd52e | 2014-02-13 05:29:23 +0000 | [diff] [blame] | 2016 | void OMPClauseReader::VisitOMPIfClause(OMPIfClause *C) { |
Arpith Chacko Jacob | fe4890a | 2017-01-18 20:40:48 +0000 | [diff] [blame] | 2017 | VisitOMPClauseWithPreInit(C); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2018 | C->setNameModifier(static_cast<OpenMPDirectiveKind>(Reader->Record.readInt())); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2019 | C->setNameModifierLoc(Reader->ReadSourceLocation()); |
| 2020 | C->setColonLoc(Reader->ReadSourceLocation()); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2021 | C->setCondition(Reader->Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2022 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Alexey Bataev | aadd52e | 2014-02-13 05:29:23 +0000 | [diff] [blame] | 2023 | } |
| 2024 | |
Alexey Bataev | 3778b60 | 2014-07-17 07:32:53 +0000 | [diff] [blame] | 2025 | void OMPClauseReader::VisitOMPFinalClause(OMPFinalClause *C) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2026 | C->setCondition(Reader->Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2027 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Alexey Bataev | 3778b60 | 2014-07-17 07:32:53 +0000 | [diff] [blame] | 2028 | } |
| 2029 | |
Alexey Bataev | 568a833 | 2014-03-06 06:15:19 +0000 | [diff] [blame] | 2030 | void OMPClauseReader::VisitOMPNumThreadsClause(OMPNumThreadsClause *C) { |
Arpith Chacko Jacob | 33c849a | 2017-01-25 00:57:16 +0000 | [diff] [blame] | 2031 | VisitOMPClauseWithPreInit(C); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2032 | C->setNumThreads(Reader->Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2033 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Alexey Bataev | 568a833 | 2014-03-06 06:15:19 +0000 | [diff] [blame] | 2034 | } |
| 2035 | |
Alexey Bataev | 62c87d2 | 2014-03-21 04:51:18 +0000 | [diff] [blame] | 2036 | void OMPClauseReader::VisitOMPSafelenClause(OMPSafelenClause *C) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2037 | C->setSafelen(Reader->Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2038 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Alexey Bataev | 62c87d2 | 2014-03-21 04:51:18 +0000 | [diff] [blame] | 2039 | } |
| 2040 | |
Alexey Bataev | 66b15b5 | 2015-08-21 11:14:16 +0000 | [diff] [blame] | 2041 | void OMPClauseReader::VisitOMPSimdlenClause(OMPSimdlenClause *C) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2042 | C->setSimdlen(Reader->Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2043 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Alexey Bataev | 66b15b5 | 2015-08-21 11:14:16 +0000 | [diff] [blame] | 2044 | } |
| 2045 | |
Alexander Musman | 8bd31e6 | 2014-05-27 15:12:19 +0000 | [diff] [blame] | 2046 | void OMPClauseReader::VisitOMPCollapseClause(OMPCollapseClause *C) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2047 | C->setNumForLoops(Reader->Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2048 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Alexander Musman | 8bd31e6 | 2014-05-27 15:12:19 +0000 | [diff] [blame] | 2049 | } |
| 2050 | |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 2051 | void OMPClauseReader::VisitOMPDefaultClause(OMPDefaultClause *C) { |
| 2052 | C->setDefaultKind( |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2053 | static_cast<OpenMPDefaultClauseKind>(Reader->Record.readInt())); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2054 | C->setLParenLoc(Reader->ReadSourceLocation()); |
| 2055 | C->setDefaultKindKwLoc(Reader->ReadSourceLocation()); |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 2056 | } |
| 2057 | |
Alexey Bataev | bcbadb6 | 2014-05-06 06:04:14 +0000 | [diff] [blame] | 2058 | void OMPClauseReader::VisitOMPProcBindClause(OMPProcBindClause *C) { |
| 2059 | C->setProcBindKind( |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2060 | static_cast<OpenMPProcBindClauseKind>(Reader->Record.readInt())); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2061 | C->setLParenLoc(Reader->ReadSourceLocation()); |
| 2062 | C->setProcBindKindKwLoc(Reader->ReadSourceLocation()); |
Alexey Bataev | bcbadb6 | 2014-05-06 06:04:14 +0000 | [diff] [blame] | 2063 | } |
| 2064 | |
Alexey Bataev | 56dafe8 | 2014-06-20 07:16:17 +0000 | [diff] [blame] | 2065 | void OMPClauseReader::VisitOMPScheduleClause(OMPScheduleClause *C) { |
Alexey Bataev | 3392d76 | 2016-02-16 11:18:12 +0000 | [diff] [blame] | 2066 | VisitOMPClauseWithPreInit(C); |
Alexey Bataev | 56dafe8 | 2014-06-20 07:16:17 +0000 | [diff] [blame] | 2067 | C->setScheduleKind( |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2068 | static_cast<OpenMPScheduleClauseKind>(Reader->Record.readInt())); |
Alexey Bataev | 6402bca | 2015-12-28 07:25:51 +0000 | [diff] [blame] | 2069 | C->setFirstScheduleModifier( |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2070 | static_cast<OpenMPScheduleClauseModifier>(Reader->Record.readInt())); |
Alexey Bataev | 6402bca | 2015-12-28 07:25:51 +0000 | [diff] [blame] | 2071 | C->setSecondScheduleModifier( |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2072 | static_cast<OpenMPScheduleClauseModifier>(Reader->Record.readInt())); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2073 | C->setChunkSize(Reader->Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2074 | C->setLParenLoc(Reader->ReadSourceLocation()); |
| 2075 | C->setFirstScheduleModifierLoc(Reader->ReadSourceLocation()); |
| 2076 | C->setSecondScheduleModifierLoc(Reader->ReadSourceLocation()); |
| 2077 | C->setScheduleKindLoc(Reader->ReadSourceLocation()); |
| 2078 | C->setCommaLoc(Reader->ReadSourceLocation()); |
Alexey Bataev | 56dafe8 | 2014-06-20 07:16:17 +0000 | [diff] [blame] | 2079 | } |
| 2080 | |
Alexey Bataev | 10e775f | 2015-07-30 11:36:16 +0000 | [diff] [blame] | 2081 | void OMPClauseReader::VisitOMPOrderedClause(OMPOrderedClause *C) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2082 | C->setNumForLoops(Reader->Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2083 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Alexey Bataev | 10e775f | 2015-07-30 11:36:16 +0000 | [diff] [blame] | 2084 | } |
Alexey Bataev | 142e1fc | 2014-06-20 09:44:06 +0000 | [diff] [blame] | 2085 | |
Alexey Bataev | 236070f | 2014-06-20 11:19:47 +0000 | [diff] [blame] | 2086 | void OMPClauseReader::VisitOMPNowaitClause(OMPNowaitClause *) {} |
| 2087 | |
Alexey Bataev | 7aea99a | 2014-07-17 12:19:31 +0000 | [diff] [blame] | 2088 | void OMPClauseReader::VisitOMPUntiedClause(OMPUntiedClause *) {} |
| 2089 | |
Alexey Bataev | 74ba3a5 | 2014-07-17 12:47:03 +0000 | [diff] [blame] | 2090 | void OMPClauseReader::VisitOMPMergeableClause(OMPMergeableClause *) {} |
| 2091 | |
Alexey Bataev | f98b00c | 2014-07-23 02:27:21 +0000 | [diff] [blame] | 2092 | void OMPClauseReader::VisitOMPReadClause(OMPReadClause *) {} |
| 2093 | |
Alexey Bataev | dea4761 | 2014-07-23 07:46:59 +0000 | [diff] [blame] | 2094 | void OMPClauseReader::VisitOMPWriteClause(OMPWriteClause *) {} |
| 2095 | |
Alexey Bataev | 67a4f22 | 2014-07-23 10:25:33 +0000 | [diff] [blame] | 2096 | void OMPClauseReader::VisitOMPUpdateClause(OMPUpdateClause *) {} |
| 2097 | |
Alexey Bataev | 459dec0 | 2014-07-24 06:46:57 +0000 | [diff] [blame] | 2098 | void OMPClauseReader::VisitOMPCaptureClause(OMPCaptureClause *) {} |
| 2099 | |
Alexey Bataev | 82bad8b | 2014-07-24 08:55:34 +0000 | [diff] [blame] | 2100 | void OMPClauseReader::VisitOMPSeqCstClause(OMPSeqCstClause *) {} |
| 2101 | |
Alexey Bataev | 346265e | 2015-09-25 10:37:12 +0000 | [diff] [blame] | 2102 | void OMPClauseReader::VisitOMPThreadsClause(OMPThreadsClause *) {} |
| 2103 | |
Alexey Bataev | d14d1e6 | 2015-09-28 06:39:35 +0000 | [diff] [blame] | 2104 | void OMPClauseReader::VisitOMPSIMDClause(OMPSIMDClause *) {} |
| 2105 | |
Alexey Bataev | b825de1 | 2015-12-07 10:51:44 +0000 | [diff] [blame] | 2106 | void OMPClauseReader::VisitOMPNogroupClause(OMPNogroupClause *) {} |
| 2107 | |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 2108 | void OMPClauseReader::VisitOMPPrivateClause(OMPPrivateClause *C) { |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2109 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 2110 | unsigned NumVars = C->varlist_size(); |
| 2111 | SmallVector<Expr *, 16> Vars; |
| 2112 | Vars.reserve(NumVars); |
| 2113 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2114 | Vars.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 2115 | C->setVarRefs(Vars); |
Alexey Bataev | 03b340a | 2014-10-21 03:16:40 +0000 | [diff] [blame] | 2116 | Vars.clear(); |
| 2117 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2118 | Vars.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | 03b340a | 2014-10-21 03:16:40 +0000 | [diff] [blame] | 2119 | C->setPrivateCopies(Vars); |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 2120 | } |
| 2121 | |
Alexey Bataev | d5af8e4 | 2013-10-01 05:32:34 +0000 | [diff] [blame] | 2122 | void OMPClauseReader::VisitOMPFirstprivateClause(OMPFirstprivateClause *C) { |
Alexey Bataev | 417089f | 2016-02-17 13:19:37 +0000 | [diff] [blame] | 2123 | VisitOMPClauseWithPreInit(C); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2124 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Alexey Bataev | d5af8e4 | 2013-10-01 05:32:34 +0000 | [diff] [blame] | 2125 | unsigned NumVars = C->varlist_size(); |
| 2126 | SmallVector<Expr *, 16> Vars; |
| 2127 | Vars.reserve(NumVars); |
| 2128 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2129 | Vars.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | d5af8e4 | 2013-10-01 05:32:34 +0000 | [diff] [blame] | 2130 | C->setVarRefs(Vars); |
Alexey Bataev | 4a5bb77 | 2014-10-08 14:01:46 +0000 | [diff] [blame] | 2131 | Vars.clear(); |
| 2132 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2133 | Vars.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | 4a5bb77 | 2014-10-08 14:01:46 +0000 | [diff] [blame] | 2134 | C->setPrivateCopies(Vars); |
| 2135 | Vars.clear(); |
| 2136 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2137 | Vars.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | 4a5bb77 | 2014-10-08 14:01:46 +0000 | [diff] [blame] | 2138 | C->setInits(Vars); |
Alexey Bataev | d5af8e4 | 2013-10-01 05:32:34 +0000 | [diff] [blame] | 2139 | } |
| 2140 | |
Alexander Musman | 1bb328c | 2014-06-04 13:06:39 +0000 | [diff] [blame] | 2141 | void OMPClauseReader::VisitOMPLastprivateClause(OMPLastprivateClause *C) { |
Alexey Bataev | 005248a | 2016-02-25 05:25:57 +0000 | [diff] [blame] | 2142 | VisitOMPClauseWithPostUpdate(C); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2143 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Alexander Musman | 1bb328c | 2014-06-04 13:06:39 +0000 | [diff] [blame] | 2144 | unsigned NumVars = C->varlist_size(); |
| 2145 | SmallVector<Expr *, 16> Vars; |
| 2146 | Vars.reserve(NumVars); |
| 2147 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2148 | Vars.push_back(Reader->Record.readSubExpr()); |
Alexander Musman | 1bb328c | 2014-06-04 13:06:39 +0000 | [diff] [blame] | 2149 | C->setVarRefs(Vars); |
Alexey Bataev | 38e8953 | 2015-04-16 04:54:05 +0000 | [diff] [blame] | 2150 | Vars.clear(); |
| 2151 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2152 | Vars.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | 38e8953 | 2015-04-16 04:54:05 +0000 | [diff] [blame] | 2153 | C->setPrivateCopies(Vars); |
| 2154 | Vars.clear(); |
| 2155 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2156 | Vars.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | 38e8953 | 2015-04-16 04:54:05 +0000 | [diff] [blame] | 2157 | C->setSourceExprs(Vars); |
| 2158 | Vars.clear(); |
| 2159 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2160 | Vars.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | 38e8953 | 2015-04-16 04:54:05 +0000 | [diff] [blame] | 2161 | C->setDestinationExprs(Vars); |
| 2162 | Vars.clear(); |
| 2163 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2164 | Vars.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | 38e8953 | 2015-04-16 04:54:05 +0000 | [diff] [blame] | 2165 | C->setAssignmentOps(Vars); |
Alexander Musman | 1bb328c | 2014-06-04 13:06:39 +0000 | [diff] [blame] | 2166 | } |
| 2167 | |
Alexey Bataev | 758e55e | 2013-09-06 18:03:48 +0000 | [diff] [blame] | 2168 | void OMPClauseReader::VisitOMPSharedClause(OMPSharedClause *C) { |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2169 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Alexey Bataev | 758e55e | 2013-09-06 18:03:48 +0000 | [diff] [blame] | 2170 | unsigned NumVars = C->varlist_size(); |
| 2171 | SmallVector<Expr *, 16> Vars; |
| 2172 | Vars.reserve(NumVars); |
| 2173 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2174 | Vars.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | 758e55e | 2013-09-06 18:03:48 +0000 | [diff] [blame] | 2175 | C->setVarRefs(Vars); |
| 2176 | } |
| 2177 | |
Alexey Bataev | c5e0258 | 2014-06-16 07:08:35 +0000 | [diff] [blame] | 2178 | void OMPClauseReader::VisitOMPReductionClause(OMPReductionClause *C) { |
Alexey Bataev | 6120507 | 2016-03-02 04:57:40 +0000 | [diff] [blame] | 2179 | VisitOMPClauseWithPostUpdate(C); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2180 | C->setLParenLoc(Reader->ReadSourceLocation()); |
| 2181 | C->setColonLoc(Reader->ReadSourceLocation()); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2182 | NestedNameSpecifierLoc NNSL = Reader->Record.readNestedNameSpecifierLoc(); |
Alexey Bataev | c5e0258 | 2014-06-16 07:08:35 +0000 | [diff] [blame] | 2183 | DeclarationNameInfo DNI; |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2184 | Reader->ReadDeclarationNameInfo(DNI); |
Alexey Bataev | c5e0258 | 2014-06-16 07:08:35 +0000 | [diff] [blame] | 2185 | C->setQualifierLoc(NNSL); |
| 2186 | C->setNameInfo(DNI); |
| 2187 | |
| 2188 | unsigned NumVars = C->varlist_size(); |
| 2189 | SmallVector<Expr *, 16> Vars; |
| 2190 | Vars.reserve(NumVars); |
| 2191 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2192 | Vars.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | c5e0258 | 2014-06-16 07:08:35 +0000 | [diff] [blame] | 2193 | C->setVarRefs(Vars); |
Alexey Bataev | 794ba0d | 2015-04-10 10:43:45 +0000 | [diff] [blame] | 2194 | Vars.clear(); |
| 2195 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2196 | Vars.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | f24e7b1 | 2015-10-08 09:10:53 +0000 | [diff] [blame] | 2197 | C->setPrivates(Vars); |
| 2198 | Vars.clear(); |
| 2199 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2200 | Vars.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | 794ba0d | 2015-04-10 10:43:45 +0000 | [diff] [blame] | 2201 | C->setLHSExprs(Vars); |
| 2202 | Vars.clear(); |
| 2203 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2204 | Vars.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | 794ba0d | 2015-04-10 10:43:45 +0000 | [diff] [blame] | 2205 | C->setRHSExprs(Vars); |
| 2206 | Vars.clear(); |
| 2207 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2208 | Vars.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | 794ba0d | 2015-04-10 10:43:45 +0000 | [diff] [blame] | 2209 | C->setReductionOps(Vars); |
Alexey Bataev | c5e0258 | 2014-06-16 07:08:35 +0000 | [diff] [blame] | 2210 | } |
| 2211 | |
Alexey Bataev | 169d96a | 2017-07-18 20:17:46 +0000 | [diff] [blame] | 2212 | void OMPClauseReader::VisitOMPTaskReductionClause(OMPTaskReductionClause *C) { |
| 2213 | VisitOMPClauseWithPostUpdate(C); |
| 2214 | C->setLParenLoc(Reader->ReadSourceLocation()); |
| 2215 | C->setColonLoc(Reader->ReadSourceLocation()); |
| 2216 | NestedNameSpecifierLoc NNSL = Reader->Record.readNestedNameSpecifierLoc(); |
| 2217 | DeclarationNameInfo DNI; |
| 2218 | Reader->ReadDeclarationNameInfo(DNI); |
| 2219 | C->setQualifierLoc(NNSL); |
| 2220 | C->setNameInfo(DNI); |
| 2221 | |
| 2222 | unsigned NumVars = C->varlist_size(); |
| 2223 | SmallVector<Expr *, 16> Vars; |
| 2224 | Vars.reserve(NumVars); |
| 2225 | for (unsigned I = 0; I != NumVars; ++I) |
| 2226 | Vars.push_back(Reader->Record.readSubExpr()); |
| 2227 | C->setVarRefs(Vars); |
| 2228 | Vars.clear(); |
| 2229 | for (unsigned I = 0; I != NumVars; ++I) |
| 2230 | Vars.push_back(Reader->Record.readSubExpr()); |
| 2231 | C->setPrivates(Vars); |
| 2232 | Vars.clear(); |
| 2233 | for (unsigned I = 0; I != NumVars; ++I) |
| 2234 | Vars.push_back(Reader->Record.readSubExpr()); |
| 2235 | C->setLHSExprs(Vars); |
| 2236 | Vars.clear(); |
| 2237 | for (unsigned I = 0; I != NumVars; ++I) |
| 2238 | Vars.push_back(Reader->Record.readSubExpr()); |
| 2239 | C->setRHSExprs(Vars); |
| 2240 | Vars.clear(); |
| 2241 | for (unsigned I = 0; I != NumVars; ++I) |
| 2242 | Vars.push_back(Reader->Record.readSubExpr()); |
| 2243 | C->setReductionOps(Vars); |
| 2244 | } |
| 2245 | |
Alexey Bataev | fa312f3 | 2017-07-21 18:48:21 +0000 | [diff] [blame] | 2246 | void OMPClauseReader::VisitOMPInReductionClause(OMPInReductionClause *C) { |
| 2247 | VisitOMPClauseWithPostUpdate(C); |
| 2248 | C->setLParenLoc(Reader->ReadSourceLocation()); |
| 2249 | C->setColonLoc(Reader->ReadSourceLocation()); |
| 2250 | NestedNameSpecifierLoc NNSL = Reader->Record.readNestedNameSpecifierLoc(); |
| 2251 | DeclarationNameInfo DNI; |
| 2252 | Reader->ReadDeclarationNameInfo(DNI); |
| 2253 | C->setQualifierLoc(NNSL); |
| 2254 | C->setNameInfo(DNI); |
| 2255 | |
| 2256 | unsigned NumVars = C->varlist_size(); |
| 2257 | SmallVector<Expr *, 16> Vars; |
| 2258 | Vars.reserve(NumVars); |
| 2259 | for (unsigned I = 0; I != NumVars; ++I) |
| 2260 | Vars.push_back(Reader->Record.readSubExpr()); |
| 2261 | C->setVarRefs(Vars); |
| 2262 | Vars.clear(); |
| 2263 | for (unsigned I = 0; I != NumVars; ++I) |
| 2264 | Vars.push_back(Reader->Record.readSubExpr()); |
| 2265 | C->setPrivates(Vars); |
| 2266 | Vars.clear(); |
| 2267 | for (unsigned I = 0; I != NumVars; ++I) |
| 2268 | Vars.push_back(Reader->Record.readSubExpr()); |
| 2269 | C->setLHSExprs(Vars); |
| 2270 | Vars.clear(); |
| 2271 | for (unsigned I = 0; I != NumVars; ++I) |
| 2272 | Vars.push_back(Reader->Record.readSubExpr()); |
| 2273 | C->setRHSExprs(Vars); |
| 2274 | Vars.clear(); |
| 2275 | for (unsigned I = 0; I != NumVars; ++I) |
| 2276 | Vars.push_back(Reader->Record.readSubExpr()); |
| 2277 | C->setReductionOps(Vars); |
Alexey Bataev | 88202be | 2017-07-27 13:20:36 +0000 | [diff] [blame] | 2278 | Vars.clear(); |
| 2279 | for (unsigned I = 0; I != NumVars; ++I) |
| 2280 | Vars.push_back(Reader->Record.readSubExpr()); |
| 2281 | C->setTaskgroupDescriptors(Vars); |
Alexey Bataev | fa312f3 | 2017-07-21 18:48:21 +0000 | [diff] [blame] | 2282 | } |
| 2283 | |
Alexander Musman | 8dba664 | 2014-04-22 13:09:42 +0000 | [diff] [blame] | 2284 | void OMPClauseReader::VisitOMPLinearClause(OMPLinearClause *C) { |
Alexey Bataev | 78849fb | 2016-03-09 09:49:00 +0000 | [diff] [blame] | 2285 | VisitOMPClauseWithPostUpdate(C); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2286 | C->setLParenLoc(Reader->ReadSourceLocation()); |
| 2287 | C->setColonLoc(Reader->ReadSourceLocation()); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2288 | C->setModifier(static_cast<OpenMPLinearClauseKind>(Reader->Record.readInt())); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2289 | C->setModifierLoc(Reader->ReadSourceLocation()); |
Alexander Musman | 8dba664 | 2014-04-22 13:09:42 +0000 | [diff] [blame] | 2290 | unsigned NumVars = C->varlist_size(); |
| 2291 | SmallVector<Expr *, 16> Vars; |
| 2292 | Vars.reserve(NumVars); |
| 2293 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2294 | Vars.push_back(Reader->Record.readSubExpr()); |
Alexander Musman | 8dba664 | 2014-04-22 13:09:42 +0000 | [diff] [blame] | 2295 | C->setVarRefs(Vars); |
Alexander Musman | 3276a27 | 2015-03-21 10:12:56 +0000 | [diff] [blame] | 2296 | Vars.clear(); |
| 2297 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2298 | Vars.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | bd9fec1 | 2015-08-18 06:47:21 +0000 | [diff] [blame] | 2299 | C->setPrivates(Vars); |
| 2300 | Vars.clear(); |
| 2301 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2302 | Vars.push_back(Reader->Record.readSubExpr()); |
Alexander Musman | 3276a27 | 2015-03-21 10:12:56 +0000 | [diff] [blame] | 2303 | C->setInits(Vars); |
| 2304 | Vars.clear(); |
| 2305 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2306 | Vars.push_back(Reader->Record.readSubExpr()); |
Alexander Musman | 3276a27 | 2015-03-21 10:12:56 +0000 | [diff] [blame] | 2307 | C->setUpdates(Vars); |
| 2308 | Vars.clear(); |
| 2309 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2310 | Vars.push_back(Reader->Record.readSubExpr()); |
Alexander Musman | 3276a27 | 2015-03-21 10:12:56 +0000 | [diff] [blame] | 2311 | C->setFinals(Vars); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2312 | C->setStep(Reader->Record.readSubExpr()); |
| 2313 | C->setCalcStep(Reader->Record.readSubExpr()); |
Alexander Musman | 8dba664 | 2014-04-22 13:09:42 +0000 | [diff] [blame] | 2314 | } |
| 2315 | |
Alexander Musman | f0d76e7 | 2014-05-29 14:36:25 +0000 | [diff] [blame] | 2316 | void OMPClauseReader::VisitOMPAlignedClause(OMPAlignedClause *C) { |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2317 | C->setLParenLoc(Reader->ReadSourceLocation()); |
| 2318 | C->setColonLoc(Reader->ReadSourceLocation()); |
Alexander Musman | f0d76e7 | 2014-05-29 14:36:25 +0000 | [diff] [blame] | 2319 | unsigned NumVars = C->varlist_size(); |
| 2320 | SmallVector<Expr *, 16> Vars; |
| 2321 | Vars.reserve(NumVars); |
| 2322 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2323 | Vars.push_back(Reader->Record.readSubExpr()); |
Alexander Musman | f0d76e7 | 2014-05-29 14:36:25 +0000 | [diff] [blame] | 2324 | C->setVarRefs(Vars); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2325 | C->setAlignment(Reader->Record.readSubExpr()); |
Alexander Musman | f0d76e7 | 2014-05-29 14:36:25 +0000 | [diff] [blame] | 2326 | } |
| 2327 | |
Alexey Bataev | d48bcd8 | 2014-03-31 03:36:38 +0000 | [diff] [blame] | 2328 | void OMPClauseReader::VisitOMPCopyinClause(OMPCopyinClause *C) { |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2329 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Alexey Bataev | d48bcd8 | 2014-03-31 03:36:38 +0000 | [diff] [blame] | 2330 | unsigned NumVars = C->varlist_size(); |
Alexey Bataev | f56f98c | 2015-04-16 05:39:01 +0000 | [diff] [blame] | 2331 | SmallVector<Expr *, 16> Exprs; |
| 2332 | Exprs.reserve(NumVars); |
Alexey Bataev | d48bcd8 | 2014-03-31 03:36:38 +0000 | [diff] [blame] | 2333 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2334 | Exprs.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | f56f98c | 2015-04-16 05:39:01 +0000 | [diff] [blame] | 2335 | C->setVarRefs(Exprs); |
| 2336 | Exprs.clear(); |
| 2337 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2338 | Exprs.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | f56f98c | 2015-04-16 05:39:01 +0000 | [diff] [blame] | 2339 | C->setSourceExprs(Exprs); |
| 2340 | Exprs.clear(); |
| 2341 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2342 | Exprs.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | f56f98c | 2015-04-16 05:39:01 +0000 | [diff] [blame] | 2343 | C->setDestinationExprs(Exprs); |
| 2344 | Exprs.clear(); |
| 2345 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2346 | Exprs.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | f56f98c | 2015-04-16 05:39:01 +0000 | [diff] [blame] | 2347 | C->setAssignmentOps(Exprs); |
Alexey Bataev | d48bcd8 | 2014-03-31 03:36:38 +0000 | [diff] [blame] | 2348 | } |
| 2349 | |
Alexey Bataev | bae9a79 | 2014-06-27 10:37:06 +0000 | [diff] [blame] | 2350 | void OMPClauseReader::VisitOMPCopyprivateClause(OMPCopyprivateClause *C) { |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2351 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Alexey Bataev | bae9a79 | 2014-06-27 10:37:06 +0000 | [diff] [blame] | 2352 | unsigned NumVars = C->varlist_size(); |
Alexey Bataev | a63048e | 2015-03-23 06:18:07 +0000 | [diff] [blame] | 2353 | SmallVector<Expr *, 16> Exprs; |
| 2354 | Exprs.reserve(NumVars); |
Alexey Bataev | bae9a79 | 2014-06-27 10:37:06 +0000 | [diff] [blame] | 2355 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2356 | Exprs.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | a63048e | 2015-03-23 06:18:07 +0000 | [diff] [blame] | 2357 | C->setVarRefs(Exprs); |
| 2358 | Exprs.clear(); |
| 2359 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2360 | Exprs.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | a63048e | 2015-03-23 06:18:07 +0000 | [diff] [blame] | 2361 | C->setSourceExprs(Exprs); |
| 2362 | Exprs.clear(); |
| 2363 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2364 | Exprs.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | a63048e | 2015-03-23 06:18:07 +0000 | [diff] [blame] | 2365 | C->setDestinationExprs(Exprs); |
| 2366 | Exprs.clear(); |
| 2367 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2368 | Exprs.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | a63048e | 2015-03-23 06:18:07 +0000 | [diff] [blame] | 2369 | C->setAssignmentOps(Exprs); |
Alexey Bataev | bae9a79 | 2014-06-27 10:37:06 +0000 | [diff] [blame] | 2370 | } |
| 2371 | |
Alexey Bataev | 6125da9 | 2014-07-21 11:26:11 +0000 | [diff] [blame] | 2372 | void OMPClauseReader::VisitOMPFlushClause(OMPFlushClause *C) { |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2373 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Alexey Bataev | 6125da9 | 2014-07-21 11:26:11 +0000 | [diff] [blame] | 2374 | unsigned NumVars = C->varlist_size(); |
| 2375 | SmallVector<Expr *, 16> Vars; |
| 2376 | Vars.reserve(NumVars); |
| 2377 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2378 | Vars.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | 6125da9 | 2014-07-21 11:26:11 +0000 | [diff] [blame] | 2379 | C->setVarRefs(Vars); |
| 2380 | } |
| 2381 | |
Alexey Bataev | 1c2cfbc | 2015-06-23 14:25:19 +0000 | [diff] [blame] | 2382 | void OMPClauseReader::VisitOMPDependClause(OMPDependClause *C) { |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2383 | C->setLParenLoc(Reader->ReadSourceLocation()); |
| 2384 | C->setDependencyKind( |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2385 | static_cast<OpenMPDependClauseKind>(Reader->Record.readInt())); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2386 | C->setDependencyLoc(Reader->ReadSourceLocation()); |
| 2387 | C->setColonLoc(Reader->ReadSourceLocation()); |
Alexey Bataev | 1c2cfbc | 2015-06-23 14:25:19 +0000 | [diff] [blame] | 2388 | unsigned NumVars = C->varlist_size(); |
| 2389 | SmallVector<Expr *, 16> Vars; |
| 2390 | Vars.reserve(NumVars); |
| 2391 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2392 | Vars.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | 1c2cfbc | 2015-06-23 14:25:19 +0000 | [diff] [blame] | 2393 | C->setVarRefs(Vars); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2394 | C->setCounterValue(Reader->Record.readSubExpr()); |
Alexey Bataev | 1c2cfbc | 2015-06-23 14:25:19 +0000 | [diff] [blame] | 2395 | } |
| 2396 | |
Michael Wong | e710d54 | 2015-08-07 16:16:36 +0000 | [diff] [blame] | 2397 | void OMPClauseReader::VisitOMPDeviceClause(OMPDeviceClause *C) { |
Alexey Bataev | 931e19b | 2017-10-02 16:32:39 +0000 | [diff] [blame] | 2398 | VisitOMPClauseWithPreInit(C); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2399 | C->setDevice(Reader->Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2400 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Michael Wong | e710d54 | 2015-08-07 16:16:36 +0000 | [diff] [blame] | 2401 | } |
| 2402 | |
Kelvin Li | 0bff7af | 2015-11-23 05:32:03 +0000 | [diff] [blame] | 2403 | void OMPClauseReader::VisitOMPMapClause(OMPMapClause *C) { |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2404 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Kelvin Li | 0bff7af | 2015-11-23 05:32:03 +0000 | [diff] [blame] | 2405 | C->setMapTypeModifier( |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2406 | static_cast<OpenMPMapClauseKind>(Reader->Record.readInt())); |
Kelvin Li | 0bff7af | 2015-11-23 05:32:03 +0000 | [diff] [blame] | 2407 | C->setMapType( |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2408 | static_cast<OpenMPMapClauseKind>(Reader->Record.readInt())); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2409 | C->setMapLoc(Reader->ReadSourceLocation()); |
| 2410 | C->setColonLoc(Reader->ReadSourceLocation()); |
Kelvin Li | 0bff7af | 2015-11-23 05:32:03 +0000 | [diff] [blame] | 2411 | auto NumVars = C->varlist_size(); |
Samuel Antao | 9092700 | 2016-04-26 14:54:23 +0000 | [diff] [blame] | 2412 | auto UniqueDecls = C->getUniqueDeclarationsNum(); |
| 2413 | auto TotalLists = C->getTotalComponentListNum(); |
| 2414 | auto TotalComponents = C->getTotalComponentsNum(); |
| 2415 | |
Kelvin Li | 0bff7af | 2015-11-23 05:32:03 +0000 | [diff] [blame] | 2416 | SmallVector<Expr *, 16> Vars; |
| 2417 | Vars.reserve(NumVars); |
Samuel Antao | 9092700 | 2016-04-26 14:54:23 +0000 | [diff] [blame] | 2418 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2419 | Vars.push_back(Reader->Record.readSubExpr()); |
Kelvin Li | 0bff7af | 2015-11-23 05:32:03 +0000 | [diff] [blame] | 2420 | C->setVarRefs(Vars); |
Samuel Antao | 9092700 | 2016-04-26 14:54:23 +0000 | [diff] [blame] | 2421 | |
| 2422 | SmallVector<ValueDecl *, 16> Decls; |
| 2423 | Decls.reserve(UniqueDecls); |
| 2424 | for (unsigned i = 0; i < UniqueDecls; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2425 | Decls.push_back(Reader->Record.readDeclAs<ValueDecl>()); |
Samuel Antao | 9092700 | 2016-04-26 14:54:23 +0000 | [diff] [blame] | 2426 | C->setUniqueDecls(Decls); |
| 2427 | |
| 2428 | SmallVector<unsigned, 16> ListsPerDecl; |
| 2429 | ListsPerDecl.reserve(UniqueDecls); |
| 2430 | for (unsigned i = 0; i < UniqueDecls; ++i) |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2431 | ListsPerDecl.push_back(Reader->Record.readInt()); |
Samuel Antao | 9092700 | 2016-04-26 14:54:23 +0000 | [diff] [blame] | 2432 | C->setDeclNumLists(ListsPerDecl); |
| 2433 | |
| 2434 | SmallVector<unsigned, 32> ListSizes; |
| 2435 | ListSizes.reserve(TotalLists); |
| 2436 | for (unsigned i = 0; i < TotalLists; ++i) |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2437 | ListSizes.push_back(Reader->Record.readInt()); |
Samuel Antao | 9092700 | 2016-04-26 14:54:23 +0000 | [diff] [blame] | 2438 | C->setComponentListSizes(ListSizes); |
| 2439 | |
| 2440 | SmallVector<OMPClauseMappableExprCommon::MappableComponent, 32> Components; |
| 2441 | Components.reserve(TotalComponents); |
| 2442 | for (unsigned i = 0; i < TotalComponents; ++i) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2443 | Expr *AssociatedExpr = Reader->Record.readSubExpr(); |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 2444 | auto *AssociatedDecl = Reader->Record.readDeclAs<ValueDecl>(); |
Samuel Antao | 9092700 | 2016-04-26 14:54:23 +0000 | [diff] [blame] | 2445 | Components.push_back(OMPClauseMappableExprCommon::MappableComponent( |
| 2446 | AssociatedExpr, AssociatedDecl)); |
| 2447 | } |
| 2448 | C->setComponents(Components, ListSizes); |
Kelvin Li | 0bff7af | 2015-11-23 05:32:03 +0000 | [diff] [blame] | 2449 | } |
| 2450 | |
Kelvin Li | 099bb8c | 2015-11-24 20:50:12 +0000 | [diff] [blame] | 2451 | void OMPClauseReader::VisitOMPNumTeamsClause(OMPNumTeamsClause *C) { |
Arpith Chacko Jacob | bc12634 | 2017-01-25 11:28:18 +0000 | [diff] [blame] | 2452 | VisitOMPClauseWithPreInit(C); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2453 | C->setNumTeams(Reader->Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2454 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Kelvin Li | 099bb8c | 2015-11-24 20:50:12 +0000 | [diff] [blame] | 2455 | } |
| 2456 | |
Kelvin Li | a15fb1a | 2015-11-27 18:47:36 +0000 | [diff] [blame] | 2457 | void OMPClauseReader::VisitOMPThreadLimitClause(OMPThreadLimitClause *C) { |
Arpith Chacko Jacob | 7ecc0b7 | 2017-01-25 11:44:35 +0000 | [diff] [blame] | 2458 | VisitOMPClauseWithPreInit(C); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2459 | C->setThreadLimit(Reader->Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2460 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Kelvin Li | a15fb1a | 2015-11-27 18:47:36 +0000 | [diff] [blame] | 2461 | } |
| 2462 | |
Alexey Bataev | a056935 | 2015-12-01 10:17:31 +0000 | [diff] [blame] | 2463 | void OMPClauseReader::VisitOMPPriorityClause(OMPPriorityClause *C) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2464 | C->setPriority(Reader->Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2465 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Alexey Bataev | a056935 | 2015-12-01 10:17:31 +0000 | [diff] [blame] | 2466 | } |
| 2467 | |
Alexey Bataev | 1fd4aed | 2015-12-07 12:52:51 +0000 | [diff] [blame] | 2468 | void OMPClauseReader::VisitOMPGrainsizeClause(OMPGrainsizeClause *C) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2469 | C->setGrainsize(Reader->Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2470 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Alexey Bataev | 1fd4aed | 2015-12-07 12:52:51 +0000 | [diff] [blame] | 2471 | } |
| 2472 | |
Alexey Bataev | 382967a | 2015-12-08 12:06:20 +0000 | [diff] [blame] | 2473 | void OMPClauseReader::VisitOMPNumTasksClause(OMPNumTasksClause *C) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2474 | C->setNumTasks(Reader->Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2475 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Alexey Bataev | 382967a | 2015-12-08 12:06:20 +0000 | [diff] [blame] | 2476 | } |
| 2477 | |
Alexey Bataev | 28c7541 | 2015-12-15 08:19:24 +0000 | [diff] [blame] | 2478 | void OMPClauseReader::VisitOMPHintClause(OMPHintClause *C) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2479 | C->setHint(Reader->Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2480 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Alexey Bataev | 28c7541 | 2015-12-15 08:19:24 +0000 | [diff] [blame] | 2481 | } |
| 2482 | |
Carlo Bertolli | b4adf55 | 2016-01-15 18:50:31 +0000 | [diff] [blame] | 2483 | void OMPClauseReader::VisitOMPDistScheduleClause(OMPDistScheduleClause *C) { |
Alexey Bataev | 3392d76 | 2016-02-16 11:18:12 +0000 | [diff] [blame] | 2484 | VisitOMPClauseWithPreInit(C); |
Carlo Bertolli | b4adf55 | 2016-01-15 18:50:31 +0000 | [diff] [blame] | 2485 | C->setDistScheduleKind( |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2486 | static_cast<OpenMPDistScheduleClauseKind>(Reader->Record.readInt())); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2487 | C->setChunkSize(Reader->Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2488 | C->setLParenLoc(Reader->ReadSourceLocation()); |
| 2489 | C->setDistScheduleKindLoc(Reader->ReadSourceLocation()); |
| 2490 | C->setCommaLoc(Reader->ReadSourceLocation()); |
Carlo Bertolli | b4adf55 | 2016-01-15 18:50:31 +0000 | [diff] [blame] | 2491 | } |
| 2492 | |
Arpith Chacko Jacob | 3cf8904 | 2016-01-26 16:37:23 +0000 | [diff] [blame] | 2493 | void OMPClauseReader::VisitOMPDefaultmapClause(OMPDefaultmapClause *C) { |
| 2494 | C->setDefaultmapKind( |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2495 | static_cast<OpenMPDefaultmapClauseKind>(Reader->Record.readInt())); |
Arpith Chacko Jacob | 3cf8904 | 2016-01-26 16:37:23 +0000 | [diff] [blame] | 2496 | C->setDefaultmapModifier( |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2497 | static_cast<OpenMPDefaultmapClauseModifier>(Reader->Record.readInt())); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2498 | C->setLParenLoc(Reader->ReadSourceLocation()); |
| 2499 | C->setDefaultmapModifierLoc(Reader->ReadSourceLocation()); |
| 2500 | C->setDefaultmapKindLoc(Reader->ReadSourceLocation()); |
Arpith Chacko Jacob | 3cf8904 | 2016-01-26 16:37:23 +0000 | [diff] [blame] | 2501 | } |
| 2502 | |
Samuel Antao | 661c090 | 2016-05-26 17:39:58 +0000 | [diff] [blame] | 2503 | void OMPClauseReader::VisitOMPToClause(OMPToClause *C) { |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2504 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Samuel Antao | 661c090 | 2016-05-26 17:39:58 +0000 | [diff] [blame] | 2505 | auto NumVars = C->varlist_size(); |
| 2506 | auto UniqueDecls = C->getUniqueDeclarationsNum(); |
| 2507 | auto TotalLists = C->getTotalComponentListNum(); |
| 2508 | auto TotalComponents = C->getTotalComponentsNum(); |
| 2509 | |
| 2510 | SmallVector<Expr *, 16> Vars; |
| 2511 | Vars.reserve(NumVars); |
| 2512 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2513 | Vars.push_back(Reader->Record.readSubExpr()); |
Samuel Antao | 661c090 | 2016-05-26 17:39:58 +0000 | [diff] [blame] | 2514 | C->setVarRefs(Vars); |
| 2515 | |
| 2516 | SmallVector<ValueDecl *, 16> Decls; |
| 2517 | Decls.reserve(UniqueDecls); |
| 2518 | for (unsigned i = 0; i < UniqueDecls; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2519 | Decls.push_back(Reader->Record.readDeclAs<ValueDecl>()); |
Samuel Antao | 661c090 | 2016-05-26 17:39:58 +0000 | [diff] [blame] | 2520 | C->setUniqueDecls(Decls); |
| 2521 | |
| 2522 | SmallVector<unsigned, 16> ListsPerDecl; |
| 2523 | ListsPerDecl.reserve(UniqueDecls); |
| 2524 | for (unsigned i = 0; i < UniqueDecls; ++i) |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2525 | ListsPerDecl.push_back(Reader->Record.readInt()); |
Samuel Antao | 661c090 | 2016-05-26 17:39:58 +0000 | [diff] [blame] | 2526 | C->setDeclNumLists(ListsPerDecl); |
| 2527 | |
| 2528 | SmallVector<unsigned, 32> ListSizes; |
| 2529 | ListSizes.reserve(TotalLists); |
| 2530 | for (unsigned i = 0; i < TotalLists; ++i) |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2531 | ListSizes.push_back(Reader->Record.readInt()); |
Samuel Antao | 661c090 | 2016-05-26 17:39:58 +0000 | [diff] [blame] | 2532 | C->setComponentListSizes(ListSizes); |
| 2533 | |
| 2534 | SmallVector<OMPClauseMappableExprCommon::MappableComponent, 32> Components; |
| 2535 | Components.reserve(TotalComponents); |
| 2536 | for (unsigned i = 0; i < TotalComponents; ++i) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2537 | Expr *AssociatedExpr = Reader->Record.readSubExpr(); |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 2538 | auto *AssociatedDecl = Reader->Record.readDeclAs<ValueDecl>(); |
Samuel Antao | 661c090 | 2016-05-26 17:39:58 +0000 | [diff] [blame] | 2539 | Components.push_back(OMPClauseMappableExprCommon::MappableComponent( |
| 2540 | AssociatedExpr, AssociatedDecl)); |
| 2541 | } |
| 2542 | C->setComponents(Components, ListSizes); |
| 2543 | } |
| 2544 | |
Samuel Antao | ec172c6 | 2016-05-26 17:49:04 +0000 | [diff] [blame] | 2545 | void OMPClauseReader::VisitOMPFromClause(OMPFromClause *C) { |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2546 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Samuel Antao | ec172c6 | 2016-05-26 17:49:04 +0000 | [diff] [blame] | 2547 | auto NumVars = C->varlist_size(); |
| 2548 | auto UniqueDecls = C->getUniqueDeclarationsNum(); |
| 2549 | auto TotalLists = C->getTotalComponentListNum(); |
| 2550 | auto TotalComponents = C->getTotalComponentsNum(); |
| 2551 | |
| 2552 | SmallVector<Expr *, 16> Vars; |
| 2553 | Vars.reserve(NumVars); |
| 2554 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2555 | Vars.push_back(Reader->Record.readSubExpr()); |
Samuel Antao | ec172c6 | 2016-05-26 17:49:04 +0000 | [diff] [blame] | 2556 | C->setVarRefs(Vars); |
| 2557 | |
| 2558 | SmallVector<ValueDecl *, 16> Decls; |
| 2559 | Decls.reserve(UniqueDecls); |
| 2560 | for (unsigned i = 0; i < UniqueDecls; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2561 | Decls.push_back(Reader->Record.readDeclAs<ValueDecl>()); |
Samuel Antao | ec172c6 | 2016-05-26 17:49:04 +0000 | [diff] [blame] | 2562 | C->setUniqueDecls(Decls); |
| 2563 | |
| 2564 | SmallVector<unsigned, 16> ListsPerDecl; |
| 2565 | ListsPerDecl.reserve(UniqueDecls); |
| 2566 | for (unsigned i = 0; i < UniqueDecls; ++i) |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2567 | ListsPerDecl.push_back(Reader->Record.readInt()); |
Samuel Antao | ec172c6 | 2016-05-26 17:49:04 +0000 | [diff] [blame] | 2568 | C->setDeclNumLists(ListsPerDecl); |
| 2569 | |
| 2570 | SmallVector<unsigned, 32> ListSizes; |
| 2571 | ListSizes.reserve(TotalLists); |
| 2572 | for (unsigned i = 0; i < TotalLists; ++i) |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2573 | ListSizes.push_back(Reader->Record.readInt()); |
Samuel Antao | ec172c6 | 2016-05-26 17:49:04 +0000 | [diff] [blame] | 2574 | C->setComponentListSizes(ListSizes); |
| 2575 | |
| 2576 | SmallVector<OMPClauseMappableExprCommon::MappableComponent, 32> Components; |
| 2577 | Components.reserve(TotalComponents); |
| 2578 | for (unsigned i = 0; i < TotalComponents; ++i) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2579 | Expr *AssociatedExpr = Reader->Record.readSubExpr(); |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 2580 | auto *AssociatedDecl = Reader->Record.readDeclAs<ValueDecl>(); |
Samuel Antao | ec172c6 | 2016-05-26 17:49:04 +0000 | [diff] [blame] | 2581 | Components.push_back(OMPClauseMappableExprCommon::MappableComponent( |
| 2582 | AssociatedExpr, AssociatedDecl)); |
| 2583 | } |
| 2584 | C->setComponents(Components, ListSizes); |
| 2585 | } |
| 2586 | |
Carlo Bertolli | 2404b17 | 2016-07-13 15:37:16 +0000 | [diff] [blame] | 2587 | void OMPClauseReader::VisitOMPUseDevicePtrClause(OMPUseDevicePtrClause *C) { |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2588 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Samuel Antao | cc10b85 | 2016-07-28 14:23:26 +0000 | [diff] [blame] | 2589 | auto NumVars = C->varlist_size(); |
| 2590 | auto UniqueDecls = C->getUniqueDeclarationsNum(); |
| 2591 | auto TotalLists = C->getTotalComponentListNum(); |
| 2592 | auto TotalComponents = C->getTotalComponentsNum(); |
| 2593 | |
Carlo Bertolli | 2404b17 | 2016-07-13 15:37:16 +0000 | [diff] [blame] | 2594 | SmallVector<Expr *, 16> Vars; |
| 2595 | Vars.reserve(NumVars); |
| 2596 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2597 | Vars.push_back(Reader->Record.readSubExpr()); |
Carlo Bertolli | 2404b17 | 2016-07-13 15:37:16 +0000 | [diff] [blame] | 2598 | C->setVarRefs(Vars); |
| 2599 | Vars.clear(); |
Samuel Antao | cc10b85 | 2016-07-28 14:23:26 +0000 | [diff] [blame] | 2600 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2601 | Vars.push_back(Reader->Record.readSubExpr()); |
Samuel Antao | cc10b85 | 2016-07-28 14:23:26 +0000 | [diff] [blame] | 2602 | C->setPrivateCopies(Vars); |
| 2603 | Vars.clear(); |
| 2604 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2605 | Vars.push_back(Reader->Record.readSubExpr()); |
Samuel Antao | cc10b85 | 2016-07-28 14:23:26 +0000 | [diff] [blame] | 2606 | C->setInits(Vars); |
| 2607 | |
| 2608 | SmallVector<ValueDecl *, 16> Decls; |
| 2609 | Decls.reserve(UniqueDecls); |
| 2610 | for (unsigned i = 0; i < UniqueDecls; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2611 | Decls.push_back(Reader->Record.readDeclAs<ValueDecl>()); |
Samuel Antao | cc10b85 | 2016-07-28 14:23:26 +0000 | [diff] [blame] | 2612 | C->setUniqueDecls(Decls); |
| 2613 | |
| 2614 | SmallVector<unsigned, 16> ListsPerDecl; |
| 2615 | ListsPerDecl.reserve(UniqueDecls); |
| 2616 | for (unsigned i = 0; i < UniqueDecls; ++i) |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2617 | ListsPerDecl.push_back(Reader->Record.readInt()); |
Samuel Antao | cc10b85 | 2016-07-28 14:23:26 +0000 | [diff] [blame] | 2618 | C->setDeclNumLists(ListsPerDecl); |
| 2619 | |
| 2620 | SmallVector<unsigned, 32> ListSizes; |
| 2621 | ListSizes.reserve(TotalLists); |
| 2622 | for (unsigned i = 0; i < TotalLists; ++i) |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2623 | ListSizes.push_back(Reader->Record.readInt()); |
Samuel Antao | cc10b85 | 2016-07-28 14:23:26 +0000 | [diff] [blame] | 2624 | C->setComponentListSizes(ListSizes); |
| 2625 | |
| 2626 | SmallVector<OMPClauseMappableExprCommon::MappableComponent, 32> Components; |
| 2627 | Components.reserve(TotalComponents); |
| 2628 | for (unsigned i = 0; i < TotalComponents; ++i) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2629 | Expr *AssociatedExpr = Reader->Record.readSubExpr(); |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 2630 | auto *AssociatedDecl = Reader->Record.readDeclAs<ValueDecl>(); |
Samuel Antao | cc10b85 | 2016-07-28 14:23:26 +0000 | [diff] [blame] | 2631 | Components.push_back(OMPClauseMappableExprCommon::MappableComponent( |
| 2632 | AssociatedExpr, AssociatedDecl)); |
| 2633 | } |
| 2634 | C->setComponents(Components, ListSizes); |
Carlo Bertolli | 2404b17 | 2016-07-13 15:37:16 +0000 | [diff] [blame] | 2635 | } |
| 2636 | |
Carlo Bertolli | 70594e9 | 2016-07-13 17:16:49 +0000 | [diff] [blame] | 2637 | void OMPClauseReader::VisitOMPIsDevicePtrClause(OMPIsDevicePtrClause *C) { |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2638 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Samuel Antao | 6890b09 | 2016-07-28 14:25:09 +0000 | [diff] [blame] | 2639 | auto NumVars = C->varlist_size(); |
| 2640 | auto UniqueDecls = C->getUniqueDeclarationsNum(); |
| 2641 | auto TotalLists = C->getTotalComponentListNum(); |
| 2642 | auto TotalComponents = C->getTotalComponentsNum(); |
| 2643 | |
Carlo Bertolli | 70594e9 | 2016-07-13 17:16:49 +0000 | [diff] [blame] | 2644 | SmallVector<Expr *, 16> Vars; |
| 2645 | Vars.reserve(NumVars); |
| 2646 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2647 | Vars.push_back(Reader->Record.readSubExpr()); |
Carlo Bertolli | 70594e9 | 2016-07-13 17:16:49 +0000 | [diff] [blame] | 2648 | C->setVarRefs(Vars); |
| 2649 | Vars.clear(); |
Samuel Antao | 6890b09 | 2016-07-28 14:25:09 +0000 | [diff] [blame] | 2650 | |
| 2651 | SmallVector<ValueDecl *, 16> Decls; |
| 2652 | Decls.reserve(UniqueDecls); |
| 2653 | for (unsigned i = 0; i < UniqueDecls; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2654 | Decls.push_back(Reader->Record.readDeclAs<ValueDecl>()); |
Samuel Antao | 6890b09 | 2016-07-28 14:25:09 +0000 | [diff] [blame] | 2655 | C->setUniqueDecls(Decls); |
| 2656 | |
| 2657 | SmallVector<unsigned, 16> ListsPerDecl; |
| 2658 | ListsPerDecl.reserve(UniqueDecls); |
| 2659 | for (unsigned i = 0; i < UniqueDecls; ++i) |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2660 | ListsPerDecl.push_back(Reader->Record.readInt()); |
Samuel Antao | 6890b09 | 2016-07-28 14:25:09 +0000 | [diff] [blame] | 2661 | C->setDeclNumLists(ListsPerDecl); |
| 2662 | |
| 2663 | SmallVector<unsigned, 32> ListSizes; |
| 2664 | ListSizes.reserve(TotalLists); |
| 2665 | for (unsigned i = 0; i < TotalLists; ++i) |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2666 | ListSizes.push_back(Reader->Record.readInt()); |
Samuel Antao | 6890b09 | 2016-07-28 14:25:09 +0000 | [diff] [blame] | 2667 | C->setComponentListSizes(ListSizes); |
| 2668 | |
| 2669 | SmallVector<OMPClauseMappableExprCommon::MappableComponent, 32> Components; |
| 2670 | Components.reserve(TotalComponents); |
| 2671 | for (unsigned i = 0; i < TotalComponents; ++i) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2672 | Expr *AssociatedExpr = Reader->Record.readSubExpr(); |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 2673 | auto *AssociatedDecl = Reader->Record.readDeclAs<ValueDecl>(); |
Samuel Antao | 6890b09 | 2016-07-28 14:25:09 +0000 | [diff] [blame] | 2674 | Components.push_back(OMPClauseMappableExprCommon::MappableComponent( |
| 2675 | AssociatedExpr, AssociatedDecl)); |
| 2676 | } |
| 2677 | C->setComponents(Components, ListSizes); |
Carlo Bertolli | 70594e9 | 2016-07-13 17:16:49 +0000 | [diff] [blame] | 2678 | } |
| 2679 | |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 2680 | //===----------------------------------------------------------------------===// |
| 2681 | // OpenMP Directives. |
| 2682 | //===----------------------------------------------------------------------===// |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 2683 | |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 2684 | void ASTStmtReader::VisitOMPExecutableDirective(OMPExecutableDirective *E) { |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2685 | E->setLocStart(ReadSourceLocation()); |
| 2686 | E->setLocEnd(ReadSourceLocation()); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2687 | OMPClauseReader ClauseReader(this, Record); |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 2688 | SmallVector<OMPClause *, 5> Clauses; |
| 2689 | for (unsigned i = 0; i < E->getNumClauses(); ++i) |
| 2690 | Clauses.push_back(ClauseReader.readClause()); |
| 2691 | E->setClauses(Clauses); |
Alexey Bataev | 68446b7 | 2014-07-18 07:47:19 +0000 | [diff] [blame] | 2692 | if (E->hasAssociatedStmt()) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2693 | E->setAssociatedStmt(Record.readSubStmt()); |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 2694 | } |
| 2695 | |
Alexander Musman | 3aaab66 | 2014-08-19 11:27:13 +0000 | [diff] [blame] | 2696 | void ASTStmtReader::VisitOMPLoopDirective(OMPLoopDirective *D) { |
| 2697 | VisitStmt(D); |
| 2698 | // Two fields (NumClauses and CollapsedNum) were read in ReadStmtFromStream. |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2699 | Record.skipInts(2); |
Alexander Musman | 3aaab66 | 2014-08-19 11:27:13 +0000 | [diff] [blame] | 2700 | VisitOMPExecutableDirective(D); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2701 | D->setIterationVariable(Record.readSubExpr()); |
| 2702 | D->setLastIteration(Record.readSubExpr()); |
| 2703 | D->setCalcLastIteration(Record.readSubExpr()); |
| 2704 | D->setPreCond(Record.readSubExpr()); |
| 2705 | D->setCond(Record.readSubExpr()); |
| 2706 | D->setInit(Record.readSubExpr()); |
| 2707 | D->setInc(Record.readSubExpr()); |
| 2708 | D->setPreInits(Record.readSubStmt()); |
Alexey Bataev | 3392d76 | 2016-02-16 11:18:12 +0000 | [diff] [blame] | 2709 | if (isOpenMPWorksharingDirective(D->getDirectiveKind()) || |
Carlo Bertolli | fc35ad2 | 2016-03-07 16:04:49 +0000 | [diff] [blame] | 2710 | isOpenMPTaskLoopDirective(D->getDirectiveKind()) || |
| 2711 | isOpenMPDistributeDirective(D->getDirectiveKind())) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2712 | D->setIsLastIterVariable(Record.readSubExpr()); |
| 2713 | D->setLowerBoundVariable(Record.readSubExpr()); |
| 2714 | D->setUpperBoundVariable(Record.readSubExpr()); |
| 2715 | D->setStrideVariable(Record.readSubExpr()); |
| 2716 | D->setEnsureUpperBound(Record.readSubExpr()); |
| 2717 | D->setNextLowerBound(Record.readSubExpr()); |
| 2718 | D->setNextUpperBound(Record.readSubExpr()); |
| 2719 | D->setNumIterations(Record.readSubExpr()); |
Alexander Musman | c638868 | 2014-12-15 07:07:06 +0000 | [diff] [blame] | 2720 | } |
Carlo Bertolli | 9925f15 | 2016-06-27 14:55:37 +0000 | [diff] [blame] | 2721 | if (isOpenMPLoopBoundSharingDirective(D->getDirectiveKind())) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2722 | D->setPrevLowerBoundVariable(Record.readSubExpr()); |
| 2723 | D->setPrevUpperBoundVariable(Record.readSubExpr()); |
Carlo Bertolli | 8429d81 | 2017-02-17 21:29:13 +0000 | [diff] [blame] | 2724 | D->setDistInc(Record.readSubExpr()); |
| 2725 | D->setPrevEnsureUpperBound(Record.readSubExpr()); |
Carlo Bertolli | ffafe10 | 2017-04-20 00:39:39 +0000 | [diff] [blame] | 2726 | D->setCombinedLowerBoundVariable(Record.readSubExpr()); |
| 2727 | D->setCombinedUpperBoundVariable(Record.readSubExpr()); |
| 2728 | D->setCombinedEnsureUpperBound(Record.readSubExpr()); |
| 2729 | D->setCombinedInit(Record.readSubExpr()); |
| 2730 | D->setCombinedCond(Record.readSubExpr()); |
| 2731 | D->setCombinedNextLowerBound(Record.readSubExpr()); |
| 2732 | D->setCombinedNextUpperBound(Record.readSubExpr()); |
Carlo Bertolli | 9925f15 | 2016-06-27 14:55:37 +0000 | [diff] [blame] | 2733 | } |
Alexander Musman | a5f070a | 2014-10-01 06:03:56 +0000 | [diff] [blame] | 2734 | SmallVector<Expr *, 4> Sub; |
| 2735 | unsigned CollapsedNum = D->getCollapsedNumber(); |
| 2736 | Sub.reserve(CollapsedNum); |
| 2737 | for (unsigned i = 0; i < CollapsedNum; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2738 | Sub.push_back(Record.readSubExpr()); |
Alexander Musman | a5f070a | 2014-10-01 06:03:56 +0000 | [diff] [blame] | 2739 | D->setCounters(Sub); |
| 2740 | Sub.clear(); |
| 2741 | for (unsigned i = 0; i < CollapsedNum; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2742 | Sub.push_back(Record.readSubExpr()); |
Alexey Bataev | a889917 | 2015-08-06 12:30:57 +0000 | [diff] [blame] | 2743 | D->setPrivateCounters(Sub); |
| 2744 | Sub.clear(); |
| 2745 | for (unsigned i = 0; i < CollapsedNum; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2746 | Sub.push_back(Record.readSubExpr()); |
Alexey Bataev | b08f89f | 2015-08-14 12:25:37 +0000 | [diff] [blame] | 2747 | D->setInits(Sub); |
| 2748 | Sub.clear(); |
| 2749 | for (unsigned i = 0; i < CollapsedNum; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2750 | Sub.push_back(Record.readSubExpr()); |
Alexander Musman | a5f070a | 2014-10-01 06:03:56 +0000 | [diff] [blame] | 2751 | D->setUpdates(Sub); |
| 2752 | Sub.clear(); |
| 2753 | for (unsigned i = 0; i < CollapsedNum; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2754 | Sub.push_back(Record.readSubExpr()); |
Alexander Musman | a5f070a | 2014-10-01 06:03:56 +0000 | [diff] [blame] | 2755 | D->setFinals(Sub); |
Alexander Musman | 3aaab66 | 2014-08-19 11:27:13 +0000 | [diff] [blame] | 2756 | } |
| 2757 | |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 2758 | void ASTStmtReader::VisitOMPParallelDirective(OMPParallelDirective *D) { |
Alexey Bataev | 1b59ab5 | 2014-02-27 08:29:12 +0000 | [diff] [blame] | 2759 | VisitStmt(D); |
| 2760 | // The NumClauses field was read in ReadStmtFromStream. |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2761 | Record.skipInts(1); |
Alexey Bataev | 1b59ab5 | 2014-02-27 08:29:12 +0000 | [diff] [blame] | 2762 | VisitOMPExecutableDirective(D); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2763 | D->setHasCancel(Record.readInt()); |
Alexey Bataev | 1b59ab5 | 2014-02-27 08:29:12 +0000 | [diff] [blame] | 2764 | } |
| 2765 | |
| 2766 | void ASTStmtReader::VisitOMPSimdDirective(OMPSimdDirective *D) { |
Alexander Musman | 3aaab66 | 2014-08-19 11:27:13 +0000 | [diff] [blame] | 2767 | VisitOMPLoopDirective(D); |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 2768 | } |
| 2769 | |
Alexey Bataev | f29276e | 2014-06-18 04:14:57 +0000 | [diff] [blame] | 2770 | void ASTStmtReader::VisitOMPForDirective(OMPForDirective *D) { |
Alexander Musman | 3aaab66 | 2014-08-19 11:27:13 +0000 | [diff] [blame] | 2771 | VisitOMPLoopDirective(D); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2772 | D->setHasCancel(Record.readInt()); |
Alexey Bataev | f29276e | 2014-06-18 04:14:57 +0000 | [diff] [blame] | 2773 | } |
| 2774 | |
Alexander Musman | f82886e | 2014-09-18 05:12:34 +0000 | [diff] [blame] | 2775 | void ASTStmtReader::VisitOMPForSimdDirective(OMPForSimdDirective *D) { |
| 2776 | VisitOMPLoopDirective(D); |
| 2777 | } |
| 2778 | |
Alexey Bataev | d3f8dd2 | 2014-06-25 11:44:49 +0000 | [diff] [blame] | 2779 | void ASTStmtReader::VisitOMPSectionsDirective(OMPSectionsDirective *D) { |
| 2780 | VisitStmt(D); |
| 2781 | // The NumClauses field was read in ReadStmtFromStream. |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2782 | Record.skipInts(1); |
Alexey Bataev | d3f8dd2 | 2014-06-25 11:44:49 +0000 | [diff] [blame] | 2783 | VisitOMPExecutableDirective(D); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2784 | D->setHasCancel(Record.readInt()); |
Alexey Bataev | d3f8dd2 | 2014-06-25 11:44:49 +0000 | [diff] [blame] | 2785 | } |
| 2786 | |
Alexey Bataev | 1e0498a | 2014-06-26 08:21:58 +0000 | [diff] [blame] | 2787 | void ASTStmtReader::VisitOMPSectionDirective(OMPSectionDirective *D) { |
| 2788 | VisitStmt(D); |
| 2789 | VisitOMPExecutableDirective(D); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2790 | D->setHasCancel(Record.readInt()); |
Alexey Bataev | 1e0498a | 2014-06-26 08:21:58 +0000 | [diff] [blame] | 2791 | } |
| 2792 | |
Alexey Bataev | d1e40fb | 2014-06-26 12:05:45 +0000 | [diff] [blame] | 2793 | void ASTStmtReader::VisitOMPSingleDirective(OMPSingleDirective *D) { |
| 2794 | VisitStmt(D); |
| 2795 | // The NumClauses field was read in ReadStmtFromStream. |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2796 | Record.skipInts(1); |
Alexey Bataev | d1e40fb | 2014-06-26 12:05:45 +0000 | [diff] [blame] | 2797 | VisitOMPExecutableDirective(D); |
| 2798 | } |
| 2799 | |
Alexander Musman | 80c2289 | 2014-07-17 08:54:58 +0000 | [diff] [blame] | 2800 | void ASTStmtReader::VisitOMPMasterDirective(OMPMasterDirective *D) { |
| 2801 | VisitStmt(D); |
| 2802 | VisitOMPExecutableDirective(D); |
| 2803 | } |
| 2804 | |
Alexander Musman | d9ed09f | 2014-07-21 09:42:05 +0000 | [diff] [blame] | 2805 | void ASTStmtReader::VisitOMPCriticalDirective(OMPCriticalDirective *D) { |
| 2806 | VisitStmt(D); |
Alexey Bataev | 28c7541 | 2015-12-15 08:19:24 +0000 | [diff] [blame] | 2807 | // The NumClauses field was read in ReadStmtFromStream. |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2808 | Record.skipInts(1); |
Alexander Musman | d9ed09f | 2014-07-21 09:42:05 +0000 | [diff] [blame] | 2809 | VisitOMPExecutableDirective(D); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2810 | ReadDeclarationNameInfo(D->DirName); |
Alexander Musman | d9ed09f | 2014-07-21 09:42:05 +0000 | [diff] [blame] | 2811 | } |
| 2812 | |
Alexey Bataev | 4acb859 | 2014-07-07 13:01:15 +0000 | [diff] [blame] | 2813 | void ASTStmtReader::VisitOMPParallelForDirective(OMPParallelForDirective *D) { |
Alexander Musman | 3aaab66 | 2014-08-19 11:27:13 +0000 | [diff] [blame] | 2814 | VisitOMPLoopDirective(D); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2815 | D->setHasCancel(Record.readInt()); |
Alexey Bataev | 4acb859 | 2014-07-07 13:01:15 +0000 | [diff] [blame] | 2816 | } |
| 2817 | |
Alexander Musman | e4e893b | 2014-09-23 09:33:00 +0000 | [diff] [blame] | 2818 | void ASTStmtReader::VisitOMPParallelForSimdDirective( |
| 2819 | OMPParallelForSimdDirective *D) { |
| 2820 | VisitOMPLoopDirective(D); |
| 2821 | } |
| 2822 | |
Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 2823 | void ASTStmtReader::VisitOMPParallelSectionsDirective( |
| 2824 | OMPParallelSectionsDirective *D) { |
| 2825 | VisitStmt(D); |
| 2826 | // The NumClauses field was read in ReadStmtFromStream. |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2827 | Record.skipInts(1); |
Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 2828 | VisitOMPExecutableDirective(D); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2829 | D->setHasCancel(Record.readInt()); |
Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 2830 | } |
| 2831 | |
Alexey Bataev | 9c2e8ee | 2014-07-11 11:25:16 +0000 | [diff] [blame] | 2832 | void ASTStmtReader::VisitOMPTaskDirective(OMPTaskDirective *D) { |
| 2833 | VisitStmt(D); |
| 2834 | // The NumClauses field was read in ReadStmtFromStream. |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2835 | Record.skipInts(1); |
Alexey Bataev | 9c2e8ee | 2014-07-11 11:25:16 +0000 | [diff] [blame] | 2836 | VisitOMPExecutableDirective(D); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2837 | D->setHasCancel(Record.readInt()); |
Alexey Bataev | 9c2e8ee | 2014-07-11 11:25:16 +0000 | [diff] [blame] | 2838 | } |
| 2839 | |
Alexey Bataev | 68446b7 | 2014-07-18 07:47:19 +0000 | [diff] [blame] | 2840 | void ASTStmtReader::VisitOMPTaskyieldDirective(OMPTaskyieldDirective *D) { |
| 2841 | VisitStmt(D); |
| 2842 | VisitOMPExecutableDirective(D); |
| 2843 | } |
| 2844 | |
Alexey Bataev | 4d1dfea | 2014-07-18 09:11:51 +0000 | [diff] [blame] | 2845 | void ASTStmtReader::VisitOMPBarrierDirective(OMPBarrierDirective *D) { |
| 2846 | VisitStmt(D); |
| 2847 | VisitOMPExecutableDirective(D); |
| 2848 | } |
| 2849 | |
Alexey Bataev | 2df347a | 2014-07-18 10:17:07 +0000 | [diff] [blame] | 2850 | void ASTStmtReader::VisitOMPTaskwaitDirective(OMPTaskwaitDirective *D) { |
| 2851 | VisitStmt(D); |
| 2852 | VisitOMPExecutableDirective(D); |
| 2853 | } |
| 2854 | |
Alexey Bataev | c30dd2d | 2015-06-18 12:14:09 +0000 | [diff] [blame] | 2855 | void ASTStmtReader::VisitOMPTaskgroupDirective(OMPTaskgroupDirective *D) { |
| 2856 | VisitStmt(D); |
Alexey Bataev | 169d96a | 2017-07-18 20:17:46 +0000 | [diff] [blame] | 2857 | // The NumClauses field was read in ReadStmtFromStream. |
| 2858 | Record.skipInts(1); |
Alexey Bataev | c30dd2d | 2015-06-18 12:14:09 +0000 | [diff] [blame] | 2859 | VisitOMPExecutableDirective(D); |
Alexey Bataev | 3b1b895 | 2017-07-25 15:53:26 +0000 | [diff] [blame] | 2860 | D->setReductionRef(Record.readSubExpr()); |
Alexey Bataev | c30dd2d | 2015-06-18 12:14:09 +0000 | [diff] [blame] | 2861 | } |
| 2862 | |
Alexey Bataev | 6125da9 | 2014-07-21 11:26:11 +0000 | [diff] [blame] | 2863 | void ASTStmtReader::VisitOMPFlushDirective(OMPFlushDirective *D) { |
| 2864 | VisitStmt(D); |
| 2865 | // The NumClauses field was read in ReadStmtFromStream. |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2866 | Record.skipInts(1); |
Alexey Bataev | 6125da9 | 2014-07-21 11:26:11 +0000 | [diff] [blame] | 2867 | VisitOMPExecutableDirective(D); |
| 2868 | } |
| 2869 | |
Alexey Bataev | 9fb6e64 | 2014-07-22 06:45:04 +0000 | [diff] [blame] | 2870 | void ASTStmtReader::VisitOMPOrderedDirective(OMPOrderedDirective *D) { |
| 2871 | VisitStmt(D); |
Alexey Bataev | 346265e | 2015-09-25 10:37:12 +0000 | [diff] [blame] | 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 | 9fb6e64 | 2014-07-22 06:45:04 +0000 | [diff] [blame] | 2874 | VisitOMPExecutableDirective(D); |
| 2875 | } |
| 2876 | |
Alexey Bataev | 0162e45 | 2014-07-22 10:10:35 +0000 | [diff] [blame] | 2877 | void ASTStmtReader::VisitOMPAtomicDirective(OMPAtomicDirective *D) { |
| 2878 | VisitStmt(D); |
| 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 | 0162e45 | 2014-07-22 10:10:35 +0000 | [diff] [blame] | 2881 | VisitOMPExecutableDirective(D); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2882 | D->setX(Record.readSubExpr()); |
| 2883 | D->setV(Record.readSubExpr()); |
| 2884 | D->setExpr(Record.readSubExpr()); |
| 2885 | D->setUpdateExpr(Record.readSubExpr()); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2886 | D->IsXLHSInRHSPart = Record.readInt() != 0; |
| 2887 | D->IsPostfixUpdate = Record.readInt() != 0; |
Alexey Bataev | 0162e45 | 2014-07-22 10:10:35 +0000 | [diff] [blame] | 2888 | } |
| 2889 | |
Alexey Bataev | 0bd520b | 2014-09-19 08:19:49 +0000 | [diff] [blame] | 2890 | void ASTStmtReader::VisitOMPTargetDirective(OMPTargetDirective *D) { |
| 2891 | VisitStmt(D); |
| 2892 | // The NumClauses field was read in ReadStmtFromStream. |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2893 | Record.skipInts(1); |
Alexey Bataev | 0bd520b | 2014-09-19 08:19:49 +0000 | [diff] [blame] | 2894 | VisitOMPExecutableDirective(D); |
| 2895 | } |
| 2896 | |
Michael Wong | 65f367f | 2015-07-21 13:44:28 +0000 | [diff] [blame] | 2897 | void ASTStmtReader::VisitOMPTargetDataDirective(OMPTargetDataDirective *D) { |
| 2898 | VisitStmt(D); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2899 | Record.skipInts(1); |
Michael Wong | 65f367f | 2015-07-21 13:44:28 +0000 | [diff] [blame] | 2900 | VisitOMPExecutableDirective(D); |
| 2901 | } |
| 2902 | |
Samuel Antao | df67fc4 | 2016-01-19 19:15:56 +0000 | [diff] [blame] | 2903 | void ASTStmtReader::VisitOMPTargetEnterDataDirective( |
| 2904 | OMPTargetEnterDataDirective *D) { |
| 2905 | VisitStmt(D); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2906 | Record.skipInts(1); |
Samuel Antao | df67fc4 | 2016-01-19 19:15:56 +0000 | [diff] [blame] | 2907 | VisitOMPExecutableDirective(D); |
| 2908 | } |
| 2909 | |
Samuel Antao | 7259076 | 2016-01-19 20:04:50 +0000 | [diff] [blame] | 2910 | void ASTStmtReader::VisitOMPTargetExitDataDirective( |
| 2911 | OMPTargetExitDataDirective *D) { |
| 2912 | VisitStmt(D); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2913 | Record.skipInts(1); |
Samuel Antao | 7259076 | 2016-01-19 20:04:50 +0000 | [diff] [blame] | 2914 | VisitOMPExecutableDirective(D); |
| 2915 | } |
| 2916 | |
Arpith Chacko Jacob | e955b3d | 2016-01-26 18:48:41 +0000 | [diff] [blame] | 2917 | void ASTStmtReader::VisitOMPTargetParallelDirective( |
| 2918 | OMPTargetParallelDirective *D) { |
| 2919 | VisitStmt(D); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2920 | Record.skipInts(1); |
Arpith Chacko Jacob | e955b3d | 2016-01-26 18:48:41 +0000 | [diff] [blame] | 2921 | VisitOMPExecutableDirective(D); |
| 2922 | } |
| 2923 | |
Arpith Chacko Jacob | 05bebb5 | 2016-02-03 15:46:42 +0000 | [diff] [blame] | 2924 | void ASTStmtReader::VisitOMPTargetParallelForDirective( |
| 2925 | OMPTargetParallelForDirective *D) { |
| 2926 | VisitOMPLoopDirective(D); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2927 | D->setHasCancel(Record.readInt()); |
Arpith Chacko Jacob | 05bebb5 | 2016-02-03 15:46:42 +0000 | [diff] [blame] | 2928 | } |
| 2929 | |
Alexey Bataev | 13314bf | 2014-10-09 04:18:56 +0000 | [diff] [blame] | 2930 | void ASTStmtReader::VisitOMPTeamsDirective(OMPTeamsDirective *D) { |
| 2931 | VisitStmt(D); |
| 2932 | // The NumClauses field was read in ReadStmtFromStream. |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2933 | Record.skipInts(1); |
Alexey Bataev | 13314bf | 2014-10-09 04:18:56 +0000 | [diff] [blame] | 2934 | VisitOMPExecutableDirective(D); |
| 2935 | } |
| 2936 | |
Alexey Bataev | 6d4ed05 | 2015-07-01 06:57:41 +0000 | [diff] [blame] | 2937 | void ASTStmtReader::VisitOMPCancellationPointDirective( |
| 2938 | OMPCancellationPointDirective *D) { |
| 2939 | VisitStmt(D); |
| 2940 | VisitOMPExecutableDirective(D); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2941 | D->setCancelRegion(static_cast<OpenMPDirectiveKind>(Record.readInt())); |
Alexey Bataev | 6d4ed05 | 2015-07-01 06:57:41 +0000 | [diff] [blame] | 2942 | } |
| 2943 | |
Alexey Bataev | 8090987 | 2015-07-02 11:25:17 +0000 | [diff] [blame] | 2944 | void ASTStmtReader::VisitOMPCancelDirective(OMPCancelDirective *D) { |
| 2945 | VisitStmt(D); |
Alexey Bataev | 87933c7 | 2015-09-18 08:07:34 +0000 | [diff] [blame] | 2946 | // The NumClauses field was read in ReadStmtFromStream. |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2947 | Record.skipInts(1); |
Alexey Bataev | 8090987 | 2015-07-02 11:25:17 +0000 | [diff] [blame] | 2948 | VisitOMPExecutableDirective(D); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2949 | D->setCancelRegion(static_cast<OpenMPDirectiveKind>(Record.readInt())); |
Alexey Bataev | 8090987 | 2015-07-02 11:25:17 +0000 | [diff] [blame] | 2950 | } |
| 2951 | |
Alexey Bataev | 49f6e78 | 2015-12-01 04:18:41 +0000 | [diff] [blame] | 2952 | void ASTStmtReader::VisitOMPTaskLoopDirective(OMPTaskLoopDirective *D) { |
| 2953 | VisitOMPLoopDirective(D); |
| 2954 | } |
| 2955 | |
Alexey Bataev | 0a6ed84 | 2015-12-03 09:40:15 +0000 | [diff] [blame] | 2956 | void ASTStmtReader::VisitOMPTaskLoopSimdDirective(OMPTaskLoopSimdDirective *D) { |
| 2957 | VisitOMPLoopDirective(D); |
| 2958 | } |
| 2959 | |
Carlo Bertolli | 6200a3d | 2015-12-14 14:51:25 +0000 | [diff] [blame] | 2960 | void ASTStmtReader::VisitOMPDistributeDirective(OMPDistributeDirective *D) { |
| 2961 | VisitOMPLoopDirective(D); |
| 2962 | } |
| 2963 | |
Samuel Antao | 686c70c | 2016-05-26 17:30:50 +0000 | [diff] [blame] | 2964 | void ASTStmtReader::VisitOMPTargetUpdateDirective(OMPTargetUpdateDirective *D) { |
| 2965 | VisitStmt(D); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2966 | Record.skipInts(1); |
Samuel Antao | 686c70c | 2016-05-26 17:30:50 +0000 | [diff] [blame] | 2967 | VisitOMPExecutableDirective(D); |
| 2968 | } |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 2969 | |
Carlo Bertolli | 9925f15 | 2016-06-27 14:55:37 +0000 | [diff] [blame] | 2970 | void ASTStmtReader::VisitOMPDistributeParallelForDirective( |
| 2971 | OMPDistributeParallelForDirective *D) { |
| 2972 | VisitOMPLoopDirective(D); |
Alexey Bataev | dcb4b8fb | 2017-11-22 20:19:50 +0000 | [diff] [blame] | 2973 | D->setHasCancel(Record.readInt()); |
Carlo Bertolli | 9925f15 | 2016-06-27 14:55:37 +0000 | [diff] [blame] | 2974 | } |
Samuel Antao | 686c70c | 2016-05-26 17:30:50 +0000 | [diff] [blame] | 2975 | |
Kelvin Li | 4a39add | 2016-07-05 05:00:15 +0000 | [diff] [blame] | 2976 | void ASTStmtReader::VisitOMPDistributeParallelForSimdDirective( |
| 2977 | OMPDistributeParallelForSimdDirective *D) { |
| 2978 | VisitOMPLoopDirective(D); |
| 2979 | } |
| 2980 | |
Kelvin Li | 787f3fc | 2016-07-06 04:45:38 +0000 | [diff] [blame] | 2981 | void ASTStmtReader::VisitOMPDistributeSimdDirective( |
| 2982 | OMPDistributeSimdDirective *D) { |
| 2983 | VisitOMPLoopDirective(D); |
| 2984 | } |
| 2985 | |
Kelvin Li | a579b91 | 2016-07-14 02:54:56 +0000 | [diff] [blame] | 2986 | void ASTStmtReader::VisitOMPTargetParallelForSimdDirective( |
| 2987 | OMPTargetParallelForSimdDirective *D) { |
| 2988 | VisitOMPLoopDirective(D); |
| 2989 | } |
| 2990 | |
Kelvin Li | 986330c | 2016-07-20 22:57:10 +0000 | [diff] [blame] | 2991 | void ASTStmtReader::VisitOMPTargetSimdDirective(OMPTargetSimdDirective *D) { |
| 2992 | VisitOMPLoopDirective(D); |
| 2993 | } |
| 2994 | |
Kelvin Li | 0253287 | 2016-08-05 14:37:37 +0000 | [diff] [blame] | 2995 | void ASTStmtReader::VisitOMPTeamsDistributeDirective( |
| 2996 | OMPTeamsDistributeDirective *D) { |
| 2997 | VisitOMPLoopDirective(D); |
| 2998 | } |
| 2999 | |
Kelvin Li | 4e325f7 | 2016-10-25 12:50:55 +0000 | [diff] [blame] | 3000 | void ASTStmtReader::VisitOMPTeamsDistributeSimdDirective( |
| 3001 | OMPTeamsDistributeSimdDirective *D) { |
| 3002 | VisitOMPLoopDirective(D); |
| 3003 | } |
| 3004 | |
Kelvin Li | 579e41c | 2016-11-30 23:51:03 +0000 | [diff] [blame] | 3005 | void ASTStmtReader::VisitOMPTeamsDistributeParallelForSimdDirective( |
| 3006 | OMPTeamsDistributeParallelForSimdDirective *D) { |
| 3007 | VisitOMPLoopDirective(D); |
| 3008 | } |
| 3009 | |
Kelvin Li | 7ade93f | 2016-12-09 03:24:30 +0000 | [diff] [blame] | 3010 | void ASTStmtReader::VisitOMPTeamsDistributeParallelForDirective( |
| 3011 | OMPTeamsDistributeParallelForDirective *D) { |
| 3012 | VisitOMPLoopDirective(D); |
Alexey Bataev | dcb4b8fb | 2017-11-22 20:19:50 +0000 | [diff] [blame] | 3013 | D->setHasCancel(Record.readInt()); |
Kelvin Li | 7ade93f | 2016-12-09 03:24:30 +0000 | [diff] [blame] | 3014 | } |
| 3015 | |
Kelvin Li | bf594a5 | 2016-12-17 05:48:59 +0000 | [diff] [blame] | 3016 | void ASTStmtReader::VisitOMPTargetTeamsDirective(OMPTargetTeamsDirective *D) { |
| 3017 | VisitStmt(D); |
| 3018 | // The NumClauses field was read in ReadStmtFromStream. |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 3019 | Record.skipInts(1); |
Kelvin Li | bf594a5 | 2016-12-17 05:48:59 +0000 | [diff] [blame] | 3020 | VisitOMPExecutableDirective(D); |
| 3021 | } |
| 3022 | |
Kelvin Li | 83c451e | 2016-12-25 04:52:54 +0000 | [diff] [blame] | 3023 | void ASTStmtReader::VisitOMPTargetTeamsDistributeDirective( |
| 3024 | OMPTargetTeamsDistributeDirective *D) { |
| 3025 | VisitOMPLoopDirective(D); |
| 3026 | } |
| 3027 | |
Kelvin Li | 80e8f56 | 2016-12-29 22:16:30 +0000 | [diff] [blame] | 3028 | void ASTStmtReader::VisitOMPTargetTeamsDistributeParallelForDirective( |
| 3029 | OMPTargetTeamsDistributeParallelForDirective *D) { |
| 3030 | VisitOMPLoopDirective(D); |
Alexey Bataev | 16e7988 | 2017-11-22 21:12:03 +0000 | [diff] [blame] | 3031 | D->setHasCancel(Record.readInt()); |
Kelvin Li | 80e8f56 | 2016-12-29 22:16:30 +0000 | [diff] [blame] | 3032 | } |
| 3033 | |
Kelvin Li | 1851df5 | 2017-01-03 05:23:48 +0000 | [diff] [blame] | 3034 | void ASTStmtReader::VisitOMPTargetTeamsDistributeParallelForSimdDirective( |
| 3035 | OMPTargetTeamsDistributeParallelForSimdDirective *D) { |
| 3036 | VisitOMPLoopDirective(D); |
| 3037 | } |
| 3038 | |
Kelvin Li | da68118 | 2017-01-10 18:08:18 +0000 | [diff] [blame] | 3039 | void ASTStmtReader::VisitOMPTargetTeamsDistributeSimdDirective( |
| 3040 | OMPTargetTeamsDistributeSimdDirective *D) { |
| 3041 | VisitOMPLoopDirective(D); |
| 3042 | } |
| 3043 | |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 3044 | //===----------------------------------------------------------------------===// |
John McCall | fa19404 | 2011-07-15 07:00:14 +0000 | [diff] [blame] | 3045 | // ASTReader Implementation |
| 3046 | //===----------------------------------------------------------------------===// |
| 3047 | |
Douglas Gregor | de3ef50 | 2011-11-30 23:21:26 +0000 | [diff] [blame] | 3048 | Stmt *ASTReader::ReadStmt(ModuleFile &F) { |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 3049 | switch (ReadingKind) { |
Richard Smith | 629ff36 | 2013-07-31 00:26:46 +0000 | [diff] [blame] | 3050 | case Read_None: |
| 3051 | llvm_unreachable("should not call this when not reading anything"); |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 3052 | case Read_Decl: |
| 3053 | case Read_Type: |
Sebastian Redl | 2c373b9 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 3054 | return ReadStmtFromStream(F); |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 3055 | case Read_Stmt: |
Argyrios Kyrtzidis | 26d7201 | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 3056 | return ReadSubStmt(); |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 3057 | } |
| 3058 | |
| 3059 | llvm_unreachable("ReadingKind not set ?"); |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 3060 | } |
| 3061 | |
Douglas Gregor | de3ef50 | 2011-11-30 23:21:26 +0000 | [diff] [blame] | 3062 | Expr *ASTReader::ReadExpr(ModuleFile &F) { |
Sebastian Redl | 2c373b9 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 3063 | return cast_or_null<Expr>(ReadStmt(F)); |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 3064 | } |
Chris Lattner | e2437f4 | 2010-05-09 06:40:08 +0000 | [diff] [blame] | 3065 | |
Sebastian Redl | 2c499f6 | 2010-08-18 23:56:43 +0000 | [diff] [blame] | 3066 | Expr *ASTReader::ReadSubExpr() { |
Argyrios Kyrtzidis | 26d7201 | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 3067 | return cast_or_null<Expr>(ReadSubStmt()); |
| 3068 | } |
| 3069 | |
Chris Lattner | f426253 | 2009-04-27 05:41:06 +0000 | [diff] [blame] | 3070 | // Within the bitstream, expressions are stored in Reverse Polish |
| 3071 | // Notation, with each of the subexpressions preceding the |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 3072 | // expression they are stored in. Subexpressions are stored from last to first. |
| 3073 | // To evaluate expressions, we continue reading expressions and placing them on |
| 3074 | // the stack, with expressions having operands removing those operands from the |
Chris Lattner | f426253 | 2009-04-27 05:41:06 +0000 | [diff] [blame] | 3075 | // stack. Evaluation terminates when we see a STMT_STOP record, and |
| 3076 | // the single remaining expression on the stack is our result. |
Douglas Gregor | de3ef50 | 2011-11-30 23:21:26 +0000 | [diff] [blame] | 3077 | Stmt *ASTReader::ReadStmtFromStream(ModuleFile &F) { |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 3078 | ReadingKindTracker ReadingKind(Read_Stmt, *this); |
Sebastian Redl | 2c373b9 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 3079 | llvm::BitstreamCursor &Cursor = F.DeclsCursor; |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 3080 | |
Argyrios Kyrtzidis | 6a59897 | 2011-10-21 23:02:28 +0000 | [diff] [blame] | 3081 | // Map of offset to previously deserialized stmt. The offset points |
George Burgess IV | 758cf9d | 2017-02-14 05:52:57 +0000 | [diff] [blame] | 3082 | // just after the stmt record. |
Argyrios Kyrtzidis | 6a59897 | 2011-10-21 23:02:28 +0000 | [diff] [blame] | 3083 | llvm::DenseMap<uint64_t, Stmt *> StmtEntries; |
Sebastian Redl | 2c373b9 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 3084 | |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 3085 | #ifndef NDEBUG |
| 3086 | unsigned PrevNumStmts = StmtStack.size(); |
| 3087 | #endif |
| 3088 | |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 3089 | ASTRecordReader Record(*this, F); |
| 3090 | ASTStmtReader Reader(Record, Cursor); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3091 | Stmt::EmptyShell Empty; |
| 3092 | |
| 3093 | while (true) { |
Chris Lattner | 0e6c940 | 2013-01-20 02:38:54 +0000 | [diff] [blame] | 3094 | llvm::BitstreamEntry Entry = Cursor.advanceSkippingSubblocks(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 3095 | |
Chris Lattner | 0e6c940 | 2013-01-20 02:38:54 +0000 | [diff] [blame] | 3096 | switch (Entry.Kind) { |
| 3097 | case llvm::BitstreamEntry::SubBlock: // Handled for us already. |
| 3098 | case llvm::BitstreamEntry::Error: |
| 3099 | Error("malformed block record in AST file"); |
Craig Topper | a13603a | 2014-05-22 05:54:18 +0000 | [diff] [blame] | 3100 | return nullptr; |
Chris Lattner | 0e6c940 | 2013-01-20 02:38:54 +0000 | [diff] [blame] | 3101 | case llvm::BitstreamEntry::EndBlock: |
| 3102 | goto Done; |
| 3103 | case llvm::BitstreamEntry::Record: |
| 3104 | // The interesting case. |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3105 | break; |
| 3106 | } |
| 3107 | |
Richard Smith | dbafb6c | 2017-06-29 23:23:46 +0000 | [diff] [blame] | 3108 | ASTContext &Context = getContext(); |
Craig Topper | a13603a | 2014-05-22 05:54:18 +0000 | [diff] [blame] | 3109 | Stmt *S = nullptr; |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3110 | bool Finished = false; |
Argyrios Kyrtzidis | 6a59897 | 2011-10-21 23:02:28 +0000 | [diff] [blame] | 3111 | bool IsStmtReference = false; |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 3112 | switch ((StmtCode)Record.readRecord(Cursor, Entry.ID)) { |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3113 | case STMT_STOP: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3114 | Finished = true; |
| 3115 | break; |
| 3116 | |
Argyrios Kyrtzidis | 6a59897 | 2011-10-21 23:02:28 +0000 | [diff] [blame] | 3117 | case STMT_REF_PTR: |
| 3118 | IsStmtReference = true; |
| 3119 | assert(StmtEntries.find(Record[0]) != StmtEntries.end() && |
| 3120 | "No stmt was recorded for this offset reference!"); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 3121 | S = StmtEntries[Record.readInt()]; |
Argyrios Kyrtzidis | 6a59897 | 2011-10-21 23:02:28 +0000 | [diff] [blame] | 3122 | break; |
| 3123 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3124 | case STMT_NULL_PTR: |
Craig Topper | a13603a | 2014-05-22 05:54:18 +0000 | [diff] [blame] | 3125 | S = nullptr; |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3126 | break; |
| 3127 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3128 | case STMT_NULL: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3129 | S = new (Context) NullStmt(Empty); |
| 3130 | break; |
| 3131 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3132 | case STMT_COMPOUND: |
Benjamin Kramer | 0742090 | 2017-12-24 16:24:20 +0000 | [diff] [blame] | 3133 | S = CompoundStmt::CreateEmpty( |
| 3134 | Context, /*NumStmts=*/Record[ASTStmtReader::NumStmtFields]); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3135 | break; |
| 3136 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3137 | case STMT_CASE: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3138 | S = new (Context) CaseStmt(Empty); |
| 3139 | break; |
| 3140 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3141 | case STMT_DEFAULT: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3142 | S = new (Context) DefaultStmt(Empty); |
| 3143 | break; |
| 3144 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3145 | case STMT_LABEL: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3146 | S = new (Context) LabelStmt(Empty); |
| 3147 | break; |
| 3148 | |
Richard Smith | c202b28 | 2012-04-14 00:33:13 +0000 | [diff] [blame] | 3149 | case STMT_ATTRIBUTED: |
Alexander Kornienko | 20f6fc6 | 2012-07-09 10:04:07 +0000 | [diff] [blame] | 3150 | S = AttributedStmt::CreateEmpty( |
| 3151 | Context, |
| 3152 | /*NumAttrs*/Record[ASTStmtReader::NumStmtFields]); |
Richard Smith | c202b28 | 2012-04-14 00:33:13 +0000 | [diff] [blame] | 3153 | break; |
| 3154 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3155 | case STMT_IF: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3156 | S = new (Context) IfStmt(Empty); |
| 3157 | break; |
| 3158 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3159 | case STMT_SWITCH: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3160 | S = new (Context) SwitchStmt(Empty); |
| 3161 | break; |
| 3162 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3163 | case STMT_WHILE: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3164 | S = new (Context) WhileStmt(Empty); |
| 3165 | break; |
| 3166 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3167 | case STMT_DO: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3168 | S = new (Context) DoStmt(Empty); |
| 3169 | break; |
Mike Stump | 11289f4 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 3170 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3171 | case STMT_FOR: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3172 | S = new (Context) ForStmt(Empty); |
| 3173 | break; |
| 3174 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3175 | case STMT_GOTO: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3176 | S = new (Context) GotoStmt(Empty); |
| 3177 | break; |
Mike Stump | 11289f4 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 3178 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3179 | case STMT_INDIRECT_GOTO: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3180 | S = new (Context) IndirectGotoStmt(Empty); |
| 3181 | break; |
| 3182 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3183 | case STMT_CONTINUE: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3184 | S = new (Context) ContinueStmt(Empty); |
| 3185 | break; |
| 3186 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3187 | case STMT_BREAK: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3188 | S = new (Context) BreakStmt(Empty); |
| 3189 | break; |
| 3190 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3191 | case STMT_RETURN: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3192 | S = new (Context) ReturnStmt(Empty); |
| 3193 | break; |
| 3194 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3195 | case STMT_DECL: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3196 | S = new (Context) DeclStmt(Empty); |
| 3197 | break; |
| 3198 | |
Chad Rosier | de70e0e | 2012-08-25 00:11:56 +0000 | [diff] [blame] | 3199 | case STMT_GCCASM: |
| 3200 | S = new (Context) GCCAsmStmt(Empty); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3201 | break; |
| 3202 | |
Chad Rosier | e30d499 | 2012-08-24 23:51:02 +0000 | [diff] [blame] | 3203 | case STMT_MSASM: |
| 3204 | S = new (Context) MSAsmStmt(Empty); |
| 3205 | break; |
| 3206 | |
Tareq A. Siraj | 24110cc | 2013-04-16 18:53:08 +0000 | [diff] [blame] | 3207 | case STMT_CAPTURED: |
Ben Langmuir | ce914fc | 2013-05-03 19:20:19 +0000 | [diff] [blame] | 3208 | S = CapturedStmt::CreateDeserialized(Context, |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 3209 | Record[ASTStmtReader::NumStmtFields]); |
Tareq A. Siraj | 24110cc | 2013-04-16 18:53:08 +0000 | [diff] [blame] | 3210 | break; |
| 3211 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3212 | case EXPR_PREDEFINED: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3213 | S = new (Context) PredefinedExpr(Empty); |
| 3214 | break; |
Mike Stump | 11289f4 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 3215 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3216 | case EXPR_DECL_REF: |
Chandler Carruth | 8d26bb0 | 2011-05-01 23:48:14 +0000 | [diff] [blame] | 3217 | S = DeclRefExpr::CreateEmpty( |
Douglas Gregor | 4163aca | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 3218 | Context, |
Chandler Carruth | 8d26bb0 | 2011-05-01 23:48:14 +0000 | [diff] [blame] | 3219 | /*HasQualifier=*/Record[ASTStmtReader::NumExprFields], |
| 3220 | /*HasFoundDecl=*/Record[ASTStmtReader::NumExprFields + 1], |
Abramo Bagnara | 7945c98 | 2012-01-27 09:46:47 +0000 | [diff] [blame] | 3221 | /*HasTemplateKWAndArgsInfo=*/Record[ASTStmtReader::NumExprFields + 2], |
Chandler Carruth | 8d26bb0 | 2011-05-01 23:48:14 +0000 | [diff] [blame] | 3222 | /*NumTemplateArgs=*/Record[ASTStmtReader::NumExprFields + 2] ? |
John McCall | 113bee0 | 2012-03-10 09:33:50 +0000 | [diff] [blame] | 3223 | Record[ASTStmtReader::NumExprFields + 5] : 0); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3224 | break; |
Mike Stump | 11289f4 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 3225 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3226 | case EXPR_INTEGER_LITERAL: |
Douglas Gregor | 4163aca | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 3227 | S = IntegerLiteral::Create(Context, Empty); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3228 | break; |
Mike Stump | 11289f4 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 3229 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3230 | case EXPR_FLOATING_LITERAL: |
Douglas Gregor | 4163aca | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 3231 | S = FloatingLiteral::Create(Context, Empty); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3232 | break; |
Mike Stump | 11289f4 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 3233 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3234 | case EXPR_IMAGINARY_LITERAL: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3235 | S = new (Context) ImaginaryLiteral(Empty); |
| 3236 | break; |
| 3237 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3238 | case EXPR_STRING_LITERAL: |
Douglas Gregor | 4163aca | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 3239 | S = StringLiteral::CreateEmpty(Context, |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 3240 | Record[ASTStmtReader::NumExprFields + 1]); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3241 | break; |
| 3242 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3243 | case EXPR_CHARACTER_LITERAL: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3244 | S = new (Context) CharacterLiteral(Empty); |
| 3245 | break; |
| 3246 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3247 | case EXPR_PAREN: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3248 | S = new (Context) ParenExpr(Empty); |
| 3249 | break; |
| 3250 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3251 | case EXPR_PAREN_LIST: |
Argyrios Kyrtzidis | f9f47c8 | 2010-06-30 08:49:18 +0000 | [diff] [blame] | 3252 | S = new (Context) ParenListExpr(Empty); |
| 3253 | break; |
| 3254 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3255 | case EXPR_UNARY_OPERATOR: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3256 | S = new (Context) UnaryOperator(Empty); |
| 3257 | break; |
| 3258 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3259 | case EXPR_OFFSETOF: |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 3260 | S = OffsetOfExpr::CreateEmpty(Context, |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 3261 | Record[ASTStmtReader::NumExprFields], |
| 3262 | Record[ASTStmtReader::NumExprFields + 1]); |
Douglas Gregor | 882211c | 2010-04-28 22:16:22 +0000 | [diff] [blame] | 3263 | break; |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 3264 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3265 | case EXPR_SIZEOF_ALIGN_OF: |
Peter Collingbourne | e190dee | 2011-03-11 19:24:49 +0000 | [diff] [blame] | 3266 | S = new (Context) UnaryExprOrTypeTraitExpr(Empty); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3267 | break; |
| 3268 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3269 | case EXPR_ARRAY_SUBSCRIPT: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3270 | S = new (Context) ArraySubscriptExpr(Empty); |
| 3271 | break; |
| 3272 | |
Alexey Bataev | 1a3320e | 2015-08-25 14:24:04 +0000 | [diff] [blame] | 3273 | case EXPR_OMP_ARRAY_SECTION: |
| 3274 | S = new (Context) OMPArraySectionExpr(Empty); |
| 3275 | break; |
| 3276 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3277 | case EXPR_CALL: |
Douglas Gregor | 4163aca | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 3278 | S = new (Context) CallExpr(Context, Stmt::CallExprClass, Empty); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3279 | break; |
| 3280 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3281 | case EXPR_MEMBER: { |
Argyrios Kyrtzidis | 1985bb3 | 2010-07-08 13:09:47 +0000 | [diff] [blame] | 3282 | // We load everything here and fully initialize it at creation. |
| 3283 | // That way we can use MemberExpr::Create and don't have to duplicate its |
| 3284 | // logic with a MemberExpr::CreateEmpty. |
| 3285 | |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 3286 | assert(Record.getIdx() == 0); |
Douglas Gregor | ea972d3 | 2011-02-28 21:54:11 +0000 | [diff] [blame] | 3287 | NestedNameSpecifierLoc QualifierLoc; |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 3288 | if (Record.readInt()) { // HasQualifier. |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 3289 | QualifierLoc = Record.readNestedNameSpecifierLoc(); |
Argyrios Kyrtzidis | 1985bb3 | 2010-07-08 13:09:47 +0000 | [diff] [blame] | 3290 | } |
| 3291 | |
Abramo Bagnara | 7945c98 | 2012-01-27 09:46:47 +0000 | [diff] [blame] | 3292 | SourceLocation TemplateKWLoc; |
Argyrios Kyrtzidis | 1985bb3 | 2010-07-08 13:09:47 +0000 | [diff] [blame] | 3293 | TemplateArgumentListInfo ArgInfo; |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 3294 | bool HasTemplateKWAndArgsInfo = Record.readInt(); |
Abramo Bagnara | 7945c98 | 2012-01-27 09:46:47 +0000 | [diff] [blame] | 3295 | if (HasTemplateKWAndArgsInfo) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 3296 | TemplateKWLoc = Record.readSourceLocation(); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 3297 | unsigned NumTemplateArgs = Record.readInt(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 3298 | ArgInfo.setLAngleLoc(Record.readSourceLocation()); |
| 3299 | ArgInfo.setRAngleLoc(Record.readSourceLocation()); |
Argyrios Kyrtzidis | 1985bb3 | 2010-07-08 13:09:47 +0000 | [diff] [blame] | 3300 | for (unsigned i = 0; i != NumTemplateArgs; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 3301 | ArgInfo.addArgument(Record.readTemplateArgumentLoc()); |
Argyrios Kyrtzidis | 1985bb3 | 2010-07-08 13:09:47 +0000 | [diff] [blame] | 3302 | } |
Abramo Bagnara | 635ed24e | 2011-10-05 07:56:41 +0000 | [diff] [blame] | 3303 | |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 3304 | bool HadMultipleCandidates = Record.readInt(); |
Abramo Bagnara | 635ed24e | 2011-10-05 07:56:41 +0000 | [diff] [blame] | 3305 | |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3306 | auto *FoundD = Record.readDeclAs<NamedDecl>(); |
| 3307 | auto AS = (AccessSpecifier)Record.readInt(); |
Argyrios Kyrtzidis | 1985bb3 | 2010-07-08 13:09:47 +0000 | [diff] [blame] | 3308 | DeclAccessPair FoundDecl = DeclAccessPair::make(FoundD, AS); |
| 3309 | |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 3310 | QualType T = Record.readType(); |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3311 | auto VK = static_cast<ExprValueKind>(Record.readInt()); |
| 3312 | auto OK = static_cast<ExprObjectKind>(Record.readInt()); |
Argyrios Kyrtzidis | 1985bb3 | 2010-07-08 13:09:47 +0000 | [diff] [blame] | 3313 | Expr *Base = ReadSubExpr(); |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3314 | auto *MemberD = Record.readDeclAs<ValueDecl>(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 3315 | SourceLocation MemberLoc = Record.readSourceLocation(); |
Yunzhong Gao | eba323a | 2015-05-01 02:04:32 +0000 | [diff] [blame] | 3316 | DeclarationNameInfo MemberNameInfo(MemberD->getDeclName(), MemberLoc); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 3317 | bool IsArrow = Record.readInt(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 3318 | SourceLocation OperatorLoc = Record.readSourceLocation(); |
Yunzhong Gao | eba323a | 2015-05-01 02:04:32 +0000 | [diff] [blame] | 3319 | |
| 3320 | S = MemberExpr::Create(Context, Base, IsArrow, OperatorLoc, QualifierLoc, |
| 3321 | TemplateKWLoc, MemberD, FoundDecl, MemberNameInfo, |
| 3322 | HasTemplateKWAndArgsInfo ? &ArgInfo : nullptr, T, |
| 3323 | VK, OK); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 3324 | Record.readDeclarationNameLoc(cast<MemberExpr>(S)->MemberDNLoc, |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 3325 | MemberD->getDeclName()); |
Yunzhong Gao | eba323a | 2015-05-01 02:04:32 +0000 | [diff] [blame] | 3326 | if (HadMultipleCandidates) |
Abramo Bagnara | 635ed24e | 2011-10-05 07:56:41 +0000 | [diff] [blame] | 3327 | cast<MemberExpr>(S)->setHadMultipleCandidates(true); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3328 | break; |
Argyrios Kyrtzidis | 1985bb3 | 2010-07-08 13:09:47 +0000 | [diff] [blame] | 3329 | } |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3330 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3331 | case EXPR_BINARY_OPERATOR: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3332 | S = new (Context) BinaryOperator(Empty); |
| 3333 | break; |
| 3334 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3335 | case EXPR_COMPOUND_ASSIGN_OPERATOR: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3336 | S = new (Context) CompoundAssignOperator(Empty); |
| 3337 | break; |
| 3338 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3339 | case EXPR_CONDITIONAL_OPERATOR: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3340 | S = new (Context) ConditionalOperator(Empty); |
| 3341 | break; |
| 3342 | |
John McCall | c07a0c7 | 2011-02-17 10:25:35 +0000 | [diff] [blame] | 3343 | case EXPR_BINARY_CONDITIONAL_OPERATOR: |
| 3344 | S = new (Context) BinaryConditionalOperator(Empty); |
| 3345 | break; |
| 3346 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3347 | case EXPR_IMPLICIT_CAST: |
Douglas Gregor | 4163aca | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 3348 | S = ImplicitCastExpr::CreateEmpty(Context, |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 3349 | /*PathSize*/ Record[ASTStmtReader::NumExprFields]); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3350 | break; |
| 3351 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3352 | case EXPR_CSTYLE_CAST: |
Douglas Gregor | 4163aca | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 3353 | S = CStyleCastExpr::CreateEmpty(Context, |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 3354 | /*PathSize*/ Record[ASTStmtReader::NumExprFields]); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3355 | break; |
| 3356 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3357 | case EXPR_COMPOUND_LITERAL: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3358 | S = new (Context) CompoundLiteralExpr(Empty); |
| 3359 | break; |
| 3360 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3361 | case EXPR_EXT_VECTOR_ELEMENT: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3362 | S = new (Context) ExtVectorElementExpr(Empty); |
| 3363 | break; |
| 3364 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3365 | case EXPR_INIT_LIST: |
Argyrios Kyrtzidis | 0f05fb9 | 2012-11-28 03:56:16 +0000 | [diff] [blame] | 3366 | S = new (Context) InitListExpr(Empty); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3367 | break; |
| 3368 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3369 | case EXPR_DESIGNATED_INIT: |
Douglas Gregor | 4163aca | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 3370 | S = DesignatedInitExpr::CreateEmpty(Context, |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 3371 | Record[ASTStmtReader::NumExprFields] - 1); |
Mike Stump | 11289f4 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 3372 | |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3373 | break; |
| 3374 | |
Yunzhong Gao | cb77930 | 2015-06-10 00:27:52 +0000 | [diff] [blame] | 3375 | case EXPR_DESIGNATED_INIT_UPDATE: |
| 3376 | S = new (Context) DesignatedInitUpdateExpr(Empty); |
| 3377 | break; |
| 3378 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3379 | case EXPR_IMPLICIT_VALUE_INIT: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3380 | S = new (Context) ImplicitValueInitExpr(Empty); |
| 3381 | break; |
| 3382 | |
Yunzhong Gao | cb77930 | 2015-06-10 00:27:52 +0000 | [diff] [blame] | 3383 | case EXPR_NO_INIT: |
| 3384 | S = new (Context) NoInitExpr(Empty); |
| 3385 | break; |
| 3386 | |
Richard Smith | 410306b | 2016-12-12 02:53:20 +0000 | [diff] [blame] | 3387 | case EXPR_ARRAY_INIT_LOOP: |
| 3388 | S = new (Context) ArrayInitLoopExpr(Empty); |
| 3389 | break; |
| 3390 | |
| 3391 | case EXPR_ARRAY_INIT_INDEX: |
| 3392 | S = new (Context) ArrayInitIndexExpr(Empty); |
| 3393 | break; |
| 3394 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3395 | case EXPR_VA_ARG: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3396 | S = new (Context) VAArgExpr(Empty); |
| 3397 | break; |
| 3398 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3399 | case EXPR_ADDR_LABEL: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3400 | S = new (Context) AddrLabelExpr(Empty); |
| 3401 | break; |
| 3402 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3403 | case EXPR_STMT: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3404 | S = new (Context) StmtExpr(Empty); |
| 3405 | break; |
| 3406 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3407 | case EXPR_CHOOSE: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3408 | S = new (Context) ChooseExpr(Empty); |
| 3409 | break; |
| 3410 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3411 | case EXPR_GNU_NULL: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3412 | S = new (Context) GNUNullExpr(Empty); |
| 3413 | break; |
| 3414 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3415 | case EXPR_SHUFFLE_VECTOR: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3416 | S = new (Context) ShuffleVectorExpr(Empty); |
| 3417 | break; |
Mike Stump | 11289f4 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 3418 | |
Hal Finkel | c4d7c82 | 2013-09-18 03:29:45 +0000 | [diff] [blame] | 3419 | case EXPR_CONVERT_VECTOR: |
| 3420 | S = new (Context) ConvertVectorExpr(Empty); |
| 3421 | break; |
| 3422 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3423 | case EXPR_BLOCK: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3424 | S = new (Context) BlockExpr(Empty); |
| 3425 | break; |
| 3426 | |
Peter Collingbourne | 9114759 | 2011-04-15 00:35:48 +0000 | [diff] [blame] | 3427 | case EXPR_GENERIC_SELECTION: |
| 3428 | S = new (Context) GenericSelectionExpr(Empty); |
| 3429 | break; |
| 3430 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3431 | case EXPR_OBJC_STRING_LITERAL: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3432 | S = new (Context) ObjCStringLiteral(Empty); |
| 3433 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3434 | |
Patrick Beard | 0caa394 | 2012-04-19 00:25:12 +0000 | [diff] [blame] | 3435 | case EXPR_OBJC_BOXED_EXPRESSION: |
| 3436 | S = new (Context) ObjCBoxedExpr(Empty); |
Ted Kremenek | e65b086 | 2012-03-06 20:05:56 +0000 | [diff] [blame] | 3437 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3438 | |
Ted Kremenek | e65b086 | 2012-03-06 20:05:56 +0000 | [diff] [blame] | 3439 | case EXPR_OBJC_ARRAY_LITERAL: |
| 3440 | S = ObjCArrayLiteral::CreateEmpty(Context, |
| 3441 | Record[ASTStmtReader::NumExprFields]); |
| 3442 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3443 | |
Ted Kremenek | e65b086 | 2012-03-06 20:05:56 +0000 | [diff] [blame] | 3444 | case EXPR_OBJC_DICTIONARY_LITERAL: |
| 3445 | S = ObjCDictionaryLiteral::CreateEmpty(Context, |
| 3446 | Record[ASTStmtReader::NumExprFields], |
| 3447 | Record[ASTStmtReader::NumExprFields + 1]); |
| 3448 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3449 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3450 | case EXPR_OBJC_ENCODE: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3451 | S = new (Context) ObjCEncodeExpr(Empty); |
| 3452 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3453 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3454 | case EXPR_OBJC_SELECTOR_EXPR: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3455 | S = new (Context) ObjCSelectorExpr(Empty); |
| 3456 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3457 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3458 | case EXPR_OBJC_PROTOCOL_EXPR: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3459 | S = new (Context) ObjCProtocolExpr(Empty); |
| 3460 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3461 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3462 | case EXPR_OBJC_IVAR_REF_EXPR: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3463 | S = new (Context) ObjCIvarRefExpr(Empty); |
| 3464 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3465 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3466 | case EXPR_OBJC_PROPERTY_REF_EXPR: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3467 | S = new (Context) ObjCPropertyRefExpr(Empty); |
| 3468 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3469 | |
Ted Kremenek | e65b086 | 2012-03-06 20:05:56 +0000 | [diff] [blame] | 3470 | case EXPR_OBJC_SUBSCRIPT_REF_EXPR: |
| 3471 | S = new (Context) ObjCSubscriptRefExpr(Empty); |
| 3472 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3473 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3474 | case EXPR_OBJC_KVC_REF_EXPR: |
John McCall | b7bd14f | 2010-12-02 01:19:52 +0000 | [diff] [blame] | 3475 | llvm_unreachable("mismatching AST file"); |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3476 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3477 | case EXPR_OBJC_MESSAGE_EXPR: |
Douglas Gregor | 4163aca | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 3478 | S = ObjCMessageExpr::CreateEmpty(Context, |
Argyrios Kyrtzidis | a6011e2 | 2011-10-03 06:36:51 +0000 | [diff] [blame] | 3479 | Record[ASTStmtReader::NumExprFields], |
| 3480 | Record[ASTStmtReader::NumExprFields + 1]); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3481 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3482 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3483 | case EXPR_OBJC_ISA: |
Steve Naroff | e87026a | 2009-07-24 17:54:45 +0000 | [diff] [blame] | 3484 | S = new (Context) ObjCIsaExpr(Empty); |
| 3485 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3486 | |
John McCall | 31168b0 | 2011-06-15 23:02:42 +0000 | [diff] [blame] | 3487 | case EXPR_OBJC_INDIRECT_COPY_RESTORE: |
| 3488 | S = new (Context) ObjCIndirectCopyRestoreExpr(Empty); |
| 3489 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3490 | |
John McCall | 31168b0 | 2011-06-15 23:02:42 +0000 | [diff] [blame] | 3491 | case EXPR_OBJC_BRIDGED_CAST: |
| 3492 | S = new (Context) ObjCBridgedCastExpr(Empty); |
| 3493 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3494 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3495 | case STMT_OBJC_FOR_COLLECTION: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3496 | S = new (Context) ObjCForCollectionStmt(Empty); |
| 3497 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3498 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3499 | case STMT_OBJC_CATCH: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3500 | S = new (Context) ObjCAtCatchStmt(Empty); |
| 3501 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3502 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3503 | case STMT_OBJC_FINALLY: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3504 | S = new (Context) ObjCAtFinallyStmt(Empty); |
| 3505 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3506 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3507 | case STMT_OBJC_AT_TRY: |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 3508 | S = ObjCAtTryStmt::CreateEmpty(Context, |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 3509 | Record[ASTStmtReader::NumStmtFields], |
| 3510 | Record[ASTStmtReader::NumStmtFields + 1]); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3511 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3512 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3513 | case STMT_OBJC_AT_SYNCHRONIZED: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3514 | S = new (Context) ObjCAtSynchronizedStmt(Empty); |
| 3515 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3516 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3517 | case STMT_OBJC_AT_THROW: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3518 | S = new (Context) ObjCAtThrowStmt(Empty); |
| 3519 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3520 | |
John McCall | 31168b0 | 2011-06-15 23:02:42 +0000 | [diff] [blame] | 3521 | case STMT_OBJC_AUTORELEASE_POOL: |
| 3522 | S = new (Context) ObjCAutoreleasePoolStmt(Empty); |
| 3523 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3524 | |
Ted Kremenek | e65b086 | 2012-03-06 20:05:56 +0000 | [diff] [blame] | 3525 | case EXPR_OBJC_BOOL_LITERAL: |
| 3526 | S = new (Context) ObjCBoolLiteralExpr(Empty); |
| 3527 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3528 | |
Erik Pilkington | 29099de | 2016-07-16 00:35:23 +0000 | [diff] [blame] | 3529 | case EXPR_OBJC_AVAILABILITY_CHECK: |
| 3530 | S = new (Context) ObjCAvailabilityCheckExpr(Empty); |
| 3531 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3532 | |
Nico Weber | 9b98207 | 2014-07-07 00:12:30 +0000 | [diff] [blame] | 3533 | case STMT_SEH_LEAVE: |
| 3534 | S = new (Context) SEHLeaveStmt(Empty); |
| 3535 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3536 | |
John McCall | fa19404 | 2011-07-15 07:00:14 +0000 | [diff] [blame] | 3537 | case STMT_SEH_EXCEPT: |
| 3538 | S = new (Context) SEHExceptStmt(Empty); |
| 3539 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3540 | |
John McCall | fa19404 | 2011-07-15 07:00:14 +0000 | [diff] [blame] | 3541 | case STMT_SEH_FINALLY: |
| 3542 | S = new (Context) SEHFinallyStmt(Empty); |
| 3543 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3544 | |
John McCall | fa19404 | 2011-07-15 07:00:14 +0000 | [diff] [blame] | 3545 | case STMT_SEH_TRY: |
| 3546 | S = new (Context) SEHTryStmt(Empty); |
| 3547 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3548 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3549 | case STMT_CXX_CATCH: |
Argyrios Kyrtzidis | 47cd7a9 | 2010-07-22 16:03:56 +0000 | [diff] [blame] | 3550 | S = new (Context) CXXCatchStmt(Empty); |
| 3551 | break; |
| 3552 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3553 | case STMT_CXX_TRY: |
Douglas Gregor | 4163aca | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 3554 | S = CXXTryStmt::Create(Context, Empty, |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 3555 | /*NumHandlers=*/Record[ASTStmtReader::NumStmtFields]); |
Argyrios Kyrtzidis | 47cd7a9 | 2010-07-22 16:03:56 +0000 | [diff] [blame] | 3556 | break; |
| 3557 | |
Richard Smith | 02e85f3 | 2011-04-14 22:09:26 +0000 | [diff] [blame] | 3558 | case STMT_CXX_FOR_RANGE: |
| 3559 | S = new (Context) CXXForRangeStmt(Empty); |
| 3560 | break; |
| 3561 | |
Douglas Gregor | deb4a2be | 2011-10-25 01:33:02 +0000 | [diff] [blame] | 3562 | case STMT_MS_DEPENDENT_EXISTS: |
| 3563 | S = new (Context) MSDependentExistsStmt(SourceLocation(), true, |
| 3564 | NestedNameSpecifierLoc(), |
| 3565 | DeclarationNameInfo(), |
Craig Topper | a13603a | 2014-05-22 05:54:18 +0000 | [diff] [blame] | 3566 | nullptr); |
Douglas Gregor | deb4a2be | 2011-10-25 01:33:02 +0000 | [diff] [blame] | 3567 | break; |
Alexey Bataev | 1b59ab5 | 2014-02-27 08:29:12 +0000 | [diff] [blame] | 3568 | |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 3569 | case STMT_OMP_PARALLEL_DIRECTIVE: |
| 3570 | S = |
| 3571 | OMPParallelDirective::CreateEmpty(Context, |
| 3572 | Record[ASTStmtReader::NumStmtFields], |
| 3573 | Empty); |
| 3574 | break; |
Alexey Bataev | 1b59ab5 | 2014-02-27 08:29:12 +0000 | [diff] [blame] | 3575 | |
| 3576 | case STMT_OMP_SIMD_DIRECTIVE: { |
| 3577 | unsigned NumClauses = Record[ASTStmtReader::NumStmtFields]; |
| 3578 | unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1]; |
| 3579 | S = OMPSimdDirective::CreateEmpty(Context, NumClauses, |
| 3580 | CollapsedNum, Empty); |
| 3581 | break; |
| 3582 | } |
| 3583 | |
Alexey Bataev | f29276e | 2014-06-18 04:14:57 +0000 | [diff] [blame] | 3584 | case STMT_OMP_FOR_DIRECTIVE: { |
| 3585 | unsigned NumClauses = Record[ASTStmtReader::NumStmtFields]; |
| 3586 | unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1]; |
| 3587 | S = OMPForDirective::CreateEmpty(Context, NumClauses, CollapsedNum, |
| 3588 | Empty); |
| 3589 | break; |
| 3590 | } |
| 3591 | |
Alexander Musman | f82886e | 2014-09-18 05:12:34 +0000 | [diff] [blame] | 3592 | case STMT_OMP_FOR_SIMD_DIRECTIVE: { |
| 3593 | unsigned NumClauses = Record[ASTStmtReader::NumStmtFields]; |
| 3594 | unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1]; |
| 3595 | S = OMPForSimdDirective::CreateEmpty(Context, NumClauses, CollapsedNum, |
| 3596 | Empty); |
| 3597 | break; |
| 3598 | } |
| 3599 | |
Alexey Bataev | d3f8dd2 | 2014-06-25 11:44:49 +0000 | [diff] [blame] | 3600 | case STMT_OMP_SECTIONS_DIRECTIVE: |
| 3601 | S = OMPSectionsDirective::CreateEmpty( |
| 3602 | Context, Record[ASTStmtReader::NumStmtFields], Empty); |
| 3603 | break; |
| 3604 | |
Alexey Bataev | 1e0498a | 2014-06-26 08:21:58 +0000 | [diff] [blame] | 3605 | case STMT_OMP_SECTION_DIRECTIVE: |
| 3606 | S = OMPSectionDirective::CreateEmpty(Context, Empty); |
| 3607 | break; |
| 3608 | |
Alexey Bataev | d1e40fb | 2014-06-26 12:05:45 +0000 | [diff] [blame] | 3609 | case STMT_OMP_SINGLE_DIRECTIVE: |
| 3610 | S = OMPSingleDirective::CreateEmpty( |
| 3611 | Context, Record[ASTStmtReader::NumStmtFields], Empty); |
| 3612 | break; |
| 3613 | |
Alexander Musman | 80c2289 | 2014-07-17 08:54:58 +0000 | [diff] [blame] | 3614 | case STMT_OMP_MASTER_DIRECTIVE: |
| 3615 | S = OMPMasterDirective::CreateEmpty(Context, Empty); |
| 3616 | break; |
| 3617 | |
Alexander Musman | d9ed09f | 2014-07-21 09:42:05 +0000 | [diff] [blame] | 3618 | case STMT_OMP_CRITICAL_DIRECTIVE: |
Alexey Bataev | 28c7541 | 2015-12-15 08:19:24 +0000 | [diff] [blame] | 3619 | S = OMPCriticalDirective::CreateEmpty( |
| 3620 | Context, Record[ASTStmtReader::NumStmtFields], Empty); |
Alexander Musman | d9ed09f | 2014-07-21 09:42:05 +0000 | [diff] [blame] | 3621 | break; |
| 3622 | |
Alexey Bataev | 4acb859 | 2014-07-07 13:01:15 +0000 | [diff] [blame] | 3623 | case STMT_OMP_PARALLEL_FOR_DIRECTIVE: { |
| 3624 | unsigned NumClauses = Record[ASTStmtReader::NumStmtFields]; |
| 3625 | unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1]; |
| 3626 | S = OMPParallelForDirective::CreateEmpty(Context, NumClauses, |
| 3627 | CollapsedNum, Empty); |
| 3628 | break; |
| 3629 | } |
| 3630 | |
Alexander Musman | e4e893b | 2014-09-23 09:33:00 +0000 | [diff] [blame] | 3631 | case STMT_OMP_PARALLEL_FOR_SIMD_DIRECTIVE: { |
| 3632 | unsigned NumClauses = Record[ASTStmtReader::NumStmtFields]; |
| 3633 | unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1]; |
| 3634 | S = OMPParallelForSimdDirective::CreateEmpty(Context, NumClauses, |
| 3635 | CollapsedNum, Empty); |
| 3636 | break; |
| 3637 | } |
| 3638 | |
Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 3639 | case STMT_OMP_PARALLEL_SECTIONS_DIRECTIVE: |
| 3640 | S = OMPParallelSectionsDirective::CreateEmpty( |
| 3641 | Context, Record[ASTStmtReader::NumStmtFields], Empty); |
| 3642 | break; |
| 3643 | |
Alexey Bataev | 9c2e8ee | 2014-07-11 11:25:16 +0000 | [diff] [blame] | 3644 | case STMT_OMP_TASK_DIRECTIVE: |
| 3645 | S = OMPTaskDirective::CreateEmpty( |
| 3646 | Context, Record[ASTStmtReader::NumStmtFields], Empty); |
| 3647 | break; |
| 3648 | |
Alexey Bataev | 68446b7 | 2014-07-18 07:47:19 +0000 | [diff] [blame] | 3649 | case STMT_OMP_TASKYIELD_DIRECTIVE: |
| 3650 | S = OMPTaskyieldDirective::CreateEmpty(Context, Empty); |
| 3651 | break; |
| 3652 | |
Alexey Bataev | 4d1dfea | 2014-07-18 09:11:51 +0000 | [diff] [blame] | 3653 | case STMT_OMP_BARRIER_DIRECTIVE: |
| 3654 | S = OMPBarrierDirective::CreateEmpty(Context, Empty); |
| 3655 | break; |
| 3656 | |
Alexey Bataev | 2df347a | 2014-07-18 10:17:07 +0000 | [diff] [blame] | 3657 | case STMT_OMP_TASKWAIT_DIRECTIVE: |
| 3658 | S = OMPTaskwaitDirective::CreateEmpty(Context, Empty); |
| 3659 | break; |
| 3660 | |
Alexey Bataev | c30dd2d | 2015-06-18 12:14:09 +0000 | [diff] [blame] | 3661 | case STMT_OMP_TASKGROUP_DIRECTIVE: |
Alexey Bataev | 169d96a | 2017-07-18 20:17:46 +0000 | [diff] [blame] | 3662 | S = OMPTaskgroupDirective::CreateEmpty( |
| 3663 | Context, Record[ASTStmtReader::NumStmtFields], Empty); |
Alexey Bataev | c30dd2d | 2015-06-18 12:14:09 +0000 | [diff] [blame] | 3664 | break; |
| 3665 | |
Alexey Bataev | 6125da9 | 2014-07-21 11:26:11 +0000 | [diff] [blame] | 3666 | case STMT_OMP_FLUSH_DIRECTIVE: |
| 3667 | S = OMPFlushDirective::CreateEmpty( |
| 3668 | Context, Record[ASTStmtReader::NumStmtFields], Empty); |
| 3669 | break; |
| 3670 | |
Alexey Bataev | 9fb6e64 | 2014-07-22 06:45:04 +0000 | [diff] [blame] | 3671 | case STMT_OMP_ORDERED_DIRECTIVE: |
Alexey Bataev | 346265e | 2015-09-25 10:37:12 +0000 | [diff] [blame] | 3672 | S = OMPOrderedDirective::CreateEmpty( |
| 3673 | Context, Record[ASTStmtReader::NumStmtFields], Empty); |
Alexey Bataev | 9fb6e64 | 2014-07-22 06:45:04 +0000 | [diff] [blame] | 3674 | break; |
| 3675 | |
Alexey Bataev | 0162e45 | 2014-07-22 10:10:35 +0000 | [diff] [blame] | 3676 | case STMT_OMP_ATOMIC_DIRECTIVE: |
| 3677 | S = OMPAtomicDirective::CreateEmpty( |
| 3678 | Context, Record[ASTStmtReader::NumStmtFields], Empty); |
| 3679 | break; |
| 3680 | |
Alexey Bataev | 0bd520b | 2014-09-19 08:19:49 +0000 | [diff] [blame] | 3681 | case STMT_OMP_TARGET_DIRECTIVE: |
| 3682 | S = OMPTargetDirective::CreateEmpty( |
| 3683 | Context, Record[ASTStmtReader::NumStmtFields], Empty); |
| 3684 | break; |
| 3685 | |
Michael Wong | 65f367f | 2015-07-21 13:44:28 +0000 | [diff] [blame] | 3686 | case STMT_OMP_TARGET_DATA_DIRECTIVE: |
| 3687 | S = OMPTargetDataDirective::CreateEmpty( |
| 3688 | Context, Record[ASTStmtReader::NumStmtFields], Empty); |
| 3689 | break; |
| 3690 | |
Samuel Antao | df67fc4 | 2016-01-19 19:15:56 +0000 | [diff] [blame] | 3691 | case STMT_OMP_TARGET_ENTER_DATA_DIRECTIVE: |
| 3692 | S = OMPTargetEnterDataDirective::CreateEmpty( |
| 3693 | Context, Record[ASTStmtReader::NumStmtFields], Empty); |
| 3694 | break; |
| 3695 | |
Samuel Antao | 7259076 | 2016-01-19 20:04:50 +0000 | [diff] [blame] | 3696 | case STMT_OMP_TARGET_EXIT_DATA_DIRECTIVE: |
| 3697 | S = OMPTargetExitDataDirective::CreateEmpty( |
| 3698 | Context, Record[ASTStmtReader::NumStmtFields], Empty); |
| 3699 | break; |
| 3700 | |
Arpith Chacko Jacob | e955b3d | 2016-01-26 18:48:41 +0000 | [diff] [blame] | 3701 | case STMT_OMP_TARGET_PARALLEL_DIRECTIVE: |
| 3702 | S = OMPTargetParallelDirective::CreateEmpty( |
| 3703 | Context, Record[ASTStmtReader::NumStmtFields], Empty); |
| 3704 | break; |
| 3705 | |
Arpith Chacko Jacob | 05bebb5 | 2016-02-03 15:46:42 +0000 | [diff] [blame] | 3706 | case STMT_OMP_TARGET_PARALLEL_FOR_DIRECTIVE: { |
| 3707 | unsigned NumClauses = Record[ASTStmtReader::NumStmtFields]; |
| 3708 | unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1]; |
| 3709 | S = OMPTargetParallelForDirective::CreateEmpty(Context, NumClauses, |
| 3710 | CollapsedNum, Empty); |
| 3711 | break; |
| 3712 | } |
| 3713 | |
Samuel Antao | 686c70c | 2016-05-26 17:30:50 +0000 | [diff] [blame] | 3714 | case STMT_OMP_TARGET_UPDATE_DIRECTIVE: |
| 3715 | S = OMPTargetUpdateDirective::CreateEmpty( |
| 3716 | Context, Record[ASTStmtReader::NumStmtFields], Empty); |
| 3717 | break; |
| 3718 | |
Alexey Bataev | 13314bf | 2014-10-09 04:18:56 +0000 | [diff] [blame] | 3719 | case STMT_OMP_TEAMS_DIRECTIVE: |
| 3720 | S = OMPTeamsDirective::CreateEmpty( |
| 3721 | Context, Record[ASTStmtReader::NumStmtFields], Empty); |
| 3722 | break; |
| 3723 | |
Alexey Bataev | 6d4ed05 | 2015-07-01 06:57:41 +0000 | [diff] [blame] | 3724 | case STMT_OMP_CANCELLATION_POINT_DIRECTIVE: |
| 3725 | S = OMPCancellationPointDirective::CreateEmpty(Context, Empty); |
| 3726 | break; |
| 3727 | |
Alexey Bataev | 8090987 | 2015-07-02 11:25:17 +0000 | [diff] [blame] | 3728 | case STMT_OMP_CANCEL_DIRECTIVE: |
Alexey Bataev | 87933c7 | 2015-09-18 08:07:34 +0000 | [diff] [blame] | 3729 | S = OMPCancelDirective::CreateEmpty( |
| 3730 | Context, Record[ASTStmtReader::NumStmtFields], Empty); |
Alexey Bataev | 8090987 | 2015-07-02 11:25:17 +0000 | [diff] [blame] | 3731 | break; |
| 3732 | |
Alexey Bataev | 49f6e78 | 2015-12-01 04:18:41 +0000 | [diff] [blame] | 3733 | case STMT_OMP_TASKLOOP_DIRECTIVE: { |
| 3734 | unsigned NumClauses = Record[ASTStmtReader::NumStmtFields]; |
| 3735 | unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1]; |
| 3736 | S = OMPTaskLoopDirective::CreateEmpty(Context, NumClauses, CollapsedNum, |
| 3737 | Empty); |
| 3738 | break; |
| 3739 | } |
| 3740 | |
Alexey Bataev | 0a6ed84 | 2015-12-03 09:40:15 +0000 | [diff] [blame] | 3741 | case STMT_OMP_TASKLOOP_SIMD_DIRECTIVE: { |
| 3742 | unsigned NumClauses = Record[ASTStmtReader::NumStmtFields]; |
| 3743 | unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1]; |
| 3744 | S = OMPTaskLoopSimdDirective::CreateEmpty(Context, NumClauses, |
| 3745 | CollapsedNum, Empty); |
| 3746 | break; |
| 3747 | } |
| 3748 | |
Carlo Bertolli | 6200a3d | 2015-12-14 14:51:25 +0000 | [diff] [blame] | 3749 | case STMT_OMP_DISTRIBUTE_DIRECTIVE: { |
| 3750 | unsigned NumClauses = Record[ASTStmtReader::NumStmtFields]; |
| 3751 | unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1]; |
| 3752 | S = OMPDistributeDirective::CreateEmpty(Context, NumClauses, CollapsedNum, |
| 3753 | Empty); |
| 3754 | break; |
| 3755 | } |
| 3756 | |
Carlo Bertolli | 9925f15 | 2016-06-27 14:55:37 +0000 | [diff] [blame] | 3757 | case STMT_OMP_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE: { |
| 3758 | unsigned NumClauses = Record[ASTStmtReader::NumStmtFields]; |
| 3759 | unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1]; |
| 3760 | S = OMPDistributeParallelForDirective::CreateEmpty(Context, NumClauses, |
| 3761 | CollapsedNum, Empty); |
| 3762 | break; |
| 3763 | } |
| 3764 | |
Kelvin Li | 4a39add | 2016-07-05 05:00:15 +0000 | [diff] [blame] | 3765 | case STMT_OMP_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE: { |
| 3766 | unsigned NumClauses = Record[ASTStmtReader::NumStmtFields]; |
| 3767 | unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1]; |
| 3768 | S = OMPDistributeParallelForSimdDirective::CreateEmpty(Context, NumClauses, |
| 3769 | CollapsedNum, |
| 3770 | Empty); |
| 3771 | break; |
| 3772 | } |
| 3773 | |
Kelvin Li | 787f3fc | 2016-07-06 04:45:38 +0000 | [diff] [blame] | 3774 | case STMT_OMP_DISTRIBUTE_SIMD_DIRECTIVE: { |
| 3775 | unsigned NumClauses = Record[ASTStmtReader::NumStmtFields]; |
| 3776 | unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1]; |
| 3777 | S = OMPDistributeSimdDirective::CreateEmpty(Context, NumClauses, |
| 3778 | CollapsedNum, Empty); |
| 3779 | break; |
| 3780 | } |
| 3781 | |
Kelvin Li | a579b91 | 2016-07-14 02:54:56 +0000 | [diff] [blame] | 3782 | case STMT_OMP_TARGET_PARALLEL_FOR_SIMD_DIRECTIVE: { |
| 3783 | unsigned NumClauses = Record[ASTStmtReader::NumStmtFields]; |
| 3784 | unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1]; |
| 3785 | S = OMPTargetParallelForSimdDirective::CreateEmpty(Context, NumClauses, |
| 3786 | CollapsedNum, Empty); |
| 3787 | break; |
| 3788 | } |
| 3789 | |
Kelvin Li | 986330c | 2016-07-20 22:57:10 +0000 | [diff] [blame] | 3790 | case STMT_OMP_TARGET_SIMD_DIRECTIVE: { |
| 3791 | auto NumClauses = Record[ASTStmtReader::NumStmtFields]; |
| 3792 | auto CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1]; |
| 3793 | S = OMPTargetSimdDirective::CreateEmpty(Context, NumClauses, CollapsedNum, |
| 3794 | Empty); |
| 3795 | break; |
| 3796 | } |
| 3797 | |
Kelvin Li | 83c451e | 2016-12-25 04:52:54 +0000 | [diff] [blame] | 3798 | case STMT_OMP_TEAMS_DISTRIBUTE_DIRECTIVE: { |
Kelvin Li | 0253287 | 2016-08-05 14:37:37 +0000 | [diff] [blame] | 3799 | auto NumClauses = Record[ASTStmtReader::NumStmtFields]; |
| 3800 | auto CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1]; |
| 3801 | S = OMPTeamsDistributeDirective::CreateEmpty(Context, NumClauses, |
| 3802 | CollapsedNum, Empty); |
| 3803 | break; |
| 3804 | } |
| 3805 | |
Kelvin Li | 4e325f7 | 2016-10-25 12:50:55 +0000 | [diff] [blame] | 3806 | case STMT_OMP_TEAMS_DISTRIBUTE_SIMD_DIRECTIVE: { |
| 3807 | unsigned NumClauses = Record[ASTStmtReader::NumStmtFields]; |
| 3808 | unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1]; |
| 3809 | S = OMPTeamsDistributeSimdDirective::CreateEmpty(Context, NumClauses, |
| 3810 | CollapsedNum, Empty); |
| 3811 | break; |
| 3812 | } |
| 3813 | |
Kelvin Li | 579e41c | 2016-11-30 23:51:03 +0000 | [diff] [blame] | 3814 | case STMT_OMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE: { |
| 3815 | auto NumClauses = Record[ASTStmtReader::NumStmtFields]; |
| 3816 | auto CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1]; |
| 3817 | S = OMPTeamsDistributeParallelForSimdDirective::CreateEmpty( |
| 3818 | Context, NumClauses, CollapsedNum, Empty); |
| 3819 | break; |
| 3820 | } |
| 3821 | |
Kelvin Li | 7ade93f | 2016-12-09 03:24:30 +0000 | [diff] [blame] | 3822 | case STMT_OMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE: { |
| 3823 | auto NumClauses = Record[ASTStmtReader::NumStmtFields]; |
| 3824 | auto CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1]; |
| 3825 | S = OMPTeamsDistributeParallelForDirective::CreateEmpty( |
| 3826 | Context, NumClauses, CollapsedNum, Empty); |
| 3827 | break; |
| 3828 | } |
| 3829 | |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3830 | case STMT_OMP_TARGET_TEAMS_DIRECTIVE: |
Kelvin Li | bf594a5 | 2016-12-17 05:48:59 +0000 | [diff] [blame] | 3831 | S = OMPTargetTeamsDirective::CreateEmpty( |
| 3832 | Context, Record[ASTStmtReader::NumStmtFields], Empty); |
| 3833 | break; |
Kelvin Li | 83c451e | 2016-12-25 04:52:54 +0000 | [diff] [blame] | 3834 | |
| 3835 | case STMT_OMP_TARGET_TEAMS_DISTRIBUTE_DIRECTIVE: { |
| 3836 | auto NumClauses = Record[ASTStmtReader::NumStmtFields]; |
| 3837 | auto CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1]; |
| 3838 | S = OMPTargetTeamsDistributeDirective::CreateEmpty(Context, NumClauses, |
| 3839 | CollapsedNum, Empty); |
| 3840 | break; |
| 3841 | } |
| 3842 | |
Kelvin Li | 80e8f56 | 2016-12-29 22:16:30 +0000 | [diff] [blame] | 3843 | case STMT_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE: { |
| 3844 | auto NumClauses = Record[ASTStmtReader::NumStmtFields]; |
| 3845 | auto CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1]; |
| 3846 | S = OMPTargetTeamsDistributeParallelForDirective::CreateEmpty( |
| 3847 | Context, NumClauses, CollapsedNum, Empty); |
| 3848 | break; |
| 3849 | } |
| 3850 | |
Kelvin Li | 1851df5 | 2017-01-03 05:23:48 +0000 | [diff] [blame] | 3851 | case STMT_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE: { |
| 3852 | auto NumClauses = Record[ASTStmtReader::NumStmtFields]; |
| 3853 | auto CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1]; |
| 3854 | S = OMPTargetTeamsDistributeParallelForSimdDirective::CreateEmpty( |
| 3855 | Context, NumClauses, CollapsedNum, Empty); |
| 3856 | break; |
| 3857 | } |
| 3858 | |
Kelvin Li | da68118 | 2017-01-10 18:08:18 +0000 | [diff] [blame] | 3859 | case STMT_OMP_TARGET_TEAMS_DISTRIBUTE_SIMD_DIRECTIVE: { |
| 3860 | auto NumClauses = Record[ASTStmtReader::NumStmtFields]; |
| 3861 | auto CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1]; |
| 3862 | S = OMPTargetTeamsDistributeSimdDirective::CreateEmpty( |
| 3863 | Context, NumClauses, CollapsedNum, Empty); |
| 3864 | break; |
| 3865 | } |
| 3866 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3867 | case EXPR_CXX_OPERATOR_CALL: |
Douglas Gregor | 4163aca | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 3868 | S = new (Context) CXXOperatorCallExpr(Context, Empty); |
Argyrios Kyrtzidis | eeaaead | 2009-07-14 03:19:21 +0000 | [diff] [blame] | 3869 | break; |
Chris Lattner | b7e7f72 | 2010-05-09 05:36:05 +0000 | [diff] [blame] | 3870 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3871 | case EXPR_CXX_MEMBER_CALL: |
Douglas Gregor | 4163aca | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 3872 | S = new (Context) CXXMemberCallExpr(Context, Empty); |
Chris Lattner | b7e7f72 | 2010-05-09 05:36:05 +0000 | [diff] [blame] | 3873 | break; |
Alexey Bataev | 1b59ab5 | 2014-02-27 08:29:12 +0000 | [diff] [blame] | 3874 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3875 | case EXPR_CXX_CONSTRUCT: |
Argyrios Kyrtzidis | b8d77eb | 2010-07-10 11:46:15 +0000 | [diff] [blame] | 3876 | S = new (Context) CXXConstructExpr(Empty); |
| 3877 | break; |
Alexey Bataev | 1b59ab5 | 2014-02-27 08:29:12 +0000 | [diff] [blame] | 3878 | |
Richard Smith | 5179eb7 | 2016-06-28 19:03:57 +0000 | [diff] [blame] | 3879 | case EXPR_CXX_INHERITED_CTOR_INIT: |
| 3880 | S = new (Context) CXXInheritedCtorInitExpr(Empty); |
| 3881 | break; |
| 3882 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3883 | case EXPR_CXX_TEMPORARY_OBJECT: |
Argyrios Kyrtzidis | b8d77eb | 2010-07-10 11:46:15 +0000 | [diff] [blame] | 3884 | S = new (Context) CXXTemporaryObjectExpr(Empty); |
Douglas Gregor | 5d3507d | 2009-09-09 23:08:42 +0000 | [diff] [blame] | 3885 | break; |
Sam Weinig | d01101e | 2010-01-16 21:21:01 +0000 | [diff] [blame] | 3886 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3887 | case EXPR_CXX_STATIC_CAST: |
Douglas Gregor | 4163aca | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 3888 | S = CXXStaticCastExpr::CreateEmpty(Context, |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 3889 | /*PathSize*/ Record[ASTStmtReader::NumExprFields]); |
Sam Weinig | d01101e | 2010-01-16 21:21:01 +0000 | [diff] [blame] | 3890 | break; |
| 3891 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3892 | case EXPR_CXX_DYNAMIC_CAST: |
Douglas Gregor | 4163aca | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 3893 | S = CXXDynamicCastExpr::CreateEmpty(Context, |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 3894 | /*PathSize*/ Record[ASTStmtReader::NumExprFields]); |
Sam Weinig | d01101e | 2010-01-16 21:21:01 +0000 | [diff] [blame] | 3895 | break; |
| 3896 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3897 | case EXPR_CXX_REINTERPRET_CAST: |
Douglas Gregor | 4163aca | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 3898 | S = CXXReinterpretCastExpr::CreateEmpty(Context, |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 3899 | /*PathSize*/ Record[ASTStmtReader::NumExprFields]); |
Sam Weinig | d01101e | 2010-01-16 21:21:01 +0000 | [diff] [blame] | 3900 | break; |
| 3901 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3902 | case EXPR_CXX_CONST_CAST: |
Douglas Gregor | 4163aca | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 3903 | S = CXXConstCastExpr::CreateEmpty(Context); |
Sam Weinig | d01101e | 2010-01-16 21:21:01 +0000 | [diff] [blame] | 3904 | break; |
| 3905 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3906 | case EXPR_CXX_FUNCTIONAL_CAST: |
Douglas Gregor | 4163aca | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 3907 | S = CXXFunctionalCastExpr::CreateEmpty(Context, |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 3908 | /*PathSize*/ Record[ASTStmtReader::NumExprFields]); |
Sam Weinig | d01101e | 2010-01-16 21:21:01 +0000 | [diff] [blame] | 3909 | break; |
| 3910 | |
Richard Smith | c67fdd4 | 2012-03-07 08:35:16 +0000 | [diff] [blame] | 3911 | case EXPR_USER_DEFINED_LITERAL: |
| 3912 | S = new (Context) UserDefinedLiteral(Context, Empty); |
| 3913 | break; |
| 3914 | |
Richard Smith | cc1b96d | 2013-06-12 22:31:48 +0000 | [diff] [blame] | 3915 | case EXPR_CXX_STD_INITIALIZER_LIST: |
| 3916 | S = new (Context) CXXStdInitializerListExpr(Empty); |
| 3917 | break; |
| 3918 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3919 | case EXPR_CXX_BOOL_LITERAL: |
Sam Weinig | e83b3ac | 2010-02-07 06:32:43 +0000 | [diff] [blame] | 3920 | S = new (Context) CXXBoolLiteralExpr(Empty); |
| 3921 | break; |
Sam Weinig | d01101e | 2010-01-16 21:21:01 +0000 | [diff] [blame] | 3922 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3923 | case EXPR_CXX_NULL_PTR_LITERAL: |
Sam Weinig | e83b3ac | 2010-02-07 06:32:43 +0000 | [diff] [blame] | 3924 | S = new (Context) CXXNullPtrLiteralExpr(Empty); |
| 3925 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3926 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3927 | case EXPR_CXX_TYPEID_EXPR: |
Chris Lattner | 13a5ecc | 2010-05-09 06:03:39 +0000 | [diff] [blame] | 3928 | S = new (Context) CXXTypeidExpr(Empty, true); |
| 3929 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3930 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3931 | case EXPR_CXX_TYPEID_TYPE: |
Chris Lattner | 13a5ecc | 2010-05-09 06:03:39 +0000 | [diff] [blame] | 3932 | S = new (Context) CXXTypeidExpr(Empty, false); |
| 3933 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3934 | |
Francois Pichet | 9f4f207 | 2010-09-08 12:20:18 +0000 | [diff] [blame] | 3935 | case EXPR_CXX_UUIDOF_EXPR: |
| 3936 | S = new (Context) CXXUuidofExpr(Empty, true); |
| 3937 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3938 | |
John McCall | 5e77d76 | 2013-04-16 07:28:30 +0000 | [diff] [blame] | 3939 | case EXPR_CXX_PROPERTY_REF_EXPR: |
| 3940 | S = new (Context) MSPropertyRefExpr(Empty); |
| 3941 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3942 | |
Alexey Bataev | f763027 | 2015-11-25 12:01:00 +0000 | [diff] [blame] | 3943 | case EXPR_CXX_PROPERTY_SUBSCRIPT_EXPR: |
| 3944 | S = new (Context) MSPropertySubscriptExpr(Empty); |
| 3945 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3946 | |
Francois Pichet | 9f4f207 | 2010-09-08 12:20:18 +0000 | [diff] [blame] | 3947 | case EXPR_CXX_UUIDOF_TYPE: |
| 3948 | S = new (Context) CXXUuidofExpr(Empty, false); |
| 3949 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3950 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3951 | case EXPR_CXX_THIS: |
Chris Lattner | 9826733 | 2010-05-09 06:15:05 +0000 | [diff] [blame] | 3952 | S = new (Context) CXXThisExpr(Empty); |
| 3953 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3954 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3955 | case EXPR_CXX_THROW: |
Chris Lattner | 9826733 | 2010-05-09 06:15:05 +0000 | [diff] [blame] | 3956 | S = new (Context) CXXThrowExpr(Empty); |
| 3957 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3958 | |
John McCall | 32791cc | 2016-01-06 22:34:54 +0000 | [diff] [blame] | 3959 | case EXPR_CXX_DEFAULT_ARG: |
| 3960 | S = new (Context) CXXDefaultArgExpr(Empty); |
Chris Lattner | e2437f4 | 2010-05-09 06:40:08 +0000 | [diff] [blame] | 3961 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3962 | |
Richard Smith | 852c9db | 2013-04-20 22:23:05 +0000 | [diff] [blame] | 3963 | case EXPR_CXX_DEFAULT_INIT: |
| 3964 | S = new (Context) CXXDefaultInitExpr(Empty); |
| 3965 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3966 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3967 | case EXPR_CXX_BIND_TEMPORARY: |
Chris Lattner | cba8614 | 2010-05-10 00:25:06 +0000 | [diff] [blame] | 3968 | S = new (Context) CXXBindTemporaryExpr(Empty); |
| 3969 | break; |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 3970 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3971 | case EXPR_CXX_SCALAR_VALUE_INIT: |
Douglas Gregor | 747eb78 | 2010-07-08 06:14:04 +0000 | [diff] [blame] | 3972 | S = new (Context) CXXScalarValueInitExpr(Empty); |
Chris Lattner | abfb58d | 2010-05-10 01:22:27 +0000 | [diff] [blame] | 3973 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3974 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3975 | case EXPR_CXX_NEW: |
Chris Lattner | abfb58d | 2010-05-10 01:22:27 +0000 | [diff] [blame] | 3976 | S = new (Context) CXXNewExpr(Empty); |
| 3977 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3978 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3979 | case EXPR_CXX_DELETE: |
Argyrios Kyrtzidis | 6e57c35 | 2010-06-22 17:07:59 +0000 | [diff] [blame] | 3980 | S = new (Context) CXXDeleteExpr(Empty); |
| 3981 | break; |
Eugene Zelenko | e69b33f | 2018-04-11 20:57:28 +0000 | [diff] [blame] | 3982 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3983 | case EXPR_CXX_PSEUDO_DESTRUCTOR: |
Argyrios Kyrtzidis | 99a226d | 2010-06-28 09:32:03 +0000 | [diff] [blame] | 3984 | S = new (Context) CXXPseudoDestructorExpr(Empty); |
| 3985 | break; |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 3986 | |
John McCall | 5d41378 | 2010-12-06 08:20:24 +0000 | [diff] [blame] | 3987 | case EXPR_EXPR_WITH_CLEANUPS: |
John McCall | 28fc709 | 2011-11-10 05:35:25 +0000 | [diff] [blame] | 3988 | S = ExprWithCleanups::Create(Context, Empty, |
| 3989 | Record[ASTStmtReader::NumExprFields]); |
Chris Lattner | cba8614 | 2010-05-10 00:25:06 +0000 | [diff] [blame] | 3990 | break; |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 3991 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3992 | case EXPR_CXX_DEPENDENT_SCOPE_MEMBER: |
Douglas Gregor | 4163aca | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 3993 | S = CXXDependentScopeMemberExpr::CreateEmpty(Context, |
Abramo Bagnara | 7945c98 | 2012-01-27 09:46:47 +0000 | [diff] [blame] | 3994 | /*HasTemplateKWAndArgsInfo=*/Record[ASTStmtReader::NumExprFields], |
Douglas Gregor | 87866ce | 2011-02-04 12:01:24 +0000 | [diff] [blame] | 3995 | /*NumTemplateArgs=*/Record[ASTStmtReader::NumExprFields] |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 3996 | ? Record[ASTStmtReader::NumExprFields + 1] |
Douglas Gregor | 87866ce | 2011-02-04 12:01:24 +0000 | [diff] [blame] | 3997 | : 0); |
Argyrios Kyrtzidis | bfcacee | 2010-06-24 08:57:31 +0000 | [diff] [blame] | 3998 | break; |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 3999 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 4000 | case EXPR_CXX_DEPENDENT_SCOPE_DECL_REF: |
Douglas Gregor | 4163aca | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 4001 | S = DependentScopeDeclRefExpr::CreateEmpty(Context, |
Abramo Bagnara | 7945c98 | 2012-01-27 09:46:47 +0000 | [diff] [blame] | 4002 | /*HasTemplateKWAndArgsInfo=*/Record[ASTStmtReader::NumExprFields], |
Douglas Gregor | 87866ce | 2011-02-04 12:01:24 +0000 | [diff] [blame] | 4003 | /*NumTemplateArgs=*/Record[ASTStmtReader::NumExprFields] |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 4004 | ? Record[ASTStmtReader::NumExprFields + 1] |
Douglas Gregor | 87866ce | 2011-02-04 12:01:24 +0000 | [diff] [blame] | 4005 | : 0); |
Argyrios Kyrtzidis | cd444d1a | 2010-06-28 09:31:56 +0000 | [diff] [blame] | 4006 | break; |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 4007 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 4008 | case EXPR_CXX_UNRESOLVED_CONSTRUCT: |
Douglas Gregor | 4163aca | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 4009 | S = CXXUnresolvedConstructExpr::CreateEmpty(Context, |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 4010 | /*NumArgs=*/Record[ASTStmtReader::NumExprFields]); |
Argyrios Kyrtzidis | b8d3c63 | 2010-06-25 09:03:26 +0000 | [diff] [blame] | 4011 | break; |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 4012 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 4013 | case EXPR_CXX_UNRESOLVED_MEMBER: |
Douglas Gregor | 4163aca | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 4014 | S = UnresolvedMemberExpr::CreateEmpty(Context, |
Abramo Bagnara | 7945c98 | 2012-01-27 09:46:47 +0000 | [diff] [blame] | 4015 | /*HasTemplateKWAndArgsInfo=*/Record[ASTStmtReader::NumExprFields], |
Douglas Gregor | 87866ce | 2011-02-04 12:01:24 +0000 | [diff] [blame] | 4016 | /*NumTemplateArgs=*/Record[ASTStmtReader::NumExprFields] |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 4017 | ? Record[ASTStmtReader::NumExprFields + 1] |
Douglas Gregor | 87866ce | 2011-02-04 12:01:24 +0000 | [diff] [blame] | 4018 | : 0); |
Argyrios Kyrtzidis | bfcacee | 2010-06-24 08:57:31 +0000 | [diff] [blame] | 4019 | break; |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 4020 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 4021 | case EXPR_CXX_UNRESOLVED_LOOKUP: |
Douglas Gregor | 4163aca | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 4022 | S = UnresolvedLookupExpr::CreateEmpty(Context, |
Abramo Bagnara | 7945c98 | 2012-01-27 09:46:47 +0000 | [diff] [blame] | 4023 | /*HasTemplateKWAndArgsInfo=*/Record[ASTStmtReader::NumExprFields], |
Douglas Gregor | 87866ce | 2011-02-04 12:01:24 +0000 | [diff] [blame] | 4024 | /*NumTemplateArgs=*/Record[ASTStmtReader::NumExprFields] |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 4025 | ? Record[ASTStmtReader::NumExprFields + 1] |
Douglas Gregor | 87866ce | 2011-02-04 12:01:24 +0000 | [diff] [blame] | 4026 | : 0); |
Argyrios Kyrtzidis | 58e01ad | 2010-06-25 09:03:34 +0000 | [diff] [blame] | 4027 | break; |
Sebastian Redl | 9ac55dd | 2010-09-10 20:55:54 +0000 | [diff] [blame] | 4028 | |
Douglas Gregor | 29c42f2 | 2012-02-24 07:38:34 +0000 | [diff] [blame] | 4029 | case EXPR_TYPE_TRAIT: |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 4030 | S = TypeTraitExpr::CreateDeserialized(Context, |
Douglas Gregor | 29c42f2 | 2012-02-24 07:38:34 +0000 | [diff] [blame] | 4031 | Record[ASTStmtReader::NumExprFields]); |
| 4032 | break; |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 4033 | |
John Wiegley | 6242b6a | 2011-04-28 00:16:57 +0000 | [diff] [blame] | 4034 | case EXPR_ARRAY_TYPE_TRAIT: |
| 4035 | S = new (Context) ArrayTypeTraitExpr(Empty); |
| 4036 | break; |
| 4037 | |
John Wiegley | f9f6584 | 2011-04-25 06:54:41 +0000 | [diff] [blame] | 4038 | case EXPR_CXX_EXPRESSION_TRAIT: |
| 4039 | S = new (Context) ExpressionTraitExpr(Empty); |
| 4040 | break; |
| 4041 | |
Sebastian Redl | 9ac55dd | 2010-09-10 20:55:54 +0000 | [diff] [blame] | 4042 | case EXPR_CXX_NOEXCEPT: |
| 4043 | S = new (Context) CXXNoexceptExpr(Empty); |
| 4044 | break; |
John McCall | 8d69a21 | 2010-11-15 23:31:06 +0000 | [diff] [blame] | 4045 | |
Douglas Gregor | e8e9dd6 | 2011-01-03 17:17:50 +0000 | [diff] [blame] | 4046 | case EXPR_PACK_EXPANSION: |
| 4047 | S = new (Context) PackExpansionExpr(Empty); |
| 4048 | break; |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 4049 | |
Douglas Gregor | 820ba7b | 2011-01-04 17:33:58 +0000 | [diff] [blame] | 4050 | case EXPR_SIZEOF_PACK: |
Richard Smith | d784e68 | 2015-09-23 21:41:42 +0000 | [diff] [blame] | 4051 | S = SizeOfPackExpr::CreateDeserialized( |
| 4052 | Context, |
| 4053 | /*NumPartialArgs=*/Record[ASTStmtReader::NumExprFields]); |
Douglas Gregor | 820ba7b | 2011-01-04 17:33:58 +0000 | [diff] [blame] | 4054 | break; |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 4055 | |
John McCall | fa19404 | 2011-07-15 07:00:14 +0000 | [diff] [blame] | 4056 | case EXPR_SUBST_NON_TYPE_TEMPLATE_PARM: |
| 4057 | S = new (Context) SubstNonTypeTemplateParmExpr(Empty); |
| 4058 | break; |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 4059 | |
Douglas Gregor | cdbc539 | 2011-01-15 01:15:58 +0000 | [diff] [blame] | 4060 | case EXPR_SUBST_NON_TYPE_TEMPLATE_PARM_PACK: |
| 4061 | S = new (Context) SubstNonTypeTemplateParmPackExpr(Empty); |
| 4062 | break; |
Richard Smith | b15fe3a | 2012-09-12 00:56:43 +0000 | [diff] [blame] | 4063 | |
| 4064 | case EXPR_FUNCTION_PARM_PACK: |
| 4065 | S = FunctionParmPackExpr::CreateEmpty(Context, |
| 4066 | Record[ASTStmtReader::NumExprFields]); |
| 4067 | break; |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 4068 | |
Douglas Gregor | fe31481 | 2011-06-21 17:03:29 +0000 | [diff] [blame] | 4069 | case EXPR_MATERIALIZE_TEMPORARY: |
| 4070 | S = new (Context) MaterializeTemporaryExpr(Empty); |
| 4071 | break; |
Richard Smith | 0f0af19 | 2014-11-08 05:07:16 +0000 | [diff] [blame] | 4072 | |
| 4073 | case EXPR_CXX_FOLD: |
| 4074 | S = new (Context) CXXFoldExpr(Empty); |
| 4075 | break; |
| 4076 | |
Argyrios Kyrtzidis | b2b0795 | 2011-12-03 03:49:52 +0000 | [diff] [blame] | 4077 | case EXPR_OPAQUE_VALUE: |
| 4078 | S = new (Context) OpaqueValueExpr(Empty); |
John McCall | 8d69a21 | 2010-11-15 23:31:06 +0000 | [diff] [blame] | 4079 | break; |
Peter Collingbourne | 41f8546 | 2011-02-09 21:07:24 +0000 | [diff] [blame] | 4080 | |
| 4081 | case EXPR_CUDA_KERNEL_CALL: |
Douglas Gregor | 4163aca | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 4082 | S = new (Context) CUDAKernelCallExpr(Context, Empty); |
Peter Collingbourne | 41f8546 | 2011-02-09 21:07:24 +0000 | [diff] [blame] | 4083 | break; |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 4084 | |
Tanya Lattner | 55808c1 | 2011-06-04 00:47:47 +0000 | [diff] [blame] | 4085 | case EXPR_ASTYPE: |
| 4086 | S = new (Context) AsTypeExpr(Empty); |
| 4087 | break; |
Eli Friedman | df14b3a | 2011-10-11 02:20:01 +0000 | [diff] [blame] | 4088 | |
John McCall | fe96e0b | 2011-11-06 09:01:30 +0000 | [diff] [blame] | 4089 | case EXPR_PSEUDO_OBJECT: { |
| 4090 | unsigned numSemanticExprs = Record[ASTStmtReader::NumExprFields]; |
| 4091 | S = PseudoObjectExpr::Create(Context, Empty, numSemanticExprs); |
| 4092 | break; |
| 4093 | } |
| 4094 | |
Eli Friedman | df14b3a | 2011-10-11 02:20:01 +0000 | [diff] [blame] | 4095 | case EXPR_ATOMIC: |
| 4096 | S = new (Context) AtomicExpr(Empty); |
| 4097 | break; |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 4098 | |
Douglas Gregor | 99ae806 | 2012-02-14 17:54:36 +0000 | [diff] [blame] | 4099 | case EXPR_LAMBDA: { |
| 4100 | unsigned NumCaptures = Record[ASTStmtReader::NumExprFields]; |
Richard Smith | 30e304e | 2016-12-14 00:03:17 +0000 | [diff] [blame] | 4101 | S = LambdaExpr::CreateDeserialized(Context, NumCaptures); |
Douglas Gregor | 99ae806 | 2012-02-14 17:54:36 +0000 | [diff] [blame] | 4102 | break; |
| 4103 | } |
Gor Nishanov | f5ecb5e | 2017-07-25 18:01:49 +0000 | [diff] [blame] | 4104 | |
| 4105 | case STMT_COROUTINE_BODY: { |
| 4106 | unsigned NumParams = Record[ASTStmtReader::NumStmtFields]; |
| 4107 | S = CoroutineBodyStmt::Create(Context, Empty, NumParams); |
| 4108 | break; |
| 4109 | } |
| 4110 | |
| 4111 | case STMT_CORETURN: |
| 4112 | S = new (Context) CoreturnStmt(Empty); |
| 4113 | break; |
| 4114 | |
| 4115 | case EXPR_COAWAIT: |
| 4116 | S = new (Context) CoawaitExpr(Empty); |
| 4117 | break; |
| 4118 | |
| 4119 | case EXPR_COYIELD: |
| 4120 | S = new (Context) CoyieldExpr(Empty); |
| 4121 | break; |
| 4122 | |
| 4123 | case EXPR_DEPENDENT_COAWAIT: |
| 4124 | S = new (Context) DependentCoawaitExpr(Empty); |
| 4125 | break; |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 4126 | } |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 4127 | |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 4128 | // We hit a STMT_STOP, so we're done with this expression. |
| 4129 | if (Finished) |
| 4130 | break; |
| 4131 | |
| 4132 | ++NumStatementsRead; |
| 4133 | |
Argyrios Kyrtzidis | 6a59897 | 2011-10-21 23:02:28 +0000 | [diff] [blame] | 4134 | if (S && !IsStmtReference) { |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 4135 | Reader.Visit(S); |
Argyrios Kyrtzidis | 6a59897 | 2011-10-21 23:02:28 +0000 | [diff] [blame] | 4136 | StmtEntries[Cursor.GetCurrentBitNo()] = S; |
| 4137 | } |
| 4138 | |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 4139 | assert(Record.getIdx() == Record.size() && |
| 4140 | "Invalid deserialization of statement"); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 4141 | StmtStack.push_back(S); |
| 4142 | } |
Chris Lattner | 0e6c940 | 2013-01-20 02:38:54 +0000 | [diff] [blame] | 4143 | Done: |
Alp Toker | 028ed91 | 2013-12-06 17:56:43 +0000 | [diff] [blame] | 4144 | assert(StmtStack.size() > PrevNumStmts && "Read too many sub-stmts!"); |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 4145 | assert(StmtStack.size() == PrevNumStmts + 1 && "Extra expressions on stack!"); |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 4146 | return StmtStack.pop_back_val(); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 4147 | } |