forked from OSchip/llvm-project
When instantiating a block expression, the instantiated
blockScopeInfo's CapturesCXXThis field need get set as well. // rdar://9362021. John M. please review. llvm-svn: 130930
This commit is contained in:
parent
979aba5d09
commit
4cc5df700e
|
@ -7700,6 +7700,11 @@ TreeTransform<Derived>::TransformBlockExpr(BlockExpr *E) {
|
||||||
BlockScopeInfo *blockScope = SemaRef.getCurBlock();
|
BlockScopeInfo *blockScope = SemaRef.getCurBlock();
|
||||||
|
|
||||||
blockScope->TheDecl->setIsVariadic(oldBlock->isVariadic());
|
blockScope->TheDecl->setIsVariadic(oldBlock->isVariadic());
|
||||||
|
// We built a new blockScopeInfo in call to ActOnBlockStart
|
||||||
|
// in above, CapturesCXXThis need be set here from the block
|
||||||
|
// expression.
|
||||||
|
blockScope->CapturesCXXThis = oldBlock->capturesCXXThis();
|
||||||
|
|
||||||
llvm::SmallVector<ParmVarDecl*, 4> params;
|
llvm::SmallVector<ParmVarDecl*, 4> params;
|
||||||
llvm::SmallVector<QualType, 4> paramTypes;
|
llvm::SmallVector<QualType, 4> paramTypes;
|
||||||
|
|
||||||
|
@ -7760,8 +7765,6 @@ TreeTransform<Derived>::TransformBlockExpr(BlockExpr *E) {
|
||||||
// In builds with assertions, make sure that we captured everything we
|
// In builds with assertions, make sure that we captured everything we
|
||||||
// captured before.
|
// captured before.
|
||||||
|
|
||||||
if (oldBlock->capturesCXXThis()) assert(blockScope->CapturesCXXThis);
|
|
||||||
|
|
||||||
for (BlockDecl::capture_iterator i = oldBlock->capture_begin(),
|
for (BlockDecl::capture_iterator i = oldBlock->capture_begin(),
|
||||||
e = oldBlock->capture_end(); i != e; ++i) {
|
e = oldBlock->capture_end(); i != e; ++i) {
|
||||||
VarDecl *oldCapture = i->getVariable();
|
VarDecl *oldCapture = i->getVariable();
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
// RUN: %clang_cc1 -emit-llvm-only -fblocks -o - -triple x86_64-apple-darwin10 %s
|
||||||
|
// rdar://9362021
|
||||||
|
|
||||||
|
@class DYFuture;
|
||||||
|
@interface NSCache
|
||||||
|
- (void)setObject:(id)obj forKey:(id)key;
|
||||||
|
@end
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
class ResourceManager
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
~ResourceManager();
|
||||||
|
DYFuture* XXX();
|
||||||
|
NSCache* _spDeviceCache;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
DYFuture* ResourceManager<T>::XXX()
|
||||||
|
{
|
||||||
|
^ {
|
||||||
|
[_spDeviceCache setObject:0 forKey:0];
|
||||||
|
}();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct AnalyzerBaseObjectTypes { };
|
||||||
|
|
||||||
|
void FUNC()
|
||||||
|
{
|
||||||
|
ResourceManager<AnalyzerBaseObjectTypes> *rm;
|
||||||
|
^(void) { rm->XXX(); }();
|
||||||
|
}
|
Loading…
Reference in New Issue