Sebastian Redl | 3b3c874 | 2010-08-18 23:57:11 +0000 | [diff] [blame] | 1 | //===--- ASTReaderStmt.cpp - Stmt/Expr Deserialization ----------*- C++ -*-===// |
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" |
Douglas Gregor | 5d3507d | 2009-09-09 23:08:42 +0000 | [diff] [blame] | 17 | #include "clang/AST/DeclCXX.h" |
Douglas Gregor | cdbc539 | 2011-01-15 01:15:58 +0000 | [diff] [blame] | 18 | #include "clang/AST/DeclTemplate.h" |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 19 | #include "clang/AST/StmtVisitor.h" |
John McCall | f413f5e | 2013-05-03 00:10:13 +0000 | [diff] [blame] | 20 | #include "clang/Lex/Token.h" |
Benjamin Kramer | 4903802 | 2012-02-04 13:45:25 +0000 | [diff] [blame] | 21 | #include "llvm/ADT/SmallString.h" |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 22 | using namespace clang; |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 23 | using namespace clang::serialization; |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 24 | |
Argyrios Kyrtzidis | f9f47c8 | 2010-06-30 08:49:18 +0000 | [diff] [blame] | 25 | namespace clang { |
Argyrios Kyrtzidis | ddf5f21 | 2010-06-28 09:31:42 +0000 | [diff] [blame] | 26 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 27 | class ASTStmtReader : public StmtVisitor<ASTStmtReader> { |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 28 | friend class OMPClauseReader; |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 29 | |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 30 | ASTRecordReader &Record; |
Sebastian Redl | c67764e | 2010-07-22 22:43:28 +0000 | [diff] [blame] | 31 | llvm::BitstreamCursor &DeclsCursor; |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 32 | |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 33 | SourceLocation ReadSourceLocation() { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 34 | return Record.readSourceLocation(); |
John McCall | f413f5e | 2013-05-03 00:10:13 +0000 | [diff] [blame] | 35 | } |
| 36 | |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 37 | SourceRange ReadSourceRange() { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 38 | return Record.readSourceRange(); |
Sebastian Redl | 2c373b9 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 39 | } |
John McCall | f413f5e | 2013-05-03 00:10:13 +0000 | [diff] [blame] | 40 | |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 41 | std::string ReadString() { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 42 | return Record.readString(); |
Sebastian Redl | 2c373b9 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 43 | } |
John McCall | f413f5e | 2013-05-03 00:10:13 +0000 | [diff] [blame] | 44 | |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 45 | TypeSourceInfo *GetTypeSourceInfo() { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 46 | return Record.getTypeSourceInfo(); |
John McCall | f413f5e | 2013-05-03 00:10:13 +0000 | [diff] [blame] | 47 | } |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 48 | |
| 49 | Decl *ReadDecl() { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 50 | return Record.readDecl(); |
Sebastian Redl | 2c373b9 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 51 | } |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 52 | |
Douglas Gregor | 7fb0919 | 2011-07-21 22:35:25 +0000 | [diff] [blame] | 53 | template<typename T> |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 54 | T *ReadDeclAs() { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 55 | return Record.readDeclAs<T>(); |
Douglas Gregor | 7fb0919 | 2011-07-21 22:35:25 +0000 | [diff] [blame] | 56 | } |
| 57 | |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 58 | void ReadDeclarationNameLoc(DeclarationNameLoc &DNLoc, |
| 59 | DeclarationName Name) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 60 | Record.readDeclarationNameLoc(DNLoc, Name); |
Argyrios Kyrtzidis | 434383d | 2010-10-15 18:21:24 +0000 | [diff] [blame] | 61 | } |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 62 | |
| 63 | void ReadDeclarationNameInfo(DeclarationNameInfo &NameInfo) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 64 | Record.readDeclarationNameInfo(NameInfo); |
Argyrios Kyrtzidis | 434383d | 2010-10-15 18:21:24 +0000 | [diff] [blame] | 65 | } |
Sebastian Redl | 2c373b9 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 66 | |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 67 | public: |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 68 | ASTStmtReader(ASTRecordReader &Record, llvm::BitstreamCursor &Cursor) |
| 69 | : Record(Record), DeclsCursor(Cursor) {} |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 70 | |
| 71 | /// \brief The number of record fields required for the Stmt class |
| 72 | /// itself. |
| 73 | static const unsigned NumStmtFields = 0; |
| 74 | |
| 75 | /// \brief The number of record fields required for the Expr class |
| 76 | /// itself. |
Douglas Gregor | 678d76c | 2011-07-01 01:22:09 +0000 | [diff] [blame] | 77 | static const unsigned NumExprFields = NumStmtFields + 7; |
Abramo Bagnara | 7945c98 | 2012-01-27 09:46:47 +0000 | [diff] [blame] | 78 | |
| 79 | /// \brief Read and initialize a ExplicitTemplateArgumentList structure. |
| 80 | void ReadTemplateKWAndArgsInfo(ASTTemplateKWAndArgsInfo &Args, |
James Y Knight | e7d8228 | 2015-12-29 18:15:14 +0000 | [diff] [blame] | 81 | TemplateArgumentLoc *ArgsLocArray, |
Abramo Bagnara | 7945c98 | 2012-01-27 09:46:47 +0000 | [diff] [blame] | 82 | unsigned NumTemplateArgs); |
Argyrios Kyrtzidis | b5288de | 2010-06-28 09:31:48 +0000 | [diff] [blame] | 83 | /// \brief Read and initialize a ExplicitTemplateArgumentList structure. |
Argyrios Kyrtzidis | de6aa08 | 2011-09-22 20:07:03 +0000 | [diff] [blame] | 84 | void ReadExplicitTemplateArgumentList(ASTTemplateArgumentListInfo &ArgList, |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 85 | unsigned NumTemplateArgs); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 86 | |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 87 | void VisitStmt(Stmt *S); |
John McCall | fa19404 | 2011-07-15 07:00:14 +0000 | [diff] [blame] | 88 | #define STMT(Type, Base) \ |
| 89 | void Visit##Type(Type *); |
| 90 | #include "clang/AST/StmtNodes.inc" |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 91 | }; |
Alexander Kornienko | ab9db51 | 2015-06-22 23:07:51 +0000 | [diff] [blame] | 92 | } |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 93 | |
James Y Knight | e7d8228 | 2015-12-29 18:15:14 +0000 | [diff] [blame] | 94 | void ASTStmtReader::ReadTemplateKWAndArgsInfo(ASTTemplateKWAndArgsInfo &Args, |
| 95 | TemplateArgumentLoc *ArgsLocArray, |
| 96 | unsigned NumTemplateArgs) { |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 97 | SourceLocation TemplateKWLoc = ReadSourceLocation(); |
Argyrios Kyrtzidis | b5288de | 2010-06-28 09:31:48 +0000 | [diff] [blame] | 98 | TemplateArgumentListInfo ArgInfo; |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 99 | ArgInfo.setLAngleLoc(ReadSourceLocation()); |
| 100 | ArgInfo.setRAngleLoc(ReadSourceLocation()); |
Argyrios Kyrtzidis | b5288de | 2010-06-28 09:31:48 +0000 | [diff] [blame] | 101 | for (unsigned i = 0; i != NumTemplateArgs; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 102 | ArgInfo.addArgument(Record.readTemplateArgumentLoc()); |
James Y Knight | e7d8228 | 2015-12-29 18:15:14 +0000 | [diff] [blame] | 103 | Args.initializeFrom(TemplateKWLoc, ArgInfo, ArgsLocArray); |
Argyrios Kyrtzidis | b5288de | 2010-06-28 09:31:48 +0000 | [diff] [blame] | 104 | } |
| 105 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 106 | void ASTStmtReader::VisitStmt(Stmt *S) { |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 107 | assert(Record.getIdx() == NumStmtFields && "Incorrect statement field count"); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 108 | } |
| 109 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 110 | void ASTStmtReader::VisitNullStmt(NullStmt *S) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 111 | VisitStmt(S); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 112 | S->setSemiLoc(ReadSourceLocation()); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 113 | S->HasLeadingEmptyMacro = Record.readInt(); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 114 | } |
| 115 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 116 | void ASTStmtReader::VisitCompoundStmt(CompoundStmt *S) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 117 | VisitStmt(S); |
Chris Lattner | 0e62c1c | 2011-07-23 10:55:15 +0000 | [diff] [blame] | 118 | SmallVector<Stmt *, 16> Stmts; |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 119 | unsigned NumStmts = Record.readInt(); |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 120 | while (NumStmts--) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 121 | Stmts.push_back(Record.readSubStmt()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 122 | S->setStmts(Record.getContext(), Stmts); |
| 123 | S->LBraceLoc = ReadSourceLocation(); |
| 124 | S->RBraceLoc = ReadSourceLocation(); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 125 | } |
| 126 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 127 | void ASTStmtReader::VisitSwitchCase(SwitchCase *S) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 128 | VisitStmt(S); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 129 | Record.recordSwitchCaseID(S, Record.readInt()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 130 | S->setKeywordLoc(ReadSourceLocation()); |
| 131 | S->setColonLoc(ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 132 | } |
| 133 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 134 | void ASTStmtReader::VisitCaseStmt(CaseStmt *S) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 135 | VisitSwitchCase(S); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 136 | S->setLHS(Record.readSubExpr()); |
| 137 | S->setRHS(Record.readSubExpr()); |
| 138 | S->setSubStmt(Record.readSubStmt()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 139 | S->setEllipsisLoc(ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 140 | } |
| 141 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 142 | void ASTStmtReader::VisitDefaultStmt(DefaultStmt *S) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 143 | VisitSwitchCase(S); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 144 | S->setSubStmt(Record.readSubStmt()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 145 | } |
| 146 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 147 | void ASTStmtReader::VisitLabelStmt(LabelStmt *S) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 148 | VisitStmt(S); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 149 | LabelDecl *LD = ReadDeclAs<LabelDecl>(); |
Chris Lattner | c8e630e | 2011-02-17 07:39:24 +0000 | [diff] [blame] | 150 | LD->setStmt(S); |
| 151 | S->setDecl(LD); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 152 | S->setSubStmt(Record.readSubStmt()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 153 | S->setIdentLoc(ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 154 | } |
| 155 | |
Richard Smith | c202b28 | 2012-04-14 00:33:13 +0000 | [diff] [blame] | 156 | void ASTStmtReader::VisitAttributedStmt(AttributedStmt *S) { |
| 157 | VisitStmt(S); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 158 | uint64_t NumAttrs = Record.readInt(); |
Richard Smith | c202b28 | 2012-04-14 00:33:13 +0000 | [diff] [blame] | 159 | AttrVec Attrs; |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 160 | Record.readAttributes(Attrs); |
Matt Beaumont-Gay | ad0bb8e | 2012-07-09 18:55:31 +0000 | [diff] [blame] | 161 | (void)NumAttrs; |
Alexander Kornienko | 20f6fc6 | 2012-07-09 10:04:07 +0000 | [diff] [blame] | 162 | assert(NumAttrs == S->NumAttrs); |
| 163 | assert(NumAttrs == Attrs.size()); |
Aaron Ballman | f3d9b09 | 2014-05-13 14:55:01 +0000 | [diff] [blame] | 164 | std::copy(Attrs.begin(), Attrs.end(), S->getAttrArrayPtr()); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 165 | S->SubStmt = Record.readSubStmt(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 166 | S->AttrLoc = ReadSourceLocation(); |
Richard Smith | c202b28 | 2012-04-14 00:33:13 +0000 | [diff] [blame] | 167 | } |
| 168 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 169 | void ASTStmtReader::VisitIfStmt(IfStmt *S) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 170 | VisitStmt(S); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 171 | S->setConstexpr(Record.readInt()); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 172 | S->setInit(Record.readSubStmt()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 173 | S->setConditionVariable(Record.getContext(), ReadDeclAs<VarDecl>()); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 174 | S->setCond(Record.readSubExpr()); |
| 175 | S->setThen(Record.readSubStmt()); |
| 176 | S->setElse(Record.readSubStmt()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 177 | S->setIfLoc(ReadSourceLocation()); |
| 178 | S->setElseLoc(ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 179 | } |
| 180 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 181 | void ASTStmtReader::VisitSwitchStmt(SwitchStmt *S) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 182 | VisitStmt(S); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 183 | S->setInit(Record.readSubStmt()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 184 | S->setConditionVariable(Record.getContext(), ReadDeclAs<VarDecl>()); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 185 | S->setCond(Record.readSubExpr()); |
| 186 | S->setBody(Record.readSubStmt()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 187 | S->setSwitchLoc(ReadSourceLocation()); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 188 | if (Record.readInt()) |
Ted Kremenek | c42f345 | 2010-09-09 00:05:53 +0000 | [diff] [blame] | 189 | S->setAllEnumCasesCovered(); |
| 190 | |
Craig Topper | a13603a | 2014-05-22 05:54:18 +0000 | [diff] [blame] | 191 | SwitchCase *PrevSC = nullptr; |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 192 | for (auto E = Record.size(); Record.getIdx() != E; ) { |
| 193 | SwitchCase *SC = Record.getSwitchCaseWithID(Record.readInt()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 194 | if (PrevSC) |
| 195 | PrevSC->setNextSwitchCase(SC); |
| 196 | else |
| 197 | S->setSwitchCaseList(SC); |
Mike Stump | 11289f4 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 198 | |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 199 | PrevSC = SC; |
| 200 | } |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 201 | } |
| 202 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 203 | void ASTStmtReader::VisitWhileStmt(WhileStmt *S) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 204 | VisitStmt(S); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 205 | S->setConditionVariable(Record.getContext(), ReadDeclAs<VarDecl>()); |
Douglas Gregor | 7fb0919 | 2011-07-21 22:35:25 +0000 | [diff] [blame] | 206 | |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 207 | S->setCond(Record.readSubExpr()); |
| 208 | S->setBody(Record.readSubStmt()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 209 | S->setWhileLoc(ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 210 | } |
| 211 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 212 | void ASTStmtReader::VisitDoStmt(DoStmt *S) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 213 | VisitStmt(S); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 214 | S->setCond(Record.readSubExpr()); |
| 215 | S->setBody(Record.readSubStmt()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 216 | S->setDoLoc(ReadSourceLocation()); |
| 217 | S->setWhileLoc(ReadSourceLocation()); |
| 218 | S->setRParenLoc(ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 219 | } |
| 220 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 221 | void ASTStmtReader::VisitForStmt(ForStmt *S) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 222 | VisitStmt(S); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 223 | S->setInit(Record.readSubStmt()); |
| 224 | S->setCond(Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 225 | S->setConditionVariable(Record.getContext(), ReadDeclAs<VarDecl>()); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 226 | S->setInc(Record.readSubExpr()); |
| 227 | S->setBody(Record.readSubStmt()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 228 | S->setForLoc(ReadSourceLocation()); |
| 229 | S->setLParenLoc(ReadSourceLocation()); |
| 230 | S->setRParenLoc(ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 231 | } |
| 232 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 233 | void ASTStmtReader::VisitGotoStmt(GotoStmt *S) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 234 | VisitStmt(S); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 235 | S->setLabel(ReadDeclAs<LabelDecl>()); |
| 236 | S->setGotoLoc(ReadSourceLocation()); |
| 237 | S->setLabelLoc(ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 238 | } |
| 239 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 240 | void ASTStmtReader::VisitIndirectGotoStmt(IndirectGotoStmt *S) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 241 | VisitStmt(S); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 242 | S->setGotoLoc(ReadSourceLocation()); |
| 243 | S->setStarLoc(ReadSourceLocation()); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 244 | S->setTarget(Record.readSubExpr()); |
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::VisitContinueStmt(ContinueStmt *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->setContinueLoc(ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 250 | } |
| 251 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 252 | void ASTStmtReader::VisitBreakStmt(BreakStmt *S) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 253 | VisitStmt(S); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 254 | S->setBreakLoc(ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 255 | } |
| 256 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 257 | void ASTStmtReader::VisitReturnStmt(ReturnStmt *S) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 258 | VisitStmt(S); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 259 | S->setRetValue(Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 260 | S->setReturnLoc(ReadSourceLocation()); |
| 261 | S->setNRVOCandidate(ReadDeclAs<VarDecl>()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 262 | } |
| 263 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 264 | void ASTStmtReader::VisitDeclStmt(DeclStmt *S) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 265 | VisitStmt(S); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 266 | S->setStartLoc(ReadSourceLocation()); |
| 267 | S->setEndLoc(ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 268 | |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 269 | if (Record.size() - Record.getIdx() == 1) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 270 | // Single declaration |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 271 | S->setDeclGroup(DeclGroupRef(ReadDecl())); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 272 | } else { |
Chris Lattner | 0e62c1c | 2011-07-23 10:55:15 +0000 | [diff] [blame] | 273 | SmallVector<Decl *, 16> Decls; |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 274 | int N = Record.size() - Record.getIdx(); |
| 275 | Decls.reserve(N); |
| 276 | for (int I = 0; I < N; ++I) |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 277 | Decls.push_back(ReadDecl()); |
| 278 | S->setDeclGroup(DeclGroupRef(DeclGroup::Create(Record.getContext(), |
Douglas Gregor | 038c338 | 2009-05-22 22:45:36 +0000 | [diff] [blame] | 279 | Decls.data(), |
| 280 | Decls.size()))); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 281 | } |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 282 | } |
| 283 | |
John McCall | f413f5e | 2013-05-03 00:10:13 +0000 | [diff] [blame] | 284 | void ASTStmtReader::VisitAsmStmt(AsmStmt *S) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 285 | VisitStmt(S); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 286 | S->NumOutputs = Record.readInt(); |
| 287 | S->NumInputs = Record.readInt(); |
| 288 | S->NumClobbers = Record.readInt(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 289 | S->setAsmLoc(ReadSourceLocation()); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 290 | S->setVolatile(Record.readInt()); |
| 291 | S->setSimple(Record.readInt()); |
John McCall | f413f5e | 2013-05-03 00:10:13 +0000 | [diff] [blame] | 292 | } |
Mike Stump | 11289f4 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 293 | |
John McCall | f413f5e | 2013-05-03 00:10:13 +0000 | [diff] [blame] | 294 | void ASTStmtReader::VisitGCCAsmStmt(GCCAsmStmt *S) { |
| 295 | VisitAsmStmt(S); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 296 | S->setRParenLoc(ReadSourceLocation()); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 297 | S->setAsmString(cast_or_null<StringLiteral>(Record.readSubStmt())); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 298 | |
John McCall | f413f5e | 2013-05-03 00:10:13 +0000 | [diff] [blame] | 299 | unsigned NumOutputs = S->getNumOutputs(); |
| 300 | unsigned NumInputs = S->getNumInputs(); |
| 301 | unsigned NumClobbers = S->getNumClobbers(); |
| 302 | |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 303 | // Outputs and inputs |
Chris Lattner | 0e62c1c | 2011-07-23 10:55:15 +0000 | [diff] [blame] | 304 | SmallVector<IdentifierInfo *, 16> Names; |
| 305 | SmallVector<StringLiteral*, 16> Constraints; |
| 306 | SmallVector<Stmt*, 16> Exprs; |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 307 | for (unsigned I = 0, N = NumOutputs + NumInputs; I != N; ++I) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 308 | Names.push_back(Record.getIdentifierInfo()); |
| 309 | Constraints.push_back(cast_or_null<StringLiteral>(Record.readSubStmt())); |
| 310 | Exprs.push_back(Record.readSubStmt()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 311 | } |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 312 | |
| 313 | // Constraints |
Chris Lattner | 0e62c1c | 2011-07-23 10:55:15 +0000 | [diff] [blame] | 314 | SmallVector<StringLiteral*, 16> Clobbers; |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 315 | for (unsigned I = 0; I != NumClobbers; ++I) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 316 | Clobbers.push_back(cast_or_null<StringLiteral>(Record.readSubStmt())); |
Anders Carlsson | 96fe0b5 | 2010-01-30 19:34:25 +0000 | [diff] [blame] | 317 | |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 318 | S->setOutputsAndInputsAndClobbers(Record.getContext(), |
| 319 | Names.data(), Constraints.data(), |
| 320 | Exprs.data(), NumOutputs, NumInputs, |
Anders Carlsson | 96fe0b5 | 2010-01-30 19:34:25 +0000 | [diff] [blame] | 321 | Clobbers.data(), NumClobbers); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 322 | } |
| 323 | |
Chad Rosier | 3250302 | 2012-06-11 20:47:18 +0000 | [diff] [blame] | 324 | void ASTStmtReader::VisitMSAsmStmt(MSAsmStmt *S) { |
John McCall | f413f5e | 2013-05-03 00:10:13 +0000 | [diff] [blame] | 325 | VisitAsmStmt(S); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 326 | S->LBraceLoc = ReadSourceLocation(); |
| 327 | S->EndLoc = ReadSourceLocation(); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 328 | S->NumAsmToks = Record.readInt(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 329 | std::string AsmStr = ReadString(); |
John McCall | f413f5e | 2013-05-03 00:10:13 +0000 | [diff] [blame] | 330 | |
| 331 | // Read the tokens. |
| 332 | SmallVector<Token, 16> AsmToks; |
| 333 | AsmToks.reserve(S->NumAsmToks); |
| 334 | for (unsigned i = 0, e = S->NumAsmToks; i != e; ++i) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 335 | AsmToks.push_back(Record.readToken()); |
John McCall | f413f5e | 2013-05-03 00:10:13 +0000 | [diff] [blame] | 336 | } |
| 337 | |
| 338 | // The calls to reserve() for the FooData vectors are mandatory to |
| 339 | // prevent dead StringRefs in the Foo vectors. |
| 340 | |
| 341 | // Read the clobbers. |
| 342 | SmallVector<std::string, 16> ClobbersData; |
| 343 | SmallVector<StringRef, 16> Clobbers; |
| 344 | ClobbersData.reserve(S->NumClobbers); |
| 345 | Clobbers.reserve(S->NumClobbers); |
| 346 | for (unsigned i = 0, e = S->NumClobbers; i != e; ++i) { |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 347 | ClobbersData.push_back(ReadString()); |
John McCall | f413f5e | 2013-05-03 00:10:13 +0000 | [diff] [blame] | 348 | Clobbers.push_back(ClobbersData.back()); |
| 349 | } |
| 350 | |
| 351 | // Read the operands. |
| 352 | unsigned NumOperands = S->NumOutputs + S->NumInputs; |
| 353 | SmallVector<Expr*, 16> Exprs; |
| 354 | SmallVector<std::string, 16> ConstraintsData; |
| 355 | SmallVector<StringRef, 16> Constraints; |
| 356 | Exprs.reserve(NumOperands); |
| 357 | ConstraintsData.reserve(NumOperands); |
| 358 | Constraints.reserve(NumOperands); |
| 359 | for (unsigned i = 0; i != NumOperands; ++i) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 360 | Exprs.push_back(cast<Expr>(Record.readSubStmt())); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 361 | ConstraintsData.push_back(ReadString()); |
John McCall | f413f5e | 2013-05-03 00:10:13 +0000 | [diff] [blame] | 362 | Constraints.push_back(ConstraintsData.back()); |
| 363 | } |
| 364 | |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 365 | S->initialize(Record.getContext(), AsmStr, AsmToks, |
John McCall | f413f5e | 2013-05-03 00:10:13 +0000 | [diff] [blame] | 366 | Constraints, Exprs, Clobbers); |
Chad Rosier | 3250302 | 2012-06-11 20:47:18 +0000 | [diff] [blame] | 367 | } |
| 368 | |
Richard Smith | 9f690bd | 2015-10-27 06:02:45 +0000 | [diff] [blame] | 369 | void ASTStmtReader::VisitCoroutineBodyStmt(CoroutineBodyStmt *S) { |
Gor Nishanov | f5ecb5e | 2017-07-25 18:01:49 +0000 | [diff] [blame] | 370 | VisitStmt(S); |
| 371 | assert(Record.peekInt() == S->NumParams); |
| 372 | Record.skipInts(1); |
| 373 | auto *StoredStmts = S->getStoredStmts(); |
| 374 | for (unsigned i = 0; |
| 375 | i < CoroutineBodyStmt::SubStmt::FirstParamMove + S->NumParams; ++i) |
| 376 | StoredStmts[i] = Record.readSubStmt(); |
Richard Smith | 9f690bd | 2015-10-27 06:02:45 +0000 | [diff] [blame] | 377 | } |
| 378 | |
| 379 | void ASTStmtReader::VisitCoreturnStmt(CoreturnStmt *S) { |
Gor Nishanov | f5ecb5e | 2017-07-25 18:01:49 +0000 | [diff] [blame] | 380 | VisitStmt(S); |
| 381 | S->CoreturnLoc = Record.readSourceLocation(); |
| 382 | for (auto &SubStmt: S->SubStmts) |
| 383 | SubStmt = Record.readSubStmt(); |
| 384 | S->IsImplicit = Record.readInt() != 0; |
Richard Smith | 9f690bd | 2015-10-27 06:02:45 +0000 | [diff] [blame] | 385 | } |
| 386 | |
Gor Nishanov | f5ecb5e | 2017-07-25 18:01:49 +0000 | [diff] [blame] | 387 | void ASTStmtReader::VisitCoawaitExpr(CoawaitExpr *E) { |
| 388 | VisitExpr(E); |
| 389 | E->KeywordLoc = ReadSourceLocation(); |
| 390 | for (auto &SubExpr: E->SubExprs) |
| 391 | SubExpr = Record.readSubStmt(); |
| 392 | E->OpaqueValue = cast_or_null<OpaqueValueExpr>(Record.readSubStmt()); |
| 393 | E->setIsImplicit(Record.readInt() != 0); |
Richard Smith | 9f690bd | 2015-10-27 06:02:45 +0000 | [diff] [blame] | 394 | } |
| 395 | |
Gor Nishanov | f5ecb5e | 2017-07-25 18:01:49 +0000 | [diff] [blame] | 396 | void ASTStmtReader::VisitCoyieldExpr(CoyieldExpr *E) { |
| 397 | VisitExpr(E); |
| 398 | E->KeywordLoc = ReadSourceLocation(); |
| 399 | for (auto &SubExpr: E->SubExprs) |
| 400 | SubExpr = Record.readSubStmt(); |
| 401 | E->OpaqueValue = cast_or_null<OpaqueValueExpr>(Record.readSubStmt()); |
Eric Fiselier | 20f25cb | 2017-03-06 23:38:15 +0000 | [diff] [blame] | 402 | } |
| 403 | |
Gor Nishanov | f5ecb5e | 2017-07-25 18:01:49 +0000 | [diff] [blame] | 404 | void ASTStmtReader::VisitDependentCoawaitExpr(DependentCoawaitExpr *E) { |
| 405 | VisitExpr(E); |
| 406 | E->KeywordLoc = ReadSourceLocation(); |
| 407 | for (auto &SubExpr: E->SubExprs) |
| 408 | SubExpr = Record.readSubStmt(); |
Richard Smith | 9f690bd | 2015-10-27 06:02:45 +0000 | [diff] [blame] | 409 | } |
| 410 | |
Tareq A. Siraj | 24110cc | 2013-04-16 18:53:08 +0000 | [diff] [blame] | 411 | void ASTStmtReader::VisitCapturedStmt(CapturedStmt *S) { |
Ben Langmuir | ce914fc | 2013-05-03 19:20:19 +0000 | [diff] [blame] | 412 | VisitStmt(S); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 413 | Record.skipInts(1); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 414 | S->setCapturedDecl(ReadDeclAs<CapturedDecl>()); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 415 | S->setCapturedRegionKind(static_cast<CapturedRegionKind>(Record.readInt())); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 416 | S->setCapturedRecordDecl(ReadDeclAs<RecordDecl>()); |
Ben Langmuir | ce914fc | 2013-05-03 19:20:19 +0000 | [diff] [blame] | 417 | |
| 418 | // Capture inits |
| 419 | for (CapturedStmt::capture_init_iterator I = S->capture_init_begin(), |
| 420 | E = S->capture_init_end(); |
| 421 | I != E; ++I) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 422 | *I = Record.readSubExpr(); |
Ben Langmuir | ce914fc | 2013-05-03 19:20:19 +0000 | [diff] [blame] | 423 | |
| 424 | // Body |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 425 | S->setCapturedStmt(Record.readSubStmt()); |
Wei Pan | 17fbf6e | 2013-05-04 03:59:06 +0000 | [diff] [blame] | 426 | S->getCapturedDecl()->setBody(S->getCapturedStmt()); |
Ben Langmuir | ce914fc | 2013-05-03 19:20:19 +0000 | [diff] [blame] | 427 | |
| 428 | // Captures |
Aaron Ballman | c656303a | 2014-03-14 18:08:33 +0000 | [diff] [blame] | 429 | for (auto &I : S->captures()) { |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 430 | I.VarAndKind.setPointer(ReadDeclAs<VarDecl>()); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 431 | I.VarAndKind.setInt( |
| 432 | static_cast<CapturedStmt::VariableCaptureKind>(Record.readInt())); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 433 | I.Loc = ReadSourceLocation(); |
Ben Langmuir | ce914fc | 2013-05-03 19:20:19 +0000 | [diff] [blame] | 434 | } |
Tareq A. Siraj | 24110cc | 2013-04-16 18:53:08 +0000 | [diff] [blame] | 435 | } |
| 436 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 437 | void ASTStmtReader::VisitExpr(Expr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 438 | VisitStmt(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 439 | E->setType(Record.readType()); |
| 440 | E->setTypeDependent(Record.readInt()); |
| 441 | E->setValueDependent(Record.readInt()); |
| 442 | E->setInstantiationDependent(Record.readInt()); |
| 443 | E->ExprBits.ContainsUnexpandedParameterPack = Record.readInt(); |
| 444 | E->setValueKind(static_cast<ExprValueKind>(Record.readInt())); |
| 445 | E->setObjectKind(static_cast<ExprObjectKind>(Record.readInt())); |
| 446 | assert(Record.getIdx() == NumExprFields && |
| 447 | "Incorrect expression field count"); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 448 | } |
| 449 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 450 | void ASTStmtReader::VisitPredefinedExpr(PredefinedExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 451 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 452 | E->setLocation(ReadSourceLocation()); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 453 | E->Type = (PredefinedExpr::IdentType)Record.readInt(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 454 | E->FnName = cast_or_null<StringLiteral>(Record.readSubExpr()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 455 | } |
| 456 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 457 | void ASTStmtReader::VisitDeclRefExpr(DeclRefExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 458 | VisitExpr(E); |
Argyrios Kyrtzidis | 1985bb3 | 2010-07-08 13:09:47 +0000 | [diff] [blame] | 459 | |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 460 | E->DeclRefExprBits.HasQualifier = Record.readInt(); |
| 461 | E->DeclRefExprBits.HasFoundDecl = Record.readInt(); |
| 462 | E->DeclRefExprBits.HasTemplateKWAndArgsInfo = Record.readInt(); |
| 463 | E->DeclRefExprBits.HadMultipleCandidates = Record.readInt(); |
| 464 | E->DeclRefExprBits.RefersToEnclosingVariableOrCapture = Record.readInt(); |
Anders Carlsson | 80756f6 | 2011-03-06 18:19:42 +0000 | [diff] [blame] | 465 | unsigned NumTemplateArgs = 0; |
Abramo Bagnara | 7945c98 | 2012-01-27 09:46:47 +0000 | [diff] [blame] | 466 | if (E->hasTemplateKWAndArgsInfo()) |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 467 | NumTemplateArgs = Record.readInt(); |
Anders Carlsson | 80756f6 | 2011-03-06 18:19:42 +0000 | [diff] [blame] | 468 | |
Chandler Carruth | 0e43996 | 2011-05-01 21:29:53 +0000 | [diff] [blame] | 469 | if (E->hasQualifier()) |
James Y Knight | e7d8228 | 2015-12-29 18:15:14 +0000 | [diff] [blame] | 470 | new (E->getTrailingObjects<NestedNameSpecifierLoc>()) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 471 | NestedNameSpecifierLoc(Record.readNestedNameSpecifierLoc()); |
Argyrios Kyrtzidis | 1985bb3 | 2010-07-08 13:09:47 +0000 | [diff] [blame] | 472 | |
Chandler Carruth | 8d26bb0 | 2011-05-01 23:48:14 +0000 | [diff] [blame] | 473 | if (E->hasFoundDecl()) |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 474 | *E->getTrailingObjects<NamedDecl *>() = ReadDeclAs<NamedDecl>(); |
Chandler Carruth | 8d26bb0 | 2011-05-01 23:48:14 +0000 | [diff] [blame] | 475 | |
Abramo Bagnara | 7945c98 | 2012-01-27 09:46:47 +0000 | [diff] [blame] | 476 | if (E->hasTemplateKWAndArgsInfo()) |
James Y Knight | e7d8228 | 2015-12-29 18:15:14 +0000 | [diff] [blame] | 477 | ReadTemplateKWAndArgsInfo( |
| 478 | *E->getTrailingObjects<ASTTemplateKWAndArgsInfo>(), |
| 479 | E->getTrailingObjects<TemplateArgumentLoc>(), NumTemplateArgs); |
Argyrios Kyrtzidis | 1985bb3 | 2010-07-08 13:09:47 +0000 | [diff] [blame] | 480 | |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 481 | E->setDecl(ReadDeclAs<ValueDecl>()); |
| 482 | E->setLocation(ReadSourceLocation()); |
| 483 | ReadDeclarationNameLoc(E->DNLoc, E->getDecl()->getDeclName()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 484 | } |
| 485 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 486 | void ASTStmtReader::VisitIntegerLiteral(IntegerLiteral *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 487 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 488 | E->setLocation(ReadSourceLocation()); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 489 | E->setValue(Record.getContext(), Record.readAPInt()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 490 | } |
| 491 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 492 | void ASTStmtReader::VisitFloatingLiteral(FloatingLiteral *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 493 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 494 | E->setRawSemantics(static_cast<Stmt::APFloatSemantics>(Record.readInt())); |
| 495 | E->setExact(Record.readInt()); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 496 | E->setValue(Record.getContext(), Record.readAPFloat(E->getSemantics())); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 497 | E->setLocation(ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 498 | } |
| 499 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 500 | void ASTStmtReader::VisitImaginaryLiteral(ImaginaryLiteral *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 501 | VisitExpr(E); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 502 | E->setSubExpr(Record.readSubExpr()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 503 | } |
| 504 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 505 | void ASTStmtReader::VisitStringLiteral(StringLiteral *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 506 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 507 | unsigned Len = Record.readInt(); |
| 508 | assert(Record.peekInt() == E->getNumConcatenated() && |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 509 | "Wrong number of concatenated tokens!"); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 510 | Record.skipInts(1); |
Eli Friedman | fcec630 | 2011-11-01 02:23:42 +0000 | [diff] [blame] | 511 | StringLiteral::StringKind kind = |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 512 | static_cast<StringLiteral::StringKind>(Record.readInt()); |
| 513 | bool isPascal = Record.readInt(); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 514 | |
Mike Stump | 11289f4 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 515 | // Read string data |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 516 | auto B = &Record.peekInt(); |
| 517 | SmallString<16> Str(B, B + Len); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 518 | E->setString(Record.getContext(), Str, kind, isPascal); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 519 | Record.skipInts(Len); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 520 | |
| 521 | // Read source locations |
| 522 | for (unsigned I = 0, N = E->getNumConcatenated(); I != N; ++I) |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 523 | E->setStrTokenLoc(I, ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 524 | } |
| 525 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 526 | void ASTStmtReader::VisitCharacterLiteral(CharacterLiteral *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 527 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 528 | E->setValue(Record.readInt()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 529 | E->setLocation(ReadSourceLocation()); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 530 | E->setKind(static_cast<CharacterLiteral::CharacterKind>(Record.readInt())); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 531 | } |
| 532 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 533 | void ASTStmtReader::VisitParenExpr(ParenExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 534 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 535 | E->setLParen(ReadSourceLocation()); |
| 536 | E->setRParen(ReadSourceLocation()); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 537 | E->setSubExpr(Record.readSubExpr()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 538 | } |
| 539 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 540 | void ASTStmtReader::VisitParenListExpr(ParenListExpr *E) { |
Argyrios Kyrtzidis | f9f47c8 | 2010-06-30 08:49:18 +0000 | [diff] [blame] | 541 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 542 | unsigned NumExprs = Record.readInt(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 543 | E->Exprs = new (Record.getContext()) Stmt*[NumExprs]; |
Argyrios Kyrtzidis | f9f47c8 | 2010-06-30 08:49:18 +0000 | [diff] [blame] | 544 | for (unsigned i = 0; i != NumExprs; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 545 | E->Exprs[i] = Record.readSubStmt(); |
Argyrios Kyrtzidis | f9f47c8 | 2010-06-30 08:49:18 +0000 | [diff] [blame] | 546 | E->NumExprs = NumExprs; |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 547 | E->LParenLoc = ReadSourceLocation(); |
| 548 | E->RParenLoc = ReadSourceLocation(); |
Argyrios Kyrtzidis | f9f47c8 | 2010-06-30 08:49:18 +0000 | [diff] [blame] | 549 | } |
| 550 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 551 | void ASTStmtReader::VisitUnaryOperator(UnaryOperator *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 552 | VisitExpr(E); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 553 | E->setSubExpr(Record.readSubExpr()); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 554 | E->setOpcode((UnaryOperator::Opcode)Record.readInt()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 555 | E->setOperatorLoc(ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 556 | } |
| 557 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 558 | void ASTStmtReader::VisitOffsetOfExpr(OffsetOfExpr *E) { |
Douglas Gregor | 882211c | 2010-04-28 22:16:22 +0000 | [diff] [blame] | 559 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 560 | assert(E->getNumComponents() == Record.peekInt()); |
| 561 | Record.skipInts(1); |
| 562 | assert(E->getNumExpressions() == Record.peekInt()); |
| 563 | Record.skipInts(1); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 564 | E->setOperatorLoc(ReadSourceLocation()); |
| 565 | E->setRParenLoc(ReadSourceLocation()); |
| 566 | E->setTypeSourceInfo(GetTypeSourceInfo()); |
Douglas Gregor | 882211c | 2010-04-28 22:16:22 +0000 | [diff] [blame] | 567 | for (unsigned I = 0, N = E->getNumComponents(); I != N; ++I) { |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 568 | OffsetOfNode::Kind Kind = static_cast<OffsetOfNode::Kind>(Record.readInt()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 569 | SourceLocation Start = ReadSourceLocation(); |
| 570 | SourceLocation End = ReadSourceLocation(); |
Douglas Gregor | 882211c | 2010-04-28 22:16:22 +0000 | [diff] [blame] | 571 | switch (Kind) { |
James Y Knight | 7281c35 | 2015-12-29 22:31:18 +0000 | [diff] [blame] | 572 | case OffsetOfNode::Array: |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 573 | E->setComponent(I, OffsetOfNode(Start, Record.readInt(), End)); |
Douglas Gregor | 882211c | 2010-04-28 22:16:22 +0000 | [diff] [blame] | 574 | break; |
| 575 | |
James Y Knight | 7281c35 | 2015-12-29 22:31:18 +0000 | [diff] [blame] | 576 | case OffsetOfNode::Field: |
| 577 | E->setComponent( |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 578 | I, OffsetOfNode(Start, ReadDeclAs<FieldDecl>(), End)); |
Douglas Gregor | 882211c | 2010-04-28 22:16:22 +0000 | [diff] [blame] | 579 | break; |
James Y Knight | 7281c35 | 2015-12-29 22:31:18 +0000 | [diff] [blame] | 580 | |
| 581 | case OffsetOfNode::Identifier: |
| 582 | E->setComponent( |
| 583 | I, |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 584 | OffsetOfNode(Start, Record.getIdentifierInfo(), End)); |
James Y Knight | 7281c35 | 2015-12-29 22:31:18 +0000 | [diff] [blame] | 585 | break; |
| 586 | |
| 587 | case OffsetOfNode::Base: { |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 588 | CXXBaseSpecifier *Base = new (Record.getContext()) CXXBaseSpecifier(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 589 | *Base = Record.readCXXBaseSpecifier(); |
James Y Knight | 7281c35 | 2015-12-29 22:31:18 +0000 | [diff] [blame] | 590 | E->setComponent(I, OffsetOfNode(Base)); |
Douglas Gregor | d170206 | 2010-04-29 00:18:15 +0000 | [diff] [blame] | 591 | break; |
Douglas Gregor | 882211c | 2010-04-28 22:16:22 +0000 | [diff] [blame] | 592 | } |
Argyrios Kyrtzidis | d67d4cc | 2010-07-29 18:16:10 +0000 | [diff] [blame] | 593 | } |
Douglas Gregor | 882211c | 2010-04-28 22:16:22 +0000 | [diff] [blame] | 594 | } |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 595 | |
Douglas Gregor | 882211c | 2010-04-28 22:16:22 +0000 | [diff] [blame] | 596 | for (unsigned I = 0, N = E->getNumExpressions(); I != N; ++I) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 597 | E->setIndexExpr(I, Record.readSubExpr()); |
Douglas Gregor | 882211c | 2010-04-28 22:16:22 +0000 | [diff] [blame] | 598 | } |
| 599 | |
Peter Collingbourne | e190dee | 2011-03-11 19:24:49 +0000 | [diff] [blame] | 600 | void ASTStmtReader::VisitUnaryExprOrTypeTraitExpr(UnaryExprOrTypeTraitExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 601 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 602 | E->setKind(static_cast<UnaryExprOrTypeTrait>(Record.readInt())); |
| 603 | if (Record.peekInt() == 0) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 604 | E->setArgument(Record.readSubExpr()); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 605 | Record.skipInts(1); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 606 | } else { |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 607 | E->setArgument(GetTypeSourceInfo()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 608 | } |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 609 | E->setOperatorLoc(ReadSourceLocation()); |
| 610 | E->setRParenLoc(ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 611 | } |
| 612 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 613 | void ASTStmtReader::VisitArraySubscriptExpr(ArraySubscriptExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 614 | VisitExpr(E); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 615 | E->setLHS(Record.readSubExpr()); |
| 616 | E->setRHS(Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 617 | E->setRBracketLoc(ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 618 | } |
| 619 | |
Alexey Bataev | 1a3320e | 2015-08-25 14:24:04 +0000 | [diff] [blame] | 620 | void ASTStmtReader::VisitOMPArraySectionExpr(OMPArraySectionExpr *E) { |
| 621 | VisitExpr(E); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 622 | E->setBase(Record.readSubExpr()); |
| 623 | E->setLowerBound(Record.readSubExpr()); |
| 624 | E->setLength(Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 625 | E->setColonLoc(ReadSourceLocation()); |
| 626 | E->setRBracketLoc(ReadSourceLocation()); |
Alexey Bataev | 1a3320e | 2015-08-25 14:24:04 +0000 | [diff] [blame] | 627 | } |
| 628 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 629 | void ASTStmtReader::VisitCallExpr(CallExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 630 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 631 | E->setNumArgs(Record.getContext(), Record.readInt()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 632 | E->setRParenLoc(ReadSourceLocation()); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 633 | E->setCallee(Record.readSubExpr()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 634 | for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 635 | E->setArg(I, Record.readSubExpr()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 636 | } |
| 637 | |
John McCall | fa19404 | 2011-07-15 07:00:14 +0000 | [diff] [blame] | 638 | void ASTStmtReader::VisitCXXMemberCallExpr(CXXMemberCallExpr *E) { |
| 639 | VisitCallExpr(E); |
| 640 | } |
| 641 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 642 | void ASTStmtReader::VisitMemberExpr(MemberExpr *E) { |
Argyrios Kyrtzidis | 1985bb3 | 2010-07-08 13:09:47 +0000 | [diff] [blame] | 643 | // Don't call VisitExpr, this is fully initialized at creation. |
| 644 | assert(E->getStmtClass() == Stmt::MemberExprClass && |
| 645 | "It's a subclass, we must advance Idx!"); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 646 | } |
| 647 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 648 | void ASTStmtReader::VisitObjCIsaExpr(ObjCIsaExpr *E) { |
Steve Naroff | e87026a | 2009-07-24 17:54:45 +0000 | [diff] [blame] | 649 | VisitExpr(E); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 650 | E->setBase(Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 651 | E->setIsaMemberLoc(ReadSourceLocation()); |
| 652 | E->setOpLoc(ReadSourceLocation()); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 653 | E->setArrow(Record.readInt()); |
Steve Naroff | e87026a | 2009-07-24 17:54:45 +0000 | [diff] [blame] | 654 | } |
| 655 | |
John McCall | 31168b0 | 2011-06-15 23:02:42 +0000 | [diff] [blame] | 656 | void ASTStmtReader:: |
| 657 | VisitObjCIndirectCopyRestoreExpr(ObjCIndirectCopyRestoreExpr *E) { |
| 658 | VisitExpr(E); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 659 | E->Operand = Record.readSubExpr(); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 660 | E->setShouldCopy(Record.readInt()); |
John McCall | 31168b0 | 2011-06-15 23:02:42 +0000 | [diff] [blame] | 661 | } |
| 662 | |
| 663 | void ASTStmtReader::VisitObjCBridgedCastExpr(ObjCBridgedCastExpr *E) { |
| 664 | VisitExplicitCastExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 665 | E->LParenLoc = ReadSourceLocation(); |
| 666 | E->BridgeKeywordLoc = ReadSourceLocation(); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 667 | E->Kind = Record.readInt(); |
John McCall | 31168b0 | 2011-06-15 23:02:42 +0000 | [diff] [blame] | 668 | } |
| 669 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 670 | void ASTStmtReader::VisitCastExpr(CastExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 671 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 672 | unsigned NumBaseSpecs = Record.readInt(); |
John McCall | cf14216 | 2010-08-07 06:22:56 +0000 | [diff] [blame] | 673 | assert(NumBaseSpecs == E->path_size()); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 674 | E->setSubExpr(Record.readSubExpr()); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 675 | E->setCastKind((CastKind)Record.readInt()); |
John McCall | cf14216 | 2010-08-07 06:22:56 +0000 | [diff] [blame] | 676 | CastExpr::path_iterator BaseI = E->path_begin(); |
Argyrios Kyrtzidis | 3701fcd | 2010-07-02 23:30:27 +0000 | [diff] [blame] | 677 | while (NumBaseSpecs--) { |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 678 | CXXBaseSpecifier *BaseSpec = new (Record.getContext()) CXXBaseSpecifier; |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 679 | *BaseSpec = Record.readCXXBaseSpecifier(); |
John McCall | cf14216 | 2010-08-07 06:22:56 +0000 | [diff] [blame] | 680 | *BaseI++ = BaseSpec; |
Argyrios Kyrtzidis | 3701fcd | 2010-07-02 23:30:27 +0000 | [diff] [blame] | 681 | } |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 682 | } |
| 683 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 684 | void ASTStmtReader::VisitBinaryOperator(BinaryOperator *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 685 | VisitExpr(E); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 686 | E->setLHS(Record.readSubExpr()); |
| 687 | E->setRHS(Record.readSubExpr()); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 688 | E->setOpcode((BinaryOperator::Opcode)Record.readInt()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 689 | E->setOperatorLoc(ReadSourceLocation()); |
Adam Nemet | 484aa45 | 2017-03-27 19:17:25 +0000 | [diff] [blame] | 690 | E->setFPFeatures(FPOptions(Record.readInt())); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 691 | } |
| 692 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 693 | void ASTStmtReader::VisitCompoundAssignOperator(CompoundAssignOperator *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 694 | VisitBinaryOperator(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 695 | E->setComputationLHSType(Record.readType()); |
| 696 | E->setComputationResultType(Record.readType()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 697 | } |
| 698 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 699 | void ASTStmtReader::VisitConditionalOperator(ConditionalOperator *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 700 | VisitExpr(E); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 701 | E->SubExprs[ConditionalOperator::COND] = Record.readSubExpr(); |
| 702 | E->SubExprs[ConditionalOperator::LHS] = Record.readSubExpr(); |
| 703 | E->SubExprs[ConditionalOperator::RHS] = Record.readSubExpr(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 704 | E->QuestionLoc = ReadSourceLocation(); |
| 705 | E->ColonLoc = ReadSourceLocation(); |
John McCall | c07a0c7 | 2011-02-17 10:25:35 +0000 | [diff] [blame] | 706 | } |
| 707 | |
| 708 | void |
| 709 | ASTStmtReader::VisitBinaryConditionalOperator(BinaryConditionalOperator *E) { |
| 710 | VisitExpr(E); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 711 | E->OpaqueValue = cast<OpaqueValueExpr>(Record.readSubExpr()); |
| 712 | E->SubExprs[BinaryConditionalOperator::COMMON] = Record.readSubExpr(); |
| 713 | E->SubExprs[BinaryConditionalOperator::COND] = Record.readSubExpr(); |
| 714 | E->SubExprs[BinaryConditionalOperator::LHS] = Record.readSubExpr(); |
| 715 | E->SubExprs[BinaryConditionalOperator::RHS] = Record.readSubExpr(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 716 | E->QuestionLoc = ReadSourceLocation(); |
| 717 | E->ColonLoc = ReadSourceLocation(); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 718 | } |
| 719 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 720 | void ASTStmtReader::VisitImplicitCastExpr(ImplicitCastExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 721 | VisitCastExpr(E); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 722 | } |
| 723 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 724 | void ASTStmtReader::VisitExplicitCastExpr(ExplicitCastExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 725 | VisitCastExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 726 | E->setTypeInfoAsWritten(GetTypeSourceInfo()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 727 | } |
| 728 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 729 | void ASTStmtReader::VisitCStyleCastExpr(CStyleCastExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 730 | VisitExplicitCastExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 731 | E->setLParenLoc(ReadSourceLocation()); |
| 732 | E->setRParenLoc(ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 733 | } |
| 734 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 735 | void ASTStmtReader::VisitCompoundLiteralExpr(CompoundLiteralExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 736 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 737 | E->setLParenLoc(ReadSourceLocation()); |
| 738 | E->setTypeSourceInfo(GetTypeSourceInfo()); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 739 | E->setInitializer(Record.readSubExpr()); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 740 | E->setFileScope(Record.readInt()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 741 | } |
| 742 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 743 | void ASTStmtReader::VisitExtVectorElementExpr(ExtVectorElementExpr *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->setBase(Record.readSubExpr()); |
| 746 | E->setAccessor(Record.getIdentifierInfo()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 747 | E->setAccessorLoc(ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 748 | } |
| 749 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 750 | void ASTStmtReader::VisitInitListExpr(InitListExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 751 | VisitExpr(E); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 752 | if (InitListExpr *SyntForm = cast_or_null<InitListExpr>(Record.readSubStmt())) |
Abramo Bagnara | 8d16bd4 | 2012-11-08 18:41:43 +0000 | [diff] [blame] | 753 | E->setSyntacticForm(SyntForm); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 754 | E->setLBraceLoc(ReadSourceLocation()); |
| 755 | E->setRBraceLoc(ReadSourceLocation()); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 756 | bool isArrayFiller = Record.readInt(); |
Craig Topper | a13603a | 2014-05-22 05:54:18 +0000 | [diff] [blame] | 757 | Expr *filler = nullptr; |
Argyrios Kyrtzidis | bbcefa7 | 2011-04-22 05:29:30 +0000 | [diff] [blame] | 758 | if (isArrayFiller) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 759 | filler = Record.readSubExpr(); |
Argyrios Kyrtzidis | bbcefa7 | 2011-04-22 05:29:30 +0000 | [diff] [blame] | 760 | E->ArrayFillerOrUnionFieldInit = filler; |
| 761 | } else |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 762 | E->ArrayFillerOrUnionFieldInit = ReadDeclAs<FieldDecl>(); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 763 | E->sawArrayRangeDesignator(Record.readInt()); |
| 764 | unsigned NumInits = Record.readInt(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 765 | E->reserveInits(Record.getContext(), NumInits); |
Argyrios Kyrtzidis | bbcefa7 | 2011-04-22 05:29:30 +0000 | [diff] [blame] | 766 | if (isArrayFiller) { |
| 767 | for (unsigned I = 0; I != NumInits; ++I) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 768 | Expr *init = Record.readSubExpr(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 769 | E->updateInit(Record.getContext(), I, init ? init : filler); |
Argyrios Kyrtzidis | bbcefa7 | 2011-04-22 05:29:30 +0000 | [diff] [blame] | 770 | } |
| 771 | } else { |
| 772 | for (unsigned I = 0; I != NumInits; ++I) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 773 | E->updateInit(Record.getContext(), I, Record.readSubExpr()); |
Argyrios Kyrtzidis | bbcefa7 | 2011-04-22 05:29:30 +0000 | [diff] [blame] | 774 | } |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 775 | } |
| 776 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 777 | void ASTStmtReader::VisitDesignatedInitExpr(DesignatedInitExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 778 | typedef DesignatedInitExpr::Designator Designator; |
| 779 | |
| 780 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 781 | unsigned NumSubExprs = Record.readInt(); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 782 | assert(NumSubExprs == E->getNumSubExprs() && "Wrong number of subexprs"); |
| 783 | for (unsigned I = 0; I != NumSubExprs; ++I) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 784 | E->setSubExpr(I, Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 785 | E->setEqualOrColonLoc(ReadSourceLocation()); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 786 | E->setGNUSyntax(Record.readInt()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 787 | |
Chris Lattner | 0e62c1c | 2011-07-23 10:55:15 +0000 | [diff] [blame] | 788 | SmallVector<Designator, 4> Designators; |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 789 | while (Record.getIdx() < Record.size()) { |
| 790 | switch ((DesignatorTypes)Record.readInt()) { |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 791 | case DESIG_FIELD_DECL: { |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 792 | FieldDecl *Field = ReadDeclAs<FieldDecl>(); |
| 793 | SourceLocation DotLoc = ReadSourceLocation(); |
| 794 | SourceLocation FieldLoc = ReadSourceLocation(); |
Mike Stump | 11289f4 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 795 | Designators.push_back(Designator(Field->getIdentifier(), DotLoc, |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 796 | FieldLoc)); |
| 797 | Designators.back().setField(Field); |
| 798 | break; |
| 799 | } |
| 800 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 801 | case DESIG_FIELD_NAME: { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 802 | const IdentifierInfo *Name = Record.getIdentifierInfo(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 803 | SourceLocation DotLoc = ReadSourceLocation(); |
| 804 | SourceLocation FieldLoc = ReadSourceLocation(); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 805 | Designators.push_back(Designator(Name, DotLoc, FieldLoc)); |
| 806 | break; |
| 807 | } |
Mike Stump | 11289f4 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 808 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 809 | case DESIG_ARRAY: { |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 810 | unsigned Index = Record.readInt(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 811 | SourceLocation LBracketLoc = ReadSourceLocation(); |
| 812 | SourceLocation RBracketLoc = ReadSourceLocation(); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 813 | Designators.push_back(Designator(Index, LBracketLoc, RBracketLoc)); |
| 814 | break; |
| 815 | } |
| 816 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 817 | case DESIG_ARRAY_RANGE: { |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 818 | unsigned Index = Record.readInt(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 819 | SourceLocation LBracketLoc = ReadSourceLocation(); |
| 820 | SourceLocation EllipsisLoc = ReadSourceLocation(); |
| 821 | SourceLocation RBracketLoc = ReadSourceLocation(); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 822 | Designators.push_back(Designator(Index, LBracketLoc, EllipsisLoc, |
| 823 | RBracketLoc)); |
| 824 | break; |
| 825 | } |
| 826 | } |
| 827 | } |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 828 | E->setDesignators(Record.getContext(), |
Douglas Gregor | 03e8bdc | 2010-01-06 23:17:19 +0000 | [diff] [blame] | 829 | Designators.data(), Designators.size()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 830 | } |
| 831 | |
Yunzhong Gao | cb77930 | 2015-06-10 00:27:52 +0000 | [diff] [blame] | 832 | void ASTStmtReader::VisitDesignatedInitUpdateExpr(DesignatedInitUpdateExpr *E) { |
| 833 | VisitExpr(E); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 834 | E->setBase(Record.readSubExpr()); |
| 835 | E->setUpdater(Record.readSubExpr()); |
Yunzhong Gao | cb77930 | 2015-06-10 00:27:52 +0000 | [diff] [blame] | 836 | } |
| 837 | |
| 838 | void ASTStmtReader::VisitNoInitExpr(NoInitExpr *E) { |
| 839 | VisitExpr(E); |
| 840 | } |
| 841 | |
Richard Smith | 410306b | 2016-12-12 02:53:20 +0000 | [diff] [blame] | 842 | void ASTStmtReader::VisitArrayInitLoopExpr(ArrayInitLoopExpr *E) { |
| 843 | VisitExpr(E); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 844 | E->SubExprs[0] = Record.readSubExpr(); |
| 845 | E->SubExprs[1] = Record.readSubExpr(); |
Richard Smith | 410306b | 2016-12-12 02:53:20 +0000 | [diff] [blame] | 846 | } |
| 847 | |
| 848 | void ASTStmtReader::VisitArrayInitIndexExpr(ArrayInitIndexExpr *E) { |
| 849 | VisitExpr(E); |
| 850 | } |
| 851 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 852 | void ASTStmtReader::VisitImplicitValueInitExpr(ImplicitValueInitExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 853 | VisitExpr(E); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 854 | } |
| 855 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 856 | void ASTStmtReader::VisitVAArgExpr(VAArgExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 857 | VisitExpr(E); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 858 | E->setSubExpr(Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 859 | E->setWrittenTypeInfo(GetTypeSourceInfo()); |
| 860 | E->setBuiltinLoc(ReadSourceLocation()); |
| 861 | E->setRParenLoc(ReadSourceLocation()); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 862 | E->setIsMicrosoftABI(Record.readInt()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 863 | } |
| 864 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 865 | void ASTStmtReader::VisitAddrLabelExpr(AddrLabelExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 866 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 867 | E->setAmpAmpLoc(ReadSourceLocation()); |
| 868 | E->setLabelLoc(ReadSourceLocation()); |
| 869 | E->setLabel(ReadDeclAs<LabelDecl>()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 870 | } |
| 871 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 872 | void ASTStmtReader::VisitStmtExpr(StmtExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 873 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 874 | E->setLParenLoc(ReadSourceLocation()); |
| 875 | E->setRParenLoc(ReadSourceLocation()); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 876 | E->setSubStmt(cast_or_null<CompoundStmt>(Record.readSubStmt())); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 877 | } |
| 878 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 879 | void ASTStmtReader::VisitChooseExpr(ChooseExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 880 | VisitExpr(E); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 881 | E->setCond(Record.readSubExpr()); |
| 882 | E->setLHS(Record.readSubExpr()); |
| 883 | E->setRHS(Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 884 | E->setBuiltinLoc(ReadSourceLocation()); |
| 885 | E->setRParenLoc(ReadSourceLocation()); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 886 | E->setIsConditionTrue(Record.readInt()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 887 | } |
| 888 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 889 | void ASTStmtReader::VisitGNUNullExpr(GNUNullExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 890 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 891 | E->setTokenLocation(ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 892 | } |
| 893 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 894 | void ASTStmtReader::VisitShuffleVectorExpr(ShuffleVectorExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 895 | VisitExpr(E); |
Chris Lattner | 0e62c1c | 2011-07-23 10:55:15 +0000 | [diff] [blame] | 896 | SmallVector<Expr *, 16> Exprs; |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 897 | unsigned NumExprs = Record.readInt(); |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 898 | while (NumExprs--) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 899 | Exprs.push_back(Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 900 | E->setExprs(Record.getContext(), Exprs); |
| 901 | E->setBuiltinLoc(ReadSourceLocation()); |
| 902 | E->setRParenLoc(ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 903 | } |
| 904 | |
Hal Finkel | c4d7c82 | 2013-09-18 03:29:45 +0000 | [diff] [blame] | 905 | void ASTStmtReader::VisitConvertVectorExpr(ConvertVectorExpr *E) { |
| 906 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 907 | E->BuiltinLoc = ReadSourceLocation(); |
| 908 | E->RParenLoc = ReadSourceLocation(); |
| 909 | E->TInfo = GetTypeSourceInfo(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 910 | E->SrcExpr = Record.readSubExpr(); |
Hal Finkel | c4d7c82 | 2013-09-18 03:29:45 +0000 | [diff] [blame] | 911 | } |
| 912 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 913 | void ASTStmtReader::VisitBlockExpr(BlockExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 914 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 915 | E->setBlockDecl(ReadDeclAs<BlockDecl>()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 916 | } |
| 917 | |
Peter Collingbourne | 9114759 | 2011-04-15 00:35:48 +0000 | [diff] [blame] | 918 | void ASTStmtReader::VisitGenericSelectionExpr(GenericSelectionExpr *E) { |
| 919 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 920 | E->NumAssocs = Record.readInt(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 921 | E->AssocTypes = new (Record.getContext()) TypeSourceInfo*[E->NumAssocs]; |
Peter Collingbourne | 9114759 | 2011-04-15 00:35:48 +0000 | [diff] [blame] | 922 | E->SubExprs = |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 923 | new(Record.getContext()) Stmt*[GenericSelectionExpr::END_EXPR+E->NumAssocs]; |
Peter Collingbourne | 9114759 | 2011-04-15 00:35:48 +0000 | [diff] [blame] | 924 | |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 925 | E->SubExprs[GenericSelectionExpr::CONTROLLING] = Record.readSubExpr(); |
Peter Collingbourne | 9114759 | 2011-04-15 00:35:48 +0000 | [diff] [blame] | 926 | for (unsigned I = 0, N = E->getNumAssocs(); I != N; ++I) { |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 927 | E->AssocTypes[I] = GetTypeSourceInfo(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 928 | E->SubExprs[GenericSelectionExpr::END_EXPR+I] = Record.readSubExpr(); |
Peter Collingbourne | 9114759 | 2011-04-15 00:35:48 +0000 | [diff] [blame] | 929 | } |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 930 | E->ResultIndex = Record.readInt(); |
Peter Collingbourne | 9114759 | 2011-04-15 00:35:48 +0000 | [diff] [blame] | 931 | |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 932 | E->GenericLoc = ReadSourceLocation(); |
| 933 | E->DefaultLoc = ReadSourceLocation(); |
| 934 | E->RParenLoc = ReadSourceLocation(); |
Peter Collingbourne | 9114759 | 2011-04-15 00:35:48 +0000 | [diff] [blame] | 935 | } |
| 936 | |
John McCall | fe96e0b | 2011-11-06 09:01:30 +0000 | [diff] [blame] | 937 | void ASTStmtReader::VisitPseudoObjectExpr(PseudoObjectExpr *E) { |
| 938 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 939 | unsigned numSemanticExprs = Record.readInt(); |
John McCall | fe96e0b | 2011-11-06 09:01:30 +0000 | [diff] [blame] | 940 | assert(numSemanticExprs + 1 == E->PseudoObjectExprBits.NumSubExprs); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 941 | E->PseudoObjectExprBits.ResultIndex = Record.readInt(); |
John McCall | fe96e0b | 2011-11-06 09:01:30 +0000 | [diff] [blame] | 942 | |
| 943 | // Read the syntactic expression. |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 944 | E->getSubExprsBuffer()[0] = Record.readSubExpr(); |
John McCall | fe96e0b | 2011-11-06 09:01:30 +0000 | [diff] [blame] | 945 | |
| 946 | // Read all the semantic expressions. |
| 947 | for (unsigned i = 0; i != numSemanticExprs; ++i) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 948 | Expr *subExpr = Record.readSubExpr(); |
John McCall | fe96e0b | 2011-11-06 09:01:30 +0000 | [diff] [blame] | 949 | E->getSubExprsBuffer()[i+1] = subExpr; |
| 950 | } |
| 951 | } |
| 952 | |
Eli Friedman | df14b3a | 2011-10-11 02:20:01 +0000 | [diff] [blame] | 953 | void ASTStmtReader::VisitAtomicExpr(AtomicExpr *E) { |
| 954 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 955 | E->Op = AtomicExpr::AtomicOp(Record.readInt()); |
Richard Smith | aa22a8c | 2012-04-10 22:49:28 +0000 | [diff] [blame] | 956 | E->NumSubExprs = AtomicExpr::getNumSubExprs(E->Op); |
| 957 | for (unsigned I = 0; I != E->NumSubExprs; ++I) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 958 | E->SubExprs[I] = Record.readSubExpr(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 959 | E->BuiltinLoc = ReadSourceLocation(); |
| 960 | E->RParenLoc = ReadSourceLocation(); |
Eli Friedman | df14b3a | 2011-10-11 02:20:01 +0000 | [diff] [blame] | 961 | } |
| 962 | |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 963 | //===----------------------------------------------------------------------===// |
| 964 | // Objective-C Expressions and Statements |
| 965 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 966 | void ASTStmtReader::VisitObjCStringLiteral(ObjCStringLiteral *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 967 | VisitExpr(E); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 968 | E->setString(cast<StringLiteral>(Record.readSubStmt())); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 969 | E->setAtLoc(ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 970 | } |
| 971 | |
Patrick Beard | 0caa394 | 2012-04-19 00:25:12 +0000 | [diff] [blame] | 972 | void ASTStmtReader::VisitObjCBoxedExpr(ObjCBoxedExpr *E) { |
Ted Kremenek | e65b086 | 2012-03-06 20:05:56 +0000 | [diff] [blame] | 973 | VisitExpr(E); |
| 974 | // could be one of several IntegerLiteral, FloatLiteral, etc. |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 975 | E->SubExpr = Record.readSubStmt(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 976 | E->BoxingMethod = ReadDeclAs<ObjCMethodDecl>(); |
| 977 | E->Range = ReadSourceRange(); |
Ted Kremenek | e65b086 | 2012-03-06 20:05:56 +0000 | [diff] [blame] | 978 | } |
| 979 | |
| 980 | void ASTStmtReader::VisitObjCArrayLiteral(ObjCArrayLiteral *E) { |
| 981 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 982 | unsigned NumElements = Record.readInt(); |
Ted Kremenek | e65b086 | 2012-03-06 20:05:56 +0000 | [diff] [blame] | 983 | assert(NumElements == E->getNumElements() && "Wrong number of elements"); |
| 984 | Expr **Elements = E->getElements(); |
| 985 | for (unsigned I = 0, N = NumElements; I != N; ++I) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 986 | Elements[I] = Record.readSubExpr(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 987 | E->ArrayWithObjectsMethod = ReadDeclAs<ObjCMethodDecl>(); |
| 988 | E->Range = ReadSourceRange(); |
Ted Kremenek | e65b086 | 2012-03-06 20:05:56 +0000 | [diff] [blame] | 989 | } |
| 990 | |
| 991 | void ASTStmtReader::VisitObjCDictionaryLiteral(ObjCDictionaryLiteral *E) { |
| 992 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 993 | unsigned NumElements = Record.readInt(); |
Ted Kremenek | e65b086 | 2012-03-06 20:05:56 +0000 | [diff] [blame] | 994 | assert(NumElements == E->getNumElements() && "Wrong number of elements"); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 995 | bool HasPackExpansions = Record.readInt(); |
Ted Kremenek | e65b086 | 2012-03-06 20:05:56 +0000 | [diff] [blame] | 996 | assert(HasPackExpansions == E->HasPackExpansions &&"Pack expansion mismatch"); |
James Y Knight | 6c2f06b | 2015-12-31 04:43:19 +0000 | [diff] [blame] | 997 | ObjCDictionaryLiteral::KeyValuePair *KeyValues = |
| 998 | E->getTrailingObjects<ObjCDictionaryLiteral::KeyValuePair>(); |
| 999 | ObjCDictionaryLiteral::ExpansionData *Expansions = |
| 1000 | E->getTrailingObjects<ObjCDictionaryLiteral::ExpansionData>(); |
Ted Kremenek | e65b086 | 2012-03-06 20:05:56 +0000 | [diff] [blame] | 1001 | for (unsigned I = 0; I != NumElements; ++I) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1002 | KeyValues[I].Key = Record.readSubExpr(); |
| 1003 | KeyValues[I].Value = Record.readSubExpr(); |
Ted Kremenek | e65b086 | 2012-03-06 20:05:56 +0000 | [diff] [blame] | 1004 | if (HasPackExpansions) { |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1005 | Expansions[I].EllipsisLoc = ReadSourceLocation(); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1006 | Expansions[I].NumExpansionsPlusOne = Record.readInt(); |
Ted Kremenek | e65b086 | 2012-03-06 20:05:56 +0000 | [diff] [blame] | 1007 | } |
| 1008 | } |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1009 | E->DictWithObjectsMethod = ReadDeclAs<ObjCMethodDecl>(); |
| 1010 | E->Range = ReadSourceRange(); |
Ted Kremenek | e65b086 | 2012-03-06 20:05:56 +0000 | [diff] [blame] | 1011 | } |
| 1012 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1013 | void ASTStmtReader::VisitObjCEncodeExpr(ObjCEncodeExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1014 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1015 | E->setEncodedTypeSourceInfo(GetTypeSourceInfo()); |
| 1016 | E->setAtLoc(ReadSourceLocation()); |
| 1017 | E->setRParenLoc(ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1018 | } |
| 1019 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1020 | void ASTStmtReader::VisitObjCSelectorExpr(ObjCSelectorExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1021 | VisitExpr(E); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1022 | E->setSelector(Record.readSelector()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1023 | E->setAtLoc(ReadSourceLocation()); |
| 1024 | E->setRParenLoc(ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1025 | } |
| 1026 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1027 | void ASTStmtReader::VisitObjCProtocolExpr(ObjCProtocolExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1028 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1029 | E->setProtocol(ReadDeclAs<ObjCProtocolDecl>()); |
| 1030 | E->setAtLoc(ReadSourceLocation()); |
| 1031 | E->ProtoLoc = ReadSourceLocation(); |
| 1032 | E->setRParenLoc(ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1033 | } |
| 1034 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1035 | void ASTStmtReader::VisitObjCIvarRefExpr(ObjCIvarRefExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1036 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1037 | E->setDecl(ReadDeclAs<ObjCIvarDecl>()); |
| 1038 | E->setLocation(ReadSourceLocation()); |
| 1039 | E->setOpLoc(ReadSourceLocation()); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1040 | E->setBase(Record.readSubExpr()); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1041 | E->setIsArrow(Record.readInt()); |
| 1042 | E->setIsFreeIvar(Record.readInt()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1043 | } |
| 1044 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1045 | void ASTStmtReader::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1046 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1047 | unsigned MethodRefFlags = Record.readInt(); |
| 1048 | bool Implicit = Record.readInt() != 0; |
John McCall | b7bd14f | 2010-12-02 01:19:52 +0000 | [diff] [blame] | 1049 | if (Implicit) { |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1050 | ObjCMethodDecl *Getter = ReadDeclAs<ObjCMethodDecl>(); |
| 1051 | ObjCMethodDecl *Setter = ReadDeclAs<ObjCMethodDecl>(); |
Argyrios Kyrtzidis | ab468b0 | 2012-03-30 00:19:18 +0000 | [diff] [blame] | 1052 | E->setImplicitProperty(Getter, Setter, MethodRefFlags); |
John McCall | b7bd14f | 2010-12-02 01:19:52 +0000 | [diff] [blame] | 1053 | } else { |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1054 | E->setExplicitProperty(ReadDeclAs<ObjCPropertyDecl>(), MethodRefFlags); |
Fariborz Jahanian | 681c075 | 2010-10-14 16:04:05 +0000 | [diff] [blame] | 1055 | } |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1056 | E->setLocation(ReadSourceLocation()); |
| 1057 | E->setReceiverLocation(ReadSourceLocation()); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1058 | switch (Record.readInt()) { |
John McCall | b7bd14f | 2010-12-02 01:19:52 +0000 | [diff] [blame] | 1059 | case 0: |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1060 | E->setBase(Record.readSubExpr()); |
John McCall | b7bd14f | 2010-12-02 01:19:52 +0000 | [diff] [blame] | 1061 | break; |
| 1062 | case 1: |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1063 | E->setSuperReceiver(Record.readType()); |
John McCall | b7bd14f | 2010-12-02 01:19:52 +0000 | [diff] [blame] | 1064 | break; |
| 1065 | case 2: |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1066 | E->setClassReceiver(ReadDeclAs<ObjCInterfaceDecl>()); |
John McCall | b7bd14f | 2010-12-02 01:19:52 +0000 | [diff] [blame] | 1067 | break; |
| 1068 | } |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1069 | } |
| 1070 | |
Ted Kremenek | e65b086 | 2012-03-06 20:05:56 +0000 | [diff] [blame] | 1071 | void ASTStmtReader::VisitObjCSubscriptRefExpr(ObjCSubscriptRefExpr *E) { |
| 1072 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1073 | E->setRBracket(ReadSourceLocation()); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1074 | E->setBaseExpr(Record.readSubExpr()); |
| 1075 | E->setKeyExpr(Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1076 | E->GetAtIndexMethodDecl = ReadDeclAs<ObjCMethodDecl>(); |
| 1077 | E->SetAtIndexMethodDecl = ReadDeclAs<ObjCMethodDecl>(); |
Ted Kremenek | e65b086 | 2012-03-06 20:05:56 +0000 | [diff] [blame] | 1078 | } |
| 1079 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1080 | void ASTStmtReader::VisitObjCMessageExpr(ObjCMessageExpr *E) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1081 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1082 | assert(Record.peekInt() == E->getNumArgs()); |
| 1083 | Record.skipInts(1); |
| 1084 | unsigned NumStoredSelLocs = Record.readInt(); |
| 1085 | E->SelLocsKind = Record.readInt(); |
| 1086 | E->setDelegateInitCall(Record.readInt()); |
| 1087 | E->IsImplicit = Record.readInt(); |
Douglas Gregor | 9a12919 | 2010-04-21 00:45:42 +0000 | [diff] [blame] | 1088 | ObjCMessageExpr::ReceiverKind Kind |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1089 | = static_cast<ObjCMessageExpr::ReceiverKind>(Record.readInt()); |
Douglas Gregor | 9a12919 | 2010-04-21 00:45:42 +0000 | [diff] [blame] | 1090 | switch (Kind) { |
| 1091 | case ObjCMessageExpr::Instance: |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1092 | E->setInstanceReceiver(Record.readSubExpr()); |
Douglas Gregor | 9a12919 | 2010-04-21 00:45:42 +0000 | [diff] [blame] | 1093 | break; |
| 1094 | |
| 1095 | case ObjCMessageExpr::Class: |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1096 | E->setClassReceiver(GetTypeSourceInfo()); |
Douglas Gregor | 9a12919 | 2010-04-21 00:45:42 +0000 | [diff] [blame] | 1097 | break; |
| 1098 | |
| 1099 | case ObjCMessageExpr::SuperClass: |
| 1100 | case ObjCMessageExpr::SuperInstance: { |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1101 | QualType T = Record.readType(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1102 | SourceLocation SuperLoc = ReadSourceLocation(); |
Douglas Gregor | 9a12919 | 2010-04-21 00:45:42 +0000 | [diff] [blame] | 1103 | E->setSuper(SuperLoc, T, Kind == ObjCMessageExpr::SuperInstance); |
| 1104 | break; |
| 1105 | } |
| 1106 | } |
| 1107 | |
| 1108 | assert(Kind == E->getReceiverKind()); |
| 1109 | |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1110 | if (Record.readInt()) |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1111 | E->setMethodDecl(ReadDeclAs<ObjCMethodDecl>()); |
Douglas Gregor | 9a12919 | 2010-04-21 00:45:42 +0000 | [diff] [blame] | 1112 | else |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1113 | E->setSelector(Record.readSelector()); |
Douglas Gregor | 9a12919 | 2010-04-21 00:45:42 +0000 | [diff] [blame] | 1114 | |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1115 | E->LBracLoc = ReadSourceLocation(); |
| 1116 | E->RBracLoc = ReadSourceLocation(); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1117 | |
| 1118 | for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1119 | E->setArg(I, Record.readSubExpr()); |
Argyrios Kyrtzidis | a6011e2 | 2011-10-03 06:36:51 +0000 | [diff] [blame] | 1120 | |
| 1121 | SourceLocation *Locs = E->getStoredSelLocs(); |
| 1122 | for (unsigned I = 0; I != NumStoredSelLocs; ++I) |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1123 | Locs[I] = ReadSourceLocation(); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1124 | } |
| 1125 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1126 | void ASTStmtReader::VisitObjCForCollectionStmt(ObjCForCollectionStmt *S) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1127 | VisitStmt(S); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1128 | S->setElement(Record.readSubStmt()); |
| 1129 | S->setCollection(Record.readSubExpr()); |
| 1130 | S->setBody(Record.readSubStmt()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1131 | S->setForLoc(ReadSourceLocation()); |
| 1132 | S->setRParenLoc(ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1133 | } |
| 1134 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1135 | void ASTStmtReader::VisitObjCAtCatchStmt(ObjCAtCatchStmt *S) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1136 | VisitStmt(S); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1137 | S->setCatchBody(Record.readSubStmt()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1138 | S->setCatchParamDecl(ReadDeclAs<VarDecl>()); |
| 1139 | S->setAtCatchLoc(ReadSourceLocation()); |
| 1140 | S->setRParenLoc(ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1141 | } |
| 1142 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1143 | void ASTStmtReader::VisitObjCAtFinallyStmt(ObjCAtFinallyStmt *S) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1144 | VisitStmt(S); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1145 | S->setFinallyBody(Record.readSubStmt()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1146 | S->setAtFinallyLoc(ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1147 | } |
| 1148 | |
John McCall | 31168b0 | 2011-06-15 23:02:42 +0000 | [diff] [blame] | 1149 | void ASTStmtReader::VisitObjCAutoreleasePoolStmt(ObjCAutoreleasePoolStmt *S) { |
| 1150 | VisitStmt(S); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1151 | S->setSubStmt(Record.readSubStmt()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1152 | S->setAtLoc(ReadSourceLocation()); |
John McCall | 31168b0 | 2011-06-15 23:02:42 +0000 | [diff] [blame] | 1153 | } |
| 1154 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1155 | void ASTStmtReader::VisitObjCAtTryStmt(ObjCAtTryStmt *S) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1156 | VisitStmt(S); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1157 | assert(Record.peekInt() == S->getNumCatchStmts()); |
| 1158 | Record.skipInts(1); |
| 1159 | bool HasFinally = Record.readInt(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1160 | S->setTryBody(Record.readSubStmt()); |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1161 | for (unsigned I = 0, N = S->getNumCatchStmts(); I != N; ++I) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1162 | S->setCatchStmt(I, cast_or_null<ObjCAtCatchStmt>(Record.readSubStmt())); |
Douglas Gregor | 96c7949 | 2010-04-23 22:50:49 +0000 | [diff] [blame] | 1163 | |
Douglas Gregor | 96c7949 | 2010-04-23 22:50:49 +0000 | [diff] [blame] | 1164 | if (HasFinally) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1165 | S->setFinallyStmt(Record.readSubStmt()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1166 | S->setAtTryLoc(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::VisitObjCAtSynchronizedStmt(ObjCAtSynchronizedStmt *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->setSynchExpr(Record.readSubStmt()); |
| 1172 | S->setSynchBody(Record.readSubStmt()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1173 | S->setAtSynchronizedLoc(ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1174 | } |
| 1175 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1176 | void ASTStmtReader::VisitObjCAtThrowStmt(ObjCAtThrowStmt *S) { |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1177 | VisitStmt(S); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1178 | S->setThrowExpr(Record.readSubStmt()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1179 | S->setThrowLoc(ReadSourceLocation()); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1180 | } |
| 1181 | |
Ted Kremenek | e65b086 | 2012-03-06 20:05:56 +0000 | [diff] [blame] | 1182 | void ASTStmtReader::VisitObjCBoolLiteralExpr(ObjCBoolLiteralExpr *E) { |
| 1183 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1184 | E->setValue(Record.readInt()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1185 | E->setLocation(ReadSourceLocation()); |
Ted Kremenek | e65b086 | 2012-03-06 20:05:56 +0000 | [diff] [blame] | 1186 | } |
| 1187 | |
Erik Pilkington | 29099de | 2016-07-16 00:35:23 +0000 | [diff] [blame] | 1188 | void ASTStmtReader::VisitObjCAvailabilityCheckExpr(ObjCAvailabilityCheckExpr *E) { |
| 1189 | VisitExpr(E); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1190 | SourceRange R = Record.readSourceRange(); |
Erik Pilkington | 29099de | 2016-07-16 00:35:23 +0000 | [diff] [blame] | 1191 | E->AtLoc = R.getBegin(); |
| 1192 | E->RParen = R.getEnd(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1193 | E->VersionToCheck = Record.readVersionTuple(); |
Erik Pilkington | 29099de | 2016-07-16 00:35:23 +0000 | [diff] [blame] | 1194 | } |
| 1195 | |
Argyrios Kyrtzidis | eeaaead | 2009-07-14 03:19:21 +0000 | [diff] [blame] | 1196 | //===----------------------------------------------------------------------===// |
| 1197 | // C++ Expressions and Statements |
Argyrios Kyrtzidis | 47cd7a9 | 2010-07-22 16:03:56 +0000 | [diff] [blame] | 1198 | //===----------------------------------------------------------------------===// |
| 1199 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1200 | void ASTStmtReader::VisitCXXCatchStmt(CXXCatchStmt *S) { |
Argyrios Kyrtzidis | 47cd7a9 | 2010-07-22 16:03:56 +0000 | [diff] [blame] | 1201 | VisitStmt(S); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1202 | S->CatchLoc = ReadSourceLocation(); |
| 1203 | S->ExceptionDecl = ReadDeclAs<VarDecl>(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1204 | S->HandlerBlock = Record.readSubStmt(); |
Argyrios Kyrtzidis | 47cd7a9 | 2010-07-22 16:03:56 +0000 | [diff] [blame] | 1205 | } |
| 1206 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1207 | void ASTStmtReader::VisitCXXTryStmt(CXXTryStmt *S) { |
Argyrios Kyrtzidis | 47cd7a9 | 2010-07-22 16:03:56 +0000 | [diff] [blame] | 1208 | VisitStmt(S); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1209 | assert(Record.peekInt() == S->getNumHandlers() && "NumStmtFields is wrong ?"); |
| 1210 | Record.skipInts(1); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1211 | S->TryLoc = ReadSourceLocation(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1212 | S->getStmts()[0] = Record.readSubStmt(); |
Argyrios Kyrtzidis | 47cd7a9 | 2010-07-22 16:03:56 +0000 | [diff] [blame] | 1213 | for (unsigned i = 0, e = S->getNumHandlers(); i != e; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1214 | S->getStmts()[i + 1] = Record.readSubStmt(); |
Argyrios Kyrtzidis | 47cd7a9 | 2010-07-22 16:03:56 +0000 | [diff] [blame] | 1215 | } |
Argyrios Kyrtzidis | eeaaead | 2009-07-14 03:19:21 +0000 | [diff] [blame] | 1216 | |
Richard Smith | 02e85f3 | 2011-04-14 22:09:26 +0000 | [diff] [blame] | 1217 | void ASTStmtReader::VisitCXXForRangeStmt(CXXForRangeStmt *S) { |
| 1218 | VisitStmt(S); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1219 | S->ForLoc = ReadSourceLocation(); |
| 1220 | S->CoawaitLoc = ReadSourceLocation(); |
| 1221 | S->ColonLoc = ReadSourceLocation(); |
| 1222 | S->RParenLoc = ReadSourceLocation(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1223 | S->setRangeStmt(Record.readSubStmt()); |
| 1224 | S->setBeginStmt(Record.readSubStmt()); |
| 1225 | S->setEndStmt(Record.readSubStmt()); |
| 1226 | S->setCond(Record.readSubExpr()); |
| 1227 | S->setInc(Record.readSubExpr()); |
| 1228 | S->setLoopVarStmt(Record.readSubStmt()); |
| 1229 | S->setBody(Record.readSubStmt()); |
Richard Smith | 02e85f3 | 2011-04-14 22:09:26 +0000 | [diff] [blame] | 1230 | } |
| 1231 | |
Douglas Gregor | deb4a2be | 2011-10-25 01:33:02 +0000 | [diff] [blame] | 1232 | void ASTStmtReader::VisitMSDependentExistsStmt(MSDependentExistsStmt *S) { |
| 1233 | VisitStmt(S); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1234 | S->KeywordLoc = ReadSourceLocation(); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1235 | S->IsIfExists = Record.readInt(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1236 | S->QualifierLoc = Record.readNestedNameSpecifierLoc(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1237 | ReadDeclarationNameInfo(S->NameInfo); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1238 | S->SubStmt = Record.readSubStmt(); |
Douglas Gregor | deb4a2be | 2011-10-25 01:33:02 +0000 | [diff] [blame] | 1239 | } |
| 1240 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1241 | void ASTStmtReader::VisitCXXOperatorCallExpr(CXXOperatorCallExpr *E) { |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1242 | VisitCallExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1243 | E->Operator = (OverloadedOperatorKind)Record.readInt(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1244 | E->Range = Record.readSourceRange(); |
Adam Nemet | 484aa45 | 2017-03-27 19:17:25 +0000 | [diff] [blame] | 1245 | E->setFPFeatures(FPOptions(Record.readInt())); |
Argyrios Kyrtzidis | eeaaead | 2009-07-14 03:19:21 +0000 | [diff] [blame] | 1246 | } |
| 1247 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1248 | void ASTStmtReader::VisitCXXConstructExpr(CXXConstructExpr *E) { |
Douglas Gregor | 5d3507d | 2009-09-09 23:08:42 +0000 | [diff] [blame] | 1249 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1250 | E->NumArgs = Record.readInt(); |
Argyrios Kyrtzidis | b8d77eb | 2010-07-10 11:46:15 +0000 | [diff] [blame] | 1251 | if (E->NumArgs) |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1252 | E->Args = new (Record.getContext()) Stmt*[E->NumArgs]; |
Argyrios Kyrtzidis | 30d98f3 | 2010-06-24 08:57:09 +0000 | [diff] [blame] | 1253 | for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1254 | E->setArg(I, Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1255 | E->setConstructor(ReadDeclAs<CXXConstructorDecl>()); |
| 1256 | E->setLocation(ReadSourceLocation()); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1257 | E->setElidable(Record.readInt()); |
| 1258 | E->setHadMultipleCandidates(Record.readInt()); |
| 1259 | E->setListInitialization(Record.readInt()); |
| 1260 | E->setStdInitListInitialization(Record.readInt()); |
| 1261 | E->setRequiresZeroInitialization(Record.readInt()); |
| 1262 | E->setConstructionKind((CXXConstructExpr::ConstructionKind)Record.readInt()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1263 | E->ParenOrBraceRange = ReadSourceRange(); |
Douglas Gregor | 5d3507d | 2009-09-09 23:08:42 +0000 | [diff] [blame] | 1264 | } |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1265 | |
Richard Smith | 5179eb7 | 2016-06-28 19:03:57 +0000 | [diff] [blame] | 1266 | void ASTStmtReader::VisitCXXInheritedCtorInitExpr(CXXInheritedCtorInitExpr *E) { |
| 1267 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1268 | E->Constructor = ReadDeclAs<CXXConstructorDecl>(); |
| 1269 | E->Loc = ReadSourceLocation(); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1270 | E->ConstructsVirtualBase = Record.readInt(); |
| 1271 | E->InheritedFromVirtualBase = Record.readInt(); |
Richard Smith | 5179eb7 | 2016-06-28 19:03:57 +0000 | [diff] [blame] | 1272 | } |
| 1273 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1274 | void ASTStmtReader::VisitCXXTemporaryObjectExpr(CXXTemporaryObjectExpr *E) { |
Argyrios Kyrtzidis | b8d77eb | 2010-07-10 11:46:15 +0000 | [diff] [blame] | 1275 | VisitCXXConstructExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1276 | E->Type = GetTypeSourceInfo(); |
Argyrios Kyrtzidis | b8d77eb | 2010-07-10 11:46:15 +0000 | [diff] [blame] | 1277 | } |
| 1278 | |
Douglas Gregor | e31e606 | 2012-02-07 10:09:13 +0000 | [diff] [blame] | 1279 | void ASTStmtReader::VisitLambdaExpr(LambdaExpr *E) { |
| 1280 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1281 | unsigned NumCaptures = Record.readInt(); |
Douglas Gregor | 99ae806 | 2012-02-14 17:54:36 +0000 | [diff] [blame] | 1282 | assert(NumCaptures == E->NumCaptures);(void)NumCaptures; |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1283 | E->IntroducerRange = ReadSourceRange(); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1284 | E->CaptureDefault = static_cast<LambdaCaptureDefault>(Record.readInt()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1285 | E->CaptureDefaultLoc = ReadSourceLocation(); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1286 | E->ExplicitParams = Record.readInt(); |
| 1287 | E->ExplicitResultType = Record.readInt(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1288 | E->ClosingBrace = ReadSourceLocation(); |
| 1289 | |
Douglas Gregor | 99ae806 | 2012-02-14 17:54:36 +0000 | [diff] [blame] | 1290 | // Read capture initializers. |
| 1291 | for (LambdaExpr::capture_init_iterator C = E->capture_init_begin(), |
| 1292 | CEnd = E->capture_init_end(); |
| 1293 | C != CEnd; ++C) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1294 | *C = Record.readSubExpr(); |
Douglas Gregor | e31e606 | 2012-02-07 10:09:13 +0000 | [diff] [blame] | 1295 | } |
| 1296 | |
Richard Smith | cc1b96d | 2013-06-12 22:31:48 +0000 | [diff] [blame] | 1297 | void |
| 1298 | ASTStmtReader::VisitCXXStdInitializerListExpr(CXXStdInitializerListExpr *E) { |
| 1299 | VisitExpr(E); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1300 | E->SubExpr = Record.readSubExpr(); |
Richard Smith | cc1b96d | 2013-06-12 22:31:48 +0000 | [diff] [blame] | 1301 | } |
| 1302 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1303 | void ASTStmtReader::VisitCXXNamedCastExpr(CXXNamedCastExpr *E) { |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1304 | VisitExplicitCastExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1305 | SourceRange R = ReadSourceRange(); |
Douglas Gregor | 4478f85 | 2011-01-12 22:41:29 +0000 | [diff] [blame] | 1306 | E->Loc = R.getBegin(); |
| 1307 | E->RParenLoc = R.getEnd(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1308 | R = ReadSourceRange(); |
Fariborz Jahanian | f073871 | 2013-02-22 22:02:53 +0000 | [diff] [blame] | 1309 | E->AngleBrackets = R; |
Sam Weinig | d01101e | 2010-01-16 21:21:01 +0000 | [diff] [blame] | 1310 | } |
| 1311 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1312 | void ASTStmtReader::VisitCXXStaticCastExpr(CXXStaticCastExpr *E) { |
Sam Weinig | d01101e | 2010-01-16 21:21:01 +0000 | [diff] [blame] | 1313 | return VisitCXXNamedCastExpr(E); |
| 1314 | } |
| 1315 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1316 | void ASTStmtReader::VisitCXXDynamicCastExpr(CXXDynamicCastExpr *E) { |
Sam Weinig | d01101e | 2010-01-16 21:21:01 +0000 | [diff] [blame] | 1317 | return VisitCXXNamedCastExpr(E); |
| 1318 | } |
| 1319 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1320 | void ASTStmtReader::VisitCXXReinterpretCastExpr(CXXReinterpretCastExpr *E) { |
Sam Weinig | d01101e | 2010-01-16 21:21:01 +0000 | [diff] [blame] | 1321 | return VisitCXXNamedCastExpr(E); |
| 1322 | } |
| 1323 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1324 | void ASTStmtReader::VisitCXXConstCastExpr(CXXConstCastExpr *E) { |
Sam Weinig | d01101e | 2010-01-16 21:21:01 +0000 | [diff] [blame] | 1325 | return VisitCXXNamedCastExpr(E); |
| 1326 | } |
| 1327 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1328 | void ASTStmtReader::VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr *E) { |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1329 | VisitExplicitCastExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1330 | E->setLParenLoc(ReadSourceLocation()); |
| 1331 | E->setRParenLoc(ReadSourceLocation()); |
Sam Weinig | d01101e | 2010-01-16 21:21:01 +0000 | [diff] [blame] | 1332 | } |
| 1333 | |
Richard Smith | c67fdd4 | 2012-03-07 08:35:16 +0000 | [diff] [blame] | 1334 | void ASTStmtReader::VisitUserDefinedLiteral(UserDefinedLiteral *E) { |
| 1335 | VisitCallExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1336 | E->UDSuffixLoc = ReadSourceLocation(); |
Richard Smith | c67fdd4 | 2012-03-07 08:35:16 +0000 | [diff] [blame] | 1337 | } |
| 1338 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1339 | void ASTStmtReader::VisitCXXBoolLiteralExpr(CXXBoolLiteralExpr *E) { |
Sam Weinig | e83b3ac | 2010-02-07 06:32:43 +0000 | [diff] [blame] | 1340 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1341 | E->setValue(Record.readInt()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1342 | E->setLocation(ReadSourceLocation()); |
Sam Weinig | e83b3ac | 2010-02-07 06:32:43 +0000 | [diff] [blame] | 1343 | } |
| 1344 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1345 | void ASTStmtReader::VisitCXXNullPtrLiteralExpr(CXXNullPtrLiteralExpr *E) { |
Sam Weinig | e83b3ac | 2010-02-07 06:32:43 +0000 | [diff] [blame] | 1346 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1347 | E->setLocation(ReadSourceLocation()); |
Sam Weinig | e83b3ac | 2010-02-07 06:32:43 +0000 | [diff] [blame] | 1348 | } |
| 1349 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1350 | void ASTStmtReader::VisitCXXTypeidExpr(CXXTypeidExpr *E) { |
Chris Lattner | 13a5ecc | 2010-05-09 06:03:39 +0000 | [diff] [blame] | 1351 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1352 | E->setSourceRange(ReadSourceRange()); |
Chris Lattner | 13a5ecc | 2010-05-09 06:03:39 +0000 | [diff] [blame] | 1353 | if (E->isTypeOperand()) { // typeid(int) |
Sebastian Redl | c67764e | 2010-07-22 22:43:28 +0000 | [diff] [blame] | 1354 | E->setTypeOperandSourceInfo( |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1355 | GetTypeSourceInfo()); |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1356 | return; |
Chris Lattner | 13a5ecc | 2010-05-09 06:03:39 +0000 | [diff] [blame] | 1357 | } |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1358 | |
Chris Lattner | 13a5ecc | 2010-05-09 06:03:39 +0000 | [diff] [blame] | 1359 | // typeid(42+2) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1360 | E->setExprOperand(Record.readSubExpr()); |
Chris Lattner | 13a5ecc | 2010-05-09 06:03:39 +0000 | [diff] [blame] | 1361 | } |
| 1362 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1363 | void ASTStmtReader::VisitCXXThisExpr(CXXThisExpr *E) { |
Chris Lattner | 9826733 | 2010-05-09 06:15:05 +0000 | [diff] [blame] | 1364 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1365 | E->setLocation(ReadSourceLocation()); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1366 | E->setImplicit(Record.readInt()); |
Chris Lattner | 9826733 | 2010-05-09 06:15:05 +0000 | [diff] [blame] | 1367 | } |
| 1368 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1369 | void ASTStmtReader::VisitCXXThrowExpr(CXXThrowExpr *E) { |
Chris Lattner | 9826733 | 2010-05-09 06:15:05 +0000 | [diff] [blame] | 1370 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1371 | E->ThrowLoc = ReadSourceLocation(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1372 | E->Op = Record.readSubExpr(); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1373 | E->IsThrownVariableInScope = Record.readInt(); |
Chris Lattner | 9826733 | 2010-05-09 06:15:05 +0000 | [diff] [blame] | 1374 | } |
Chris Lattner | 13a5ecc | 2010-05-09 06:03:39 +0000 | [diff] [blame] | 1375 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1376 | void ASTStmtReader::VisitCXXDefaultArgExpr(CXXDefaultArgExpr *E) { |
Chris Lattner | e2437f4 | 2010-05-09 06:40:08 +0000 | [diff] [blame] | 1377 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1378 | E->Param = ReadDeclAs<ParmVarDecl>(); |
| 1379 | E->Loc = ReadSourceLocation(); |
Chris Lattner | cba8614 | 2010-05-10 00:25:06 +0000 | [diff] [blame] | 1380 | } |
| 1381 | |
Richard Smith | 852c9db | 2013-04-20 22:23:05 +0000 | [diff] [blame] | 1382 | void ASTStmtReader::VisitCXXDefaultInitExpr(CXXDefaultInitExpr *E) { |
| 1383 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1384 | E->Field = ReadDeclAs<FieldDecl>(); |
| 1385 | E->Loc = ReadSourceLocation(); |
Richard Smith | 852c9db | 2013-04-20 22:23:05 +0000 | [diff] [blame] | 1386 | } |
| 1387 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1388 | void ASTStmtReader::VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *E) { |
Chris Lattner | cba8614 | 2010-05-10 00:25:06 +0000 | [diff] [blame] | 1389 | VisitExpr(E); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1390 | E->setTemporary(Record.readCXXTemporary()); |
| 1391 | E->setSubExpr(Record.readSubExpr()); |
Chris Lattner | cba8614 | 2010-05-10 00:25:06 +0000 | [diff] [blame] | 1392 | } |
| 1393 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1394 | void ASTStmtReader::VisitCXXScalarValueInitExpr(CXXScalarValueInitExpr *E) { |
Chris Lattner | abfb58d | 2010-05-10 01:22:27 +0000 | [diff] [blame] | 1395 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1396 | E->TypeInfo = GetTypeSourceInfo(); |
| 1397 | E->RParenLoc = ReadSourceLocation(); |
Chris Lattner | abfb58d | 2010-05-10 01:22:27 +0000 | [diff] [blame] | 1398 | } |
| 1399 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1400 | void ASTStmtReader::VisitCXXNewExpr(CXXNewExpr *E) { |
Chris Lattner | abfb58d | 2010-05-10 01:22:27 +0000 | [diff] [blame] | 1401 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1402 | E->GlobalNew = Record.readInt(); |
| 1403 | bool isArray = Record.readInt(); |
| 1404 | E->PassAlignment = Record.readInt(); |
| 1405 | E->UsualArrayDeleteWantsSize = Record.readInt(); |
| 1406 | unsigned NumPlacementArgs = Record.readInt(); |
| 1407 | E->StoredInitializationStyle = Record.readInt(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1408 | E->setOperatorNew(ReadDeclAs<FunctionDecl>()); |
| 1409 | E->setOperatorDelete(ReadDeclAs<FunctionDecl>()); |
| 1410 | E->AllocatedTypeInfo = GetTypeSourceInfo(); |
| 1411 | E->TypeIdParens = ReadSourceRange(); |
| 1412 | E->Range = ReadSourceRange(); |
| 1413 | E->DirectInitRange = ReadSourceRange(); |
Chandler Carruth | 0171815 | 2010-10-25 08:47:36 +0000 | [diff] [blame] | 1414 | |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1415 | E->AllocateArgsArray(Record.getContext(), isArray, NumPlacementArgs, |
Sebastian Redl | 6047f07 | 2012-02-16 12:22:20 +0000 | [diff] [blame] | 1416 | E->StoredInitializationStyle != 0); |
Chris Lattner | abfb58d | 2010-05-10 01:22:27 +0000 | [diff] [blame] | 1417 | |
| 1418 | // Install all the subexpressions. |
Chris Lattner | abfb58d | 2010-05-10 01:22:27 +0000 | [diff] [blame] | 1419 | for (CXXNewExpr::raw_arg_iterator I = E->raw_arg_begin(),e = E->raw_arg_end(); |
| 1420 | I != e; ++I) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1421 | *I = Record.readSubStmt(); |
Chris Lattner | abfb58d | 2010-05-10 01:22:27 +0000 | [diff] [blame] | 1422 | } |
| 1423 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1424 | void ASTStmtReader::VisitCXXDeleteExpr(CXXDeleteExpr *E) { |
Argyrios Kyrtzidis | 6e57c35 | 2010-06-22 17:07:59 +0000 | [diff] [blame] | 1425 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1426 | E->GlobalDelete = Record.readInt(); |
| 1427 | E->ArrayForm = Record.readInt(); |
| 1428 | E->ArrayFormAsWritten = Record.readInt(); |
| 1429 | E->UsualArrayDeleteWantsSize = Record.readInt(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1430 | E->OperatorDelete = ReadDeclAs<FunctionDecl>(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1431 | E->Argument = Record.readSubExpr(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1432 | E->Loc = ReadSourceLocation(); |
Argyrios Kyrtzidis | 6e57c35 | 2010-06-22 17:07:59 +0000 | [diff] [blame] | 1433 | } |
Chris Lattner | cba8614 | 2010-05-10 00:25:06 +0000 | [diff] [blame] | 1434 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1435 | void ASTStmtReader::VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr *E) { |
Argyrios Kyrtzidis | 99a226d | 2010-06-28 09:32:03 +0000 | [diff] [blame] | 1436 | VisitExpr(E); |
| 1437 | |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1438 | E->Base = Record.readSubExpr(); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1439 | E->IsArrow = Record.readInt(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1440 | E->OperatorLoc = ReadSourceLocation(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1441 | E->QualifierLoc = Record.readNestedNameSpecifierLoc(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1442 | E->ScopeType = GetTypeSourceInfo(); |
| 1443 | E->ColonColonLoc = ReadSourceLocation(); |
| 1444 | E->TildeLoc = ReadSourceLocation(); |
| 1445 | |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1446 | IdentifierInfo *II = Record.getIdentifierInfo(); |
Argyrios Kyrtzidis | 99a226d | 2010-06-28 09:32:03 +0000 | [diff] [blame] | 1447 | if (II) |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1448 | E->setDestroyedType(II, ReadSourceLocation()); |
Argyrios Kyrtzidis | 99a226d | 2010-06-28 09:32:03 +0000 | [diff] [blame] | 1449 | else |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1450 | E->setDestroyedType(GetTypeSourceInfo()); |
Argyrios Kyrtzidis | 99a226d | 2010-06-28 09:32:03 +0000 | [diff] [blame] | 1451 | } |
| 1452 | |
John McCall | 5d41378 | 2010-12-06 08:20:24 +0000 | [diff] [blame] | 1453 | void ASTStmtReader::VisitExprWithCleanups(ExprWithCleanups *E) { |
Chris Lattner | cba8614 | 2010-05-10 00:25:06 +0000 | [diff] [blame] | 1454 | VisitExpr(E); |
John McCall | 28fc709 | 2011-11-10 05:35:25 +0000 | [diff] [blame] | 1455 | |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1456 | unsigned NumObjects = Record.readInt(); |
John McCall | 28fc709 | 2011-11-10 05:35:25 +0000 | [diff] [blame] | 1457 | assert(NumObjects == E->getNumObjects()); |
| 1458 | for (unsigned i = 0; i != NumObjects; ++i) |
James Y Knight | e00a67e | 2015-12-31 04:18:25 +0000 | [diff] [blame] | 1459 | E->getTrailingObjects<BlockDecl *>()[i] = |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1460 | ReadDeclAs<BlockDecl>(); |
John McCall | 28fc709 | 2011-11-10 05:35:25 +0000 | [diff] [blame] | 1461 | |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1462 | E->ExprWithCleanupsBits.CleanupsHaveSideEffects = Record.readInt(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1463 | E->SubExpr = Record.readSubExpr(); |
Chris Lattner | e2437f4 | 2010-05-09 06:40:08 +0000 | [diff] [blame] | 1464 | } |
| 1465 | |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1466 | void |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1467 | ASTStmtReader::VisitCXXDependentScopeMemberExpr(CXXDependentScopeMemberExpr *E){ |
Argyrios Kyrtzidis | bfcacee | 2010-06-24 08:57:31 +0000 | [diff] [blame] | 1468 | VisitExpr(E); |
Abramo Bagnara | 7945c98 | 2012-01-27 09:46:47 +0000 | [diff] [blame] | 1469 | |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1470 | if (Record.readInt()) // HasTemplateKWAndArgsInfo |
James Y Knight | e7d8228 | 2015-12-29 18:15:14 +0000 | [diff] [blame] | 1471 | ReadTemplateKWAndArgsInfo( |
| 1472 | *E->getTrailingObjects<ASTTemplateKWAndArgsInfo>(), |
| 1473 | E->getTrailingObjects<TemplateArgumentLoc>(), |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1474 | /*NumTemplateArgs=*/Record.readInt()); |
Argyrios Kyrtzidis | bfcacee | 2010-06-24 08:57:31 +0000 | [diff] [blame] | 1475 | |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1476 | E->Base = Record.readSubExpr(); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1477 | E->BaseType = Record.readType(); |
| 1478 | E->IsArrow = Record.readInt(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1479 | E->OperatorLoc = ReadSourceLocation(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1480 | E->QualifierLoc = Record.readNestedNameSpecifierLoc(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1481 | E->FirstQualifierFoundInScope = ReadDeclAs<NamedDecl>(); |
| 1482 | ReadDeclarationNameInfo(E->MemberNameInfo); |
Argyrios Kyrtzidis | bfcacee | 2010-06-24 08:57:31 +0000 | [diff] [blame] | 1483 | } |
| 1484 | |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1485 | void |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1486 | ASTStmtReader::VisitDependentScopeDeclRefExpr(DependentScopeDeclRefExpr *E) { |
Argyrios Kyrtzidis | cd444d1a | 2010-06-28 09:31:56 +0000 | [diff] [blame] | 1487 | VisitExpr(E); |
Abramo Bagnara | 7945c98 | 2012-01-27 09:46:47 +0000 | [diff] [blame] | 1488 | |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1489 | if (Record.readInt()) // HasTemplateKWAndArgsInfo |
James Y Knight | e7d8228 | 2015-12-29 18:15:14 +0000 | [diff] [blame] | 1490 | ReadTemplateKWAndArgsInfo( |
| 1491 | *E->getTrailingObjects<ASTTemplateKWAndArgsInfo>(), |
| 1492 | E->getTrailingObjects<TemplateArgumentLoc>(), |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1493 | /*NumTemplateArgs=*/Record.readInt()); |
Douglas Gregor | 3a43fd6 | 2011-02-25 20:49:16 +0000 | [diff] [blame] | 1494 | |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1495 | E->QualifierLoc = Record.readNestedNameSpecifierLoc(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1496 | ReadDeclarationNameInfo(E->NameInfo); |
Argyrios Kyrtzidis | cd444d1a | 2010-06-28 09:31:56 +0000 | [diff] [blame] | 1497 | } |
| 1498 | |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1499 | void |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1500 | ASTStmtReader::VisitCXXUnresolvedConstructExpr(CXXUnresolvedConstructExpr *E) { |
Argyrios Kyrtzidis | bfcacee | 2010-06-24 08:57:31 +0000 | [diff] [blame] | 1501 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1502 | assert(Record.peekInt() == E->arg_size() && |
| 1503 | "Read wrong record during creation ?"); |
| 1504 | Record.skipInts(1); |
Argyrios Kyrtzidis | bfcacee | 2010-06-24 08:57:31 +0000 | [diff] [blame] | 1505 | for (unsigned I = 0, N = E->arg_size(); I != N; ++I) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1506 | E->setArg(I, Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1507 | E->Type = GetTypeSourceInfo(); |
| 1508 | E->setLParenLoc(ReadSourceLocation()); |
| 1509 | E->setRParenLoc(ReadSourceLocation()); |
Argyrios Kyrtzidis | bfcacee | 2010-06-24 08:57:31 +0000 | [diff] [blame] | 1510 | } |
| 1511 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1512 | void ASTStmtReader::VisitOverloadExpr(OverloadExpr *E) { |
Argyrios Kyrtzidis | b8d3c63 | 2010-06-25 09:03:26 +0000 | [diff] [blame] | 1513 | VisitExpr(E); |
Abramo Bagnara | 7945c98 | 2012-01-27 09:46:47 +0000 | [diff] [blame] | 1514 | |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1515 | if (Record.readInt()) // HasTemplateKWAndArgsInfo |
James Y Knight | e7d8228 | 2015-12-29 18:15:14 +0000 | [diff] [blame] | 1516 | ReadTemplateKWAndArgsInfo(*E->getTrailingASTTemplateKWAndArgsInfo(), |
| 1517 | E->getTrailingTemplateArgumentLoc(), |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1518 | /*NumTemplateArgs=*/Record.readInt()); |
Argyrios Kyrtzidis | b8d3c63 | 2010-06-25 09:03:26 +0000 | [diff] [blame] | 1519 | |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1520 | unsigned NumDecls = Record.readInt(); |
Argyrios Kyrtzidis | b8d3c63 | 2010-06-25 09:03:26 +0000 | [diff] [blame] | 1521 | UnresolvedSet<8> Decls; |
| 1522 | for (unsigned i = 0; i != NumDecls; ++i) { |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1523 | NamedDecl *D = ReadDeclAs<NamedDecl>(); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1524 | AccessSpecifier AS = (AccessSpecifier)Record.readInt(); |
Argyrios Kyrtzidis | b8d3c63 | 2010-06-25 09:03:26 +0000 | [diff] [blame] | 1525 | Decls.addDecl(D, AS); |
| 1526 | } |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1527 | E->initializeResults(Record.getContext(), Decls.begin(), Decls.end()); |
Argyrios Kyrtzidis | b8d3c63 | 2010-06-25 09:03:26 +0000 | [diff] [blame] | 1528 | |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1529 | ReadDeclarationNameInfo(E->NameInfo); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1530 | E->QualifierLoc = Record.readNestedNameSpecifierLoc(); |
Argyrios Kyrtzidis | b8d3c63 | 2010-06-25 09:03:26 +0000 | [diff] [blame] | 1531 | } |
| 1532 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1533 | void ASTStmtReader::VisitUnresolvedMemberExpr(UnresolvedMemberExpr *E) { |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1534 | VisitOverloadExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1535 | E->IsArrow = Record.readInt(); |
| 1536 | E->HasUnresolvedUsing = Record.readInt(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1537 | E->Base = Record.readSubExpr(); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1538 | E->BaseType = Record.readType(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1539 | E->OperatorLoc = ReadSourceLocation(); |
Argyrios Kyrtzidis | b8d3c63 | 2010-06-25 09:03:26 +0000 | [diff] [blame] | 1540 | } |
| 1541 | |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1542 | void ASTStmtReader::VisitUnresolvedLookupExpr(UnresolvedLookupExpr *E) { |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1543 | VisitOverloadExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1544 | E->RequiresADL = Record.readInt(); |
| 1545 | E->Overloaded = Record.readInt(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1546 | E->NamingClass = ReadDeclAs<CXXRecordDecl>(); |
Argyrios Kyrtzidis | 58e01ad | 2010-06-25 09:03:34 +0000 | [diff] [blame] | 1547 | } |
| 1548 | |
Douglas Gregor | 29c42f2 | 2012-02-24 07:38:34 +0000 | [diff] [blame] | 1549 | void ASTStmtReader::VisitTypeTraitExpr(TypeTraitExpr *E) { |
| 1550 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1551 | E->TypeTraitExprBits.NumArgs = Record.readInt(); |
| 1552 | E->TypeTraitExprBits.Kind = Record.readInt(); |
| 1553 | E->TypeTraitExprBits.Value = Record.readInt(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1554 | SourceRange Range = ReadSourceRange(); |
Jordan Rose | 99e80c1 | 2013-12-20 01:26:47 +0000 | [diff] [blame] | 1555 | E->Loc = Range.getBegin(); |
| 1556 | E->RParenLoc = Range.getEnd(); |
| 1557 | |
James Y Knight | e00a67e | 2015-12-31 04:18:25 +0000 | [diff] [blame] | 1558 | TypeSourceInfo **Args = E->getTrailingObjects<TypeSourceInfo *>(); |
Douglas Gregor | 29c42f2 | 2012-02-24 07:38:34 +0000 | [diff] [blame] | 1559 | for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I) |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1560 | Args[I] = GetTypeSourceInfo(); |
Douglas Gregor | 29c42f2 | 2012-02-24 07:38:34 +0000 | [diff] [blame] | 1561 | } |
| 1562 | |
John Wiegley | 6242b6a | 2011-04-28 00:16:57 +0000 | [diff] [blame] | 1563 | void ASTStmtReader::VisitArrayTypeTraitExpr(ArrayTypeTraitExpr *E) { |
| 1564 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1565 | E->ATT = (ArrayTypeTrait)Record.readInt(); |
| 1566 | E->Value = (unsigned int)Record.readInt(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1567 | SourceRange Range = ReadSourceRange(); |
John Wiegley | 6242b6a | 2011-04-28 00:16:57 +0000 | [diff] [blame] | 1568 | E->Loc = Range.getBegin(); |
| 1569 | E->RParen = Range.getEnd(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1570 | E->QueriedType = GetTypeSourceInfo(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1571 | E->Dimension = Record.readSubExpr(); |
John Wiegley | 6242b6a | 2011-04-28 00:16:57 +0000 | [diff] [blame] | 1572 | } |
| 1573 | |
John Wiegley | f9f6584 | 2011-04-25 06:54:41 +0000 | [diff] [blame] | 1574 | void ASTStmtReader::VisitExpressionTraitExpr(ExpressionTraitExpr *E) { |
| 1575 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1576 | E->ET = (ExpressionTrait)Record.readInt(); |
| 1577 | E->Value = (bool)Record.readInt(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1578 | SourceRange Range = ReadSourceRange(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1579 | E->QueriedExpression = Record.readSubExpr(); |
John Wiegley | f9f6584 | 2011-04-25 06:54:41 +0000 | [diff] [blame] | 1580 | E->Loc = Range.getBegin(); |
| 1581 | E->RParen = Range.getEnd(); |
| 1582 | } |
| 1583 | |
Sebastian Redl | 9ac55dd | 2010-09-10 20:55:54 +0000 | [diff] [blame] | 1584 | void ASTStmtReader::VisitCXXNoexceptExpr(CXXNoexceptExpr *E) { |
| 1585 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1586 | E->Value = (bool)Record.readInt(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1587 | E->Range = ReadSourceRange(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1588 | E->Operand = Record.readSubExpr(); |
Sebastian Redl | 9ac55dd | 2010-09-10 20:55:54 +0000 | [diff] [blame] | 1589 | } |
| 1590 | |
Douglas Gregor | e8e9dd6 | 2011-01-03 17:17:50 +0000 | [diff] [blame] | 1591 | void ASTStmtReader::VisitPackExpansionExpr(PackExpansionExpr *E) { |
| 1592 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1593 | E->EllipsisLoc = ReadSourceLocation(); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1594 | E->NumExpansions = Record.readInt(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1595 | E->Pattern = Record.readSubExpr(); |
Douglas Gregor | e8e9dd6 | 2011-01-03 17:17:50 +0000 | [diff] [blame] | 1596 | } |
| 1597 | |
Douglas Gregor | 820ba7b | 2011-01-04 17:33:58 +0000 | [diff] [blame] | 1598 | void ASTStmtReader::VisitSizeOfPackExpr(SizeOfPackExpr *E) { |
| 1599 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1600 | unsigned NumPartialArgs = Record.readInt(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1601 | E->OperatorLoc = ReadSourceLocation(); |
| 1602 | E->PackLoc = ReadSourceLocation(); |
| 1603 | E->RParenLoc = ReadSourceLocation(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1604 | E->Pack = Record.readDeclAs<NamedDecl>(); |
Richard Smith | d784e68 | 2015-09-23 21:41:42 +0000 | [diff] [blame] | 1605 | if (E->isPartiallySubstituted()) { |
| 1606 | assert(E->Length == NumPartialArgs); |
James Y Knight | e00a67e | 2015-12-31 04:18:25 +0000 | [diff] [blame] | 1607 | for (auto *I = E->getTrailingObjects<TemplateArgument>(), |
Richard Smith | d784e68 | 2015-09-23 21:41:42 +0000 | [diff] [blame] | 1608 | *E = I + NumPartialArgs; |
| 1609 | I != E; ++I) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1610 | new (I) TemplateArgument(Record.readTemplateArgument()); |
Richard Smith | d784e68 | 2015-09-23 21:41:42 +0000 | [diff] [blame] | 1611 | } else if (!E->isValueDependent()) { |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1612 | E->Length = Record.readInt(); |
Richard Smith | d784e68 | 2015-09-23 21:41:42 +0000 | [diff] [blame] | 1613 | } |
Douglas Gregor | 820ba7b | 2011-01-04 17:33:58 +0000 | [diff] [blame] | 1614 | } |
| 1615 | |
John McCall | fa19404 | 2011-07-15 07:00:14 +0000 | [diff] [blame] | 1616 | void ASTStmtReader::VisitSubstNonTypeTemplateParmExpr( |
| 1617 | SubstNonTypeTemplateParmExpr *E) { |
| 1618 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1619 | E->Param = ReadDeclAs<NonTypeTemplateParmDecl>(); |
| 1620 | E->NameLoc = ReadSourceLocation(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1621 | E->Replacement = Record.readSubExpr(); |
John McCall | fa19404 | 2011-07-15 07:00:14 +0000 | [diff] [blame] | 1622 | } |
| 1623 | |
Douglas Gregor | cdbc539 | 2011-01-15 01:15:58 +0000 | [diff] [blame] | 1624 | void ASTStmtReader::VisitSubstNonTypeTemplateParmPackExpr( |
| 1625 | SubstNonTypeTemplateParmPackExpr *E) { |
| 1626 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1627 | E->Param = ReadDeclAs<NonTypeTemplateParmDecl>(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1628 | TemplateArgument ArgPack = Record.readTemplateArgument(); |
Douglas Gregor | cdbc539 | 2011-01-15 01:15:58 +0000 | [diff] [blame] | 1629 | if (ArgPack.getKind() != TemplateArgument::Pack) |
| 1630 | return; |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1631 | |
Douglas Gregor | cdbc539 | 2011-01-15 01:15:58 +0000 | [diff] [blame] | 1632 | E->Arguments = ArgPack.pack_begin(); |
| 1633 | E->NumArguments = ArgPack.pack_size(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1634 | E->NameLoc = ReadSourceLocation(); |
Douglas Gregor | cdbc539 | 2011-01-15 01:15:58 +0000 | [diff] [blame] | 1635 | } |
| 1636 | |
Richard Smith | b15fe3a | 2012-09-12 00:56:43 +0000 | [diff] [blame] | 1637 | void ASTStmtReader::VisitFunctionParmPackExpr(FunctionParmPackExpr *E) { |
| 1638 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1639 | E->NumParameters = Record.readInt(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1640 | E->ParamPack = ReadDeclAs<ParmVarDecl>(); |
| 1641 | E->NameLoc = ReadSourceLocation(); |
James Y Knight | e00a67e | 2015-12-31 04:18:25 +0000 | [diff] [blame] | 1642 | ParmVarDecl **Parms = E->getTrailingObjects<ParmVarDecl *>(); |
Richard Smith | b15fe3a | 2012-09-12 00:56:43 +0000 | [diff] [blame] | 1643 | for (unsigned i = 0, n = E->NumParameters; i != n; ++i) |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1644 | Parms[i] = ReadDeclAs<ParmVarDecl>(); |
Richard Smith | b15fe3a | 2012-09-12 00:56:43 +0000 | [diff] [blame] | 1645 | } |
| 1646 | |
Douglas Gregor | fe31481 | 2011-06-21 17:03:29 +0000 | [diff] [blame] | 1647 | void ASTStmtReader::VisitMaterializeTemporaryExpr(MaterializeTemporaryExpr *E) { |
| 1648 | VisitExpr(E); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1649 | E->State = Record.readSubExpr(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1650 | auto VD = ReadDeclAs<ValueDecl>(); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1651 | unsigned ManglingNumber = Record.readInt(); |
David Majnemer | daff370 | 2014-05-01 17:50:17 +0000 | [diff] [blame] | 1652 | E->setExtendingDecl(VD, ManglingNumber); |
Douglas Gregor | fe31481 | 2011-06-21 17:03:29 +0000 | [diff] [blame] | 1653 | } |
| 1654 | |
Richard Smith | 0f0af19 | 2014-11-08 05:07:16 +0000 | [diff] [blame] | 1655 | void ASTStmtReader::VisitCXXFoldExpr(CXXFoldExpr *E) { |
| 1656 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1657 | E->LParenLoc = ReadSourceLocation(); |
| 1658 | E->EllipsisLoc = ReadSourceLocation(); |
| 1659 | E->RParenLoc = ReadSourceLocation(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1660 | E->SubExprs[0] = Record.readSubExpr(); |
| 1661 | E->SubExprs[1] = Record.readSubExpr(); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1662 | E->Opcode = (BinaryOperatorKind)Record.readInt(); |
Richard Smith | 0f0af19 | 2014-11-08 05:07:16 +0000 | [diff] [blame] | 1663 | } |
| 1664 | |
John McCall | 8d69a21 | 2010-11-15 23:31:06 +0000 | [diff] [blame] | 1665 | void ASTStmtReader::VisitOpaqueValueExpr(OpaqueValueExpr *E) { |
| 1666 | VisitExpr(E); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1667 | E->SourceExpr = Record.readSubExpr(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1668 | E->Loc = ReadSourceLocation(); |
John McCall | 8d69a21 | 2010-11-15 23:31:06 +0000 | [diff] [blame] | 1669 | } |
| 1670 | |
Kaelyn Takata | e1f49d5 | 2014-10-27 18:07:20 +0000 | [diff] [blame] | 1671 | void ASTStmtReader::VisitTypoExpr(TypoExpr *E) { |
| 1672 | llvm_unreachable("Cannot read TypoExpr nodes"); |
| 1673 | } |
| 1674 | |
Peter Collingbourne | 41f8546 | 2011-02-09 21:07:24 +0000 | [diff] [blame] | 1675 | //===----------------------------------------------------------------------===// |
John McCall | fa19404 | 2011-07-15 07:00:14 +0000 | [diff] [blame] | 1676 | // Microsoft Expressions and Statements |
| 1677 | //===----------------------------------------------------------------------===// |
John McCall | 5e77d76 | 2013-04-16 07:28:30 +0000 | [diff] [blame] | 1678 | void ASTStmtReader::VisitMSPropertyRefExpr(MSPropertyRefExpr *E) { |
| 1679 | VisitExpr(E); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1680 | E->IsArrow = (Record.readInt() != 0); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1681 | E->BaseExpr = Record.readSubExpr(); |
| 1682 | E->QualifierLoc = Record.readNestedNameSpecifierLoc(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1683 | E->MemberLoc = ReadSourceLocation(); |
| 1684 | E->TheDecl = ReadDeclAs<MSPropertyDecl>(); |
John McCall | 5e77d76 | 2013-04-16 07:28:30 +0000 | [diff] [blame] | 1685 | } |
| 1686 | |
Alexey Bataev | f763027 | 2015-11-25 12:01:00 +0000 | [diff] [blame] | 1687 | void ASTStmtReader::VisitMSPropertySubscriptExpr(MSPropertySubscriptExpr *E) { |
| 1688 | VisitExpr(E); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1689 | E->setBase(Record.readSubExpr()); |
| 1690 | E->setIdx(Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1691 | E->setRBracketLoc(ReadSourceLocation()); |
Alexey Bataev | f763027 | 2015-11-25 12:01:00 +0000 | [diff] [blame] | 1692 | } |
| 1693 | |
John McCall | fa19404 | 2011-07-15 07:00:14 +0000 | [diff] [blame] | 1694 | void ASTStmtReader::VisitCXXUuidofExpr(CXXUuidofExpr *E) { |
| 1695 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1696 | E->setSourceRange(ReadSourceRange()); |
| 1697 | std::string UuidStr = ReadString(); |
| 1698 | E->setUuidStr(StringRef(UuidStr).copy(Record.getContext())); |
John McCall | fa19404 | 2011-07-15 07:00:14 +0000 | [diff] [blame] | 1699 | if (E->isTypeOperand()) { // __uuidof(ComType) |
| 1700 | E->setTypeOperandSourceInfo( |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1701 | GetTypeSourceInfo()); |
John McCall | fa19404 | 2011-07-15 07:00:14 +0000 | [diff] [blame] | 1702 | return; |
| 1703 | } |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1704 | |
John McCall | fa19404 | 2011-07-15 07:00:14 +0000 | [diff] [blame] | 1705 | // __uuidof(expr) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1706 | E->setExprOperand(Record.readSubExpr()); |
John McCall | fa19404 | 2011-07-15 07:00:14 +0000 | [diff] [blame] | 1707 | } |
| 1708 | |
Nico Weber | 9b98207 | 2014-07-07 00:12:30 +0000 | [diff] [blame] | 1709 | void ASTStmtReader::VisitSEHLeaveStmt(SEHLeaveStmt *S) { |
| 1710 | VisitStmt(S); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1711 | S->setLeaveLoc(ReadSourceLocation()); |
Nico Weber | 9b98207 | 2014-07-07 00:12:30 +0000 | [diff] [blame] | 1712 | } |
| 1713 | |
John McCall | fa19404 | 2011-07-15 07:00:14 +0000 | [diff] [blame] | 1714 | void ASTStmtReader::VisitSEHExceptStmt(SEHExceptStmt *S) { |
| 1715 | VisitStmt(S); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1716 | S->Loc = ReadSourceLocation(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1717 | S->Children[SEHExceptStmt::FILTER_EXPR] = Record.readSubStmt(); |
| 1718 | S->Children[SEHExceptStmt::BLOCK] = Record.readSubStmt(); |
John McCall | fa19404 | 2011-07-15 07:00:14 +0000 | [diff] [blame] | 1719 | } |
| 1720 | |
| 1721 | void ASTStmtReader::VisitSEHFinallyStmt(SEHFinallyStmt *S) { |
| 1722 | VisitStmt(S); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1723 | S->Loc = ReadSourceLocation(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1724 | S->Block = Record.readSubStmt(); |
John McCall | fa19404 | 2011-07-15 07:00:14 +0000 | [diff] [blame] | 1725 | } |
| 1726 | |
| 1727 | void ASTStmtReader::VisitSEHTryStmt(SEHTryStmt *S) { |
| 1728 | VisitStmt(S); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1729 | S->IsCXXTry = Record.readInt(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1730 | S->TryLoc = ReadSourceLocation(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1731 | S->Children[SEHTryStmt::TRY] = Record.readSubStmt(); |
| 1732 | S->Children[SEHTryStmt::HANDLER] = Record.readSubStmt(); |
John McCall | fa19404 | 2011-07-15 07:00:14 +0000 | [diff] [blame] | 1733 | } |
| 1734 | |
| 1735 | //===----------------------------------------------------------------------===// |
Peter Collingbourne | 41f8546 | 2011-02-09 21:07:24 +0000 | [diff] [blame] | 1736 | // CUDA Expressions and Statements |
| 1737 | //===----------------------------------------------------------------------===// |
| 1738 | |
| 1739 | void ASTStmtReader::VisitCUDAKernelCallExpr(CUDAKernelCallExpr *E) { |
| 1740 | VisitCallExpr(E); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1741 | E->setConfig(cast<CallExpr>(Record.readSubExpr())); |
Peter Collingbourne | 41f8546 | 2011-02-09 21:07:24 +0000 | [diff] [blame] | 1742 | } |
| 1743 | |
John McCall | fa19404 | 2011-07-15 07:00:14 +0000 | [diff] [blame] | 1744 | //===----------------------------------------------------------------------===// |
| 1745 | // OpenCL Expressions and Statements. |
| 1746 | //===----------------------------------------------------------------------===// |
| 1747 | void ASTStmtReader::VisitAsTypeExpr(AsTypeExpr *E) { |
| 1748 | VisitExpr(E); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1749 | E->BuiltinLoc = ReadSourceLocation(); |
| 1750 | E->RParenLoc = ReadSourceLocation(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1751 | E->SrcExpr = Record.readSubExpr(); |
John McCall | fa19404 | 2011-07-15 07:00:14 +0000 | [diff] [blame] | 1752 | } |
| 1753 | |
| 1754 | //===----------------------------------------------------------------------===// |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 1755 | // OpenMP Clauses. |
| 1756 | //===----------------------------------------------------------------------===// |
| 1757 | |
| 1758 | namespace clang { |
| 1759 | class OMPClauseReader : public OMPClauseVisitor<OMPClauseReader> { |
| 1760 | ASTStmtReader *Reader; |
| 1761 | ASTContext &Context; |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 1762 | public: |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1763 | OMPClauseReader(ASTStmtReader *R, ASTRecordReader &Record) |
| 1764 | : Reader(R), Context(Record.getContext()) {} |
Alexey Bataev | 417089f | 2016-02-17 13:19:37 +0000 | [diff] [blame] | 1765 | #define OPENMP_CLAUSE(Name, Class) void Visit##Class(Class *C); |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 1766 | #include "clang/Basic/OpenMPKinds.def" |
| 1767 | OMPClause *readClause(); |
Alexey Bataev | 3392d76 | 2016-02-16 11:18:12 +0000 | [diff] [blame] | 1768 | void VisitOMPClauseWithPreInit(OMPClauseWithPreInit *C); |
Alexey Bataev | 005248a | 2016-02-25 05:25:57 +0000 | [diff] [blame] | 1769 | void VisitOMPClauseWithPostUpdate(OMPClauseWithPostUpdate *C); |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 1770 | }; |
Alexander Kornienko | ab9db51 | 2015-06-22 23:07:51 +0000 | [diff] [blame] | 1771 | } |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 1772 | |
| 1773 | OMPClause *OMPClauseReader::readClause() { |
| 1774 | OMPClause *C; |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1775 | switch (Reader->Record.readInt()) { |
Alexey Bataev | aadd52e | 2014-02-13 05:29:23 +0000 | [diff] [blame] | 1776 | case OMPC_if: |
| 1777 | C = new (Context) OMPIfClause(); |
| 1778 | break; |
Alexey Bataev | 3778b60 | 2014-07-17 07:32:53 +0000 | [diff] [blame] | 1779 | case OMPC_final: |
| 1780 | C = new (Context) OMPFinalClause(); |
| 1781 | break; |
Alexey Bataev | 568a833 | 2014-03-06 06:15:19 +0000 | [diff] [blame] | 1782 | case OMPC_num_threads: |
| 1783 | C = new (Context) OMPNumThreadsClause(); |
| 1784 | break; |
Alexey Bataev | 62c87d2 | 2014-03-21 04:51:18 +0000 | [diff] [blame] | 1785 | case OMPC_safelen: |
| 1786 | C = new (Context) OMPSafelenClause(); |
| 1787 | break; |
Alexey Bataev | 66b15b5 | 2015-08-21 11:14:16 +0000 | [diff] [blame] | 1788 | case OMPC_simdlen: |
| 1789 | C = new (Context) OMPSimdlenClause(); |
| 1790 | break; |
Alexander Musman | 8bd31e6 | 2014-05-27 15:12:19 +0000 | [diff] [blame] | 1791 | case OMPC_collapse: |
| 1792 | C = new (Context) OMPCollapseClause(); |
| 1793 | break; |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 1794 | case OMPC_default: |
| 1795 | C = new (Context) OMPDefaultClause(); |
| 1796 | break; |
Alexey Bataev | bcbadb6 | 2014-05-06 06:04:14 +0000 | [diff] [blame] | 1797 | case OMPC_proc_bind: |
| 1798 | C = new (Context) OMPProcBindClause(); |
| 1799 | break; |
Alexey Bataev | 56dafe8 | 2014-06-20 07:16:17 +0000 | [diff] [blame] | 1800 | case OMPC_schedule: |
| 1801 | C = new (Context) OMPScheduleClause(); |
| 1802 | break; |
Alexey Bataev | 142e1fc | 2014-06-20 09:44:06 +0000 | [diff] [blame] | 1803 | case OMPC_ordered: |
| 1804 | C = new (Context) OMPOrderedClause(); |
| 1805 | break; |
Alexey Bataev | 236070f | 2014-06-20 11:19:47 +0000 | [diff] [blame] | 1806 | case OMPC_nowait: |
| 1807 | C = new (Context) OMPNowaitClause(); |
| 1808 | break; |
Alexey Bataev | 7aea99a | 2014-07-17 12:19:31 +0000 | [diff] [blame] | 1809 | case OMPC_untied: |
| 1810 | C = new (Context) OMPUntiedClause(); |
| 1811 | break; |
Alexey Bataev | 74ba3a5 | 2014-07-17 12:47:03 +0000 | [diff] [blame] | 1812 | case OMPC_mergeable: |
| 1813 | C = new (Context) OMPMergeableClause(); |
| 1814 | break; |
Alexey Bataev | f98b00c | 2014-07-23 02:27:21 +0000 | [diff] [blame] | 1815 | case OMPC_read: |
| 1816 | C = new (Context) OMPReadClause(); |
| 1817 | break; |
Alexey Bataev | dea4761 | 2014-07-23 07:46:59 +0000 | [diff] [blame] | 1818 | case OMPC_write: |
| 1819 | C = new (Context) OMPWriteClause(); |
| 1820 | break; |
Alexey Bataev | 67a4f22 | 2014-07-23 10:25:33 +0000 | [diff] [blame] | 1821 | case OMPC_update: |
| 1822 | C = new (Context) OMPUpdateClause(); |
| 1823 | break; |
Alexey Bataev | 459dec0 | 2014-07-24 06:46:57 +0000 | [diff] [blame] | 1824 | case OMPC_capture: |
| 1825 | C = new (Context) OMPCaptureClause(); |
| 1826 | break; |
Alexey Bataev | 82bad8b | 2014-07-24 08:55:34 +0000 | [diff] [blame] | 1827 | case OMPC_seq_cst: |
| 1828 | C = new (Context) OMPSeqCstClause(); |
| 1829 | break; |
Alexey Bataev | 346265e | 2015-09-25 10:37:12 +0000 | [diff] [blame] | 1830 | case OMPC_threads: |
| 1831 | C = new (Context) OMPThreadsClause(); |
| 1832 | break; |
Alexey Bataev | d14d1e6 | 2015-09-28 06:39:35 +0000 | [diff] [blame] | 1833 | case OMPC_simd: |
| 1834 | C = new (Context) OMPSIMDClause(); |
| 1835 | break; |
Alexey Bataev | b825de1 | 2015-12-07 10:51:44 +0000 | [diff] [blame] | 1836 | case OMPC_nogroup: |
| 1837 | C = new (Context) OMPNogroupClause(); |
| 1838 | break; |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 1839 | case OMPC_private: |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1840 | C = OMPPrivateClause::CreateEmpty(Context, Reader->Record.readInt()); |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 1841 | break; |
Alexey Bataev | d5af8e4 | 2013-10-01 05:32:34 +0000 | [diff] [blame] | 1842 | case OMPC_firstprivate: |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1843 | C = OMPFirstprivateClause::CreateEmpty(Context, Reader->Record.readInt()); |
Alexey Bataev | d5af8e4 | 2013-10-01 05:32:34 +0000 | [diff] [blame] | 1844 | break; |
Alexander Musman | 1bb328c | 2014-06-04 13:06:39 +0000 | [diff] [blame] | 1845 | case OMPC_lastprivate: |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1846 | C = OMPLastprivateClause::CreateEmpty(Context, Reader->Record.readInt()); |
Alexander Musman | 1bb328c | 2014-06-04 13:06:39 +0000 | [diff] [blame] | 1847 | break; |
Alexey Bataev | 758e55e | 2013-09-06 18:03:48 +0000 | [diff] [blame] | 1848 | case OMPC_shared: |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1849 | C = OMPSharedClause::CreateEmpty(Context, Reader->Record.readInt()); |
Alexey Bataev | 758e55e | 2013-09-06 18:03:48 +0000 | [diff] [blame] | 1850 | break; |
Alexey Bataev | c5e0258 | 2014-06-16 07:08:35 +0000 | [diff] [blame] | 1851 | case OMPC_reduction: |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1852 | C = OMPReductionClause::CreateEmpty(Context, Reader->Record.readInt()); |
Alexey Bataev | c5e0258 | 2014-06-16 07:08:35 +0000 | [diff] [blame] | 1853 | break; |
Alexey Bataev | 169d96a | 2017-07-18 20:17:46 +0000 | [diff] [blame] | 1854 | case OMPC_task_reduction: |
| 1855 | C = OMPTaskReductionClause::CreateEmpty(Context, Reader->Record.readInt()); |
| 1856 | break; |
Alexey Bataev | fa312f3 | 2017-07-21 18:48:21 +0000 | [diff] [blame] | 1857 | case OMPC_in_reduction: |
| 1858 | C = OMPInReductionClause::CreateEmpty(Context, Reader->Record.readInt()); |
| 1859 | break; |
Alexander Musman | 8dba664 | 2014-04-22 13:09:42 +0000 | [diff] [blame] | 1860 | case OMPC_linear: |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1861 | C = OMPLinearClause::CreateEmpty(Context, Reader->Record.readInt()); |
Alexander Musman | 8dba664 | 2014-04-22 13:09:42 +0000 | [diff] [blame] | 1862 | break; |
Alexander Musman | f0d76e7 | 2014-05-29 14:36:25 +0000 | [diff] [blame] | 1863 | case OMPC_aligned: |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1864 | C = OMPAlignedClause::CreateEmpty(Context, Reader->Record.readInt()); |
Alexander Musman | f0d76e7 | 2014-05-29 14:36:25 +0000 | [diff] [blame] | 1865 | break; |
Alexey Bataev | d48bcd8 | 2014-03-31 03:36:38 +0000 | [diff] [blame] | 1866 | case OMPC_copyin: |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1867 | C = OMPCopyinClause::CreateEmpty(Context, Reader->Record.readInt()); |
Alexey Bataev | d48bcd8 | 2014-03-31 03:36:38 +0000 | [diff] [blame] | 1868 | break; |
Alexey Bataev | bae9a79 | 2014-06-27 10:37:06 +0000 | [diff] [blame] | 1869 | case OMPC_copyprivate: |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1870 | C = OMPCopyprivateClause::CreateEmpty(Context, Reader->Record.readInt()); |
Alexey Bataev | bae9a79 | 2014-06-27 10:37:06 +0000 | [diff] [blame] | 1871 | break; |
Alexey Bataev | 6125da9 | 2014-07-21 11:26:11 +0000 | [diff] [blame] | 1872 | case OMPC_flush: |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1873 | C = OMPFlushClause::CreateEmpty(Context, Reader->Record.readInt()); |
Alexey Bataev | 6125da9 | 2014-07-21 11:26:11 +0000 | [diff] [blame] | 1874 | break; |
Alexey Bataev | 1c2cfbc | 2015-06-23 14:25:19 +0000 | [diff] [blame] | 1875 | case OMPC_depend: |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1876 | C = OMPDependClause::CreateEmpty(Context, Reader->Record.readInt()); |
Alexey Bataev | 1c2cfbc | 2015-06-23 14:25:19 +0000 | [diff] [blame] | 1877 | break; |
Michael Wong | e710d54 | 2015-08-07 16:16:36 +0000 | [diff] [blame] | 1878 | case OMPC_device: |
| 1879 | C = new (Context) OMPDeviceClause(); |
| 1880 | break; |
Samuel Antao | 9092700 | 2016-04-26 14:54:23 +0000 | [diff] [blame] | 1881 | case OMPC_map: { |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1882 | unsigned NumVars = Reader->Record.readInt(); |
| 1883 | unsigned NumDeclarations = Reader->Record.readInt(); |
| 1884 | unsigned NumLists = Reader->Record.readInt(); |
| 1885 | unsigned NumComponents = Reader->Record.readInt(); |
Samuel Antao | 9092700 | 2016-04-26 14:54:23 +0000 | [diff] [blame] | 1886 | C = OMPMapClause::CreateEmpty(Context, NumVars, NumDeclarations, NumLists, |
| 1887 | NumComponents); |
Kelvin Li | 0bff7af | 2015-11-23 05:32:03 +0000 | [diff] [blame] | 1888 | break; |
Samuel Antao | 9092700 | 2016-04-26 14:54:23 +0000 | [diff] [blame] | 1889 | } |
Kelvin Li | 099bb8c | 2015-11-24 20:50:12 +0000 | [diff] [blame] | 1890 | case OMPC_num_teams: |
| 1891 | C = new (Context) OMPNumTeamsClause(); |
| 1892 | break; |
Kelvin Li | a15fb1a | 2015-11-27 18:47:36 +0000 | [diff] [blame] | 1893 | case OMPC_thread_limit: |
| 1894 | C = new (Context) OMPThreadLimitClause(); |
| 1895 | break; |
Alexey Bataev | a056935 | 2015-12-01 10:17:31 +0000 | [diff] [blame] | 1896 | case OMPC_priority: |
| 1897 | C = new (Context) OMPPriorityClause(); |
| 1898 | break; |
Alexey Bataev | 1fd4aed | 2015-12-07 12:52:51 +0000 | [diff] [blame] | 1899 | case OMPC_grainsize: |
| 1900 | C = new (Context) OMPGrainsizeClause(); |
| 1901 | break; |
Alexey Bataev | 382967a | 2015-12-08 12:06:20 +0000 | [diff] [blame] | 1902 | case OMPC_num_tasks: |
| 1903 | C = new (Context) OMPNumTasksClause(); |
| 1904 | break; |
Alexey Bataev | 28c7541 | 2015-12-15 08:19:24 +0000 | [diff] [blame] | 1905 | case OMPC_hint: |
| 1906 | C = new (Context) OMPHintClause(); |
| 1907 | break; |
Carlo Bertolli | b4adf55 | 2016-01-15 18:50:31 +0000 | [diff] [blame] | 1908 | case OMPC_dist_schedule: |
| 1909 | C = new (Context) OMPDistScheduleClause(); |
| 1910 | break; |
Arpith Chacko Jacob | 3cf8904 | 2016-01-26 16:37:23 +0000 | [diff] [blame] | 1911 | case OMPC_defaultmap: |
| 1912 | C = new (Context) OMPDefaultmapClause(); |
| 1913 | break; |
Samuel Antao | 661c090 | 2016-05-26 17:39:58 +0000 | [diff] [blame] | 1914 | case OMPC_to: { |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1915 | unsigned NumVars = Reader->Record.readInt(); |
| 1916 | unsigned NumDeclarations = Reader->Record.readInt(); |
| 1917 | unsigned NumLists = Reader->Record.readInt(); |
| 1918 | unsigned NumComponents = Reader->Record.readInt(); |
Samuel Antao | 661c090 | 2016-05-26 17:39:58 +0000 | [diff] [blame] | 1919 | C = OMPToClause::CreateEmpty(Context, NumVars, NumDeclarations, NumLists, |
| 1920 | NumComponents); |
| 1921 | break; |
| 1922 | } |
Samuel Antao | ec172c6 | 2016-05-26 17:49:04 +0000 | [diff] [blame] | 1923 | case OMPC_from: { |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1924 | unsigned NumVars = Reader->Record.readInt(); |
| 1925 | unsigned NumDeclarations = Reader->Record.readInt(); |
| 1926 | unsigned NumLists = Reader->Record.readInt(); |
| 1927 | unsigned NumComponents = Reader->Record.readInt(); |
Samuel Antao | ec172c6 | 2016-05-26 17:49:04 +0000 | [diff] [blame] | 1928 | C = OMPFromClause::CreateEmpty(Context, NumVars, NumDeclarations, NumLists, |
| 1929 | NumComponents); |
| 1930 | break; |
| 1931 | } |
Samuel Antao | cc10b85 | 2016-07-28 14:23:26 +0000 | [diff] [blame] | 1932 | case OMPC_use_device_ptr: { |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1933 | unsigned NumVars = Reader->Record.readInt(); |
| 1934 | unsigned NumDeclarations = Reader->Record.readInt(); |
| 1935 | unsigned NumLists = Reader->Record.readInt(); |
| 1936 | unsigned NumComponents = Reader->Record.readInt(); |
Samuel Antao | cc10b85 | 2016-07-28 14:23:26 +0000 | [diff] [blame] | 1937 | C = OMPUseDevicePtrClause::CreateEmpty(Context, NumVars, NumDeclarations, |
| 1938 | NumLists, NumComponents); |
Carlo Bertolli | 2404b17 | 2016-07-13 15:37:16 +0000 | [diff] [blame] | 1939 | break; |
Samuel Antao | cc10b85 | 2016-07-28 14:23:26 +0000 | [diff] [blame] | 1940 | } |
Samuel Antao | 6890b09 | 2016-07-28 14:25:09 +0000 | [diff] [blame] | 1941 | case OMPC_is_device_ptr: { |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1942 | unsigned NumVars = Reader->Record.readInt(); |
| 1943 | unsigned NumDeclarations = Reader->Record.readInt(); |
| 1944 | unsigned NumLists = Reader->Record.readInt(); |
| 1945 | unsigned NumComponents = Reader->Record.readInt(); |
Samuel Antao | 6890b09 | 2016-07-28 14:25:09 +0000 | [diff] [blame] | 1946 | C = OMPIsDevicePtrClause::CreateEmpty(Context, NumVars, NumDeclarations, |
| 1947 | NumLists, NumComponents); |
Carlo Bertolli | 70594e9 | 2016-07-13 17:16:49 +0000 | [diff] [blame] | 1948 | break; |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 1949 | } |
Samuel Antao | 6890b09 | 2016-07-28 14:25:09 +0000 | [diff] [blame] | 1950 | } |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 1951 | Visit(C); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1952 | C->setLocStart(Reader->ReadSourceLocation()); |
| 1953 | C->setLocEnd(Reader->ReadSourceLocation()); |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 1954 | |
| 1955 | return C; |
| 1956 | } |
| 1957 | |
Alexey Bataev | 3392d76 | 2016-02-16 11:18:12 +0000 | [diff] [blame] | 1958 | void OMPClauseReader::VisitOMPClauseWithPreInit(OMPClauseWithPreInit *C) { |
Arpith Chacko Jacob | fe4890a | 2017-01-18 20:40:48 +0000 | [diff] [blame] | 1959 | C->setPreInitStmt(Reader->Record.readSubStmt(), |
| 1960 | static_cast<OpenMPDirectiveKind>(Reader->Record.readInt())); |
Alexey Bataev | 3392d76 | 2016-02-16 11:18:12 +0000 | [diff] [blame] | 1961 | } |
| 1962 | |
Alexey Bataev | 005248a | 2016-02-25 05:25:57 +0000 | [diff] [blame] | 1963 | void OMPClauseReader::VisitOMPClauseWithPostUpdate(OMPClauseWithPostUpdate *C) { |
Alexey Bataev | 37e594c | 2016-03-04 07:21:16 +0000 | [diff] [blame] | 1964 | VisitOMPClauseWithPreInit(C); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1965 | C->setPostUpdateExpr(Reader->Record.readSubExpr()); |
Alexey Bataev | 005248a | 2016-02-25 05:25:57 +0000 | [diff] [blame] | 1966 | } |
| 1967 | |
Alexey Bataev | aadd52e | 2014-02-13 05:29:23 +0000 | [diff] [blame] | 1968 | void OMPClauseReader::VisitOMPIfClause(OMPIfClause *C) { |
Arpith Chacko Jacob | fe4890a | 2017-01-18 20:40:48 +0000 | [diff] [blame] | 1969 | VisitOMPClauseWithPreInit(C); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 1970 | C->setNameModifier(static_cast<OpenMPDirectiveKind>(Reader->Record.readInt())); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1971 | C->setNameModifierLoc(Reader->ReadSourceLocation()); |
| 1972 | C->setColonLoc(Reader->ReadSourceLocation()); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1973 | C->setCondition(Reader->Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1974 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Alexey Bataev | aadd52e | 2014-02-13 05:29:23 +0000 | [diff] [blame] | 1975 | } |
| 1976 | |
Alexey Bataev | 3778b60 | 2014-07-17 07:32:53 +0000 | [diff] [blame] | 1977 | void OMPClauseReader::VisitOMPFinalClause(OMPFinalClause *C) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1978 | C->setCondition(Reader->Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1979 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Alexey Bataev | 3778b60 | 2014-07-17 07:32:53 +0000 | [diff] [blame] | 1980 | } |
| 1981 | |
Alexey Bataev | 568a833 | 2014-03-06 06:15:19 +0000 | [diff] [blame] | 1982 | void OMPClauseReader::VisitOMPNumThreadsClause(OMPNumThreadsClause *C) { |
Arpith Chacko Jacob | 33c849a | 2017-01-25 00:57:16 +0000 | [diff] [blame] | 1983 | VisitOMPClauseWithPreInit(C); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1984 | C->setNumThreads(Reader->Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1985 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Alexey Bataev | 568a833 | 2014-03-06 06:15:19 +0000 | [diff] [blame] | 1986 | } |
| 1987 | |
Alexey Bataev | 62c87d2 | 2014-03-21 04:51:18 +0000 | [diff] [blame] | 1988 | void OMPClauseReader::VisitOMPSafelenClause(OMPSafelenClause *C) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1989 | C->setSafelen(Reader->Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1990 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Alexey Bataev | 62c87d2 | 2014-03-21 04:51:18 +0000 | [diff] [blame] | 1991 | } |
| 1992 | |
Alexey Bataev | 66b15b5 | 2015-08-21 11:14:16 +0000 | [diff] [blame] | 1993 | void OMPClauseReader::VisitOMPSimdlenClause(OMPSimdlenClause *C) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1994 | C->setSimdlen(Reader->Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 1995 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Alexey Bataev | 66b15b5 | 2015-08-21 11:14:16 +0000 | [diff] [blame] | 1996 | } |
| 1997 | |
Alexander Musman | 8bd31e6 | 2014-05-27 15:12:19 +0000 | [diff] [blame] | 1998 | void OMPClauseReader::VisitOMPCollapseClause(OMPCollapseClause *C) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 1999 | C->setNumForLoops(Reader->Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2000 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Alexander Musman | 8bd31e6 | 2014-05-27 15:12:19 +0000 | [diff] [blame] | 2001 | } |
| 2002 | |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 2003 | void OMPClauseReader::VisitOMPDefaultClause(OMPDefaultClause *C) { |
| 2004 | C->setDefaultKind( |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2005 | static_cast<OpenMPDefaultClauseKind>(Reader->Record.readInt())); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2006 | C->setLParenLoc(Reader->ReadSourceLocation()); |
| 2007 | C->setDefaultKindKwLoc(Reader->ReadSourceLocation()); |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 2008 | } |
| 2009 | |
Alexey Bataev | bcbadb6 | 2014-05-06 06:04:14 +0000 | [diff] [blame] | 2010 | void OMPClauseReader::VisitOMPProcBindClause(OMPProcBindClause *C) { |
| 2011 | C->setProcBindKind( |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2012 | static_cast<OpenMPProcBindClauseKind>(Reader->Record.readInt())); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2013 | C->setLParenLoc(Reader->ReadSourceLocation()); |
| 2014 | C->setProcBindKindKwLoc(Reader->ReadSourceLocation()); |
Alexey Bataev | bcbadb6 | 2014-05-06 06:04:14 +0000 | [diff] [blame] | 2015 | } |
| 2016 | |
Alexey Bataev | 56dafe8 | 2014-06-20 07:16:17 +0000 | [diff] [blame] | 2017 | void OMPClauseReader::VisitOMPScheduleClause(OMPScheduleClause *C) { |
Alexey Bataev | 3392d76 | 2016-02-16 11:18:12 +0000 | [diff] [blame] | 2018 | VisitOMPClauseWithPreInit(C); |
Alexey Bataev | 56dafe8 | 2014-06-20 07:16:17 +0000 | [diff] [blame] | 2019 | C->setScheduleKind( |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2020 | static_cast<OpenMPScheduleClauseKind>(Reader->Record.readInt())); |
Alexey Bataev | 6402bca | 2015-12-28 07:25:51 +0000 | [diff] [blame] | 2021 | C->setFirstScheduleModifier( |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2022 | static_cast<OpenMPScheduleClauseModifier>(Reader->Record.readInt())); |
Alexey Bataev | 6402bca | 2015-12-28 07:25:51 +0000 | [diff] [blame] | 2023 | C->setSecondScheduleModifier( |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2024 | static_cast<OpenMPScheduleClauseModifier>(Reader->Record.readInt())); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2025 | C->setChunkSize(Reader->Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2026 | C->setLParenLoc(Reader->ReadSourceLocation()); |
| 2027 | C->setFirstScheduleModifierLoc(Reader->ReadSourceLocation()); |
| 2028 | C->setSecondScheduleModifierLoc(Reader->ReadSourceLocation()); |
| 2029 | C->setScheduleKindLoc(Reader->ReadSourceLocation()); |
| 2030 | C->setCommaLoc(Reader->ReadSourceLocation()); |
Alexey Bataev | 56dafe8 | 2014-06-20 07:16:17 +0000 | [diff] [blame] | 2031 | } |
| 2032 | |
Alexey Bataev | 10e775f | 2015-07-30 11:36:16 +0000 | [diff] [blame] | 2033 | void OMPClauseReader::VisitOMPOrderedClause(OMPOrderedClause *C) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2034 | C->setNumForLoops(Reader->Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2035 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Alexey Bataev | 10e775f | 2015-07-30 11:36:16 +0000 | [diff] [blame] | 2036 | } |
Alexey Bataev | 142e1fc | 2014-06-20 09:44:06 +0000 | [diff] [blame] | 2037 | |
Alexey Bataev | 236070f | 2014-06-20 11:19:47 +0000 | [diff] [blame] | 2038 | void OMPClauseReader::VisitOMPNowaitClause(OMPNowaitClause *) {} |
| 2039 | |
Alexey Bataev | 7aea99a | 2014-07-17 12:19:31 +0000 | [diff] [blame] | 2040 | void OMPClauseReader::VisitOMPUntiedClause(OMPUntiedClause *) {} |
| 2041 | |
Alexey Bataev | 74ba3a5 | 2014-07-17 12:47:03 +0000 | [diff] [blame] | 2042 | void OMPClauseReader::VisitOMPMergeableClause(OMPMergeableClause *) {} |
| 2043 | |
Alexey Bataev | f98b00c | 2014-07-23 02:27:21 +0000 | [diff] [blame] | 2044 | void OMPClauseReader::VisitOMPReadClause(OMPReadClause *) {} |
| 2045 | |
Alexey Bataev | dea4761 | 2014-07-23 07:46:59 +0000 | [diff] [blame] | 2046 | void OMPClauseReader::VisitOMPWriteClause(OMPWriteClause *) {} |
| 2047 | |
Alexey Bataev | 67a4f22 | 2014-07-23 10:25:33 +0000 | [diff] [blame] | 2048 | void OMPClauseReader::VisitOMPUpdateClause(OMPUpdateClause *) {} |
| 2049 | |
Alexey Bataev | 459dec0 | 2014-07-24 06:46:57 +0000 | [diff] [blame] | 2050 | void OMPClauseReader::VisitOMPCaptureClause(OMPCaptureClause *) {} |
| 2051 | |
Alexey Bataev | 82bad8b | 2014-07-24 08:55:34 +0000 | [diff] [blame] | 2052 | void OMPClauseReader::VisitOMPSeqCstClause(OMPSeqCstClause *) {} |
| 2053 | |
Alexey Bataev | 346265e | 2015-09-25 10:37:12 +0000 | [diff] [blame] | 2054 | void OMPClauseReader::VisitOMPThreadsClause(OMPThreadsClause *) {} |
| 2055 | |
Alexey Bataev | d14d1e6 | 2015-09-28 06:39:35 +0000 | [diff] [blame] | 2056 | void OMPClauseReader::VisitOMPSIMDClause(OMPSIMDClause *) {} |
| 2057 | |
Alexey Bataev | b825de1 | 2015-12-07 10:51:44 +0000 | [diff] [blame] | 2058 | void OMPClauseReader::VisitOMPNogroupClause(OMPNogroupClause *) {} |
| 2059 | |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 2060 | void OMPClauseReader::VisitOMPPrivateClause(OMPPrivateClause *C) { |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2061 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 2062 | unsigned NumVars = C->varlist_size(); |
| 2063 | SmallVector<Expr *, 16> Vars; |
| 2064 | Vars.reserve(NumVars); |
| 2065 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2066 | Vars.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 2067 | C->setVarRefs(Vars); |
Alexey Bataev | 03b340a | 2014-10-21 03:16:40 +0000 | [diff] [blame] | 2068 | Vars.clear(); |
| 2069 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2070 | Vars.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | 03b340a | 2014-10-21 03:16:40 +0000 | [diff] [blame] | 2071 | C->setPrivateCopies(Vars); |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 2072 | } |
| 2073 | |
Alexey Bataev | d5af8e4 | 2013-10-01 05:32:34 +0000 | [diff] [blame] | 2074 | void OMPClauseReader::VisitOMPFirstprivateClause(OMPFirstprivateClause *C) { |
Alexey Bataev | 417089f | 2016-02-17 13:19:37 +0000 | [diff] [blame] | 2075 | VisitOMPClauseWithPreInit(C); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2076 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Alexey Bataev | d5af8e4 | 2013-10-01 05:32:34 +0000 | [diff] [blame] | 2077 | unsigned NumVars = C->varlist_size(); |
| 2078 | SmallVector<Expr *, 16> Vars; |
| 2079 | Vars.reserve(NumVars); |
| 2080 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2081 | Vars.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | d5af8e4 | 2013-10-01 05:32:34 +0000 | [diff] [blame] | 2082 | C->setVarRefs(Vars); |
Alexey Bataev | 4a5bb77 | 2014-10-08 14:01:46 +0000 | [diff] [blame] | 2083 | Vars.clear(); |
| 2084 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2085 | Vars.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | 4a5bb77 | 2014-10-08 14:01:46 +0000 | [diff] [blame] | 2086 | C->setPrivateCopies(Vars); |
| 2087 | Vars.clear(); |
| 2088 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2089 | Vars.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | 4a5bb77 | 2014-10-08 14:01:46 +0000 | [diff] [blame] | 2090 | C->setInits(Vars); |
Alexey Bataev | d5af8e4 | 2013-10-01 05:32:34 +0000 | [diff] [blame] | 2091 | } |
| 2092 | |
Alexander Musman | 1bb328c | 2014-06-04 13:06:39 +0000 | [diff] [blame] | 2093 | void OMPClauseReader::VisitOMPLastprivateClause(OMPLastprivateClause *C) { |
Alexey Bataev | 005248a | 2016-02-25 05:25:57 +0000 | [diff] [blame] | 2094 | VisitOMPClauseWithPostUpdate(C); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2095 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Alexander Musman | 1bb328c | 2014-06-04 13:06:39 +0000 | [diff] [blame] | 2096 | unsigned NumVars = C->varlist_size(); |
| 2097 | SmallVector<Expr *, 16> Vars; |
| 2098 | Vars.reserve(NumVars); |
| 2099 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2100 | Vars.push_back(Reader->Record.readSubExpr()); |
Alexander Musman | 1bb328c | 2014-06-04 13:06:39 +0000 | [diff] [blame] | 2101 | C->setVarRefs(Vars); |
Alexey Bataev | 38e8953 | 2015-04-16 04:54:05 +0000 | [diff] [blame] | 2102 | Vars.clear(); |
| 2103 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2104 | Vars.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | 38e8953 | 2015-04-16 04:54:05 +0000 | [diff] [blame] | 2105 | C->setPrivateCopies(Vars); |
| 2106 | Vars.clear(); |
| 2107 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2108 | Vars.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | 38e8953 | 2015-04-16 04:54:05 +0000 | [diff] [blame] | 2109 | C->setSourceExprs(Vars); |
| 2110 | Vars.clear(); |
| 2111 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2112 | Vars.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | 38e8953 | 2015-04-16 04:54:05 +0000 | [diff] [blame] | 2113 | C->setDestinationExprs(Vars); |
| 2114 | Vars.clear(); |
| 2115 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2116 | Vars.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | 38e8953 | 2015-04-16 04:54:05 +0000 | [diff] [blame] | 2117 | C->setAssignmentOps(Vars); |
Alexander Musman | 1bb328c | 2014-06-04 13:06:39 +0000 | [diff] [blame] | 2118 | } |
| 2119 | |
Alexey Bataev | 758e55e | 2013-09-06 18:03:48 +0000 | [diff] [blame] | 2120 | void OMPClauseReader::VisitOMPSharedClause(OMPSharedClause *C) { |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2121 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Alexey Bataev | 758e55e | 2013-09-06 18:03:48 +0000 | [diff] [blame] | 2122 | unsigned NumVars = C->varlist_size(); |
| 2123 | SmallVector<Expr *, 16> Vars; |
| 2124 | Vars.reserve(NumVars); |
| 2125 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2126 | Vars.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | 758e55e | 2013-09-06 18:03:48 +0000 | [diff] [blame] | 2127 | C->setVarRefs(Vars); |
| 2128 | } |
| 2129 | |
Alexey Bataev | c5e0258 | 2014-06-16 07:08:35 +0000 | [diff] [blame] | 2130 | void OMPClauseReader::VisitOMPReductionClause(OMPReductionClause *C) { |
Alexey Bataev | 6120507 | 2016-03-02 04:57:40 +0000 | [diff] [blame] | 2131 | VisitOMPClauseWithPostUpdate(C); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2132 | C->setLParenLoc(Reader->ReadSourceLocation()); |
| 2133 | C->setColonLoc(Reader->ReadSourceLocation()); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2134 | NestedNameSpecifierLoc NNSL = Reader->Record.readNestedNameSpecifierLoc(); |
Alexey Bataev | c5e0258 | 2014-06-16 07:08:35 +0000 | [diff] [blame] | 2135 | DeclarationNameInfo DNI; |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2136 | Reader->ReadDeclarationNameInfo(DNI); |
Alexey Bataev | c5e0258 | 2014-06-16 07:08:35 +0000 | [diff] [blame] | 2137 | C->setQualifierLoc(NNSL); |
| 2138 | C->setNameInfo(DNI); |
| 2139 | |
| 2140 | unsigned NumVars = C->varlist_size(); |
| 2141 | SmallVector<Expr *, 16> Vars; |
| 2142 | Vars.reserve(NumVars); |
| 2143 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2144 | Vars.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | c5e0258 | 2014-06-16 07:08:35 +0000 | [diff] [blame] | 2145 | C->setVarRefs(Vars); |
Alexey Bataev | 794ba0d | 2015-04-10 10:43:45 +0000 | [diff] [blame] | 2146 | Vars.clear(); |
| 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()); |
Alexey Bataev | f24e7b1 | 2015-10-08 09:10:53 +0000 | [diff] [blame] | 2149 | C->setPrivates(Vars); |
| 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 | 794ba0d | 2015-04-10 10:43:45 +0000 | [diff] [blame] | 2153 | C->setLHSExprs(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 | 794ba0d | 2015-04-10 10:43:45 +0000 | [diff] [blame] | 2157 | C->setRHSExprs(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 | 794ba0d | 2015-04-10 10:43:45 +0000 | [diff] [blame] | 2161 | C->setReductionOps(Vars); |
Alexey Bataev | c5e0258 | 2014-06-16 07:08:35 +0000 | [diff] [blame] | 2162 | } |
| 2163 | |
Alexey Bataev | 169d96a | 2017-07-18 20:17:46 +0000 | [diff] [blame] | 2164 | void OMPClauseReader::VisitOMPTaskReductionClause(OMPTaskReductionClause *C) { |
| 2165 | VisitOMPClauseWithPostUpdate(C); |
| 2166 | C->setLParenLoc(Reader->ReadSourceLocation()); |
| 2167 | C->setColonLoc(Reader->ReadSourceLocation()); |
| 2168 | NestedNameSpecifierLoc NNSL = Reader->Record.readNestedNameSpecifierLoc(); |
| 2169 | DeclarationNameInfo DNI; |
| 2170 | Reader->ReadDeclarationNameInfo(DNI); |
| 2171 | C->setQualifierLoc(NNSL); |
| 2172 | C->setNameInfo(DNI); |
| 2173 | |
| 2174 | unsigned NumVars = C->varlist_size(); |
| 2175 | SmallVector<Expr *, 16> Vars; |
| 2176 | Vars.reserve(NumVars); |
| 2177 | for (unsigned I = 0; I != NumVars; ++I) |
| 2178 | Vars.push_back(Reader->Record.readSubExpr()); |
| 2179 | C->setVarRefs(Vars); |
| 2180 | Vars.clear(); |
| 2181 | for (unsigned I = 0; I != NumVars; ++I) |
| 2182 | Vars.push_back(Reader->Record.readSubExpr()); |
| 2183 | C->setPrivates(Vars); |
| 2184 | Vars.clear(); |
| 2185 | for (unsigned I = 0; I != NumVars; ++I) |
| 2186 | Vars.push_back(Reader->Record.readSubExpr()); |
| 2187 | C->setLHSExprs(Vars); |
| 2188 | Vars.clear(); |
| 2189 | for (unsigned I = 0; I != NumVars; ++I) |
| 2190 | Vars.push_back(Reader->Record.readSubExpr()); |
| 2191 | C->setRHSExprs(Vars); |
| 2192 | Vars.clear(); |
| 2193 | for (unsigned I = 0; I != NumVars; ++I) |
| 2194 | Vars.push_back(Reader->Record.readSubExpr()); |
| 2195 | C->setReductionOps(Vars); |
| 2196 | } |
| 2197 | |
Alexey Bataev | fa312f3 | 2017-07-21 18:48:21 +0000 | [diff] [blame] | 2198 | void OMPClauseReader::VisitOMPInReductionClause(OMPInReductionClause *C) { |
| 2199 | VisitOMPClauseWithPostUpdate(C); |
| 2200 | C->setLParenLoc(Reader->ReadSourceLocation()); |
| 2201 | C->setColonLoc(Reader->ReadSourceLocation()); |
| 2202 | NestedNameSpecifierLoc NNSL = Reader->Record.readNestedNameSpecifierLoc(); |
| 2203 | DeclarationNameInfo DNI; |
| 2204 | Reader->ReadDeclarationNameInfo(DNI); |
| 2205 | C->setQualifierLoc(NNSL); |
| 2206 | C->setNameInfo(DNI); |
| 2207 | |
| 2208 | unsigned NumVars = C->varlist_size(); |
| 2209 | SmallVector<Expr *, 16> Vars; |
| 2210 | Vars.reserve(NumVars); |
| 2211 | for (unsigned I = 0; I != NumVars; ++I) |
| 2212 | Vars.push_back(Reader->Record.readSubExpr()); |
| 2213 | C->setVarRefs(Vars); |
| 2214 | Vars.clear(); |
| 2215 | for (unsigned I = 0; I != NumVars; ++I) |
| 2216 | Vars.push_back(Reader->Record.readSubExpr()); |
| 2217 | C->setPrivates(Vars); |
| 2218 | Vars.clear(); |
| 2219 | for (unsigned I = 0; I != NumVars; ++I) |
| 2220 | Vars.push_back(Reader->Record.readSubExpr()); |
| 2221 | C->setLHSExprs(Vars); |
| 2222 | Vars.clear(); |
| 2223 | for (unsigned I = 0; I != NumVars; ++I) |
| 2224 | Vars.push_back(Reader->Record.readSubExpr()); |
| 2225 | C->setRHSExprs(Vars); |
| 2226 | Vars.clear(); |
| 2227 | for (unsigned I = 0; I != NumVars; ++I) |
| 2228 | Vars.push_back(Reader->Record.readSubExpr()); |
| 2229 | C->setReductionOps(Vars); |
Alexey Bataev | 88202be | 2017-07-27 13:20:36 +0000 | [diff] [blame] | 2230 | Vars.clear(); |
| 2231 | for (unsigned I = 0; I != NumVars; ++I) |
| 2232 | Vars.push_back(Reader->Record.readSubExpr()); |
| 2233 | C->setTaskgroupDescriptors(Vars); |
Alexey Bataev | fa312f3 | 2017-07-21 18:48:21 +0000 | [diff] [blame] | 2234 | } |
| 2235 | |
Alexander Musman | 8dba664 | 2014-04-22 13:09:42 +0000 | [diff] [blame] | 2236 | void OMPClauseReader::VisitOMPLinearClause(OMPLinearClause *C) { |
Alexey Bataev | 78849fb | 2016-03-09 09:49:00 +0000 | [diff] [blame] | 2237 | VisitOMPClauseWithPostUpdate(C); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2238 | C->setLParenLoc(Reader->ReadSourceLocation()); |
| 2239 | C->setColonLoc(Reader->ReadSourceLocation()); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2240 | C->setModifier(static_cast<OpenMPLinearClauseKind>(Reader->Record.readInt())); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2241 | C->setModifierLoc(Reader->ReadSourceLocation()); |
Alexander Musman | 8dba664 | 2014-04-22 13:09:42 +0000 | [diff] [blame] | 2242 | unsigned NumVars = C->varlist_size(); |
| 2243 | SmallVector<Expr *, 16> Vars; |
| 2244 | Vars.reserve(NumVars); |
| 2245 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2246 | Vars.push_back(Reader->Record.readSubExpr()); |
Alexander Musman | 8dba664 | 2014-04-22 13:09:42 +0000 | [diff] [blame] | 2247 | C->setVarRefs(Vars); |
Alexander Musman | 3276a27 | 2015-03-21 10:12:56 +0000 | [diff] [blame] | 2248 | Vars.clear(); |
| 2249 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2250 | Vars.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | bd9fec1 | 2015-08-18 06:47:21 +0000 | [diff] [blame] | 2251 | C->setPrivates(Vars); |
| 2252 | Vars.clear(); |
| 2253 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2254 | Vars.push_back(Reader->Record.readSubExpr()); |
Alexander Musman | 3276a27 | 2015-03-21 10:12:56 +0000 | [diff] [blame] | 2255 | C->setInits(Vars); |
| 2256 | Vars.clear(); |
| 2257 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2258 | Vars.push_back(Reader->Record.readSubExpr()); |
Alexander Musman | 3276a27 | 2015-03-21 10:12:56 +0000 | [diff] [blame] | 2259 | C->setUpdates(Vars); |
| 2260 | Vars.clear(); |
| 2261 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2262 | Vars.push_back(Reader->Record.readSubExpr()); |
Alexander Musman | 3276a27 | 2015-03-21 10:12:56 +0000 | [diff] [blame] | 2263 | C->setFinals(Vars); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2264 | C->setStep(Reader->Record.readSubExpr()); |
| 2265 | C->setCalcStep(Reader->Record.readSubExpr()); |
Alexander Musman | 8dba664 | 2014-04-22 13:09:42 +0000 | [diff] [blame] | 2266 | } |
| 2267 | |
Alexander Musman | f0d76e7 | 2014-05-29 14:36:25 +0000 | [diff] [blame] | 2268 | void OMPClauseReader::VisitOMPAlignedClause(OMPAlignedClause *C) { |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2269 | C->setLParenLoc(Reader->ReadSourceLocation()); |
| 2270 | C->setColonLoc(Reader->ReadSourceLocation()); |
Alexander Musman | f0d76e7 | 2014-05-29 14:36:25 +0000 | [diff] [blame] | 2271 | unsigned NumVars = C->varlist_size(); |
| 2272 | SmallVector<Expr *, 16> Vars; |
| 2273 | Vars.reserve(NumVars); |
| 2274 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2275 | Vars.push_back(Reader->Record.readSubExpr()); |
Alexander Musman | f0d76e7 | 2014-05-29 14:36:25 +0000 | [diff] [blame] | 2276 | C->setVarRefs(Vars); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2277 | C->setAlignment(Reader->Record.readSubExpr()); |
Alexander Musman | f0d76e7 | 2014-05-29 14:36:25 +0000 | [diff] [blame] | 2278 | } |
| 2279 | |
Alexey Bataev | d48bcd8 | 2014-03-31 03:36:38 +0000 | [diff] [blame] | 2280 | void OMPClauseReader::VisitOMPCopyinClause(OMPCopyinClause *C) { |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2281 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Alexey Bataev | d48bcd8 | 2014-03-31 03:36:38 +0000 | [diff] [blame] | 2282 | unsigned NumVars = C->varlist_size(); |
Alexey Bataev | f56f98c | 2015-04-16 05:39:01 +0000 | [diff] [blame] | 2283 | SmallVector<Expr *, 16> Exprs; |
| 2284 | Exprs.reserve(NumVars); |
Alexey Bataev | d48bcd8 | 2014-03-31 03:36:38 +0000 | [diff] [blame] | 2285 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2286 | Exprs.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | f56f98c | 2015-04-16 05:39:01 +0000 | [diff] [blame] | 2287 | C->setVarRefs(Exprs); |
| 2288 | Exprs.clear(); |
| 2289 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2290 | Exprs.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | f56f98c | 2015-04-16 05:39:01 +0000 | [diff] [blame] | 2291 | C->setSourceExprs(Exprs); |
| 2292 | Exprs.clear(); |
| 2293 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2294 | Exprs.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | f56f98c | 2015-04-16 05:39:01 +0000 | [diff] [blame] | 2295 | C->setDestinationExprs(Exprs); |
| 2296 | Exprs.clear(); |
| 2297 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2298 | Exprs.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | f56f98c | 2015-04-16 05:39:01 +0000 | [diff] [blame] | 2299 | C->setAssignmentOps(Exprs); |
Alexey Bataev | d48bcd8 | 2014-03-31 03:36:38 +0000 | [diff] [blame] | 2300 | } |
| 2301 | |
Alexey Bataev | bae9a79 | 2014-06-27 10:37:06 +0000 | [diff] [blame] | 2302 | void OMPClauseReader::VisitOMPCopyprivateClause(OMPCopyprivateClause *C) { |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2303 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Alexey Bataev | bae9a79 | 2014-06-27 10:37:06 +0000 | [diff] [blame] | 2304 | unsigned NumVars = C->varlist_size(); |
Alexey Bataev | a63048e | 2015-03-23 06:18:07 +0000 | [diff] [blame] | 2305 | SmallVector<Expr *, 16> Exprs; |
| 2306 | Exprs.reserve(NumVars); |
Alexey Bataev | bae9a79 | 2014-06-27 10:37:06 +0000 | [diff] [blame] | 2307 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2308 | Exprs.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | a63048e | 2015-03-23 06:18:07 +0000 | [diff] [blame] | 2309 | C->setVarRefs(Exprs); |
| 2310 | Exprs.clear(); |
| 2311 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2312 | Exprs.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | a63048e | 2015-03-23 06:18:07 +0000 | [diff] [blame] | 2313 | C->setSourceExprs(Exprs); |
| 2314 | Exprs.clear(); |
| 2315 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2316 | Exprs.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | a63048e | 2015-03-23 06:18:07 +0000 | [diff] [blame] | 2317 | C->setDestinationExprs(Exprs); |
| 2318 | Exprs.clear(); |
| 2319 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2320 | Exprs.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | a63048e | 2015-03-23 06:18:07 +0000 | [diff] [blame] | 2321 | C->setAssignmentOps(Exprs); |
Alexey Bataev | bae9a79 | 2014-06-27 10:37:06 +0000 | [diff] [blame] | 2322 | } |
| 2323 | |
Alexey Bataev | 6125da9 | 2014-07-21 11:26:11 +0000 | [diff] [blame] | 2324 | void OMPClauseReader::VisitOMPFlushClause(OMPFlushClause *C) { |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2325 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Alexey Bataev | 6125da9 | 2014-07-21 11:26:11 +0000 | [diff] [blame] | 2326 | unsigned NumVars = C->varlist_size(); |
| 2327 | SmallVector<Expr *, 16> Vars; |
| 2328 | Vars.reserve(NumVars); |
| 2329 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2330 | Vars.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | 6125da9 | 2014-07-21 11:26:11 +0000 | [diff] [blame] | 2331 | C->setVarRefs(Vars); |
| 2332 | } |
| 2333 | |
Alexey Bataev | 1c2cfbc | 2015-06-23 14:25:19 +0000 | [diff] [blame] | 2334 | void OMPClauseReader::VisitOMPDependClause(OMPDependClause *C) { |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2335 | C->setLParenLoc(Reader->ReadSourceLocation()); |
| 2336 | C->setDependencyKind( |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2337 | static_cast<OpenMPDependClauseKind>(Reader->Record.readInt())); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2338 | C->setDependencyLoc(Reader->ReadSourceLocation()); |
| 2339 | C->setColonLoc(Reader->ReadSourceLocation()); |
Alexey Bataev | 1c2cfbc | 2015-06-23 14:25:19 +0000 | [diff] [blame] | 2340 | unsigned NumVars = C->varlist_size(); |
| 2341 | SmallVector<Expr *, 16> Vars; |
| 2342 | Vars.reserve(NumVars); |
| 2343 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2344 | Vars.push_back(Reader->Record.readSubExpr()); |
Alexey Bataev | 1c2cfbc | 2015-06-23 14:25:19 +0000 | [diff] [blame] | 2345 | C->setVarRefs(Vars); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2346 | C->setCounterValue(Reader->Record.readSubExpr()); |
Alexey Bataev | 1c2cfbc | 2015-06-23 14:25:19 +0000 | [diff] [blame] | 2347 | } |
| 2348 | |
Michael Wong | e710d54 | 2015-08-07 16:16:36 +0000 | [diff] [blame] | 2349 | void OMPClauseReader::VisitOMPDeviceClause(OMPDeviceClause *C) { |
Alexey Bataev | 931e19b | 2017-10-02 16:32:39 +0000 | [diff] [blame] | 2350 | VisitOMPClauseWithPreInit(C); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2351 | C->setDevice(Reader->Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2352 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Michael Wong | e710d54 | 2015-08-07 16:16:36 +0000 | [diff] [blame] | 2353 | } |
| 2354 | |
Kelvin Li | 0bff7af | 2015-11-23 05:32:03 +0000 | [diff] [blame] | 2355 | void OMPClauseReader::VisitOMPMapClause(OMPMapClause *C) { |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2356 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Kelvin Li | 0bff7af | 2015-11-23 05:32:03 +0000 | [diff] [blame] | 2357 | C->setMapTypeModifier( |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2358 | static_cast<OpenMPMapClauseKind>(Reader->Record.readInt())); |
Kelvin Li | 0bff7af | 2015-11-23 05:32:03 +0000 | [diff] [blame] | 2359 | C->setMapType( |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2360 | static_cast<OpenMPMapClauseKind>(Reader->Record.readInt())); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2361 | C->setMapLoc(Reader->ReadSourceLocation()); |
| 2362 | C->setColonLoc(Reader->ReadSourceLocation()); |
Kelvin Li | 0bff7af | 2015-11-23 05:32:03 +0000 | [diff] [blame] | 2363 | auto NumVars = C->varlist_size(); |
Samuel Antao | 9092700 | 2016-04-26 14:54:23 +0000 | [diff] [blame] | 2364 | auto UniqueDecls = C->getUniqueDeclarationsNum(); |
| 2365 | auto TotalLists = C->getTotalComponentListNum(); |
| 2366 | auto TotalComponents = C->getTotalComponentsNum(); |
| 2367 | |
Kelvin Li | 0bff7af | 2015-11-23 05:32:03 +0000 | [diff] [blame] | 2368 | SmallVector<Expr *, 16> Vars; |
| 2369 | Vars.reserve(NumVars); |
Samuel Antao | 9092700 | 2016-04-26 14:54:23 +0000 | [diff] [blame] | 2370 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2371 | Vars.push_back(Reader->Record.readSubExpr()); |
Kelvin Li | 0bff7af | 2015-11-23 05:32:03 +0000 | [diff] [blame] | 2372 | C->setVarRefs(Vars); |
Samuel Antao | 9092700 | 2016-04-26 14:54:23 +0000 | [diff] [blame] | 2373 | |
| 2374 | SmallVector<ValueDecl *, 16> Decls; |
| 2375 | Decls.reserve(UniqueDecls); |
| 2376 | for (unsigned i = 0; i < UniqueDecls; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2377 | Decls.push_back(Reader->Record.readDeclAs<ValueDecl>()); |
Samuel Antao | 9092700 | 2016-04-26 14:54:23 +0000 | [diff] [blame] | 2378 | C->setUniqueDecls(Decls); |
| 2379 | |
| 2380 | SmallVector<unsigned, 16> ListsPerDecl; |
| 2381 | ListsPerDecl.reserve(UniqueDecls); |
| 2382 | for (unsigned i = 0; i < UniqueDecls; ++i) |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2383 | ListsPerDecl.push_back(Reader->Record.readInt()); |
Samuel Antao | 9092700 | 2016-04-26 14:54:23 +0000 | [diff] [blame] | 2384 | C->setDeclNumLists(ListsPerDecl); |
| 2385 | |
| 2386 | SmallVector<unsigned, 32> ListSizes; |
| 2387 | ListSizes.reserve(TotalLists); |
| 2388 | for (unsigned i = 0; i < TotalLists; ++i) |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2389 | ListSizes.push_back(Reader->Record.readInt()); |
Samuel Antao | 9092700 | 2016-04-26 14:54:23 +0000 | [diff] [blame] | 2390 | C->setComponentListSizes(ListSizes); |
| 2391 | |
| 2392 | SmallVector<OMPClauseMappableExprCommon::MappableComponent, 32> Components; |
| 2393 | Components.reserve(TotalComponents); |
| 2394 | for (unsigned i = 0; i < TotalComponents; ++i) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2395 | Expr *AssociatedExpr = Reader->Record.readSubExpr(); |
| 2396 | ValueDecl *AssociatedDecl = Reader->Record.readDeclAs<ValueDecl>(); |
Samuel Antao | 9092700 | 2016-04-26 14:54:23 +0000 | [diff] [blame] | 2397 | Components.push_back(OMPClauseMappableExprCommon::MappableComponent( |
| 2398 | AssociatedExpr, AssociatedDecl)); |
| 2399 | } |
| 2400 | C->setComponents(Components, ListSizes); |
Kelvin Li | 0bff7af | 2015-11-23 05:32:03 +0000 | [diff] [blame] | 2401 | } |
| 2402 | |
Kelvin Li | 099bb8c | 2015-11-24 20:50:12 +0000 | [diff] [blame] | 2403 | void OMPClauseReader::VisitOMPNumTeamsClause(OMPNumTeamsClause *C) { |
Arpith Chacko Jacob | bc12634 | 2017-01-25 11:28:18 +0000 | [diff] [blame] | 2404 | VisitOMPClauseWithPreInit(C); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2405 | C->setNumTeams(Reader->Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2406 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Kelvin Li | 099bb8c | 2015-11-24 20:50:12 +0000 | [diff] [blame] | 2407 | } |
| 2408 | |
Kelvin Li | a15fb1a | 2015-11-27 18:47:36 +0000 | [diff] [blame] | 2409 | void OMPClauseReader::VisitOMPThreadLimitClause(OMPThreadLimitClause *C) { |
Arpith Chacko Jacob | 7ecc0b7 | 2017-01-25 11:44:35 +0000 | [diff] [blame] | 2410 | VisitOMPClauseWithPreInit(C); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2411 | C->setThreadLimit(Reader->Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2412 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Kelvin Li | a15fb1a | 2015-11-27 18:47:36 +0000 | [diff] [blame] | 2413 | } |
| 2414 | |
Alexey Bataev | a056935 | 2015-12-01 10:17:31 +0000 | [diff] [blame] | 2415 | void OMPClauseReader::VisitOMPPriorityClause(OMPPriorityClause *C) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2416 | C->setPriority(Reader->Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2417 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Alexey Bataev | a056935 | 2015-12-01 10:17:31 +0000 | [diff] [blame] | 2418 | } |
| 2419 | |
Alexey Bataev | 1fd4aed | 2015-12-07 12:52:51 +0000 | [diff] [blame] | 2420 | void OMPClauseReader::VisitOMPGrainsizeClause(OMPGrainsizeClause *C) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2421 | C->setGrainsize(Reader->Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2422 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Alexey Bataev | 1fd4aed | 2015-12-07 12:52:51 +0000 | [diff] [blame] | 2423 | } |
| 2424 | |
Alexey Bataev | 382967a | 2015-12-08 12:06:20 +0000 | [diff] [blame] | 2425 | void OMPClauseReader::VisitOMPNumTasksClause(OMPNumTasksClause *C) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2426 | C->setNumTasks(Reader->Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2427 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Alexey Bataev | 382967a | 2015-12-08 12:06:20 +0000 | [diff] [blame] | 2428 | } |
| 2429 | |
Alexey Bataev | 28c7541 | 2015-12-15 08:19:24 +0000 | [diff] [blame] | 2430 | void OMPClauseReader::VisitOMPHintClause(OMPHintClause *C) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2431 | C->setHint(Reader->Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2432 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Alexey Bataev | 28c7541 | 2015-12-15 08:19:24 +0000 | [diff] [blame] | 2433 | } |
| 2434 | |
Carlo Bertolli | b4adf55 | 2016-01-15 18:50:31 +0000 | [diff] [blame] | 2435 | void OMPClauseReader::VisitOMPDistScheduleClause(OMPDistScheduleClause *C) { |
Alexey Bataev | 3392d76 | 2016-02-16 11:18:12 +0000 | [diff] [blame] | 2436 | VisitOMPClauseWithPreInit(C); |
Carlo Bertolli | b4adf55 | 2016-01-15 18:50:31 +0000 | [diff] [blame] | 2437 | C->setDistScheduleKind( |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2438 | static_cast<OpenMPDistScheduleClauseKind>(Reader->Record.readInt())); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2439 | C->setChunkSize(Reader->Record.readSubExpr()); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2440 | C->setLParenLoc(Reader->ReadSourceLocation()); |
| 2441 | C->setDistScheduleKindLoc(Reader->ReadSourceLocation()); |
| 2442 | C->setCommaLoc(Reader->ReadSourceLocation()); |
Carlo Bertolli | b4adf55 | 2016-01-15 18:50:31 +0000 | [diff] [blame] | 2443 | } |
| 2444 | |
Arpith Chacko Jacob | 3cf8904 | 2016-01-26 16:37:23 +0000 | [diff] [blame] | 2445 | void OMPClauseReader::VisitOMPDefaultmapClause(OMPDefaultmapClause *C) { |
| 2446 | C->setDefaultmapKind( |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2447 | static_cast<OpenMPDefaultmapClauseKind>(Reader->Record.readInt())); |
Arpith Chacko Jacob | 3cf8904 | 2016-01-26 16:37:23 +0000 | [diff] [blame] | 2448 | C->setDefaultmapModifier( |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2449 | static_cast<OpenMPDefaultmapClauseModifier>(Reader->Record.readInt())); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2450 | C->setLParenLoc(Reader->ReadSourceLocation()); |
| 2451 | C->setDefaultmapModifierLoc(Reader->ReadSourceLocation()); |
| 2452 | C->setDefaultmapKindLoc(Reader->ReadSourceLocation()); |
Arpith Chacko Jacob | 3cf8904 | 2016-01-26 16:37:23 +0000 | [diff] [blame] | 2453 | } |
| 2454 | |
Samuel Antao | 661c090 | 2016-05-26 17:39:58 +0000 | [diff] [blame] | 2455 | void OMPClauseReader::VisitOMPToClause(OMPToClause *C) { |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2456 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Samuel Antao | 661c090 | 2016-05-26 17:39:58 +0000 | [diff] [blame] | 2457 | auto NumVars = C->varlist_size(); |
| 2458 | auto UniqueDecls = C->getUniqueDeclarationsNum(); |
| 2459 | auto TotalLists = C->getTotalComponentListNum(); |
| 2460 | auto TotalComponents = C->getTotalComponentsNum(); |
| 2461 | |
| 2462 | SmallVector<Expr *, 16> Vars; |
| 2463 | Vars.reserve(NumVars); |
| 2464 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2465 | Vars.push_back(Reader->Record.readSubExpr()); |
Samuel Antao | 661c090 | 2016-05-26 17:39:58 +0000 | [diff] [blame] | 2466 | C->setVarRefs(Vars); |
| 2467 | |
| 2468 | SmallVector<ValueDecl *, 16> Decls; |
| 2469 | Decls.reserve(UniqueDecls); |
| 2470 | for (unsigned i = 0; i < UniqueDecls; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2471 | Decls.push_back(Reader->Record.readDeclAs<ValueDecl>()); |
Samuel Antao | 661c090 | 2016-05-26 17:39:58 +0000 | [diff] [blame] | 2472 | C->setUniqueDecls(Decls); |
| 2473 | |
| 2474 | SmallVector<unsigned, 16> ListsPerDecl; |
| 2475 | ListsPerDecl.reserve(UniqueDecls); |
| 2476 | for (unsigned i = 0; i < UniqueDecls; ++i) |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2477 | ListsPerDecl.push_back(Reader->Record.readInt()); |
Samuel Antao | 661c090 | 2016-05-26 17:39:58 +0000 | [diff] [blame] | 2478 | C->setDeclNumLists(ListsPerDecl); |
| 2479 | |
| 2480 | SmallVector<unsigned, 32> ListSizes; |
| 2481 | ListSizes.reserve(TotalLists); |
| 2482 | for (unsigned i = 0; i < TotalLists; ++i) |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2483 | ListSizes.push_back(Reader->Record.readInt()); |
Samuel Antao | 661c090 | 2016-05-26 17:39:58 +0000 | [diff] [blame] | 2484 | C->setComponentListSizes(ListSizes); |
| 2485 | |
| 2486 | SmallVector<OMPClauseMappableExprCommon::MappableComponent, 32> Components; |
| 2487 | Components.reserve(TotalComponents); |
| 2488 | for (unsigned i = 0; i < TotalComponents; ++i) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2489 | Expr *AssociatedExpr = Reader->Record.readSubExpr(); |
| 2490 | ValueDecl *AssociatedDecl = Reader->Record.readDeclAs<ValueDecl>(); |
Samuel Antao | 661c090 | 2016-05-26 17:39:58 +0000 | [diff] [blame] | 2491 | Components.push_back(OMPClauseMappableExprCommon::MappableComponent( |
| 2492 | AssociatedExpr, AssociatedDecl)); |
| 2493 | } |
| 2494 | C->setComponents(Components, ListSizes); |
| 2495 | } |
| 2496 | |
Samuel Antao | ec172c6 | 2016-05-26 17:49:04 +0000 | [diff] [blame] | 2497 | void OMPClauseReader::VisitOMPFromClause(OMPFromClause *C) { |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2498 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Samuel Antao | ec172c6 | 2016-05-26 17:49:04 +0000 | [diff] [blame] | 2499 | auto NumVars = C->varlist_size(); |
| 2500 | auto UniqueDecls = C->getUniqueDeclarationsNum(); |
| 2501 | auto TotalLists = C->getTotalComponentListNum(); |
| 2502 | auto TotalComponents = C->getTotalComponentsNum(); |
| 2503 | |
| 2504 | SmallVector<Expr *, 16> Vars; |
| 2505 | Vars.reserve(NumVars); |
| 2506 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2507 | Vars.push_back(Reader->Record.readSubExpr()); |
Samuel Antao | ec172c6 | 2016-05-26 17:49:04 +0000 | [diff] [blame] | 2508 | C->setVarRefs(Vars); |
| 2509 | |
| 2510 | SmallVector<ValueDecl *, 16> Decls; |
| 2511 | Decls.reserve(UniqueDecls); |
| 2512 | for (unsigned i = 0; i < UniqueDecls; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2513 | Decls.push_back(Reader->Record.readDeclAs<ValueDecl>()); |
Samuel Antao | ec172c6 | 2016-05-26 17:49:04 +0000 | [diff] [blame] | 2514 | C->setUniqueDecls(Decls); |
| 2515 | |
| 2516 | SmallVector<unsigned, 16> ListsPerDecl; |
| 2517 | ListsPerDecl.reserve(UniqueDecls); |
| 2518 | for (unsigned i = 0; i < UniqueDecls; ++i) |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2519 | ListsPerDecl.push_back(Reader->Record.readInt()); |
Samuel Antao | ec172c6 | 2016-05-26 17:49:04 +0000 | [diff] [blame] | 2520 | C->setDeclNumLists(ListsPerDecl); |
| 2521 | |
| 2522 | SmallVector<unsigned, 32> ListSizes; |
| 2523 | ListSizes.reserve(TotalLists); |
| 2524 | for (unsigned i = 0; i < TotalLists; ++i) |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2525 | ListSizes.push_back(Reader->Record.readInt()); |
Samuel Antao | ec172c6 | 2016-05-26 17:49:04 +0000 | [diff] [blame] | 2526 | C->setComponentListSizes(ListSizes); |
| 2527 | |
| 2528 | SmallVector<OMPClauseMappableExprCommon::MappableComponent, 32> Components; |
| 2529 | Components.reserve(TotalComponents); |
| 2530 | for (unsigned i = 0; i < TotalComponents; ++i) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2531 | Expr *AssociatedExpr = Reader->Record.readSubExpr(); |
| 2532 | ValueDecl *AssociatedDecl = Reader->Record.readDeclAs<ValueDecl>(); |
Samuel Antao | ec172c6 | 2016-05-26 17:49:04 +0000 | [diff] [blame] | 2533 | Components.push_back(OMPClauseMappableExprCommon::MappableComponent( |
| 2534 | AssociatedExpr, AssociatedDecl)); |
| 2535 | } |
| 2536 | C->setComponents(Components, ListSizes); |
| 2537 | } |
| 2538 | |
Carlo Bertolli | 2404b17 | 2016-07-13 15:37:16 +0000 | [diff] [blame] | 2539 | void OMPClauseReader::VisitOMPUseDevicePtrClause(OMPUseDevicePtrClause *C) { |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2540 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Samuel Antao | cc10b85 | 2016-07-28 14:23:26 +0000 | [diff] [blame] | 2541 | auto NumVars = C->varlist_size(); |
| 2542 | auto UniqueDecls = C->getUniqueDeclarationsNum(); |
| 2543 | auto TotalLists = C->getTotalComponentListNum(); |
| 2544 | auto TotalComponents = C->getTotalComponentsNum(); |
| 2545 | |
Carlo Bertolli | 2404b17 | 2016-07-13 15:37:16 +0000 | [diff] [blame] | 2546 | SmallVector<Expr *, 16> Vars; |
| 2547 | Vars.reserve(NumVars); |
| 2548 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2549 | Vars.push_back(Reader->Record.readSubExpr()); |
Carlo Bertolli | 2404b17 | 2016-07-13 15:37:16 +0000 | [diff] [blame] | 2550 | C->setVarRefs(Vars); |
| 2551 | Vars.clear(); |
Samuel Antao | cc10b85 | 2016-07-28 14:23:26 +0000 | [diff] [blame] | 2552 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2553 | Vars.push_back(Reader->Record.readSubExpr()); |
Samuel Antao | cc10b85 | 2016-07-28 14:23:26 +0000 | [diff] [blame] | 2554 | C->setPrivateCopies(Vars); |
| 2555 | Vars.clear(); |
| 2556 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2557 | Vars.push_back(Reader->Record.readSubExpr()); |
Samuel Antao | cc10b85 | 2016-07-28 14:23:26 +0000 | [diff] [blame] | 2558 | C->setInits(Vars); |
| 2559 | |
| 2560 | SmallVector<ValueDecl *, 16> Decls; |
| 2561 | Decls.reserve(UniqueDecls); |
| 2562 | for (unsigned i = 0; i < UniqueDecls; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2563 | Decls.push_back(Reader->Record.readDeclAs<ValueDecl>()); |
Samuel Antao | cc10b85 | 2016-07-28 14:23:26 +0000 | [diff] [blame] | 2564 | C->setUniqueDecls(Decls); |
| 2565 | |
| 2566 | SmallVector<unsigned, 16> ListsPerDecl; |
| 2567 | ListsPerDecl.reserve(UniqueDecls); |
| 2568 | for (unsigned i = 0; i < UniqueDecls; ++i) |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2569 | ListsPerDecl.push_back(Reader->Record.readInt()); |
Samuel Antao | cc10b85 | 2016-07-28 14:23:26 +0000 | [diff] [blame] | 2570 | C->setDeclNumLists(ListsPerDecl); |
| 2571 | |
| 2572 | SmallVector<unsigned, 32> ListSizes; |
| 2573 | ListSizes.reserve(TotalLists); |
| 2574 | for (unsigned i = 0; i < TotalLists; ++i) |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2575 | ListSizes.push_back(Reader->Record.readInt()); |
Samuel Antao | cc10b85 | 2016-07-28 14:23:26 +0000 | [diff] [blame] | 2576 | C->setComponentListSizes(ListSizes); |
| 2577 | |
| 2578 | SmallVector<OMPClauseMappableExprCommon::MappableComponent, 32> Components; |
| 2579 | Components.reserve(TotalComponents); |
| 2580 | for (unsigned i = 0; i < TotalComponents; ++i) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2581 | Expr *AssociatedExpr = Reader->Record.readSubExpr(); |
| 2582 | ValueDecl *AssociatedDecl = Reader->Record.readDeclAs<ValueDecl>(); |
Samuel Antao | cc10b85 | 2016-07-28 14:23:26 +0000 | [diff] [blame] | 2583 | Components.push_back(OMPClauseMappableExprCommon::MappableComponent( |
| 2584 | AssociatedExpr, AssociatedDecl)); |
| 2585 | } |
| 2586 | C->setComponents(Components, ListSizes); |
Carlo Bertolli | 2404b17 | 2016-07-13 15:37:16 +0000 | [diff] [blame] | 2587 | } |
| 2588 | |
Carlo Bertolli | 70594e9 | 2016-07-13 17:16:49 +0000 | [diff] [blame] | 2589 | void OMPClauseReader::VisitOMPIsDevicePtrClause(OMPIsDevicePtrClause *C) { |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2590 | C->setLParenLoc(Reader->ReadSourceLocation()); |
Samuel Antao | 6890b09 | 2016-07-28 14:25:09 +0000 | [diff] [blame] | 2591 | auto NumVars = C->varlist_size(); |
| 2592 | auto UniqueDecls = C->getUniqueDeclarationsNum(); |
| 2593 | auto TotalLists = C->getTotalComponentListNum(); |
| 2594 | auto TotalComponents = C->getTotalComponentsNum(); |
| 2595 | |
Carlo Bertolli | 70594e9 | 2016-07-13 17:16:49 +0000 | [diff] [blame] | 2596 | SmallVector<Expr *, 16> Vars; |
| 2597 | Vars.reserve(NumVars); |
| 2598 | for (unsigned i = 0; i != NumVars; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2599 | Vars.push_back(Reader->Record.readSubExpr()); |
Carlo Bertolli | 70594e9 | 2016-07-13 17:16:49 +0000 | [diff] [blame] | 2600 | C->setVarRefs(Vars); |
| 2601 | Vars.clear(); |
Samuel Antao | 6890b09 | 2016-07-28 14:25:09 +0000 | [diff] [blame] | 2602 | |
| 2603 | SmallVector<ValueDecl *, 16> Decls; |
| 2604 | Decls.reserve(UniqueDecls); |
| 2605 | for (unsigned i = 0; i < UniqueDecls; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2606 | Decls.push_back(Reader->Record.readDeclAs<ValueDecl>()); |
Samuel Antao | 6890b09 | 2016-07-28 14:25:09 +0000 | [diff] [blame] | 2607 | C->setUniqueDecls(Decls); |
| 2608 | |
| 2609 | SmallVector<unsigned, 16> ListsPerDecl; |
| 2610 | ListsPerDecl.reserve(UniqueDecls); |
| 2611 | for (unsigned i = 0; i < UniqueDecls; ++i) |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2612 | ListsPerDecl.push_back(Reader->Record.readInt()); |
Samuel Antao | 6890b09 | 2016-07-28 14:25:09 +0000 | [diff] [blame] | 2613 | C->setDeclNumLists(ListsPerDecl); |
| 2614 | |
| 2615 | SmallVector<unsigned, 32> ListSizes; |
| 2616 | ListSizes.reserve(TotalLists); |
| 2617 | for (unsigned i = 0; i < TotalLists; ++i) |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2618 | ListSizes.push_back(Reader->Record.readInt()); |
Samuel Antao | 6890b09 | 2016-07-28 14:25:09 +0000 | [diff] [blame] | 2619 | C->setComponentListSizes(ListSizes); |
| 2620 | |
| 2621 | SmallVector<OMPClauseMappableExprCommon::MappableComponent, 32> Components; |
| 2622 | Components.reserve(TotalComponents); |
| 2623 | for (unsigned i = 0; i < TotalComponents; ++i) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2624 | Expr *AssociatedExpr = Reader->Record.readSubExpr(); |
| 2625 | ValueDecl *AssociatedDecl = Reader->Record.readDeclAs<ValueDecl>(); |
Samuel Antao | 6890b09 | 2016-07-28 14:25:09 +0000 | [diff] [blame] | 2626 | Components.push_back(OMPClauseMappableExprCommon::MappableComponent( |
| 2627 | AssociatedExpr, AssociatedDecl)); |
| 2628 | } |
| 2629 | C->setComponents(Components, ListSizes); |
Carlo Bertolli | 70594e9 | 2016-07-13 17:16:49 +0000 | [diff] [blame] | 2630 | } |
| 2631 | |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 2632 | //===----------------------------------------------------------------------===// |
| 2633 | // OpenMP Directives. |
| 2634 | //===----------------------------------------------------------------------===// |
| 2635 | void ASTStmtReader::VisitOMPExecutableDirective(OMPExecutableDirective *E) { |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2636 | E->setLocStart(ReadSourceLocation()); |
| 2637 | E->setLocEnd(ReadSourceLocation()); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2638 | OMPClauseReader ClauseReader(this, Record); |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 2639 | SmallVector<OMPClause *, 5> Clauses; |
| 2640 | for (unsigned i = 0; i < E->getNumClauses(); ++i) |
| 2641 | Clauses.push_back(ClauseReader.readClause()); |
| 2642 | E->setClauses(Clauses); |
Alexey Bataev | 68446b7 | 2014-07-18 07:47:19 +0000 | [diff] [blame] | 2643 | if (E->hasAssociatedStmt()) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2644 | E->setAssociatedStmt(Record.readSubStmt()); |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 2645 | } |
| 2646 | |
Alexander Musman | 3aaab66 | 2014-08-19 11:27:13 +0000 | [diff] [blame] | 2647 | void ASTStmtReader::VisitOMPLoopDirective(OMPLoopDirective *D) { |
| 2648 | VisitStmt(D); |
| 2649 | // Two fields (NumClauses and CollapsedNum) were read in ReadStmtFromStream. |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2650 | Record.skipInts(2); |
Alexander Musman | 3aaab66 | 2014-08-19 11:27:13 +0000 | [diff] [blame] | 2651 | VisitOMPExecutableDirective(D); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2652 | D->setIterationVariable(Record.readSubExpr()); |
| 2653 | D->setLastIteration(Record.readSubExpr()); |
| 2654 | D->setCalcLastIteration(Record.readSubExpr()); |
| 2655 | D->setPreCond(Record.readSubExpr()); |
| 2656 | D->setCond(Record.readSubExpr()); |
| 2657 | D->setInit(Record.readSubExpr()); |
| 2658 | D->setInc(Record.readSubExpr()); |
| 2659 | D->setPreInits(Record.readSubStmt()); |
Alexey Bataev | 3392d76 | 2016-02-16 11:18:12 +0000 | [diff] [blame] | 2660 | if (isOpenMPWorksharingDirective(D->getDirectiveKind()) || |
Carlo Bertolli | fc35ad2 | 2016-03-07 16:04:49 +0000 | [diff] [blame] | 2661 | isOpenMPTaskLoopDirective(D->getDirectiveKind()) || |
| 2662 | isOpenMPDistributeDirective(D->getDirectiveKind())) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2663 | D->setIsLastIterVariable(Record.readSubExpr()); |
| 2664 | D->setLowerBoundVariable(Record.readSubExpr()); |
| 2665 | D->setUpperBoundVariable(Record.readSubExpr()); |
| 2666 | D->setStrideVariable(Record.readSubExpr()); |
| 2667 | D->setEnsureUpperBound(Record.readSubExpr()); |
| 2668 | D->setNextLowerBound(Record.readSubExpr()); |
| 2669 | D->setNextUpperBound(Record.readSubExpr()); |
| 2670 | D->setNumIterations(Record.readSubExpr()); |
Alexander Musman | c638868 | 2014-12-15 07:07:06 +0000 | [diff] [blame] | 2671 | } |
Carlo Bertolli | 9925f15 | 2016-06-27 14:55:37 +0000 | [diff] [blame] | 2672 | if (isOpenMPLoopBoundSharingDirective(D->getDirectiveKind())) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2673 | D->setPrevLowerBoundVariable(Record.readSubExpr()); |
| 2674 | D->setPrevUpperBoundVariable(Record.readSubExpr()); |
Carlo Bertolli | 8429d81 | 2017-02-17 21:29:13 +0000 | [diff] [blame] | 2675 | D->setDistInc(Record.readSubExpr()); |
| 2676 | D->setPrevEnsureUpperBound(Record.readSubExpr()); |
Carlo Bertolli | ffafe10 | 2017-04-20 00:39:39 +0000 | [diff] [blame] | 2677 | D->setCombinedLowerBoundVariable(Record.readSubExpr()); |
| 2678 | D->setCombinedUpperBoundVariable(Record.readSubExpr()); |
| 2679 | D->setCombinedEnsureUpperBound(Record.readSubExpr()); |
| 2680 | D->setCombinedInit(Record.readSubExpr()); |
| 2681 | D->setCombinedCond(Record.readSubExpr()); |
| 2682 | D->setCombinedNextLowerBound(Record.readSubExpr()); |
| 2683 | D->setCombinedNextUpperBound(Record.readSubExpr()); |
Carlo Bertolli | 9925f15 | 2016-06-27 14:55:37 +0000 | [diff] [blame] | 2684 | } |
Alexander Musman | a5f070a | 2014-10-01 06:03:56 +0000 | [diff] [blame] | 2685 | SmallVector<Expr *, 4> Sub; |
| 2686 | unsigned CollapsedNum = D->getCollapsedNumber(); |
| 2687 | Sub.reserve(CollapsedNum); |
| 2688 | for (unsigned i = 0; i < CollapsedNum; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2689 | Sub.push_back(Record.readSubExpr()); |
Alexander Musman | a5f070a | 2014-10-01 06:03:56 +0000 | [diff] [blame] | 2690 | D->setCounters(Sub); |
| 2691 | Sub.clear(); |
| 2692 | for (unsigned i = 0; i < CollapsedNum; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2693 | Sub.push_back(Record.readSubExpr()); |
Alexey Bataev | a889917 | 2015-08-06 12:30:57 +0000 | [diff] [blame] | 2694 | D->setPrivateCounters(Sub); |
| 2695 | Sub.clear(); |
| 2696 | for (unsigned i = 0; i < CollapsedNum; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2697 | Sub.push_back(Record.readSubExpr()); |
Alexey Bataev | b08f89f | 2015-08-14 12:25:37 +0000 | [diff] [blame] | 2698 | D->setInits(Sub); |
| 2699 | Sub.clear(); |
| 2700 | for (unsigned i = 0; i < CollapsedNum; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2701 | Sub.push_back(Record.readSubExpr()); |
Alexander Musman | a5f070a | 2014-10-01 06:03:56 +0000 | [diff] [blame] | 2702 | D->setUpdates(Sub); |
| 2703 | Sub.clear(); |
| 2704 | for (unsigned i = 0; i < CollapsedNum; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2705 | Sub.push_back(Record.readSubExpr()); |
Alexander Musman | a5f070a | 2014-10-01 06:03:56 +0000 | [diff] [blame] | 2706 | D->setFinals(Sub); |
Alexander Musman | 3aaab66 | 2014-08-19 11:27:13 +0000 | [diff] [blame] | 2707 | } |
| 2708 | |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 2709 | void ASTStmtReader::VisitOMPParallelDirective(OMPParallelDirective *D) { |
Alexey Bataev | 1b59ab5 | 2014-02-27 08:29:12 +0000 | [diff] [blame] | 2710 | VisitStmt(D); |
| 2711 | // The NumClauses field was read in ReadStmtFromStream. |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2712 | Record.skipInts(1); |
Alexey Bataev | 1b59ab5 | 2014-02-27 08:29:12 +0000 | [diff] [blame] | 2713 | VisitOMPExecutableDirective(D); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2714 | D->setHasCancel(Record.readInt()); |
Alexey Bataev | 1b59ab5 | 2014-02-27 08:29:12 +0000 | [diff] [blame] | 2715 | } |
| 2716 | |
| 2717 | void ASTStmtReader::VisitOMPSimdDirective(OMPSimdDirective *D) { |
Alexander Musman | 3aaab66 | 2014-08-19 11:27:13 +0000 | [diff] [blame] | 2718 | VisitOMPLoopDirective(D); |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 2719 | } |
| 2720 | |
Alexey Bataev | f29276e | 2014-06-18 04:14:57 +0000 | [diff] [blame] | 2721 | void ASTStmtReader::VisitOMPForDirective(OMPForDirective *D) { |
Alexander Musman | 3aaab66 | 2014-08-19 11:27:13 +0000 | [diff] [blame] | 2722 | VisitOMPLoopDirective(D); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2723 | D->setHasCancel(Record.readInt()); |
Alexey Bataev | f29276e | 2014-06-18 04:14:57 +0000 | [diff] [blame] | 2724 | } |
| 2725 | |
Alexander Musman | f82886e | 2014-09-18 05:12:34 +0000 | [diff] [blame] | 2726 | void ASTStmtReader::VisitOMPForSimdDirective(OMPForSimdDirective *D) { |
| 2727 | VisitOMPLoopDirective(D); |
| 2728 | } |
| 2729 | |
Alexey Bataev | d3f8dd2 | 2014-06-25 11:44:49 +0000 | [diff] [blame] | 2730 | void ASTStmtReader::VisitOMPSectionsDirective(OMPSectionsDirective *D) { |
| 2731 | VisitStmt(D); |
| 2732 | // The NumClauses field was read in ReadStmtFromStream. |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2733 | Record.skipInts(1); |
Alexey Bataev | d3f8dd2 | 2014-06-25 11:44:49 +0000 | [diff] [blame] | 2734 | VisitOMPExecutableDirective(D); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2735 | D->setHasCancel(Record.readInt()); |
Alexey Bataev | d3f8dd2 | 2014-06-25 11:44:49 +0000 | [diff] [blame] | 2736 | } |
| 2737 | |
Alexey Bataev | 1e0498a | 2014-06-26 08:21:58 +0000 | [diff] [blame] | 2738 | void ASTStmtReader::VisitOMPSectionDirective(OMPSectionDirective *D) { |
| 2739 | VisitStmt(D); |
| 2740 | VisitOMPExecutableDirective(D); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2741 | D->setHasCancel(Record.readInt()); |
Alexey Bataev | 1e0498a | 2014-06-26 08:21:58 +0000 | [diff] [blame] | 2742 | } |
| 2743 | |
Alexey Bataev | d1e40fb | 2014-06-26 12:05:45 +0000 | [diff] [blame] | 2744 | void ASTStmtReader::VisitOMPSingleDirective(OMPSingleDirective *D) { |
| 2745 | VisitStmt(D); |
| 2746 | // The NumClauses field was read in ReadStmtFromStream. |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2747 | Record.skipInts(1); |
Alexey Bataev | d1e40fb | 2014-06-26 12:05:45 +0000 | [diff] [blame] | 2748 | VisitOMPExecutableDirective(D); |
| 2749 | } |
| 2750 | |
Alexander Musman | 80c2289 | 2014-07-17 08:54:58 +0000 | [diff] [blame] | 2751 | void ASTStmtReader::VisitOMPMasterDirective(OMPMasterDirective *D) { |
| 2752 | VisitStmt(D); |
| 2753 | VisitOMPExecutableDirective(D); |
| 2754 | } |
| 2755 | |
Alexander Musman | d9ed09f | 2014-07-21 09:42:05 +0000 | [diff] [blame] | 2756 | void ASTStmtReader::VisitOMPCriticalDirective(OMPCriticalDirective *D) { |
| 2757 | VisitStmt(D); |
Alexey Bataev | 28c7541 | 2015-12-15 08:19:24 +0000 | [diff] [blame] | 2758 | // The NumClauses field was read in ReadStmtFromStream. |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2759 | Record.skipInts(1); |
Alexander Musman | d9ed09f | 2014-07-21 09:42:05 +0000 | [diff] [blame] | 2760 | VisitOMPExecutableDirective(D); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 2761 | ReadDeclarationNameInfo(D->DirName); |
Alexander Musman | d9ed09f | 2014-07-21 09:42:05 +0000 | [diff] [blame] | 2762 | } |
| 2763 | |
Alexey Bataev | 4acb859 | 2014-07-07 13:01:15 +0000 | [diff] [blame] | 2764 | void ASTStmtReader::VisitOMPParallelForDirective(OMPParallelForDirective *D) { |
Alexander Musman | 3aaab66 | 2014-08-19 11:27:13 +0000 | [diff] [blame] | 2765 | VisitOMPLoopDirective(D); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2766 | D->setHasCancel(Record.readInt()); |
Alexey Bataev | 4acb859 | 2014-07-07 13:01:15 +0000 | [diff] [blame] | 2767 | } |
| 2768 | |
Alexander Musman | e4e893b | 2014-09-23 09:33:00 +0000 | [diff] [blame] | 2769 | void ASTStmtReader::VisitOMPParallelForSimdDirective( |
| 2770 | OMPParallelForSimdDirective *D) { |
| 2771 | VisitOMPLoopDirective(D); |
| 2772 | } |
| 2773 | |
Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 2774 | void ASTStmtReader::VisitOMPParallelSectionsDirective( |
| 2775 | OMPParallelSectionsDirective *D) { |
| 2776 | VisitStmt(D); |
| 2777 | // The NumClauses field was read in ReadStmtFromStream. |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2778 | Record.skipInts(1); |
Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 2779 | VisitOMPExecutableDirective(D); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2780 | D->setHasCancel(Record.readInt()); |
Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 2781 | } |
| 2782 | |
Alexey Bataev | 9c2e8ee | 2014-07-11 11:25:16 +0000 | [diff] [blame] | 2783 | void ASTStmtReader::VisitOMPTaskDirective(OMPTaskDirective *D) { |
| 2784 | VisitStmt(D); |
| 2785 | // The NumClauses field was read in ReadStmtFromStream. |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2786 | Record.skipInts(1); |
Alexey Bataev | 9c2e8ee | 2014-07-11 11:25:16 +0000 | [diff] [blame] | 2787 | VisitOMPExecutableDirective(D); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2788 | D->setHasCancel(Record.readInt()); |
Alexey Bataev | 9c2e8ee | 2014-07-11 11:25:16 +0000 | [diff] [blame] | 2789 | } |
| 2790 | |
Alexey Bataev | 68446b7 | 2014-07-18 07:47:19 +0000 | [diff] [blame] | 2791 | void ASTStmtReader::VisitOMPTaskyieldDirective(OMPTaskyieldDirective *D) { |
| 2792 | VisitStmt(D); |
| 2793 | VisitOMPExecutableDirective(D); |
| 2794 | } |
| 2795 | |
Alexey Bataev | 4d1dfea | 2014-07-18 09:11:51 +0000 | [diff] [blame] | 2796 | void ASTStmtReader::VisitOMPBarrierDirective(OMPBarrierDirective *D) { |
| 2797 | VisitStmt(D); |
| 2798 | VisitOMPExecutableDirective(D); |
| 2799 | } |
| 2800 | |
Alexey Bataev | 2df347a | 2014-07-18 10:17:07 +0000 | [diff] [blame] | 2801 | void ASTStmtReader::VisitOMPTaskwaitDirective(OMPTaskwaitDirective *D) { |
| 2802 | VisitStmt(D); |
| 2803 | VisitOMPExecutableDirective(D); |
| 2804 | } |
| 2805 | |
Alexey Bataev | c30dd2d | 2015-06-18 12:14:09 +0000 | [diff] [blame] | 2806 | void ASTStmtReader::VisitOMPTaskgroupDirective(OMPTaskgroupDirective *D) { |
| 2807 | VisitStmt(D); |
Alexey Bataev | 169d96a | 2017-07-18 20:17:46 +0000 | [diff] [blame] | 2808 | // The NumClauses field was read in ReadStmtFromStream. |
| 2809 | Record.skipInts(1); |
Alexey Bataev | c30dd2d | 2015-06-18 12:14:09 +0000 | [diff] [blame] | 2810 | VisitOMPExecutableDirective(D); |
Alexey Bataev | 3b1b895 | 2017-07-25 15:53:26 +0000 | [diff] [blame] | 2811 | D->setReductionRef(Record.readSubExpr()); |
Alexey Bataev | c30dd2d | 2015-06-18 12:14:09 +0000 | [diff] [blame] | 2812 | } |
| 2813 | |
Alexey Bataev | 6125da9 | 2014-07-21 11:26:11 +0000 | [diff] [blame] | 2814 | void ASTStmtReader::VisitOMPFlushDirective(OMPFlushDirective *D) { |
| 2815 | VisitStmt(D); |
| 2816 | // The NumClauses field was read in ReadStmtFromStream. |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2817 | Record.skipInts(1); |
Alexey Bataev | 6125da9 | 2014-07-21 11:26:11 +0000 | [diff] [blame] | 2818 | VisitOMPExecutableDirective(D); |
| 2819 | } |
| 2820 | |
Alexey Bataev | 9fb6e64 | 2014-07-22 06:45:04 +0000 | [diff] [blame] | 2821 | void ASTStmtReader::VisitOMPOrderedDirective(OMPOrderedDirective *D) { |
| 2822 | VisitStmt(D); |
Alexey Bataev | 346265e | 2015-09-25 10:37:12 +0000 | [diff] [blame] | 2823 | // The NumClauses field was read in ReadStmtFromStream. |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2824 | Record.skipInts(1); |
Alexey Bataev | 9fb6e64 | 2014-07-22 06:45:04 +0000 | [diff] [blame] | 2825 | VisitOMPExecutableDirective(D); |
| 2826 | } |
| 2827 | |
Alexey Bataev | 0162e45 | 2014-07-22 10:10:35 +0000 | [diff] [blame] | 2828 | void ASTStmtReader::VisitOMPAtomicDirective(OMPAtomicDirective *D) { |
| 2829 | VisitStmt(D); |
| 2830 | // The NumClauses field was read in ReadStmtFromStream. |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2831 | Record.skipInts(1); |
Alexey Bataev | 0162e45 | 2014-07-22 10:10:35 +0000 | [diff] [blame] | 2832 | VisitOMPExecutableDirective(D); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 2833 | D->setX(Record.readSubExpr()); |
| 2834 | D->setV(Record.readSubExpr()); |
| 2835 | D->setExpr(Record.readSubExpr()); |
| 2836 | D->setUpdateExpr(Record.readSubExpr()); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2837 | D->IsXLHSInRHSPart = Record.readInt() != 0; |
| 2838 | D->IsPostfixUpdate = Record.readInt() != 0; |
Alexey Bataev | 0162e45 | 2014-07-22 10:10:35 +0000 | [diff] [blame] | 2839 | } |
| 2840 | |
Alexey Bataev | 0bd520b | 2014-09-19 08:19:49 +0000 | [diff] [blame] | 2841 | void ASTStmtReader::VisitOMPTargetDirective(OMPTargetDirective *D) { |
| 2842 | VisitStmt(D); |
| 2843 | // The NumClauses field was read in ReadStmtFromStream. |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2844 | Record.skipInts(1); |
Alexey Bataev | 0bd520b | 2014-09-19 08:19:49 +0000 | [diff] [blame] | 2845 | VisitOMPExecutableDirective(D); |
| 2846 | } |
| 2847 | |
Michael Wong | 65f367f | 2015-07-21 13:44:28 +0000 | [diff] [blame] | 2848 | void ASTStmtReader::VisitOMPTargetDataDirective(OMPTargetDataDirective *D) { |
| 2849 | VisitStmt(D); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2850 | Record.skipInts(1); |
Michael Wong | 65f367f | 2015-07-21 13:44:28 +0000 | [diff] [blame] | 2851 | VisitOMPExecutableDirective(D); |
| 2852 | } |
| 2853 | |
Samuel Antao | df67fc4 | 2016-01-19 19:15:56 +0000 | [diff] [blame] | 2854 | void ASTStmtReader::VisitOMPTargetEnterDataDirective( |
| 2855 | OMPTargetEnterDataDirective *D) { |
| 2856 | VisitStmt(D); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2857 | Record.skipInts(1); |
Samuel Antao | df67fc4 | 2016-01-19 19:15:56 +0000 | [diff] [blame] | 2858 | VisitOMPExecutableDirective(D); |
| 2859 | } |
| 2860 | |
Samuel Antao | 7259076 | 2016-01-19 20:04:50 +0000 | [diff] [blame] | 2861 | void ASTStmtReader::VisitOMPTargetExitDataDirective( |
| 2862 | OMPTargetExitDataDirective *D) { |
| 2863 | VisitStmt(D); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2864 | Record.skipInts(1); |
Samuel Antao | 7259076 | 2016-01-19 20:04:50 +0000 | [diff] [blame] | 2865 | VisitOMPExecutableDirective(D); |
| 2866 | } |
| 2867 | |
Arpith Chacko Jacob | e955b3d | 2016-01-26 18:48:41 +0000 | [diff] [blame] | 2868 | void ASTStmtReader::VisitOMPTargetParallelDirective( |
| 2869 | OMPTargetParallelDirective *D) { |
| 2870 | VisitStmt(D); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2871 | Record.skipInts(1); |
Arpith Chacko Jacob | e955b3d | 2016-01-26 18:48:41 +0000 | [diff] [blame] | 2872 | VisitOMPExecutableDirective(D); |
| 2873 | } |
| 2874 | |
Arpith Chacko Jacob | 05bebb5 | 2016-02-03 15:46:42 +0000 | [diff] [blame] | 2875 | void ASTStmtReader::VisitOMPTargetParallelForDirective( |
| 2876 | OMPTargetParallelForDirective *D) { |
| 2877 | VisitOMPLoopDirective(D); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2878 | D->setHasCancel(Record.readInt()); |
Arpith Chacko Jacob | 05bebb5 | 2016-02-03 15:46:42 +0000 | [diff] [blame] | 2879 | } |
| 2880 | |
Alexey Bataev | 13314bf | 2014-10-09 04:18:56 +0000 | [diff] [blame] | 2881 | void ASTStmtReader::VisitOMPTeamsDirective(OMPTeamsDirective *D) { |
| 2882 | VisitStmt(D); |
| 2883 | // The NumClauses field was read in ReadStmtFromStream. |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2884 | Record.skipInts(1); |
Alexey Bataev | 13314bf | 2014-10-09 04:18:56 +0000 | [diff] [blame] | 2885 | VisitOMPExecutableDirective(D); |
| 2886 | } |
| 2887 | |
Alexey Bataev | 6d4ed05 | 2015-07-01 06:57:41 +0000 | [diff] [blame] | 2888 | void ASTStmtReader::VisitOMPCancellationPointDirective( |
| 2889 | OMPCancellationPointDirective *D) { |
| 2890 | VisitStmt(D); |
| 2891 | VisitOMPExecutableDirective(D); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2892 | D->setCancelRegion(static_cast<OpenMPDirectiveKind>(Record.readInt())); |
Alexey Bataev | 6d4ed05 | 2015-07-01 06:57:41 +0000 | [diff] [blame] | 2893 | } |
| 2894 | |
Alexey Bataev | 8090987 | 2015-07-02 11:25:17 +0000 | [diff] [blame] | 2895 | void ASTStmtReader::VisitOMPCancelDirective(OMPCancelDirective *D) { |
| 2896 | VisitStmt(D); |
Alexey Bataev | 87933c7 | 2015-09-18 08:07:34 +0000 | [diff] [blame] | 2897 | // The NumClauses field was read in ReadStmtFromStream. |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2898 | Record.skipInts(1); |
Alexey Bataev | 8090987 | 2015-07-02 11:25:17 +0000 | [diff] [blame] | 2899 | VisitOMPExecutableDirective(D); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2900 | D->setCancelRegion(static_cast<OpenMPDirectiveKind>(Record.readInt())); |
Alexey Bataev | 8090987 | 2015-07-02 11:25:17 +0000 | [diff] [blame] | 2901 | } |
| 2902 | |
Alexey Bataev | 49f6e78 | 2015-12-01 04:18:41 +0000 | [diff] [blame] | 2903 | void ASTStmtReader::VisitOMPTaskLoopDirective(OMPTaskLoopDirective *D) { |
| 2904 | VisitOMPLoopDirective(D); |
| 2905 | } |
| 2906 | |
Alexey Bataev | 0a6ed84 | 2015-12-03 09:40:15 +0000 | [diff] [blame] | 2907 | void ASTStmtReader::VisitOMPTaskLoopSimdDirective(OMPTaskLoopSimdDirective *D) { |
| 2908 | VisitOMPLoopDirective(D); |
| 2909 | } |
| 2910 | |
Carlo Bertolli | 6200a3d | 2015-12-14 14:51:25 +0000 | [diff] [blame] | 2911 | void ASTStmtReader::VisitOMPDistributeDirective(OMPDistributeDirective *D) { |
| 2912 | VisitOMPLoopDirective(D); |
| 2913 | } |
| 2914 | |
Samuel Antao | 686c70c | 2016-05-26 17:30:50 +0000 | [diff] [blame] | 2915 | void ASTStmtReader::VisitOMPTargetUpdateDirective(OMPTargetUpdateDirective *D) { |
| 2916 | VisitStmt(D); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2917 | Record.skipInts(1); |
Samuel Antao | 686c70c | 2016-05-26 17:30:50 +0000 | [diff] [blame] | 2918 | VisitOMPExecutableDirective(D); |
| 2919 | } |
Carlo Bertolli | 9925f15 | 2016-06-27 14:55:37 +0000 | [diff] [blame] | 2920 | void ASTStmtReader::VisitOMPDistributeParallelForDirective( |
| 2921 | OMPDistributeParallelForDirective *D) { |
| 2922 | VisitOMPLoopDirective(D); |
Alexey Bataev | dcb4b8fb | 2017-11-22 20:19:50 +0000 | [diff] [blame^] | 2923 | D->setHasCancel(Record.readInt()); |
Carlo Bertolli | 9925f15 | 2016-06-27 14:55:37 +0000 | [diff] [blame] | 2924 | } |
Samuel Antao | 686c70c | 2016-05-26 17:30:50 +0000 | [diff] [blame] | 2925 | |
Kelvin Li | 4a39add | 2016-07-05 05:00:15 +0000 | [diff] [blame] | 2926 | void ASTStmtReader::VisitOMPDistributeParallelForSimdDirective( |
| 2927 | OMPDistributeParallelForSimdDirective *D) { |
| 2928 | VisitOMPLoopDirective(D); |
| 2929 | } |
| 2930 | |
Kelvin Li | 787f3fc | 2016-07-06 04:45:38 +0000 | [diff] [blame] | 2931 | void ASTStmtReader::VisitOMPDistributeSimdDirective( |
| 2932 | OMPDistributeSimdDirective *D) { |
| 2933 | VisitOMPLoopDirective(D); |
| 2934 | } |
| 2935 | |
Kelvin Li | a579b91 | 2016-07-14 02:54:56 +0000 | [diff] [blame] | 2936 | void ASTStmtReader::VisitOMPTargetParallelForSimdDirective( |
| 2937 | OMPTargetParallelForSimdDirective *D) { |
| 2938 | VisitOMPLoopDirective(D); |
| 2939 | } |
| 2940 | |
Kelvin Li | 986330c | 2016-07-20 22:57:10 +0000 | [diff] [blame] | 2941 | void ASTStmtReader::VisitOMPTargetSimdDirective(OMPTargetSimdDirective *D) { |
| 2942 | VisitOMPLoopDirective(D); |
| 2943 | } |
| 2944 | |
Kelvin Li | 0253287 | 2016-08-05 14:37:37 +0000 | [diff] [blame] | 2945 | void ASTStmtReader::VisitOMPTeamsDistributeDirective( |
| 2946 | OMPTeamsDistributeDirective *D) { |
| 2947 | VisitOMPLoopDirective(D); |
| 2948 | } |
| 2949 | |
Kelvin Li | 4e325f7 | 2016-10-25 12:50:55 +0000 | [diff] [blame] | 2950 | void ASTStmtReader::VisitOMPTeamsDistributeSimdDirective( |
| 2951 | OMPTeamsDistributeSimdDirective *D) { |
| 2952 | VisitOMPLoopDirective(D); |
| 2953 | } |
| 2954 | |
Kelvin Li | 579e41c | 2016-11-30 23:51:03 +0000 | [diff] [blame] | 2955 | void ASTStmtReader::VisitOMPTeamsDistributeParallelForSimdDirective( |
| 2956 | OMPTeamsDistributeParallelForSimdDirective *D) { |
| 2957 | VisitOMPLoopDirective(D); |
| 2958 | } |
| 2959 | |
Kelvin Li | 7ade93f | 2016-12-09 03:24:30 +0000 | [diff] [blame] | 2960 | void ASTStmtReader::VisitOMPTeamsDistributeParallelForDirective( |
| 2961 | OMPTeamsDistributeParallelForDirective *D) { |
| 2962 | VisitOMPLoopDirective(D); |
Alexey Bataev | dcb4b8fb | 2017-11-22 20:19:50 +0000 | [diff] [blame^] | 2963 | D->setHasCancel(Record.readInt()); |
Kelvin Li | 7ade93f | 2016-12-09 03:24:30 +0000 | [diff] [blame] | 2964 | } |
| 2965 | |
Kelvin Li | bf594a5 | 2016-12-17 05:48:59 +0000 | [diff] [blame] | 2966 | void ASTStmtReader::VisitOMPTargetTeamsDirective(OMPTargetTeamsDirective *D) { |
| 2967 | VisitStmt(D); |
| 2968 | // The NumClauses field was read in ReadStmtFromStream. |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 2969 | Record.skipInts(1); |
Kelvin Li | bf594a5 | 2016-12-17 05:48:59 +0000 | [diff] [blame] | 2970 | VisitOMPExecutableDirective(D); |
| 2971 | } |
| 2972 | |
Kelvin Li | 83c451e | 2016-12-25 04:52:54 +0000 | [diff] [blame] | 2973 | void ASTStmtReader::VisitOMPTargetTeamsDistributeDirective( |
| 2974 | OMPTargetTeamsDistributeDirective *D) { |
| 2975 | VisitOMPLoopDirective(D); |
| 2976 | } |
| 2977 | |
Kelvin Li | 80e8f56 | 2016-12-29 22:16:30 +0000 | [diff] [blame] | 2978 | void ASTStmtReader::VisitOMPTargetTeamsDistributeParallelForDirective( |
| 2979 | OMPTargetTeamsDistributeParallelForDirective *D) { |
| 2980 | VisitOMPLoopDirective(D); |
| 2981 | } |
| 2982 | |
Kelvin Li | 1851df5 | 2017-01-03 05:23:48 +0000 | [diff] [blame] | 2983 | void ASTStmtReader::VisitOMPTargetTeamsDistributeParallelForSimdDirective( |
| 2984 | OMPTargetTeamsDistributeParallelForSimdDirective *D) { |
| 2985 | VisitOMPLoopDirective(D); |
| 2986 | } |
| 2987 | |
Kelvin Li | da68118 | 2017-01-10 18:08:18 +0000 | [diff] [blame] | 2988 | void ASTStmtReader::VisitOMPTargetTeamsDistributeSimdDirective( |
| 2989 | OMPTargetTeamsDistributeSimdDirective *D) { |
| 2990 | VisitOMPLoopDirective(D); |
| 2991 | } |
| 2992 | |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 2993 | //===----------------------------------------------------------------------===// |
John McCall | fa19404 | 2011-07-15 07:00:14 +0000 | [diff] [blame] | 2994 | // ASTReader Implementation |
| 2995 | //===----------------------------------------------------------------------===// |
| 2996 | |
Douglas Gregor | de3ef50 | 2011-11-30 23:21:26 +0000 | [diff] [blame] | 2997 | Stmt *ASTReader::ReadStmt(ModuleFile &F) { |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 2998 | switch (ReadingKind) { |
Richard Smith | 629ff36 | 2013-07-31 00:26:46 +0000 | [diff] [blame] | 2999 | case Read_None: |
| 3000 | llvm_unreachable("should not call this when not reading anything"); |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 3001 | case Read_Decl: |
| 3002 | case Read_Type: |
Sebastian Redl | 2c373b9 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 3003 | return ReadStmtFromStream(F); |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 3004 | case Read_Stmt: |
Argyrios Kyrtzidis | 26d7201 | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 3005 | return ReadSubStmt(); |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 3006 | } |
| 3007 | |
| 3008 | llvm_unreachable("ReadingKind not set ?"); |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 3009 | } |
| 3010 | |
Douglas Gregor | de3ef50 | 2011-11-30 23:21:26 +0000 | [diff] [blame] | 3011 | Expr *ASTReader::ReadExpr(ModuleFile &F) { |
Sebastian Redl | 2c373b9 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 3012 | return cast_or_null<Expr>(ReadStmt(F)); |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 3013 | } |
Chris Lattner | e2437f4 | 2010-05-09 06:40:08 +0000 | [diff] [blame] | 3014 | |
Sebastian Redl | 2c499f6 | 2010-08-18 23:56:43 +0000 | [diff] [blame] | 3015 | Expr *ASTReader::ReadSubExpr() { |
Argyrios Kyrtzidis | 26d7201 | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 3016 | return cast_or_null<Expr>(ReadSubStmt()); |
| 3017 | } |
| 3018 | |
Chris Lattner | f426253 | 2009-04-27 05:41:06 +0000 | [diff] [blame] | 3019 | // Within the bitstream, expressions are stored in Reverse Polish |
| 3020 | // Notation, with each of the subexpressions preceding the |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 3021 | // expression they are stored in. Subexpressions are stored from last to first. |
| 3022 | // To evaluate expressions, we continue reading expressions and placing them on |
| 3023 | // the stack, with expressions having operands removing those operands from the |
Chris Lattner | f426253 | 2009-04-27 05:41:06 +0000 | [diff] [blame] | 3024 | // stack. Evaluation terminates when we see a STMT_STOP record, and |
| 3025 | // the single remaining expression on the stack is our result. |
Douglas Gregor | de3ef50 | 2011-11-30 23:21:26 +0000 | [diff] [blame] | 3026 | Stmt *ASTReader::ReadStmtFromStream(ModuleFile &F) { |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 3027 | |
| 3028 | ReadingKindTracker ReadingKind(Read_Stmt, *this); |
Sebastian Redl | 2c373b9 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 3029 | llvm::BitstreamCursor &Cursor = F.DeclsCursor; |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 3030 | |
Argyrios Kyrtzidis | 6a59897 | 2011-10-21 23:02:28 +0000 | [diff] [blame] | 3031 | // Map of offset to previously deserialized stmt. The offset points |
George Burgess IV | 758cf9d | 2017-02-14 05:52:57 +0000 | [diff] [blame] | 3032 | // just after the stmt record. |
Argyrios Kyrtzidis | 6a59897 | 2011-10-21 23:02:28 +0000 | [diff] [blame] | 3033 | llvm::DenseMap<uint64_t, Stmt *> StmtEntries; |
Sebastian Redl | 2c373b9 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 3034 | |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 3035 | #ifndef NDEBUG |
| 3036 | unsigned PrevNumStmts = StmtStack.size(); |
| 3037 | #endif |
| 3038 | |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 3039 | ASTRecordReader Record(*this, F); |
| 3040 | ASTStmtReader Reader(Record, Cursor); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3041 | Stmt::EmptyShell Empty; |
| 3042 | |
| 3043 | while (true) { |
Chris Lattner | 0e6c940 | 2013-01-20 02:38:54 +0000 | [diff] [blame] | 3044 | llvm::BitstreamEntry Entry = Cursor.advanceSkippingSubblocks(); |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 3045 | |
Chris Lattner | 0e6c940 | 2013-01-20 02:38:54 +0000 | [diff] [blame] | 3046 | switch (Entry.Kind) { |
| 3047 | case llvm::BitstreamEntry::SubBlock: // Handled for us already. |
| 3048 | case llvm::BitstreamEntry::Error: |
| 3049 | Error("malformed block record in AST file"); |
Craig Topper | a13603a | 2014-05-22 05:54:18 +0000 | [diff] [blame] | 3050 | return nullptr; |
Chris Lattner | 0e6c940 | 2013-01-20 02:38:54 +0000 | [diff] [blame] | 3051 | case llvm::BitstreamEntry::EndBlock: |
| 3052 | goto Done; |
| 3053 | case llvm::BitstreamEntry::Record: |
| 3054 | // The interesting case. |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3055 | break; |
| 3056 | } |
| 3057 | |
Richard Smith | dbafb6c | 2017-06-29 23:23:46 +0000 | [diff] [blame] | 3058 | ASTContext &Context = getContext(); |
Craig Topper | a13603a | 2014-05-22 05:54:18 +0000 | [diff] [blame] | 3059 | Stmt *S = nullptr; |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3060 | bool Finished = false; |
Argyrios Kyrtzidis | 6a59897 | 2011-10-21 23:02:28 +0000 | [diff] [blame] | 3061 | bool IsStmtReference = false; |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 3062 | switch ((StmtCode)Record.readRecord(Cursor, Entry.ID)) { |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3063 | case STMT_STOP: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3064 | Finished = true; |
| 3065 | break; |
| 3066 | |
Argyrios Kyrtzidis | 6a59897 | 2011-10-21 23:02:28 +0000 | [diff] [blame] | 3067 | case STMT_REF_PTR: |
| 3068 | IsStmtReference = true; |
| 3069 | assert(StmtEntries.find(Record[0]) != StmtEntries.end() && |
| 3070 | "No stmt was recorded for this offset reference!"); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 3071 | S = StmtEntries[Record.readInt()]; |
Argyrios Kyrtzidis | 6a59897 | 2011-10-21 23:02:28 +0000 | [diff] [blame] | 3072 | break; |
| 3073 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3074 | case STMT_NULL_PTR: |
Craig Topper | a13603a | 2014-05-22 05:54:18 +0000 | [diff] [blame] | 3075 | S = nullptr; |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3076 | break; |
| 3077 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3078 | case STMT_NULL: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3079 | S = new (Context) NullStmt(Empty); |
| 3080 | break; |
| 3081 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3082 | case STMT_COMPOUND: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3083 | S = new (Context) CompoundStmt(Empty); |
| 3084 | break; |
| 3085 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3086 | case STMT_CASE: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3087 | S = new (Context) CaseStmt(Empty); |
| 3088 | break; |
| 3089 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3090 | case STMT_DEFAULT: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3091 | S = new (Context) DefaultStmt(Empty); |
| 3092 | break; |
| 3093 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3094 | case STMT_LABEL: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3095 | S = new (Context) LabelStmt(Empty); |
| 3096 | break; |
| 3097 | |
Richard Smith | c202b28 | 2012-04-14 00:33:13 +0000 | [diff] [blame] | 3098 | case STMT_ATTRIBUTED: |
Alexander Kornienko | 20f6fc6 | 2012-07-09 10:04:07 +0000 | [diff] [blame] | 3099 | S = AttributedStmt::CreateEmpty( |
| 3100 | Context, |
| 3101 | /*NumAttrs*/Record[ASTStmtReader::NumStmtFields]); |
Richard Smith | c202b28 | 2012-04-14 00:33:13 +0000 | [diff] [blame] | 3102 | break; |
| 3103 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3104 | case STMT_IF: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3105 | S = new (Context) IfStmt(Empty); |
| 3106 | break; |
| 3107 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3108 | case STMT_SWITCH: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3109 | S = new (Context) SwitchStmt(Empty); |
| 3110 | break; |
| 3111 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3112 | case STMT_WHILE: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3113 | S = new (Context) WhileStmt(Empty); |
| 3114 | break; |
| 3115 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3116 | case STMT_DO: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3117 | S = new (Context) DoStmt(Empty); |
| 3118 | break; |
Mike Stump | 11289f4 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 3119 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3120 | case STMT_FOR: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3121 | S = new (Context) ForStmt(Empty); |
| 3122 | break; |
| 3123 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3124 | case STMT_GOTO: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3125 | S = new (Context) GotoStmt(Empty); |
| 3126 | break; |
Mike Stump | 11289f4 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 3127 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3128 | case STMT_INDIRECT_GOTO: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3129 | S = new (Context) IndirectGotoStmt(Empty); |
| 3130 | break; |
| 3131 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3132 | case STMT_CONTINUE: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3133 | S = new (Context) ContinueStmt(Empty); |
| 3134 | break; |
| 3135 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3136 | case STMT_BREAK: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3137 | S = new (Context) BreakStmt(Empty); |
| 3138 | break; |
| 3139 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3140 | case STMT_RETURN: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3141 | S = new (Context) ReturnStmt(Empty); |
| 3142 | break; |
| 3143 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3144 | case STMT_DECL: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3145 | S = new (Context) DeclStmt(Empty); |
| 3146 | break; |
| 3147 | |
Chad Rosier | de70e0e | 2012-08-25 00:11:56 +0000 | [diff] [blame] | 3148 | case STMT_GCCASM: |
| 3149 | S = new (Context) GCCAsmStmt(Empty); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3150 | break; |
| 3151 | |
Chad Rosier | e30d499 | 2012-08-24 23:51:02 +0000 | [diff] [blame] | 3152 | case STMT_MSASM: |
| 3153 | S = new (Context) MSAsmStmt(Empty); |
| 3154 | break; |
| 3155 | |
Tareq A. Siraj | 24110cc | 2013-04-16 18:53:08 +0000 | [diff] [blame] | 3156 | case STMT_CAPTURED: |
Ben Langmuir | ce914fc | 2013-05-03 19:20:19 +0000 | [diff] [blame] | 3157 | S = CapturedStmt::CreateDeserialized(Context, |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 3158 | Record[ASTStmtReader::NumStmtFields]); |
Tareq A. Siraj | 24110cc | 2013-04-16 18:53:08 +0000 | [diff] [blame] | 3159 | break; |
| 3160 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3161 | case EXPR_PREDEFINED: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3162 | S = new (Context) PredefinedExpr(Empty); |
| 3163 | break; |
Mike Stump | 11289f4 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 3164 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3165 | case EXPR_DECL_REF: |
Chandler Carruth | 8d26bb0 | 2011-05-01 23:48:14 +0000 | [diff] [blame] | 3166 | S = DeclRefExpr::CreateEmpty( |
Douglas Gregor | 4163aca | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 3167 | Context, |
Chandler Carruth | 8d26bb0 | 2011-05-01 23:48:14 +0000 | [diff] [blame] | 3168 | /*HasQualifier=*/Record[ASTStmtReader::NumExprFields], |
| 3169 | /*HasFoundDecl=*/Record[ASTStmtReader::NumExprFields + 1], |
Abramo Bagnara | 7945c98 | 2012-01-27 09:46:47 +0000 | [diff] [blame] | 3170 | /*HasTemplateKWAndArgsInfo=*/Record[ASTStmtReader::NumExprFields + 2], |
Chandler Carruth | 8d26bb0 | 2011-05-01 23:48:14 +0000 | [diff] [blame] | 3171 | /*NumTemplateArgs=*/Record[ASTStmtReader::NumExprFields + 2] ? |
John McCall | 113bee0 | 2012-03-10 09:33:50 +0000 | [diff] [blame] | 3172 | Record[ASTStmtReader::NumExprFields + 5] : 0); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3173 | break; |
Mike Stump | 11289f4 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 3174 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3175 | case EXPR_INTEGER_LITERAL: |
Douglas Gregor | 4163aca | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 3176 | S = IntegerLiteral::Create(Context, Empty); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 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 EXPR_FLOATING_LITERAL: |
Douglas Gregor | 4163aca | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 3180 | S = FloatingLiteral::Create(Context, Empty); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3181 | break; |
Mike Stump | 11289f4 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 3182 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3183 | case EXPR_IMAGINARY_LITERAL: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3184 | S = new (Context) ImaginaryLiteral(Empty); |
| 3185 | break; |
| 3186 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3187 | case EXPR_STRING_LITERAL: |
Douglas Gregor | 4163aca | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 3188 | S = StringLiteral::CreateEmpty(Context, |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 3189 | Record[ASTStmtReader::NumExprFields + 1]); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3190 | break; |
| 3191 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3192 | case EXPR_CHARACTER_LITERAL: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3193 | S = new (Context) CharacterLiteral(Empty); |
| 3194 | break; |
| 3195 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3196 | case EXPR_PAREN: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3197 | S = new (Context) ParenExpr(Empty); |
| 3198 | break; |
| 3199 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3200 | case EXPR_PAREN_LIST: |
Argyrios Kyrtzidis | f9f47c8 | 2010-06-30 08:49:18 +0000 | [diff] [blame] | 3201 | S = new (Context) ParenListExpr(Empty); |
| 3202 | break; |
| 3203 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3204 | case EXPR_UNARY_OPERATOR: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3205 | S = new (Context) UnaryOperator(Empty); |
| 3206 | break; |
| 3207 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3208 | case EXPR_OFFSETOF: |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 3209 | S = OffsetOfExpr::CreateEmpty(Context, |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 3210 | Record[ASTStmtReader::NumExprFields], |
| 3211 | Record[ASTStmtReader::NumExprFields + 1]); |
Douglas Gregor | 882211c | 2010-04-28 22:16:22 +0000 | [diff] [blame] | 3212 | break; |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 3213 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3214 | case EXPR_SIZEOF_ALIGN_OF: |
Peter Collingbourne | e190dee | 2011-03-11 19:24:49 +0000 | [diff] [blame] | 3215 | S = new (Context) UnaryExprOrTypeTraitExpr(Empty); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3216 | break; |
| 3217 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3218 | case EXPR_ARRAY_SUBSCRIPT: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3219 | S = new (Context) ArraySubscriptExpr(Empty); |
| 3220 | break; |
| 3221 | |
Alexey Bataev | 1a3320e | 2015-08-25 14:24:04 +0000 | [diff] [blame] | 3222 | case EXPR_OMP_ARRAY_SECTION: |
| 3223 | S = new (Context) OMPArraySectionExpr(Empty); |
| 3224 | break; |
| 3225 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3226 | case EXPR_CALL: |
Douglas Gregor | 4163aca | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 3227 | S = new (Context) CallExpr(Context, Stmt::CallExprClass, Empty); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3228 | break; |
| 3229 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3230 | case EXPR_MEMBER: { |
Argyrios Kyrtzidis | 1985bb3 | 2010-07-08 13:09:47 +0000 | [diff] [blame] | 3231 | // We load everything here and fully initialize it at creation. |
| 3232 | // That way we can use MemberExpr::Create and don't have to duplicate its |
| 3233 | // logic with a MemberExpr::CreateEmpty. |
| 3234 | |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 3235 | assert(Record.getIdx() == 0); |
Douglas Gregor | ea972d3 | 2011-02-28 21:54:11 +0000 | [diff] [blame] | 3236 | NestedNameSpecifierLoc QualifierLoc; |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 3237 | if (Record.readInt()) { // HasQualifier. |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 3238 | QualifierLoc = Record.readNestedNameSpecifierLoc(); |
Argyrios Kyrtzidis | 1985bb3 | 2010-07-08 13:09:47 +0000 | [diff] [blame] | 3239 | } |
| 3240 | |
Abramo Bagnara | 7945c98 | 2012-01-27 09:46:47 +0000 | [diff] [blame] | 3241 | SourceLocation TemplateKWLoc; |
Argyrios Kyrtzidis | 1985bb3 | 2010-07-08 13:09:47 +0000 | [diff] [blame] | 3242 | TemplateArgumentListInfo ArgInfo; |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 3243 | bool HasTemplateKWAndArgsInfo = Record.readInt(); |
Abramo Bagnara | 7945c98 | 2012-01-27 09:46:47 +0000 | [diff] [blame] | 3244 | if (HasTemplateKWAndArgsInfo) { |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 3245 | TemplateKWLoc = Record.readSourceLocation(); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 3246 | unsigned NumTemplateArgs = Record.readInt(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 3247 | ArgInfo.setLAngleLoc(Record.readSourceLocation()); |
| 3248 | ArgInfo.setRAngleLoc(Record.readSourceLocation()); |
Argyrios Kyrtzidis | 1985bb3 | 2010-07-08 13:09:47 +0000 | [diff] [blame] | 3249 | for (unsigned i = 0; i != NumTemplateArgs; ++i) |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 3250 | ArgInfo.addArgument(Record.readTemplateArgumentLoc()); |
Argyrios Kyrtzidis | 1985bb3 | 2010-07-08 13:09:47 +0000 | [diff] [blame] | 3251 | } |
Abramo Bagnara | 635ed24e | 2011-10-05 07:56:41 +0000 | [diff] [blame] | 3252 | |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 3253 | bool HadMultipleCandidates = Record.readInt(); |
Abramo Bagnara | 635ed24e | 2011-10-05 07:56:41 +0000 | [diff] [blame] | 3254 | |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 3255 | NamedDecl *FoundD = Record.readDeclAs<NamedDecl>(); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 3256 | AccessSpecifier AS = (AccessSpecifier)Record.readInt(); |
Argyrios Kyrtzidis | 1985bb3 | 2010-07-08 13:09:47 +0000 | [diff] [blame] | 3257 | DeclAccessPair FoundDecl = DeclAccessPair::make(FoundD, AS); |
| 3258 | |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 3259 | QualType T = Record.readType(); |
| 3260 | ExprValueKind VK = static_cast<ExprValueKind>(Record.readInt()); |
| 3261 | ExprObjectKind OK = static_cast<ExprObjectKind>(Record.readInt()); |
Argyrios Kyrtzidis | 1985bb3 | 2010-07-08 13:09:47 +0000 | [diff] [blame] | 3262 | Expr *Base = ReadSubExpr(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 3263 | ValueDecl *MemberD = Record.readDeclAs<ValueDecl>(); |
| 3264 | SourceLocation MemberLoc = Record.readSourceLocation(); |
Yunzhong Gao | eba323a | 2015-05-01 02:04:32 +0000 | [diff] [blame] | 3265 | DeclarationNameInfo MemberNameInfo(MemberD->getDeclName(), MemberLoc); |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 3266 | bool IsArrow = Record.readInt(); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 3267 | SourceLocation OperatorLoc = Record.readSourceLocation(); |
Yunzhong Gao | eba323a | 2015-05-01 02:04:32 +0000 | [diff] [blame] | 3268 | |
| 3269 | S = MemberExpr::Create(Context, Base, IsArrow, OperatorLoc, QualifierLoc, |
| 3270 | TemplateKWLoc, MemberD, FoundDecl, MemberNameInfo, |
| 3271 | HasTemplateKWAndArgsInfo ? &ArgInfo : nullptr, T, |
| 3272 | VK, OK); |
David L. Jones | b6a8f02 | 2016-12-21 04:34:52 +0000 | [diff] [blame] | 3273 | Record.readDeclarationNameLoc(cast<MemberExpr>(S)->MemberDNLoc, |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 3274 | MemberD->getDeclName()); |
Yunzhong Gao | eba323a | 2015-05-01 02:04:32 +0000 | [diff] [blame] | 3275 | if (HadMultipleCandidates) |
Abramo Bagnara | 635ed24e | 2011-10-05 07:56:41 +0000 | [diff] [blame] | 3276 | cast<MemberExpr>(S)->setHadMultipleCandidates(true); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3277 | break; |
Argyrios Kyrtzidis | 1985bb3 | 2010-07-08 13:09:47 +0000 | [diff] [blame] | 3278 | } |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3279 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3280 | case EXPR_BINARY_OPERATOR: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3281 | S = new (Context) BinaryOperator(Empty); |
| 3282 | break; |
| 3283 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3284 | case EXPR_COMPOUND_ASSIGN_OPERATOR: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3285 | S = new (Context) CompoundAssignOperator(Empty); |
| 3286 | break; |
| 3287 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3288 | case EXPR_CONDITIONAL_OPERATOR: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3289 | S = new (Context) ConditionalOperator(Empty); |
| 3290 | break; |
| 3291 | |
John McCall | c07a0c7 | 2011-02-17 10:25:35 +0000 | [diff] [blame] | 3292 | case EXPR_BINARY_CONDITIONAL_OPERATOR: |
| 3293 | S = new (Context) BinaryConditionalOperator(Empty); |
| 3294 | break; |
| 3295 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3296 | case EXPR_IMPLICIT_CAST: |
Douglas Gregor | 4163aca | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 3297 | S = ImplicitCastExpr::CreateEmpty(Context, |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 3298 | /*PathSize*/ Record[ASTStmtReader::NumExprFields]); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3299 | break; |
| 3300 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3301 | case EXPR_CSTYLE_CAST: |
Douglas Gregor | 4163aca | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 3302 | S = CStyleCastExpr::CreateEmpty(Context, |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 3303 | /*PathSize*/ Record[ASTStmtReader::NumExprFields]); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3304 | break; |
| 3305 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3306 | case EXPR_COMPOUND_LITERAL: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3307 | S = new (Context) CompoundLiteralExpr(Empty); |
| 3308 | break; |
| 3309 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3310 | case EXPR_EXT_VECTOR_ELEMENT: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3311 | S = new (Context) ExtVectorElementExpr(Empty); |
| 3312 | break; |
| 3313 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3314 | case EXPR_INIT_LIST: |
Argyrios Kyrtzidis | 0f05fb9 | 2012-11-28 03:56:16 +0000 | [diff] [blame] | 3315 | S = new (Context) InitListExpr(Empty); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3316 | break; |
| 3317 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3318 | case EXPR_DESIGNATED_INIT: |
Douglas Gregor | 4163aca | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 3319 | S = DesignatedInitExpr::CreateEmpty(Context, |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 3320 | Record[ASTStmtReader::NumExprFields] - 1); |
Mike Stump | 11289f4 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 3321 | |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3322 | break; |
| 3323 | |
Yunzhong Gao | cb77930 | 2015-06-10 00:27:52 +0000 | [diff] [blame] | 3324 | case EXPR_DESIGNATED_INIT_UPDATE: |
| 3325 | S = new (Context) DesignatedInitUpdateExpr(Empty); |
| 3326 | break; |
| 3327 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3328 | case EXPR_IMPLICIT_VALUE_INIT: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3329 | S = new (Context) ImplicitValueInitExpr(Empty); |
| 3330 | break; |
| 3331 | |
Yunzhong Gao | cb77930 | 2015-06-10 00:27:52 +0000 | [diff] [blame] | 3332 | case EXPR_NO_INIT: |
| 3333 | S = new (Context) NoInitExpr(Empty); |
| 3334 | break; |
| 3335 | |
Richard Smith | 410306b | 2016-12-12 02:53:20 +0000 | [diff] [blame] | 3336 | case EXPR_ARRAY_INIT_LOOP: |
| 3337 | S = new (Context) ArrayInitLoopExpr(Empty); |
| 3338 | break; |
| 3339 | |
| 3340 | case EXPR_ARRAY_INIT_INDEX: |
| 3341 | S = new (Context) ArrayInitIndexExpr(Empty); |
| 3342 | break; |
| 3343 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3344 | case EXPR_VA_ARG: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3345 | S = new (Context) VAArgExpr(Empty); |
| 3346 | break; |
| 3347 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3348 | case EXPR_ADDR_LABEL: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3349 | S = new (Context) AddrLabelExpr(Empty); |
| 3350 | break; |
| 3351 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3352 | case EXPR_STMT: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3353 | S = new (Context) StmtExpr(Empty); |
| 3354 | break; |
| 3355 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3356 | case EXPR_CHOOSE: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3357 | S = new (Context) ChooseExpr(Empty); |
| 3358 | break; |
| 3359 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3360 | case EXPR_GNU_NULL: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3361 | S = new (Context) GNUNullExpr(Empty); |
| 3362 | break; |
| 3363 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3364 | case EXPR_SHUFFLE_VECTOR: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3365 | S = new (Context) ShuffleVectorExpr(Empty); |
| 3366 | break; |
Mike Stump | 11289f4 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 3367 | |
Hal Finkel | c4d7c82 | 2013-09-18 03:29:45 +0000 | [diff] [blame] | 3368 | case EXPR_CONVERT_VECTOR: |
| 3369 | S = new (Context) ConvertVectorExpr(Empty); |
| 3370 | break; |
| 3371 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3372 | case EXPR_BLOCK: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3373 | S = new (Context) BlockExpr(Empty); |
| 3374 | break; |
| 3375 | |
Peter Collingbourne | 9114759 | 2011-04-15 00:35:48 +0000 | [diff] [blame] | 3376 | case EXPR_GENERIC_SELECTION: |
| 3377 | S = new (Context) GenericSelectionExpr(Empty); |
| 3378 | break; |
| 3379 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3380 | case EXPR_OBJC_STRING_LITERAL: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3381 | S = new (Context) ObjCStringLiteral(Empty); |
| 3382 | break; |
Patrick Beard | 0caa394 | 2012-04-19 00:25:12 +0000 | [diff] [blame] | 3383 | case EXPR_OBJC_BOXED_EXPRESSION: |
| 3384 | S = new (Context) ObjCBoxedExpr(Empty); |
Ted Kremenek | e65b086 | 2012-03-06 20:05:56 +0000 | [diff] [blame] | 3385 | break; |
| 3386 | case EXPR_OBJC_ARRAY_LITERAL: |
| 3387 | S = ObjCArrayLiteral::CreateEmpty(Context, |
| 3388 | Record[ASTStmtReader::NumExprFields]); |
| 3389 | break; |
| 3390 | case EXPR_OBJC_DICTIONARY_LITERAL: |
| 3391 | S = ObjCDictionaryLiteral::CreateEmpty(Context, |
| 3392 | Record[ASTStmtReader::NumExprFields], |
| 3393 | Record[ASTStmtReader::NumExprFields + 1]); |
| 3394 | break; |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3395 | case EXPR_OBJC_ENCODE: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3396 | S = new (Context) ObjCEncodeExpr(Empty); |
| 3397 | break; |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3398 | case EXPR_OBJC_SELECTOR_EXPR: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3399 | S = new (Context) ObjCSelectorExpr(Empty); |
| 3400 | break; |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3401 | case EXPR_OBJC_PROTOCOL_EXPR: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3402 | S = new (Context) ObjCProtocolExpr(Empty); |
| 3403 | break; |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3404 | case EXPR_OBJC_IVAR_REF_EXPR: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3405 | S = new (Context) ObjCIvarRefExpr(Empty); |
| 3406 | break; |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3407 | case EXPR_OBJC_PROPERTY_REF_EXPR: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3408 | S = new (Context) ObjCPropertyRefExpr(Empty); |
| 3409 | break; |
Ted Kremenek | e65b086 | 2012-03-06 20:05:56 +0000 | [diff] [blame] | 3410 | case EXPR_OBJC_SUBSCRIPT_REF_EXPR: |
| 3411 | S = new (Context) ObjCSubscriptRefExpr(Empty); |
| 3412 | break; |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3413 | case EXPR_OBJC_KVC_REF_EXPR: |
John McCall | b7bd14f | 2010-12-02 01:19:52 +0000 | [diff] [blame] | 3414 | llvm_unreachable("mismatching AST file"); |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3415 | case EXPR_OBJC_MESSAGE_EXPR: |
Douglas Gregor | 4163aca | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 3416 | S = ObjCMessageExpr::CreateEmpty(Context, |
Argyrios Kyrtzidis | a6011e2 | 2011-10-03 06:36:51 +0000 | [diff] [blame] | 3417 | Record[ASTStmtReader::NumExprFields], |
| 3418 | Record[ASTStmtReader::NumExprFields + 1]); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3419 | break; |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3420 | case EXPR_OBJC_ISA: |
Steve Naroff | e87026a | 2009-07-24 17:54:45 +0000 | [diff] [blame] | 3421 | S = new (Context) ObjCIsaExpr(Empty); |
| 3422 | break; |
John McCall | 31168b0 | 2011-06-15 23:02:42 +0000 | [diff] [blame] | 3423 | case EXPR_OBJC_INDIRECT_COPY_RESTORE: |
| 3424 | S = new (Context) ObjCIndirectCopyRestoreExpr(Empty); |
| 3425 | break; |
| 3426 | case EXPR_OBJC_BRIDGED_CAST: |
| 3427 | S = new (Context) ObjCBridgedCastExpr(Empty); |
| 3428 | break; |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3429 | case STMT_OBJC_FOR_COLLECTION: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3430 | S = new (Context) ObjCForCollectionStmt(Empty); |
| 3431 | break; |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3432 | case STMT_OBJC_CATCH: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3433 | S = new (Context) ObjCAtCatchStmt(Empty); |
| 3434 | break; |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3435 | case STMT_OBJC_FINALLY: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3436 | S = new (Context) ObjCAtFinallyStmt(Empty); |
| 3437 | break; |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3438 | case STMT_OBJC_AT_TRY: |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 3439 | S = ObjCAtTryStmt::CreateEmpty(Context, |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 3440 | Record[ASTStmtReader::NumStmtFields], |
| 3441 | Record[ASTStmtReader::NumStmtFields + 1]); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3442 | break; |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3443 | case STMT_OBJC_AT_SYNCHRONIZED: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3444 | S = new (Context) ObjCAtSynchronizedStmt(Empty); |
| 3445 | break; |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3446 | case STMT_OBJC_AT_THROW: |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 3447 | S = new (Context) ObjCAtThrowStmt(Empty); |
| 3448 | break; |
John McCall | 31168b0 | 2011-06-15 23:02:42 +0000 | [diff] [blame] | 3449 | case STMT_OBJC_AUTORELEASE_POOL: |
| 3450 | S = new (Context) ObjCAutoreleasePoolStmt(Empty); |
| 3451 | break; |
Ted Kremenek | e65b086 | 2012-03-06 20:05:56 +0000 | [diff] [blame] | 3452 | case EXPR_OBJC_BOOL_LITERAL: |
| 3453 | S = new (Context) ObjCBoolLiteralExpr(Empty); |
| 3454 | break; |
Erik Pilkington | 29099de | 2016-07-16 00:35:23 +0000 | [diff] [blame] | 3455 | case EXPR_OBJC_AVAILABILITY_CHECK: |
| 3456 | S = new (Context) ObjCAvailabilityCheckExpr(Empty); |
| 3457 | break; |
Nico Weber | 9b98207 | 2014-07-07 00:12:30 +0000 | [diff] [blame] | 3458 | case STMT_SEH_LEAVE: |
| 3459 | S = new (Context) SEHLeaveStmt(Empty); |
| 3460 | break; |
John McCall | fa19404 | 2011-07-15 07:00:14 +0000 | [diff] [blame] | 3461 | case STMT_SEH_EXCEPT: |
| 3462 | S = new (Context) SEHExceptStmt(Empty); |
| 3463 | break; |
| 3464 | case STMT_SEH_FINALLY: |
| 3465 | S = new (Context) SEHFinallyStmt(Empty); |
| 3466 | break; |
| 3467 | case STMT_SEH_TRY: |
| 3468 | S = new (Context) SEHTryStmt(Empty); |
| 3469 | break; |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3470 | case STMT_CXX_CATCH: |
Argyrios Kyrtzidis | 47cd7a9 | 2010-07-22 16:03:56 +0000 | [diff] [blame] | 3471 | S = new (Context) CXXCatchStmt(Empty); |
| 3472 | break; |
| 3473 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3474 | case STMT_CXX_TRY: |
Douglas Gregor | 4163aca | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 3475 | S = CXXTryStmt::Create(Context, Empty, |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 3476 | /*NumHandlers=*/Record[ASTStmtReader::NumStmtFields]); |
Argyrios Kyrtzidis | 47cd7a9 | 2010-07-22 16:03:56 +0000 | [diff] [blame] | 3477 | break; |
| 3478 | |
Richard Smith | 02e85f3 | 2011-04-14 22:09:26 +0000 | [diff] [blame] | 3479 | case STMT_CXX_FOR_RANGE: |
| 3480 | S = new (Context) CXXForRangeStmt(Empty); |
| 3481 | break; |
| 3482 | |
Douglas Gregor | deb4a2be | 2011-10-25 01:33:02 +0000 | [diff] [blame] | 3483 | case STMT_MS_DEPENDENT_EXISTS: |
| 3484 | S = new (Context) MSDependentExistsStmt(SourceLocation(), true, |
| 3485 | NestedNameSpecifierLoc(), |
| 3486 | DeclarationNameInfo(), |
Craig Topper | a13603a | 2014-05-22 05:54:18 +0000 | [diff] [blame] | 3487 | nullptr); |
Douglas Gregor | deb4a2be | 2011-10-25 01:33:02 +0000 | [diff] [blame] | 3488 | break; |
Alexey Bataev | 1b59ab5 | 2014-02-27 08:29:12 +0000 | [diff] [blame] | 3489 | |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 3490 | case STMT_OMP_PARALLEL_DIRECTIVE: |
| 3491 | S = |
| 3492 | OMPParallelDirective::CreateEmpty(Context, |
| 3493 | Record[ASTStmtReader::NumStmtFields], |
| 3494 | Empty); |
| 3495 | break; |
Alexey Bataev | 1b59ab5 | 2014-02-27 08:29:12 +0000 | [diff] [blame] | 3496 | |
| 3497 | case STMT_OMP_SIMD_DIRECTIVE: { |
| 3498 | unsigned NumClauses = Record[ASTStmtReader::NumStmtFields]; |
| 3499 | unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1]; |
| 3500 | S = OMPSimdDirective::CreateEmpty(Context, NumClauses, |
| 3501 | CollapsedNum, Empty); |
| 3502 | break; |
| 3503 | } |
| 3504 | |
Alexey Bataev | f29276e | 2014-06-18 04:14:57 +0000 | [diff] [blame] | 3505 | case STMT_OMP_FOR_DIRECTIVE: { |
| 3506 | unsigned NumClauses = Record[ASTStmtReader::NumStmtFields]; |
| 3507 | unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1]; |
| 3508 | S = OMPForDirective::CreateEmpty(Context, NumClauses, CollapsedNum, |
| 3509 | Empty); |
| 3510 | break; |
| 3511 | } |
| 3512 | |
Alexander Musman | f82886e | 2014-09-18 05:12:34 +0000 | [diff] [blame] | 3513 | case STMT_OMP_FOR_SIMD_DIRECTIVE: { |
| 3514 | unsigned NumClauses = Record[ASTStmtReader::NumStmtFields]; |
| 3515 | unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1]; |
| 3516 | S = OMPForSimdDirective::CreateEmpty(Context, NumClauses, CollapsedNum, |
| 3517 | Empty); |
| 3518 | break; |
| 3519 | } |
| 3520 | |
Alexey Bataev | d3f8dd2 | 2014-06-25 11:44:49 +0000 | [diff] [blame] | 3521 | case STMT_OMP_SECTIONS_DIRECTIVE: |
| 3522 | S = OMPSectionsDirective::CreateEmpty( |
| 3523 | Context, Record[ASTStmtReader::NumStmtFields], Empty); |
| 3524 | break; |
| 3525 | |
Alexey Bataev | 1e0498a | 2014-06-26 08:21:58 +0000 | [diff] [blame] | 3526 | case STMT_OMP_SECTION_DIRECTIVE: |
| 3527 | S = OMPSectionDirective::CreateEmpty(Context, Empty); |
| 3528 | break; |
| 3529 | |
Alexey Bataev | d1e40fb | 2014-06-26 12:05:45 +0000 | [diff] [blame] | 3530 | case STMT_OMP_SINGLE_DIRECTIVE: |
| 3531 | S = OMPSingleDirective::CreateEmpty( |
| 3532 | Context, Record[ASTStmtReader::NumStmtFields], Empty); |
| 3533 | break; |
| 3534 | |
Alexander Musman | 80c2289 | 2014-07-17 08:54:58 +0000 | [diff] [blame] | 3535 | case STMT_OMP_MASTER_DIRECTIVE: |
| 3536 | S = OMPMasterDirective::CreateEmpty(Context, Empty); |
| 3537 | break; |
| 3538 | |
Alexander Musman | d9ed09f | 2014-07-21 09:42:05 +0000 | [diff] [blame] | 3539 | case STMT_OMP_CRITICAL_DIRECTIVE: |
Alexey Bataev | 28c7541 | 2015-12-15 08:19:24 +0000 | [diff] [blame] | 3540 | S = OMPCriticalDirective::CreateEmpty( |
| 3541 | Context, Record[ASTStmtReader::NumStmtFields], Empty); |
Alexander Musman | d9ed09f | 2014-07-21 09:42:05 +0000 | [diff] [blame] | 3542 | break; |
| 3543 | |
Alexey Bataev | 4acb859 | 2014-07-07 13:01:15 +0000 | [diff] [blame] | 3544 | case STMT_OMP_PARALLEL_FOR_DIRECTIVE: { |
| 3545 | unsigned NumClauses = Record[ASTStmtReader::NumStmtFields]; |
| 3546 | unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1]; |
| 3547 | S = OMPParallelForDirective::CreateEmpty(Context, NumClauses, |
| 3548 | CollapsedNum, Empty); |
| 3549 | break; |
| 3550 | } |
| 3551 | |
Alexander Musman | e4e893b | 2014-09-23 09:33:00 +0000 | [diff] [blame] | 3552 | case STMT_OMP_PARALLEL_FOR_SIMD_DIRECTIVE: { |
| 3553 | unsigned NumClauses = Record[ASTStmtReader::NumStmtFields]; |
| 3554 | unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1]; |
| 3555 | S = OMPParallelForSimdDirective::CreateEmpty(Context, NumClauses, |
| 3556 | CollapsedNum, Empty); |
| 3557 | break; |
| 3558 | } |
| 3559 | |
Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 3560 | case STMT_OMP_PARALLEL_SECTIONS_DIRECTIVE: |
| 3561 | S = OMPParallelSectionsDirective::CreateEmpty( |
| 3562 | Context, Record[ASTStmtReader::NumStmtFields], Empty); |
| 3563 | break; |
| 3564 | |
Alexey Bataev | 9c2e8ee | 2014-07-11 11:25:16 +0000 | [diff] [blame] | 3565 | case STMT_OMP_TASK_DIRECTIVE: |
| 3566 | S = OMPTaskDirective::CreateEmpty( |
| 3567 | Context, Record[ASTStmtReader::NumStmtFields], Empty); |
| 3568 | break; |
| 3569 | |
Alexey Bataev | 68446b7 | 2014-07-18 07:47:19 +0000 | [diff] [blame] | 3570 | case STMT_OMP_TASKYIELD_DIRECTIVE: |
| 3571 | S = OMPTaskyieldDirective::CreateEmpty(Context, Empty); |
| 3572 | break; |
| 3573 | |
Alexey Bataev | 4d1dfea | 2014-07-18 09:11:51 +0000 | [diff] [blame] | 3574 | case STMT_OMP_BARRIER_DIRECTIVE: |
| 3575 | S = OMPBarrierDirective::CreateEmpty(Context, Empty); |
| 3576 | break; |
| 3577 | |
Alexey Bataev | 2df347a | 2014-07-18 10:17:07 +0000 | [diff] [blame] | 3578 | case STMT_OMP_TASKWAIT_DIRECTIVE: |
| 3579 | S = OMPTaskwaitDirective::CreateEmpty(Context, Empty); |
| 3580 | break; |
| 3581 | |
Alexey Bataev | c30dd2d | 2015-06-18 12:14:09 +0000 | [diff] [blame] | 3582 | case STMT_OMP_TASKGROUP_DIRECTIVE: |
Alexey Bataev | 169d96a | 2017-07-18 20:17:46 +0000 | [diff] [blame] | 3583 | S = OMPTaskgroupDirective::CreateEmpty( |
| 3584 | Context, Record[ASTStmtReader::NumStmtFields], Empty); |
Alexey Bataev | c30dd2d | 2015-06-18 12:14:09 +0000 | [diff] [blame] | 3585 | break; |
| 3586 | |
Alexey Bataev | 6125da9 | 2014-07-21 11:26:11 +0000 | [diff] [blame] | 3587 | case STMT_OMP_FLUSH_DIRECTIVE: |
| 3588 | S = OMPFlushDirective::CreateEmpty( |
| 3589 | Context, Record[ASTStmtReader::NumStmtFields], Empty); |
| 3590 | break; |
| 3591 | |
Alexey Bataev | 9fb6e64 | 2014-07-22 06:45:04 +0000 | [diff] [blame] | 3592 | case STMT_OMP_ORDERED_DIRECTIVE: |
Alexey Bataev | 346265e | 2015-09-25 10:37:12 +0000 | [diff] [blame] | 3593 | S = OMPOrderedDirective::CreateEmpty( |
| 3594 | Context, Record[ASTStmtReader::NumStmtFields], Empty); |
Alexey Bataev | 9fb6e64 | 2014-07-22 06:45:04 +0000 | [diff] [blame] | 3595 | break; |
| 3596 | |
Alexey Bataev | 0162e45 | 2014-07-22 10:10:35 +0000 | [diff] [blame] | 3597 | case STMT_OMP_ATOMIC_DIRECTIVE: |
| 3598 | S = OMPAtomicDirective::CreateEmpty( |
| 3599 | Context, Record[ASTStmtReader::NumStmtFields], Empty); |
| 3600 | break; |
| 3601 | |
Alexey Bataev | 0bd520b | 2014-09-19 08:19:49 +0000 | [diff] [blame] | 3602 | case STMT_OMP_TARGET_DIRECTIVE: |
| 3603 | S = OMPTargetDirective::CreateEmpty( |
| 3604 | Context, Record[ASTStmtReader::NumStmtFields], Empty); |
| 3605 | break; |
| 3606 | |
Michael Wong | 65f367f | 2015-07-21 13:44:28 +0000 | [diff] [blame] | 3607 | case STMT_OMP_TARGET_DATA_DIRECTIVE: |
| 3608 | S = OMPTargetDataDirective::CreateEmpty( |
| 3609 | Context, Record[ASTStmtReader::NumStmtFields], Empty); |
| 3610 | break; |
| 3611 | |
Samuel Antao | df67fc4 | 2016-01-19 19:15:56 +0000 | [diff] [blame] | 3612 | case STMT_OMP_TARGET_ENTER_DATA_DIRECTIVE: |
| 3613 | S = OMPTargetEnterDataDirective::CreateEmpty( |
| 3614 | Context, Record[ASTStmtReader::NumStmtFields], Empty); |
| 3615 | break; |
| 3616 | |
Samuel Antao | 7259076 | 2016-01-19 20:04:50 +0000 | [diff] [blame] | 3617 | case STMT_OMP_TARGET_EXIT_DATA_DIRECTIVE: |
| 3618 | S = OMPTargetExitDataDirective::CreateEmpty( |
| 3619 | Context, Record[ASTStmtReader::NumStmtFields], Empty); |
| 3620 | break; |
| 3621 | |
Arpith Chacko Jacob | e955b3d | 2016-01-26 18:48:41 +0000 | [diff] [blame] | 3622 | case STMT_OMP_TARGET_PARALLEL_DIRECTIVE: |
| 3623 | S = OMPTargetParallelDirective::CreateEmpty( |
| 3624 | Context, Record[ASTStmtReader::NumStmtFields], Empty); |
| 3625 | break; |
| 3626 | |
Arpith Chacko Jacob | 05bebb5 | 2016-02-03 15:46:42 +0000 | [diff] [blame] | 3627 | case STMT_OMP_TARGET_PARALLEL_FOR_DIRECTIVE: { |
| 3628 | unsigned NumClauses = Record[ASTStmtReader::NumStmtFields]; |
| 3629 | unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1]; |
| 3630 | S = OMPTargetParallelForDirective::CreateEmpty(Context, NumClauses, |
| 3631 | CollapsedNum, Empty); |
| 3632 | break; |
| 3633 | } |
| 3634 | |
Samuel Antao | 686c70c | 2016-05-26 17:30:50 +0000 | [diff] [blame] | 3635 | case STMT_OMP_TARGET_UPDATE_DIRECTIVE: |
| 3636 | S = OMPTargetUpdateDirective::CreateEmpty( |
| 3637 | Context, Record[ASTStmtReader::NumStmtFields], Empty); |
| 3638 | break; |
| 3639 | |
Alexey Bataev | 13314bf | 2014-10-09 04:18:56 +0000 | [diff] [blame] | 3640 | case STMT_OMP_TEAMS_DIRECTIVE: |
| 3641 | S = OMPTeamsDirective::CreateEmpty( |
| 3642 | Context, Record[ASTStmtReader::NumStmtFields], Empty); |
| 3643 | break; |
| 3644 | |
Alexey Bataev | 6d4ed05 | 2015-07-01 06:57:41 +0000 | [diff] [blame] | 3645 | case STMT_OMP_CANCELLATION_POINT_DIRECTIVE: |
| 3646 | S = OMPCancellationPointDirective::CreateEmpty(Context, Empty); |
| 3647 | break; |
| 3648 | |
Alexey Bataev | 8090987 | 2015-07-02 11:25:17 +0000 | [diff] [blame] | 3649 | case STMT_OMP_CANCEL_DIRECTIVE: |
Alexey Bataev | 87933c7 | 2015-09-18 08:07:34 +0000 | [diff] [blame] | 3650 | S = OMPCancelDirective::CreateEmpty( |
| 3651 | Context, Record[ASTStmtReader::NumStmtFields], Empty); |
Alexey Bataev | 8090987 | 2015-07-02 11:25:17 +0000 | [diff] [blame] | 3652 | break; |
| 3653 | |
Alexey Bataev | 49f6e78 | 2015-12-01 04:18:41 +0000 | [diff] [blame] | 3654 | case STMT_OMP_TASKLOOP_DIRECTIVE: { |
| 3655 | unsigned NumClauses = Record[ASTStmtReader::NumStmtFields]; |
| 3656 | unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1]; |
| 3657 | S = OMPTaskLoopDirective::CreateEmpty(Context, NumClauses, CollapsedNum, |
| 3658 | Empty); |
| 3659 | break; |
| 3660 | } |
| 3661 | |
Alexey Bataev | 0a6ed84 | 2015-12-03 09:40:15 +0000 | [diff] [blame] | 3662 | case STMT_OMP_TASKLOOP_SIMD_DIRECTIVE: { |
| 3663 | unsigned NumClauses = Record[ASTStmtReader::NumStmtFields]; |
| 3664 | unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1]; |
| 3665 | S = OMPTaskLoopSimdDirective::CreateEmpty(Context, NumClauses, |
| 3666 | CollapsedNum, Empty); |
| 3667 | break; |
| 3668 | } |
| 3669 | |
Carlo Bertolli | 6200a3d | 2015-12-14 14:51:25 +0000 | [diff] [blame] | 3670 | case STMT_OMP_DISTRIBUTE_DIRECTIVE: { |
| 3671 | unsigned NumClauses = Record[ASTStmtReader::NumStmtFields]; |
| 3672 | unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1]; |
| 3673 | S = OMPDistributeDirective::CreateEmpty(Context, NumClauses, CollapsedNum, |
| 3674 | Empty); |
| 3675 | break; |
| 3676 | } |
| 3677 | |
Carlo Bertolli | 9925f15 | 2016-06-27 14:55:37 +0000 | [diff] [blame] | 3678 | case STMT_OMP_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE: { |
| 3679 | unsigned NumClauses = Record[ASTStmtReader::NumStmtFields]; |
| 3680 | unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1]; |
| 3681 | S = OMPDistributeParallelForDirective::CreateEmpty(Context, NumClauses, |
| 3682 | CollapsedNum, Empty); |
| 3683 | break; |
| 3684 | } |
| 3685 | |
Kelvin Li | 4a39add | 2016-07-05 05:00:15 +0000 | [diff] [blame] | 3686 | case STMT_OMP_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE: { |
| 3687 | unsigned NumClauses = Record[ASTStmtReader::NumStmtFields]; |
| 3688 | unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1]; |
| 3689 | S = OMPDistributeParallelForSimdDirective::CreateEmpty(Context, NumClauses, |
| 3690 | CollapsedNum, |
| 3691 | Empty); |
| 3692 | break; |
| 3693 | } |
| 3694 | |
Kelvin Li | 787f3fc | 2016-07-06 04:45:38 +0000 | [diff] [blame] | 3695 | case STMT_OMP_DISTRIBUTE_SIMD_DIRECTIVE: { |
| 3696 | unsigned NumClauses = Record[ASTStmtReader::NumStmtFields]; |
| 3697 | unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1]; |
| 3698 | S = OMPDistributeSimdDirective::CreateEmpty(Context, NumClauses, |
| 3699 | CollapsedNum, Empty); |
| 3700 | break; |
| 3701 | } |
| 3702 | |
Kelvin Li | a579b91 | 2016-07-14 02:54:56 +0000 | [diff] [blame] | 3703 | case STMT_OMP_TARGET_PARALLEL_FOR_SIMD_DIRECTIVE: { |
| 3704 | unsigned NumClauses = Record[ASTStmtReader::NumStmtFields]; |
| 3705 | unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1]; |
| 3706 | S = OMPTargetParallelForSimdDirective::CreateEmpty(Context, NumClauses, |
| 3707 | CollapsedNum, Empty); |
| 3708 | break; |
| 3709 | } |
| 3710 | |
Kelvin Li | 986330c | 2016-07-20 22:57:10 +0000 | [diff] [blame] | 3711 | case STMT_OMP_TARGET_SIMD_DIRECTIVE: { |
| 3712 | auto NumClauses = Record[ASTStmtReader::NumStmtFields]; |
| 3713 | auto CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1]; |
| 3714 | S = OMPTargetSimdDirective::CreateEmpty(Context, NumClauses, CollapsedNum, |
| 3715 | Empty); |
| 3716 | break; |
| 3717 | } |
| 3718 | |
Kelvin Li | 83c451e | 2016-12-25 04:52:54 +0000 | [diff] [blame] | 3719 | case STMT_OMP_TEAMS_DISTRIBUTE_DIRECTIVE: { |
Kelvin Li | 0253287 | 2016-08-05 14:37:37 +0000 | [diff] [blame] | 3720 | auto NumClauses = Record[ASTStmtReader::NumStmtFields]; |
| 3721 | auto CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1]; |
| 3722 | S = OMPTeamsDistributeDirective::CreateEmpty(Context, NumClauses, |
| 3723 | CollapsedNum, Empty); |
| 3724 | break; |
| 3725 | } |
| 3726 | |
Kelvin Li | 4e325f7 | 2016-10-25 12:50:55 +0000 | [diff] [blame] | 3727 | case STMT_OMP_TEAMS_DISTRIBUTE_SIMD_DIRECTIVE: { |
| 3728 | unsigned NumClauses = Record[ASTStmtReader::NumStmtFields]; |
| 3729 | unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1]; |
| 3730 | S = OMPTeamsDistributeSimdDirective::CreateEmpty(Context, NumClauses, |
| 3731 | CollapsedNum, Empty); |
| 3732 | break; |
| 3733 | } |
| 3734 | |
Kelvin Li | 579e41c | 2016-11-30 23:51:03 +0000 | [diff] [blame] | 3735 | case STMT_OMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE: { |
| 3736 | auto NumClauses = Record[ASTStmtReader::NumStmtFields]; |
| 3737 | auto CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1]; |
| 3738 | S = OMPTeamsDistributeParallelForSimdDirective::CreateEmpty( |
| 3739 | Context, NumClauses, CollapsedNum, Empty); |
| 3740 | break; |
| 3741 | } |
| 3742 | |
Kelvin Li | 7ade93f | 2016-12-09 03:24:30 +0000 | [diff] [blame] | 3743 | case STMT_OMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE: { |
| 3744 | auto NumClauses = Record[ASTStmtReader::NumStmtFields]; |
| 3745 | auto CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1]; |
| 3746 | S = OMPTeamsDistributeParallelForDirective::CreateEmpty( |
| 3747 | Context, NumClauses, CollapsedNum, Empty); |
| 3748 | break; |
| 3749 | } |
| 3750 | |
Kelvin Li | bf594a5 | 2016-12-17 05:48:59 +0000 | [diff] [blame] | 3751 | case STMT_OMP_TARGET_TEAMS_DIRECTIVE: { |
| 3752 | S = OMPTargetTeamsDirective::CreateEmpty( |
| 3753 | Context, Record[ASTStmtReader::NumStmtFields], Empty); |
| 3754 | break; |
| 3755 | } |
Kelvin Li | 83c451e | 2016-12-25 04:52:54 +0000 | [diff] [blame] | 3756 | |
| 3757 | case STMT_OMP_TARGET_TEAMS_DISTRIBUTE_DIRECTIVE: { |
| 3758 | auto NumClauses = Record[ASTStmtReader::NumStmtFields]; |
| 3759 | auto CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1]; |
| 3760 | S = OMPTargetTeamsDistributeDirective::CreateEmpty(Context, NumClauses, |
| 3761 | CollapsedNum, Empty); |
| 3762 | break; |
| 3763 | } |
| 3764 | |
Kelvin Li | 80e8f56 | 2016-12-29 22:16:30 +0000 | [diff] [blame] | 3765 | case STMT_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE: { |
| 3766 | auto NumClauses = Record[ASTStmtReader::NumStmtFields]; |
| 3767 | auto CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1]; |
| 3768 | S = OMPTargetTeamsDistributeParallelForDirective::CreateEmpty( |
| 3769 | Context, NumClauses, CollapsedNum, Empty); |
| 3770 | break; |
| 3771 | } |
| 3772 | |
Kelvin Li | 1851df5 | 2017-01-03 05:23:48 +0000 | [diff] [blame] | 3773 | case STMT_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE: { |
| 3774 | auto NumClauses = Record[ASTStmtReader::NumStmtFields]; |
| 3775 | auto CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1]; |
| 3776 | S = OMPTargetTeamsDistributeParallelForSimdDirective::CreateEmpty( |
| 3777 | Context, NumClauses, CollapsedNum, Empty); |
| 3778 | break; |
| 3779 | } |
| 3780 | |
Kelvin Li | da68118 | 2017-01-10 18:08:18 +0000 | [diff] [blame] | 3781 | case STMT_OMP_TARGET_TEAMS_DISTRIBUTE_SIMD_DIRECTIVE: { |
| 3782 | auto NumClauses = Record[ASTStmtReader::NumStmtFields]; |
| 3783 | auto CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1]; |
| 3784 | S = OMPTargetTeamsDistributeSimdDirective::CreateEmpty( |
| 3785 | Context, NumClauses, CollapsedNum, Empty); |
| 3786 | break; |
| 3787 | } |
| 3788 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3789 | case EXPR_CXX_OPERATOR_CALL: |
Douglas Gregor | 4163aca | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 3790 | S = new (Context) CXXOperatorCallExpr(Context, Empty); |
Argyrios Kyrtzidis | eeaaead | 2009-07-14 03:19:21 +0000 | [diff] [blame] | 3791 | break; |
Chris Lattner | b7e7f72 | 2010-05-09 05:36:05 +0000 | [diff] [blame] | 3792 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3793 | case EXPR_CXX_MEMBER_CALL: |
Douglas Gregor | 4163aca | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 3794 | S = new (Context) CXXMemberCallExpr(Context, Empty); |
Chris Lattner | b7e7f72 | 2010-05-09 05:36:05 +0000 | [diff] [blame] | 3795 | break; |
Alexey Bataev | 1b59ab5 | 2014-02-27 08:29:12 +0000 | [diff] [blame] | 3796 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3797 | case EXPR_CXX_CONSTRUCT: |
Argyrios Kyrtzidis | b8d77eb | 2010-07-10 11:46:15 +0000 | [diff] [blame] | 3798 | S = new (Context) CXXConstructExpr(Empty); |
| 3799 | break; |
Alexey Bataev | 1b59ab5 | 2014-02-27 08:29:12 +0000 | [diff] [blame] | 3800 | |
Richard Smith | 5179eb7 | 2016-06-28 19:03:57 +0000 | [diff] [blame] | 3801 | case EXPR_CXX_INHERITED_CTOR_INIT: |
| 3802 | S = new (Context) CXXInheritedCtorInitExpr(Empty); |
| 3803 | break; |
| 3804 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3805 | case EXPR_CXX_TEMPORARY_OBJECT: |
Argyrios Kyrtzidis | b8d77eb | 2010-07-10 11:46:15 +0000 | [diff] [blame] | 3806 | S = new (Context) CXXTemporaryObjectExpr(Empty); |
Douglas Gregor | 5d3507d | 2009-09-09 23:08:42 +0000 | [diff] [blame] | 3807 | break; |
Sam Weinig | d01101e | 2010-01-16 21:21:01 +0000 | [diff] [blame] | 3808 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3809 | case EXPR_CXX_STATIC_CAST: |
Douglas Gregor | 4163aca | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 3810 | S = CXXStaticCastExpr::CreateEmpty(Context, |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 3811 | /*PathSize*/ Record[ASTStmtReader::NumExprFields]); |
Sam Weinig | d01101e | 2010-01-16 21:21:01 +0000 | [diff] [blame] | 3812 | break; |
| 3813 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3814 | case EXPR_CXX_DYNAMIC_CAST: |
Douglas Gregor | 4163aca | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 3815 | S = CXXDynamicCastExpr::CreateEmpty(Context, |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 3816 | /*PathSize*/ Record[ASTStmtReader::NumExprFields]); |
Sam Weinig | d01101e | 2010-01-16 21:21:01 +0000 | [diff] [blame] | 3817 | break; |
| 3818 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3819 | case EXPR_CXX_REINTERPRET_CAST: |
Douglas Gregor | 4163aca | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 3820 | S = CXXReinterpretCastExpr::CreateEmpty(Context, |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 3821 | /*PathSize*/ Record[ASTStmtReader::NumExprFields]); |
Sam Weinig | d01101e | 2010-01-16 21:21:01 +0000 | [diff] [blame] | 3822 | break; |
| 3823 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3824 | case EXPR_CXX_CONST_CAST: |
Douglas Gregor | 4163aca | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 3825 | S = CXXConstCastExpr::CreateEmpty(Context); |
Sam Weinig | d01101e | 2010-01-16 21:21:01 +0000 | [diff] [blame] | 3826 | break; |
| 3827 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3828 | case EXPR_CXX_FUNCTIONAL_CAST: |
Douglas Gregor | 4163aca | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 3829 | S = CXXFunctionalCastExpr::CreateEmpty(Context, |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 3830 | /*PathSize*/ Record[ASTStmtReader::NumExprFields]); |
Sam Weinig | d01101e | 2010-01-16 21:21:01 +0000 | [diff] [blame] | 3831 | break; |
| 3832 | |
Richard Smith | c67fdd4 | 2012-03-07 08:35:16 +0000 | [diff] [blame] | 3833 | case EXPR_USER_DEFINED_LITERAL: |
| 3834 | S = new (Context) UserDefinedLiteral(Context, Empty); |
| 3835 | break; |
| 3836 | |
Richard Smith | cc1b96d | 2013-06-12 22:31:48 +0000 | [diff] [blame] | 3837 | case EXPR_CXX_STD_INITIALIZER_LIST: |
| 3838 | S = new (Context) CXXStdInitializerListExpr(Empty); |
| 3839 | break; |
| 3840 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3841 | case EXPR_CXX_BOOL_LITERAL: |
Sam Weinig | e83b3ac | 2010-02-07 06:32:43 +0000 | [diff] [blame] | 3842 | S = new (Context) CXXBoolLiteralExpr(Empty); |
| 3843 | break; |
Sam Weinig | d01101e | 2010-01-16 21:21:01 +0000 | [diff] [blame] | 3844 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3845 | case EXPR_CXX_NULL_PTR_LITERAL: |
Sam Weinig | e83b3ac | 2010-02-07 06:32:43 +0000 | [diff] [blame] | 3846 | S = new (Context) CXXNullPtrLiteralExpr(Empty); |
| 3847 | break; |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3848 | case EXPR_CXX_TYPEID_EXPR: |
Chris Lattner | 13a5ecc | 2010-05-09 06:03:39 +0000 | [diff] [blame] | 3849 | S = new (Context) CXXTypeidExpr(Empty, true); |
| 3850 | break; |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3851 | case EXPR_CXX_TYPEID_TYPE: |
Chris Lattner | 13a5ecc | 2010-05-09 06:03:39 +0000 | [diff] [blame] | 3852 | S = new (Context) CXXTypeidExpr(Empty, false); |
| 3853 | break; |
Francois Pichet | 9f4f207 | 2010-09-08 12:20:18 +0000 | [diff] [blame] | 3854 | case EXPR_CXX_UUIDOF_EXPR: |
| 3855 | S = new (Context) CXXUuidofExpr(Empty, true); |
| 3856 | break; |
John McCall | 5e77d76 | 2013-04-16 07:28:30 +0000 | [diff] [blame] | 3857 | case EXPR_CXX_PROPERTY_REF_EXPR: |
| 3858 | S = new (Context) MSPropertyRefExpr(Empty); |
| 3859 | break; |
Alexey Bataev | f763027 | 2015-11-25 12:01:00 +0000 | [diff] [blame] | 3860 | case EXPR_CXX_PROPERTY_SUBSCRIPT_EXPR: |
| 3861 | S = new (Context) MSPropertySubscriptExpr(Empty); |
| 3862 | break; |
Francois Pichet | 9f4f207 | 2010-09-08 12:20:18 +0000 | [diff] [blame] | 3863 | case EXPR_CXX_UUIDOF_TYPE: |
| 3864 | S = new (Context) CXXUuidofExpr(Empty, false); |
| 3865 | break; |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3866 | case EXPR_CXX_THIS: |
Chris Lattner | 9826733 | 2010-05-09 06:15:05 +0000 | [diff] [blame] | 3867 | S = new (Context) CXXThisExpr(Empty); |
| 3868 | break; |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3869 | case EXPR_CXX_THROW: |
Chris Lattner | 9826733 | 2010-05-09 06:15:05 +0000 | [diff] [blame] | 3870 | S = new (Context) CXXThrowExpr(Empty); |
| 3871 | break; |
John McCall | 32791cc | 2016-01-06 22:34:54 +0000 | [diff] [blame] | 3872 | case EXPR_CXX_DEFAULT_ARG: |
| 3873 | S = new (Context) CXXDefaultArgExpr(Empty); |
Chris Lattner | e2437f4 | 2010-05-09 06:40:08 +0000 | [diff] [blame] | 3874 | break; |
Richard Smith | 852c9db | 2013-04-20 22:23:05 +0000 | [diff] [blame] | 3875 | case EXPR_CXX_DEFAULT_INIT: |
| 3876 | S = new (Context) CXXDefaultInitExpr(Empty); |
| 3877 | break; |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3878 | case EXPR_CXX_BIND_TEMPORARY: |
Chris Lattner | cba8614 | 2010-05-10 00:25:06 +0000 | [diff] [blame] | 3879 | S = new (Context) CXXBindTemporaryExpr(Empty); |
| 3880 | break; |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 3881 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3882 | case EXPR_CXX_SCALAR_VALUE_INIT: |
Douglas Gregor | 747eb78 | 2010-07-08 06:14:04 +0000 | [diff] [blame] | 3883 | S = new (Context) CXXScalarValueInitExpr(Empty); |
Chris Lattner | abfb58d | 2010-05-10 01:22:27 +0000 | [diff] [blame] | 3884 | break; |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3885 | case EXPR_CXX_NEW: |
Chris Lattner | abfb58d | 2010-05-10 01:22:27 +0000 | [diff] [blame] | 3886 | S = new (Context) CXXNewExpr(Empty); |
| 3887 | break; |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3888 | case EXPR_CXX_DELETE: |
Argyrios Kyrtzidis | 6e57c35 | 2010-06-22 17:07:59 +0000 | [diff] [blame] | 3889 | S = new (Context) CXXDeleteExpr(Empty); |
| 3890 | break; |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3891 | case EXPR_CXX_PSEUDO_DESTRUCTOR: |
Argyrios Kyrtzidis | 99a226d | 2010-06-28 09:32:03 +0000 | [diff] [blame] | 3892 | S = new (Context) CXXPseudoDestructorExpr(Empty); |
| 3893 | break; |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 3894 | |
John McCall | 5d41378 | 2010-12-06 08:20:24 +0000 | [diff] [blame] | 3895 | case EXPR_EXPR_WITH_CLEANUPS: |
John McCall | 28fc709 | 2011-11-10 05:35:25 +0000 | [diff] [blame] | 3896 | S = ExprWithCleanups::Create(Context, Empty, |
| 3897 | Record[ASTStmtReader::NumExprFields]); |
Chris Lattner | cba8614 | 2010-05-10 00:25:06 +0000 | [diff] [blame] | 3898 | break; |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 3899 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3900 | case EXPR_CXX_DEPENDENT_SCOPE_MEMBER: |
Douglas Gregor | 4163aca | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 3901 | S = CXXDependentScopeMemberExpr::CreateEmpty(Context, |
Abramo Bagnara | 7945c98 | 2012-01-27 09:46:47 +0000 | [diff] [blame] | 3902 | /*HasTemplateKWAndArgsInfo=*/Record[ASTStmtReader::NumExprFields], |
Douglas Gregor | 87866ce | 2011-02-04 12:01:24 +0000 | [diff] [blame] | 3903 | /*NumTemplateArgs=*/Record[ASTStmtReader::NumExprFields] |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 3904 | ? Record[ASTStmtReader::NumExprFields + 1] |
Douglas Gregor | 87866ce | 2011-02-04 12:01:24 +0000 | [diff] [blame] | 3905 | : 0); |
Argyrios Kyrtzidis | bfcacee | 2010-06-24 08:57:31 +0000 | [diff] [blame] | 3906 | break; |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 3907 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3908 | case EXPR_CXX_DEPENDENT_SCOPE_DECL_REF: |
Douglas Gregor | 4163aca | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 3909 | S = DependentScopeDeclRefExpr::CreateEmpty(Context, |
Abramo Bagnara | 7945c98 | 2012-01-27 09:46:47 +0000 | [diff] [blame] | 3910 | /*HasTemplateKWAndArgsInfo=*/Record[ASTStmtReader::NumExprFields], |
Douglas Gregor | 87866ce | 2011-02-04 12:01:24 +0000 | [diff] [blame] | 3911 | /*NumTemplateArgs=*/Record[ASTStmtReader::NumExprFields] |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 3912 | ? Record[ASTStmtReader::NumExprFields + 1] |
Douglas Gregor | 87866ce | 2011-02-04 12:01:24 +0000 | [diff] [blame] | 3913 | : 0); |
Argyrios Kyrtzidis | cd444d1a | 2010-06-28 09:31:56 +0000 | [diff] [blame] | 3914 | break; |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 3915 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3916 | case EXPR_CXX_UNRESOLVED_CONSTRUCT: |
Douglas Gregor | 4163aca | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 3917 | S = CXXUnresolvedConstructExpr::CreateEmpty(Context, |
Sebastian Redl | 70c751d | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 3918 | /*NumArgs=*/Record[ASTStmtReader::NumExprFields]); |
Argyrios Kyrtzidis | b8d3c63 | 2010-06-25 09:03:26 +0000 | [diff] [blame] | 3919 | break; |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 3920 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3921 | case EXPR_CXX_UNRESOLVED_MEMBER: |
Douglas Gregor | 4163aca | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 3922 | S = UnresolvedMemberExpr::CreateEmpty(Context, |
Abramo Bagnara | 7945c98 | 2012-01-27 09:46:47 +0000 | [diff] [blame] | 3923 | /*HasTemplateKWAndArgsInfo=*/Record[ASTStmtReader::NumExprFields], |
Douglas Gregor | 87866ce | 2011-02-04 12:01:24 +0000 | [diff] [blame] | 3924 | /*NumTemplateArgs=*/Record[ASTStmtReader::NumExprFields] |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 3925 | ? Record[ASTStmtReader::NumExprFields + 1] |
Douglas Gregor | 87866ce | 2011-02-04 12:01:24 +0000 | [diff] [blame] | 3926 | : 0); |
Argyrios Kyrtzidis | bfcacee | 2010-06-24 08:57:31 +0000 | [diff] [blame] | 3927 | break; |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 3928 | |
Sebastian Redl | 539c506 | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 3929 | case EXPR_CXX_UNRESOLVED_LOOKUP: |
Douglas Gregor | 4163aca | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 3930 | S = UnresolvedLookupExpr::CreateEmpty(Context, |
Abramo Bagnara | 7945c98 | 2012-01-27 09:46:47 +0000 | [diff] [blame] | 3931 | /*HasTemplateKWAndArgsInfo=*/Record[ASTStmtReader::NumExprFields], |
Douglas Gregor | 87866ce | 2011-02-04 12:01:24 +0000 | [diff] [blame] | 3932 | /*NumTemplateArgs=*/Record[ASTStmtReader::NumExprFields] |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 3933 | ? Record[ASTStmtReader::NumExprFields + 1] |
Douglas Gregor | 87866ce | 2011-02-04 12:01:24 +0000 | [diff] [blame] | 3934 | : 0); |
Argyrios Kyrtzidis | 58e01ad | 2010-06-25 09:03:34 +0000 | [diff] [blame] | 3935 | break; |
Sebastian Redl | 9ac55dd | 2010-09-10 20:55:54 +0000 | [diff] [blame] | 3936 | |
Douglas Gregor | 29c42f2 | 2012-02-24 07:38:34 +0000 | [diff] [blame] | 3937 | case EXPR_TYPE_TRAIT: |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 3938 | S = TypeTraitExpr::CreateDeserialized(Context, |
Douglas Gregor | 29c42f2 | 2012-02-24 07:38:34 +0000 | [diff] [blame] | 3939 | Record[ASTStmtReader::NumExprFields]); |
| 3940 | break; |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 3941 | |
John Wiegley | 6242b6a | 2011-04-28 00:16:57 +0000 | [diff] [blame] | 3942 | case EXPR_ARRAY_TYPE_TRAIT: |
| 3943 | S = new (Context) ArrayTypeTraitExpr(Empty); |
| 3944 | break; |
| 3945 | |
John Wiegley | f9f6584 | 2011-04-25 06:54:41 +0000 | [diff] [blame] | 3946 | case EXPR_CXX_EXPRESSION_TRAIT: |
| 3947 | S = new (Context) ExpressionTraitExpr(Empty); |
| 3948 | break; |
| 3949 | |
Sebastian Redl | 9ac55dd | 2010-09-10 20:55:54 +0000 | [diff] [blame] | 3950 | case EXPR_CXX_NOEXCEPT: |
| 3951 | S = new (Context) CXXNoexceptExpr(Empty); |
| 3952 | break; |
John McCall | 8d69a21 | 2010-11-15 23:31:06 +0000 | [diff] [blame] | 3953 | |
Douglas Gregor | e8e9dd6 | 2011-01-03 17:17:50 +0000 | [diff] [blame] | 3954 | case EXPR_PACK_EXPANSION: |
| 3955 | S = new (Context) PackExpansionExpr(Empty); |
| 3956 | break; |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 3957 | |
Douglas Gregor | 820ba7b | 2011-01-04 17:33:58 +0000 | [diff] [blame] | 3958 | case EXPR_SIZEOF_PACK: |
Richard Smith | d784e68 | 2015-09-23 21:41:42 +0000 | [diff] [blame] | 3959 | S = SizeOfPackExpr::CreateDeserialized( |
| 3960 | Context, |
| 3961 | /*NumPartialArgs=*/Record[ASTStmtReader::NumExprFields]); |
Douglas Gregor | 820ba7b | 2011-01-04 17:33:58 +0000 | [diff] [blame] | 3962 | break; |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 3963 | |
John McCall | fa19404 | 2011-07-15 07:00:14 +0000 | [diff] [blame] | 3964 | case EXPR_SUBST_NON_TYPE_TEMPLATE_PARM: |
| 3965 | S = new (Context) SubstNonTypeTemplateParmExpr(Empty); |
| 3966 | break; |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 3967 | |
Douglas Gregor | cdbc539 | 2011-01-15 01:15:58 +0000 | [diff] [blame] | 3968 | case EXPR_SUBST_NON_TYPE_TEMPLATE_PARM_PACK: |
| 3969 | S = new (Context) SubstNonTypeTemplateParmPackExpr(Empty); |
| 3970 | break; |
Richard Smith | b15fe3a | 2012-09-12 00:56:43 +0000 | [diff] [blame] | 3971 | |
| 3972 | case EXPR_FUNCTION_PARM_PACK: |
| 3973 | S = FunctionParmPackExpr::CreateEmpty(Context, |
| 3974 | Record[ASTStmtReader::NumExprFields]); |
| 3975 | break; |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 3976 | |
Douglas Gregor | fe31481 | 2011-06-21 17:03:29 +0000 | [diff] [blame] | 3977 | case EXPR_MATERIALIZE_TEMPORARY: |
| 3978 | S = new (Context) MaterializeTemporaryExpr(Empty); |
| 3979 | break; |
Richard Smith | 0f0af19 | 2014-11-08 05:07:16 +0000 | [diff] [blame] | 3980 | |
| 3981 | case EXPR_CXX_FOLD: |
| 3982 | S = new (Context) CXXFoldExpr(Empty); |
| 3983 | break; |
| 3984 | |
Argyrios Kyrtzidis | b2b0795 | 2011-12-03 03:49:52 +0000 | [diff] [blame] | 3985 | case EXPR_OPAQUE_VALUE: |
| 3986 | S = new (Context) OpaqueValueExpr(Empty); |
John McCall | 8d69a21 | 2010-11-15 23:31:06 +0000 | [diff] [blame] | 3987 | break; |
Peter Collingbourne | 41f8546 | 2011-02-09 21:07:24 +0000 | [diff] [blame] | 3988 | |
| 3989 | case EXPR_CUDA_KERNEL_CALL: |
Douglas Gregor | 4163aca | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 3990 | S = new (Context) CUDAKernelCallExpr(Context, Empty); |
Peter Collingbourne | 41f8546 | 2011-02-09 21:07:24 +0000 | [diff] [blame] | 3991 | break; |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 3992 | |
Tanya Lattner | 55808c1 | 2011-06-04 00:47:47 +0000 | [diff] [blame] | 3993 | case EXPR_ASTYPE: |
| 3994 | S = new (Context) AsTypeExpr(Empty); |
| 3995 | break; |
Eli Friedman | df14b3a | 2011-10-11 02:20:01 +0000 | [diff] [blame] | 3996 | |
John McCall | fe96e0b | 2011-11-06 09:01:30 +0000 | [diff] [blame] | 3997 | case EXPR_PSEUDO_OBJECT: { |
| 3998 | unsigned numSemanticExprs = Record[ASTStmtReader::NumExprFields]; |
| 3999 | S = PseudoObjectExpr::Create(Context, Empty, numSemanticExprs); |
| 4000 | break; |
| 4001 | } |
| 4002 | |
Eli Friedman | df14b3a | 2011-10-11 02:20:01 +0000 | [diff] [blame] | 4003 | case EXPR_ATOMIC: |
| 4004 | S = new (Context) AtomicExpr(Empty); |
| 4005 | break; |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 4006 | |
Douglas Gregor | 99ae806 | 2012-02-14 17:54:36 +0000 | [diff] [blame] | 4007 | case EXPR_LAMBDA: { |
| 4008 | unsigned NumCaptures = Record[ASTStmtReader::NumExprFields]; |
Richard Smith | 30e304e | 2016-12-14 00:03:17 +0000 | [diff] [blame] | 4009 | S = LambdaExpr::CreateDeserialized(Context, NumCaptures); |
Douglas Gregor | 99ae806 | 2012-02-14 17:54:36 +0000 | [diff] [blame] | 4010 | break; |
| 4011 | } |
Gor Nishanov | f5ecb5e | 2017-07-25 18:01:49 +0000 | [diff] [blame] | 4012 | |
| 4013 | case STMT_COROUTINE_BODY: { |
| 4014 | unsigned NumParams = Record[ASTStmtReader::NumStmtFields]; |
| 4015 | S = CoroutineBodyStmt::Create(Context, Empty, NumParams); |
| 4016 | break; |
| 4017 | } |
| 4018 | |
| 4019 | case STMT_CORETURN: |
| 4020 | S = new (Context) CoreturnStmt(Empty); |
| 4021 | break; |
| 4022 | |
| 4023 | case EXPR_COAWAIT: |
| 4024 | S = new (Context) CoawaitExpr(Empty); |
| 4025 | break; |
| 4026 | |
| 4027 | case EXPR_COYIELD: |
| 4028 | S = new (Context) CoyieldExpr(Empty); |
| 4029 | break; |
| 4030 | |
| 4031 | case EXPR_DEPENDENT_COAWAIT: |
| 4032 | S = new (Context) DependentCoawaitExpr(Empty); |
| 4033 | break; |
| 4034 | |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 4035 | } |
David L. Jones | c4808b9e | 2016-12-15 20:53:26 +0000 | [diff] [blame] | 4036 | |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 4037 | // We hit a STMT_STOP, so we're done with this expression. |
| 4038 | if (Finished) |
| 4039 | break; |
| 4040 | |
| 4041 | ++NumStatementsRead; |
| 4042 | |
Argyrios Kyrtzidis | 6a59897 | 2011-10-21 23:02:28 +0000 | [diff] [blame] | 4043 | if (S && !IsStmtReference) { |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 4044 | Reader.Visit(S); |
Argyrios Kyrtzidis | 6a59897 | 2011-10-21 23:02:28 +0000 | [diff] [blame] | 4045 | StmtEntries[Cursor.GetCurrentBitNo()] = S; |
| 4046 | } |
| 4047 | |
David L. Jones | be1557a | 2016-12-21 00:17:49 +0000 | [diff] [blame] | 4048 | assert(Record.getIdx() == Record.size() && |
| 4049 | "Invalid deserialization of statement"); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 4050 | StmtStack.push_back(S); |
| 4051 | } |
Chris Lattner | 0e6c940 | 2013-01-20 02:38:54 +0000 | [diff] [blame] | 4052 | Done: |
Alp Toker | 028ed91 | 2013-12-06 17:56:43 +0000 | [diff] [blame] | 4053 | assert(StmtStack.size() > PrevNumStmts && "Read too many sub-stmts!"); |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 4054 | assert(StmtStack.size() == PrevNumStmts + 1 && "Extra expressions on stack!"); |
Argyrios Kyrtzidis | d0795b2 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 4055 | return StmtStack.pop_back_val(); |
Chris Lattner | 92ba5ff | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 4056 | } |