From da04639a40e01d8d2ee891c075b271fd272d3d53 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 31 Mar 2009 08:31:13 +0000 Subject: [PATCH] add a const version of the lookupFieldDeclForIvar method. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68094 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/AST/DeclObjC.h | 5 +++++ lib/AST/ASTContext.cpp | 4 +--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/include/clang/AST/DeclObjC.h b/include/clang/AST/DeclObjC.h index 76e4c0211e..9acce0f541 100644 --- a/include/clang/AST/DeclObjC.h +++ b/include/clang/AST/DeclObjC.h @@ -412,6 +412,11 @@ public: FieldDecl *lookupFieldDeclForIvar(ASTContext &Context, const ObjCIvarDecl *ivar); + const FieldDecl *lookupFieldDeclForIvar(ASTContext &Ctx, + const ObjCIvarDecl *IV) const { + return const_cast(this)->lookupFieldDeclForIvar(Ctx,IV); + } + bool isForwardDecl() const { return ForwardDecl; } void setForwardDecl(bool val) { ForwardDecl = val; } diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index 18a3a4221a..2e350c8502 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -650,9 +650,7 @@ const RecordDecl *ASTContext::addRecordToClass(const ObjCInterfaceDecl *D) void ASTContext::setFieldDecl(const ObjCInterfaceDecl *OI, const ObjCIvarDecl *Ivar, const ObjCIvarRefExpr *MRef) { - FieldDecl *FD = (const_cast(OI))-> - lookupFieldDeclForIvar(*this, Ivar); - ASTFieldForIvarRef[MRef] = FD; + ASTFieldForIvarRef[MRef] = OI->lookupFieldDeclForIvar(*this, Ivar); } /// getASTObjcInterfaceLayout - Get or compute information about the layout of -- 2.40.0