[PATCH] D25547: [CodeGen][ObjC] Do not emit objc_storeStrong to initialize a constexpr variable

John McCall via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 17 13:55:36 PDT 2016


rjmccall added a comment.

Thanks!  A couple minor tweaks, then LGTM.



================
Comment at: lib/CodeGen/CGExpr.cpp:1652
+        Src = RValue::get(EmitObjCExtendObjectLifetime(Dst.getType(),
+                                                       Src.getScalarVal()));
       // fall into the normal path
----------------
These two cases are actually identical in behavior (because __autoreleased variables don't actually own their current value).  I think I prefer the second way of writing it.


================
Comment at: lib/CodeGen/CGObjC.cpp:1665
   } else {
-    EmitScalarInit(CurrentItem, elementLValue);
+    EmitStoreThroughLValue(RValue::get(CurrentItem), elementLValue, true);
   }
----------------
Please add /*isInit*/ comments here and elsewhere.


https://reviews.llvm.org/D25547





More information about the cfe-commits mailing list