diff options
author | Daniel Dunbar <daniel@zuster.org> | 2010-04-05 16:20:33 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2010-04-05 16:20:33 +0000 |
commit | 56229f5889ee35495de7138f29712674f8f81ec1 (patch) | |
tree | 1fd5490727aef741d7d168c3cbe308fc7514f324 /lib/CodeGen/CGObjCMac.cpp | |
parent | 09d9fa1933499cb2808cd97b2db16ee11a990ef9 (diff) |
Add a FIXME and reduce nesting.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100432 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGObjCMac.cpp')
-rw-r--r-- | lib/CodeGen/CGObjCMac.cpp | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/lib/CodeGen/CGObjCMac.cpp b/lib/CodeGen/CGObjCMac.cpp index 5373390ef7..9ca0bc0c29 100644 --- a/lib/CodeGen/CGObjCMac.cpp +++ b/lib/CodeGen/CGObjCMac.cpp @@ -107,24 +107,22 @@ LValue CGObjCRuntime::EmitValueForIvarAtOffset(CodeGen::CodeGenFunction &CGF, 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; - - 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; + if (!Ivar->isBitField()) + return LValue::MakeAddr(V, Quals); + + // 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()); } /// |