]> granicus.if.org Git - clang/commitdiff
Remove lookupFieldDeclFromIvar from ObjCIvarDecl interface.
authorDaniel Dunbar <daniel@zuster.org>
Wed, 22 Apr 2009 12:00:04 +0000 (12:00 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Wed, 22 Apr 2009 12:00:04 +0000 (12:00 +0000)
 - This is only used by CGObjCRuntime now.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69800 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/DeclObjC.h
lib/AST/DeclObjC.cpp
lib/CodeGen/CGObjCMac.cpp

index ddcbb0c2eae3df7e6ba060f2260393aebebfa9ed..0ffa5df64fe79552b7f8475ab5a8c93e2e8e5775 100644 (file)
@@ -434,9 +434,6 @@ public:
     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; }
   
index d9bec6d31a11c974dd127213c83e3ead25c963d8..1e05eb614148fe3fadb4c645d85523cb19fdd3fc 100644 (file)
@@ -375,21 +375,6 @@ ObjCInterfaceDecl::FindCategoryDeclaration(IdentifierInfo *CategoryId) const {
   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
 //===----------------------------------------------------------------------===//
index a80274a6909b607d5f478a7b86adf44480c3e0b7..a993963680aeab2e76e36b98a54623d0d1fa2799 100644 (file)
@@ -41,6 +41,22 @@ CGObjCRuntime::GetConcreteClassStruct(CodeGen::CodeGenModule &CGM,
   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 @@ uint64_t CGObjCRuntime::ComputeIvarBaseOffset(CodeGen::CodeGenModule &CGM,
   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 @@ LValue CGObjCRuntime::EmitValueForIvarAtOffset(CodeGen::CodeGenFunction &CGF,
   // 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);