From a91768e56977920cbe9723c8f3f5371e3d37d379 Mon Sep 17 00:00:00 2001 From: Jordy Rose Date: Fri, 22 Jul 2011 02:08:32 +0000 Subject: Add a const overload for ObjCInterfaceDecl::all_declared_ivar_begin. This was previously not-const only because it has to lazily construct a chain of ivars the first time it is called (and after the chain is invalidated). In practice, all the clients were just const_casting their const Decls; all those now-unnecessary const_casts have been removed. llvm-svn: 135741 --- clang/lib/CodeGen/CGObjCRuntime.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'clang/lib/CodeGen/CGObjCRuntime.cpp') diff --git a/clang/lib/CodeGen/CGObjCRuntime.cpp b/clang/lib/CodeGen/CGObjCRuntime.cpp index 52338606b83..bc739c84110 100644 --- a/clang/lib/CodeGen/CGObjCRuntime.cpp +++ b/clang/lib/CodeGen/CGObjCRuntime.cpp @@ -52,9 +52,8 @@ static uint64_t LookupFieldBitOffset(CodeGen::CodeGenModule &CGM, // implemented. This should be fixed to get the information from the layout // directly. unsigned Index = 0; - ObjCInterfaceDecl *IDecl = const_cast(Container); - for (ObjCIvarDecl *IVD = IDecl->all_declared_ivar_begin(); + for (const ObjCIvarDecl *IVD = Container->all_declared_ivar_begin(); IVD; IVD = IVD->getNextIvar()) { if (Ivar == IVD) break; -- cgit v1.2.3