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

Chris Lattner sabre at nondot.org
Tue Mar 31 01:33:17 PDT 2009


Author: lattner
Date: Tue Mar 31 03:33:16 2009
New Revision: 68095

URL: http://llvm.org/viewvc/llvm-project?rev=68095&view=rev
Log:
small cleanups.

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=68095&r1=68094&r2=68095&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCMac.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCMac.cpp Tue Mar 31 03:33:16 2009
@@ -456,12 +456,12 @@
 
   /// GetIvarBaseOffset - returns ivars byte offset.
   uint64_t GetIvarBaseOffset(const llvm::StructLayout *Layout,
-                             FieldDecl *Field);
+                             const FieldDecl *Field);
   
-  /// GetFieldBaseOffset - return's field byt offset.
+  /// GetFieldBaseOffset - return's field byte offset.
   uint64_t GetFieldBaseOffset(const ObjCInterfaceDecl *OI,
                               const llvm::StructLayout *Layout,
-                              FieldDecl *Field);
+                              const FieldDecl *Field);
   
   /// CreateMetadataVar - Create a global variable with internal
   /// linkage for use by the Objective-C runtime.
@@ -1829,7 +1829,7 @@
 }
 
 uint64_t CGObjCCommonMac::GetIvarBaseOffset(const llvm::StructLayout *Layout,
-                                            FieldDecl *Field) {
+                                            const FieldDecl *Field) {
   if (!Field->isBitField())
     return Layout->getElementOffset(
             CGM.getTypes().getLLVMFieldNo(Field));
@@ -1844,12 +1844,10 @@
 /// GetFieldBaseOffset - return's field byt offset.
 uint64_t CGObjCCommonMac::GetFieldBaseOffset(const ObjCInterfaceDecl *OI,
                                              const llvm::StructLayout *Layout,
-                                             FieldDecl *Field) {
+                                             const FieldDecl *Field) {
   const ObjCIvarDecl *Ivar = cast<ObjCIvarDecl>(Field);
-  Field = const_cast<ObjCInterfaceDecl*>(OI)->lookupFieldDeclForIvar(
-                                                      CGM.getContext(), Ivar);
-  uint64_t Offset = GetIvarBaseOffset(Layout, Field);
-  return Offset;
+  const FieldDecl *FD = OI->lookupFieldDeclForIvar(CGM.getContext(), Ivar);
+  return GetIvarBaseOffset(Layout, FD);
 }
 
 llvm::GlobalVariable *





More information about the cfe-commits mailing list