diff options
author | John McCall <rjmccall@apple.com> | 2011-02-02 13:00:07 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2011-02-02 13:00:07 +0000 |
commit | 469a1eb996e1cb0be54f9b210f836afbddcbb2cc (patch) | |
tree | d80fe9f7fd892e6713f33d29ee26aa0270db925a /include/clang/Sema/ScopeInfo.h | |
parent | 5b5828b74c758d7babffb2407464507fa004b157 (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 'include/clang/Sema/ScopeInfo.h')
-rw-r--r-- | include/clang/Sema/ScopeInfo.h | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/include/clang/Sema/ScopeInfo.h b/include/clang/Sema/ScopeInfo.h index 15d17306c9..0ba61b34eb 100644 --- a/include/clang/Sema/ScopeInfo.h +++ b/include/clang/Sema/ScopeInfo.h @@ -17,6 +17,7 @@ #include "clang/AST/Type.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/SetVector.h" namespace clang { @@ -101,8 +102,6 @@ public: /// \brief Retains information about a block that is currently being parsed. class BlockScopeInfo : public FunctionScopeInfo { public: - bool hasBlockDeclRefExprs; - BlockDecl *TheDecl; /// TheScope - This is the scope for the block itself, which contains @@ -117,9 +116,15 @@ public: /// Its return type may be BuiltinType::Dependent. QualType FunctionType; + /// Captures - The set of variables captured by this block. + llvm::SmallSetVector<VarDecl*, 4> Captures; + + /// CapturesCXXThis - Whether this block captures 'this'. + bool CapturesCXXThis; + BlockScopeInfo(Diagnostic &Diag, Scope *BlockScope, BlockDecl *Block) - : FunctionScopeInfo(Diag), hasBlockDeclRefExprs(false), - TheDecl(Block), TheScope(BlockScope) + : FunctionScopeInfo(Diag), TheDecl(Block), TheScope(BlockScope), + CapturesCXXThis(false) { IsBlockInfo = true; } |