[PATCH] D20045: [ObjC][CodeGen] Remove an assert that is no longer correct.

John McCall via cfe-commits cfe-commits at lists.llvm.org
Thu May 12 15:32:27 PDT 2016


rjmccall added inline comments.

================
Comment at: lib/CodeGen/CGExpr.cpp:365
@@ +364,3 @@
+      // If the global variable already has an initializer, there is no need to
+      // emit code for initialization or push a cleanup.
+      if (Var->hasInitializer())
----------------
As we discussed in person, please make the comment address *why* this can ever have an initializer.  I think something like this would be ok:

  // createReferenceTemporary will promote the temporary to a global
  // with a constant initializer if it can.  It can only do this to a value of
  // ARC-manageable type if the value is global and therefore "immune"
  // to ref-counting operations.  Therefore we have no need to emit either
  // a dynamic initialization or a cleanup and we can just return the
  // address of the temporary.


http://reviews.llvm.org/D20045





More information about the cfe-commits mailing list