From: Fariborz Jahanian Date: Wed, 27 May 2009 19:54:11 +0000 (+0000) Subject: No write-barrier for initializations. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=14674ffb81dccbc4e1bf78ab5b7987685819b445;p=clang No write-barrier for initializations. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72492 91177308-0d34-0410-b5e6-96231b3b80d8 --- 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} +};