[cfe-commits] r101257 - /cfe/trunk/lib/CodeGen/CGObjCMac.cpp
Daniel Dunbar
daniel at zuster.org
Wed Apr 14 10:02:21 PDT 2010
Author: ddunbar
Date: Wed Apr 14 12:02:21 2010
New Revision: 101257
URL: http://llvm.org/viewvc/llvm-project?rev=101257&view=rev
Log:
IRgen/NeXT: Simplify to use AST record layout for getting offsets instead of the
IRgen record layout, which this code doesn't need to depend on.
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=101257&r1=101256&r2=101257&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCMac.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCMac.cpp Wed Apr 14 12:02:21 2010
@@ -3171,19 +3171,10 @@
FieldDecl *Field = RecFields[i];
uint64_t FieldOffset;
if (RD) {
- const CGRecordLayout &RL =
- CGM.getTypes().getCGRecordLayout(Field->getParent());
- if (Field->isBitField()) {
- const CGBitFieldInfo &Info = RL.getBitFieldInfo(Field);
-
- const llvm::Type *Ty =
- CGM.getTypes().ConvertTypeForMemRecursive(Field->getType());
- uint64_t TypeSize =
- CGM.getTypes().getTargetData().getTypeAllocSize(Ty);
- FieldOffset = Info.FieldNo * TypeSize;
- } else
- FieldOffset =
- Layout->getElementOffset(RL.getLLVMFieldNo(Field));
+ // Note that 'i' here is actually the field index inside RD of Field,
+ // although this dependency is hidden.
+ const ASTRecordLayout &RL = CGM.getContext().getASTRecordLayout(RD);
+ FieldOffset = RL.getFieldOffset(i) / 8;
} else
FieldOffset = ComputeIvarBaseOffset(CGM, OI, cast<ObjCIvarDecl>(Field));
More information about the cfe-commits
mailing list