diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2012-12-11 19:58:01 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2012-12-11 19:58:01 +0000 |
commit | f762b72f355c4f64846afe4ffdaafbef66c85981 (patch) | |
tree | c290e5f60731eb2bafce132dfa5af6f6e9f328ec | |
parent | d692c1dbb7d1d2faf24fd8a019ea2af09d2fbb89 (diff) | |
download | bcm5719-llvm-f762b72f355c4f64846afe4ffdaafbef66c85981.tar.gz bcm5719-llvm-f762b72f355c4f64846afe4ffdaafbef66c85981.zip |
objective-C blocks: Check for record type when deciding if
byref variable requires extended layout info. to prevent
a crash involving arrays declared __block. // rdar://12787751
llvm-svn: 169908
-rw-r--r-- | clang/lib/AST/ASTContext.cpp | 2 | ||||
-rw-r--r-- | clang/test/CodeGenObjC/block-byref-variable-layout.m | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index 44f13b6906f..f3fa13584de 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -4413,7 +4413,7 @@ bool ASTContext::getByrefLifetime(QualType Ty, return false; HasByrefExtendedLayout = false; - if (Ty->isAggregateType()) { + if (Ty->isRecordType()) { HasByrefExtendedLayout = true; LifeTime = Qualifiers::OCL_None; } diff --git a/clang/test/CodeGenObjC/block-byref-variable-layout.m b/clang/test/CodeGenObjC/block-byref-variable-layout.m index 6030661af4d..9c8f6743be3 100644 --- a/clang/test/CodeGenObjC/block-byref-variable-layout.m +++ b/clang/test/CodeGenObjC/block-byref-variable-layout.m @@ -40,3 +40,10 @@ int main() { }; c(); } + +// rdar://12787751 +typedef char mds_path_t[1024]; +void directVolumePerfWaitForStoreState() +{ + __block mds_path_t path; +} |