- Add BlockDecl AST node.
- Modify BlockExpr to reference the BlockDecl.
This is "cleanup" necessary to improve our lookup semantics for blocks (to fix <rdar://problem/6272905> clang block rewriter: parameter to function not imported into block?).
Still some follow-up work to finish this (forthcoming).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57298 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/StmtSerialization.cpp b/lib/AST/StmtSerialization.cpp
index f72800d..a4fd8c3 100644
--- a/lib/AST/StmtSerialization.cpp
+++ b/lib/AST/StmtSerialization.cpp
@@ -1114,18 +1114,12 @@
void BlockExpr::EmitImpl(Serializer& S) const {
S.Emit(getType());
- S.Emit(getCaretLocation());
- S.EmitOwnedPtr(Body);
+ S.EmitOwnedPtr(TheBlock);
}
BlockExpr* BlockExpr::CreateImpl(Deserializer& D, ASTContext& C) {
- QualType Q = QualType::ReadVal(D);
- SourceLocation L = SourceLocation::ReadVal(D);
- /*CompoundStmt* BodyStmt = cast<CompoundStmt>(*/D.ReadOwnedPtr<Stmt>(C)/*)*/;
- assert(0 && "Cannot deserialize BlockBlockExpr yet");
- // FIXME: need to handle parameters.
- //return new BlockBlockExpr(L, Q, BodyStmt);
- return 0;
+ QualType T = QualType::ReadVal(D);
+ return new BlockExpr(cast<BlockDecl>(D.ReadOwnedPtr<Decl>(C)),T);
}
void BlockDeclRefExpr::EmitImpl(Serializer& S) const {