]> granicus.if.org Git - clang/commitdiff
Remove non-const form of lookupFieldDeclForIvar.
authorDaniel Dunbar <daniel@zuster.org>
Mon, 20 Apr 2009 00:37:55 +0000 (00:37 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Mon, 20 Apr 2009 00:37:55 +0000 (00:37 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69563 91177308-0d34-0410-b5e6-96231b3b80d8

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

index 2f360b6db5b1c025dd57744d2a538be4fed79407..119b3c890a3022b9e5f18e58f669f04eb00e94e2 100644 (file)
@@ -428,13 +428,9 @@ public:
   void setIVarList(ObjCIvarDecl * const *List, unsigned Num, ASTContext &C) {
     IVars.set(List, Num, C);
   }
-  FieldDecl *lookupFieldDeclForIvar(ASTContext &Context, 
-                                    const ObjCIvarDecl *ivar);
 
   const FieldDecl *lookupFieldDeclForIvar(ASTContext &Ctx, 
-                                          const ObjCIvarDecl *IV) const {
-    return const_cast<ObjCInterfaceDecl*>(this)->lookupFieldDeclForIvar(Ctx,IV);
-  }
+                                          const ObjCIvarDecl *IV) const;
 
   bool isForwardDecl() const { return ForwardDecl; }
   void setForwardDecl(bool val) { ForwardDecl = val; }
index 4bc7cd461cbce06ab79345b45f9491c69703a391..4a3c4d4f30e9d19c3fcd7be176a9efbb74fdd0e7 100644 (file)
@@ -375,11 +375,12 @@ ObjCInterfaceDecl::FindCategoryDeclaration(IdentifierInfo *CategoryId) const {
   return 0;
 }
 
-/// lookupFieldDeclForIvar - looks up a field decl' in the laid out
+/// lookupFieldDeclForIvar - looks up a field decl in the laid out
 /// storage which matches this 'ivar'.
 ///
-FieldDecl *ObjCInterfaceDecl::lookupFieldDeclForIvar(ASTContext &Context, 
-                                                     const ObjCIvarDecl *IVar) {
+const FieldDecl *
+ObjCInterfaceDecl::lookupFieldDeclForIvar(ASTContext &Context, 
+                                          const ObjCIvarDecl *IVar) const {
   const RecordDecl *RecordForDecl = Context.addRecordToClass(this);
   assert(RecordForDecl && "lookupFieldDeclForIvar no storage for class");
   DeclContext::lookup_const_result Lookup =
index 2ac4f9c7dfd3ed6419c9e7803c183f7f0e9523ae..e22efa162adf05394823937351341b5c312059dc 100644 (file)
@@ -195,7 +195,7 @@ void CodeGenFunction::GenerateObjCGetter(ObjCImplementationDecl *IMP,
                                            Types.ConvertType(PD->getType())));
     EmitReturnOfRValue(RV, PD->getType());
   } else {
-    FieldDecl *Field = 
+    const FieldDecl *Field = 
       IMP->getClassInterface()->lookupFieldDeclForIvar(getContext(), Ivar);
     LValue LV = EmitLValueForIvar(TypeOfSelfObject(),
                                   LoadObjCSelf(), Ivar, Field, 0);
index f7936fda55417603b5e930d7a16e662f80e9586e..2bbb15f01744fad10f7778d21961ff3a25434998 100644 (file)
@@ -764,7 +764,8 @@ void CGObjCGNU::GenerateClass(const ObjCImplementationDecl *OID) {
       Context.getObjCEncodingForType((*iter)->getType(), TypeStr);
       IvarTypes.push_back(CGM.GetAddrOfConstantCString(TypeStr));
       // Get the offset
-      FieldDecl *Field = ClassDecl->lookupFieldDeclForIvar(Context, (*iter));
+      const FieldDecl *Field = 
+        ClassDecl->lookupFieldDeclForIvar(Context, (*iter));
       int offset =
         (int)Layout->getElementOffset(CGM.getTypes().getLLVMFieldNo(Field));
       IvarOffsets.push_back(
@@ -1105,7 +1106,8 @@ llvm::Value *CGObjCGNU::EmitIvarOffset(CodeGen::CodeGenFunction &CGF,
                             CGM.getContext().getObjCInterfaceType(Interface));
   const llvm::StructLayout *Layout =
     CGM.getTargetData().getStructLayout(cast<llvm::StructType>(InterfaceLTy));
-  FieldDecl *Field = Interface->lookupFieldDeclForIvar(CGM.getContext(), Ivar);
+  const FieldDecl *Field = 
+    Interface->lookupFieldDeclForIvar(CGM.getContext(), Ivar);
   uint64_t Offset =
     Layout->getElementOffset(CGM.getTypes().getLLVMFieldNo(Field));
   
index e04f723b1d781b8c73429eab94e6983fbd6698e6..e92796b5ba8dc9c133da06320f97cf3fc292410f 100644 (file)
@@ -2400,7 +2400,8 @@ llvm::Value *CGObjCMac::EmitIvarOffset(CodeGen::CodeGenFunction &CGF,
                                        ObjCInterfaceDecl *Interface,
                                        const ObjCIvarDecl *Ivar) {
   const llvm::StructLayout *Layout = GetInterfaceDeclStructLayout(Interface);
-  FieldDecl *Field = Interface->lookupFieldDeclForIvar(CGM.getContext(), Ivar);
+  const FieldDecl *Field = 
+    Interface->lookupFieldDeclForIvar(CGM.getContext(), Ivar);
   uint64_t Offset = GetIvarBaseOffset(Layout, Field);
   return llvm::ConstantInt::get(
                             CGM.getTypes().ConvertType(CGM.getContext().LongTy),