[cfe-commits] r69800 - in /cfe/trunk: include/clang/AST/DeclObjC.h lib/AST/DeclObjC.cpp lib/CodeGen/CGObjCMac.cpp

Daniel Dunbar daniel at zuster.org
Wed Apr 22 05:00:13 PDT 2009


Author: ddunbar
Date: Wed Apr 22 07:00:04 2009
New Revision: 69800

URL: http://llvm.org/viewvc/llvm-project?rev=69800&view=rev
Log:
Remove lookupFieldDeclFromIvar from ObjCIvarDecl interface.
 - This is only used by CGObjCRuntime now.


Modified:
    cfe/trunk/include/clang/AST/DeclObjC.h
    cfe/trunk/lib/AST/DeclObjC.cpp
    cfe/trunk/lib/CodeGen/CGObjCMac.cpp

Modified: cfe/trunk/include/clang/AST/DeclObjC.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclObjC.h?rev=69800&r1=69799&r2=69800&view=diff

==============================================================================
--- cfe/trunk/include/clang/AST/DeclObjC.h (original)
+++ cfe/trunk/include/clang/AST/DeclObjC.h Wed Apr 22 07:00:04 2009
@@ -434,9 +434,6 @@
     IVars.set(List, Num, C);
   }
 
-  const FieldDecl *lookupFieldDeclForIvar(ASTContext &Ctx, 
-                                          const ObjCIvarDecl *IV) const;
-
   bool isForwardDecl() const { return ForwardDecl; }
   void setForwardDecl(bool val) { ForwardDecl = val; }
   

Modified: cfe/trunk/lib/AST/DeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclObjC.cpp?rev=69800&r1=69799&r2=69800&view=diff

==============================================================================
--- cfe/trunk/lib/AST/DeclObjC.cpp (original)
+++ cfe/trunk/lib/AST/DeclObjC.cpp Wed Apr 22 07:00:04 2009
@@ -375,21 +375,6 @@
   return 0;
 }
 
-/// lookupFieldDeclForIvar - looks up a field decl in the laid out
-/// storage which matches this 'ivar'.
-///
-const FieldDecl *
-ObjCInterfaceDecl::lookupFieldDeclForIvar(ASTContext &Context, 
-                                          const ObjCIvarDecl *IVar) const {
-  assert(!isForwardDecl() && "Invalid interface decl!");
-  const RecordDecl *RecordForDecl = Context.addRecordToClass(this);
-  assert(RecordForDecl && "lookupFieldDeclForIvar no storage for class");
-  DeclContext::lookup_const_result Lookup =
-    RecordForDecl->lookup(Context, IVar->getDeclName());
-  assert((Lookup.first != Lookup.second) && "field decl not found");
-  return cast<FieldDecl>(*Lookup.first);
-}
-
 //===----------------------------------------------------------------------===//
 // ObjCIvarDecl
 //===----------------------------------------------------------------------===//

Modified: cfe/trunk/lib/CodeGen/CGObjCMac.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCMac.cpp?rev=69800&r1=69799&r2=69800&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCMac.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCMac.cpp Wed Apr 22 07:00:04 2009
@@ -41,6 +41,22 @@
   return cast<llvm::StructType>(CGM.getTypes().ConvertTagDeclType(RD));
 }
 
+
+/// LookupFieldDeclForIvar - looks up a field decl in the laid out
+/// storage which matches this 'ivar'.
+///
+static const FieldDecl *LookupFieldDeclForIvar(ASTContext &Context, 
+                                               const ObjCInterfaceDecl *OID,
+                                               const ObjCIvarDecl *OIVD) {
+  assert(!OID->isForwardDecl() && "Invalid interface decl!");
+  const RecordDecl *RecordForDecl = Context.addRecordToClass(OID);
+  assert(RecordForDecl && "lookupFieldDeclForIvar no storage for class");
+  DeclContext::lookup_const_result Lookup =
+    RecordForDecl->lookup(Context, OIVD->getDeclName());
+  assert((Lookup.first != Lookup.second) && "field decl not found");
+  return cast<FieldDecl>(*Lookup.first);
+}
+
 uint64_t CGObjCRuntime::ComputeIvarBaseOffset(CodeGen::CodeGenModule &CGM,
                                               const ObjCInterfaceDecl *OID,
                                               const ObjCIvarDecl *Ivar) {
@@ -50,7 +66,7 @@
   const llvm::StructLayout *Layout = 
     CGM.getTargetData().getStructLayout(STy);
   const FieldDecl *Field = 
-    OID->lookupFieldDeclForIvar(CGM.getContext(), Ivar);
+    LookupFieldDeclForIvar(CGM.getContext(), OID, Ivar);
   if (!Field->isBitField())
     return Layout->getElementOffset(CGM.getTypes().getLLVMFieldNo(Field));
   
@@ -82,7 +98,7 @@
   // since the structure layout is fixed; however for that we need to
   // be able to walk the class chain for an Ivar.
   const FieldDecl *Field = 
-    OID->lookupFieldDeclForIvar(CGF.CGM.getContext(), Ivar);
+    LookupFieldDeclForIvar(CGF.CGM.getContext(), OID, Ivar);
   
   // (char *) BaseValue
   llvm::Type *I8Ptr = llvm::PointerType::getUnqual(llvm::Type::Int8Ty);





More information about the cfe-commits mailing list