[cfe-commits] r70813 - /cfe/trunk/lib/CodeGen/CGObjCMac.cpp
Daniel Dunbar
daniel at zuster.org
Sun May 3 16:35:23 PDT 2009
Author: ddunbar
Date: Sun May 3 18:35:23 2009
New Revision: 70813
URL: http://llvm.org/viewvc/llvm-project?rev=70813&view=rev
Log:
Inline GetFieldBaseOffset into sole callsite.
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=70813&r1=70812&r2=70813&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCMac.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCMac.cpp Sun May 3 18:35:23 2009
@@ -845,11 +845,6 @@
/// defined. The return value has type ProtocolPtrTy.
llvm::Constant *GetProtocolRef(const ObjCProtocolDecl *PD);
- /// GetFieldBaseOffset - return's field byte offset.
- uint64_t GetFieldBaseOffset(const ObjCImplementationDecl *OI,
- const llvm::StructLayout *Layout,
- const FieldDecl *Field);
-
/// CreateMetadataVar - Create a global variable with internal
/// linkage for use by the Objective-C runtime.
///
@@ -2228,16 +2223,6 @@
return Method;
}
-/// GetFieldBaseOffset - return the field's byte offset.
-uint64_t CGObjCCommonMac::GetFieldBaseOffset(const ObjCImplementationDecl *OI,
- const llvm::StructLayout *Layout,
- const FieldDecl *Field) {
- // Is this a C struct?
- if (!OI)
- return Layout->getElementOffset(CGM.getTypes().getLLVMFieldNo(Field));
- return ComputeIvarBaseOffset(CGM, OI, cast<ObjCIvarDecl>(Field));
-}
-
llvm::GlobalVariable *
CGObjCCommonMac::CreateMetadataVar(const std::string &Name,
llvm::Constant *Init,
@@ -2958,7 +2943,12 @@
for (unsigned i = 0, e = RecFields.size(); i != e; ++i) {
FieldDecl *Field = RecFields[i];
- unsigned FieldOffset = GetFieldBaseOffset(OI, Layout, Field);
+ uint64_t FieldOffset;
+ if (RD)
+ FieldOffset =
+ Layout->getElementOffset(CGM.getTypes().getLLVMFieldNo(Field));
+ else
+ FieldOffset = ComputeIvarBaseOffset(CGM, OI, cast<ObjCIvarDecl>(Field));
// Skip over unnamed or bitfields
if (!Field->getIdentifier() || Field->isBitField()) {
More information about the cfe-commits
mailing list