diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2009-05-27 19:54:11 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2009-05-27 19:54:11 +0000 |
commit | 14674ffb81dccbc4e1bf78ab5b7987685819b445 (patch) | |
tree | d9ac181d69b0a078ee2db9101e0264e0b74d2892 | |
parent | 529677703214454e85c9089440c1c77200c53772 (diff) |
No write-barrier for initializations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72492 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/CGExprAgg.cpp | 2 | ||||
-rw-r--r-- | test/CodeGenObjC/objc2-no-write-barrier.m | 18 |
2 files changed, 20 insertions, 0 deletions
diff --git a/lib/CodeGen/CGExprAgg.cpp b/lib/CodeGen/CGExprAgg.cpp index 59c00528a8..af1bbfdd58 100644 --- a/lib/CodeGen/CGExprAgg.cpp +++ b/lib/CodeGen/CGExprAgg.cpp @@ -459,6 +459,8 @@ void AggExprEmitter::VisitInitListExpr(InitListExpr *E) { // FIXME: volatility LValue FieldLoc = CGF.EmitLValueForField(DestPtr, *Field, false, 0); + // We never generate write-barries for initialized fields. + LValue::SetObjCNonGC(FieldLoc, true); if (CurInitVal < NumInitElements) { // Store the initializer into the field EmitInitializationToLValue(E->getInit(CurInitVal++), FieldLoc); diff --git a/test/CodeGenObjC/objc2-no-write-barrier.m b/test/CodeGenObjC/objc2-no-write-barrier.m new file mode 100644 index 0000000000..2c53509694 --- /dev/null +++ b/test/CodeGenObjC/objc2-no-write-barrier.m @@ -0,0 +1,18 @@ +// RUN: clang-cc -triple x86_64-apple-darwin9 -fobjc-gc -emit-llvm -o %t %s && +// RUN: grep 'objc_assign' %t | count 0 + +typedef struct { + int ival; + id submenu; +} XCBinderContextMenuItem; + +id actionMenuForDataNode(void) { + XCBinderContextMenuItem menusToCreate[] = { + {1, 0} + }; + return 0; +} + +XCBinderContextMenuItem GmenusToCreate[] = { + {1, 0} +}; |