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