[cfe-commits] r100432 - /cfe/trunk/lib/CodeGen/CGObjCMac.cpp

Daniel Dunbar daniel at zuster.org
Mon Apr 5 09:20:34 PDT 2010


Author: ddunbar
Date: Mon Apr  5 11:20:33 2010
New Revision: 100432

URL: http://llvm.org/viewvc/llvm-project?rev=100432&view=rev
Log:
Add a FIXME and reduce nesting.

Modified:
    cfe/trunk/lib/CodeGen/CGObjCMac.cpp

Modified: cfe/trunk/lib/CodeGen/CGObjCMac.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCMac.cpp?rev=100432&r1=100431&r2=100432&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCMac.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCMac.cpp Mon Apr  5 11:20:33 2010
@@ -107,24 +107,22 @@
   Qualifiers Quals = CGF.MakeQualifiers(IvarTy);
   Quals.addCVRQualifiers(CVRQualifiers);
 
-  if (Ivar->isBitField()) {
-    // We need to compute the bit offset for the bit-field, the offset
-    // is to the byte. Note, there is a subtle invariant here: we can
-    // only call this routine on non-sythesized ivars but we may be
-    // called for synthesized ivars. However, a synthesized ivar can
-    // never be a bit-field so this is safe.
-    uint64_t BitOffset = LookupFieldBitOffset(CGF.CGM, OID, 0, Ivar) % 8;
+  if (!Ivar->isBitField())
+    return LValue::MakeAddr(V, Quals);
 
-    uint64_t BitFieldSize =
-      Ivar->getBitWidth()->EvaluateAsInt(CGF.getContext()).getZExtValue();
-    return LValue::MakeBitfield(V, BitOffset, BitFieldSize,
-                                IvarTy->isSignedIntegerType(),
-                                Quals.getCVRQualifiers());
-  }
-
-  
-  LValue LV = LValue::MakeAddr(V, Quals);
-  return LV;
+  // We need to compute the bit offset for the bit-field, the offset is to the
+  // byte. Note, there is a subtle invariant here: we can only call this routine
+  // on non-synthesized ivars but we may be called for synthesized ivars.
+  // However, a synthesized ivar can never be a bit-field, so this is safe.
+  uint64_t BitOffset = LookupFieldBitOffset(CGF.CGM, OID, 0, Ivar) % 8;
+  uint64_t BitFieldSize =
+    Ivar->getBitWidth()->EvaluateAsInt(CGF.getContext()).getZExtValue();
+
+  // FIXME: We need to set a very conservative alignment on this, or make sure
+  // that the runtime is doing the right thing.
+  return LValue::MakeBitfield(V, BitOffset, BitFieldSize,
+                              IvarTy->isSignedIntegerType(),
+                              Quals.getCVRQualifiers());
 }
 
 ///





More information about the cfe-commits mailing list