[cfe-commits] r72492 - in /cfe/trunk: lib/CodeGen/CGExprAgg.cpp test/CodeGenObjC/objc2-no-write-barrier.m
Fariborz Jahanian
fjahanian at apple.com
Wed May 27 12:54:12 PDT 2009
Author: fjahanian
Date: Wed May 27 14:54:11 2009
New Revision: 72492
URL: http://llvm.org/viewvc/llvm-project?rev=72492&view=rev
Log:
No write-barrier for initializations.
Added:
cfe/trunk/test/CodeGenObjC/objc2-no-write-barrier.m
Modified:
cfe/trunk/lib/CodeGen/CGExprAgg.cpp
Modified: cfe/trunk/lib/CodeGen/CGExprAgg.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprAgg.cpp?rev=72492&r1=72491&r2=72492&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprAgg.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprAgg.cpp Wed May 27 14:54:11 2009
@@ -459,6 +459,8 @@
// 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);
Added: cfe/trunk/test/CodeGenObjC/objc2-no-write-barrier.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/objc2-no-write-barrier.m?rev=72492&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenObjC/objc2-no-write-barrier.m (added)
+++ cfe/trunk/test/CodeGenObjC/objc2-no-write-barrier.m Wed May 27 14:54:11 2009
@@ -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}
+};
More information about the cfe-commits
mailing list