Sebastian Redl | 904c9c8 | 2010-08-18 23:57:11 +0000 | [diff] [blame] | 1 | //===--- ASTReaderStmt.cpp - Stmt/Expr Deserialization ----------*- C++ -*-===// |
Chris Lattner | 4c6f952 | 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 | c43b54c | 2010-08-18 23:56:43 +0000 | [diff] [blame] | 11 | // ASTReader::ReadStmt method. |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 12 | // |
| 13 | //===----------------------------------------------------------------------===// |
| 14 | |
Sebastian Redl | 6ab7cd8 | 2010-08-18 23:57:17 +0000 | [diff] [blame] | 15 | #include "clang/Serialization/ASTReader.h" |
Douglas Gregor | 39da0b8 | 2009-09-09 23:08:42 +0000 | [diff] [blame] | 16 | #include "clang/AST/DeclCXX.h" |
Douglas Gregor | c7793c7 | 2011-01-15 01:15:58 +0000 | [diff] [blame] | 17 | #include "clang/AST/DeclTemplate.h" |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 18 | #include "clang/AST/StmtVisitor.h" |
Benjamin Kramer | 8fe83e1 | 2012-02-04 13:45:25 +0000 | [diff] [blame] | 19 | #include "llvm/ADT/SmallString.h" |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 20 | using namespace clang; |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 21 | using namespace clang::serialization; |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 22 | |
Argyrios Kyrtzidis | 37bdfe2 | 2010-06-30 08:49:18 +0000 | [diff] [blame] | 23 | namespace clang { |
Argyrios Kyrtzidis | 17cfded | 2010-06-28 09:31:42 +0000 | [diff] [blame] | 24 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 25 | class ASTStmtReader : public StmtVisitor<ASTStmtReader> { |
Douglas Gregor | 409448c | 2011-07-21 22:35:25 +0000 | [diff] [blame] | 26 | typedef ASTReader::RecordData RecordData; |
| 27 | |
Sebastian Redl | c43b54c | 2010-08-18 23:56:43 +0000 | [diff] [blame] | 28 | ASTReader &Reader; |
Douglas Gregor | 1a4761e | 2011-11-30 23:21:26 +0000 | [diff] [blame] | 29 | ModuleFile &F; |
Sebastian Redl | 577d479 | 2010-07-22 22:43:28 +0000 | [diff] [blame] | 30 | llvm::BitstreamCursor &DeclsCursor; |
Sebastian Redl | c43b54c | 2010-08-18 23:56:43 +0000 | [diff] [blame] | 31 | const ASTReader::RecordData &Record; |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 32 | unsigned &Idx; |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 33 | |
Douglas Gregor | 409448c | 2011-07-21 22:35:25 +0000 | [diff] [blame] | 34 | SourceLocation ReadSourceLocation(const RecordData &R, unsigned &I) { |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 35 | return Reader.ReadSourceLocation(F, R, I); |
| 36 | } |
Douglas Gregor | 409448c | 2011-07-21 22:35:25 +0000 | [diff] [blame] | 37 | |
| 38 | SourceRange ReadSourceRange(const RecordData &R, unsigned &I) { |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 39 | return Reader.ReadSourceRange(F, R, I); |
| 40 | } |
Douglas Gregor | 409448c | 2011-07-21 22:35:25 +0000 | [diff] [blame] | 41 | |
| 42 | TypeSourceInfo *GetTypeSourceInfo(const RecordData &R, unsigned &I) { |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 43 | return Reader.GetTypeSourceInfo(F, R, I); |
| 44 | } |
Douglas Gregor | 409448c | 2011-07-21 22:35:25 +0000 | [diff] [blame] | 45 | |
| 46 | serialization::DeclID ReadDeclID(const RecordData &R, unsigned &I) { |
| 47 | return Reader.ReadDeclID(F, R, I); |
| 48 | } |
| 49 | |
| 50 | Decl *ReadDecl(const RecordData &R, unsigned &I) { |
| 51 | return Reader.ReadDecl(F, R, I); |
| 52 | } |
| 53 | |
| 54 | template<typename T> |
| 55 | T *ReadDeclAs(const RecordData &R, unsigned &I) { |
| 56 | return Reader.ReadDeclAs<T>(F, R, I); |
| 57 | } |
| 58 | |
Argyrios Kyrtzidis | 4045107 | 2010-10-15 18:21:24 +0000 | [diff] [blame] | 59 | void ReadDeclarationNameLoc(DeclarationNameLoc &DNLoc, DeclarationName Name, |
| 60 | const ASTReader::RecordData &R, unsigned &I) { |
| 61 | Reader.ReadDeclarationNameLoc(F, DNLoc, Name, R, I); |
| 62 | } |
Douglas Gregor | 409448c | 2011-07-21 22:35:25 +0000 | [diff] [blame] | 63 | |
Argyrios Kyrtzidis | 4045107 | 2010-10-15 18:21:24 +0000 | [diff] [blame] | 64 | void ReadDeclarationNameInfo(DeclarationNameInfo &NameInfo, |
| 65 | const ASTReader::RecordData &R, unsigned &I) { |
| 66 | Reader.ReadDeclarationNameInfo(F, NameInfo, R, I); |
| 67 | } |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 68 | |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 69 | public: |
Douglas Gregor | 1a4761e | 2011-11-30 23:21:26 +0000 | [diff] [blame] | 70 | ASTStmtReader(ASTReader &Reader, ModuleFile &F, |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 71 | llvm::BitstreamCursor &Cursor, |
Sebastian Redl | c43b54c | 2010-08-18 23:56:43 +0000 | [diff] [blame] | 72 | const ASTReader::RecordData &Record, unsigned &Idx) |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 73 | : Reader(Reader), F(F), DeclsCursor(Cursor), Record(Record), Idx(Idx) { } |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 74 | |
| 75 | /// \brief The number of record fields required for the Stmt class |
| 76 | /// itself. |
| 77 | static const unsigned NumStmtFields = 0; |
| 78 | |
| 79 | /// \brief The number of record fields required for the Expr class |
| 80 | /// itself. |
Douglas Gregor | 561f812 | 2011-07-01 01:22:09 +0000 | [diff] [blame] | 81 | static const unsigned NumExprFields = NumStmtFields + 7; |
Abramo Bagnara | e4b9276 | 2012-01-27 09:46:47 +0000 | [diff] [blame] | 82 | |
| 83 | /// \brief Read and initialize a ExplicitTemplateArgumentList structure. |
| 84 | void ReadTemplateKWAndArgsInfo(ASTTemplateKWAndArgsInfo &Args, |
| 85 | unsigned NumTemplateArgs); |
Argyrios Kyrtzidis | 36c76f0 | 2010-06-28 09:31:48 +0000 | [diff] [blame] | 86 | /// \brief Read and initialize a ExplicitTemplateArgumentList structure. |
Argyrios Kyrtzidis | b0c3e09 | 2011-09-22 20:07:03 +0000 | [diff] [blame] | 87 | void ReadExplicitTemplateArgumentList(ASTTemplateArgumentListInfo &ArgList, |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 88 | unsigned NumTemplateArgs); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 89 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 90 | void VisitStmt(Stmt *S); |
John McCall | 7110fd6 | 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 | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 94 | }; |
| 95 | } |
| 96 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 97 | void ASTStmtReader:: |
Abramo Bagnara | e4b9276 | 2012-01-27 09:46:47 +0000 | [diff] [blame] | 98 | ReadTemplateKWAndArgsInfo(ASTTemplateKWAndArgsInfo &Args, |
| 99 | unsigned NumTemplateArgs) { |
| 100 | SourceLocation TemplateKWLoc = ReadSourceLocation(Record, Idx); |
Argyrios Kyrtzidis | 36c76f0 | 2010-06-28 09:31:48 +0000 | [diff] [blame] | 101 | TemplateArgumentListInfo ArgInfo; |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 102 | ArgInfo.setLAngleLoc(ReadSourceLocation(Record, Idx)); |
| 103 | ArgInfo.setRAngleLoc(ReadSourceLocation(Record, Idx)); |
Argyrios Kyrtzidis | 36c76f0 | 2010-06-28 09:31:48 +0000 | [diff] [blame] | 104 | for (unsigned i = 0; i != NumTemplateArgs; ++i) |
Sebastian Redl | 577d479 | 2010-07-22 22:43:28 +0000 | [diff] [blame] | 105 | ArgInfo.addArgument( |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 106 | Reader.ReadTemplateArgumentLoc(F, Record, Idx)); |
Abramo Bagnara | e4b9276 | 2012-01-27 09:46:47 +0000 | [diff] [blame] | 107 | Args.initializeFrom(TemplateKWLoc, ArgInfo); |
Argyrios Kyrtzidis | 36c76f0 | 2010-06-28 09:31:48 +0000 | [diff] [blame] | 108 | } |
| 109 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 110 | void ASTStmtReader::VisitStmt(Stmt *S) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 111 | assert(Idx == NumStmtFields && "Incorrect statement field count"); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 112 | } |
| 113 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 114 | void ASTStmtReader::VisitNullStmt(NullStmt *S) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 115 | VisitStmt(S); |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 116 | S->setSemiLoc(ReadSourceLocation(Record, Idx)); |
Argyrios Kyrtzidis | e2ca828 | 2011-09-01 21:53:45 +0000 | [diff] [blame] | 117 | S->HasLeadingEmptyMacro = Record[Idx++]; |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 118 | } |
| 119 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 120 | void ASTStmtReader::VisitCompoundStmt(CompoundStmt *S) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 121 | VisitStmt(S); |
Chris Lattner | 5f9e272 | 2011-07-23 10:55:15 +0000 | [diff] [blame] | 122 | SmallVector<Stmt *, 16> Stmts; |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 123 | unsigned NumStmts = Record[Idx++]; |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 124 | while (NumStmts--) |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 125 | Stmts.push_back(Reader.ReadSubStmt()); |
Douglas Gregor | 3594277 | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 126 | S->setStmts(Reader.getContext(), Stmts.data(), Stmts.size()); |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 127 | S->setLBracLoc(ReadSourceLocation(Record, Idx)); |
| 128 | S->setRBracLoc(ReadSourceLocation(Record, Idx)); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 129 | } |
| 130 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 131 | void ASTStmtReader::VisitSwitchCase(SwitchCase *S) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 132 | VisitStmt(S); |
| 133 | Reader.RecordSwitchCaseID(S, Record[Idx++]); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 134 | } |
| 135 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 136 | void ASTStmtReader::VisitCaseStmt(CaseStmt *S) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 137 | VisitSwitchCase(S); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 138 | S->setLHS(Reader.ReadSubExpr()); |
| 139 | S->setRHS(Reader.ReadSubExpr()); |
| 140 | S->setSubStmt(Reader.ReadSubStmt()); |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 141 | S->setCaseLoc(ReadSourceLocation(Record, Idx)); |
| 142 | S->setEllipsisLoc(ReadSourceLocation(Record, Idx)); |
| 143 | S->setColonLoc(ReadSourceLocation(Record, Idx)); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 144 | } |
| 145 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 146 | void ASTStmtReader::VisitDefaultStmt(DefaultStmt *S) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 147 | VisitSwitchCase(S); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 148 | S->setSubStmt(Reader.ReadSubStmt()); |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 149 | S->setDefaultLoc(ReadSourceLocation(Record, Idx)); |
| 150 | S->setColonLoc(ReadSourceLocation(Record, Idx)); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 151 | } |
| 152 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 153 | void ASTStmtReader::VisitLabelStmt(LabelStmt *S) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 154 | VisitStmt(S); |
Douglas Gregor | 409448c | 2011-07-21 22:35:25 +0000 | [diff] [blame] | 155 | LabelDecl *LD = ReadDeclAs<LabelDecl>(Record, Idx); |
Chris Lattner | ad8dcf4 | 2011-02-17 07:39:24 +0000 | [diff] [blame] | 156 | LD->setStmt(S); |
| 157 | S->setDecl(LD); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 158 | S->setSubStmt(Reader.ReadSubStmt()); |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 159 | S->setIdentLoc(ReadSourceLocation(Record, Idx)); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 160 | } |
| 161 | |
Richard Smith | 534986f | 2012-04-14 00:33:13 +0000 | [diff] [blame] | 162 | void ASTStmtReader::VisitAttributedStmt(AttributedStmt *S) { |
| 163 | VisitStmt(S); |
| 164 | AttrVec Attrs; |
| 165 | Reader.ReadAttributes(F, Attrs, Record, Idx); |
| 166 | S->Attrs = Attrs; |
| 167 | S->SubStmt = Reader.ReadSubStmt(); |
| 168 | S->AttrLoc = ReadSourceLocation(Record, Idx); |
| 169 | } |
| 170 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 171 | void ASTStmtReader::VisitIfStmt(IfStmt *S) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 172 | VisitStmt(S); |
Richard Smith | 534986f | 2012-04-14 00:33:13 +0000 | [diff] [blame] | 173 | S->setConditionVariable(Reader.getContext(), |
Douglas Gregor | 409448c | 2011-07-21 22:35:25 +0000 | [diff] [blame] | 174 | ReadDeclAs<VarDecl>(Record, Idx)); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 175 | S->setCond(Reader.ReadSubExpr()); |
| 176 | S->setThen(Reader.ReadSubStmt()); |
| 177 | S->setElse(Reader.ReadSubStmt()); |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 178 | S->setIfLoc(ReadSourceLocation(Record, Idx)); |
| 179 | S->setElseLoc(ReadSourceLocation(Record, Idx)); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 180 | } |
| 181 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 182 | void ASTStmtReader::VisitSwitchStmt(SwitchStmt *S) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 183 | VisitStmt(S); |
Douglas Gregor | 3594277 | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 184 | S->setConditionVariable(Reader.getContext(), |
Douglas Gregor | 409448c | 2011-07-21 22:35:25 +0000 | [diff] [blame] | 185 | ReadDeclAs<VarDecl>(Record, Idx)); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 186 | S->setCond(Reader.ReadSubExpr()); |
| 187 | S->setBody(Reader.ReadSubStmt()); |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 188 | S->setSwitchLoc(ReadSourceLocation(Record, Idx)); |
Ted Kremenek | 559fb55 | 2010-09-09 00:05:53 +0000 | [diff] [blame] | 189 | if (Record[Idx++]) |
| 190 | S->setAllEnumCasesCovered(); |
| 191 | |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 192 | SwitchCase *PrevSC = 0; |
| 193 | for (unsigned N = Record.size(); Idx != N; ++Idx) { |
| 194 | SwitchCase *SC = Reader.getSwitchCaseWithID(Record[Idx]); |
| 195 | if (PrevSC) |
| 196 | PrevSC->setNextSwitchCase(SC); |
| 197 | else |
| 198 | S->setSwitchCaseList(SC); |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 199 | |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 200 | PrevSC = SC; |
| 201 | } |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 202 | } |
| 203 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 204 | void ASTStmtReader::VisitWhileStmt(WhileStmt *S) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 205 | VisitStmt(S); |
Douglas Gregor | 3594277 | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 206 | S->setConditionVariable(Reader.getContext(), |
Douglas Gregor | 409448c | 2011-07-21 22:35:25 +0000 | [diff] [blame] | 207 | ReadDeclAs<VarDecl>(Record, Idx)); |
| 208 | |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 209 | S->setCond(Reader.ReadSubExpr()); |
| 210 | S->setBody(Reader.ReadSubStmt()); |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 211 | S->setWhileLoc(ReadSourceLocation(Record, Idx)); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 212 | } |
| 213 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 214 | void ASTStmtReader::VisitDoStmt(DoStmt *S) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 215 | VisitStmt(S); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 216 | S->setCond(Reader.ReadSubExpr()); |
| 217 | S->setBody(Reader.ReadSubStmt()); |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 218 | S->setDoLoc(ReadSourceLocation(Record, Idx)); |
| 219 | S->setWhileLoc(ReadSourceLocation(Record, Idx)); |
| 220 | S->setRParenLoc(ReadSourceLocation(Record, Idx)); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 221 | } |
| 222 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 223 | void ASTStmtReader::VisitForStmt(ForStmt *S) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 224 | VisitStmt(S); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 225 | S->setInit(Reader.ReadSubStmt()); |
| 226 | S->setCond(Reader.ReadSubExpr()); |
Douglas Gregor | 3594277 | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 227 | S->setConditionVariable(Reader.getContext(), |
Douglas Gregor | 409448c | 2011-07-21 22:35:25 +0000 | [diff] [blame] | 228 | ReadDeclAs<VarDecl>(Record, Idx)); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 229 | S->setInc(Reader.ReadSubExpr()); |
| 230 | S->setBody(Reader.ReadSubStmt()); |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 231 | S->setForLoc(ReadSourceLocation(Record, Idx)); |
| 232 | S->setLParenLoc(ReadSourceLocation(Record, Idx)); |
| 233 | S->setRParenLoc(ReadSourceLocation(Record, Idx)); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 234 | } |
| 235 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 236 | void ASTStmtReader::VisitGotoStmt(GotoStmt *S) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 237 | VisitStmt(S); |
Douglas Gregor | 409448c | 2011-07-21 22:35:25 +0000 | [diff] [blame] | 238 | S->setLabel(ReadDeclAs<LabelDecl>(Record, Idx)); |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 239 | S->setGotoLoc(ReadSourceLocation(Record, Idx)); |
| 240 | S->setLabelLoc(ReadSourceLocation(Record, Idx)); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 241 | } |
| 242 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 243 | void ASTStmtReader::VisitIndirectGotoStmt(IndirectGotoStmt *S) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 244 | VisitStmt(S); |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 245 | S->setGotoLoc(ReadSourceLocation(Record, Idx)); |
| 246 | S->setStarLoc(ReadSourceLocation(Record, Idx)); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 247 | S->setTarget(Reader.ReadSubExpr()); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 248 | } |
| 249 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 250 | void ASTStmtReader::VisitContinueStmt(ContinueStmt *S) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 251 | VisitStmt(S); |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 252 | S->setContinueLoc(ReadSourceLocation(Record, Idx)); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 253 | } |
| 254 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 255 | void ASTStmtReader::VisitBreakStmt(BreakStmt *S) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 256 | VisitStmt(S); |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 257 | S->setBreakLoc(ReadSourceLocation(Record, Idx)); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 258 | } |
| 259 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 260 | void ASTStmtReader::VisitReturnStmt(ReturnStmt *S) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 261 | VisitStmt(S); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 262 | S->setRetValue(Reader.ReadSubExpr()); |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 263 | S->setReturnLoc(ReadSourceLocation(Record, Idx)); |
Douglas Gregor | 409448c | 2011-07-21 22:35:25 +0000 | [diff] [blame] | 264 | S->setNRVOCandidate(ReadDeclAs<VarDecl>(Record, Idx)); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 265 | } |
| 266 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 267 | void ASTStmtReader::VisitDeclStmt(DeclStmt *S) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 268 | VisitStmt(S); |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 269 | S->setStartLoc(ReadSourceLocation(Record, Idx)); |
| 270 | S->setEndLoc(ReadSourceLocation(Record, Idx)); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 271 | |
| 272 | if (Idx + 1 == Record.size()) { |
| 273 | // Single declaration |
Douglas Gregor | 409448c | 2011-07-21 22:35:25 +0000 | [diff] [blame] | 274 | S->setDeclGroup(DeclGroupRef(ReadDecl(Record, Idx))); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 275 | } else { |
Chris Lattner | 5f9e272 | 2011-07-23 10:55:15 +0000 | [diff] [blame] | 276 | SmallVector<Decl *, 16> Decls; |
Douglas Gregor | 409448c | 2011-07-21 22:35:25 +0000 | [diff] [blame] | 277 | Decls.reserve(Record.size() - Idx); |
| 278 | for (unsigned N = Record.size(); Idx != N; ) |
| 279 | Decls.push_back(ReadDecl(Record, Idx)); |
Douglas Gregor | 3594277 | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 280 | S->setDeclGroup(DeclGroupRef(DeclGroup::Create(Reader.getContext(), |
Douglas Gregor | 75fdb23 | 2009-05-22 22:45:36 +0000 | [diff] [blame] | 281 | Decls.data(), |
| 282 | Decls.size()))); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 283 | } |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 284 | } |
| 285 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 286 | void ASTStmtReader::VisitAsmStmt(AsmStmt *S) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 287 | VisitStmt(S); |
| 288 | unsigned NumOutputs = Record[Idx++]; |
| 289 | unsigned NumInputs = Record[Idx++]; |
| 290 | unsigned NumClobbers = Record[Idx++]; |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 291 | S->setAsmLoc(ReadSourceLocation(Record, Idx)); |
| 292 | S->setRParenLoc(ReadSourceLocation(Record, Idx)); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 293 | S->setVolatile(Record[Idx++]); |
| 294 | S->setSimple(Record[Idx++]); |
Mike Stump | 3b11fd3 | 2010-01-04 22:37:17 +0000 | [diff] [blame] | 295 | S->setMSAsm(Record[Idx++]); |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 296 | |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 297 | S->setAsmString(cast_or_null<StringLiteral>(Reader.ReadSubStmt())); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 298 | |
| 299 | // Outputs and inputs |
Chris Lattner | 5f9e272 | 2011-07-23 10:55:15 +0000 | [diff] [blame] | 300 | SmallVector<IdentifierInfo *, 16> Names; |
| 301 | SmallVector<StringLiteral*, 16> Constraints; |
| 302 | SmallVector<Stmt*, 16> Exprs; |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 303 | for (unsigned I = 0, N = NumOutputs + NumInputs; I != N; ++I) { |
Douglas Gregor | 95eab17 | 2011-07-28 20:55:49 +0000 | [diff] [blame] | 304 | Names.push_back(Reader.GetIdentifierInfo(F, Record, Idx)); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 305 | Constraints.push_back(cast_or_null<StringLiteral>(Reader.ReadSubStmt())); |
| 306 | Exprs.push_back(Reader.ReadSubStmt()); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 307 | } |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 308 | |
| 309 | // Constraints |
Chris Lattner | 5f9e272 | 2011-07-23 10:55:15 +0000 | [diff] [blame] | 310 | SmallVector<StringLiteral*, 16> Clobbers; |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 311 | for (unsigned I = 0; I != NumClobbers; ++I) |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 312 | Clobbers.push_back(cast_or_null<StringLiteral>(Reader.ReadSubStmt())); |
Anders Carlsson | fdba9c0 | 2010-01-30 19:34:25 +0000 | [diff] [blame] | 313 | |
Douglas Gregor | 3594277 | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 314 | S->setOutputsAndInputsAndClobbers(Reader.getContext(), |
Anders Carlsson | acb6bcb | 2010-01-30 20:38:10 +0000 | [diff] [blame] | 315 | Names.data(), Constraints.data(), |
Anders Carlsson | fdba9c0 | 2010-01-30 19:34:25 +0000 | [diff] [blame] | 316 | Exprs.data(), NumOutputs, NumInputs, |
| 317 | Clobbers.data(), NumClobbers); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 318 | } |
| 319 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 320 | void ASTStmtReader::VisitExpr(Expr *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 321 | VisitStmt(E); |
Douglas Gregor | 393f249 | 2011-07-22 00:38:23 +0000 | [diff] [blame] | 322 | E->setType(Reader.readType(F, Record, Idx)); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 323 | E->setTypeDependent(Record[Idx++]); |
| 324 | E->setValueDependent(Record[Idx++]); |
Douglas Gregor | 561f812 | 2011-07-01 01:22:09 +0000 | [diff] [blame] | 325 | E->setInstantiationDependent(Record[Idx++]); |
Douglas Gregor | d093722 | 2010-12-13 22:49:22 +0000 | [diff] [blame] | 326 | E->ExprBits.ContainsUnexpandedParameterPack = Record[Idx++]; |
John McCall | f89e55a | 2010-11-18 06:31:45 +0000 | [diff] [blame] | 327 | E->setValueKind(static_cast<ExprValueKind>(Record[Idx++])); |
| 328 | E->setObjectKind(static_cast<ExprObjectKind>(Record[Idx++])); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 329 | assert(Idx == NumExprFields && "Incorrect expression field count"); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 330 | } |
| 331 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 332 | void ASTStmtReader::VisitPredefinedExpr(PredefinedExpr *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 333 | VisitExpr(E); |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 334 | E->setLocation(ReadSourceLocation(Record, Idx)); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 335 | E->setIdentType((PredefinedExpr::IdentType)Record[Idx++]); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 336 | } |
| 337 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 338 | void ASTStmtReader::VisitDeclRefExpr(DeclRefExpr *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 339 | VisitExpr(E); |
Argyrios Kyrtzidis | 663e380 | 2010-07-08 13:09:47 +0000 | [diff] [blame] | 340 | |
Chandler Carruth | cb66cff | 2011-05-01 21:29:53 +0000 | [diff] [blame] | 341 | E->DeclRefExprBits.HasQualifier = Record[Idx++]; |
Chandler Carruth | 3aa8140 | 2011-05-01 23:48:14 +0000 | [diff] [blame] | 342 | E->DeclRefExprBits.HasFoundDecl = Record[Idx++]; |
Abramo Bagnara | e4b9276 | 2012-01-27 09:46:47 +0000 | [diff] [blame] | 343 | E->DeclRefExprBits.HasTemplateKWAndArgsInfo = Record[Idx++]; |
Abramo Bagnara | 7cc58b4 | 2011-10-05 07:56:41 +0000 | [diff] [blame] | 344 | E->DeclRefExprBits.HadMultipleCandidates = Record[Idx++]; |
John McCall | f4b88a4 | 2012-03-10 09:33:50 +0000 | [diff] [blame] | 345 | E->DeclRefExprBits.RefersToEnclosingLocal = Record[Idx++]; |
Anders Carlsson | b0ca137 | 2011-03-06 18:19:42 +0000 | [diff] [blame] | 346 | unsigned NumTemplateArgs = 0; |
Abramo Bagnara | e4b9276 | 2012-01-27 09:46:47 +0000 | [diff] [blame] | 347 | if (E->hasTemplateKWAndArgsInfo()) |
Anders Carlsson | b0ca137 | 2011-03-06 18:19:42 +0000 | [diff] [blame] | 348 | NumTemplateArgs = Record[Idx++]; |
| 349 | |
Chandler Carruth | cb66cff | 2011-05-01 21:29:53 +0000 | [diff] [blame] | 350 | if (E->hasQualifier()) |
Chandler Carruth | 6857c3e | 2011-05-01 22:14:37 +0000 | [diff] [blame] | 351 | E->getInternalQualifierLoc() |
Douglas Gregor | 40d96a6 | 2011-02-28 21:54:11 +0000 | [diff] [blame] | 352 | = Reader.ReadNestedNameSpecifierLoc(F, Record, Idx); |
Argyrios Kyrtzidis | 663e380 | 2010-07-08 13:09:47 +0000 | [diff] [blame] | 353 | |
Chandler Carruth | 3aa8140 | 2011-05-01 23:48:14 +0000 | [diff] [blame] | 354 | if (E->hasFoundDecl()) |
Douglas Gregor | 409448c | 2011-07-21 22:35:25 +0000 | [diff] [blame] | 355 | E->getInternalFoundDecl() = ReadDeclAs<NamedDecl>(Record, Idx); |
Chandler Carruth | 3aa8140 | 2011-05-01 23:48:14 +0000 | [diff] [blame] | 356 | |
Abramo Bagnara | e4b9276 | 2012-01-27 09:46:47 +0000 | [diff] [blame] | 357 | if (E->hasTemplateKWAndArgsInfo()) |
| 358 | ReadTemplateKWAndArgsInfo(*E->getTemplateKWAndArgsInfo(), |
| 359 | NumTemplateArgs); |
Argyrios Kyrtzidis | 663e380 | 2010-07-08 13:09:47 +0000 | [diff] [blame] | 360 | |
Douglas Gregor | 409448c | 2011-07-21 22:35:25 +0000 | [diff] [blame] | 361 | E->setDecl(ReadDeclAs<ValueDecl>(Record, Idx)); |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 362 | E->setLocation(ReadSourceLocation(Record, Idx)); |
Argyrios Kyrtzidis | 4045107 | 2010-10-15 18:21:24 +0000 | [diff] [blame] | 363 | ReadDeclarationNameLoc(E->DNLoc, E->getDecl()->getDeclName(), Record, Idx); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 364 | } |
| 365 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 366 | void ASTStmtReader::VisitIntegerLiteral(IntegerLiteral *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 367 | VisitExpr(E); |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 368 | E->setLocation(ReadSourceLocation(Record, Idx)); |
Douglas Gregor | 3594277 | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 369 | E->setValue(Reader.getContext(), Reader.ReadAPInt(Record, Idx)); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 370 | } |
| 371 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 372 | void ASTStmtReader::VisitFloatingLiteral(FloatingLiteral *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 373 | VisitExpr(E); |
Douglas Gregor | 3594277 | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 374 | E->setValue(Reader.getContext(), Reader.ReadAPFloat(Record, Idx)); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 375 | E->setExact(Record[Idx++]); |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 376 | E->setLocation(ReadSourceLocation(Record, Idx)); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 377 | } |
| 378 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 379 | void ASTStmtReader::VisitImaginaryLiteral(ImaginaryLiteral *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 380 | VisitExpr(E); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 381 | E->setSubExpr(Reader.ReadSubExpr()); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 382 | } |
| 383 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 384 | void ASTStmtReader::VisitStringLiteral(StringLiteral *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 385 | VisitExpr(E); |
| 386 | unsigned Len = Record[Idx++]; |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 387 | assert(Record[Idx] == E->getNumConcatenated() && |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 388 | "Wrong number of concatenated tokens!"); |
| 389 | ++Idx; |
Eli Friedman | 64f45a2 | 2011-11-01 02:23:42 +0000 | [diff] [blame] | 390 | StringLiteral::StringKind kind = |
| 391 | static_cast<StringLiteral::StringKind>(Record[Idx++]); |
| 392 | bool isPascal = Record[Idx++]; |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 393 | |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 394 | // Read string data |
Dylan Noblesmith | f7ccbad | 2012-02-05 02:13:05 +0000 | [diff] [blame] | 395 | SmallString<16> Str(&Record[Idx], &Record[Idx] + Len); |
Eli Friedman | 64f45a2 | 2011-11-01 02:23:42 +0000 | [diff] [blame] | 396 | E->setString(Reader.getContext(), Str.str(), kind, isPascal); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 397 | Idx += Len; |
| 398 | |
| 399 | // Read source locations |
| 400 | for (unsigned I = 0, N = E->getNumConcatenated(); I != N; ++I) |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 401 | E->setStrTokenLoc(I, ReadSourceLocation(Record, Idx)); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 402 | } |
| 403 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 404 | void ASTStmtReader::VisitCharacterLiteral(CharacterLiteral *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 405 | VisitExpr(E); |
| 406 | E->setValue(Record[Idx++]); |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 407 | E->setLocation(ReadSourceLocation(Record, Idx)); |
Douglas Gregor | 5cee119 | 2011-07-27 05:40:30 +0000 | [diff] [blame] | 408 | E->setKind(static_cast<CharacterLiteral::CharacterKind>(Record[Idx++])); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 409 | } |
| 410 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 411 | void ASTStmtReader::VisitParenExpr(ParenExpr *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 412 | VisitExpr(E); |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 413 | E->setLParen(ReadSourceLocation(Record, Idx)); |
| 414 | E->setRParen(ReadSourceLocation(Record, Idx)); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 415 | E->setSubExpr(Reader.ReadSubExpr()); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 416 | } |
| 417 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 418 | void ASTStmtReader::VisitParenListExpr(ParenListExpr *E) { |
Argyrios Kyrtzidis | 37bdfe2 | 2010-06-30 08:49:18 +0000 | [diff] [blame] | 419 | VisitExpr(E); |
| 420 | unsigned NumExprs = Record[Idx++]; |
Douglas Gregor | 3594277 | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 421 | E->Exprs = new (Reader.getContext()) Stmt*[NumExprs]; |
Argyrios Kyrtzidis | 37bdfe2 | 2010-06-30 08:49:18 +0000 | [diff] [blame] | 422 | for (unsigned i = 0; i != NumExprs; ++i) |
| 423 | E->Exprs[i] = Reader.ReadSubStmt(); |
| 424 | E->NumExprs = NumExprs; |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 425 | E->LParenLoc = ReadSourceLocation(Record, Idx); |
| 426 | E->RParenLoc = ReadSourceLocation(Record, Idx); |
Argyrios Kyrtzidis | 37bdfe2 | 2010-06-30 08:49:18 +0000 | [diff] [blame] | 427 | } |
| 428 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 429 | void ASTStmtReader::VisitUnaryOperator(UnaryOperator *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 430 | VisitExpr(E); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 431 | E->setSubExpr(Reader.ReadSubExpr()); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 432 | E->setOpcode((UnaryOperator::Opcode)Record[Idx++]); |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 433 | E->setOperatorLoc(ReadSourceLocation(Record, Idx)); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 434 | } |
| 435 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 436 | void ASTStmtReader::VisitOffsetOfExpr(OffsetOfExpr *E) { |
Douglas Gregor | 8ecdb65 | 2010-04-28 22:16:22 +0000 | [diff] [blame] | 437 | typedef OffsetOfExpr::OffsetOfNode Node; |
| 438 | VisitExpr(E); |
| 439 | assert(E->getNumComponents() == Record[Idx]); |
| 440 | ++Idx; |
| 441 | assert(E->getNumExpressions() == Record[Idx]); |
| 442 | ++Idx; |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 443 | E->setOperatorLoc(ReadSourceLocation(Record, Idx)); |
| 444 | E->setRParenLoc(ReadSourceLocation(Record, Idx)); |
| 445 | E->setTypeSourceInfo(GetTypeSourceInfo(Record, Idx)); |
Douglas Gregor | 8ecdb65 | 2010-04-28 22:16:22 +0000 | [diff] [blame] | 446 | for (unsigned I = 0, N = E->getNumComponents(); I != N; ++I) { |
| 447 | Node::Kind Kind = static_cast<Node::Kind>(Record[Idx++]); |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 448 | SourceLocation Start = ReadSourceLocation(Record, Idx); |
| 449 | SourceLocation End = ReadSourceLocation(Record, Idx); |
Douglas Gregor | 8ecdb65 | 2010-04-28 22:16:22 +0000 | [diff] [blame] | 450 | switch (Kind) { |
| 451 | case Node::Array: |
| 452 | E->setComponent(I, Node(Start, Record[Idx++], End)); |
| 453 | break; |
| 454 | |
| 455 | case Node::Field: |
Douglas Gregor | 409448c | 2011-07-21 22:35:25 +0000 | [diff] [blame] | 456 | E->setComponent(I, Node(Start, ReadDeclAs<FieldDecl>(Record, Idx), End)); |
Douglas Gregor | 8ecdb65 | 2010-04-28 22:16:22 +0000 | [diff] [blame] | 457 | break; |
| 458 | |
| 459 | case Node::Identifier: |
Douglas Gregor | 95eab17 | 2011-07-28 20:55:49 +0000 | [diff] [blame] | 460 | E->setComponent(I, |
| 461 | Node(Start, |
| 462 | Reader.GetIdentifierInfo(F, Record, Idx), |
| 463 | End)); |
Douglas Gregor | 8ecdb65 | 2010-04-28 22:16:22 +0000 | [diff] [blame] | 464 | break; |
Douglas Gregor | cc8a5d5 | 2010-04-29 00:18:15 +0000 | [diff] [blame] | 465 | |
Argyrios Kyrtzidis | afbf312 | 2010-07-29 18:16:10 +0000 | [diff] [blame] | 466 | case Node::Base: { |
Douglas Gregor | 3594277 | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 467 | CXXBaseSpecifier *Base = new (Reader.getContext()) CXXBaseSpecifier(); |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 468 | *Base = Reader.ReadCXXBaseSpecifier(F, Record, Idx); |
Argyrios Kyrtzidis | afbf312 | 2010-07-29 18:16:10 +0000 | [diff] [blame] | 469 | E->setComponent(I, Node(Base)); |
Douglas Gregor | cc8a5d5 | 2010-04-29 00:18:15 +0000 | [diff] [blame] | 470 | break; |
Douglas Gregor | 8ecdb65 | 2010-04-28 22:16:22 +0000 | [diff] [blame] | 471 | } |
Argyrios Kyrtzidis | afbf312 | 2010-07-29 18:16:10 +0000 | [diff] [blame] | 472 | } |
Douglas Gregor | 8ecdb65 | 2010-04-28 22:16:22 +0000 | [diff] [blame] | 473 | } |
| 474 | |
| 475 | for (unsigned I = 0, N = E->getNumExpressions(); I != N; ++I) |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 476 | E->setIndexExpr(I, Reader.ReadSubExpr()); |
Douglas Gregor | 8ecdb65 | 2010-04-28 22:16:22 +0000 | [diff] [blame] | 477 | } |
| 478 | |
Peter Collingbourne | f4e3cfb | 2011-03-11 19:24:49 +0000 | [diff] [blame] | 479 | void ASTStmtReader::VisitUnaryExprOrTypeTraitExpr(UnaryExprOrTypeTraitExpr *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 480 | VisitExpr(E); |
Peter Collingbourne | f4e3cfb | 2011-03-11 19:24:49 +0000 | [diff] [blame] | 481 | E->setKind(static_cast<UnaryExprOrTypeTrait>(Record[Idx++])); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 482 | if (Record[Idx] == 0) { |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 483 | E->setArgument(Reader.ReadSubExpr()); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 484 | ++Idx; |
| 485 | } else { |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 486 | E->setArgument(GetTypeSourceInfo(Record, Idx)); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 487 | } |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 488 | E->setOperatorLoc(ReadSourceLocation(Record, Idx)); |
| 489 | E->setRParenLoc(ReadSourceLocation(Record, Idx)); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 490 | } |
| 491 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 492 | void ASTStmtReader::VisitArraySubscriptExpr(ArraySubscriptExpr *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 493 | VisitExpr(E); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 494 | E->setLHS(Reader.ReadSubExpr()); |
| 495 | E->setRHS(Reader.ReadSubExpr()); |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 496 | E->setRBracketLoc(ReadSourceLocation(Record, Idx)); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 497 | } |
| 498 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 499 | void ASTStmtReader::VisitCallExpr(CallExpr *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 500 | VisitExpr(E); |
Douglas Gregor | 3594277 | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 501 | E->setNumArgs(Reader.getContext(), Record[Idx++]); |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 502 | E->setRParenLoc(ReadSourceLocation(Record, Idx)); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 503 | E->setCallee(Reader.ReadSubExpr()); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 504 | for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I) |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 505 | E->setArg(I, Reader.ReadSubExpr()); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 506 | } |
| 507 | |
John McCall | 7110fd6 | 2011-07-15 07:00:14 +0000 | [diff] [blame] | 508 | void ASTStmtReader::VisitCXXMemberCallExpr(CXXMemberCallExpr *E) { |
| 509 | VisitCallExpr(E); |
| 510 | } |
| 511 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 512 | void ASTStmtReader::VisitMemberExpr(MemberExpr *E) { |
Argyrios Kyrtzidis | 663e380 | 2010-07-08 13:09:47 +0000 | [diff] [blame] | 513 | // Don't call VisitExpr, this is fully initialized at creation. |
| 514 | assert(E->getStmtClass() == Stmt::MemberExprClass && |
| 515 | "It's a subclass, we must advance Idx!"); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 516 | } |
| 517 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 518 | void ASTStmtReader::VisitObjCIsaExpr(ObjCIsaExpr *E) { |
Steve Naroff | f242b1b | 2009-07-24 17:54:45 +0000 | [diff] [blame] | 519 | VisitExpr(E); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 520 | E->setBase(Reader.ReadSubExpr()); |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 521 | E->setIsaMemberLoc(ReadSourceLocation(Record, Idx)); |
Steve Naroff | f242b1b | 2009-07-24 17:54:45 +0000 | [diff] [blame] | 522 | E->setArrow(Record[Idx++]); |
Steve Naroff | f242b1b | 2009-07-24 17:54:45 +0000 | [diff] [blame] | 523 | } |
| 524 | |
John McCall | f85e193 | 2011-06-15 23:02:42 +0000 | [diff] [blame] | 525 | void ASTStmtReader:: |
| 526 | VisitObjCIndirectCopyRestoreExpr(ObjCIndirectCopyRestoreExpr *E) { |
| 527 | VisitExpr(E); |
| 528 | E->Operand = Reader.ReadSubExpr(); |
| 529 | E->setShouldCopy(Record[Idx++]); |
| 530 | } |
| 531 | |
| 532 | void ASTStmtReader::VisitObjCBridgedCastExpr(ObjCBridgedCastExpr *E) { |
| 533 | VisitExplicitCastExpr(E); |
| 534 | E->LParenLoc = ReadSourceLocation(Record, Idx); |
| 535 | E->BridgeKeywordLoc = ReadSourceLocation(Record, Idx); |
| 536 | E->Kind = Record[Idx++]; |
| 537 | } |
| 538 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 539 | void ASTStmtReader::VisitCastExpr(CastExpr *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 540 | VisitExpr(E); |
John McCall | f871d0c | 2010-08-07 06:22:56 +0000 | [diff] [blame] | 541 | unsigned NumBaseSpecs = Record[Idx++]; |
| 542 | assert(NumBaseSpecs == E->path_size()); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 543 | E->setSubExpr(Reader.ReadSubExpr()); |
Anders Carlsson | cdef2b7 | 2009-07-31 00:48:10 +0000 | [diff] [blame] | 544 | E->setCastKind((CastExpr::CastKind)Record[Idx++]); |
John McCall | f871d0c | 2010-08-07 06:22:56 +0000 | [diff] [blame] | 545 | CastExpr::path_iterator BaseI = E->path_begin(); |
Argyrios Kyrtzidis | 0745d0a | 2010-07-02 23:30:27 +0000 | [diff] [blame] | 546 | while (NumBaseSpecs--) { |
Douglas Gregor | 3594277 | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 547 | CXXBaseSpecifier *BaseSpec = new (Reader.getContext()) CXXBaseSpecifier; |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 548 | *BaseSpec = Reader.ReadCXXBaseSpecifier(F, Record, Idx); |
John McCall | f871d0c | 2010-08-07 06:22:56 +0000 | [diff] [blame] | 549 | *BaseI++ = BaseSpec; |
Argyrios Kyrtzidis | 0745d0a | 2010-07-02 23:30:27 +0000 | [diff] [blame] | 550 | } |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 551 | } |
| 552 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 553 | void ASTStmtReader::VisitBinaryOperator(BinaryOperator *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 554 | VisitExpr(E); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 555 | E->setLHS(Reader.ReadSubExpr()); |
| 556 | E->setRHS(Reader.ReadSubExpr()); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 557 | E->setOpcode((BinaryOperator::Opcode)Record[Idx++]); |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 558 | E->setOperatorLoc(ReadSourceLocation(Record, Idx)); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 559 | } |
| 560 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 561 | void ASTStmtReader::VisitCompoundAssignOperator(CompoundAssignOperator *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 562 | VisitBinaryOperator(E); |
Douglas Gregor | 393f249 | 2011-07-22 00:38:23 +0000 | [diff] [blame] | 563 | E->setComputationLHSType(Reader.readType(F, Record, Idx)); |
| 564 | E->setComputationResultType(Reader.readType(F, Record, Idx)); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 565 | } |
| 566 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 567 | void ASTStmtReader::VisitConditionalOperator(ConditionalOperator *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 568 | VisitExpr(E); |
John McCall | 56ca35d | 2011-02-17 10:25:35 +0000 | [diff] [blame] | 569 | E->SubExprs[ConditionalOperator::COND] = Reader.ReadSubExpr(); |
| 570 | E->SubExprs[ConditionalOperator::LHS] = Reader.ReadSubExpr(); |
| 571 | E->SubExprs[ConditionalOperator::RHS] = Reader.ReadSubExpr(); |
| 572 | E->QuestionLoc = ReadSourceLocation(Record, Idx); |
| 573 | E->ColonLoc = ReadSourceLocation(Record, Idx); |
| 574 | } |
| 575 | |
| 576 | void |
| 577 | ASTStmtReader::VisitBinaryConditionalOperator(BinaryConditionalOperator *E) { |
| 578 | VisitExpr(E); |
| 579 | E->OpaqueValue = cast<OpaqueValueExpr>(Reader.ReadSubExpr()); |
| 580 | E->SubExprs[BinaryConditionalOperator::COMMON] = Reader.ReadSubExpr(); |
| 581 | E->SubExprs[BinaryConditionalOperator::COND] = Reader.ReadSubExpr(); |
| 582 | E->SubExprs[BinaryConditionalOperator::LHS] = Reader.ReadSubExpr(); |
| 583 | E->SubExprs[BinaryConditionalOperator::RHS] = Reader.ReadSubExpr(); |
| 584 | E->QuestionLoc = ReadSourceLocation(Record, Idx); |
| 585 | E->ColonLoc = ReadSourceLocation(Record, Idx); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 586 | } |
| 587 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 588 | void ASTStmtReader::VisitImplicitCastExpr(ImplicitCastExpr *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 589 | VisitCastExpr(E); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 590 | } |
| 591 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 592 | void ASTStmtReader::VisitExplicitCastExpr(ExplicitCastExpr *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 593 | VisitCastExpr(E); |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 594 | E->setTypeInfoAsWritten(GetTypeSourceInfo(Record, Idx)); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 595 | } |
| 596 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 597 | void ASTStmtReader::VisitCStyleCastExpr(CStyleCastExpr *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 598 | VisitExplicitCastExpr(E); |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 599 | E->setLParenLoc(ReadSourceLocation(Record, Idx)); |
| 600 | E->setRParenLoc(ReadSourceLocation(Record, Idx)); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 601 | } |
| 602 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 603 | void ASTStmtReader::VisitCompoundLiteralExpr(CompoundLiteralExpr *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 604 | VisitExpr(E); |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 605 | E->setLParenLoc(ReadSourceLocation(Record, Idx)); |
| 606 | E->setTypeSourceInfo(GetTypeSourceInfo(Record, Idx)); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 607 | E->setInitializer(Reader.ReadSubExpr()); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 608 | E->setFileScope(Record[Idx++]); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 609 | } |
| 610 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 611 | void ASTStmtReader::VisitExtVectorElementExpr(ExtVectorElementExpr *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 612 | VisitExpr(E); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 613 | E->setBase(Reader.ReadSubExpr()); |
Douglas Gregor | 95eab17 | 2011-07-28 20:55:49 +0000 | [diff] [blame] | 614 | E->setAccessor(Reader.GetIdentifierInfo(F, Record, Idx)); |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 615 | E->setAccessorLoc(ReadSourceLocation(Record, Idx)); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 616 | } |
| 617 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 618 | void ASTStmtReader::VisitInitListExpr(InitListExpr *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 619 | VisitExpr(E); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 620 | E->setSyntacticForm(cast_or_null<InitListExpr>(Reader.ReadSubStmt())); |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 621 | E->setLBraceLoc(ReadSourceLocation(Record, Idx)); |
| 622 | E->setRBraceLoc(ReadSourceLocation(Record, Idx)); |
Argyrios Kyrtzidis | 2ac0b7a | 2011-04-22 05:29:30 +0000 | [diff] [blame] | 623 | bool isArrayFiller = Record[Idx++]; |
| 624 | Expr *filler = 0; |
| 625 | if (isArrayFiller) { |
| 626 | filler = Reader.ReadSubExpr(); |
| 627 | E->ArrayFillerOrUnionFieldInit = filler; |
| 628 | } else |
Douglas Gregor | 409448c | 2011-07-21 22:35:25 +0000 | [diff] [blame] | 629 | E->ArrayFillerOrUnionFieldInit = ReadDeclAs<FieldDecl>(Record, Idx); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 630 | E->sawArrayRangeDesignator(Record[Idx++]); |
Benjamin Kramer | 1b1a507 | 2012-02-27 13:20:39 +0000 | [diff] [blame] | 631 | E->setInitializesStdInitializerList(Record[Idx++]); |
Argyrios Kyrtzidis | 2ac0b7a | 2011-04-22 05:29:30 +0000 | [diff] [blame] | 632 | unsigned NumInits = Record[Idx++]; |
Douglas Gregor | 3594277 | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 633 | E->reserveInits(Reader.getContext(), NumInits); |
Argyrios Kyrtzidis | 2ac0b7a | 2011-04-22 05:29:30 +0000 | [diff] [blame] | 634 | if (isArrayFiller) { |
| 635 | for (unsigned I = 0; I != NumInits; ++I) { |
| 636 | Expr *init = Reader.ReadSubExpr(); |
Douglas Gregor | 3594277 | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 637 | E->updateInit(Reader.getContext(), I, init ? init : filler); |
Argyrios Kyrtzidis | 2ac0b7a | 2011-04-22 05:29:30 +0000 | [diff] [blame] | 638 | } |
| 639 | } else { |
| 640 | for (unsigned I = 0; I != NumInits; ++I) |
Douglas Gregor | 3594277 | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 641 | E->updateInit(Reader.getContext(), I, Reader.ReadSubExpr()); |
Argyrios Kyrtzidis | 2ac0b7a | 2011-04-22 05:29:30 +0000 | [diff] [blame] | 642 | } |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 643 | } |
| 644 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 645 | void ASTStmtReader::VisitDesignatedInitExpr(DesignatedInitExpr *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 646 | typedef DesignatedInitExpr::Designator Designator; |
| 647 | |
| 648 | VisitExpr(E); |
| 649 | unsigned NumSubExprs = Record[Idx++]; |
| 650 | assert(NumSubExprs == E->getNumSubExprs() && "Wrong number of subexprs"); |
| 651 | for (unsigned I = 0; I != NumSubExprs; ++I) |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 652 | E->setSubExpr(I, Reader.ReadSubExpr()); |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 653 | E->setEqualOrColonLoc(ReadSourceLocation(Record, Idx)); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 654 | E->setGNUSyntax(Record[Idx++]); |
| 655 | |
Chris Lattner | 5f9e272 | 2011-07-23 10:55:15 +0000 | [diff] [blame] | 656 | SmallVector<Designator, 4> Designators; |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 657 | while (Idx < Record.size()) { |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 658 | switch ((DesignatorTypes)Record[Idx++]) { |
| 659 | case DESIG_FIELD_DECL: { |
Douglas Gregor | 409448c | 2011-07-21 22:35:25 +0000 | [diff] [blame] | 660 | FieldDecl *Field = ReadDeclAs<FieldDecl>(Record, Idx); |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 661 | SourceLocation DotLoc |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 662 | = ReadSourceLocation(Record, Idx); |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 663 | SourceLocation FieldLoc |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 664 | = ReadSourceLocation(Record, Idx); |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 665 | Designators.push_back(Designator(Field->getIdentifier(), DotLoc, |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 666 | FieldLoc)); |
| 667 | Designators.back().setField(Field); |
| 668 | break; |
| 669 | } |
| 670 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 671 | case DESIG_FIELD_NAME: { |
Douglas Gregor | 95eab17 | 2011-07-28 20:55:49 +0000 | [diff] [blame] | 672 | const IdentifierInfo *Name = Reader.GetIdentifierInfo(F, Record, Idx); |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 673 | SourceLocation DotLoc |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 674 | = ReadSourceLocation(Record, Idx); |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 675 | SourceLocation FieldLoc |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 676 | = ReadSourceLocation(Record, Idx); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 677 | Designators.push_back(Designator(Name, DotLoc, FieldLoc)); |
| 678 | break; |
| 679 | } |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 680 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 681 | case DESIG_ARRAY: { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 682 | unsigned Index = Record[Idx++]; |
| 683 | SourceLocation LBracketLoc |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 684 | = ReadSourceLocation(Record, Idx); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 685 | SourceLocation RBracketLoc |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 686 | = ReadSourceLocation(Record, Idx); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 687 | Designators.push_back(Designator(Index, LBracketLoc, RBracketLoc)); |
| 688 | break; |
| 689 | } |
| 690 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 691 | case DESIG_ARRAY_RANGE: { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 692 | unsigned Index = Record[Idx++]; |
| 693 | SourceLocation LBracketLoc |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 694 | = ReadSourceLocation(Record, Idx); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 695 | SourceLocation EllipsisLoc |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 696 | = ReadSourceLocation(Record, Idx); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 697 | SourceLocation RBracketLoc |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 698 | = ReadSourceLocation(Record, Idx); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 699 | Designators.push_back(Designator(Index, LBracketLoc, EllipsisLoc, |
| 700 | RBracketLoc)); |
| 701 | break; |
| 702 | } |
| 703 | } |
| 704 | } |
Douglas Gregor | 3594277 | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 705 | E->setDesignators(Reader.getContext(), |
Douglas Gregor | 319d57f | 2010-01-06 23:17:19 +0000 | [diff] [blame] | 706 | Designators.data(), Designators.size()); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 707 | } |
| 708 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 709 | void ASTStmtReader::VisitImplicitValueInitExpr(ImplicitValueInitExpr *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 710 | VisitExpr(E); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 711 | } |
| 712 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 713 | void ASTStmtReader::VisitVAArgExpr(VAArgExpr *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 714 | VisitExpr(E); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 715 | E->setSubExpr(Reader.ReadSubExpr()); |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 716 | E->setWrittenTypeInfo(GetTypeSourceInfo(Record, Idx)); |
| 717 | E->setBuiltinLoc(ReadSourceLocation(Record, Idx)); |
| 718 | E->setRParenLoc(ReadSourceLocation(Record, Idx)); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 719 | } |
| 720 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 721 | void ASTStmtReader::VisitAddrLabelExpr(AddrLabelExpr *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 722 | VisitExpr(E); |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 723 | E->setAmpAmpLoc(ReadSourceLocation(Record, Idx)); |
| 724 | E->setLabelLoc(ReadSourceLocation(Record, Idx)); |
Douglas Gregor | 409448c | 2011-07-21 22:35:25 +0000 | [diff] [blame] | 725 | E->setLabel(ReadDeclAs<LabelDecl>(Record, Idx)); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 726 | } |
| 727 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 728 | void ASTStmtReader::VisitStmtExpr(StmtExpr *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 729 | VisitExpr(E); |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 730 | E->setLParenLoc(ReadSourceLocation(Record, Idx)); |
| 731 | E->setRParenLoc(ReadSourceLocation(Record, Idx)); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 732 | E->setSubStmt(cast_or_null<CompoundStmt>(Reader.ReadSubStmt())); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 733 | } |
| 734 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 735 | void ASTStmtReader::VisitChooseExpr(ChooseExpr *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 736 | VisitExpr(E); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 737 | E->setCond(Reader.ReadSubExpr()); |
| 738 | E->setLHS(Reader.ReadSubExpr()); |
| 739 | E->setRHS(Reader.ReadSubExpr()); |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 740 | E->setBuiltinLoc(ReadSourceLocation(Record, Idx)); |
| 741 | E->setRParenLoc(ReadSourceLocation(Record, Idx)); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 742 | } |
| 743 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 744 | void ASTStmtReader::VisitGNUNullExpr(GNUNullExpr *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 745 | VisitExpr(E); |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 746 | E->setTokenLocation(ReadSourceLocation(Record, Idx)); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 747 | } |
| 748 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 749 | void ASTStmtReader::VisitShuffleVectorExpr(ShuffleVectorExpr *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 750 | VisitExpr(E); |
Chris Lattner | 5f9e272 | 2011-07-23 10:55:15 +0000 | [diff] [blame] | 751 | SmallVector<Expr *, 16> Exprs; |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 752 | unsigned NumExprs = Record[Idx++]; |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 753 | while (NumExprs--) |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 754 | Exprs.push_back(Reader.ReadSubExpr()); |
Douglas Gregor | 3594277 | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 755 | E->setExprs(Reader.getContext(), Exprs.data(), Exprs.size()); |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 756 | E->setBuiltinLoc(ReadSourceLocation(Record, Idx)); |
| 757 | E->setRParenLoc(ReadSourceLocation(Record, Idx)); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 758 | } |
| 759 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 760 | void ASTStmtReader::VisitBlockExpr(BlockExpr *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 761 | VisitExpr(E); |
Douglas Gregor | 409448c | 2011-07-21 22:35:25 +0000 | [diff] [blame] | 762 | E->setBlockDecl(ReadDeclAs<BlockDecl>(Record, Idx)); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 763 | } |
| 764 | |
Peter Collingbourne | f111d93 | 2011-04-15 00:35:48 +0000 | [diff] [blame] | 765 | void ASTStmtReader::VisitGenericSelectionExpr(GenericSelectionExpr *E) { |
| 766 | VisitExpr(E); |
| 767 | E->NumAssocs = Record[Idx++]; |
Douglas Gregor | 3594277 | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 768 | E->AssocTypes = new (Reader.getContext()) TypeSourceInfo*[E->NumAssocs]; |
Peter Collingbourne | f111d93 | 2011-04-15 00:35:48 +0000 | [diff] [blame] | 769 | E->SubExprs = |
Douglas Gregor | 3594277 | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 770 | new(Reader.getContext()) Stmt*[GenericSelectionExpr::END_EXPR+E->NumAssocs]; |
Peter Collingbourne | f111d93 | 2011-04-15 00:35:48 +0000 | [diff] [blame] | 771 | |
| 772 | E->SubExprs[GenericSelectionExpr::CONTROLLING] = Reader.ReadSubExpr(); |
| 773 | for (unsigned I = 0, N = E->getNumAssocs(); I != N; ++I) { |
| 774 | E->AssocTypes[I] = GetTypeSourceInfo(Record, Idx); |
| 775 | E->SubExprs[GenericSelectionExpr::END_EXPR+I] = Reader.ReadSubExpr(); |
| 776 | } |
| 777 | E->ResultIndex = Record[Idx++]; |
| 778 | |
| 779 | E->GenericLoc = ReadSourceLocation(Record, Idx); |
| 780 | E->DefaultLoc = ReadSourceLocation(Record, Idx); |
| 781 | E->RParenLoc = ReadSourceLocation(Record, Idx); |
| 782 | } |
| 783 | |
John McCall | 4b9c2d2 | 2011-11-06 09:01:30 +0000 | [diff] [blame] | 784 | void ASTStmtReader::VisitPseudoObjectExpr(PseudoObjectExpr *E) { |
| 785 | VisitExpr(E); |
| 786 | unsigned numSemanticExprs = Record[Idx++]; |
| 787 | assert(numSemanticExprs + 1 == E->PseudoObjectExprBits.NumSubExprs); |
| 788 | E->PseudoObjectExprBits.ResultIndex = Record[Idx++]; |
| 789 | |
| 790 | // Read the syntactic expression. |
| 791 | E->getSubExprsBuffer()[0] = Reader.ReadSubExpr(); |
| 792 | |
| 793 | // Read all the semantic expressions. |
| 794 | for (unsigned i = 0; i != numSemanticExprs; ++i) { |
| 795 | Expr *subExpr = Reader.ReadSubExpr(); |
John McCall | 4b9c2d2 | 2011-11-06 09:01:30 +0000 | [diff] [blame] | 796 | E->getSubExprsBuffer()[i+1] = subExpr; |
| 797 | } |
| 798 | } |
| 799 | |
Eli Friedman | 276b061 | 2011-10-11 02:20:01 +0000 | [diff] [blame] | 800 | void ASTStmtReader::VisitAtomicExpr(AtomicExpr *E) { |
| 801 | VisitExpr(E); |
Richard Smith | e1b2abc | 2012-04-10 22:49:28 +0000 | [diff] [blame] | 802 | E->Op = AtomicExpr::AtomicOp(Record[Idx++]); |
| 803 | E->NumSubExprs = AtomicExpr::getNumSubExprs(E->Op); |
| 804 | for (unsigned I = 0; I != E->NumSubExprs; ++I) |
| 805 | E->SubExprs[I] = Reader.ReadSubExpr(); |
| 806 | E->BuiltinLoc = ReadSourceLocation(Record, Idx); |
| 807 | E->RParenLoc = ReadSourceLocation(Record, Idx); |
Eli Friedman | 276b061 | 2011-10-11 02:20:01 +0000 | [diff] [blame] | 808 | } |
| 809 | |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 810 | //===----------------------------------------------------------------------===// |
| 811 | // Objective-C Expressions and Statements |
| 812 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 813 | void ASTStmtReader::VisitObjCStringLiteral(ObjCStringLiteral *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 814 | VisitExpr(E); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 815 | E->setString(cast<StringLiteral>(Reader.ReadSubStmt())); |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 816 | E->setAtLoc(ReadSourceLocation(Record, Idx)); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 817 | } |
| 818 | |
Patrick Beard | eb382ec | 2012-04-19 00:25:12 +0000 | [diff] [blame^] | 819 | void ASTStmtReader::VisitObjCBoxedExpr(ObjCBoxedExpr *E) { |
Ted Kremenek | ebcb57a | 2012-03-06 20:05:56 +0000 | [diff] [blame] | 820 | VisitExpr(E); |
| 821 | // could be one of several IntegerLiteral, FloatLiteral, etc. |
Patrick Beard | eb382ec | 2012-04-19 00:25:12 +0000 | [diff] [blame^] | 822 | E->SubExpr = Reader.ReadSubStmt(); |
| 823 | E->BoxingMethod = ReadDeclAs<ObjCMethodDecl>(Record, Idx); |
| 824 | E->Range = ReadSourceRange(Record, Idx); |
Ted Kremenek | ebcb57a | 2012-03-06 20:05:56 +0000 | [diff] [blame] | 825 | } |
| 826 | |
| 827 | void ASTStmtReader::VisitObjCArrayLiteral(ObjCArrayLiteral *E) { |
| 828 | VisitExpr(E); |
| 829 | unsigned NumElements = Record[Idx++]; |
| 830 | assert(NumElements == E->getNumElements() && "Wrong number of elements"); |
| 831 | Expr **Elements = E->getElements(); |
| 832 | for (unsigned I = 0, N = NumElements; I != N; ++I) |
| 833 | Elements[I] = Reader.ReadSubExpr(); |
| 834 | E->ArrayWithObjectsMethod = ReadDeclAs<ObjCMethodDecl>(Record, Idx); |
| 835 | E->Range = ReadSourceRange(Record, Idx); |
| 836 | } |
| 837 | |
| 838 | void ASTStmtReader::VisitObjCDictionaryLiteral(ObjCDictionaryLiteral *E) { |
| 839 | VisitExpr(E); |
| 840 | unsigned NumElements = Record[Idx++]; |
| 841 | assert(NumElements == E->getNumElements() && "Wrong number of elements"); |
| 842 | bool HasPackExpansions = Record[Idx++]; |
| 843 | assert(HasPackExpansions == E->HasPackExpansions &&"Pack expansion mismatch"); |
| 844 | ObjCDictionaryLiteral::KeyValuePair *KeyValues = E->getKeyValues(); |
| 845 | ObjCDictionaryLiteral::ExpansionData *Expansions = E->getExpansionData(); |
| 846 | for (unsigned I = 0; I != NumElements; ++I) { |
| 847 | KeyValues[I].Key = Reader.ReadSubExpr(); |
| 848 | KeyValues[I].Value = Reader.ReadSubExpr(); |
| 849 | if (HasPackExpansions) { |
| 850 | Expansions[I].EllipsisLoc = ReadSourceLocation(Record, Idx); |
| 851 | Expansions[I].NumExpansionsPlusOne = Record[Idx++]; |
| 852 | } |
| 853 | } |
| 854 | E->DictWithObjectsMethod = ReadDeclAs<ObjCMethodDecl>(Record, Idx); |
| 855 | E->Range = ReadSourceRange(Record, Idx); |
| 856 | } |
| 857 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 858 | void ASTStmtReader::VisitObjCEncodeExpr(ObjCEncodeExpr *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 859 | VisitExpr(E); |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 860 | E->setEncodedTypeSourceInfo(GetTypeSourceInfo(Record, Idx)); |
| 861 | E->setAtLoc(ReadSourceLocation(Record, Idx)); |
| 862 | E->setRParenLoc(ReadSourceLocation(Record, Idx)); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 863 | } |
| 864 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 865 | void ASTStmtReader::VisitObjCSelectorExpr(ObjCSelectorExpr *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 866 | VisitExpr(E); |
Douglas Gregor | 2d2689a | 2011-07-28 21:16:51 +0000 | [diff] [blame] | 867 | E->setSelector(Reader.ReadSelector(F, Record, Idx)); |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 868 | E->setAtLoc(ReadSourceLocation(Record, Idx)); |
| 869 | E->setRParenLoc(ReadSourceLocation(Record, Idx)); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 870 | } |
| 871 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 872 | void ASTStmtReader::VisitObjCProtocolExpr(ObjCProtocolExpr *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 873 | VisitExpr(E); |
Douglas Gregor | 409448c | 2011-07-21 22:35:25 +0000 | [diff] [blame] | 874 | E->setProtocol(ReadDeclAs<ObjCProtocolDecl>(Record, Idx)); |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 875 | E->setAtLoc(ReadSourceLocation(Record, Idx)); |
| 876 | E->setRParenLoc(ReadSourceLocation(Record, Idx)); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 877 | } |
| 878 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 879 | void ASTStmtReader::VisitObjCIvarRefExpr(ObjCIvarRefExpr *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 880 | VisitExpr(E); |
Douglas Gregor | 409448c | 2011-07-21 22:35:25 +0000 | [diff] [blame] | 881 | E->setDecl(ReadDeclAs<ObjCIvarDecl>(Record, Idx)); |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 882 | E->setLocation(ReadSourceLocation(Record, Idx)); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 883 | E->setBase(Reader.ReadSubExpr()); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 884 | E->setIsArrow(Record[Idx++]); |
| 885 | E->setIsFreeIvar(Record[Idx++]); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 886 | } |
| 887 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 888 | void ASTStmtReader::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 889 | VisitExpr(E); |
Argyrios Kyrtzidis | b085d89 | 2012-03-30 00:19:18 +0000 | [diff] [blame] | 890 | unsigned MethodRefFlags = Record[Idx++]; |
John McCall | 12f78a6 | 2010-12-02 01:19:52 +0000 | [diff] [blame] | 891 | bool Implicit = Record[Idx++] != 0; |
| 892 | if (Implicit) { |
Douglas Gregor | 409448c | 2011-07-21 22:35:25 +0000 | [diff] [blame] | 893 | ObjCMethodDecl *Getter = ReadDeclAs<ObjCMethodDecl>(Record, Idx); |
| 894 | ObjCMethodDecl *Setter = ReadDeclAs<ObjCMethodDecl>(Record, Idx); |
Argyrios Kyrtzidis | b085d89 | 2012-03-30 00:19:18 +0000 | [diff] [blame] | 895 | E->setImplicitProperty(Getter, Setter, MethodRefFlags); |
John McCall | 12f78a6 | 2010-12-02 01:19:52 +0000 | [diff] [blame] | 896 | } else { |
Argyrios Kyrtzidis | b085d89 | 2012-03-30 00:19:18 +0000 | [diff] [blame] | 897 | E->setExplicitProperty(ReadDeclAs<ObjCPropertyDecl>(Record, Idx), |
| 898 | MethodRefFlags); |
Fariborz Jahanian | 8ac2d44 | 2010-10-14 16:04:05 +0000 | [diff] [blame] | 899 | } |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 900 | E->setLocation(ReadSourceLocation(Record, Idx)); |
John McCall | 12f78a6 | 2010-12-02 01:19:52 +0000 | [diff] [blame] | 901 | E->setReceiverLocation(ReadSourceLocation(Record, Idx)); |
| 902 | switch (Record[Idx++]) { |
| 903 | case 0: |
| 904 | E->setBase(Reader.ReadSubExpr()); |
| 905 | break; |
| 906 | case 1: |
Douglas Gregor | 393f249 | 2011-07-22 00:38:23 +0000 | [diff] [blame] | 907 | E->setSuperReceiver(Reader.readType(F, Record, Idx)); |
John McCall | 12f78a6 | 2010-12-02 01:19:52 +0000 | [diff] [blame] | 908 | break; |
| 909 | case 2: |
Douglas Gregor | 409448c | 2011-07-21 22:35:25 +0000 | [diff] [blame] | 910 | E->setClassReceiver(ReadDeclAs<ObjCInterfaceDecl>(Record, Idx)); |
John McCall | 12f78a6 | 2010-12-02 01:19:52 +0000 | [diff] [blame] | 911 | break; |
| 912 | } |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 913 | } |
| 914 | |
Ted Kremenek | ebcb57a | 2012-03-06 20:05:56 +0000 | [diff] [blame] | 915 | void ASTStmtReader::VisitObjCSubscriptRefExpr(ObjCSubscriptRefExpr *E) { |
| 916 | VisitExpr(E); |
| 917 | E->setRBracket(ReadSourceLocation(Record, Idx)); |
| 918 | E->setBaseExpr(Reader.ReadSubExpr()); |
| 919 | E->setKeyExpr(Reader.ReadSubExpr()); |
| 920 | E->GetAtIndexMethodDecl = ReadDeclAs<ObjCMethodDecl>(Record, Idx); |
| 921 | E->SetAtIndexMethodDecl = ReadDeclAs<ObjCMethodDecl>(Record, Idx); |
| 922 | } |
| 923 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 924 | void ASTStmtReader::VisitObjCMessageExpr(ObjCMessageExpr *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 925 | VisitExpr(E); |
Douglas Gregor | 04badcf | 2010-04-21 00:45:42 +0000 | [diff] [blame] | 926 | assert(Record[Idx] == E->getNumArgs()); |
| 927 | ++Idx; |
Argyrios Kyrtzidis | 2071808 | 2011-10-03 06:36:51 +0000 | [diff] [blame] | 928 | unsigned NumStoredSelLocs = Record[Idx++]; |
| 929 | E->SelLocsKind = Record[Idx++]; |
John McCall | f85e193 | 2011-06-15 23:02:42 +0000 | [diff] [blame] | 930 | E->setDelegateInitCall(Record[Idx++]); |
Argyrios Kyrtzidis | 746f5bc | 2012-01-12 02:34:39 +0000 | [diff] [blame] | 931 | E->IsImplicit = Record[Idx++]; |
Douglas Gregor | 04badcf | 2010-04-21 00:45:42 +0000 | [diff] [blame] | 932 | ObjCMessageExpr::ReceiverKind Kind |
| 933 | = static_cast<ObjCMessageExpr::ReceiverKind>(Record[Idx++]); |
| 934 | switch (Kind) { |
| 935 | case ObjCMessageExpr::Instance: |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 936 | E->setInstanceReceiver(Reader.ReadSubExpr()); |
Douglas Gregor | 04badcf | 2010-04-21 00:45:42 +0000 | [diff] [blame] | 937 | break; |
| 938 | |
| 939 | case ObjCMessageExpr::Class: |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 940 | E->setClassReceiver(GetTypeSourceInfo(Record, Idx)); |
Douglas Gregor | 04badcf | 2010-04-21 00:45:42 +0000 | [diff] [blame] | 941 | break; |
| 942 | |
| 943 | case ObjCMessageExpr::SuperClass: |
| 944 | case ObjCMessageExpr::SuperInstance: { |
Douglas Gregor | 393f249 | 2011-07-22 00:38:23 +0000 | [diff] [blame] | 945 | QualType T = Reader.readType(F, Record, Idx); |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 946 | SourceLocation SuperLoc = ReadSourceLocation(Record, Idx); |
Douglas Gregor | 04badcf | 2010-04-21 00:45:42 +0000 | [diff] [blame] | 947 | E->setSuper(SuperLoc, T, Kind == ObjCMessageExpr::SuperInstance); |
| 948 | break; |
| 949 | } |
| 950 | } |
| 951 | |
| 952 | assert(Kind == E->getReceiverKind()); |
| 953 | |
| 954 | if (Record[Idx++]) |
Douglas Gregor | 409448c | 2011-07-21 22:35:25 +0000 | [diff] [blame] | 955 | E->setMethodDecl(ReadDeclAs<ObjCMethodDecl>(Record, Idx)); |
Douglas Gregor | 04badcf | 2010-04-21 00:45:42 +0000 | [diff] [blame] | 956 | else |
Douglas Gregor | 2d2689a | 2011-07-28 21:16:51 +0000 | [diff] [blame] | 957 | E->setSelector(Reader.ReadSelector(F, Record, Idx)); |
Douglas Gregor | 04badcf | 2010-04-21 00:45:42 +0000 | [diff] [blame] | 958 | |
Argyrios Kyrtzidis | f40f0d5 | 2010-12-10 20:08:27 +0000 | [diff] [blame] | 959 | E->LBracLoc = ReadSourceLocation(Record, Idx); |
| 960 | E->RBracLoc = ReadSourceLocation(Record, Idx); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 961 | |
| 962 | for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I) |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 963 | E->setArg(I, Reader.ReadSubExpr()); |
Argyrios Kyrtzidis | 2071808 | 2011-10-03 06:36:51 +0000 | [diff] [blame] | 964 | |
| 965 | SourceLocation *Locs = E->getStoredSelLocs(); |
| 966 | for (unsigned I = 0; I != NumStoredSelLocs; ++I) |
| 967 | Locs[I] = ReadSourceLocation(Record, Idx); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 968 | } |
| 969 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 970 | void ASTStmtReader::VisitObjCForCollectionStmt(ObjCForCollectionStmt *S) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 971 | VisitStmt(S); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 972 | S->setElement(Reader.ReadSubStmt()); |
| 973 | S->setCollection(Reader.ReadSubExpr()); |
| 974 | S->setBody(Reader.ReadSubStmt()); |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 975 | S->setForLoc(ReadSourceLocation(Record, Idx)); |
| 976 | S->setRParenLoc(ReadSourceLocation(Record, Idx)); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 977 | } |
| 978 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 979 | void ASTStmtReader::VisitObjCAtCatchStmt(ObjCAtCatchStmt *S) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 980 | VisitStmt(S); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 981 | S->setCatchBody(Reader.ReadSubStmt()); |
Douglas Gregor | 409448c | 2011-07-21 22:35:25 +0000 | [diff] [blame] | 982 | S->setCatchParamDecl(ReadDeclAs<VarDecl>(Record, Idx)); |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 983 | S->setAtCatchLoc(ReadSourceLocation(Record, Idx)); |
| 984 | S->setRParenLoc(ReadSourceLocation(Record, Idx)); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 985 | } |
| 986 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 987 | void ASTStmtReader::VisitObjCAtFinallyStmt(ObjCAtFinallyStmt *S) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 988 | VisitStmt(S); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 989 | S->setFinallyBody(Reader.ReadSubStmt()); |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 990 | S->setAtFinallyLoc(ReadSourceLocation(Record, Idx)); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 991 | } |
| 992 | |
John McCall | f85e193 | 2011-06-15 23:02:42 +0000 | [diff] [blame] | 993 | void ASTStmtReader::VisitObjCAutoreleasePoolStmt(ObjCAutoreleasePoolStmt *S) { |
| 994 | VisitStmt(S); |
| 995 | S->setSubStmt(Reader.ReadSubStmt()); |
| 996 | S->setAtLoc(ReadSourceLocation(Record, Idx)); |
| 997 | } |
| 998 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 999 | void ASTStmtReader::VisitObjCAtTryStmt(ObjCAtTryStmt *S) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1000 | VisitStmt(S); |
Douglas Gregor | 8f5e3dd | 2010-04-23 22:50:49 +0000 | [diff] [blame] | 1001 | assert(Record[Idx] == S->getNumCatchStmts()); |
| 1002 | ++Idx; |
| 1003 | bool HasFinally = Record[Idx++]; |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 1004 | S->setTryBody(Reader.ReadSubStmt()); |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1005 | for (unsigned I = 0, N = S->getNumCatchStmts(); I != N; ++I) |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 1006 | S->setCatchStmt(I, cast_or_null<ObjCAtCatchStmt>(Reader.ReadSubStmt())); |
Douglas Gregor | 8f5e3dd | 2010-04-23 22:50:49 +0000 | [diff] [blame] | 1007 | |
Douglas Gregor | 8f5e3dd | 2010-04-23 22:50:49 +0000 | [diff] [blame] | 1008 | if (HasFinally) |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 1009 | S->setFinallyStmt(Reader.ReadSubStmt()); |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 1010 | S->setAtTryLoc(ReadSourceLocation(Record, Idx)); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1011 | } |
| 1012 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1013 | void ASTStmtReader::VisitObjCAtSynchronizedStmt(ObjCAtSynchronizedStmt *S) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1014 | VisitStmt(S); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 1015 | S->setSynchExpr(Reader.ReadSubStmt()); |
| 1016 | S->setSynchBody(Reader.ReadSubStmt()); |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 1017 | S->setAtSynchronizedLoc(ReadSourceLocation(Record, Idx)); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1018 | } |
| 1019 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1020 | void ASTStmtReader::VisitObjCAtThrowStmt(ObjCAtThrowStmt *S) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1021 | VisitStmt(S); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 1022 | S->setThrowExpr(Reader.ReadSubStmt()); |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 1023 | S->setThrowLoc(ReadSourceLocation(Record, Idx)); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1024 | } |
| 1025 | |
Ted Kremenek | ebcb57a | 2012-03-06 20:05:56 +0000 | [diff] [blame] | 1026 | void ASTStmtReader::VisitObjCBoolLiteralExpr(ObjCBoolLiteralExpr *E) { |
| 1027 | VisitExpr(E); |
| 1028 | E->setValue(Record[Idx++]); |
| 1029 | E->setLocation(ReadSourceLocation(Record, Idx)); |
| 1030 | } |
| 1031 | |
Argyrios Kyrtzidis | ba0a900 | 2009-07-14 03:19:21 +0000 | [diff] [blame] | 1032 | //===----------------------------------------------------------------------===// |
| 1033 | // C++ Expressions and Statements |
Argyrios Kyrtzidis | 7cb45e3 | 2010-07-22 16:03:56 +0000 | [diff] [blame] | 1034 | //===----------------------------------------------------------------------===// |
| 1035 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1036 | void ASTStmtReader::VisitCXXCatchStmt(CXXCatchStmt *S) { |
Argyrios Kyrtzidis | 7cb45e3 | 2010-07-22 16:03:56 +0000 | [diff] [blame] | 1037 | VisitStmt(S); |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 1038 | S->CatchLoc = ReadSourceLocation(Record, Idx); |
Douglas Gregor | 409448c | 2011-07-21 22:35:25 +0000 | [diff] [blame] | 1039 | S->ExceptionDecl = ReadDeclAs<VarDecl>(Record, Idx); |
Argyrios Kyrtzidis | 7cb45e3 | 2010-07-22 16:03:56 +0000 | [diff] [blame] | 1040 | S->HandlerBlock = Reader.ReadSubStmt(); |
| 1041 | } |
| 1042 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1043 | void ASTStmtReader::VisitCXXTryStmt(CXXTryStmt *S) { |
Argyrios Kyrtzidis | 7cb45e3 | 2010-07-22 16:03:56 +0000 | [diff] [blame] | 1044 | VisitStmt(S); |
| 1045 | assert(Record[Idx] == S->getNumHandlers() && "NumStmtFields is wrong ?"); |
| 1046 | ++Idx; |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 1047 | S->TryLoc = ReadSourceLocation(Record, Idx); |
Argyrios Kyrtzidis | 7cb45e3 | 2010-07-22 16:03:56 +0000 | [diff] [blame] | 1048 | S->getStmts()[0] = Reader.ReadSubStmt(); |
| 1049 | for (unsigned i = 0, e = S->getNumHandlers(); i != e; ++i) |
| 1050 | S->getStmts()[i + 1] = Reader.ReadSubStmt(); |
| 1051 | } |
Argyrios Kyrtzidis | ba0a900 | 2009-07-14 03:19:21 +0000 | [diff] [blame] | 1052 | |
Richard Smith | ad762fc | 2011-04-14 22:09:26 +0000 | [diff] [blame] | 1053 | void ASTStmtReader::VisitCXXForRangeStmt(CXXForRangeStmt *S) { |
| 1054 | VisitStmt(S); |
| 1055 | S->setForLoc(ReadSourceLocation(Record, Idx)); |
| 1056 | S->setColonLoc(ReadSourceLocation(Record, Idx)); |
| 1057 | S->setRParenLoc(ReadSourceLocation(Record, Idx)); |
| 1058 | S->setRangeStmt(Reader.ReadSubStmt()); |
| 1059 | S->setBeginEndStmt(Reader.ReadSubStmt()); |
| 1060 | S->setCond(Reader.ReadSubExpr()); |
| 1061 | S->setInc(Reader.ReadSubExpr()); |
| 1062 | S->setLoopVarStmt(Reader.ReadSubStmt()); |
| 1063 | S->setBody(Reader.ReadSubStmt()); |
| 1064 | } |
| 1065 | |
Douglas Gregor | ba0513d | 2011-10-25 01:33:02 +0000 | [diff] [blame] | 1066 | void ASTStmtReader::VisitMSDependentExistsStmt(MSDependentExistsStmt *S) { |
| 1067 | VisitStmt(S); |
| 1068 | S->KeywordLoc = ReadSourceLocation(Record, Idx); |
| 1069 | S->IsIfExists = Record[Idx++]; |
| 1070 | S->QualifierLoc = Reader.ReadNestedNameSpecifierLoc(F, Record, Idx); |
| 1071 | ReadDeclarationNameInfo(S->NameInfo, Record, Idx); |
| 1072 | S->SubStmt = Reader.ReadSubStmt(); |
| 1073 | } |
| 1074 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1075 | void ASTStmtReader::VisitCXXOperatorCallExpr(CXXOperatorCallExpr *E) { |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1076 | VisitCallExpr(E); |
Argyrios Kyrtzidis | ba0a900 | 2009-07-14 03:19:21 +0000 | [diff] [blame] | 1077 | E->setOperator((OverloadedOperatorKind)Record[Idx++]); |
Argyrios Kyrtzidis | ba0a900 | 2009-07-14 03:19:21 +0000 | [diff] [blame] | 1078 | } |
| 1079 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1080 | void ASTStmtReader::VisitCXXConstructExpr(CXXConstructExpr *E) { |
Douglas Gregor | 39da0b8 | 2009-09-09 23:08:42 +0000 | [diff] [blame] | 1081 | VisitExpr(E); |
Argyrios Kyrtzidis | 6d00c13 | 2010-07-10 11:46:15 +0000 | [diff] [blame] | 1082 | E->NumArgs = Record[Idx++]; |
| 1083 | if (E->NumArgs) |
Douglas Gregor | 3594277 | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 1084 | E->Args = new (Reader.getContext()) Stmt*[E->NumArgs]; |
Argyrios Kyrtzidis | 5e1b7c2 | 2010-06-24 08:57:09 +0000 | [diff] [blame] | 1085 | for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I) |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 1086 | E->setArg(I, Reader.ReadSubExpr()); |
Douglas Gregor | 409448c | 2011-07-21 22:35:25 +0000 | [diff] [blame] | 1087 | E->setConstructor(ReadDeclAs<CXXConstructorDecl>(Record, Idx)); |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 1088 | E->setLocation(ReadSourceLocation(Record, Idx)); |
Abramo Bagnara | 7cc58b4 | 2011-10-05 07:56:41 +0000 | [diff] [blame] | 1089 | E->setElidable(Record[Idx++]); |
| 1090 | E->setHadMultipleCandidates(Record[Idx++]); |
Douglas Gregor | 16006c9 | 2009-12-16 18:50:27 +0000 | [diff] [blame] | 1091 | E->setRequiresZeroInitialization(Record[Idx++]); |
Douglas Gregor | 3c9034c | 2010-05-15 00:13:29 +0000 | [diff] [blame] | 1092 | E->setConstructionKind((CXXConstructExpr::ConstructionKind)Record[Idx++]); |
Chandler Carruth | 428edaf | 2010-10-25 08:47:36 +0000 | [diff] [blame] | 1093 | E->ParenRange = ReadSourceRange(Record, Idx); |
Douglas Gregor | 39da0b8 | 2009-09-09 23:08:42 +0000 | [diff] [blame] | 1094 | } |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1095 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1096 | void ASTStmtReader::VisitCXXTemporaryObjectExpr(CXXTemporaryObjectExpr *E) { |
Argyrios Kyrtzidis | 6d00c13 | 2010-07-10 11:46:15 +0000 | [diff] [blame] | 1097 | VisitCXXConstructExpr(E); |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 1098 | E->Type = GetTypeSourceInfo(Record, Idx); |
Argyrios Kyrtzidis | 6d00c13 | 2010-07-10 11:46:15 +0000 | [diff] [blame] | 1099 | } |
| 1100 | |
Douglas Gregor | 01d0801 | 2012-02-07 10:09:13 +0000 | [diff] [blame] | 1101 | void ASTStmtReader::VisitLambdaExpr(LambdaExpr *E) { |
| 1102 | VisitExpr(E); |
Douglas Gregor | 9d36f5d | 2012-02-14 17:54:36 +0000 | [diff] [blame] | 1103 | unsigned NumCaptures = Record[Idx++]; |
| 1104 | assert(NumCaptures == E->NumCaptures);(void)NumCaptures; |
| 1105 | unsigned NumArrayIndexVars = Record[Idx++]; |
| 1106 | E->IntroducerRange = ReadSourceRange(Record, Idx); |
| 1107 | E->CaptureDefault = static_cast<LambdaCaptureDefault>(Record[Idx++]); |
| 1108 | E->ExplicitParams = Record[Idx++]; |
| 1109 | E->ExplicitResultType = Record[Idx++]; |
| 1110 | E->ClosingBrace = ReadSourceLocation(Record, Idx); |
| 1111 | |
| 1112 | // Read capture initializers. |
| 1113 | for (LambdaExpr::capture_init_iterator C = E->capture_init_begin(), |
| 1114 | CEnd = E->capture_init_end(); |
| 1115 | C != CEnd; ++C) |
| 1116 | *C = Reader.ReadSubExpr(); |
| 1117 | |
| 1118 | // Read array capture index variables. |
| 1119 | if (NumArrayIndexVars > 0) { |
| 1120 | unsigned *ArrayIndexStarts = E->getArrayIndexStarts(); |
| 1121 | for (unsigned I = 0; I != NumCaptures + 1; ++I) |
| 1122 | ArrayIndexStarts[I] = Record[Idx++]; |
| 1123 | |
| 1124 | VarDecl **ArrayIndexVars = E->getArrayIndexVars(); |
| 1125 | for (unsigned I = 0; I != NumArrayIndexVars; ++I) |
| 1126 | ArrayIndexVars[I] = ReadDeclAs<VarDecl>(Record, Idx); |
| 1127 | } |
Douglas Gregor | 01d0801 | 2012-02-07 10:09:13 +0000 | [diff] [blame] | 1128 | } |
| 1129 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1130 | void ASTStmtReader::VisitCXXNamedCastExpr(CXXNamedCastExpr *E) { |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1131 | VisitExplicitCastExpr(E); |
Douglas Gregor | 1d5d0b9 | 2011-01-12 22:41:29 +0000 | [diff] [blame] | 1132 | SourceRange R = ReadSourceRange(Record, Idx); |
| 1133 | E->Loc = R.getBegin(); |
| 1134 | E->RParenLoc = R.getEnd(); |
Sam Weinig | ce757a7 | 2010-01-16 21:21:01 +0000 | [diff] [blame] | 1135 | } |
| 1136 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1137 | void ASTStmtReader::VisitCXXStaticCastExpr(CXXStaticCastExpr *E) { |
Sam Weinig | ce757a7 | 2010-01-16 21:21:01 +0000 | [diff] [blame] | 1138 | return VisitCXXNamedCastExpr(E); |
| 1139 | } |
| 1140 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1141 | void ASTStmtReader::VisitCXXDynamicCastExpr(CXXDynamicCastExpr *E) { |
Sam Weinig | ce757a7 | 2010-01-16 21:21:01 +0000 | [diff] [blame] | 1142 | return VisitCXXNamedCastExpr(E); |
| 1143 | } |
| 1144 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1145 | void ASTStmtReader::VisitCXXReinterpretCastExpr(CXXReinterpretCastExpr *E) { |
Sam Weinig | ce757a7 | 2010-01-16 21:21:01 +0000 | [diff] [blame] | 1146 | return VisitCXXNamedCastExpr(E); |
| 1147 | } |
| 1148 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1149 | void ASTStmtReader::VisitCXXConstCastExpr(CXXConstCastExpr *E) { |
Sam Weinig | ce757a7 | 2010-01-16 21:21:01 +0000 | [diff] [blame] | 1150 | return VisitCXXNamedCastExpr(E); |
| 1151 | } |
| 1152 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1153 | void ASTStmtReader::VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr *E) { |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1154 | VisitExplicitCastExpr(E); |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 1155 | E->setTypeBeginLoc(ReadSourceLocation(Record, Idx)); |
| 1156 | E->setRParenLoc(ReadSourceLocation(Record, Idx)); |
Sam Weinig | ce757a7 | 2010-01-16 21:21:01 +0000 | [diff] [blame] | 1157 | } |
| 1158 | |
Richard Smith | 9fcce65 | 2012-03-07 08:35:16 +0000 | [diff] [blame] | 1159 | void ASTStmtReader::VisitUserDefinedLiteral(UserDefinedLiteral *E) { |
| 1160 | VisitCallExpr(E); |
| 1161 | E->UDSuffixLoc = ReadSourceLocation(Record, Idx); |
| 1162 | } |
| 1163 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1164 | void ASTStmtReader::VisitCXXBoolLiteralExpr(CXXBoolLiteralExpr *E) { |
Sam Weinig | eb7f961 | 2010-02-07 06:32:43 +0000 | [diff] [blame] | 1165 | VisitExpr(E); |
| 1166 | E->setValue(Record[Idx++]); |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 1167 | E->setLocation(ReadSourceLocation(Record, Idx)); |
Sam Weinig | eb7f961 | 2010-02-07 06:32:43 +0000 | [diff] [blame] | 1168 | } |
| 1169 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1170 | void ASTStmtReader::VisitCXXNullPtrLiteralExpr(CXXNullPtrLiteralExpr *E) { |
Sam Weinig | eb7f961 | 2010-02-07 06:32:43 +0000 | [diff] [blame] | 1171 | VisitExpr(E); |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 1172 | E->setLocation(ReadSourceLocation(Record, Idx)); |
Sam Weinig | eb7f961 | 2010-02-07 06:32:43 +0000 | [diff] [blame] | 1173 | } |
| 1174 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1175 | void ASTStmtReader::VisitCXXTypeidExpr(CXXTypeidExpr *E) { |
Chris Lattner | 14ab24f | 2010-05-09 06:03:39 +0000 | [diff] [blame] | 1176 | VisitExpr(E); |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 1177 | E->setSourceRange(ReadSourceRange(Record, Idx)); |
Chris Lattner | 14ab24f | 2010-05-09 06:03:39 +0000 | [diff] [blame] | 1178 | if (E->isTypeOperand()) { // typeid(int) |
Sebastian Redl | 577d479 | 2010-07-22 22:43:28 +0000 | [diff] [blame] | 1179 | E->setTypeOperandSourceInfo( |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 1180 | GetTypeSourceInfo(Record, Idx)); |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1181 | return; |
Chris Lattner | 14ab24f | 2010-05-09 06:03:39 +0000 | [diff] [blame] | 1182 | } |
| 1183 | |
| 1184 | // typeid(42+2) |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 1185 | E->setExprOperand(Reader.ReadSubExpr()); |
Chris Lattner | 14ab24f | 2010-05-09 06:03:39 +0000 | [diff] [blame] | 1186 | } |
| 1187 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1188 | void ASTStmtReader::VisitCXXThisExpr(CXXThisExpr *E) { |
Chris Lattner | 2fbdfcd | 2010-05-09 06:15:05 +0000 | [diff] [blame] | 1189 | VisitExpr(E); |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 1190 | E->setLocation(ReadSourceLocation(Record, Idx)); |
Chris Lattner | 2fbdfcd | 2010-05-09 06:15:05 +0000 | [diff] [blame] | 1191 | E->setImplicit(Record[Idx++]); |
Chris Lattner | 2fbdfcd | 2010-05-09 06:15:05 +0000 | [diff] [blame] | 1192 | } |
| 1193 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1194 | void ASTStmtReader::VisitCXXThrowExpr(CXXThrowExpr *E) { |
Chris Lattner | 2fbdfcd | 2010-05-09 06:15:05 +0000 | [diff] [blame] | 1195 | VisitExpr(E); |
Douglas Gregor | bca01b4 | 2011-07-06 22:04:06 +0000 | [diff] [blame] | 1196 | E->ThrowLoc = ReadSourceLocation(Record, Idx); |
| 1197 | E->Op = Reader.ReadSubExpr(); |
| 1198 | E->IsThrownVariableInScope = Record[Idx++]; |
Chris Lattner | 2fbdfcd | 2010-05-09 06:15:05 +0000 | [diff] [blame] | 1199 | } |
Chris Lattner | 14ab24f | 2010-05-09 06:03:39 +0000 | [diff] [blame] | 1200 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1201 | void ASTStmtReader::VisitCXXDefaultArgExpr(CXXDefaultArgExpr *E) { |
Chris Lattner | 030854b | 2010-05-09 06:40:08 +0000 | [diff] [blame] | 1202 | VisitExpr(E); |
Argyrios Kyrtzidis | 8a50733 | 2010-07-02 23:30:15 +0000 | [diff] [blame] | 1203 | |
Douglas Gregor | df22655 | 2011-09-23 22:07:41 +0000 | [diff] [blame] | 1204 | assert((bool)Record[Idx] == E->Param.getInt() && "We messed up at creation ?"); |
Argyrios Kyrtzidis | 8a50733 | 2010-07-02 23:30:15 +0000 | [diff] [blame] | 1205 | ++Idx; // HasOtherExprStored and SubExpr was handled during creation. |
Douglas Gregor | 409448c | 2011-07-21 22:35:25 +0000 | [diff] [blame] | 1206 | E->Param.setPointer(ReadDeclAs<ParmVarDecl>(Record, Idx)); |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 1207 | E->Loc = ReadSourceLocation(Record, Idx); |
Chris Lattner | d259836 | 2010-05-10 00:25:06 +0000 | [diff] [blame] | 1208 | } |
| 1209 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1210 | void ASTStmtReader::VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *E) { |
Chris Lattner | d259836 | 2010-05-10 00:25:06 +0000 | [diff] [blame] | 1211 | VisitExpr(E); |
Douglas Gregor | 409448c | 2011-07-21 22:35:25 +0000 | [diff] [blame] | 1212 | E->setTemporary(Reader.ReadCXXTemporary(F, Record, Idx)); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 1213 | E->setSubExpr(Reader.ReadSubExpr()); |
Chris Lattner | d259836 | 2010-05-10 00:25:06 +0000 | [diff] [blame] | 1214 | } |
| 1215 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1216 | void ASTStmtReader::VisitCXXScalarValueInitExpr(CXXScalarValueInitExpr *E) { |
Chris Lattner | 5921863 | 2010-05-10 01:22:27 +0000 | [diff] [blame] | 1217 | VisitExpr(E); |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 1218 | E->TypeInfo = GetTypeSourceInfo(Record, Idx); |
| 1219 | E->RParenLoc = ReadSourceLocation(Record, Idx); |
Chris Lattner | 5921863 | 2010-05-10 01:22:27 +0000 | [diff] [blame] | 1220 | } |
| 1221 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1222 | void ASTStmtReader::VisitCXXNewExpr(CXXNewExpr *E) { |
Chris Lattner | 5921863 | 2010-05-10 01:22:27 +0000 | [diff] [blame] | 1223 | VisitExpr(E); |
John McCall | 6ec278d | 2011-01-27 09:37:56 +0000 | [diff] [blame] | 1224 | E->GlobalNew = Record[Idx++]; |
Sebastian Redl | 1548d14 | 2012-02-16 11:35:52 +0000 | [diff] [blame] | 1225 | bool isArray = Record[Idx++]; |
Sebastian Redl | 2aed8b8 | 2012-02-16 12:22:20 +0000 | [diff] [blame] | 1226 | E->UsualArrayDeleteWantsSize = Record[Idx++]; |
Chris Lattner | 5921863 | 2010-05-10 01:22:27 +0000 | [diff] [blame] | 1227 | unsigned NumPlacementArgs = Record[Idx++]; |
Sebastian Redl | 2aed8b8 | 2012-02-16 12:22:20 +0000 | [diff] [blame] | 1228 | E->StoredInitializationStyle = Record[Idx++]; |
Douglas Gregor | 409448c | 2011-07-21 22:35:25 +0000 | [diff] [blame] | 1229 | E->setOperatorNew(ReadDeclAs<FunctionDecl>(Record, Idx)); |
| 1230 | E->setOperatorDelete(ReadDeclAs<FunctionDecl>(Record, Idx)); |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 1231 | E->AllocatedTypeInfo = GetTypeSourceInfo(Record, Idx); |
Douglas Gregor | 83bc276 | 2012-02-20 16:12:14 +0000 | [diff] [blame] | 1232 | E->TypeIdParens = ReadSourceRange(Record, Idx); |
Chandler Carruth | 428edaf | 2010-10-25 08:47:36 +0000 | [diff] [blame] | 1233 | E->StartLoc = ReadSourceLocation(Record, Idx); |
Douglas Gregor | 83bc276 | 2012-02-20 16:12:14 +0000 | [diff] [blame] | 1234 | E->DirectInitRange = ReadSourceRange(Record, Idx); |
Chandler Carruth | 428edaf | 2010-10-25 08:47:36 +0000 | [diff] [blame] | 1235 | |
Douglas Gregor | 3594277 | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 1236 | E->AllocateArgsArray(Reader.getContext(), isArray, NumPlacementArgs, |
Sebastian Redl | 2aed8b8 | 2012-02-16 12:22:20 +0000 | [diff] [blame] | 1237 | E->StoredInitializationStyle != 0); |
Chris Lattner | 5921863 | 2010-05-10 01:22:27 +0000 | [diff] [blame] | 1238 | |
| 1239 | // Install all the subexpressions. |
Chris Lattner | 5921863 | 2010-05-10 01:22:27 +0000 | [diff] [blame] | 1240 | for (CXXNewExpr::raw_arg_iterator I = E->raw_arg_begin(),e = E->raw_arg_end(); |
| 1241 | I != e; ++I) |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 1242 | *I = Reader.ReadSubStmt(); |
Chris Lattner | 5921863 | 2010-05-10 01:22:27 +0000 | [diff] [blame] | 1243 | } |
| 1244 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1245 | void ASTStmtReader::VisitCXXDeleteExpr(CXXDeleteExpr *E) { |
Argyrios Kyrtzidis | 95fc98c | 2010-06-22 17:07:59 +0000 | [diff] [blame] | 1246 | VisitExpr(E); |
Argyrios Kyrtzidis | f1b8911 | 2010-09-13 20:15:40 +0000 | [diff] [blame] | 1247 | E->GlobalDelete = Record[Idx++]; |
| 1248 | E->ArrayForm = Record[Idx++]; |
Argyrios Kyrtzidis | 4076dac | 2010-09-13 20:15:54 +0000 | [diff] [blame] | 1249 | E->ArrayFormAsWritten = Record[Idx++]; |
John McCall | 6ec278d | 2011-01-27 09:37:56 +0000 | [diff] [blame] | 1250 | E->UsualArrayDeleteWantsSize = Record[Idx++]; |
Douglas Gregor | 409448c | 2011-07-21 22:35:25 +0000 | [diff] [blame] | 1251 | E->OperatorDelete = ReadDeclAs<FunctionDecl>(Record, Idx); |
Argyrios Kyrtzidis | f1b8911 | 2010-09-13 20:15:40 +0000 | [diff] [blame] | 1252 | E->Argument = Reader.ReadSubExpr(); |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 1253 | E->Loc = ReadSourceLocation(Record, Idx); |
Argyrios Kyrtzidis | 95fc98c | 2010-06-22 17:07:59 +0000 | [diff] [blame] | 1254 | } |
Chris Lattner | d259836 | 2010-05-10 00:25:06 +0000 | [diff] [blame] | 1255 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1256 | void ASTStmtReader::VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr *E) { |
Argyrios Kyrtzidis | de4bd18 | 2010-06-28 09:32:03 +0000 | [diff] [blame] | 1257 | VisitExpr(E); |
| 1258 | |
Douglas Gregor | f3db29f | 2011-02-25 18:19:59 +0000 | [diff] [blame] | 1259 | E->Base = Reader.ReadSubExpr(); |
| 1260 | E->IsArrow = Record[Idx++]; |
| 1261 | E->OperatorLoc = ReadSourceLocation(Record, Idx); |
| 1262 | E->QualifierLoc = Reader.ReadNestedNameSpecifierLoc(F, Record, Idx); |
| 1263 | E->ScopeType = GetTypeSourceInfo(Record, Idx); |
| 1264 | E->ColonColonLoc = ReadSourceLocation(Record, Idx); |
| 1265 | E->TildeLoc = ReadSourceLocation(Record, Idx); |
Argyrios Kyrtzidis | de4bd18 | 2010-06-28 09:32:03 +0000 | [diff] [blame] | 1266 | |
Douglas Gregor | 95eab17 | 2011-07-28 20:55:49 +0000 | [diff] [blame] | 1267 | IdentifierInfo *II = Reader.GetIdentifierInfo(F, Record, Idx); |
Argyrios Kyrtzidis | de4bd18 | 2010-06-28 09:32:03 +0000 | [diff] [blame] | 1268 | if (II) |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 1269 | E->setDestroyedType(II, ReadSourceLocation(Record, Idx)); |
Argyrios Kyrtzidis | de4bd18 | 2010-06-28 09:32:03 +0000 | [diff] [blame] | 1270 | else |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 1271 | E->setDestroyedType(GetTypeSourceInfo(Record, Idx)); |
Argyrios Kyrtzidis | de4bd18 | 2010-06-28 09:32:03 +0000 | [diff] [blame] | 1272 | } |
| 1273 | |
John McCall | 4765fa0 | 2010-12-06 08:20:24 +0000 | [diff] [blame] | 1274 | void ASTStmtReader::VisitExprWithCleanups(ExprWithCleanups *E) { |
Chris Lattner | d259836 | 2010-05-10 00:25:06 +0000 | [diff] [blame] | 1275 | VisitExpr(E); |
John McCall | 80ee6e8 | 2011-11-10 05:35:25 +0000 | [diff] [blame] | 1276 | |
| 1277 | unsigned NumObjects = Record[Idx++]; |
| 1278 | assert(NumObjects == E->getNumObjects()); |
| 1279 | for (unsigned i = 0; i != NumObjects; ++i) |
| 1280 | E->getObjectsBuffer()[i] = ReadDeclAs<BlockDecl>(Record, Idx); |
| 1281 | |
| 1282 | E->SubExpr = Reader.ReadSubExpr(); |
Chris Lattner | 030854b | 2010-05-09 06:40:08 +0000 | [diff] [blame] | 1283 | } |
| 1284 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1285 | void |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1286 | ASTStmtReader::VisitCXXDependentScopeMemberExpr(CXXDependentScopeMemberExpr *E){ |
Argyrios Kyrtzidis | 8dfbd8b | 2010-06-24 08:57:31 +0000 | [diff] [blame] | 1287 | VisitExpr(E); |
Abramo Bagnara | e4b9276 | 2012-01-27 09:46:47 +0000 | [diff] [blame] | 1288 | |
| 1289 | if (Record[Idx++]) // HasTemplateKWAndArgsInfo |
| 1290 | ReadTemplateKWAndArgsInfo(*E->getTemplateKWAndArgsInfo(), |
| 1291 | /*NumTemplateArgs=*/Record[Idx++]); |
Argyrios Kyrtzidis | 8dfbd8b | 2010-06-24 08:57:31 +0000 | [diff] [blame] | 1292 | |
Douglas Gregor | 7c3179c | 2011-02-28 18:50:33 +0000 | [diff] [blame] | 1293 | E->Base = Reader.ReadSubExpr(); |
Douglas Gregor | 393f249 | 2011-07-22 00:38:23 +0000 | [diff] [blame] | 1294 | E->BaseType = Reader.readType(F, Record, Idx); |
Douglas Gregor | 7c3179c | 2011-02-28 18:50:33 +0000 | [diff] [blame] | 1295 | E->IsArrow = Record[Idx++]; |
| 1296 | E->OperatorLoc = ReadSourceLocation(Record, Idx); |
| 1297 | E->QualifierLoc = Reader.ReadNestedNameSpecifierLoc(F, Record, Idx); |
Douglas Gregor | 409448c | 2011-07-21 22:35:25 +0000 | [diff] [blame] | 1298 | E->FirstQualifierFoundInScope = ReadDeclAs<NamedDecl>(Record, Idx); |
Argyrios Kyrtzidis | 4045107 | 2010-10-15 18:21:24 +0000 | [diff] [blame] | 1299 | ReadDeclarationNameInfo(E->MemberNameInfo, Record, Idx); |
Argyrios Kyrtzidis | 8dfbd8b | 2010-06-24 08:57:31 +0000 | [diff] [blame] | 1300 | } |
| 1301 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1302 | void |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1303 | ASTStmtReader::VisitDependentScopeDeclRefExpr(DependentScopeDeclRefExpr *E) { |
Argyrios Kyrtzidis | 12dffcd | 2010-06-28 09:31:56 +0000 | [diff] [blame] | 1304 | VisitExpr(E); |
Abramo Bagnara | e4b9276 | 2012-01-27 09:46:47 +0000 | [diff] [blame] | 1305 | |
| 1306 | if (Record[Idx++]) // HasTemplateKWAndArgsInfo |
| 1307 | ReadTemplateKWAndArgsInfo(*E->getTemplateKWAndArgsInfo(), |
| 1308 | /*NumTemplateArgs=*/Record[Idx++]); |
Douglas Gregor | 00cf3cc | 2011-02-25 20:49:16 +0000 | [diff] [blame] | 1309 | |
| 1310 | E->QualifierLoc = Reader.ReadNestedNameSpecifierLoc(F, Record, Idx); |
Argyrios Kyrtzidis | 4045107 | 2010-10-15 18:21:24 +0000 | [diff] [blame] | 1311 | ReadDeclarationNameInfo(E->NameInfo, Record, Idx); |
Argyrios Kyrtzidis | 12dffcd | 2010-06-28 09:31:56 +0000 | [diff] [blame] | 1312 | } |
| 1313 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1314 | void |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1315 | ASTStmtReader::VisitCXXUnresolvedConstructExpr(CXXUnresolvedConstructExpr *E) { |
Argyrios Kyrtzidis | 8dfbd8b | 2010-06-24 08:57:31 +0000 | [diff] [blame] | 1316 | VisitExpr(E); |
| 1317 | assert(Record[Idx] == E->arg_size() && "Read wrong record during creation ?"); |
| 1318 | ++Idx; // NumArgs; |
| 1319 | for (unsigned I = 0, N = E->arg_size(); I != N; ++I) |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 1320 | E->setArg(I, Reader.ReadSubExpr()); |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 1321 | E->Type = GetTypeSourceInfo(Record, Idx); |
| 1322 | E->setLParenLoc(ReadSourceLocation(Record, Idx)); |
| 1323 | E->setRParenLoc(ReadSourceLocation(Record, Idx)); |
Argyrios Kyrtzidis | 8dfbd8b | 2010-06-24 08:57:31 +0000 | [diff] [blame] | 1324 | } |
| 1325 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1326 | void ASTStmtReader::VisitOverloadExpr(OverloadExpr *E) { |
Argyrios Kyrtzidis | a77eb08 | 2010-06-25 09:03:26 +0000 | [diff] [blame] | 1327 | VisitExpr(E); |
Abramo Bagnara | e4b9276 | 2012-01-27 09:46:47 +0000 | [diff] [blame] | 1328 | |
| 1329 | if (Record[Idx++]) // HasTemplateKWAndArgsInfo |
| 1330 | ReadTemplateKWAndArgsInfo(*E->getTemplateKWAndArgsInfo(), |
| 1331 | /*NumTemplateArgs=*/Record[Idx++]); |
Argyrios Kyrtzidis | a77eb08 | 2010-06-25 09:03:26 +0000 | [diff] [blame] | 1332 | |
| 1333 | unsigned NumDecls = Record[Idx++]; |
| 1334 | UnresolvedSet<8> Decls; |
| 1335 | for (unsigned i = 0; i != NumDecls; ++i) { |
Douglas Gregor | 409448c | 2011-07-21 22:35:25 +0000 | [diff] [blame] | 1336 | NamedDecl *D = ReadDeclAs<NamedDecl>(Record, Idx); |
Argyrios Kyrtzidis | a77eb08 | 2010-06-25 09:03:26 +0000 | [diff] [blame] | 1337 | AccessSpecifier AS = (AccessSpecifier)Record[Idx++]; |
| 1338 | Decls.addDecl(D, AS); |
| 1339 | } |
Douglas Gregor | 3594277 | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 1340 | E->initializeResults(Reader.getContext(), Decls.begin(), Decls.end()); |
Argyrios Kyrtzidis | a77eb08 | 2010-06-25 09:03:26 +0000 | [diff] [blame] | 1341 | |
Argyrios Kyrtzidis | 4045107 | 2010-10-15 18:21:24 +0000 | [diff] [blame] | 1342 | ReadDeclarationNameInfo(E->NameInfo, Record, Idx); |
Douglas Gregor | 4c9be89 | 2011-02-28 20:01:57 +0000 | [diff] [blame] | 1343 | E->QualifierLoc = Reader.ReadNestedNameSpecifierLoc(F, Record, Idx); |
Argyrios Kyrtzidis | a77eb08 | 2010-06-25 09:03:26 +0000 | [diff] [blame] | 1344 | } |
| 1345 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1346 | void ASTStmtReader::VisitUnresolvedMemberExpr(UnresolvedMemberExpr *E) { |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1347 | VisitOverloadExpr(E); |
Douglas Gregor | 4c9be89 | 2011-02-28 20:01:57 +0000 | [diff] [blame] | 1348 | E->IsArrow = Record[Idx++]; |
| 1349 | E->HasUnresolvedUsing = Record[Idx++]; |
| 1350 | E->Base = Reader.ReadSubExpr(); |
Douglas Gregor | 393f249 | 2011-07-22 00:38:23 +0000 | [diff] [blame] | 1351 | E->BaseType = Reader.readType(F, Record, Idx); |
Douglas Gregor | 4c9be89 | 2011-02-28 20:01:57 +0000 | [diff] [blame] | 1352 | E->OperatorLoc = ReadSourceLocation(Record, Idx); |
Argyrios Kyrtzidis | a77eb08 | 2010-06-25 09:03:26 +0000 | [diff] [blame] | 1353 | } |
| 1354 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1355 | void ASTStmtReader::VisitUnresolvedLookupExpr(UnresolvedLookupExpr *E) { |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1356 | VisitOverloadExpr(E); |
Douglas Gregor | 4c9be89 | 2011-02-28 20:01:57 +0000 | [diff] [blame] | 1357 | E->RequiresADL = Record[Idx++]; |
Richard Smith | ad762fc | 2011-04-14 22:09:26 +0000 | [diff] [blame] | 1358 | if (E->RequiresADL) |
| 1359 | E->StdIsAssociatedNamespace = Record[Idx++]; |
Douglas Gregor | 4c9be89 | 2011-02-28 20:01:57 +0000 | [diff] [blame] | 1360 | E->Overloaded = Record[Idx++]; |
Douglas Gregor | 409448c | 2011-07-21 22:35:25 +0000 | [diff] [blame] | 1361 | E->NamingClass = ReadDeclAs<CXXRecordDecl>(Record, Idx); |
Argyrios Kyrtzidis | bd65bb5 | 2010-06-25 09:03:34 +0000 | [diff] [blame] | 1362 | } |
| 1363 | |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1364 | void ASTStmtReader::VisitUnaryTypeTraitExpr(UnaryTypeTraitExpr *E) { |
Argyrios Kyrtzidis | 6d00c13 | 2010-07-10 11:46:15 +0000 | [diff] [blame] | 1365 | VisitExpr(E); |
| 1366 | E->UTT = (UnaryTypeTrait)Record[Idx++]; |
Sebastian Redl | 0dfd848 | 2010-09-13 20:56:31 +0000 | [diff] [blame] | 1367 | E->Value = (bool)Record[Idx++]; |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 1368 | SourceRange Range = ReadSourceRange(Record, Idx); |
Argyrios Kyrtzidis | 6d00c13 | 2010-07-10 11:46:15 +0000 | [diff] [blame] | 1369 | E->Loc = Range.getBegin(); |
| 1370 | E->RParen = Range.getEnd(); |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 1371 | E->QueriedType = GetTypeSourceInfo(Record, Idx); |
Argyrios Kyrtzidis | 6d00c13 | 2010-07-10 11:46:15 +0000 | [diff] [blame] | 1372 | } |
| 1373 | |
Francois Pichet | 6ad6f28 | 2010-12-07 00:08:36 +0000 | [diff] [blame] | 1374 | void ASTStmtReader::VisitBinaryTypeTraitExpr(BinaryTypeTraitExpr *E) { |
| 1375 | VisitExpr(E); |
| 1376 | E->BTT = (BinaryTypeTrait)Record[Idx++]; |
| 1377 | E->Value = (bool)Record[Idx++]; |
| 1378 | SourceRange Range = ReadSourceRange(Record, Idx); |
| 1379 | E->Loc = Range.getBegin(); |
| 1380 | E->RParen = Range.getEnd(); |
| 1381 | E->LhsType = GetTypeSourceInfo(Record, Idx); |
| 1382 | E->RhsType = GetTypeSourceInfo(Record, Idx); |
| 1383 | } |
| 1384 | |
Douglas Gregor | 4ca8ac2 | 2012-02-24 07:38:34 +0000 | [diff] [blame] | 1385 | void ASTStmtReader::VisitTypeTraitExpr(TypeTraitExpr *E) { |
| 1386 | VisitExpr(E); |
| 1387 | E->TypeTraitExprBits.NumArgs = Record[Idx++]; |
| 1388 | E->TypeTraitExprBits.Kind = Record[Idx++]; |
| 1389 | E->TypeTraitExprBits.Value = Record[Idx++]; |
| 1390 | |
| 1391 | TypeSourceInfo **Args = E->getTypeSourceInfos(); |
| 1392 | for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I) |
| 1393 | Args[I] = GetTypeSourceInfo(Record, Idx); |
| 1394 | } |
| 1395 | |
John Wiegley | 21ff2e5 | 2011-04-28 00:16:57 +0000 | [diff] [blame] | 1396 | void ASTStmtReader::VisitArrayTypeTraitExpr(ArrayTypeTraitExpr *E) { |
| 1397 | VisitExpr(E); |
| 1398 | E->ATT = (ArrayTypeTrait)Record[Idx++]; |
| 1399 | E->Value = (unsigned int)Record[Idx++]; |
| 1400 | SourceRange Range = ReadSourceRange(Record, Idx); |
| 1401 | E->Loc = Range.getBegin(); |
| 1402 | E->RParen = Range.getEnd(); |
| 1403 | E->QueriedType = GetTypeSourceInfo(Record, Idx); |
| 1404 | } |
| 1405 | |
John Wiegley | 5526220 | 2011-04-25 06:54:41 +0000 | [diff] [blame] | 1406 | void ASTStmtReader::VisitExpressionTraitExpr(ExpressionTraitExpr *E) { |
| 1407 | VisitExpr(E); |
| 1408 | E->ET = (ExpressionTrait)Record[Idx++]; |
| 1409 | E->Value = (bool)Record[Idx++]; |
| 1410 | SourceRange Range = ReadSourceRange(Record, Idx); |
| 1411 | E->QueriedExpression = Reader.ReadSubExpr(); |
| 1412 | E->Loc = Range.getBegin(); |
| 1413 | E->RParen = Range.getEnd(); |
| 1414 | } |
| 1415 | |
Sebastian Redl | 6b219d0 | 2010-09-10 20:55:54 +0000 | [diff] [blame] | 1416 | void ASTStmtReader::VisitCXXNoexceptExpr(CXXNoexceptExpr *E) { |
| 1417 | VisitExpr(E); |
Sebastian Redl | 5221d8f | 2010-09-10 22:34:40 +0000 | [diff] [blame] | 1418 | E->Value = (bool)Record[Idx++]; |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 1419 | E->Range = ReadSourceRange(Record, Idx); |
Sebastian Redl | 5221d8f | 2010-09-10 22:34:40 +0000 | [diff] [blame] | 1420 | E->Operand = Reader.ReadSubExpr(); |
Sebastian Redl | 6b219d0 | 2010-09-10 20:55:54 +0000 | [diff] [blame] | 1421 | } |
| 1422 | |
Douglas Gregor | be230c3 | 2011-01-03 17:17:50 +0000 | [diff] [blame] | 1423 | void ASTStmtReader::VisitPackExpansionExpr(PackExpansionExpr *E) { |
| 1424 | VisitExpr(E); |
| 1425 | E->EllipsisLoc = ReadSourceLocation(Record, Idx); |
Douglas Gregor | 67fd125 | 2011-01-14 21:20:45 +0000 | [diff] [blame] | 1426 | E->NumExpansions = Record[Idx++]; |
Douglas Gregor | be230c3 | 2011-01-03 17:17:50 +0000 | [diff] [blame] | 1427 | E->Pattern = Reader.ReadSubExpr(); |
| 1428 | } |
| 1429 | |
Douglas Gregor | ee8aff0 | 2011-01-04 17:33:58 +0000 | [diff] [blame] | 1430 | void ASTStmtReader::VisitSizeOfPackExpr(SizeOfPackExpr *E) { |
| 1431 | VisitExpr(E); |
| 1432 | E->OperatorLoc = ReadSourceLocation(Record, Idx); |
| 1433 | E->PackLoc = ReadSourceLocation(Record, Idx); |
| 1434 | E->RParenLoc = ReadSourceLocation(Record, Idx); |
| 1435 | E->Length = Record[Idx++]; |
Douglas Gregor | 409448c | 2011-07-21 22:35:25 +0000 | [diff] [blame] | 1436 | E->Pack = ReadDeclAs<NamedDecl>(Record, Idx); |
Douglas Gregor | ee8aff0 | 2011-01-04 17:33:58 +0000 | [diff] [blame] | 1437 | } |
| 1438 | |
John McCall | 7110fd6 | 2011-07-15 07:00:14 +0000 | [diff] [blame] | 1439 | void ASTStmtReader::VisitSubstNonTypeTemplateParmExpr( |
| 1440 | SubstNonTypeTemplateParmExpr *E) { |
| 1441 | VisitExpr(E); |
Douglas Gregor | 409448c | 2011-07-21 22:35:25 +0000 | [diff] [blame] | 1442 | E->Param = ReadDeclAs<NonTypeTemplateParmDecl>(Record, Idx); |
John McCall | 7110fd6 | 2011-07-15 07:00:14 +0000 | [diff] [blame] | 1443 | E->NameLoc = ReadSourceLocation(Record, Idx); |
| 1444 | E->Replacement = Reader.ReadSubExpr(); |
| 1445 | } |
| 1446 | |
Douglas Gregor | c7793c7 | 2011-01-15 01:15:58 +0000 | [diff] [blame] | 1447 | void ASTStmtReader::VisitSubstNonTypeTemplateParmPackExpr( |
| 1448 | SubstNonTypeTemplateParmPackExpr *E) { |
| 1449 | VisitExpr(E); |
Douglas Gregor | 409448c | 2011-07-21 22:35:25 +0000 | [diff] [blame] | 1450 | E->Param = ReadDeclAs<NonTypeTemplateParmDecl>(Record, Idx); |
Douglas Gregor | c7793c7 | 2011-01-15 01:15:58 +0000 | [diff] [blame] | 1451 | TemplateArgument ArgPack = Reader.ReadTemplateArgument(F, Record, Idx); |
| 1452 | if (ArgPack.getKind() != TemplateArgument::Pack) |
| 1453 | return; |
| 1454 | |
| 1455 | E->Arguments = ArgPack.pack_begin(); |
| 1456 | E->NumArguments = ArgPack.pack_size(); |
| 1457 | E->NameLoc = ReadSourceLocation(Record, Idx); |
| 1458 | } |
| 1459 | |
Douglas Gregor | 03e8003 | 2011-06-21 17:03:29 +0000 | [diff] [blame] | 1460 | void ASTStmtReader::VisitMaterializeTemporaryExpr(MaterializeTemporaryExpr *E) { |
| 1461 | VisitExpr(E); |
| 1462 | E->Temporary = Reader.ReadSubExpr(); |
| 1463 | } |
| 1464 | |
John McCall | 7cd7d1a | 2010-11-15 23:31:06 +0000 | [diff] [blame] | 1465 | void ASTStmtReader::VisitOpaqueValueExpr(OpaqueValueExpr *E) { |
| 1466 | VisitExpr(E); |
Argyrios Kyrtzidis | 8bc2782 | 2011-12-03 03:49:52 +0000 | [diff] [blame] | 1467 | E->SourceExpr = Reader.ReadSubExpr(); |
Douglas Gregor | b608b98 | 2011-01-28 02:26:04 +0000 | [diff] [blame] | 1468 | E->Loc = ReadSourceLocation(Record, Idx); |
John McCall | 7cd7d1a | 2010-11-15 23:31:06 +0000 | [diff] [blame] | 1469 | } |
| 1470 | |
Peter Collingbourne | e08ce65 | 2011-02-09 21:07:24 +0000 | [diff] [blame] | 1471 | //===----------------------------------------------------------------------===// |
John McCall | 7110fd6 | 2011-07-15 07:00:14 +0000 | [diff] [blame] | 1472 | // Microsoft Expressions and Statements |
| 1473 | //===----------------------------------------------------------------------===// |
| 1474 | void ASTStmtReader::VisitCXXUuidofExpr(CXXUuidofExpr *E) { |
| 1475 | VisitExpr(E); |
| 1476 | E->setSourceRange(ReadSourceRange(Record, Idx)); |
| 1477 | if (E->isTypeOperand()) { // __uuidof(ComType) |
| 1478 | E->setTypeOperandSourceInfo( |
| 1479 | GetTypeSourceInfo(Record, Idx)); |
| 1480 | return; |
| 1481 | } |
| 1482 | |
| 1483 | // __uuidof(expr) |
| 1484 | E->setExprOperand(Reader.ReadSubExpr()); |
| 1485 | } |
| 1486 | |
| 1487 | void ASTStmtReader::VisitSEHExceptStmt(SEHExceptStmt *S) { |
| 1488 | VisitStmt(S); |
| 1489 | S->Loc = ReadSourceLocation(Record, Idx); |
| 1490 | S->Children[SEHExceptStmt::FILTER_EXPR] = Reader.ReadSubStmt(); |
| 1491 | S->Children[SEHExceptStmt::BLOCK] = Reader.ReadSubStmt(); |
| 1492 | } |
| 1493 | |
| 1494 | void ASTStmtReader::VisitSEHFinallyStmt(SEHFinallyStmt *S) { |
| 1495 | VisitStmt(S); |
| 1496 | S->Loc = ReadSourceLocation(Record, Idx); |
| 1497 | S->Block = Reader.ReadSubStmt(); |
| 1498 | } |
| 1499 | |
| 1500 | void ASTStmtReader::VisitSEHTryStmt(SEHTryStmt *S) { |
| 1501 | VisitStmt(S); |
| 1502 | S->IsCXXTry = Record[Idx++]; |
| 1503 | S->TryLoc = ReadSourceLocation(Record, Idx); |
| 1504 | S->Children[SEHTryStmt::TRY] = Reader.ReadSubStmt(); |
| 1505 | S->Children[SEHTryStmt::HANDLER] = Reader.ReadSubStmt(); |
| 1506 | } |
| 1507 | |
| 1508 | //===----------------------------------------------------------------------===// |
Peter Collingbourne | e08ce65 | 2011-02-09 21:07:24 +0000 | [diff] [blame] | 1509 | // CUDA Expressions and Statements |
| 1510 | //===----------------------------------------------------------------------===// |
| 1511 | |
| 1512 | void ASTStmtReader::VisitCUDAKernelCallExpr(CUDAKernelCallExpr *E) { |
| 1513 | VisitCallExpr(E); |
| 1514 | E->setConfig(cast<CallExpr>(Reader.ReadSubExpr())); |
| 1515 | } |
| 1516 | |
John McCall | 7110fd6 | 2011-07-15 07:00:14 +0000 | [diff] [blame] | 1517 | //===----------------------------------------------------------------------===// |
| 1518 | // OpenCL Expressions and Statements. |
| 1519 | //===----------------------------------------------------------------------===// |
| 1520 | void ASTStmtReader::VisitAsTypeExpr(AsTypeExpr *E) { |
| 1521 | VisitExpr(E); |
| 1522 | E->BuiltinLoc = ReadSourceLocation(Record, Idx); |
| 1523 | E->RParenLoc = ReadSourceLocation(Record, Idx); |
| 1524 | E->SrcExpr = Reader.ReadSubExpr(); |
| 1525 | } |
| 1526 | |
| 1527 | //===----------------------------------------------------------------------===// |
| 1528 | // ASTReader Implementation |
| 1529 | //===----------------------------------------------------------------------===// |
| 1530 | |
Douglas Gregor | 1a4761e | 2011-11-30 23:21:26 +0000 | [diff] [blame] | 1531 | Stmt *ASTReader::ReadStmt(ModuleFile &F) { |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1532 | switch (ReadingKind) { |
| 1533 | case Read_Decl: |
| 1534 | case Read_Type: |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 1535 | return ReadStmtFromStream(F); |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1536 | case Read_Stmt: |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 1537 | return ReadSubStmt(); |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1538 | } |
| 1539 | |
| 1540 | llvm_unreachable("ReadingKind not set ?"); |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1541 | } |
| 1542 | |
Douglas Gregor | 1a4761e | 2011-11-30 23:21:26 +0000 | [diff] [blame] | 1543 | Expr *ASTReader::ReadExpr(ModuleFile &F) { |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 1544 | return cast_or_null<Expr>(ReadStmt(F)); |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1545 | } |
Chris Lattner | 030854b | 2010-05-09 06:40:08 +0000 | [diff] [blame] | 1546 | |
Sebastian Redl | c43b54c | 2010-08-18 23:56:43 +0000 | [diff] [blame] | 1547 | Expr *ASTReader::ReadSubExpr() { |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 1548 | return cast_or_null<Expr>(ReadSubStmt()); |
| 1549 | } |
| 1550 | |
Chris Lattner | 52e97d1 | 2009-04-27 05:41:06 +0000 | [diff] [blame] | 1551 | // Within the bitstream, expressions are stored in Reverse Polish |
| 1552 | // Notation, with each of the subexpressions preceding the |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1553 | // expression they are stored in. Subexpressions are stored from last to first. |
| 1554 | // To evaluate expressions, we continue reading expressions and placing them on |
| 1555 | // the stack, with expressions having operands removing those operands from the |
Chris Lattner | 52e97d1 | 2009-04-27 05:41:06 +0000 | [diff] [blame] | 1556 | // stack. Evaluation terminates when we see a STMT_STOP record, and |
| 1557 | // the single remaining expression on the stack is our result. |
Douglas Gregor | 1a4761e | 2011-11-30 23:21:26 +0000 | [diff] [blame] | 1558 | Stmt *ASTReader::ReadStmtFromStream(ModuleFile &F) { |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1559 | |
| 1560 | ReadingKindTracker ReadingKind(Read_Stmt, *this); |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 1561 | llvm::BitstreamCursor &Cursor = F.DeclsCursor; |
Argyrios Kyrtzidis | e6f0868 | 2011-10-21 23:02:28 +0000 | [diff] [blame] | 1562 | |
| 1563 | // Map of offset to previously deserialized stmt. The offset points |
| 1564 | /// just after the stmt record. |
| 1565 | llvm::DenseMap<uint64_t, Stmt *> StmtEntries; |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 1566 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1567 | #ifndef NDEBUG |
| 1568 | unsigned PrevNumStmts = StmtStack.size(); |
| 1569 | #endif |
| 1570 | |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1571 | RecordData Record; |
| 1572 | unsigned Idx; |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 1573 | ASTStmtReader Reader(*this, F, Cursor, Record, Idx); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1574 | Stmt::EmptyShell Empty; |
| 1575 | |
| 1576 | while (true) { |
Chris Lattner | 52e97d1 | 2009-04-27 05:41:06 +0000 | [diff] [blame] | 1577 | unsigned Code = Cursor.ReadCode(); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1578 | if (Code == llvm::bitc::END_BLOCK) { |
Chris Lattner | 52e97d1 | 2009-04-27 05:41:06 +0000 | [diff] [blame] | 1579 | if (Cursor.ReadBlockEnd()) { |
Sebastian Redl | 3c7f413 | 2010-08-18 23:57:06 +0000 | [diff] [blame] | 1580 | Error("error at end of block in AST file"); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1581 | return 0; |
| 1582 | } |
| 1583 | break; |
| 1584 | } |
| 1585 | |
| 1586 | if (Code == llvm::bitc::ENTER_SUBBLOCK) { |
| 1587 | // No known subblocks, always skip them. |
Chris Lattner | 52e97d1 | 2009-04-27 05:41:06 +0000 | [diff] [blame] | 1588 | Cursor.ReadSubBlockID(); |
| 1589 | if (Cursor.SkipBlock()) { |
Sebastian Redl | 3c7f413 | 2010-08-18 23:57:06 +0000 | [diff] [blame] | 1590 | Error("malformed block record in AST file"); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1591 | return 0; |
| 1592 | } |
| 1593 | continue; |
| 1594 | } |
| 1595 | |
| 1596 | if (Code == llvm::bitc::DEFINE_ABBREV) { |
Chris Lattner | 52e97d1 | 2009-04-27 05:41:06 +0000 | [diff] [blame] | 1597 | Cursor.ReadAbbrevRecord(); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1598 | continue; |
| 1599 | } |
| 1600 | |
| 1601 | Stmt *S = 0; |
| 1602 | Idx = 0; |
| 1603 | Record.clear(); |
| 1604 | bool Finished = false; |
Argyrios Kyrtzidis | e6f0868 | 2011-10-21 23:02:28 +0000 | [diff] [blame] | 1605 | bool IsStmtReference = false; |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1606 | switch ((StmtCode)Cursor.ReadRecord(Code, Record)) { |
| 1607 | case STMT_STOP: |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1608 | Finished = true; |
| 1609 | break; |
| 1610 | |
Argyrios Kyrtzidis | e6f0868 | 2011-10-21 23:02:28 +0000 | [diff] [blame] | 1611 | case STMT_REF_PTR: |
| 1612 | IsStmtReference = true; |
| 1613 | assert(StmtEntries.find(Record[0]) != StmtEntries.end() && |
| 1614 | "No stmt was recorded for this offset reference!"); |
| 1615 | S = StmtEntries[Record[Idx++]]; |
| 1616 | break; |
| 1617 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1618 | case STMT_NULL_PTR: |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 1619 | S = 0; |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1620 | break; |
| 1621 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1622 | case STMT_NULL: |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1623 | S = new (Context) NullStmt(Empty); |
| 1624 | break; |
| 1625 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1626 | case STMT_COMPOUND: |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1627 | S = new (Context) CompoundStmt(Empty); |
| 1628 | break; |
| 1629 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1630 | case STMT_CASE: |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1631 | S = new (Context) CaseStmt(Empty); |
| 1632 | break; |
| 1633 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1634 | case STMT_DEFAULT: |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1635 | S = new (Context) DefaultStmt(Empty); |
| 1636 | break; |
| 1637 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1638 | case STMT_LABEL: |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1639 | S = new (Context) LabelStmt(Empty); |
| 1640 | break; |
| 1641 | |
Richard Smith | 534986f | 2012-04-14 00:33:13 +0000 | [diff] [blame] | 1642 | case STMT_ATTRIBUTED: |
| 1643 | S = new (Context) AttributedStmt(Empty); |
| 1644 | break; |
| 1645 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1646 | case STMT_IF: |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1647 | S = new (Context) IfStmt(Empty); |
| 1648 | break; |
| 1649 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1650 | case STMT_SWITCH: |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1651 | S = new (Context) SwitchStmt(Empty); |
| 1652 | break; |
| 1653 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1654 | case STMT_WHILE: |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1655 | S = new (Context) WhileStmt(Empty); |
| 1656 | break; |
| 1657 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1658 | case STMT_DO: |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1659 | S = new (Context) DoStmt(Empty); |
| 1660 | break; |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 1661 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1662 | case STMT_FOR: |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1663 | S = new (Context) ForStmt(Empty); |
| 1664 | break; |
| 1665 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1666 | case STMT_GOTO: |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1667 | S = new (Context) GotoStmt(Empty); |
| 1668 | break; |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 1669 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1670 | case STMT_INDIRECT_GOTO: |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1671 | S = new (Context) IndirectGotoStmt(Empty); |
| 1672 | break; |
| 1673 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1674 | case STMT_CONTINUE: |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1675 | S = new (Context) ContinueStmt(Empty); |
| 1676 | break; |
| 1677 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1678 | case STMT_BREAK: |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1679 | S = new (Context) BreakStmt(Empty); |
| 1680 | break; |
| 1681 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1682 | case STMT_RETURN: |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1683 | S = new (Context) ReturnStmt(Empty); |
| 1684 | break; |
| 1685 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1686 | case STMT_DECL: |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1687 | S = new (Context) DeclStmt(Empty); |
| 1688 | break; |
| 1689 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1690 | case STMT_ASM: |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1691 | S = new (Context) AsmStmt(Empty); |
| 1692 | break; |
| 1693 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1694 | case EXPR_PREDEFINED: |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1695 | S = new (Context) PredefinedExpr(Empty); |
| 1696 | break; |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 1697 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1698 | case EXPR_DECL_REF: |
Chandler Carruth | 3aa8140 | 2011-05-01 23:48:14 +0000 | [diff] [blame] | 1699 | S = DeclRefExpr::CreateEmpty( |
Douglas Gregor | 3594277 | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 1700 | Context, |
Chandler Carruth | 3aa8140 | 2011-05-01 23:48:14 +0000 | [diff] [blame] | 1701 | /*HasQualifier=*/Record[ASTStmtReader::NumExprFields], |
| 1702 | /*HasFoundDecl=*/Record[ASTStmtReader::NumExprFields + 1], |
Abramo Bagnara | e4b9276 | 2012-01-27 09:46:47 +0000 | [diff] [blame] | 1703 | /*HasTemplateKWAndArgsInfo=*/Record[ASTStmtReader::NumExprFields + 2], |
Chandler Carruth | 3aa8140 | 2011-05-01 23:48:14 +0000 | [diff] [blame] | 1704 | /*NumTemplateArgs=*/Record[ASTStmtReader::NumExprFields + 2] ? |
John McCall | f4b88a4 | 2012-03-10 09:33:50 +0000 | [diff] [blame] | 1705 | Record[ASTStmtReader::NumExprFields + 5] : 0); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1706 | break; |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 1707 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1708 | case EXPR_INTEGER_LITERAL: |
Douglas Gregor | 3594277 | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 1709 | S = IntegerLiteral::Create(Context, Empty); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1710 | break; |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 1711 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1712 | case EXPR_FLOATING_LITERAL: |
Douglas Gregor | 3594277 | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 1713 | S = FloatingLiteral::Create(Context, Empty); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1714 | break; |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 1715 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1716 | case EXPR_IMAGINARY_LITERAL: |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1717 | S = new (Context) ImaginaryLiteral(Empty); |
| 1718 | break; |
| 1719 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1720 | case EXPR_STRING_LITERAL: |
Douglas Gregor | 3594277 | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 1721 | S = StringLiteral::CreateEmpty(Context, |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1722 | Record[ASTStmtReader::NumExprFields + 1]); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1723 | break; |
| 1724 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1725 | case EXPR_CHARACTER_LITERAL: |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1726 | S = new (Context) CharacterLiteral(Empty); |
| 1727 | break; |
| 1728 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1729 | case EXPR_PAREN: |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1730 | S = new (Context) ParenExpr(Empty); |
| 1731 | break; |
| 1732 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1733 | case EXPR_PAREN_LIST: |
Argyrios Kyrtzidis | 37bdfe2 | 2010-06-30 08:49:18 +0000 | [diff] [blame] | 1734 | S = new (Context) ParenListExpr(Empty); |
| 1735 | break; |
| 1736 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1737 | case EXPR_UNARY_OPERATOR: |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1738 | S = new (Context) UnaryOperator(Empty); |
| 1739 | break; |
| 1740 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1741 | case EXPR_OFFSETOF: |
Douglas Gregor | 3594277 | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 1742 | S = OffsetOfExpr::CreateEmpty(Context, |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1743 | Record[ASTStmtReader::NumExprFields], |
| 1744 | Record[ASTStmtReader::NumExprFields + 1]); |
Douglas Gregor | 8ecdb65 | 2010-04-28 22:16:22 +0000 | [diff] [blame] | 1745 | break; |
| 1746 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1747 | case EXPR_SIZEOF_ALIGN_OF: |
Peter Collingbourne | f4e3cfb | 2011-03-11 19:24:49 +0000 | [diff] [blame] | 1748 | S = new (Context) UnaryExprOrTypeTraitExpr(Empty); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1749 | break; |
| 1750 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1751 | case EXPR_ARRAY_SUBSCRIPT: |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1752 | S = new (Context) ArraySubscriptExpr(Empty); |
| 1753 | break; |
| 1754 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1755 | case EXPR_CALL: |
Douglas Gregor | 3594277 | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 1756 | S = new (Context) CallExpr(Context, Stmt::CallExprClass, Empty); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1757 | break; |
| 1758 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1759 | case EXPR_MEMBER: { |
Argyrios Kyrtzidis | 663e380 | 2010-07-08 13:09:47 +0000 | [diff] [blame] | 1760 | // We load everything here and fully initialize it at creation. |
| 1761 | // That way we can use MemberExpr::Create and don't have to duplicate its |
| 1762 | // logic with a MemberExpr::CreateEmpty. |
| 1763 | |
| 1764 | assert(Idx == 0); |
Douglas Gregor | 40d96a6 | 2011-02-28 21:54:11 +0000 | [diff] [blame] | 1765 | NestedNameSpecifierLoc QualifierLoc; |
Argyrios Kyrtzidis | 663e380 | 2010-07-08 13:09:47 +0000 | [diff] [blame] | 1766 | if (Record[Idx++]) { // HasQualifier. |
Douglas Gregor | 40d96a6 | 2011-02-28 21:54:11 +0000 | [diff] [blame] | 1767 | QualifierLoc = ReadNestedNameSpecifierLoc(F, Record, Idx); |
Argyrios Kyrtzidis | 663e380 | 2010-07-08 13:09:47 +0000 | [diff] [blame] | 1768 | } |
| 1769 | |
Abramo Bagnara | e4b9276 | 2012-01-27 09:46:47 +0000 | [diff] [blame] | 1770 | SourceLocation TemplateKWLoc; |
Argyrios Kyrtzidis | 663e380 | 2010-07-08 13:09:47 +0000 | [diff] [blame] | 1771 | TemplateArgumentListInfo ArgInfo; |
Abramo Bagnara | e4b9276 | 2012-01-27 09:46:47 +0000 | [diff] [blame] | 1772 | bool HasTemplateKWAndArgsInfo = Record[Idx++]; |
| 1773 | if (HasTemplateKWAndArgsInfo) { |
| 1774 | TemplateKWLoc = ReadSourceLocation(F, Record, Idx); |
Douglas Gregor | def0354 | 2011-02-04 12:01:24 +0000 | [diff] [blame] | 1775 | unsigned NumTemplateArgs = Record[Idx++]; |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 1776 | ArgInfo.setLAngleLoc(ReadSourceLocation(F, Record, Idx)); |
| 1777 | ArgInfo.setRAngleLoc(ReadSourceLocation(F, Record, Idx)); |
Argyrios Kyrtzidis | 663e380 | 2010-07-08 13:09:47 +0000 | [diff] [blame] | 1778 | for (unsigned i = 0; i != NumTemplateArgs; ++i) |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 1779 | ArgInfo.addArgument(ReadTemplateArgumentLoc(F, Record, Idx)); |
Argyrios Kyrtzidis | 663e380 | 2010-07-08 13:09:47 +0000 | [diff] [blame] | 1780 | } |
Abramo Bagnara | 7cc58b4 | 2011-10-05 07:56:41 +0000 | [diff] [blame] | 1781 | |
| 1782 | bool HadMultipleCandidates = Record[Idx++]; |
| 1783 | |
Douglas Gregor | 409448c | 2011-07-21 22:35:25 +0000 | [diff] [blame] | 1784 | NamedDecl *FoundD = ReadDeclAs<NamedDecl>(F, Record, Idx); |
Argyrios Kyrtzidis | 663e380 | 2010-07-08 13:09:47 +0000 | [diff] [blame] | 1785 | AccessSpecifier AS = (AccessSpecifier)Record[Idx++]; |
| 1786 | DeclAccessPair FoundDecl = DeclAccessPair::make(FoundD, AS); |
| 1787 | |
Douglas Gregor | 393f249 | 2011-07-22 00:38:23 +0000 | [diff] [blame] | 1788 | QualType T = readType(F, Record, Idx); |
John McCall | f89e55a | 2010-11-18 06:31:45 +0000 | [diff] [blame] | 1789 | ExprValueKind VK = static_cast<ExprValueKind>(Record[Idx++]); |
| 1790 | ExprObjectKind OK = static_cast<ExprObjectKind>(Record[Idx++]); |
Argyrios Kyrtzidis | 663e380 | 2010-07-08 13:09:47 +0000 | [diff] [blame] | 1791 | Expr *Base = ReadSubExpr(); |
Douglas Gregor | 409448c | 2011-07-21 22:35:25 +0000 | [diff] [blame] | 1792 | ValueDecl *MemberD = ReadDeclAs<ValueDecl>(F, Record, Idx); |
Sebastian Redl | c363273 | 2010-10-05 15:59:54 +0000 | [diff] [blame] | 1793 | SourceLocation MemberLoc = ReadSourceLocation(F, Record, Idx); |
Abramo Bagnara | 2577743 | 2010-08-11 22:01:17 +0000 | [diff] [blame] | 1794 | DeclarationNameInfo MemberNameInfo(MemberD->getDeclName(), MemberLoc); |
Argyrios Kyrtzidis | 663e380 | 2010-07-08 13:09:47 +0000 | [diff] [blame] | 1795 | bool IsArrow = Record[Idx++]; |
| 1796 | |
Douglas Gregor | 3594277 | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 1797 | S = MemberExpr::Create(Context, Base, IsArrow, QualifierLoc, |
Abramo Bagnara | e4b9276 | 2012-01-27 09:46:47 +0000 | [diff] [blame] | 1798 | TemplateKWLoc, MemberD, FoundDecl, MemberNameInfo, |
| 1799 | HasTemplateKWAndArgsInfo ? &ArgInfo : 0, |
| 1800 | T, VK, OK); |
Argyrios Kyrtzidis | 4045107 | 2010-10-15 18:21:24 +0000 | [diff] [blame] | 1801 | ReadDeclarationNameLoc(F, cast<MemberExpr>(S)->MemberDNLoc, |
| 1802 | MemberD->getDeclName(), Record, Idx); |
Abramo Bagnara | 7cc58b4 | 2011-10-05 07:56:41 +0000 | [diff] [blame] | 1803 | if (HadMultipleCandidates) |
| 1804 | cast<MemberExpr>(S)->setHadMultipleCandidates(true); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1805 | break; |
Argyrios Kyrtzidis | 663e380 | 2010-07-08 13:09:47 +0000 | [diff] [blame] | 1806 | } |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1807 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1808 | case EXPR_BINARY_OPERATOR: |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1809 | S = new (Context) BinaryOperator(Empty); |
| 1810 | break; |
| 1811 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1812 | case EXPR_COMPOUND_ASSIGN_OPERATOR: |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1813 | S = new (Context) CompoundAssignOperator(Empty); |
| 1814 | break; |
| 1815 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1816 | case EXPR_CONDITIONAL_OPERATOR: |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1817 | S = new (Context) ConditionalOperator(Empty); |
| 1818 | break; |
| 1819 | |
John McCall | 56ca35d | 2011-02-17 10:25:35 +0000 | [diff] [blame] | 1820 | case EXPR_BINARY_CONDITIONAL_OPERATOR: |
| 1821 | S = new (Context) BinaryConditionalOperator(Empty); |
| 1822 | break; |
| 1823 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1824 | case EXPR_IMPLICIT_CAST: |
Douglas Gregor | 3594277 | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 1825 | S = ImplicitCastExpr::CreateEmpty(Context, |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1826 | /*PathSize*/ Record[ASTStmtReader::NumExprFields]); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1827 | break; |
| 1828 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1829 | case EXPR_CSTYLE_CAST: |
Douglas Gregor | 3594277 | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 1830 | S = CStyleCastExpr::CreateEmpty(Context, |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1831 | /*PathSize*/ Record[ASTStmtReader::NumExprFields]); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1832 | break; |
| 1833 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1834 | case EXPR_COMPOUND_LITERAL: |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1835 | S = new (Context) CompoundLiteralExpr(Empty); |
| 1836 | break; |
| 1837 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1838 | case EXPR_EXT_VECTOR_ELEMENT: |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1839 | S = new (Context) ExtVectorElementExpr(Empty); |
| 1840 | break; |
| 1841 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1842 | case EXPR_INIT_LIST: |
Douglas Gregor | 3594277 | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 1843 | S = new (Context) InitListExpr(getContext(), Empty); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1844 | break; |
| 1845 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1846 | case EXPR_DESIGNATED_INIT: |
Douglas Gregor | 3594277 | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 1847 | S = DesignatedInitExpr::CreateEmpty(Context, |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1848 | Record[ASTStmtReader::NumExprFields] - 1); |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 1849 | |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1850 | break; |
| 1851 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1852 | case EXPR_IMPLICIT_VALUE_INIT: |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1853 | S = new (Context) ImplicitValueInitExpr(Empty); |
| 1854 | break; |
| 1855 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1856 | case EXPR_VA_ARG: |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1857 | S = new (Context) VAArgExpr(Empty); |
| 1858 | break; |
| 1859 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1860 | case EXPR_ADDR_LABEL: |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1861 | S = new (Context) AddrLabelExpr(Empty); |
| 1862 | break; |
| 1863 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1864 | case EXPR_STMT: |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1865 | S = new (Context) StmtExpr(Empty); |
| 1866 | break; |
| 1867 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1868 | case EXPR_CHOOSE: |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1869 | S = new (Context) ChooseExpr(Empty); |
| 1870 | break; |
| 1871 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1872 | case EXPR_GNU_NULL: |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1873 | S = new (Context) GNUNullExpr(Empty); |
| 1874 | break; |
| 1875 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1876 | case EXPR_SHUFFLE_VECTOR: |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1877 | S = new (Context) ShuffleVectorExpr(Empty); |
| 1878 | break; |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 1879 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1880 | case EXPR_BLOCK: |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1881 | S = new (Context) BlockExpr(Empty); |
| 1882 | break; |
| 1883 | |
Peter Collingbourne | f111d93 | 2011-04-15 00:35:48 +0000 | [diff] [blame] | 1884 | case EXPR_GENERIC_SELECTION: |
| 1885 | S = new (Context) GenericSelectionExpr(Empty); |
| 1886 | break; |
| 1887 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1888 | case EXPR_OBJC_STRING_LITERAL: |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1889 | S = new (Context) ObjCStringLiteral(Empty); |
| 1890 | break; |
Patrick Beard | eb382ec | 2012-04-19 00:25:12 +0000 | [diff] [blame^] | 1891 | case EXPR_OBJC_BOXED_EXPRESSION: |
| 1892 | S = new (Context) ObjCBoxedExpr(Empty); |
Ted Kremenek | ebcb57a | 2012-03-06 20:05:56 +0000 | [diff] [blame] | 1893 | break; |
| 1894 | case EXPR_OBJC_ARRAY_LITERAL: |
| 1895 | S = ObjCArrayLiteral::CreateEmpty(Context, |
| 1896 | Record[ASTStmtReader::NumExprFields]); |
| 1897 | break; |
| 1898 | case EXPR_OBJC_DICTIONARY_LITERAL: |
| 1899 | S = ObjCDictionaryLiteral::CreateEmpty(Context, |
| 1900 | Record[ASTStmtReader::NumExprFields], |
| 1901 | Record[ASTStmtReader::NumExprFields + 1]); |
| 1902 | break; |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1903 | case EXPR_OBJC_ENCODE: |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1904 | S = new (Context) ObjCEncodeExpr(Empty); |
| 1905 | break; |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1906 | case EXPR_OBJC_SELECTOR_EXPR: |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1907 | S = new (Context) ObjCSelectorExpr(Empty); |
| 1908 | break; |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1909 | case EXPR_OBJC_PROTOCOL_EXPR: |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1910 | S = new (Context) ObjCProtocolExpr(Empty); |
| 1911 | break; |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1912 | case EXPR_OBJC_IVAR_REF_EXPR: |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1913 | S = new (Context) ObjCIvarRefExpr(Empty); |
| 1914 | break; |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1915 | case EXPR_OBJC_PROPERTY_REF_EXPR: |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1916 | S = new (Context) ObjCPropertyRefExpr(Empty); |
| 1917 | break; |
Ted Kremenek | ebcb57a | 2012-03-06 20:05:56 +0000 | [diff] [blame] | 1918 | case EXPR_OBJC_SUBSCRIPT_REF_EXPR: |
| 1919 | S = new (Context) ObjCSubscriptRefExpr(Empty); |
| 1920 | break; |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1921 | case EXPR_OBJC_KVC_REF_EXPR: |
John McCall | 12f78a6 | 2010-12-02 01:19:52 +0000 | [diff] [blame] | 1922 | llvm_unreachable("mismatching AST file"); |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1923 | case EXPR_OBJC_MESSAGE_EXPR: |
Douglas Gregor | 3594277 | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 1924 | S = ObjCMessageExpr::CreateEmpty(Context, |
Argyrios Kyrtzidis | 2071808 | 2011-10-03 06:36:51 +0000 | [diff] [blame] | 1925 | Record[ASTStmtReader::NumExprFields], |
| 1926 | Record[ASTStmtReader::NumExprFields + 1]); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1927 | break; |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1928 | case EXPR_OBJC_ISA: |
Steve Naroff | f242b1b | 2009-07-24 17:54:45 +0000 | [diff] [blame] | 1929 | S = new (Context) ObjCIsaExpr(Empty); |
| 1930 | break; |
John McCall | f85e193 | 2011-06-15 23:02:42 +0000 | [diff] [blame] | 1931 | case EXPR_OBJC_INDIRECT_COPY_RESTORE: |
| 1932 | S = new (Context) ObjCIndirectCopyRestoreExpr(Empty); |
| 1933 | break; |
| 1934 | case EXPR_OBJC_BRIDGED_CAST: |
| 1935 | S = new (Context) ObjCBridgedCastExpr(Empty); |
| 1936 | break; |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1937 | case STMT_OBJC_FOR_COLLECTION: |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1938 | S = new (Context) ObjCForCollectionStmt(Empty); |
| 1939 | break; |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1940 | case STMT_OBJC_CATCH: |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1941 | S = new (Context) ObjCAtCatchStmt(Empty); |
| 1942 | break; |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1943 | case STMT_OBJC_FINALLY: |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1944 | S = new (Context) ObjCAtFinallyStmt(Empty); |
| 1945 | break; |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1946 | case STMT_OBJC_AT_TRY: |
Douglas Gregor | 3594277 | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 1947 | S = ObjCAtTryStmt::CreateEmpty(Context, |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1948 | Record[ASTStmtReader::NumStmtFields], |
| 1949 | Record[ASTStmtReader::NumStmtFields + 1]); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1950 | break; |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1951 | case STMT_OBJC_AT_SYNCHRONIZED: |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1952 | S = new (Context) ObjCAtSynchronizedStmt(Empty); |
| 1953 | break; |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1954 | case STMT_OBJC_AT_THROW: |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1955 | S = new (Context) ObjCAtThrowStmt(Empty); |
| 1956 | break; |
John McCall | f85e193 | 2011-06-15 23:02:42 +0000 | [diff] [blame] | 1957 | case STMT_OBJC_AUTORELEASE_POOL: |
| 1958 | S = new (Context) ObjCAutoreleasePoolStmt(Empty); |
| 1959 | break; |
Ted Kremenek | ebcb57a | 2012-03-06 20:05:56 +0000 | [diff] [blame] | 1960 | case EXPR_OBJC_BOOL_LITERAL: |
| 1961 | S = new (Context) ObjCBoolLiteralExpr(Empty); |
| 1962 | break; |
John McCall | 7110fd6 | 2011-07-15 07:00:14 +0000 | [diff] [blame] | 1963 | case STMT_SEH_EXCEPT: |
| 1964 | S = new (Context) SEHExceptStmt(Empty); |
| 1965 | break; |
| 1966 | case STMT_SEH_FINALLY: |
| 1967 | S = new (Context) SEHFinallyStmt(Empty); |
| 1968 | break; |
| 1969 | case STMT_SEH_TRY: |
| 1970 | S = new (Context) SEHTryStmt(Empty); |
| 1971 | break; |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1972 | case STMT_CXX_CATCH: |
Argyrios Kyrtzidis | 7cb45e3 | 2010-07-22 16:03:56 +0000 | [diff] [blame] | 1973 | S = new (Context) CXXCatchStmt(Empty); |
| 1974 | break; |
| 1975 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1976 | case STMT_CXX_TRY: |
Douglas Gregor | 3594277 | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 1977 | S = CXXTryStmt::Create(Context, Empty, |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 1978 | /*NumHandlers=*/Record[ASTStmtReader::NumStmtFields]); |
Argyrios Kyrtzidis | 7cb45e3 | 2010-07-22 16:03:56 +0000 | [diff] [blame] | 1979 | break; |
| 1980 | |
Richard Smith | ad762fc | 2011-04-14 22:09:26 +0000 | [diff] [blame] | 1981 | case STMT_CXX_FOR_RANGE: |
| 1982 | S = new (Context) CXXForRangeStmt(Empty); |
| 1983 | break; |
| 1984 | |
Douglas Gregor | ba0513d | 2011-10-25 01:33:02 +0000 | [diff] [blame] | 1985 | case STMT_MS_DEPENDENT_EXISTS: |
| 1986 | S = new (Context) MSDependentExistsStmt(SourceLocation(), true, |
| 1987 | NestedNameSpecifierLoc(), |
| 1988 | DeclarationNameInfo(), |
| 1989 | 0); |
| 1990 | break; |
| 1991 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1992 | case EXPR_CXX_OPERATOR_CALL: |
Douglas Gregor | 3594277 | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 1993 | S = new (Context) CXXOperatorCallExpr(Context, Empty); |
Argyrios Kyrtzidis | ba0a900 | 2009-07-14 03:19:21 +0000 | [diff] [blame] | 1994 | break; |
Chris Lattner | 1817bd4 | 2010-05-09 05:36:05 +0000 | [diff] [blame] | 1995 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 1996 | case EXPR_CXX_MEMBER_CALL: |
Douglas Gregor | 3594277 | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 1997 | S = new (Context) CXXMemberCallExpr(Context, Empty); |
Chris Lattner | 1817bd4 | 2010-05-09 05:36:05 +0000 | [diff] [blame] | 1998 | break; |
Douglas Gregor | 39da0b8 | 2009-09-09 23:08:42 +0000 | [diff] [blame] | 1999 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 2000 | case EXPR_CXX_CONSTRUCT: |
Argyrios Kyrtzidis | 6d00c13 | 2010-07-10 11:46:15 +0000 | [diff] [blame] | 2001 | S = new (Context) CXXConstructExpr(Empty); |
| 2002 | break; |
| 2003 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 2004 | case EXPR_CXX_TEMPORARY_OBJECT: |
Argyrios Kyrtzidis | 6d00c13 | 2010-07-10 11:46:15 +0000 | [diff] [blame] | 2005 | S = new (Context) CXXTemporaryObjectExpr(Empty); |
Douglas Gregor | 39da0b8 | 2009-09-09 23:08:42 +0000 | [diff] [blame] | 2006 | break; |
Sam Weinig | ce757a7 | 2010-01-16 21:21:01 +0000 | [diff] [blame] | 2007 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 2008 | case EXPR_CXX_STATIC_CAST: |
Douglas Gregor | 3594277 | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 2009 | S = CXXStaticCastExpr::CreateEmpty(Context, |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 2010 | /*PathSize*/ Record[ASTStmtReader::NumExprFields]); |
Sam Weinig | ce757a7 | 2010-01-16 21:21:01 +0000 | [diff] [blame] | 2011 | break; |
| 2012 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 2013 | case EXPR_CXX_DYNAMIC_CAST: |
Douglas Gregor | 3594277 | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 2014 | S = CXXDynamicCastExpr::CreateEmpty(Context, |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 2015 | /*PathSize*/ Record[ASTStmtReader::NumExprFields]); |
Sam Weinig | ce757a7 | 2010-01-16 21:21:01 +0000 | [diff] [blame] | 2016 | break; |
| 2017 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 2018 | case EXPR_CXX_REINTERPRET_CAST: |
Douglas Gregor | 3594277 | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 2019 | S = CXXReinterpretCastExpr::CreateEmpty(Context, |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 2020 | /*PathSize*/ Record[ASTStmtReader::NumExprFields]); |
Sam Weinig | ce757a7 | 2010-01-16 21:21:01 +0000 | [diff] [blame] | 2021 | break; |
| 2022 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 2023 | case EXPR_CXX_CONST_CAST: |
Douglas Gregor | 3594277 | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 2024 | S = CXXConstCastExpr::CreateEmpty(Context); |
Sam Weinig | ce757a7 | 2010-01-16 21:21:01 +0000 | [diff] [blame] | 2025 | break; |
| 2026 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 2027 | case EXPR_CXX_FUNCTIONAL_CAST: |
Douglas Gregor | 3594277 | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 2028 | S = CXXFunctionalCastExpr::CreateEmpty(Context, |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 2029 | /*PathSize*/ Record[ASTStmtReader::NumExprFields]); |
Sam Weinig | ce757a7 | 2010-01-16 21:21:01 +0000 | [diff] [blame] | 2030 | break; |
| 2031 | |
Richard Smith | 9fcce65 | 2012-03-07 08:35:16 +0000 | [diff] [blame] | 2032 | case EXPR_USER_DEFINED_LITERAL: |
| 2033 | S = new (Context) UserDefinedLiteral(Context, Empty); |
| 2034 | break; |
| 2035 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 2036 | case EXPR_CXX_BOOL_LITERAL: |
Sam Weinig | eb7f961 | 2010-02-07 06:32:43 +0000 | [diff] [blame] | 2037 | S = new (Context) CXXBoolLiteralExpr(Empty); |
| 2038 | break; |
Sam Weinig | ce757a7 | 2010-01-16 21:21:01 +0000 | [diff] [blame] | 2039 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 2040 | case EXPR_CXX_NULL_PTR_LITERAL: |
Sam Weinig | eb7f961 | 2010-02-07 06:32:43 +0000 | [diff] [blame] | 2041 | S = new (Context) CXXNullPtrLiteralExpr(Empty); |
| 2042 | break; |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 2043 | case EXPR_CXX_TYPEID_EXPR: |
Chris Lattner | 14ab24f | 2010-05-09 06:03:39 +0000 | [diff] [blame] | 2044 | S = new (Context) CXXTypeidExpr(Empty, true); |
| 2045 | break; |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 2046 | case EXPR_CXX_TYPEID_TYPE: |
Chris Lattner | 14ab24f | 2010-05-09 06:03:39 +0000 | [diff] [blame] | 2047 | S = new (Context) CXXTypeidExpr(Empty, false); |
| 2048 | break; |
Francois Pichet | 01b7c30 | 2010-09-08 12:20:18 +0000 | [diff] [blame] | 2049 | case EXPR_CXX_UUIDOF_EXPR: |
| 2050 | S = new (Context) CXXUuidofExpr(Empty, true); |
| 2051 | break; |
| 2052 | case EXPR_CXX_UUIDOF_TYPE: |
| 2053 | S = new (Context) CXXUuidofExpr(Empty, false); |
| 2054 | break; |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 2055 | case EXPR_CXX_THIS: |
Chris Lattner | 2fbdfcd | 2010-05-09 06:15:05 +0000 | [diff] [blame] | 2056 | S = new (Context) CXXThisExpr(Empty); |
| 2057 | break; |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 2058 | case EXPR_CXX_THROW: |
Chris Lattner | 2fbdfcd | 2010-05-09 06:15:05 +0000 | [diff] [blame] | 2059 | S = new (Context) CXXThrowExpr(Empty); |
| 2060 | break; |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 2061 | case EXPR_CXX_DEFAULT_ARG: { |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 2062 | bool HasOtherExprStored = Record[ASTStmtReader::NumExprFields]; |
Argyrios Kyrtzidis | 8a50733 | 2010-07-02 23:30:15 +0000 | [diff] [blame] | 2063 | if (HasOtherExprStored) { |
| 2064 | Expr *SubExpr = ReadSubExpr(); |
Douglas Gregor | 3594277 | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 2065 | S = CXXDefaultArgExpr::Create(Context, SourceLocation(), 0, SubExpr); |
Argyrios Kyrtzidis | 8a50733 | 2010-07-02 23:30:15 +0000 | [diff] [blame] | 2066 | } else |
| 2067 | S = new (Context) CXXDefaultArgExpr(Empty); |
Chris Lattner | 030854b | 2010-05-09 06:40:08 +0000 | [diff] [blame] | 2068 | break; |
Argyrios Kyrtzidis | 8a50733 | 2010-07-02 23:30:15 +0000 | [diff] [blame] | 2069 | } |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 2070 | case EXPR_CXX_BIND_TEMPORARY: |
Chris Lattner | d259836 | 2010-05-10 00:25:06 +0000 | [diff] [blame] | 2071 | S = new (Context) CXXBindTemporaryExpr(Empty); |
| 2072 | break; |
Douglas Gregor | e2ca6d4 | 2010-09-02 21:50:02 +0000 | [diff] [blame] | 2073 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 2074 | case EXPR_CXX_SCALAR_VALUE_INIT: |
Douglas Gregor | ed8abf1 | 2010-07-08 06:14:04 +0000 | [diff] [blame] | 2075 | S = new (Context) CXXScalarValueInitExpr(Empty); |
Chris Lattner | 5921863 | 2010-05-10 01:22:27 +0000 | [diff] [blame] | 2076 | break; |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 2077 | case EXPR_CXX_NEW: |
Chris Lattner | 5921863 | 2010-05-10 01:22:27 +0000 | [diff] [blame] | 2078 | S = new (Context) CXXNewExpr(Empty); |
| 2079 | break; |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 2080 | case EXPR_CXX_DELETE: |
Argyrios Kyrtzidis | 95fc98c | 2010-06-22 17:07:59 +0000 | [diff] [blame] | 2081 | S = new (Context) CXXDeleteExpr(Empty); |
| 2082 | break; |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 2083 | case EXPR_CXX_PSEUDO_DESTRUCTOR: |
Argyrios Kyrtzidis | de4bd18 | 2010-06-28 09:32:03 +0000 | [diff] [blame] | 2084 | S = new (Context) CXXPseudoDestructorExpr(Empty); |
| 2085 | break; |
Chris Lattner | 5921863 | 2010-05-10 01:22:27 +0000 | [diff] [blame] | 2086 | |
John McCall | 4765fa0 | 2010-12-06 08:20:24 +0000 | [diff] [blame] | 2087 | case EXPR_EXPR_WITH_CLEANUPS: |
John McCall | 80ee6e8 | 2011-11-10 05:35:25 +0000 | [diff] [blame] | 2088 | S = ExprWithCleanups::Create(Context, Empty, |
| 2089 | Record[ASTStmtReader::NumExprFields]); |
Chris Lattner | d259836 | 2010-05-10 00:25:06 +0000 | [diff] [blame] | 2090 | break; |
Argyrios Kyrtzidis | 8dfbd8b | 2010-06-24 08:57:31 +0000 | [diff] [blame] | 2091 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 2092 | case EXPR_CXX_DEPENDENT_SCOPE_MEMBER: |
Douglas Gregor | 3594277 | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 2093 | S = CXXDependentScopeMemberExpr::CreateEmpty(Context, |
Abramo Bagnara | e4b9276 | 2012-01-27 09:46:47 +0000 | [diff] [blame] | 2094 | /*HasTemplateKWAndArgsInfo=*/Record[ASTStmtReader::NumExprFields], |
Douglas Gregor | def0354 | 2011-02-04 12:01:24 +0000 | [diff] [blame] | 2095 | /*NumTemplateArgs=*/Record[ASTStmtReader::NumExprFields] |
| 2096 | ? Record[ASTStmtReader::NumExprFields + 1] |
| 2097 | : 0); |
Argyrios Kyrtzidis | 8dfbd8b | 2010-06-24 08:57:31 +0000 | [diff] [blame] | 2098 | break; |
| 2099 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 2100 | case EXPR_CXX_DEPENDENT_SCOPE_DECL_REF: |
Douglas Gregor | 3594277 | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 2101 | S = DependentScopeDeclRefExpr::CreateEmpty(Context, |
Abramo Bagnara | e4b9276 | 2012-01-27 09:46:47 +0000 | [diff] [blame] | 2102 | /*HasTemplateKWAndArgsInfo=*/Record[ASTStmtReader::NumExprFields], |
Douglas Gregor | def0354 | 2011-02-04 12:01:24 +0000 | [diff] [blame] | 2103 | /*NumTemplateArgs=*/Record[ASTStmtReader::NumExprFields] |
| 2104 | ? Record[ASTStmtReader::NumExprFields + 1] |
| 2105 | : 0); |
Argyrios Kyrtzidis | 12dffcd | 2010-06-28 09:31:56 +0000 | [diff] [blame] | 2106 | break; |
| 2107 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 2108 | case EXPR_CXX_UNRESOLVED_CONSTRUCT: |
Douglas Gregor | 3594277 | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 2109 | S = CXXUnresolvedConstructExpr::CreateEmpty(Context, |
Sebastian Redl | 60adf4a | 2010-08-18 23:56:52 +0000 | [diff] [blame] | 2110 | /*NumArgs=*/Record[ASTStmtReader::NumExprFields]); |
Argyrios Kyrtzidis | a77eb08 | 2010-06-25 09:03:26 +0000 | [diff] [blame] | 2111 | break; |
| 2112 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 2113 | case EXPR_CXX_UNRESOLVED_MEMBER: |
Douglas Gregor | 3594277 | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 2114 | S = UnresolvedMemberExpr::CreateEmpty(Context, |
Abramo Bagnara | e4b9276 | 2012-01-27 09:46:47 +0000 | [diff] [blame] | 2115 | /*HasTemplateKWAndArgsInfo=*/Record[ASTStmtReader::NumExprFields], |
Douglas Gregor | def0354 | 2011-02-04 12:01:24 +0000 | [diff] [blame] | 2116 | /*NumTemplateArgs=*/Record[ASTStmtReader::NumExprFields] |
| 2117 | ? Record[ASTStmtReader::NumExprFields + 1] |
| 2118 | : 0); |
Argyrios Kyrtzidis | 8dfbd8b | 2010-06-24 08:57:31 +0000 | [diff] [blame] | 2119 | break; |
Argyrios Kyrtzidis | bd65bb5 | 2010-06-25 09:03:34 +0000 | [diff] [blame] | 2120 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 2121 | case EXPR_CXX_UNRESOLVED_LOOKUP: |
Douglas Gregor | 3594277 | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 2122 | S = UnresolvedLookupExpr::CreateEmpty(Context, |
Abramo Bagnara | e4b9276 | 2012-01-27 09:46:47 +0000 | [diff] [blame] | 2123 | /*HasTemplateKWAndArgsInfo=*/Record[ASTStmtReader::NumExprFields], |
Douglas Gregor | def0354 | 2011-02-04 12:01:24 +0000 | [diff] [blame] | 2124 | /*NumTemplateArgs=*/Record[ASTStmtReader::NumExprFields] |
| 2125 | ? Record[ASTStmtReader::NumExprFields + 1] |
| 2126 | : 0); |
Argyrios Kyrtzidis | bd65bb5 | 2010-06-25 09:03:34 +0000 | [diff] [blame] | 2127 | break; |
Argyrios Kyrtzidis | 6d00c13 | 2010-07-10 11:46:15 +0000 | [diff] [blame] | 2128 | |
Sebastian Redl | 8538e8d | 2010-08-18 23:57:32 +0000 | [diff] [blame] | 2129 | case EXPR_CXX_UNARY_TYPE_TRAIT: |
Argyrios Kyrtzidis | 6d00c13 | 2010-07-10 11:46:15 +0000 | [diff] [blame] | 2130 | S = new (Context) UnaryTypeTraitExpr(Empty); |
| 2131 | break; |
Sebastian Redl | 6b219d0 | 2010-09-10 20:55:54 +0000 | [diff] [blame] | 2132 | |
Francois Pichet | f187237 | 2010-12-08 22:35:30 +0000 | [diff] [blame] | 2133 | case EXPR_BINARY_TYPE_TRAIT: |
Francois Pichet | 6ad6f28 | 2010-12-07 00:08:36 +0000 | [diff] [blame] | 2134 | S = new (Context) BinaryTypeTraitExpr(Empty); |
| 2135 | break; |
| 2136 | |
Douglas Gregor | 4ca8ac2 | 2012-02-24 07:38:34 +0000 | [diff] [blame] | 2137 | case EXPR_TYPE_TRAIT: |
| 2138 | S = TypeTraitExpr::CreateDeserialized(Context, |
| 2139 | Record[ASTStmtReader::NumExprFields]); |
| 2140 | break; |
| 2141 | |
John Wiegley | 21ff2e5 | 2011-04-28 00:16:57 +0000 | [diff] [blame] | 2142 | case EXPR_ARRAY_TYPE_TRAIT: |
| 2143 | S = new (Context) ArrayTypeTraitExpr(Empty); |
| 2144 | break; |
| 2145 | |
John Wiegley | 5526220 | 2011-04-25 06:54:41 +0000 | [diff] [blame] | 2146 | case EXPR_CXX_EXPRESSION_TRAIT: |
| 2147 | S = new (Context) ExpressionTraitExpr(Empty); |
| 2148 | break; |
| 2149 | |
Sebastian Redl | 6b219d0 | 2010-09-10 20:55:54 +0000 | [diff] [blame] | 2150 | case EXPR_CXX_NOEXCEPT: |
| 2151 | S = new (Context) CXXNoexceptExpr(Empty); |
| 2152 | break; |
John McCall | 7cd7d1a | 2010-11-15 23:31:06 +0000 | [diff] [blame] | 2153 | |
Douglas Gregor | be230c3 | 2011-01-03 17:17:50 +0000 | [diff] [blame] | 2154 | case EXPR_PACK_EXPANSION: |
| 2155 | S = new (Context) PackExpansionExpr(Empty); |
| 2156 | break; |
| 2157 | |
Douglas Gregor | ee8aff0 | 2011-01-04 17:33:58 +0000 | [diff] [blame] | 2158 | case EXPR_SIZEOF_PACK: |
| 2159 | S = new (Context) SizeOfPackExpr(Empty); |
| 2160 | break; |
| 2161 | |
John McCall | 7110fd6 | 2011-07-15 07:00:14 +0000 | [diff] [blame] | 2162 | case EXPR_SUBST_NON_TYPE_TEMPLATE_PARM: |
| 2163 | S = new (Context) SubstNonTypeTemplateParmExpr(Empty); |
| 2164 | break; |
| 2165 | |
Douglas Gregor | c7793c7 | 2011-01-15 01:15:58 +0000 | [diff] [blame] | 2166 | case EXPR_SUBST_NON_TYPE_TEMPLATE_PARM_PACK: |
| 2167 | S = new (Context) SubstNonTypeTemplateParmPackExpr(Empty); |
| 2168 | break; |
| 2169 | |
Douglas Gregor | 03e8003 | 2011-06-21 17:03:29 +0000 | [diff] [blame] | 2170 | case EXPR_MATERIALIZE_TEMPORARY: |
| 2171 | S = new (Context) MaterializeTemporaryExpr(Empty); |
| 2172 | break; |
| 2173 | |
Argyrios Kyrtzidis | 8bc2782 | 2011-12-03 03:49:52 +0000 | [diff] [blame] | 2174 | case EXPR_OPAQUE_VALUE: |
| 2175 | S = new (Context) OpaqueValueExpr(Empty); |
John McCall | 7cd7d1a | 2010-11-15 23:31:06 +0000 | [diff] [blame] | 2176 | break; |
Peter Collingbourne | e08ce65 | 2011-02-09 21:07:24 +0000 | [diff] [blame] | 2177 | |
| 2178 | case EXPR_CUDA_KERNEL_CALL: |
Douglas Gregor | 3594277 | 2011-09-09 21:34:22 +0000 | [diff] [blame] | 2179 | S = new (Context) CUDAKernelCallExpr(Context, Empty); |
Peter Collingbourne | e08ce65 | 2011-02-09 21:07:24 +0000 | [diff] [blame] | 2180 | break; |
Tanya Lattner | 61eee0c | 2011-06-04 00:47:47 +0000 | [diff] [blame] | 2181 | |
| 2182 | case EXPR_ASTYPE: |
| 2183 | S = new (Context) AsTypeExpr(Empty); |
| 2184 | break; |
Eli Friedman | 276b061 | 2011-10-11 02:20:01 +0000 | [diff] [blame] | 2185 | |
John McCall | 4b9c2d2 | 2011-11-06 09:01:30 +0000 | [diff] [blame] | 2186 | case EXPR_PSEUDO_OBJECT: { |
| 2187 | unsigned numSemanticExprs = Record[ASTStmtReader::NumExprFields]; |
| 2188 | S = PseudoObjectExpr::Create(Context, Empty, numSemanticExprs); |
| 2189 | break; |
| 2190 | } |
| 2191 | |
Eli Friedman | 276b061 | 2011-10-11 02:20:01 +0000 | [diff] [blame] | 2192 | case EXPR_ATOMIC: |
| 2193 | S = new (Context) AtomicExpr(Empty); |
| 2194 | break; |
Douglas Gregor | 9d36f5d | 2012-02-14 17:54:36 +0000 | [diff] [blame] | 2195 | |
| 2196 | case EXPR_LAMBDA: { |
| 2197 | unsigned NumCaptures = Record[ASTStmtReader::NumExprFields]; |
| 2198 | unsigned NumArrayIndexVars = Record[ASTStmtReader::NumExprFields + 1]; |
| 2199 | S = LambdaExpr::CreateDeserialized(Context, NumCaptures, |
| 2200 | NumArrayIndexVars); |
| 2201 | break; |
| 2202 | } |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 2203 | } |
Argyrios Kyrtzidis | 6d00c13 | 2010-07-10 11:46:15 +0000 | [diff] [blame] | 2204 | |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 2205 | // We hit a STMT_STOP, so we're done with this expression. |
| 2206 | if (Finished) |
| 2207 | break; |
| 2208 | |
| 2209 | ++NumStatementsRead; |
| 2210 | |
Argyrios Kyrtzidis | e6f0868 | 2011-10-21 23:02:28 +0000 | [diff] [blame] | 2211 | if (S && !IsStmtReference) { |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 2212 | Reader.Visit(S); |
Argyrios Kyrtzidis | e6f0868 | 2011-10-21 23:02:28 +0000 | [diff] [blame] | 2213 | StmtEntries[Cursor.GetCurrentBitNo()] = S; |
| 2214 | } |
| 2215 | |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 2216 | |
| 2217 | assert(Idx == Record.size() && "Invalid deserialization of statement"); |
| 2218 | StmtStack.push_back(S); |
| 2219 | } |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 2220 | |
| 2221 | #ifndef NDEBUG |
| 2222 | assert(StmtStack.size() > PrevNumStmts && "Read too many sub stmts!"); |
| 2223 | assert(StmtStack.size() == PrevNumStmts + 1 && "Extra expressions on stack!"); |
| 2224 | #endif |
| 2225 | |
| 2226 | return StmtStack.pop_back_val(); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 2227 | } |