aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/Decl.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/AST/Decl.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/AST/Decl.cpp')
-rw-r--r--lib/AST/Decl.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp
index b1da849ae1..db69e0878a 100644
--- a/lib/AST/Decl.cpp
+++ b/lib/AST/Decl.cpp
@@ -2104,8 +2104,21 @@ void BlockDecl::setParams(ParmVarDecl **NewParamInfo,
}
}
-unsigned BlockDecl::getNumParams() const {
- return NumParams;
+void BlockDecl::setCapturedDecls(ASTContext &Context,
+ VarDecl * const *begin,
+ VarDecl * const *end,
+ bool capturesCXXThis) {
+ CapturesCXXThis = capturesCXXThis;
+
+ if (begin == end) {
+ NumCapturedDecls = 0;
+ CapturedDecls = 0;
+ return;
+ }
+
+ NumCapturedDecls = end - begin;
+ CapturedDecls = new (Context) VarDecl*[NumCapturedDecls];
+ memcpy(CapturedDecls, begin, NumCapturedDecls * sizeof(VarDecl*));
}
SourceRange BlockDecl::getSourceRange() const {