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

Chris Lattner sabre at nondot.org
Sat Apr 5 22:25:03 PDT 2008


Author: lattner
Date: Sun Apr  6 00:25:03 2008
New Revision: 49262

URL: http://llvm.org/viewvc/llvm-project?rev=49262&view=rev
Log:
Fix a bug I introduced in my const'ification patch.

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

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

==============================================================================
--- cfe/trunk/include/clang/AST/DeclObjC.h (original)
+++ cfe/trunk/include/clang/AST/DeclObjC.h Sun Apr  6 00:25:03 2008
@@ -125,9 +125,9 @@
   
   NamedDecl *getMethodContext() const { return MethodContext; }
   
-  const ObjCInterfaceDecl *getClassInterface() const;
-  ObjCInterfaceDecl *getClassInterface() {
-    return (ObjCInterfaceDecl*)((ObjCMethodDecl*)this)->getClassInterface();
+  ObjCInterfaceDecl *getClassInterface();
+  const ObjCInterfaceDecl *getClassInterface() const {
+    return const_cast<ObjCMethodDecl*>(this)->getClassInterface();
   }
   
   Selector getSelector() const { return SelName; }

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

==============================================================================
--- cfe/trunk/lib/AST/DeclObjC.cpp (original)
+++ cfe/trunk/lib/AST/DeclObjC.cpp Sun Apr  6 00:25:03 2008
@@ -417,16 +417,15 @@
   return length; 
 }
 
-const ObjCInterfaceDecl *ObjCMethodDecl::getClassInterface() const {
+ObjCInterfaceDecl *ObjCMethodDecl::getClassInterface() {
   if (ObjCInterfaceDecl *ID = dyn_cast<ObjCInterfaceDecl>(MethodContext))
     return ID;
   if (ObjCCategoryDecl *CD = dyn_cast<ObjCCategoryDecl>(MethodContext))
     return CD->getClassInterface();
   if (ObjCImplementationDecl *IMD = 
-      dyn_cast<ObjCImplementationDecl>(MethodContext))
+        dyn_cast<ObjCImplementationDecl>(MethodContext))
     return IMD->getClassInterface();
-  if (ObjCCategoryImplDecl *CID = 
-      dyn_cast<ObjCCategoryImplDecl>(MethodContext))
+  if (ObjCCategoryImplDecl *CID = dyn_cast<ObjCCategoryImplDecl>(MethodContext))
     return CID->getClassInterface();
   assert(false && "unknown method context");
   return 0;





More information about the cfe-commits mailing list