forked from OSchip/llvm-project
modern objective-c translator. Fixes a mis-translation when
of a __block struct object. // rdar://11230308 llvm-svn: 154566
This commit is contained in:
parent
e9c64d104f
commit
5811fd6cc4
|
|
@ -4812,6 +4812,10 @@ void RewriteModernObjC::RewriteByRefVar(VarDecl *ND) {
|
|||
// {0, &ND, some_flag, __size=sizeof(struct __Block_byref_ND),
|
||||
// initializer-if-any};
|
||||
bool hasInit = (ND->getInit() != 0);
|
||||
// FIXME. rewriter does not support __block c++ objects which
|
||||
// require construction.
|
||||
if (hasInit && dyn_cast<CXXConstructExpr>(ND->getInit()))
|
||||
hasInit = false;
|
||||
unsigned flags = 0;
|
||||
if (HasCopyAndDispose)
|
||||
flags |= BLOCK_HAS_COPY_DISPOSE;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
// RUN: %clang_cc1 -x objective-c++ -fblocks -fms-extensions -rewrite-objc %s -o %t-rw.cpp
|
||||
// RUN: %clang_cc1 -fsyntax-only -fblocks -Wno-address-of-temporary -D"Class=void*" -D"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
|
||||
// rdar://11230308
|
||||
|
||||
typedef struct {
|
||||
char byte0;
|
||||
char byte1;
|
||||
} CFUUIDBytes;
|
||||
|
||||
void x(void *);
|
||||
|
||||
void y() {
|
||||
__block CFUUIDBytes bytes;
|
||||
|
||||
void (^bar)() = ^{
|
||||
x(&bytes);
|
||||
};
|
||||
}
|
||||
Loading…
Reference in New Issue