[cfe-commits] r68094 - in /cfe/trunk: include/clang/AST/DeclObjC.h lib/AST/ASTContext.cpp

Chris Lattner sabre at nondot.org
Tue Mar 31 01:31:14 PDT 2009


Author: lattner
Date: Tue Mar 31 03:31:13 2009
New Revision: 68094

URL: http://llvm.org/viewvc/llvm-project?rev=68094&view=rev
Log:
add a const version of the lookupFieldDeclForIvar method.

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

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

==============================================================================
--- cfe/trunk/include/clang/AST/DeclObjC.h (original)
+++ cfe/trunk/include/clang/AST/DeclObjC.h Tue Mar 31 03:31:13 2009
@@ -412,6 +412,11 @@
   FieldDecl *lookupFieldDeclForIvar(ASTContext &Context, 
                                     const ObjCIvarDecl *ivar);
 
+  const FieldDecl *lookupFieldDeclForIvar(ASTContext &Ctx, 
+                                          const ObjCIvarDecl *IV) const {
+    return const_cast<ObjCInterfaceDecl*>(this)->lookupFieldDeclForIvar(Ctx,IV);
+  }
+
   bool isForwardDecl() const { return ForwardDecl; }
   void setForwardDecl(bool val) { ForwardDecl = val; }
   

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

==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Tue Mar 31 03:31:13 2009
@@ -650,9 +650,7 @@
 void ASTContext::setFieldDecl(const ObjCInterfaceDecl *OI,
                               const ObjCIvarDecl *Ivar,
                               const ObjCIvarRefExpr *MRef) {
-  FieldDecl *FD = (const_cast<ObjCInterfaceDecl *>(OI))->
-                    lookupFieldDeclForIvar(*this, Ivar);
-  ASTFieldForIvarRef[MRef] = FD;
+  ASTFieldForIvarRef[MRef] = OI->lookupFieldDeclForIvar(*this, Ivar);
 }
 
 /// getASTObjcInterfaceLayout - Get or compute information about the layout of





More information about the cfe-commits mailing list