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