diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2010-05-27 16:05:06 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2010-05-27 16:05:06 +0000 |
commit | 38c9ab880b843a128f8d895d3e2e24877e178788 (patch) | |
tree | cff69025e104a22faf84d4b4e64a48b7e83b4a99 | |
parent | 9f716e4140da8d18165a702f81d2286a12e83a8c (diff) |
Objective-c++ IR gen.
Flag synthesized struct decl. as non-empty so
CXX side of ir gen does not skip its Null initialization.
Fixes radar 8027844 for objc++'s collection statement.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104837 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/AST/ASTContext.cpp | 3 | ||||
-rw-r--r-- | test/CodeGenObjCXX/foreach-statement.mm | 10 |
2 files changed, 13 insertions, 0 deletions
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index 851f8d1c68..60d7117bbf 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -2856,6 +2856,9 @@ QualType ASTContext::getObjCFastEnumerationStateType() { Field->setAccess(AS_public); ObjCFastEnumerationStateTypeDecl->addDecl(Field); } + if (getLangOptions().CPlusPlus) + if (CXXRecordDecl *CXXRD = dyn_cast<CXXRecordDecl>(ObjCFastEnumerationStateTypeDecl)) + CXXRD->setEmpty(false); ObjCFastEnumerationStateTypeDecl->completeDefinition(); } diff --git a/test/CodeGenObjCXX/foreach-statement.mm b/test/CodeGenObjCXX/foreach-statement.mm new file mode 100644 index 0000000000..d0ad5b3a8f --- /dev/null +++ b/test/CodeGenObjCXX/foreach-statement.mm @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s +// rdar: // 8027844 + +// CHECK: call void @llvm.memset + +int main() { + id foo; + for (id a in foo) { + } +} |