aboutsummaryrefslogtreecommitdiff
path: root/lib/Serialization/ASTReaderDecl.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2011-02-02 13:00:07 +0000
committerJohn McCall <rjmccall@apple.com>2011-02-02 13:00:07 +0000
commit469a1eb996e1cb0be54f9b210f836afbddcbb2cc (patch)
treed80fe9f7fd892e6713f33d29ee26aa0270db925a /lib/Serialization/ASTReaderDecl.cpp
parent5b5828b74c758d7babffb2407464507fa004b157 (diff)
An insomniac stab at making block declarations list the variables they close
on, as well as more reliably limiting invalid references to locals from nested scopes. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124721 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Serialization/ASTReaderDecl.cpp')
-rw-r--r--lib/Serialization/ASTReaderDecl.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/Serialization/ASTReaderDecl.cpp b/lib/Serialization/ASTReaderDecl.cpp
index 26baee47c2..311ce7b5b1 100644
--- a/lib/Serialization/ASTReaderDecl.cpp
+++ b/lib/Serialization/ASTReaderDecl.cpp
@@ -696,6 +696,15 @@ void ASTDeclReader::VisitBlockDecl(BlockDecl *BD) {
for (unsigned I = 0; I != NumParams; ++I)
Params.push_back(cast<ParmVarDecl>(Reader.GetDecl(Record[Idx++])));
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);
}
void ASTDeclReader::VisitLinkageSpecDecl(LinkageSpecDecl *D) {