aboutsummaryrefslogtreecommitdiff
path: root/lib/Serialization/ASTReaderDecl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Serialization/ASTReaderDecl.cpp')
-rw-r--r--lib/Serialization/ASTReaderDecl.cpp21
1 files changed, 14 insertions, 7 deletions
diff --git a/lib/Serialization/ASTReaderDecl.cpp b/lib/Serialization/ASTReaderDecl.cpp
index 311ce7b5b1..2c304326bf 100644
--- a/lib/Serialization/ASTReaderDecl.cpp
+++ b/lib/Serialization/ASTReaderDecl.cpp
@@ -698,13 +698,20 @@ void ASTDeclReader::VisitBlockDecl(BlockDecl *BD) {
BD->setParams(Params.data(), NumParams);
bool capturesCXXThis = Record[Idx++];
- unsigned numCapturedDecls = Record[Idx++];
- llvm::SmallVector<VarDecl*, 16> capturedDecls;
- capturedDecls.reserve(numCapturedDecls);
- for (unsigned i = 0; i != numCapturedDecls; ++i)
- capturedDecls.push_back(cast<VarDecl>(Reader.GetDecl(Record[Idx++])));
- BD->setCapturedDecls(*Reader.getContext(), capturedDecls.begin(),
- capturedDecls.end(), capturesCXXThis);
+ unsigned numCaptures = Record[Idx++];
+ llvm::SmallVector<BlockDecl::Capture, 16> captures;
+ captures.reserve(numCaptures);
+ for (unsigned i = 0; i != numCaptures; ++i) {
+ VarDecl *decl = cast<VarDecl>(Reader.GetDecl(Record[Idx++]));
+ unsigned flags = Record[Idx++];
+ bool byRef = (flags & 1);
+ bool nested = (flags & 2);
+ Expr *copyExpr = ((flags & 4) ? Reader.ReadExpr(F) : 0);
+
+ captures.push_back(BlockDecl::Capture(decl, byRef, nested, copyExpr));
+ }
+ BD->setCaptures(*Reader.getContext(), captures.begin(),
+ captures.end(), capturesCXXThis);
}
void ASTDeclReader::VisitLinkageSpecDecl(LinkageSpecDecl *D) {