[cfe-commits] r49257 - in /cfe/trunk: include/clang/AST/DeclObjC.h include/clang/AST/Expr.h include/clang/AST/Stmt.h include/clang/Analysis/Support/ExprDeclBitVector.h lib/AST/DeclObjC.cpp

Chris Lattner sabre at nondot.org
Sat Apr 5 21:11:27 PDT 2008


Author: lattner
Date: Sat Apr  5 23:11:27 2008
New Revision: 49257

URL: http://llvm.org/viewvc/llvm-project?rev=49257&view=rev
Log:
fix a number of const qualification bugs.

Modified:
    cfe/trunk/include/clang/AST/DeclObjC.h
    cfe/trunk/include/clang/AST/Expr.h
    cfe/trunk/include/clang/AST/Stmt.h
    cfe/trunk/include/clang/Analysis/Support/ExprDeclBitVector.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=49257&r1=49256&r2=49257&view=diff

==============================================================================
--- cfe/trunk/include/clang/AST/DeclObjC.h (original)
+++ cfe/trunk/include/clang/AST/DeclObjC.h Sat Apr  5 23:11:27 2008
@@ -125,7 +125,10 @@
   
   NamedDecl *getMethodContext() const { return MethodContext; }
   
-  ObjCInterfaceDecl *const getClassInterface() const;
+  const ObjCInterfaceDecl *getClassInterface() const;
+  ObjCInterfaceDecl *getClassInterface() {
+    return (ObjCInterfaceDecl*)((ObjCMethodDecl*)this)->getClassInterface();
+  }
   
   Selector getSelector() const { return SelName; }
   unsigned getSynthesizedMethodSize() const;
@@ -161,10 +164,12 @@
   ImplementationControl getImplementationControl() const { 
     return ImplementationControl(DeclImplementation); 
   }
-  Stmt *const getBody() const { return Body; }
+  Stmt *getBody() { return Body; }
+  const Stmt *getBody() const { return Body; }
   void setBody(Stmt *B) { Body = B; }
 
-  ParmVarDecl *const getSelfDecl() const { return SelfDecl; }
+  const ParmVarDecl *getSelfDecl() const { return SelfDecl; }
+  ParmVarDecl *getSelfDecl() { return SelfDecl; }
   void setSelfDecl(ParmVarDecl *PVD) { SelfDecl = PVD; }
   
   // Implement isa/cast/dyncast/etc.
@@ -655,7 +660,8 @@
   static ObjCCategoryDecl *Create(ASTContext &C,
                                   SourceLocation L, IdentifierInfo *Id);
   
-  ObjCInterfaceDecl *getClassInterface() const { return ClassInterface; }
+  ObjCInterfaceDecl *getClassInterface() { return ClassInterface; }
+  const ObjCInterfaceDecl *getClassInterface() const { return ClassInterface; }
   void setClassInterface(ObjCInterfaceDecl *IDecl) { ClassInterface = IDecl; }
   
   void setReferencedProtocolList(ObjCProtocolDecl **List, unsigned NumRPs);
@@ -746,7 +752,8 @@
                                       SourceLocation L, IdentifierInfo *Id,
                                       ObjCInterfaceDecl *classInterface);
         
-  ObjCInterfaceDecl *getClassInterface() const { return ClassInterface; }
+  const ObjCInterfaceDecl *getClassInterface() const { return ClassInterface; }
+  ObjCInterfaceDecl *getClassInterface() { return ClassInterface; }
   
   unsigned getNumInstanceMethods() const { return InstanceMethods.size(); }
   unsigned getNumClassMethods() const { return ClassMethods.size(); }
@@ -844,8 +851,10 @@
   SourceLocation getLocEnd() const { return EndLoc; }
   void setLocEnd(SourceLocation LE) { EndLoc = LE; };
   
-  ObjCInterfaceDecl *getClassInterface() const { return ClassInterface; }
-  ObjCInterfaceDecl *getSuperClass() const { return SuperClass; }
+  const ObjCInterfaceDecl *getClassInterface() const { return ClassInterface; }
+  ObjCInterfaceDecl *getClassInterface() { return ClassInterface; }
+  const ObjCInterfaceDecl *getSuperClass() const { return SuperClass; }
+  ObjCInterfaceDecl *getSuperClass() { return SuperClass; }
   
   void setSuperClass(ObjCInterfaceDecl * superCls) { SuperClass = superCls; }
   

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

==============================================================================
--- cfe/trunk/include/clang/AST/Expr.h (original)
+++ cfe/trunk/include/clang/AST/Expr.h Sat Apr  5 23:11:27 2008
@@ -1458,10 +1458,11 @@
   ObjCIvarDecl *getDecl() { return D; }
   const ObjCIvarDecl *getDecl() const { return D; }
   virtual SourceRange getSourceRange() const { return SourceRange(Loc); }
-  Expr *const getBase() const { return Base; }
+  const Expr *getBase() const { return Base; }
+  Expr *getBase() { return Base; }
   void setBase(Expr * base) { Base = base; }
-  const bool isArrow() const { return IsArrow; }
-  const bool isFreeIvar() const { return IsFreeIvar; }
+  bool isArrow() const { return IsArrow; }
+  bool isFreeIvar() const { return IsFreeIvar; }
   
   SourceLocation getLocation() const { return Loc; }
   

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

==============================================================================
--- cfe/trunk/include/clang/AST/Stmt.h (original)
+++ cfe/trunk/include/clang/AST/Stmt.h Sat Apr  5 23:11:27 2008
@@ -1041,7 +1041,8 @@
     AtThrowLoc = atThrowLoc;
   }
   
-  Expr *const getThrowExpr() const { return reinterpret_cast<Expr*>(Throw); }
+  const Expr *getThrowExpr() const { return reinterpret_cast<Expr*>(Throw); }
+  Expr *getThrowExpr() { return reinterpret_cast<Expr*>(Throw); }
   
   virtual SourceRange getSourceRange() const {
     if (Throw)

Modified: cfe/trunk/include/clang/Analysis/Support/ExprDeclBitVector.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/Support/ExprDeclBitVector.h?rev=49257&r1=49256&r2=49257&view=diff

==============================================================================
--- cfe/trunk/include/clang/Analysis/Support/ExprDeclBitVector.h (original)
+++ cfe/trunk/include/clang/Analysis/Support/ExprDeclBitVector.h Sat Apr  5 23:11:27 2008
@@ -102,7 +102,7 @@
       return DeclBV[i];
     }
     
-    const bool getBit(unsigned i) const {
+    bool getBit(unsigned i) const {
       return DeclBV[i];
     }
     

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

==============================================================================
--- cfe/trunk/lib/AST/DeclObjC.cpp (original)
+++ cfe/trunk/lib/AST/DeclObjC.cpp Sat Apr  5 23:11:27 2008
@@ -418,7 +418,7 @@
   return length; 
 }
 
-ObjCInterfaceDecl *const ObjCMethodDecl::getClassInterface() const {
+const ObjCInterfaceDecl *ObjCMethodDecl::getClassInterface() const {
   if (ObjCInterfaceDecl *ID = dyn_cast<ObjCInterfaceDecl>(MethodContext))
     return ID;
   if (ObjCCategoryDecl *CD = dyn_cast<ObjCCategoryDecl>(MethodContext))





More information about the cfe-commits mailing list