Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1 | //===--- PCHReaderStmt.cpp - Stmt/Expr Deserialization ----------*- C++ -*-===// |
| 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 |
| 11 | // PCHReader::ReadStmt method. |
| 12 | // |
| 13 | //===----------------------------------------------------------------------===// |
| 14 | |
| 15 | #include "clang/Frontend/PCHReader.h" |
Douglas Gregor | 39da0b8 | 2009-09-09 23:08:42 +0000 | [diff] [blame] | 16 | #include "clang/AST/DeclCXX.h" |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 17 | #include "clang/AST/StmtVisitor.h" |
| 18 | using namespace clang; |
| 19 | |
Argyrios Kyrtzidis | 37bdfe2 | 2010-06-30 08:49:18 +0000 | [diff] [blame] | 20 | namespace clang { |
Argyrios Kyrtzidis | 17cfded | 2010-06-28 09:31:42 +0000 | [diff] [blame] | 21 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 22 | class PCHStmtReader : public StmtVisitor<PCHStmtReader> { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 23 | PCHReader &Reader; |
| 24 | const PCHReader::RecordData &Record; |
| 25 | unsigned &Idx; |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 26 | |
| 27 | public: |
| 28 | PCHStmtReader(PCHReader &Reader, const PCHReader::RecordData &Record, |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 29 | unsigned &Idx) |
| 30 | : Reader(Reader), Record(Record), Idx(Idx) { } |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 31 | |
| 32 | /// \brief The number of record fields required for the Stmt class |
| 33 | /// itself. |
| 34 | static const unsigned NumStmtFields = 0; |
| 35 | |
| 36 | /// \brief The number of record fields required for the Expr class |
| 37 | /// itself. |
| 38 | static const unsigned NumExprFields = NumStmtFields + 3; |
Argyrios Kyrtzidis | 36c76f0 | 2010-06-28 09:31:48 +0000 | [diff] [blame] | 39 | |
| 40 | /// \brief Read and initialize a ExplicitTemplateArgumentList structure. |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 41 | void ReadExplicitTemplateArgumentList(ExplicitTemplateArgumentList &ArgList, |
| 42 | unsigned NumTemplateArgs); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 43 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 44 | void VisitStmt(Stmt *S); |
| 45 | void VisitNullStmt(NullStmt *S); |
| 46 | void VisitCompoundStmt(CompoundStmt *S); |
| 47 | void VisitSwitchCase(SwitchCase *S); |
| 48 | void VisitCaseStmt(CaseStmt *S); |
| 49 | void VisitDefaultStmt(DefaultStmt *S); |
| 50 | void VisitLabelStmt(LabelStmt *S); |
| 51 | void VisitIfStmt(IfStmt *S); |
| 52 | void VisitSwitchStmt(SwitchStmt *S); |
| 53 | void VisitWhileStmt(WhileStmt *S); |
| 54 | void VisitDoStmt(DoStmt *S); |
| 55 | void VisitForStmt(ForStmt *S); |
| 56 | void VisitGotoStmt(GotoStmt *S); |
| 57 | void VisitIndirectGotoStmt(IndirectGotoStmt *S); |
| 58 | void VisitContinueStmt(ContinueStmt *S); |
| 59 | void VisitBreakStmt(BreakStmt *S); |
| 60 | void VisitReturnStmt(ReturnStmt *S); |
| 61 | void VisitDeclStmt(DeclStmt *S); |
| 62 | void VisitAsmStmt(AsmStmt *S); |
| 63 | void VisitExpr(Expr *E); |
| 64 | void VisitPredefinedExpr(PredefinedExpr *E); |
| 65 | void VisitDeclRefExpr(DeclRefExpr *E); |
| 66 | void VisitIntegerLiteral(IntegerLiteral *E); |
| 67 | void VisitFloatingLiteral(FloatingLiteral *E); |
| 68 | void VisitImaginaryLiteral(ImaginaryLiteral *E); |
| 69 | void VisitStringLiteral(StringLiteral *E); |
| 70 | void VisitCharacterLiteral(CharacterLiteral *E); |
| 71 | void VisitParenExpr(ParenExpr *E); |
Argyrios Kyrtzidis | 37bdfe2 | 2010-06-30 08:49:18 +0000 | [diff] [blame] | 72 | void VisitParenListExpr(ParenListExpr *E); |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 73 | void VisitUnaryOperator(UnaryOperator *E); |
| 74 | void VisitOffsetOfExpr(OffsetOfExpr *E); |
| 75 | void VisitSizeOfAlignOfExpr(SizeOfAlignOfExpr *E); |
| 76 | void VisitArraySubscriptExpr(ArraySubscriptExpr *E); |
| 77 | void VisitCallExpr(CallExpr *E); |
| 78 | void VisitMemberExpr(MemberExpr *E); |
| 79 | void VisitCastExpr(CastExpr *E); |
| 80 | void VisitBinaryOperator(BinaryOperator *E); |
| 81 | void VisitCompoundAssignOperator(CompoundAssignOperator *E); |
| 82 | void VisitConditionalOperator(ConditionalOperator *E); |
| 83 | void VisitImplicitCastExpr(ImplicitCastExpr *E); |
| 84 | void VisitExplicitCastExpr(ExplicitCastExpr *E); |
| 85 | void VisitCStyleCastExpr(CStyleCastExpr *E); |
| 86 | void VisitCompoundLiteralExpr(CompoundLiteralExpr *E); |
| 87 | void VisitExtVectorElementExpr(ExtVectorElementExpr *E); |
| 88 | void VisitInitListExpr(InitListExpr *E); |
| 89 | void VisitDesignatedInitExpr(DesignatedInitExpr *E); |
| 90 | void VisitImplicitValueInitExpr(ImplicitValueInitExpr *E); |
| 91 | void VisitVAArgExpr(VAArgExpr *E); |
| 92 | void VisitAddrLabelExpr(AddrLabelExpr *E); |
| 93 | void VisitStmtExpr(StmtExpr *E); |
| 94 | void VisitTypesCompatibleExpr(TypesCompatibleExpr *E); |
| 95 | void VisitChooseExpr(ChooseExpr *E); |
| 96 | void VisitGNUNullExpr(GNUNullExpr *E); |
| 97 | void VisitShuffleVectorExpr(ShuffleVectorExpr *E); |
| 98 | void VisitBlockExpr(BlockExpr *E); |
| 99 | void VisitBlockDeclRefExpr(BlockDeclRefExpr *E); |
| 100 | void VisitObjCStringLiteral(ObjCStringLiteral *E); |
| 101 | void VisitObjCEncodeExpr(ObjCEncodeExpr *E); |
| 102 | void VisitObjCSelectorExpr(ObjCSelectorExpr *E); |
| 103 | void VisitObjCProtocolExpr(ObjCProtocolExpr *E); |
| 104 | void VisitObjCIvarRefExpr(ObjCIvarRefExpr *E); |
| 105 | void VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *E); |
| 106 | void VisitObjCImplicitSetterGetterRefExpr( |
Fariborz Jahanian | 09105f5 | 2009-08-20 17:02:02 +0000 | [diff] [blame] | 107 | ObjCImplicitSetterGetterRefExpr *E); |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 108 | void VisitObjCMessageExpr(ObjCMessageExpr *E); |
| 109 | void VisitObjCSuperExpr(ObjCSuperExpr *E); |
| 110 | void VisitObjCIsaExpr(ObjCIsaExpr *E); |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 111 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 112 | void VisitObjCForCollectionStmt(ObjCForCollectionStmt *); |
| 113 | void VisitObjCAtCatchStmt(ObjCAtCatchStmt *); |
| 114 | void VisitObjCAtFinallyStmt(ObjCAtFinallyStmt *); |
| 115 | void VisitObjCAtTryStmt(ObjCAtTryStmt *); |
| 116 | void VisitObjCAtSynchronizedStmt(ObjCAtSynchronizedStmt *); |
| 117 | void VisitObjCAtThrowStmt(ObjCAtThrowStmt *); |
Argyrios Kyrtzidis | ba0a900 | 2009-07-14 03:19:21 +0000 | [diff] [blame] | 118 | |
Argyrios Kyrtzidis | 7cb45e3 | 2010-07-22 16:03:56 +0000 | [diff] [blame^] | 119 | // C++ Statements |
| 120 | void VisitCXXCatchStmt(CXXCatchStmt *S); |
| 121 | void VisitCXXTryStmt(CXXTryStmt *S); |
| 122 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 123 | void VisitCXXOperatorCallExpr(CXXOperatorCallExpr *E); |
| 124 | void VisitCXXConstructExpr(CXXConstructExpr *E); |
Argyrios Kyrtzidis | 6d00c13 | 2010-07-10 11:46:15 +0000 | [diff] [blame] | 125 | void VisitCXXTemporaryObjectExpr(CXXTemporaryObjectExpr *E); |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 126 | void VisitCXXNamedCastExpr(CXXNamedCastExpr *E); |
| 127 | void VisitCXXStaticCastExpr(CXXStaticCastExpr *E); |
| 128 | void VisitCXXDynamicCastExpr(CXXDynamicCastExpr *E); |
| 129 | void VisitCXXReinterpretCastExpr(CXXReinterpretCastExpr *E); |
| 130 | void VisitCXXConstCastExpr(CXXConstCastExpr *E); |
| 131 | void VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr *E); |
| 132 | void VisitCXXBoolLiteralExpr(CXXBoolLiteralExpr *E); |
| 133 | void VisitCXXNullPtrLiteralExpr(CXXNullPtrLiteralExpr *E); |
| 134 | void VisitCXXTypeidExpr(CXXTypeidExpr *E); |
| 135 | void VisitCXXThisExpr(CXXThisExpr *E); |
| 136 | void VisitCXXThrowExpr(CXXThrowExpr *E); |
| 137 | void VisitCXXDefaultArgExpr(CXXDefaultArgExpr *E); |
| 138 | void VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *E); |
Argyrios Kyrtzidis | 6d00c13 | 2010-07-10 11:46:15 +0000 | [diff] [blame] | 139 | void VisitCXXBindReferenceExpr(CXXBindReferenceExpr *E); |
Chris Lattner | d259836 | 2010-05-10 00:25:06 +0000 | [diff] [blame] | 140 | |
Douglas Gregor | ed8abf1 | 2010-07-08 06:14:04 +0000 | [diff] [blame] | 141 | void VisitCXXScalarValueInitExpr(CXXScalarValueInitExpr *E); |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 142 | void VisitCXXNewExpr(CXXNewExpr *E); |
| 143 | void VisitCXXDeleteExpr(CXXDeleteExpr *E); |
| 144 | void VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr *E); |
Chris Lattner | 5921863 | 2010-05-10 01:22:27 +0000 | [diff] [blame] | 145 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 146 | void VisitCXXExprWithTemporaries(CXXExprWithTemporaries *E); |
Argyrios Kyrtzidis | 8dfbd8b | 2010-06-24 08:57:31 +0000 | [diff] [blame] | 147 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 148 | void VisitCXXDependentScopeMemberExpr(CXXDependentScopeMemberExpr *E); |
| 149 | void VisitDependentScopeDeclRefExpr(DependentScopeDeclRefExpr *E); |
| 150 | void VisitCXXUnresolvedConstructExpr(CXXUnresolvedConstructExpr *E); |
Argyrios Kyrtzidis | a77eb08 | 2010-06-25 09:03:26 +0000 | [diff] [blame] | 151 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 152 | void VisitOverloadExpr(OverloadExpr *E); |
| 153 | void VisitUnresolvedMemberExpr(UnresolvedMemberExpr *E); |
| 154 | void VisitUnresolvedLookupExpr(UnresolvedLookupExpr *E); |
Argyrios Kyrtzidis | 6d00c13 | 2010-07-10 11:46:15 +0000 | [diff] [blame] | 155 | |
| 156 | void VisitUnaryTypeTraitExpr(UnaryTypeTraitExpr *E); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 157 | }; |
| 158 | } |
| 159 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 160 | void PCHStmtReader:: |
Argyrios Kyrtzidis | 36c76f0 | 2010-06-28 09:31:48 +0000 | [diff] [blame] | 161 | ReadExplicitTemplateArgumentList(ExplicitTemplateArgumentList &ArgList, |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 162 | unsigned NumTemplateArgs) { |
Argyrios Kyrtzidis | 36c76f0 | 2010-06-28 09:31:48 +0000 | [diff] [blame] | 163 | TemplateArgumentListInfo ArgInfo; |
| 164 | ArgInfo.setLAngleLoc(Reader.ReadSourceLocation(Record, Idx)); |
| 165 | ArgInfo.setRAngleLoc(Reader.ReadSourceLocation(Record, Idx)); |
Argyrios Kyrtzidis | 36c76f0 | 2010-06-28 09:31:48 +0000 | [diff] [blame] | 166 | for (unsigned i = 0; i != NumTemplateArgs; ++i) |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 167 | ArgInfo.addArgument(Reader.ReadTemplateArgumentLoc(Record, Idx)); |
Argyrios Kyrtzidis | 36c76f0 | 2010-06-28 09:31:48 +0000 | [diff] [blame] | 168 | ArgList.initializeFrom(ArgInfo); |
Argyrios Kyrtzidis | 36c76f0 | 2010-06-28 09:31:48 +0000 | [diff] [blame] | 169 | } |
| 170 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 171 | void PCHStmtReader::VisitStmt(Stmt *S) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 172 | assert(Idx == NumStmtFields && "Incorrect statement field count"); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 173 | } |
| 174 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 175 | void PCHStmtReader::VisitNullStmt(NullStmt *S) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 176 | VisitStmt(S); |
| 177 | S->setSemiLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 178 | } |
| 179 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 180 | void PCHStmtReader::VisitCompoundStmt(CompoundStmt *S) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 181 | VisitStmt(S); |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 182 | llvm::SmallVector<Stmt *, 16> Stmts; |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 183 | unsigned NumStmts = Record[Idx++]; |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 184 | while (NumStmts--) |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 185 | Stmts.push_back(Reader.ReadSubStmt()); |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 186 | S->setStmts(*Reader.getContext(), Stmts.data(), Stmts.size()); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 187 | S->setLBracLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
| 188 | S->setRBracLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 189 | } |
| 190 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 191 | void PCHStmtReader::VisitSwitchCase(SwitchCase *S) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 192 | VisitStmt(S); |
| 193 | Reader.RecordSwitchCaseID(S, Record[Idx++]); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 194 | } |
| 195 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 196 | void PCHStmtReader::VisitCaseStmt(CaseStmt *S) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 197 | VisitSwitchCase(S); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 198 | S->setLHS(Reader.ReadSubExpr()); |
| 199 | S->setRHS(Reader.ReadSubExpr()); |
| 200 | S->setSubStmt(Reader.ReadSubStmt()); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 201 | S->setCaseLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
Douglas Gregor | dbb26db | 2009-05-15 23:57:33 +0000 | [diff] [blame] | 202 | S->setEllipsisLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
| 203 | S->setColonLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 204 | } |
| 205 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 206 | void PCHStmtReader::VisitDefaultStmt(DefaultStmt *S) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 207 | VisitSwitchCase(S); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 208 | S->setSubStmt(Reader.ReadSubStmt()); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 209 | S->setDefaultLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
Douglas Gregor | dbb26db | 2009-05-15 23:57:33 +0000 | [diff] [blame] | 210 | S->setColonLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 211 | } |
| 212 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 213 | void PCHStmtReader::VisitLabelStmt(LabelStmt *S) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 214 | VisitStmt(S); |
| 215 | S->setID(Reader.GetIdentifierInfo(Record, Idx)); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 216 | S->setSubStmt(Reader.ReadSubStmt()); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 217 | S->setIdentLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
| 218 | Reader.RecordLabelStmt(S, Record[Idx++]); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 219 | } |
| 220 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 221 | void PCHStmtReader::VisitIfStmt(IfStmt *S) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 222 | VisitStmt(S); |
Douglas Gregor | 43dec6b | 2010-06-21 23:44:13 +0000 | [diff] [blame] | 223 | S->setConditionVariable(*Reader.getContext(), |
| 224 | cast_or_null<VarDecl>(Reader.GetDecl(Record[Idx++]))); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 225 | S->setCond(Reader.ReadSubExpr()); |
| 226 | S->setThen(Reader.ReadSubStmt()); |
| 227 | S->setElse(Reader.ReadSubStmt()); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 228 | S->setIfLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
Douglas Gregor | d06f6ca | 2009-05-15 18:53:42 +0000 | [diff] [blame] | 229 | S->setElseLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 230 | } |
| 231 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 232 | void PCHStmtReader::VisitSwitchStmt(SwitchStmt *S) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 233 | VisitStmt(S); |
Douglas Gregor | 43dec6b | 2010-06-21 23:44:13 +0000 | [diff] [blame] | 234 | S->setConditionVariable(*Reader.getContext(), |
| 235 | cast_or_null<VarDecl>(Reader.GetDecl(Record[Idx++]))); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 236 | S->setCond(Reader.ReadSubExpr()); |
| 237 | S->setBody(Reader.ReadSubStmt()); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 238 | S->setSwitchLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
| 239 | SwitchCase *PrevSC = 0; |
| 240 | for (unsigned N = Record.size(); Idx != N; ++Idx) { |
| 241 | SwitchCase *SC = Reader.getSwitchCaseWithID(Record[Idx]); |
| 242 | if (PrevSC) |
| 243 | PrevSC->setNextSwitchCase(SC); |
| 244 | else |
| 245 | S->setSwitchCaseList(SC); |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 246 | |
Douglas Gregor | 43d9d92 | 2009-08-08 01:41:12 +0000 | [diff] [blame] | 247 | // Retain this SwitchCase, since SwitchStmt::addSwitchCase() would |
| 248 | // normally retain it (but we aren't calling addSwitchCase). |
| 249 | SC->Retain(); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 250 | PrevSC = SC; |
| 251 | } |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 252 | } |
| 253 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 254 | void PCHStmtReader::VisitWhileStmt(WhileStmt *S) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 255 | VisitStmt(S); |
Douglas Gregor | 43dec6b | 2010-06-21 23:44:13 +0000 | [diff] [blame] | 256 | S->setConditionVariable(*Reader.getContext(), |
| 257 | cast_or_null<VarDecl>(Reader.GetDecl(Record[Idx++]))); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 258 | S->setCond(Reader.ReadSubExpr()); |
| 259 | S->setBody(Reader.ReadSubStmt()); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 260 | S->setWhileLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 261 | } |
| 262 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 263 | void PCHStmtReader::VisitDoStmt(DoStmt *S) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 264 | VisitStmt(S); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 265 | S->setCond(Reader.ReadSubExpr()); |
| 266 | S->setBody(Reader.ReadSubStmt()); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 267 | S->setDoLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
Douglas Gregor | 9f3ca2a | 2009-05-15 21:56:04 +0000 | [diff] [blame] | 268 | S->setWhileLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
Chris Lattner | 9891359 | 2009-06-12 23:04:47 +0000 | [diff] [blame] | 269 | S->setRParenLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 270 | } |
| 271 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 272 | void PCHStmtReader::VisitForStmt(ForStmt *S) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 273 | VisitStmt(S); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 274 | S->setInit(Reader.ReadSubStmt()); |
| 275 | S->setCond(Reader.ReadSubExpr()); |
Douglas Gregor | 43dec6b | 2010-06-21 23:44:13 +0000 | [diff] [blame] | 276 | S->setConditionVariable(*Reader.getContext(), |
| 277 | cast_or_null<VarDecl>(Reader.GetDecl(Record[Idx++]))); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 278 | S->setInc(Reader.ReadSubExpr()); |
| 279 | S->setBody(Reader.ReadSubStmt()); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 280 | S->setForLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
Douglas Gregor | 5831c6a | 2009-05-15 22:12:32 +0000 | [diff] [blame] | 281 | S->setLParenLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
| 282 | S->setRParenLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 283 | } |
| 284 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 285 | void PCHStmtReader::VisitGotoStmt(GotoStmt *S) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 286 | VisitStmt(S); |
| 287 | Reader.SetLabelOf(S, Record[Idx++]); |
| 288 | S->setGotoLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
| 289 | S->setLabelLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 290 | } |
| 291 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 292 | void PCHStmtReader::VisitIndirectGotoStmt(IndirectGotoStmt *S) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 293 | VisitStmt(S); |
| 294 | S->setGotoLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
Douglas Gregor | 5f1b9e6 | 2009-05-16 00:20:29 +0000 | [diff] [blame] | 295 | S->setStarLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 296 | S->setTarget(Reader.ReadSubExpr()); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 297 | } |
| 298 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 299 | void PCHStmtReader::VisitContinueStmt(ContinueStmt *S) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 300 | VisitStmt(S); |
| 301 | S->setContinueLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 302 | } |
| 303 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 304 | void PCHStmtReader::VisitBreakStmt(BreakStmt *S) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 305 | VisitStmt(S); |
| 306 | S->setBreakLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 307 | } |
| 308 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 309 | void PCHStmtReader::VisitReturnStmt(ReturnStmt *S) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 310 | VisitStmt(S); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 311 | S->setRetValue(Reader.ReadSubExpr()); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 312 | S->setReturnLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
Douglas Gregor | 5077c38 | 2010-05-15 06:01:05 +0000 | [diff] [blame] | 313 | S->setNRVOCandidate(cast_or_null<VarDecl>(Reader.GetDecl(Record[Idx++]))); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 314 | } |
| 315 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 316 | void PCHStmtReader::VisitDeclStmt(DeclStmt *S) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 317 | VisitStmt(S); |
| 318 | S->setStartLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
| 319 | S->setEndLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
| 320 | |
| 321 | if (Idx + 1 == Record.size()) { |
| 322 | // Single declaration |
| 323 | S->setDeclGroup(DeclGroupRef(Reader.GetDecl(Record[Idx++]))); |
| 324 | } else { |
| 325 | llvm::SmallVector<Decl *, 16> Decls; |
| 326 | Decls.reserve(Record.size() - Idx); |
| 327 | for (unsigned N = Record.size(); Idx != N; ++Idx) |
| 328 | Decls.push_back(Reader.GetDecl(Record[Idx])); |
Chris Lattner | d1d64a0 | 2009-04-27 21:45:14 +0000 | [diff] [blame] | 329 | S->setDeclGroup(DeclGroupRef(DeclGroup::Create(*Reader.getContext(), |
Douglas Gregor | 75fdb23 | 2009-05-22 22:45:36 +0000 | [diff] [blame] | 330 | Decls.data(), |
| 331 | Decls.size()))); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 332 | } |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 333 | } |
| 334 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 335 | void PCHStmtReader::VisitAsmStmt(AsmStmt *S) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 336 | VisitStmt(S); |
| 337 | unsigned NumOutputs = Record[Idx++]; |
| 338 | unsigned NumInputs = Record[Idx++]; |
| 339 | unsigned NumClobbers = Record[Idx++]; |
| 340 | S->setAsmLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
| 341 | S->setRParenLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
| 342 | S->setVolatile(Record[Idx++]); |
| 343 | S->setSimple(Record[Idx++]); |
Mike Stump | 3b11fd3 | 2010-01-04 22:37:17 +0000 | [diff] [blame] | 344 | S->setMSAsm(Record[Idx++]); |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 345 | |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 346 | S->setAsmString(cast_or_null<StringLiteral>(Reader.ReadSubStmt())); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 347 | |
| 348 | // Outputs and inputs |
Anders Carlsson | ff93dbd | 2010-01-30 22:25:16 +0000 | [diff] [blame] | 349 | llvm::SmallVector<IdentifierInfo *, 16> Names; |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 350 | llvm::SmallVector<StringLiteral*, 16> Constraints; |
| 351 | llvm::SmallVector<Stmt*, 16> Exprs; |
| 352 | for (unsigned I = 0, N = NumOutputs + NumInputs; I != N; ++I) { |
Anders Carlsson | ff93dbd | 2010-01-30 22:25:16 +0000 | [diff] [blame] | 353 | Names.push_back(Reader.GetIdentifierInfo(Record, Idx)); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 354 | Constraints.push_back(cast_or_null<StringLiteral>(Reader.ReadSubStmt())); |
| 355 | Exprs.push_back(Reader.ReadSubStmt()); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 356 | } |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 357 | |
| 358 | // Constraints |
| 359 | llvm::SmallVector<StringLiteral*, 16> Clobbers; |
| 360 | for (unsigned I = 0; I != NumClobbers; ++I) |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 361 | Clobbers.push_back(cast_or_null<StringLiteral>(Reader.ReadSubStmt())); |
Anders Carlsson | fdba9c0 | 2010-01-30 19:34:25 +0000 | [diff] [blame] | 362 | |
Anders Carlsson | acb6bcb | 2010-01-30 20:38:10 +0000 | [diff] [blame] | 363 | S->setOutputsAndInputsAndClobbers(*Reader.getContext(), |
| 364 | Names.data(), Constraints.data(), |
Anders Carlsson | fdba9c0 | 2010-01-30 19:34:25 +0000 | [diff] [blame] | 365 | Exprs.data(), NumOutputs, NumInputs, |
| 366 | Clobbers.data(), NumClobbers); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 367 | } |
| 368 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 369 | void PCHStmtReader::VisitExpr(Expr *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 370 | VisitStmt(E); |
| 371 | E->setType(Reader.GetType(Record[Idx++])); |
| 372 | E->setTypeDependent(Record[Idx++]); |
| 373 | E->setValueDependent(Record[Idx++]); |
| 374 | assert(Idx == NumExprFields && "Incorrect expression field count"); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 375 | } |
| 376 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 377 | void PCHStmtReader::VisitPredefinedExpr(PredefinedExpr *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 378 | VisitExpr(E); |
| 379 | E->setLocation(SourceLocation::getFromRawEncoding(Record[Idx++])); |
| 380 | E->setIdentType((PredefinedExpr::IdentType)Record[Idx++]); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 381 | } |
| 382 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 383 | void PCHStmtReader::VisitDeclRefExpr(DeclRefExpr *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 384 | VisitExpr(E); |
Argyrios Kyrtzidis | 663e380 | 2010-07-08 13:09:47 +0000 | [diff] [blame] | 385 | |
| 386 | bool HasQualifier = Record[Idx++]; |
| 387 | unsigned NumTemplateArgs = Record[Idx++]; |
| 388 | |
| 389 | E->DecoratedD.setInt((HasQualifier? DeclRefExpr::HasQualifierFlag : 0) | |
| 390 | (NumTemplateArgs ? DeclRefExpr::HasExplicitTemplateArgumentListFlag : 0)); |
| 391 | |
| 392 | if (HasQualifier) { |
| 393 | E->getNameQualifier()->NNS = Reader.ReadNestedNameSpecifier(Record, Idx); |
| 394 | E->getNameQualifier()->Range = Reader.ReadSourceRange(Record, Idx); |
| 395 | } |
| 396 | |
| 397 | if (NumTemplateArgs) |
| 398 | ReadExplicitTemplateArgumentList(*E->getExplicitTemplateArgumentList(), |
| 399 | NumTemplateArgs); |
| 400 | |
John McCall | dbd872f | 2009-12-08 09:08:17 +0000 | [diff] [blame] | 401 | E->setDecl(cast<ValueDecl>(Reader.GetDecl(Record[Idx++]))); |
Argyrios Kyrtzidis | 663e380 | 2010-07-08 13:09:47 +0000 | [diff] [blame] | 402 | E->setLocation(Reader.ReadSourceLocation(Record, Idx)); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 403 | } |
| 404 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 405 | void PCHStmtReader::VisitIntegerLiteral(IntegerLiteral *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 406 | VisitExpr(E); |
| 407 | E->setLocation(SourceLocation::getFromRawEncoding(Record[Idx++])); |
| 408 | E->setValue(Reader.ReadAPInt(Record, Idx)); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 409 | } |
| 410 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 411 | void PCHStmtReader::VisitFloatingLiteral(FloatingLiteral *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 412 | VisitExpr(E); |
| 413 | E->setValue(Reader.ReadAPFloat(Record, Idx)); |
| 414 | E->setExact(Record[Idx++]); |
| 415 | E->setLocation(SourceLocation::getFromRawEncoding(Record[Idx++])); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 416 | } |
| 417 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 418 | void PCHStmtReader::VisitImaginaryLiteral(ImaginaryLiteral *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 419 | VisitExpr(E); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 420 | E->setSubExpr(Reader.ReadSubExpr()); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 421 | } |
| 422 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 423 | void PCHStmtReader::VisitStringLiteral(StringLiteral *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 424 | VisitExpr(E); |
| 425 | unsigned Len = Record[Idx++]; |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 426 | assert(Record[Idx] == E->getNumConcatenated() && |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 427 | "Wrong number of concatenated tokens!"); |
| 428 | ++Idx; |
| 429 | E->setWide(Record[Idx++]); |
| 430 | |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 431 | // Read string data |
Daniel Dunbar | b648023 | 2009-09-22 03:27:33 +0000 | [diff] [blame] | 432 | llvm::SmallString<16> Str(&Record[Idx], &Record[Idx] + Len); |
| 433 | E->setString(*Reader.getContext(), Str.str()); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 434 | Idx += Len; |
| 435 | |
| 436 | // Read source locations |
| 437 | for (unsigned I = 0, N = E->getNumConcatenated(); I != N; ++I) |
| 438 | E->setStrTokenLoc(I, SourceLocation::getFromRawEncoding(Record[Idx++])); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 439 | } |
| 440 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 441 | void PCHStmtReader::VisitCharacterLiteral(CharacterLiteral *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 442 | VisitExpr(E); |
| 443 | E->setValue(Record[Idx++]); |
| 444 | E->setLocation(SourceLocation::getFromRawEncoding(Record[Idx++])); |
| 445 | E->setWide(Record[Idx++]); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 446 | } |
| 447 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 448 | void PCHStmtReader::VisitParenExpr(ParenExpr *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 449 | VisitExpr(E); |
| 450 | E->setLParen(SourceLocation::getFromRawEncoding(Record[Idx++])); |
| 451 | E->setRParen(SourceLocation::getFromRawEncoding(Record[Idx++])); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 452 | E->setSubExpr(Reader.ReadSubExpr()); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 453 | } |
| 454 | |
Argyrios Kyrtzidis | 37bdfe2 | 2010-06-30 08:49:18 +0000 | [diff] [blame] | 455 | void PCHStmtReader::VisitParenListExpr(ParenListExpr *E) { |
| 456 | VisitExpr(E); |
| 457 | unsigned NumExprs = Record[Idx++]; |
| 458 | E->Exprs = new (*Reader.getContext()) Stmt*[NumExprs]; |
| 459 | for (unsigned i = 0; i != NumExprs; ++i) |
| 460 | E->Exprs[i] = Reader.ReadSubStmt(); |
| 461 | E->NumExprs = NumExprs; |
| 462 | E->LParenLoc = Reader.ReadSourceLocation(Record, Idx); |
| 463 | E->RParenLoc = Reader.ReadSourceLocation(Record, Idx); |
| 464 | } |
| 465 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 466 | void PCHStmtReader::VisitUnaryOperator(UnaryOperator *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 467 | VisitExpr(E); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 468 | E->setSubExpr(Reader.ReadSubExpr()); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 469 | E->setOpcode((UnaryOperator::Opcode)Record[Idx++]); |
| 470 | E->setOperatorLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 471 | } |
| 472 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 473 | void PCHStmtReader::VisitOffsetOfExpr(OffsetOfExpr *E) { |
Douglas Gregor | 8ecdb65 | 2010-04-28 22:16:22 +0000 | [diff] [blame] | 474 | typedef OffsetOfExpr::OffsetOfNode Node; |
| 475 | VisitExpr(E); |
| 476 | assert(E->getNumComponents() == Record[Idx]); |
| 477 | ++Idx; |
| 478 | assert(E->getNumExpressions() == Record[Idx]); |
| 479 | ++Idx; |
| 480 | E->setOperatorLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
| 481 | E->setRParenLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
| 482 | E->setTypeSourceInfo(Reader.GetTypeSourceInfo(Record, Idx)); |
| 483 | for (unsigned I = 0, N = E->getNumComponents(); I != N; ++I) { |
| 484 | Node::Kind Kind = static_cast<Node::Kind>(Record[Idx++]); |
| 485 | SourceLocation Start = SourceLocation::getFromRawEncoding(Record[Idx++]); |
| 486 | SourceLocation End = SourceLocation::getFromRawEncoding(Record[Idx++]); |
| 487 | switch (Kind) { |
| 488 | case Node::Array: |
| 489 | E->setComponent(I, Node(Start, Record[Idx++], End)); |
| 490 | break; |
| 491 | |
| 492 | case Node::Field: |
| 493 | E->setComponent(I, |
| 494 | Node(Start, |
| 495 | dyn_cast_or_null<FieldDecl>(Reader.GetDecl(Record[Idx++])), |
| 496 | End)); |
| 497 | break; |
| 498 | |
| 499 | case Node::Identifier: |
| 500 | E->setComponent(I, Node(Start, Reader.GetIdentifier(Record[Idx++]), End)); |
| 501 | break; |
Douglas Gregor | cc8a5d5 | 2010-04-29 00:18:15 +0000 | [diff] [blame] | 502 | |
| 503 | case Node::Base: |
| 504 | // FIXME: Implement this! |
| 505 | llvm_unreachable("PCH for offsetof(base-specifier) not implemented"); |
| 506 | break; |
Douglas Gregor | 8ecdb65 | 2010-04-28 22:16:22 +0000 | [diff] [blame] | 507 | } |
| 508 | } |
| 509 | |
| 510 | for (unsigned I = 0, N = E->getNumExpressions(); I != N; ++I) |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 511 | E->setIndexExpr(I, Reader.ReadSubExpr()); |
Douglas Gregor | 8ecdb65 | 2010-04-28 22:16:22 +0000 | [diff] [blame] | 512 | } |
| 513 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 514 | void PCHStmtReader::VisitSizeOfAlignOfExpr(SizeOfAlignOfExpr *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 515 | VisitExpr(E); |
| 516 | E->setSizeof(Record[Idx++]); |
| 517 | if (Record[Idx] == 0) { |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 518 | E->setArgument(Reader.ReadSubExpr()); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 519 | ++Idx; |
| 520 | } else { |
John McCall | a93c934 | 2009-12-07 02:54:59 +0000 | [diff] [blame] | 521 | E->setArgument(Reader.GetTypeSourceInfo(Record, Idx)); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 522 | } |
| 523 | E->setOperatorLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
| 524 | E->setRParenLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 525 | } |
| 526 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 527 | void PCHStmtReader::VisitArraySubscriptExpr(ArraySubscriptExpr *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 528 | VisitExpr(E); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 529 | E->setLHS(Reader.ReadSubExpr()); |
| 530 | E->setRHS(Reader.ReadSubExpr()); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 531 | E->setRBracketLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 532 | } |
| 533 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 534 | void PCHStmtReader::VisitCallExpr(CallExpr *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 535 | VisitExpr(E); |
Chris Lattner | d1d64a0 | 2009-04-27 21:45:14 +0000 | [diff] [blame] | 536 | E->setNumArgs(*Reader.getContext(), Record[Idx++]); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 537 | E->setRParenLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 538 | E->setCallee(Reader.ReadSubExpr()); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 539 | for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I) |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 540 | E->setArg(I, Reader.ReadSubExpr()); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 541 | } |
| 542 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 543 | void PCHStmtReader::VisitMemberExpr(MemberExpr *E) { |
Argyrios Kyrtzidis | 663e380 | 2010-07-08 13:09:47 +0000 | [diff] [blame] | 544 | // Don't call VisitExpr, this is fully initialized at creation. |
| 545 | assert(E->getStmtClass() == Stmt::MemberExprClass && |
| 546 | "It's a subclass, we must advance Idx!"); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 547 | } |
| 548 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 549 | void PCHStmtReader::VisitObjCIsaExpr(ObjCIsaExpr *E) { |
Steve Naroff | f242b1b | 2009-07-24 17:54:45 +0000 | [diff] [blame] | 550 | VisitExpr(E); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 551 | E->setBase(Reader.ReadSubExpr()); |
Steve Naroff | f242b1b | 2009-07-24 17:54:45 +0000 | [diff] [blame] | 552 | E->setIsaMemberLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
| 553 | E->setArrow(Record[Idx++]); |
Steve Naroff | f242b1b | 2009-07-24 17:54:45 +0000 | [diff] [blame] | 554 | } |
| 555 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 556 | void PCHStmtReader::VisitCastExpr(CastExpr *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 557 | VisitExpr(E); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 558 | E->setSubExpr(Reader.ReadSubExpr()); |
Anders Carlsson | cdef2b7 | 2009-07-31 00:48:10 +0000 | [diff] [blame] | 559 | E->setCastKind((CastExpr::CastKind)Record[Idx++]); |
Argyrios Kyrtzidis | 0745d0a | 2010-07-02 23:30:27 +0000 | [diff] [blame] | 560 | CXXBaseSpecifierArray &BasePath = E->getBasePath(); |
| 561 | unsigned NumBaseSpecs = Record[Idx++]; |
| 562 | while (NumBaseSpecs--) { |
| 563 | // FIXME: These gets leaked. |
| 564 | CXXBaseSpecifier *BaseSpec = new (*Reader.getContext()) CXXBaseSpecifier; |
| 565 | *BaseSpec = Reader.ReadCXXBaseSpecifier(Record, Idx); |
| 566 | BasePath.push_back(BaseSpec); |
| 567 | } |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 568 | } |
| 569 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 570 | void PCHStmtReader::VisitBinaryOperator(BinaryOperator *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 571 | VisitExpr(E); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 572 | E->setLHS(Reader.ReadSubExpr()); |
| 573 | E->setRHS(Reader.ReadSubExpr()); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 574 | E->setOpcode((BinaryOperator::Opcode)Record[Idx++]); |
| 575 | E->setOperatorLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 576 | } |
| 577 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 578 | void PCHStmtReader::VisitCompoundAssignOperator(CompoundAssignOperator *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 579 | VisitBinaryOperator(E); |
| 580 | E->setComputationLHSType(Reader.GetType(Record[Idx++])); |
| 581 | E->setComputationResultType(Reader.GetType(Record[Idx++])); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 582 | } |
| 583 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 584 | void PCHStmtReader::VisitConditionalOperator(ConditionalOperator *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 585 | VisitExpr(E); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 586 | E->setCond(Reader.ReadSubExpr()); |
| 587 | E->setLHS(Reader.ReadSubExpr()); |
| 588 | E->setRHS(Reader.ReadSubExpr()); |
Douglas Gregor | 47e1f7c | 2009-08-26 14:37:04 +0000 | [diff] [blame] | 589 | E->setQuestionLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
| 590 | E->setColonLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 591 | } |
| 592 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 593 | void PCHStmtReader::VisitImplicitCastExpr(ImplicitCastExpr *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 594 | VisitCastExpr(E); |
Sebastian Redl | 906082e | 2010-07-20 04:20:21 +0000 | [diff] [blame] | 595 | E->setCategory(static_cast<ImplicitCastExpr::ResultCategory>(Record[Idx++])); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 596 | } |
| 597 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 598 | void PCHStmtReader::VisitExplicitCastExpr(ExplicitCastExpr *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 599 | VisitCastExpr(E); |
John McCall | 9d12503 | 2010-01-15 18:39:57 +0000 | [diff] [blame] | 600 | E->setTypeInfoAsWritten(Reader.GetTypeSourceInfo(Record, Idx)); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 601 | } |
| 602 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 603 | void PCHStmtReader::VisitCStyleCastExpr(CStyleCastExpr *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 604 | VisitExplicitCastExpr(E); |
| 605 | E->setLParenLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
| 606 | E->setRParenLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 607 | } |
| 608 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 609 | void PCHStmtReader::VisitCompoundLiteralExpr(CompoundLiteralExpr *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 610 | VisitExpr(E); |
| 611 | E->setLParenLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
John McCall | 42f56b5 | 2010-01-18 19:35:47 +0000 | [diff] [blame] | 612 | E->setTypeSourceInfo(Reader.GetTypeSourceInfo(Record, Idx)); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 613 | E->setInitializer(Reader.ReadSubExpr()); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 614 | E->setFileScope(Record[Idx++]); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 615 | } |
| 616 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 617 | void PCHStmtReader::VisitExtVectorElementExpr(ExtVectorElementExpr *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 618 | VisitExpr(E); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 619 | E->setBase(Reader.ReadSubExpr()); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 620 | E->setAccessor(Reader.GetIdentifierInfo(Record, Idx)); |
| 621 | E->setAccessorLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 622 | } |
| 623 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 624 | void PCHStmtReader::VisitInitListExpr(InitListExpr *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 625 | VisitExpr(E); |
| 626 | unsigned NumInits = Record[Idx++]; |
Ted Kremenek | 709210f | 2010-04-13 23:39:13 +0000 | [diff] [blame] | 627 | E->reserveInits(*Reader.getContext(), NumInits); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 628 | for (unsigned I = 0; I != NumInits; ++I) |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 629 | E->updateInit(*Reader.getContext(), I, Reader.ReadSubExpr()); |
| 630 | E->setSyntacticForm(cast_or_null<InitListExpr>(Reader.ReadSubStmt())); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 631 | E->setLBraceLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
| 632 | E->setRBraceLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
| 633 | E->setInitializedFieldInUnion( |
| 634 | cast_or_null<FieldDecl>(Reader.GetDecl(Record[Idx++]))); |
| 635 | E->sawArrayRangeDesignator(Record[Idx++]); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 636 | } |
| 637 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 638 | void PCHStmtReader::VisitDesignatedInitExpr(DesignatedInitExpr *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 639 | typedef DesignatedInitExpr::Designator Designator; |
| 640 | |
| 641 | VisitExpr(E); |
| 642 | unsigned NumSubExprs = Record[Idx++]; |
| 643 | assert(NumSubExprs == E->getNumSubExprs() && "Wrong number of subexprs"); |
| 644 | for (unsigned I = 0; I != NumSubExprs; ++I) |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 645 | E->setSubExpr(I, Reader.ReadSubExpr()); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 646 | E->setEqualOrColonLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
| 647 | E->setGNUSyntax(Record[Idx++]); |
| 648 | |
| 649 | llvm::SmallVector<Designator, 4> Designators; |
| 650 | while (Idx < Record.size()) { |
| 651 | switch ((pch::DesignatorTypes)Record[Idx++]) { |
| 652 | case pch::DESIG_FIELD_DECL: { |
| 653 | FieldDecl *Field = cast<FieldDecl>(Reader.GetDecl(Record[Idx++])); |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 654 | SourceLocation DotLoc |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 655 | = SourceLocation::getFromRawEncoding(Record[Idx++]); |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 656 | SourceLocation FieldLoc |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 657 | = SourceLocation::getFromRawEncoding(Record[Idx++]); |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 658 | Designators.push_back(Designator(Field->getIdentifier(), DotLoc, |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 659 | FieldLoc)); |
| 660 | Designators.back().setField(Field); |
| 661 | break; |
| 662 | } |
| 663 | |
| 664 | case pch::DESIG_FIELD_NAME: { |
| 665 | const IdentifierInfo *Name = Reader.GetIdentifierInfo(Record, Idx); |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 666 | SourceLocation DotLoc |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 667 | = SourceLocation::getFromRawEncoding(Record[Idx++]); |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 668 | SourceLocation FieldLoc |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 669 | = SourceLocation::getFromRawEncoding(Record[Idx++]); |
| 670 | Designators.push_back(Designator(Name, DotLoc, FieldLoc)); |
| 671 | break; |
| 672 | } |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 673 | |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 674 | case pch::DESIG_ARRAY: { |
| 675 | unsigned Index = Record[Idx++]; |
| 676 | SourceLocation LBracketLoc |
| 677 | = SourceLocation::getFromRawEncoding(Record[Idx++]); |
| 678 | SourceLocation RBracketLoc |
| 679 | = SourceLocation::getFromRawEncoding(Record[Idx++]); |
| 680 | Designators.push_back(Designator(Index, LBracketLoc, RBracketLoc)); |
| 681 | break; |
| 682 | } |
| 683 | |
| 684 | case pch::DESIG_ARRAY_RANGE: { |
| 685 | unsigned Index = Record[Idx++]; |
| 686 | SourceLocation LBracketLoc |
| 687 | = SourceLocation::getFromRawEncoding(Record[Idx++]); |
| 688 | SourceLocation EllipsisLoc |
| 689 | = SourceLocation::getFromRawEncoding(Record[Idx++]); |
| 690 | SourceLocation RBracketLoc |
| 691 | = SourceLocation::getFromRawEncoding(Record[Idx++]); |
| 692 | Designators.push_back(Designator(Index, LBracketLoc, EllipsisLoc, |
| 693 | RBracketLoc)); |
| 694 | break; |
| 695 | } |
| 696 | } |
| 697 | } |
Douglas Gregor | 319d57f | 2010-01-06 23:17:19 +0000 | [diff] [blame] | 698 | E->setDesignators(*Reader.getContext(), |
| 699 | Designators.data(), Designators.size()); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 700 | } |
| 701 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 702 | void PCHStmtReader::VisitImplicitValueInitExpr(ImplicitValueInitExpr *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 703 | VisitExpr(E); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 704 | } |
| 705 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 706 | void PCHStmtReader::VisitVAArgExpr(VAArgExpr *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 707 | VisitExpr(E); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 708 | E->setSubExpr(Reader.ReadSubExpr()); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 709 | E->setBuiltinLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
| 710 | E->setRParenLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 711 | } |
| 712 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 713 | void PCHStmtReader::VisitAddrLabelExpr(AddrLabelExpr *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 714 | VisitExpr(E); |
| 715 | E->setAmpAmpLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
| 716 | E->setLabelLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
| 717 | Reader.SetLabelOf(E, Record[Idx++]); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 718 | } |
| 719 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 720 | void PCHStmtReader::VisitStmtExpr(StmtExpr *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 721 | VisitExpr(E); |
| 722 | E->setLParenLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
| 723 | E->setRParenLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 724 | E->setSubStmt(cast_or_null<CompoundStmt>(Reader.ReadSubStmt())); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 725 | } |
| 726 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 727 | void PCHStmtReader::VisitTypesCompatibleExpr(TypesCompatibleExpr *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 728 | VisitExpr(E); |
| 729 | E->setArgType1(Reader.GetType(Record[Idx++])); |
| 730 | E->setArgType2(Reader.GetType(Record[Idx++])); |
| 731 | E->setBuiltinLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
| 732 | E->setRParenLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 733 | } |
| 734 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 735 | void PCHStmtReader::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()); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 740 | E->setBuiltinLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
| 741 | E->setRParenLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 742 | } |
| 743 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 744 | void PCHStmtReader::VisitGNUNullExpr(GNUNullExpr *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 745 | VisitExpr(E); |
| 746 | E->setTokenLocation(SourceLocation::getFromRawEncoding(Record[Idx++])); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 747 | } |
| 748 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 749 | void PCHStmtReader::VisitShuffleVectorExpr(ShuffleVectorExpr *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 750 | VisitExpr(E); |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 751 | llvm::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()); |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 755 | E->setExprs(*Reader.getContext(), Exprs.data(), Exprs.size()); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 756 | E->setBuiltinLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
| 757 | E->setRParenLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 758 | } |
| 759 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 760 | void PCHStmtReader::VisitBlockExpr(BlockExpr *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 761 | VisitExpr(E); |
| 762 | E->setBlockDecl(cast_or_null<BlockDecl>(Reader.GetDecl(Record[Idx++]))); |
| 763 | E->setHasBlockDeclRefExprs(Record[Idx++]); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 764 | } |
| 765 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 766 | void PCHStmtReader::VisitBlockDeclRefExpr(BlockDeclRefExpr *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 767 | VisitExpr(E); |
| 768 | E->setDecl(cast<ValueDecl>(Reader.GetDecl(Record[Idx++]))); |
| 769 | E->setLocation(SourceLocation::getFromRawEncoding(Record[Idx++])); |
| 770 | E->setByRef(Record[Idx++]); |
Fariborz Jahanian | 9b0b57c | 2009-06-20 00:02:26 +0000 | [diff] [blame] | 771 | E->setConstQualAdded(Record[Idx++]); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 772 | E->setCopyConstructorExpr(Reader.ReadSubExpr()); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 773 | } |
| 774 | |
| 775 | //===----------------------------------------------------------------------===// |
| 776 | // Objective-C Expressions and Statements |
| 777 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 778 | void PCHStmtReader::VisitObjCStringLiteral(ObjCStringLiteral *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 779 | VisitExpr(E); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 780 | E->setString(cast<StringLiteral>(Reader.ReadSubStmt())); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 781 | E->setAtLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 782 | } |
| 783 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 784 | void PCHStmtReader::VisitObjCEncodeExpr(ObjCEncodeExpr *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 785 | VisitExpr(E); |
Douglas Gregor | 81d3466 | 2010-04-20 15:39:42 +0000 | [diff] [blame] | 786 | E->setEncodedTypeSourceInfo(Reader.GetTypeSourceInfo(Record, Idx)); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 787 | E->setAtLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
| 788 | E->setRParenLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 789 | } |
| 790 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 791 | void PCHStmtReader::VisitObjCSelectorExpr(ObjCSelectorExpr *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 792 | VisitExpr(E); |
| 793 | E->setSelector(Reader.GetSelector(Record, Idx)); |
| 794 | E->setAtLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
| 795 | E->setRParenLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 796 | } |
| 797 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 798 | void PCHStmtReader::VisitObjCProtocolExpr(ObjCProtocolExpr *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 799 | VisitExpr(E); |
| 800 | E->setProtocol(cast<ObjCProtocolDecl>(Reader.GetDecl(Record[Idx++]))); |
| 801 | E->setAtLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
| 802 | E->setRParenLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 803 | } |
| 804 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 805 | void PCHStmtReader::VisitObjCIvarRefExpr(ObjCIvarRefExpr *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 806 | VisitExpr(E); |
| 807 | E->setDecl(cast<ObjCIvarDecl>(Reader.GetDecl(Record[Idx++]))); |
| 808 | E->setLocation(SourceLocation::getFromRawEncoding(Record[Idx++])); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 809 | E->setBase(Reader.ReadSubExpr()); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 810 | E->setIsArrow(Record[Idx++]); |
| 811 | E->setIsFreeIvar(Record[Idx++]); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 812 | } |
| 813 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 814 | void PCHStmtReader::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 815 | VisitExpr(E); |
| 816 | E->setProperty(cast<ObjCPropertyDecl>(Reader.GetDecl(Record[Idx++]))); |
| 817 | E->setLocation(SourceLocation::getFromRawEncoding(Record[Idx++])); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 818 | E->setBase(Reader.ReadSubExpr()); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 819 | } |
| 820 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 821 | void PCHStmtReader::VisitObjCImplicitSetterGetterRefExpr( |
Fariborz Jahanian | 09105f5 | 2009-08-20 17:02:02 +0000 | [diff] [blame] | 822 | ObjCImplicitSetterGetterRefExpr *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 823 | VisitExpr(E); |
| 824 | E->setGetterMethod( |
| 825 | cast_or_null<ObjCMethodDecl>(Reader.GetDecl(Record[Idx++]))); |
| 826 | E->setSetterMethod( |
| 827 | cast_or_null<ObjCMethodDecl>(Reader.GetDecl(Record[Idx++]))); |
Fariborz Jahanian | d2ae5aa | 2009-08-18 21:37:33 +0000 | [diff] [blame] | 828 | E->setInterfaceDecl( |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 829 | cast_or_null<ObjCInterfaceDecl>(Reader.GetDecl(Record[Idx++]))); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 830 | E->setBase(Reader.ReadSubExpr()); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 831 | E->setLocation(SourceLocation::getFromRawEncoding(Record[Idx++])); |
| 832 | E->setClassLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 833 | } |
| 834 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 835 | void PCHStmtReader::VisitObjCMessageExpr(ObjCMessageExpr *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 836 | VisitExpr(E); |
Douglas Gregor | 04badcf | 2010-04-21 00:45:42 +0000 | [diff] [blame] | 837 | assert(Record[Idx] == E->getNumArgs()); |
| 838 | ++Idx; |
| 839 | ObjCMessageExpr::ReceiverKind Kind |
| 840 | = static_cast<ObjCMessageExpr::ReceiverKind>(Record[Idx++]); |
| 841 | switch (Kind) { |
| 842 | case ObjCMessageExpr::Instance: |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 843 | E->setInstanceReceiver(Reader.ReadSubExpr()); |
Douglas Gregor | 04badcf | 2010-04-21 00:45:42 +0000 | [diff] [blame] | 844 | break; |
| 845 | |
| 846 | case ObjCMessageExpr::Class: |
| 847 | E->setClassReceiver(Reader.GetTypeSourceInfo(Record, Idx)); |
| 848 | break; |
| 849 | |
| 850 | case ObjCMessageExpr::SuperClass: |
| 851 | case ObjCMessageExpr::SuperInstance: { |
| 852 | QualType T = Reader.GetType(Record[Idx++]); |
| 853 | SourceLocation SuperLoc = SourceLocation::getFromRawEncoding(Record[Idx++]); |
| 854 | E->setSuper(SuperLoc, T, Kind == ObjCMessageExpr::SuperInstance); |
| 855 | break; |
| 856 | } |
| 857 | } |
| 858 | |
| 859 | assert(Kind == E->getReceiverKind()); |
| 860 | |
| 861 | if (Record[Idx++]) |
| 862 | E->setMethodDecl(cast_or_null<ObjCMethodDecl>(Reader.GetDecl(Record[Idx++]))); |
| 863 | else |
| 864 | E->setSelector(Reader.GetSelector(Record, Idx)); |
| 865 | |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 866 | E->setLeftLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
| 867 | E->setRightLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 868 | |
| 869 | for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I) |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 870 | E->setArg(I, Reader.ReadSubExpr()); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 871 | } |
| 872 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 873 | void PCHStmtReader::VisitObjCSuperExpr(ObjCSuperExpr *E) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 874 | VisitExpr(E); |
| 875 | E->setLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 876 | } |
| 877 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 878 | void PCHStmtReader::VisitObjCForCollectionStmt(ObjCForCollectionStmt *S) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 879 | VisitStmt(S); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 880 | S->setElement(Reader.ReadSubStmt()); |
| 881 | S->setCollection(Reader.ReadSubExpr()); |
| 882 | S->setBody(Reader.ReadSubStmt()); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 883 | S->setForLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
| 884 | S->setRParenLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 885 | } |
| 886 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 887 | void PCHStmtReader::VisitObjCAtCatchStmt(ObjCAtCatchStmt *S) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 888 | VisitStmt(S); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 889 | S->setCatchBody(Reader.ReadSubStmt()); |
Douglas Gregor | c00d8e1 | 2010-04-26 16:46:50 +0000 | [diff] [blame] | 890 | S->setCatchParamDecl(cast_or_null<VarDecl>(Reader.GetDecl(Record[Idx++]))); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 891 | S->setAtCatchLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
| 892 | S->setRParenLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 893 | } |
| 894 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 895 | void PCHStmtReader::VisitObjCAtFinallyStmt(ObjCAtFinallyStmt *S) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 896 | VisitStmt(S); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 897 | S->setFinallyBody(Reader.ReadSubStmt()); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 898 | S->setAtFinallyLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 899 | } |
| 900 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 901 | void PCHStmtReader::VisitObjCAtTryStmt(ObjCAtTryStmt *S) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 902 | VisitStmt(S); |
Douglas Gregor | 8f5e3dd | 2010-04-23 22:50:49 +0000 | [diff] [blame] | 903 | assert(Record[Idx] == S->getNumCatchStmts()); |
| 904 | ++Idx; |
| 905 | bool HasFinally = Record[Idx++]; |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 906 | S->setTryBody(Reader.ReadSubStmt()); |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 907 | for (unsigned I = 0, N = S->getNumCatchStmts(); I != N; ++I) |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 908 | S->setCatchStmt(I, cast_or_null<ObjCAtCatchStmt>(Reader.ReadSubStmt())); |
Douglas Gregor | 8f5e3dd | 2010-04-23 22:50:49 +0000 | [diff] [blame] | 909 | |
Douglas Gregor | 8f5e3dd | 2010-04-23 22:50:49 +0000 | [diff] [blame] | 910 | if (HasFinally) |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 911 | S->setFinallyStmt(Reader.ReadSubStmt()); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 912 | S->setAtTryLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 913 | } |
| 914 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 915 | void PCHStmtReader::VisitObjCAtSynchronizedStmt(ObjCAtSynchronizedStmt *S) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 916 | VisitStmt(S); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 917 | S->setSynchExpr(Reader.ReadSubStmt()); |
| 918 | S->setSynchBody(Reader.ReadSubStmt()); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 919 | S->setAtSynchronizedLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 920 | } |
| 921 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 922 | void PCHStmtReader::VisitObjCAtThrowStmt(ObjCAtThrowStmt *S) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 923 | VisitStmt(S); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 924 | S->setThrowExpr(Reader.ReadSubStmt()); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 925 | S->setThrowLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 926 | } |
| 927 | |
Argyrios Kyrtzidis | ba0a900 | 2009-07-14 03:19:21 +0000 | [diff] [blame] | 928 | //===----------------------------------------------------------------------===// |
| 929 | // C++ Expressions and Statements |
Argyrios Kyrtzidis | 7cb45e3 | 2010-07-22 16:03:56 +0000 | [diff] [blame^] | 930 | //===----------------------------------------------------------------------===// |
| 931 | |
| 932 | void PCHStmtReader::VisitCXXCatchStmt(CXXCatchStmt *S) { |
| 933 | VisitStmt(S); |
| 934 | S->CatchLoc = Reader.ReadSourceLocation(Record, Idx); |
| 935 | S->ExceptionDecl = cast_or_null<VarDecl>(Reader.GetDecl(Record[Idx++])); |
| 936 | S->HandlerBlock = Reader.ReadSubStmt(); |
| 937 | } |
| 938 | |
| 939 | void PCHStmtReader::VisitCXXTryStmt(CXXTryStmt *S) { |
| 940 | VisitStmt(S); |
| 941 | assert(Record[Idx] == S->getNumHandlers() && "NumStmtFields is wrong ?"); |
| 942 | ++Idx; |
| 943 | S->TryLoc = Reader.ReadSourceLocation(Record, Idx); |
| 944 | S->getStmts()[0] = Reader.ReadSubStmt(); |
| 945 | for (unsigned i = 0, e = S->getNumHandlers(); i != e; ++i) |
| 946 | S->getStmts()[i + 1] = Reader.ReadSubStmt(); |
| 947 | } |
Argyrios Kyrtzidis | ba0a900 | 2009-07-14 03:19:21 +0000 | [diff] [blame] | 948 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 949 | void PCHStmtReader::VisitCXXOperatorCallExpr(CXXOperatorCallExpr *E) { |
| 950 | VisitCallExpr(E); |
Argyrios Kyrtzidis | ba0a900 | 2009-07-14 03:19:21 +0000 | [diff] [blame] | 951 | E->setOperator((OverloadedOperatorKind)Record[Idx++]); |
Argyrios Kyrtzidis | ba0a900 | 2009-07-14 03:19:21 +0000 | [diff] [blame] | 952 | } |
| 953 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 954 | void PCHStmtReader::VisitCXXConstructExpr(CXXConstructExpr *E) { |
Douglas Gregor | 39da0b8 | 2009-09-09 23:08:42 +0000 | [diff] [blame] | 955 | VisitExpr(E); |
Argyrios Kyrtzidis | 6d00c13 | 2010-07-10 11:46:15 +0000 | [diff] [blame] | 956 | E->NumArgs = Record[Idx++]; |
| 957 | if (E->NumArgs) |
| 958 | E->Args = new (*Reader.getContext()) Stmt*[E->NumArgs]; |
Argyrios Kyrtzidis | 5e1b7c2 | 2010-06-24 08:57:09 +0000 | [diff] [blame] | 959 | for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I) |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 960 | E->setArg(I, Reader.ReadSubExpr()); |
Douglas Gregor | 39da0b8 | 2009-09-09 23:08:42 +0000 | [diff] [blame] | 961 | E->setConstructor(cast<CXXConstructorDecl>(Reader.GetDecl(Record[Idx++]))); |
Douglas Gregor | 99a2e60 | 2009-12-16 01:38:02 +0000 | [diff] [blame] | 962 | E->setLocation(SourceLocation::getFromRawEncoding(Record[Idx++])); |
Douglas Gregor | 39da0b8 | 2009-09-09 23:08:42 +0000 | [diff] [blame] | 963 | E->setElidable(Record[Idx++]); |
Douglas Gregor | 16006c9 | 2009-12-16 18:50:27 +0000 | [diff] [blame] | 964 | E->setRequiresZeroInitialization(Record[Idx++]); |
Douglas Gregor | 3c9034c | 2010-05-15 00:13:29 +0000 | [diff] [blame] | 965 | E->setConstructionKind((CXXConstructExpr::ConstructionKind)Record[Idx++]); |
Douglas Gregor | 39da0b8 | 2009-09-09 23:08:42 +0000 | [diff] [blame] | 966 | } |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 967 | |
Argyrios Kyrtzidis | 6d00c13 | 2010-07-10 11:46:15 +0000 | [diff] [blame] | 968 | void PCHStmtReader::VisitCXXTemporaryObjectExpr(CXXTemporaryObjectExpr *E) { |
| 969 | VisitCXXConstructExpr(E); |
| 970 | E->TyBeginLoc = Reader.ReadSourceLocation(Record, Idx); |
| 971 | E->RParenLoc = Reader.ReadSourceLocation(Record, Idx); |
| 972 | } |
| 973 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 974 | void PCHStmtReader::VisitCXXNamedCastExpr(CXXNamedCastExpr *E) { |
| 975 | VisitExplicitCastExpr(E); |
Sam Weinig | ce757a7 | 2010-01-16 21:21:01 +0000 | [diff] [blame] | 976 | E->setOperatorLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
Sam Weinig | ce757a7 | 2010-01-16 21:21:01 +0000 | [diff] [blame] | 977 | } |
| 978 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 979 | void PCHStmtReader::VisitCXXStaticCastExpr(CXXStaticCastExpr *E) { |
Sam Weinig | ce757a7 | 2010-01-16 21:21:01 +0000 | [diff] [blame] | 980 | return VisitCXXNamedCastExpr(E); |
| 981 | } |
| 982 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 983 | void PCHStmtReader::VisitCXXDynamicCastExpr(CXXDynamicCastExpr *E) { |
Sam Weinig | ce757a7 | 2010-01-16 21:21:01 +0000 | [diff] [blame] | 984 | return VisitCXXNamedCastExpr(E); |
| 985 | } |
| 986 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 987 | void PCHStmtReader::VisitCXXReinterpretCastExpr(CXXReinterpretCastExpr *E) { |
Sam Weinig | ce757a7 | 2010-01-16 21:21:01 +0000 | [diff] [blame] | 988 | return VisitCXXNamedCastExpr(E); |
| 989 | } |
| 990 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 991 | void PCHStmtReader::VisitCXXConstCastExpr(CXXConstCastExpr *E) { |
Sam Weinig | ce757a7 | 2010-01-16 21:21:01 +0000 | [diff] [blame] | 992 | return VisitCXXNamedCastExpr(E); |
| 993 | } |
| 994 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 995 | void PCHStmtReader::VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr *E) { |
| 996 | VisitExplicitCastExpr(E); |
Sam Weinig | ce757a7 | 2010-01-16 21:21:01 +0000 | [diff] [blame] | 997 | E->setTypeBeginLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
| 998 | E->setRParenLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
Sam Weinig | ce757a7 | 2010-01-16 21:21:01 +0000 | [diff] [blame] | 999 | } |
| 1000 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1001 | void PCHStmtReader::VisitCXXBoolLiteralExpr(CXXBoolLiteralExpr *E) { |
Sam Weinig | eb7f961 | 2010-02-07 06:32:43 +0000 | [diff] [blame] | 1002 | VisitExpr(E); |
| 1003 | E->setValue(Record[Idx++]); |
| 1004 | E->setLocation(SourceLocation::getFromRawEncoding(Record[Idx++])); |
Sam Weinig | eb7f961 | 2010-02-07 06:32:43 +0000 | [diff] [blame] | 1005 | } |
| 1006 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1007 | void PCHStmtReader::VisitCXXNullPtrLiteralExpr(CXXNullPtrLiteralExpr *E) { |
Sam Weinig | eb7f961 | 2010-02-07 06:32:43 +0000 | [diff] [blame] | 1008 | VisitExpr(E); |
| 1009 | E->setLocation(SourceLocation::getFromRawEncoding(Record[Idx++])); |
Sam Weinig | eb7f961 | 2010-02-07 06:32:43 +0000 | [diff] [blame] | 1010 | } |
| 1011 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1012 | void PCHStmtReader::VisitCXXTypeidExpr(CXXTypeidExpr *E) { |
Chris Lattner | 14ab24f | 2010-05-09 06:03:39 +0000 | [diff] [blame] | 1013 | VisitExpr(E); |
| 1014 | E->setSourceRange(Reader.ReadSourceRange(Record, Idx)); |
| 1015 | if (E->isTypeOperand()) { // typeid(int) |
| 1016 | E->setTypeOperandSourceInfo(Reader.GetTypeSourceInfo(Record, Idx)); |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1017 | return; |
Chris Lattner | 14ab24f | 2010-05-09 06:03:39 +0000 | [diff] [blame] | 1018 | } |
| 1019 | |
| 1020 | // typeid(42+2) |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 1021 | E->setExprOperand(Reader.ReadSubExpr()); |
Chris Lattner | 14ab24f | 2010-05-09 06:03:39 +0000 | [diff] [blame] | 1022 | } |
| 1023 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1024 | void PCHStmtReader::VisitCXXThisExpr(CXXThisExpr *E) { |
Chris Lattner | 2fbdfcd | 2010-05-09 06:15:05 +0000 | [diff] [blame] | 1025 | VisitExpr(E); |
| 1026 | E->setLocation(SourceLocation::getFromRawEncoding(Record[Idx++])); |
| 1027 | E->setImplicit(Record[Idx++]); |
Chris Lattner | 2fbdfcd | 2010-05-09 06:15:05 +0000 | [diff] [blame] | 1028 | } |
| 1029 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1030 | void PCHStmtReader::VisitCXXThrowExpr(CXXThrowExpr *E) { |
Chris Lattner | 2fbdfcd | 2010-05-09 06:15:05 +0000 | [diff] [blame] | 1031 | VisitExpr(E); |
| 1032 | E->setThrowLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 1033 | E->setSubExpr(Reader.ReadSubExpr()); |
Chris Lattner | 2fbdfcd | 2010-05-09 06:15:05 +0000 | [diff] [blame] | 1034 | } |
Chris Lattner | 14ab24f | 2010-05-09 06:03:39 +0000 | [diff] [blame] | 1035 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1036 | void PCHStmtReader::VisitCXXDefaultArgExpr(CXXDefaultArgExpr *E) { |
Chris Lattner | 030854b | 2010-05-09 06:40:08 +0000 | [diff] [blame] | 1037 | VisitExpr(E); |
Argyrios Kyrtzidis | 8a50733 | 2010-07-02 23:30:15 +0000 | [diff] [blame] | 1038 | |
| 1039 | assert(Record[Idx] == E->Param.getInt() && "We messed up at creation ?"); |
| 1040 | ++Idx; // HasOtherExprStored and SubExpr was handled during creation. |
| 1041 | E->Param.setPointer(cast<ParmVarDecl>(Reader.GetDecl(Record[Idx++]))); |
| 1042 | E->Loc = Reader.ReadSourceLocation(Record, Idx); |
Chris Lattner | d259836 | 2010-05-10 00:25:06 +0000 | [diff] [blame] | 1043 | } |
| 1044 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1045 | void PCHStmtReader::VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *E) { |
Chris Lattner | d259836 | 2010-05-10 00:25:06 +0000 | [diff] [blame] | 1046 | VisitExpr(E); |
| 1047 | E->setTemporary(Reader.ReadCXXTemporary(Record, Idx)); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 1048 | E->setSubExpr(Reader.ReadSubExpr()); |
Chris Lattner | d259836 | 2010-05-10 00:25:06 +0000 | [diff] [blame] | 1049 | } |
| 1050 | |
Argyrios Kyrtzidis | 6d00c13 | 2010-07-10 11:46:15 +0000 | [diff] [blame] | 1051 | void PCHStmtReader::VisitCXXBindReferenceExpr(CXXBindReferenceExpr *E) { |
| 1052 | VisitExpr(E); |
| 1053 | E->SubExpr = Reader.ReadSubExpr(); |
| 1054 | E->ExtendsLifetime = Record[Idx++]; |
| 1055 | E->RequiresTemporaryCopy = Record[Idx++]; |
| 1056 | } |
| 1057 | |
Douglas Gregor | ed8abf1 | 2010-07-08 06:14:04 +0000 | [diff] [blame] | 1058 | void PCHStmtReader::VisitCXXScalarValueInitExpr(CXXScalarValueInitExpr *E) { |
Chris Lattner | 5921863 | 2010-05-10 01:22:27 +0000 | [diff] [blame] | 1059 | VisitExpr(E); |
| 1060 | E->setTypeBeginLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
| 1061 | E->setRParenLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
Chris Lattner | 5921863 | 2010-05-10 01:22:27 +0000 | [diff] [blame] | 1062 | } |
| 1063 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1064 | void PCHStmtReader::VisitCXXNewExpr(CXXNewExpr *E) { |
Chris Lattner | 5921863 | 2010-05-10 01:22:27 +0000 | [diff] [blame] | 1065 | VisitExpr(E); |
| 1066 | E->setGlobalNew(Record[Idx++]); |
Chris Lattner | 5921863 | 2010-05-10 01:22:27 +0000 | [diff] [blame] | 1067 | E->setHasInitializer(Record[Idx++]); |
| 1068 | bool isArray = Record[Idx++]; |
| 1069 | unsigned NumPlacementArgs = Record[Idx++]; |
| 1070 | unsigned NumCtorArgs = Record[Idx++]; |
| 1071 | E->setOperatorNew(cast_or_null<FunctionDecl>(Reader.GetDecl(Record[Idx++]))); |
| 1072 | E->setOperatorDelete( |
| 1073 | cast_or_null<FunctionDecl>(Reader.GetDecl(Record[Idx++]))); |
| 1074 | E->setConstructor( |
| 1075 | cast_or_null<CXXConstructorDecl>(Reader.GetDecl(Record[Idx++]))); |
Douglas Gregor | 4bd4031 | 2010-07-13 15:54:32 +0000 | [diff] [blame] | 1076 | SourceRange TypeIdParens; |
| 1077 | TypeIdParens.setBegin(SourceLocation::getFromRawEncoding(Record[Idx++])); |
| 1078 | TypeIdParens.setEnd(SourceLocation::getFromRawEncoding(Record[Idx++])); |
| 1079 | E->TypeIdParens = TypeIdParens; |
Chris Lattner | 5921863 | 2010-05-10 01:22:27 +0000 | [diff] [blame] | 1080 | E->setStartLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
| 1081 | E->setEndLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
| 1082 | |
| 1083 | E->AllocateArgsArray(*Reader.getContext(), isArray, NumPlacementArgs, |
| 1084 | NumCtorArgs); |
| 1085 | |
| 1086 | // Install all the subexpressions. |
Chris Lattner | 5921863 | 2010-05-10 01:22:27 +0000 | [diff] [blame] | 1087 | for (CXXNewExpr::raw_arg_iterator I = E->raw_arg_begin(),e = E->raw_arg_end(); |
| 1088 | I != e; ++I) |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 1089 | *I = Reader.ReadSubStmt(); |
Chris Lattner | 5921863 | 2010-05-10 01:22:27 +0000 | [diff] [blame] | 1090 | } |
| 1091 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1092 | void PCHStmtReader::VisitCXXDeleteExpr(CXXDeleteExpr *E) { |
Argyrios Kyrtzidis | 95fc98c | 2010-06-22 17:07:59 +0000 | [diff] [blame] | 1093 | VisitExpr(E); |
| 1094 | E->setGlobalDelete(Record[Idx++]); |
| 1095 | E->setArrayForm(Record[Idx++]); |
| 1096 | E->setOperatorDelete( |
| 1097 | cast_or_null<FunctionDecl>(Reader.GetDecl(Record[Idx++]))); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 1098 | E->setArgument(Reader.ReadSubExpr()); |
Argyrios Kyrtzidis | 95fc98c | 2010-06-22 17:07:59 +0000 | [diff] [blame] | 1099 | E->setStartLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); |
Argyrios Kyrtzidis | 95fc98c | 2010-06-22 17:07:59 +0000 | [diff] [blame] | 1100 | } |
Chris Lattner | d259836 | 2010-05-10 00:25:06 +0000 | [diff] [blame] | 1101 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1102 | void PCHStmtReader::VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr *E) { |
Argyrios Kyrtzidis | de4bd18 | 2010-06-28 09:32:03 +0000 | [diff] [blame] | 1103 | VisitExpr(E); |
| 1104 | |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 1105 | E->setBase(Reader.ReadSubExpr()); |
Argyrios Kyrtzidis | de4bd18 | 2010-06-28 09:32:03 +0000 | [diff] [blame] | 1106 | E->setArrow(Record[Idx++]); |
| 1107 | E->setOperatorLoc(Reader.ReadSourceLocation(Record, Idx)); |
| 1108 | E->setQualifier(Reader.ReadNestedNameSpecifier(Record, Idx)); |
| 1109 | E->setQualifierRange(Reader.ReadSourceRange(Record, Idx)); |
| 1110 | E->setScopeTypeInfo(Reader.GetTypeSourceInfo(Record, Idx)); |
| 1111 | E->setColonColonLoc(Reader.ReadSourceLocation(Record, Idx)); |
| 1112 | E->setTildeLoc(Reader.ReadSourceLocation(Record, Idx)); |
| 1113 | |
| 1114 | IdentifierInfo *II = Reader.GetIdentifierInfo(Record, Idx); |
| 1115 | if (II) |
| 1116 | E->setDestroyedType(II, Reader.ReadSourceLocation(Record, Idx)); |
| 1117 | else |
| 1118 | E->setDestroyedType(Reader.GetTypeSourceInfo(Record, Idx)); |
Argyrios Kyrtzidis | de4bd18 | 2010-06-28 09:32:03 +0000 | [diff] [blame] | 1119 | } |
| 1120 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1121 | void PCHStmtReader::VisitCXXExprWithTemporaries(CXXExprWithTemporaries *E) { |
Chris Lattner | d259836 | 2010-05-10 00:25:06 +0000 | [diff] [blame] | 1122 | VisitExpr(E); |
| 1123 | unsigned NumTemps = Record[Idx++]; |
| 1124 | if (NumTemps) { |
Ted Kremenek | d04ed41 | 2010-05-10 20:06:30 +0000 | [diff] [blame] | 1125 | E->setNumTemporaries(*Reader.getContext(), NumTemps); |
Chris Lattner | d259836 | 2010-05-10 00:25:06 +0000 | [diff] [blame] | 1126 | for (unsigned i = 0; i != NumTemps; ++i) |
| 1127 | E->setTemporary(i, Reader.ReadCXXTemporary(Record, Idx)); |
| 1128 | } |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 1129 | E->setSubExpr(Reader.ReadSubExpr()); |
Chris Lattner | 030854b | 2010-05-09 06:40:08 +0000 | [diff] [blame] | 1130 | } |
| 1131 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1132 | void |
Argyrios Kyrtzidis | 8dfbd8b | 2010-06-24 08:57:31 +0000 | [diff] [blame] | 1133 | PCHStmtReader::VisitCXXDependentScopeMemberExpr(CXXDependentScopeMemberExpr *E){ |
| 1134 | VisitExpr(E); |
| 1135 | |
| 1136 | unsigned NumTemplateArgs = Record[Idx++]; |
| 1137 | assert((NumTemplateArgs != 0) == E->hasExplicitTemplateArgs() && |
| 1138 | "Read wrong record during creation ?"); |
Argyrios Kyrtzidis | 36c76f0 | 2010-06-28 09:31:48 +0000 | [diff] [blame] | 1139 | if (E->hasExplicitTemplateArgs()) |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1140 | ReadExplicitTemplateArgumentList(*E->getExplicitTemplateArgumentList(), |
| 1141 | NumTemplateArgs); |
Argyrios Kyrtzidis | 8dfbd8b | 2010-06-24 08:57:31 +0000 | [diff] [blame] | 1142 | |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 1143 | E->setBase(Reader.ReadSubExpr()); |
Argyrios Kyrtzidis | 8dfbd8b | 2010-06-24 08:57:31 +0000 | [diff] [blame] | 1144 | E->setBaseType(Reader.GetType(Record[Idx++])); |
| 1145 | E->setArrow(Record[Idx++]); |
| 1146 | E->setOperatorLoc(Reader.ReadSourceLocation(Record, Idx)); |
| 1147 | E->setQualifier(Reader.ReadNestedNameSpecifier(Record, Idx)); |
| 1148 | E->setQualifierRange(Reader.ReadSourceRange(Record, Idx)); |
| 1149 | E->setFirstQualifierFoundInScope( |
| 1150 | cast_or_null<NamedDecl>(Reader.GetDecl(Record[Idx++]))); |
| 1151 | E->setMember(Reader.ReadDeclarationName(Record, Idx)); |
| 1152 | E->setMemberLoc(Reader.ReadSourceLocation(Record, Idx)); |
Argyrios Kyrtzidis | 8dfbd8b | 2010-06-24 08:57:31 +0000 | [diff] [blame] | 1153 | } |
| 1154 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1155 | void |
Argyrios Kyrtzidis | 12dffcd | 2010-06-28 09:31:56 +0000 | [diff] [blame] | 1156 | PCHStmtReader::VisitDependentScopeDeclRefExpr(DependentScopeDeclRefExpr *E) { |
| 1157 | VisitExpr(E); |
Argyrios Kyrtzidis | 12dffcd | 2010-06-28 09:31:56 +0000 | [diff] [blame] | 1158 | |
| 1159 | unsigned NumTemplateArgs = Record[Idx++]; |
| 1160 | assert((NumTemplateArgs != 0) == E->hasExplicitTemplateArgs() && |
| 1161 | "Read wrong record during creation ?"); |
| 1162 | if (E->hasExplicitTemplateArgs()) |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1163 | ReadExplicitTemplateArgumentList(E->getExplicitTemplateArgs(), |
| 1164 | NumTemplateArgs); |
Argyrios Kyrtzidis | 12dffcd | 2010-06-28 09:31:56 +0000 | [diff] [blame] | 1165 | |
| 1166 | E->setDeclName(Reader.ReadDeclarationName(Record, Idx)); |
| 1167 | E->setLocation(Reader.ReadSourceLocation(Record, Idx)); |
| 1168 | E->setQualifierRange(Reader.ReadSourceRange(Record, Idx)); |
| 1169 | E->setQualifier(Reader.ReadNestedNameSpecifier(Record, Idx)); |
Argyrios Kyrtzidis | 12dffcd | 2010-06-28 09:31:56 +0000 | [diff] [blame] | 1170 | } |
| 1171 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1172 | void |
Argyrios Kyrtzidis | 8dfbd8b | 2010-06-24 08:57:31 +0000 | [diff] [blame] | 1173 | PCHStmtReader::VisitCXXUnresolvedConstructExpr(CXXUnresolvedConstructExpr *E) { |
| 1174 | VisitExpr(E); |
| 1175 | assert(Record[Idx] == E->arg_size() && "Read wrong record during creation ?"); |
| 1176 | ++Idx; // NumArgs; |
| 1177 | for (unsigned I = 0, N = E->arg_size(); I != N; ++I) |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 1178 | E->setArg(I, Reader.ReadSubExpr()); |
Argyrios Kyrtzidis | 8dfbd8b | 2010-06-24 08:57:31 +0000 | [diff] [blame] | 1179 | E->setTypeBeginLoc(Reader.ReadSourceLocation(Record, Idx)); |
| 1180 | E->setTypeAsWritten(Reader.GetType(Record[Idx++])); |
| 1181 | E->setLParenLoc(Reader.ReadSourceLocation(Record, Idx)); |
| 1182 | E->setRParenLoc(Reader.ReadSourceLocation(Record, Idx)); |
Argyrios Kyrtzidis | 8dfbd8b | 2010-06-24 08:57:31 +0000 | [diff] [blame] | 1183 | } |
| 1184 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1185 | void PCHStmtReader::VisitOverloadExpr(OverloadExpr *E) { |
Argyrios Kyrtzidis | a77eb08 | 2010-06-25 09:03:26 +0000 | [diff] [blame] | 1186 | VisitExpr(E); |
| 1187 | |
| 1188 | unsigned NumTemplateArgs = Record[Idx++]; |
| 1189 | assert((NumTemplateArgs != 0) == E->hasExplicitTemplateArgs() && |
| 1190 | "Read wrong record during creation ?"); |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1191 | if (E->hasExplicitTemplateArgs()) |
| 1192 | ReadExplicitTemplateArgumentList(E->getExplicitTemplateArgs(), |
| 1193 | NumTemplateArgs); |
Argyrios Kyrtzidis | a77eb08 | 2010-06-25 09:03:26 +0000 | [diff] [blame] | 1194 | |
| 1195 | unsigned NumDecls = Record[Idx++]; |
| 1196 | UnresolvedSet<8> Decls; |
| 1197 | for (unsigned i = 0; i != NumDecls; ++i) { |
| 1198 | NamedDecl *D = cast<NamedDecl>(Reader.GetDecl(Record[Idx++])); |
| 1199 | AccessSpecifier AS = (AccessSpecifier)Record[Idx++]; |
| 1200 | Decls.addDecl(D, AS); |
| 1201 | } |
| 1202 | E->initializeResults(*Reader.getContext(), Decls.begin(), Decls.end()); |
| 1203 | |
| 1204 | E->setName(Reader.ReadDeclarationName(Record, Idx)); |
| 1205 | E->setQualifier(Reader.ReadNestedNameSpecifier(Record, Idx)); |
| 1206 | E->setQualifierRange(Reader.ReadSourceRange(Record, Idx)); |
| 1207 | E->setNameLoc(Reader.ReadSourceLocation(Record, Idx)); |
Argyrios Kyrtzidis | a77eb08 | 2010-06-25 09:03:26 +0000 | [diff] [blame] | 1208 | } |
| 1209 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1210 | void PCHStmtReader::VisitUnresolvedMemberExpr(UnresolvedMemberExpr *E) { |
| 1211 | VisitOverloadExpr(E); |
Argyrios Kyrtzidis | a77eb08 | 2010-06-25 09:03:26 +0000 | [diff] [blame] | 1212 | E->setArrow(Record[Idx++]); |
| 1213 | E->setHasUnresolvedUsing(Record[Idx++]); |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 1214 | E->setBase(Reader.ReadSubExpr()); |
Argyrios Kyrtzidis | a77eb08 | 2010-06-25 09:03:26 +0000 | [diff] [blame] | 1215 | E->setBaseType(Reader.GetType(Record[Idx++])); |
| 1216 | E->setOperatorLoc(Reader.ReadSourceLocation(Record, Idx)); |
Argyrios Kyrtzidis | a77eb08 | 2010-06-25 09:03:26 +0000 | [diff] [blame] | 1217 | } |
| 1218 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1219 | void PCHStmtReader::VisitUnresolvedLookupExpr(UnresolvedLookupExpr *E) { |
| 1220 | VisitOverloadExpr(E); |
Argyrios Kyrtzidis | bd65bb5 | 2010-06-25 09:03:34 +0000 | [diff] [blame] | 1221 | E->setRequiresADL(Record[Idx++]); |
| 1222 | E->setOverloaded(Record[Idx++]); |
| 1223 | E->setNamingClass(cast_or_null<CXXRecordDecl>(Reader.GetDecl(Record[Idx++]))); |
Argyrios Kyrtzidis | bd65bb5 | 2010-06-25 09:03:34 +0000 | [diff] [blame] | 1224 | } |
| 1225 | |
Argyrios Kyrtzidis | 6d00c13 | 2010-07-10 11:46:15 +0000 | [diff] [blame] | 1226 | void PCHStmtReader::VisitUnaryTypeTraitExpr(UnaryTypeTraitExpr *E) { |
| 1227 | VisitExpr(E); |
| 1228 | E->UTT = (UnaryTypeTrait)Record[Idx++]; |
| 1229 | SourceRange Range = Reader.ReadSourceRange(Record, Idx); |
| 1230 | E->Loc = Range.getBegin(); |
| 1231 | E->RParen = Range.getEnd(); |
| 1232 | E->QueriedType = Reader.GetType(Record[Idx++]); |
| 1233 | } |
| 1234 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1235 | Stmt *PCHReader::ReadStmt() { |
| 1236 | switch (ReadingKind) { |
| 1237 | case Read_Decl: |
| 1238 | case Read_Type: |
| 1239 | // Read a statement from the current DeclCursor. |
Sebastian Redl | 9137a52 | 2010-07-16 17:50:48 +0000 | [diff] [blame] | 1240 | return ReadStmtFromStream(Chain[0]->DeclsCursor); |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1241 | case Read_Stmt: |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 1242 | return ReadSubStmt(); |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1243 | } |
| 1244 | |
| 1245 | llvm_unreachable("ReadingKind not set ?"); |
| 1246 | return 0; |
| 1247 | } |
| 1248 | |
| 1249 | Expr *PCHReader::ReadExpr() { |
| 1250 | return cast_or_null<Expr>(ReadStmt()); |
| 1251 | } |
Chris Lattner | 030854b | 2010-05-09 06:40:08 +0000 | [diff] [blame] | 1252 | |
Argyrios Kyrtzidis | d98a2ab | 2010-06-29 22:46:25 +0000 | [diff] [blame] | 1253 | Expr *PCHReader::ReadSubExpr() { |
| 1254 | return cast_or_null<Expr>(ReadSubStmt()); |
| 1255 | } |
| 1256 | |
Chris Lattner | 52e97d1 | 2009-04-27 05:41:06 +0000 | [diff] [blame] | 1257 | // Within the bitstream, expressions are stored in Reverse Polish |
| 1258 | // Notation, with each of the subexpressions preceding the |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1259 | // expression they are stored in. Subexpressions are stored from last to first. |
| 1260 | // To evaluate expressions, we continue reading expressions and placing them on |
| 1261 | // the stack, with expressions having operands removing those operands from the |
Chris Lattner | 52e97d1 | 2009-04-27 05:41:06 +0000 | [diff] [blame] | 1262 | // stack. Evaluation terminates when we see a STMT_STOP record, and |
| 1263 | // the single remaining expression on the stack is our result. |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1264 | Stmt *PCHReader::ReadStmtFromStream(llvm::BitstreamCursor &Cursor) { |
| 1265 | |
| 1266 | ReadingKindTracker ReadingKind(Read_Stmt, *this); |
| 1267 | |
| 1268 | #ifndef NDEBUG |
| 1269 | unsigned PrevNumStmts = StmtStack.size(); |
| 1270 | #endif |
| 1271 | |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1272 | RecordData Record; |
| 1273 | unsigned Idx; |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1274 | PCHStmtReader Reader(*this, Record, Idx); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1275 | Stmt::EmptyShell Empty; |
| 1276 | |
| 1277 | while (true) { |
Chris Lattner | 52e97d1 | 2009-04-27 05:41:06 +0000 | [diff] [blame] | 1278 | unsigned Code = Cursor.ReadCode(); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1279 | if (Code == llvm::bitc::END_BLOCK) { |
Chris Lattner | 52e97d1 | 2009-04-27 05:41:06 +0000 | [diff] [blame] | 1280 | if (Cursor.ReadBlockEnd()) { |
Douglas Gregor | a02b147 | 2009-04-28 21:53:25 +0000 | [diff] [blame] | 1281 | Error("error at end of block in PCH file"); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1282 | return 0; |
| 1283 | } |
| 1284 | break; |
| 1285 | } |
| 1286 | |
| 1287 | if (Code == llvm::bitc::ENTER_SUBBLOCK) { |
| 1288 | // No known subblocks, always skip them. |
Chris Lattner | 52e97d1 | 2009-04-27 05:41:06 +0000 | [diff] [blame] | 1289 | Cursor.ReadSubBlockID(); |
| 1290 | if (Cursor.SkipBlock()) { |
Douglas Gregor | a02b147 | 2009-04-28 21:53:25 +0000 | [diff] [blame] | 1291 | Error("malformed block record in PCH file"); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1292 | return 0; |
| 1293 | } |
| 1294 | continue; |
| 1295 | } |
| 1296 | |
| 1297 | if (Code == llvm::bitc::DEFINE_ABBREV) { |
Chris Lattner | 52e97d1 | 2009-04-27 05:41:06 +0000 | [diff] [blame] | 1298 | Cursor.ReadAbbrevRecord(); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1299 | continue; |
| 1300 | } |
| 1301 | |
| 1302 | Stmt *S = 0; |
| 1303 | Idx = 0; |
| 1304 | Record.clear(); |
| 1305 | bool Finished = false; |
Chris Lattner | 52e97d1 | 2009-04-27 05:41:06 +0000 | [diff] [blame] | 1306 | switch ((pch::StmtCode)Cursor.ReadRecord(Code, Record)) { |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1307 | case pch::STMT_STOP: |
| 1308 | Finished = true; |
| 1309 | break; |
| 1310 | |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 1311 | case pch::STMT_NULL_PTR: |
| 1312 | S = 0; |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1313 | break; |
| 1314 | |
| 1315 | case pch::STMT_NULL: |
| 1316 | S = new (Context) NullStmt(Empty); |
| 1317 | break; |
| 1318 | |
| 1319 | case pch::STMT_COMPOUND: |
| 1320 | S = new (Context) CompoundStmt(Empty); |
| 1321 | break; |
| 1322 | |
| 1323 | case pch::STMT_CASE: |
| 1324 | S = new (Context) CaseStmt(Empty); |
| 1325 | break; |
| 1326 | |
| 1327 | case pch::STMT_DEFAULT: |
| 1328 | S = new (Context) DefaultStmt(Empty); |
| 1329 | break; |
| 1330 | |
| 1331 | case pch::STMT_LABEL: |
| 1332 | S = new (Context) LabelStmt(Empty); |
| 1333 | break; |
| 1334 | |
| 1335 | case pch::STMT_IF: |
| 1336 | S = new (Context) IfStmt(Empty); |
| 1337 | break; |
| 1338 | |
| 1339 | case pch::STMT_SWITCH: |
| 1340 | S = new (Context) SwitchStmt(Empty); |
| 1341 | break; |
| 1342 | |
| 1343 | case pch::STMT_WHILE: |
| 1344 | S = new (Context) WhileStmt(Empty); |
| 1345 | break; |
| 1346 | |
| 1347 | case pch::STMT_DO: |
| 1348 | S = new (Context) DoStmt(Empty); |
| 1349 | break; |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 1350 | |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1351 | case pch::STMT_FOR: |
| 1352 | S = new (Context) ForStmt(Empty); |
| 1353 | break; |
| 1354 | |
| 1355 | case pch::STMT_GOTO: |
| 1356 | S = new (Context) GotoStmt(Empty); |
| 1357 | break; |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 1358 | |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1359 | case pch::STMT_INDIRECT_GOTO: |
| 1360 | S = new (Context) IndirectGotoStmt(Empty); |
| 1361 | break; |
| 1362 | |
| 1363 | case pch::STMT_CONTINUE: |
| 1364 | S = new (Context) ContinueStmt(Empty); |
| 1365 | break; |
| 1366 | |
| 1367 | case pch::STMT_BREAK: |
| 1368 | S = new (Context) BreakStmt(Empty); |
| 1369 | break; |
| 1370 | |
| 1371 | case pch::STMT_RETURN: |
| 1372 | S = new (Context) ReturnStmt(Empty); |
| 1373 | break; |
| 1374 | |
| 1375 | case pch::STMT_DECL: |
| 1376 | S = new (Context) DeclStmt(Empty); |
| 1377 | break; |
| 1378 | |
| 1379 | case pch::STMT_ASM: |
| 1380 | S = new (Context) AsmStmt(Empty); |
| 1381 | break; |
| 1382 | |
| 1383 | case pch::EXPR_PREDEFINED: |
| 1384 | S = new (Context) PredefinedExpr(Empty); |
| 1385 | break; |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 1386 | |
| 1387 | case pch::EXPR_DECL_REF: |
Argyrios Kyrtzidis | 663e380 | 2010-07-08 13:09:47 +0000 | [diff] [blame] | 1388 | S = DeclRefExpr::CreateEmpty(*Context, |
| 1389 | /*HasQualifier=*/Record[PCHStmtReader::NumExprFields], |
| 1390 | /*NumTemplateArgs=*/Record[PCHStmtReader::NumExprFields + 1]); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1391 | break; |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 1392 | |
| 1393 | case pch::EXPR_INTEGER_LITERAL: |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1394 | S = new (Context) IntegerLiteral(Empty); |
| 1395 | break; |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 1396 | |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1397 | case pch::EXPR_FLOATING_LITERAL: |
| 1398 | S = new (Context) FloatingLiteral(Empty); |
| 1399 | break; |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 1400 | |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1401 | case pch::EXPR_IMAGINARY_LITERAL: |
| 1402 | S = new (Context) ImaginaryLiteral(Empty); |
| 1403 | break; |
| 1404 | |
| 1405 | case pch::EXPR_STRING_LITERAL: |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 1406 | S = StringLiteral::CreateEmpty(*Context, |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1407 | Record[PCHStmtReader::NumExprFields + 1]); |
| 1408 | break; |
| 1409 | |
| 1410 | case pch::EXPR_CHARACTER_LITERAL: |
| 1411 | S = new (Context) CharacterLiteral(Empty); |
| 1412 | break; |
| 1413 | |
| 1414 | case pch::EXPR_PAREN: |
| 1415 | S = new (Context) ParenExpr(Empty); |
| 1416 | break; |
| 1417 | |
Argyrios Kyrtzidis | 37bdfe2 | 2010-06-30 08:49:18 +0000 | [diff] [blame] | 1418 | case pch::EXPR_PAREN_LIST: |
| 1419 | S = new (Context) ParenListExpr(Empty); |
| 1420 | break; |
| 1421 | |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1422 | case pch::EXPR_UNARY_OPERATOR: |
| 1423 | S = new (Context) UnaryOperator(Empty); |
| 1424 | break; |
| 1425 | |
Douglas Gregor | 8ecdb65 | 2010-04-28 22:16:22 +0000 | [diff] [blame] | 1426 | case pch::EXPR_OFFSETOF: |
| 1427 | S = OffsetOfExpr::CreateEmpty(*Context, |
| 1428 | Record[PCHStmtReader::NumExprFields], |
| 1429 | Record[PCHStmtReader::NumExprFields + 1]); |
| 1430 | break; |
| 1431 | |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1432 | case pch::EXPR_SIZEOF_ALIGN_OF: |
| 1433 | S = new (Context) SizeOfAlignOfExpr(Empty); |
| 1434 | break; |
| 1435 | |
| 1436 | case pch::EXPR_ARRAY_SUBSCRIPT: |
| 1437 | S = new (Context) ArraySubscriptExpr(Empty); |
| 1438 | break; |
| 1439 | |
| 1440 | case pch::EXPR_CALL: |
Argyrios Kyrtzidis | ba0a900 | 2009-07-14 03:19:21 +0000 | [diff] [blame] | 1441 | S = new (Context) CallExpr(*Context, Stmt::CallExprClass, Empty); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1442 | break; |
| 1443 | |
Argyrios Kyrtzidis | 663e380 | 2010-07-08 13:09:47 +0000 | [diff] [blame] | 1444 | case pch::EXPR_MEMBER: { |
| 1445 | // We load everything here and fully initialize it at creation. |
| 1446 | // That way we can use MemberExpr::Create and don't have to duplicate its |
| 1447 | // logic with a MemberExpr::CreateEmpty. |
| 1448 | |
| 1449 | assert(Idx == 0); |
| 1450 | NestedNameSpecifier *NNS = 0; |
| 1451 | SourceRange QualifierRange; |
| 1452 | if (Record[Idx++]) { // HasQualifier. |
| 1453 | NNS = ReadNestedNameSpecifier(Record, Idx); |
| 1454 | QualifierRange = ReadSourceRange(Record, Idx); |
| 1455 | } |
| 1456 | |
| 1457 | TemplateArgumentListInfo ArgInfo; |
| 1458 | unsigned NumTemplateArgs = Record[Idx++]; |
| 1459 | if (NumTemplateArgs) { |
| 1460 | ArgInfo.setLAngleLoc(ReadSourceLocation(Record, Idx)); |
| 1461 | ArgInfo.setRAngleLoc(ReadSourceLocation(Record, Idx)); |
| 1462 | for (unsigned i = 0; i != NumTemplateArgs; ++i) |
| 1463 | ArgInfo.addArgument(ReadTemplateArgumentLoc(Record, Idx)); |
| 1464 | } |
| 1465 | |
| 1466 | NamedDecl *FoundD = cast_or_null<NamedDecl>(GetDecl(Record[Idx++])); |
| 1467 | AccessSpecifier AS = (AccessSpecifier)Record[Idx++]; |
| 1468 | DeclAccessPair FoundDecl = DeclAccessPair::make(FoundD, AS); |
| 1469 | |
| 1470 | QualType T = GetType(Record[Idx++]); |
| 1471 | Expr *Base = ReadSubExpr(); |
| 1472 | ValueDecl *MemberD = cast<ValueDecl>(GetDecl(Record[Idx++])); |
| 1473 | SourceLocation MemberLoc = ReadSourceLocation(Record, Idx); |
| 1474 | bool IsArrow = Record[Idx++]; |
| 1475 | |
| 1476 | S = MemberExpr::Create(*Context, Base, IsArrow, NNS, QualifierRange, |
| 1477 | MemberD, FoundDecl, MemberLoc, |
| 1478 | NumTemplateArgs ? &ArgInfo : 0, T); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1479 | break; |
Argyrios Kyrtzidis | 663e380 | 2010-07-08 13:09:47 +0000 | [diff] [blame] | 1480 | } |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1481 | |
| 1482 | case pch::EXPR_BINARY_OPERATOR: |
| 1483 | S = new (Context) BinaryOperator(Empty); |
| 1484 | break; |
| 1485 | |
| 1486 | case pch::EXPR_COMPOUND_ASSIGN_OPERATOR: |
| 1487 | S = new (Context) CompoundAssignOperator(Empty); |
| 1488 | break; |
| 1489 | |
| 1490 | case pch::EXPR_CONDITIONAL_OPERATOR: |
| 1491 | S = new (Context) ConditionalOperator(Empty); |
| 1492 | break; |
| 1493 | |
| 1494 | case pch::EXPR_IMPLICIT_CAST: |
| 1495 | S = new (Context) ImplicitCastExpr(Empty); |
| 1496 | break; |
| 1497 | |
| 1498 | case pch::EXPR_CSTYLE_CAST: |
| 1499 | S = new (Context) CStyleCastExpr(Empty); |
| 1500 | break; |
| 1501 | |
| 1502 | case pch::EXPR_COMPOUND_LITERAL: |
| 1503 | S = new (Context) CompoundLiteralExpr(Empty); |
| 1504 | break; |
| 1505 | |
| 1506 | case pch::EXPR_EXT_VECTOR_ELEMENT: |
| 1507 | S = new (Context) ExtVectorElementExpr(Empty); |
| 1508 | break; |
| 1509 | |
| 1510 | case pch::EXPR_INIT_LIST: |
Ted Kremenek | 709210f | 2010-04-13 23:39:13 +0000 | [diff] [blame] | 1511 | S = new (Context) InitListExpr(*getContext(), Empty); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1512 | break; |
| 1513 | |
| 1514 | case pch::EXPR_DESIGNATED_INIT: |
Chris Lattner | d1d64a0 | 2009-04-27 21:45:14 +0000 | [diff] [blame] | 1515 | S = DesignatedInitExpr::CreateEmpty(*Context, |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1516 | Record[PCHStmtReader::NumExprFields] - 1); |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 1517 | |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1518 | break; |
| 1519 | |
| 1520 | case pch::EXPR_IMPLICIT_VALUE_INIT: |
| 1521 | S = new (Context) ImplicitValueInitExpr(Empty); |
| 1522 | break; |
| 1523 | |
| 1524 | case pch::EXPR_VA_ARG: |
| 1525 | S = new (Context) VAArgExpr(Empty); |
| 1526 | break; |
| 1527 | |
| 1528 | case pch::EXPR_ADDR_LABEL: |
| 1529 | S = new (Context) AddrLabelExpr(Empty); |
| 1530 | break; |
| 1531 | |
| 1532 | case pch::EXPR_STMT: |
| 1533 | S = new (Context) StmtExpr(Empty); |
| 1534 | break; |
| 1535 | |
| 1536 | case pch::EXPR_TYPES_COMPATIBLE: |
| 1537 | S = new (Context) TypesCompatibleExpr(Empty); |
| 1538 | break; |
| 1539 | |
| 1540 | case pch::EXPR_CHOOSE: |
| 1541 | S = new (Context) ChooseExpr(Empty); |
| 1542 | break; |
| 1543 | |
| 1544 | case pch::EXPR_GNU_NULL: |
| 1545 | S = new (Context) GNUNullExpr(Empty); |
| 1546 | break; |
| 1547 | |
| 1548 | case pch::EXPR_SHUFFLE_VECTOR: |
| 1549 | S = new (Context) ShuffleVectorExpr(Empty); |
| 1550 | break; |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 1551 | |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1552 | case pch::EXPR_BLOCK: |
| 1553 | S = new (Context) BlockExpr(Empty); |
| 1554 | break; |
| 1555 | |
| 1556 | case pch::EXPR_BLOCK_DECL_REF: |
| 1557 | S = new (Context) BlockDeclRefExpr(Empty); |
| 1558 | break; |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 1559 | |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1560 | case pch::EXPR_OBJC_STRING_LITERAL: |
| 1561 | S = new (Context) ObjCStringLiteral(Empty); |
| 1562 | break; |
| 1563 | case pch::EXPR_OBJC_ENCODE: |
| 1564 | S = new (Context) ObjCEncodeExpr(Empty); |
| 1565 | break; |
| 1566 | case pch::EXPR_OBJC_SELECTOR_EXPR: |
| 1567 | S = new (Context) ObjCSelectorExpr(Empty); |
| 1568 | break; |
| 1569 | case pch::EXPR_OBJC_PROTOCOL_EXPR: |
| 1570 | S = new (Context) ObjCProtocolExpr(Empty); |
| 1571 | break; |
| 1572 | case pch::EXPR_OBJC_IVAR_REF_EXPR: |
| 1573 | S = new (Context) ObjCIvarRefExpr(Empty); |
| 1574 | break; |
| 1575 | case pch::EXPR_OBJC_PROPERTY_REF_EXPR: |
| 1576 | S = new (Context) ObjCPropertyRefExpr(Empty); |
| 1577 | break; |
| 1578 | case pch::EXPR_OBJC_KVC_REF_EXPR: |
Fariborz Jahanian | 09105f5 | 2009-08-20 17:02:02 +0000 | [diff] [blame] | 1579 | S = new (Context) ObjCImplicitSetterGetterRefExpr(Empty); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1580 | break; |
| 1581 | case pch::EXPR_OBJC_MESSAGE_EXPR: |
Douglas Gregor | 04badcf | 2010-04-21 00:45:42 +0000 | [diff] [blame] | 1582 | S = ObjCMessageExpr::CreateEmpty(*Context, |
| 1583 | Record[PCHStmtReader::NumExprFields]); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1584 | break; |
| 1585 | case pch::EXPR_OBJC_SUPER_EXPR: |
| 1586 | S = new (Context) ObjCSuperExpr(Empty); |
| 1587 | break; |
Steve Naroff | f242b1b | 2009-07-24 17:54:45 +0000 | [diff] [blame] | 1588 | case pch::EXPR_OBJC_ISA: |
| 1589 | S = new (Context) ObjCIsaExpr(Empty); |
| 1590 | break; |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1591 | case pch::STMT_OBJC_FOR_COLLECTION: |
| 1592 | S = new (Context) ObjCForCollectionStmt(Empty); |
| 1593 | break; |
| 1594 | case pch::STMT_OBJC_CATCH: |
| 1595 | S = new (Context) ObjCAtCatchStmt(Empty); |
| 1596 | break; |
| 1597 | case pch::STMT_OBJC_FINALLY: |
| 1598 | S = new (Context) ObjCAtFinallyStmt(Empty); |
| 1599 | break; |
| 1600 | case pch::STMT_OBJC_AT_TRY: |
Douglas Gregor | 8f5e3dd | 2010-04-23 22:50:49 +0000 | [diff] [blame] | 1601 | S = ObjCAtTryStmt::CreateEmpty(*Context, |
| 1602 | Record[PCHStmtReader::NumStmtFields], |
| 1603 | Record[PCHStmtReader::NumStmtFields + 1]); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1604 | break; |
| 1605 | case pch::STMT_OBJC_AT_SYNCHRONIZED: |
| 1606 | S = new (Context) ObjCAtSynchronizedStmt(Empty); |
| 1607 | break; |
| 1608 | case pch::STMT_OBJC_AT_THROW: |
| 1609 | S = new (Context) ObjCAtThrowStmt(Empty); |
| 1610 | break; |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 1611 | |
Argyrios Kyrtzidis | 7cb45e3 | 2010-07-22 16:03:56 +0000 | [diff] [blame^] | 1612 | case pch::STMT_CXX_CATCH: |
| 1613 | S = new (Context) CXXCatchStmt(Empty); |
| 1614 | break; |
| 1615 | |
| 1616 | case pch::STMT_CXX_TRY: |
| 1617 | S = CXXTryStmt::Create(*Context, Empty, |
| 1618 | /*NumHandlers=*/Record[PCHStmtReader::NumStmtFields]); |
| 1619 | break; |
| 1620 | |
Argyrios Kyrtzidis | ba0a900 | 2009-07-14 03:19:21 +0000 | [diff] [blame] | 1621 | case pch::EXPR_CXX_OPERATOR_CALL: |
| 1622 | S = new (Context) CXXOperatorCallExpr(*Context, Empty); |
| 1623 | break; |
Chris Lattner | 1817bd4 | 2010-05-09 05:36:05 +0000 | [diff] [blame] | 1624 | |
| 1625 | case pch::EXPR_CXX_MEMBER_CALL: |
| 1626 | S = new (Context) CXXMemberCallExpr(*Context, Empty); |
| 1627 | break; |
Douglas Gregor | 39da0b8 | 2009-09-09 23:08:42 +0000 | [diff] [blame] | 1628 | |
| 1629 | case pch::EXPR_CXX_CONSTRUCT: |
Argyrios Kyrtzidis | 6d00c13 | 2010-07-10 11:46:15 +0000 | [diff] [blame] | 1630 | S = new (Context) CXXConstructExpr(Empty); |
| 1631 | break; |
| 1632 | |
| 1633 | case pch::EXPR_CXX_TEMPORARY_OBJECT: |
| 1634 | S = new (Context) CXXTemporaryObjectExpr(Empty); |
Douglas Gregor | 39da0b8 | 2009-09-09 23:08:42 +0000 | [diff] [blame] | 1635 | break; |
Sam Weinig | ce757a7 | 2010-01-16 21:21:01 +0000 | [diff] [blame] | 1636 | |
| 1637 | case pch::EXPR_CXX_STATIC_CAST: |
| 1638 | S = new (Context) CXXStaticCastExpr(Empty); |
| 1639 | break; |
| 1640 | |
| 1641 | case pch::EXPR_CXX_DYNAMIC_CAST: |
| 1642 | S = new (Context) CXXDynamicCastExpr(Empty); |
| 1643 | break; |
| 1644 | |
| 1645 | case pch::EXPR_CXX_REINTERPRET_CAST: |
| 1646 | S = new (Context) CXXReinterpretCastExpr(Empty); |
| 1647 | break; |
| 1648 | |
| 1649 | case pch::EXPR_CXX_CONST_CAST: |
| 1650 | S = new (Context) CXXConstCastExpr(Empty); |
| 1651 | break; |
| 1652 | |
| 1653 | case pch::EXPR_CXX_FUNCTIONAL_CAST: |
| 1654 | S = new (Context) CXXFunctionalCastExpr(Empty); |
| 1655 | break; |
| 1656 | |
Sam Weinig | eb7f961 | 2010-02-07 06:32:43 +0000 | [diff] [blame] | 1657 | case pch::EXPR_CXX_BOOL_LITERAL: |
| 1658 | S = new (Context) CXXBoolLiteralExpr(Empty); |
| 1659 | break; |
Sam Weinig | ce757a7 | 2010-01-16 21:21:01 +0000 | [diff] [blame] | 1660 | |
Sam Weinig | eb7f961 | 2010-02-07 06:32:43 +0000 | [diff] [blame] | 1661 | case pch::EXPR_CXX_NULL_PTR_LITERAL: |
| 1662 | S = new (Context) CXXNullPtrLiteralExpr(Empty); |
| 1663 | break; |
Chris Lattner | 14ab24f | 2010-05-09 06:03:39 +0000 | [diff] [blame] | 1664 | case pch::EXPR_CXX_TYPEID_EXPR: |
| 1665 | S = new (Context) CXXTypeidExpr(Empty, true); |
| 1666 | break; |
| 1667 | case pch::EXPR_CXX_TYPEID_TYPE: |
| 1668 | S = new (Context) CXXTypeidExpr(Empty, false); |
| 1669 | break; |
Chris Lattner | 2fbdfcd | 2010-05-09 06:15:05 +0000 | [diff] [blame] | 1670 | case pch::EXPR_CXX_THIS: |
| 1671 | S = new (Context) CXXThisExpr(Empty); |
| 1672 | break; |
| 1673 | case pch::EXPR_CXX_THROW: |
| 1674 | S = new (Context) CXXThrowExpr(Empty); |
| 1675 | break; |
Argyrios Kyrtzidis | 8a50733 | 2010-07-02 23:30:15 +0000 | [diff] [blame] | 1676 | case pch::EXPR_CXX_DEFAULT_ARG: { |
| 1677 | bool HasOtherExprStored = Record[PCHStmtReader::NumExprFields]; |
| 1678 | if (HasOtherExprStored) { |
| 1679 | Expr *SubExpr = ReadSubExpr(); |
| 1680 | S = CXXDefaultArgExpr::Create(*Context, SourceLocation(), 0, SubExpr); |
| 1681 | } else |
| 1682 | S = new (Context) CXXDefaultArgExpr(Empty); |
Chris Lattner | 030854b | 2010-05-09 06:40:08 +0000 | [diff] [blame] | 1683 | break; |
Argyrios Kyrtzidis | 8a50733 | 2010-07-02 23:30:15 +0000 | [diff] [blame] | 1684 | } |
Chris Lattner | d259836 | 2010-05-10 00:25:06 +0000 | [diff] [blame] | 1685 | case pch::EXPR_CXX_BIND_TEMPORARY: |
| 1686 | S = new (Context) CXXBindTemporaryExpr(Empty); |
| 1687 | break; |
Argyrios Kyrtzidis | 6d00c13 | 2010-07-10 11:46:15 +0000 | [diff] [blame] | 1688 | case pch::EXPR_CXX_BIND_REFERENCE: |
| 1689 | S = new (Context) CXXBindReferenceExpr(Empty); |
| 1690 | break; |
Chris Lattner | 5921863 | 2010-05-10 01:22:27 +0000 | [diff] [blame] | 1691 | |
Douglas Gregor | ed8abf1 | 2010-07-08 06:14:04 +0000 | [diff] [blame] | 1692 | case pch::EXPR_CXX_SCALAR_VALUE_INIT: |
| 1693 | S = new (Context) CXXScalarValueInitExpr(Empty); |
Chris Lattner | 5921863 | 2010-05-10 01:22:27 +0000 | [diff] [blame] | 1694 | break; |
| 1695 | case pch::EXPR_CXX_NEW: |
| 1696 | S = new (Context) CXXNewExpr(Empty); |
| 1697 | break; |
Argyrios Kyrtzidis | 95fc98c | 2010-06-22 17:07:59 +0000 | [diff] [blame] | 1698 | case pch::EXPR_CXX_DELETE: |
| 1699 | S = new (Context) CXXDeleteExpr(Empty); |
| 1700 | break; |
Argyrios Kyrtzidis | de4bd18 | 2010-06-28 09:32:03 +0000 | [diff] [blame] | 1701 | case pch::EXPR_CXX_PSEUDO_DESTRUCTOR: |
| 1702 | S = new (Context) CXXPseudoDestructorExpr(Empty); |
| 1703 | break; |
Chris Lattner | 5921863 | 2010-05-10 01:22:27 +0000 | [diff] [blame] | 1704 | |
Chris Lattner | d259836 | 2010-05-10 00:25:06 +0000 | [diff] [blame] | 1705 | case pch::EXPR_CXX_EXPR_WITH_TEMPORARIES: |
| 1706 | S = new (Context) CXXExprWithTemporaries(Empty); |
| 1707 | break; |
Argyrios Kyrtzidis | 8dfbd8b | 2010-06-24 08:57:31 +0000 | [diff] [blame] | 1708 | |
| 1709 | case pch::EXPR_CXX_DEPENDENT_SCOPE_MEMBER: |
| 1710 | S = CXXDependentScopeMemberExpr::CreateEmpty(*Context, |
Argyrios Kyrtzidis | a77eb08 | 2010-06-25 09:03:26 +0000 | [diff] [blame] | 1711 | /*NumTemplateArgs=*/Record[PCHStmtReader::NumExprFields]); |
Argyrios Kyrtzidis | 8dfbd8b | 2010-06-24 08:57:31 +0000 | [diff] [blame] | 1712 | break; |
| 1713 | |
Argyrios Kyrtzidis | 12dffcd | 2010-06-28 09:31:56 +0000 | [diff] [blame] | 1714 | case pch::EXPR_CXX_DEPENDENT_SCOPE_DECL_REF: |
| 1715 | S = DependentScopeDeclRefExpr::CreateEmpty(*Context, |
| 1716 | /*NumTemplateArgs=*/Record[PCHStmtReader::NumExprFields]); |
| 1717 | break; |
| 1718 | |
Argyrios Kyrtzidis | 8dfbd8b | 2010-06-24 08:57:31 +0000 | [diff] [blame] | 1719 | case pch::EXPR_CXX_UNRESOLVED_CONSTRUCT: |
| 1720 | S = CXXUnresolvedConstructExpr::CreateEmpty(*Context, |
Argyrios Kyrtzidis | a77eb08 | 2010-06-25 09:03:26 +0000 | [diff] [blame] | 1721 | /*NumArgs=*/Record[PCHStmtReader::NumExprFields]); |
| 1722 | break; |
| 1723 | |
| 1724 | case pch::EXPR_CXX_UNRESOLVED_MEMBER: |
| 1725 | S = UnresolvedMemberExpr::CreateEmpty(*Context, |
| 1726 | /*NumTemplateArgs=*/Record[PCHStmtReader::NumExprFields]); |
Argyrios Kyrtzidis | 8dfbd8b | 2010-06-24 08:57:31 +0000 | [diff] [blame] | 1727 | break; |
Argyrios Kyrtzidis | bd65bb5 | 2010-06-25 09:03:34 +0000 | [diff] [blame] | 1728 | |
| 1729 | case pch::EXPR_CXX_UNRESOLVED_LOOKUP: |
| 1730 | S = UnresolvedLookupExpr::CreateEmpty(*Context, |
| 1731 | /*NumTemplateArgs=*/Record[PCHStmtReader::NumExprFields]); |
| 1732 | break; |
Argyrios Kyrtzidis | 6d00c13 | 2010-07-10 11:46:15 +0000 | [diff] [blame] | 1733 | |
| 1734 | case pch::EXPR_CXX_UNARY_TYPE_TRAIT: |
| 1735 | S = new (Context) UnaryTypeTraitExpr(Empty); |
| 1736 | break; |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1737 | } |
Argyrios Kyrtzidis | 6d00c13 | 2010-07-10 11:46:15 +0000 | [diff] [blame] | 1738 | |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1739 | // We hit a STMT_STOP, so we're done with this expression. |
| 1740 | if (Finished) |
| 1741 | break; |
| 1742 | |
| 1743 | ++NumStatementsRead; |
| 1744 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1745 | if (S) |
| 1746 | Reader.Visit(S); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1747 | |
| 1748 | assert(Idx == Record.size() && "Invalid deserialization of statement"); |
| 1749 | StmtStack.push_back(S); |
| 1750 | } |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 1751 | |
| 1752 | #ifndef NDEBUG |
| 1753 | assert(StmtStack.size() > PrevNumStmts && "Read too many sub stmts!"); |
| 1754 | assert(StmtStack.size() == PrevNumStmts + 1 && "Extra expressions on stack!"); |
| 1755 | #endif |
| 1756 | |
| 1757 | return StmtStack.pop_back_val(); |
Chris Lattner | 4c6f952 | 2009-04-27 05:14:47 +0000 | [diff] [blame] | 1758 | } |