summaryrefslogtreecommitdiffstats
path: root/clang/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
commitc63de66c4f50973b54e3341194bf847e7bfefe1f (patch)
treedb578fef9737ff5f7d251069278373980f94fe22 /clang/lib/AST/Decl.cpp
parentfdfdbd091d663b1b3c12cf96064d755887b8aaa7 (diff)
downloadbcm5719-llvm-c63de66c4f50973b54e3341194bf847e7bfefe1f.tar.gz
bcm5719-llvm-c63de66c4f50973b54e3341194bf847e7bfefe1f.zip
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. llvm-svn: 124721
Diffstat (limited to 'clang/lib/AST/Decl.cpp')
-rw-r--r--clang/lib/AST/Decl.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index b1da849ae15..db69e0878af 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/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 {
OpenPOWER on IntegriCloud