]> granicus.if.org Git - clang/commitdiff
Mark another TypeForDecl const and make getObjCInterfaceType's argument const.
authorDaniel Dunbar <daniel@zuster.org>
Wed, 22 Apr 2009 04:34:53 +0000 (04:34 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Wed, 22 Apr 2009 04:34:53 +0000 (04:34 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69772 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/ASTContext.h
include/clang/AST/DeclObjC.h
include/clang/Analysis/PathSensitive/MemRegion.h
lib/AST/ASTContext.cpp
lib/AST/DeclObjC.cpp
lib/CodeGen/CodeGenTypes.cpp

index 11f629a6f954e149c8956afe5fef22870a21c0db..2be3689bc0182f33e8a9f2179d280c69f8b07425 100644 (file)
@@ -299,7 +299,7 @@ public:
   /// getTypedefType - Return the unique reference to the type for the
   /// specified typename decl.
   QualType getTypedefType(TypedefDecl *Decl);
-  QualType getObjCInterfaceType(ObjCInterfaceDecl *Decl);
+  QualType getObjCInterfaceType(const ObjCInterfaceDecl *Decl);
 
   QualType getTemplateTypeParmType(unsigned Depth, unsigned Index, 
                                    IdentifierInfo *Name = 0);
index 60bbd6fe14032f7ab30f2a8dc14d320ef76c527e..ddcbb0c2eae3df7e6ba060f2260393aebebfa9ed 100644 (file)
@@ -368,7 +368,7 @@ public:
 class ObjCInterfaceDecl : public ObjCContainerDecl {
   /// TypeForDecl - This indicates the Type object that represents this
   /// TypeDecl.  It is a cache maintained by ASTContext::getObjCInterfaceType
-  Type *TypeForDecl;
+  mutable Type *TypeForDecl;
   friend class ASTContext;
   
   /// Class's super class.
@@ -492,7 +492,7 @@ public:
   
   // Low-level accessor
   Type *getTypeForDecl() const { return TypeForDecl; }
-  void setTypeForDecl(Type *TD) { TypeForDecl = TD; }
+  void setTypeForDecl(Type *TD) const { TypeForDecl = TD; }
 
   static bool classof(const Decl *D) { return D->getKind() == ObjCInterface; }
   static bool classof(const ObjCInterfaceDecl *D) { return true; }
index 7397c9213804db7b7c7dc7a388954b54d27ef884..290599d1374683e9b675f60ef82f8802c3c0b287 100644 (file)
@@ -463,8 +463,7 @@ public:
   }
   
   QualType getRValueType(ASTContext& C) const {
-    ObjCInterfaceDecl* ID = const_cast<ObjCInterfaceDecl*>(getInterface());
-    return C.getObjCInterfaceType(ID);
+    return C.getObjCInterfaceType(getInterface());
   }
   
   static bool classof(const MemRegion* R) {
index a3a2778860ed51b43d365006ca9cd7baf9ee99bd..af7cf124ef290e99abdfd24200b3a12e25dd99bf 100644 (file)
@@ -1383,10 +1383,11 @@ QualType ASTContext::getTypedefType(TypedefDecl *Decl) {
 
 /// getObjCInterfaceType - Return the unique reference to the type for the
 /// specified ObjC interface decl.
-QualType ASTContext::getObjCInterfaceType(ObjCInterfaceDecl *Decl) {
+QualType ASTContext::getObjCInterfaceType(const ObjCInterfaceDecl *Decl) {
   if (Decl->TypeForDecl) return QualType(Decl->TypeForDecl, 0);
   
-  Decl->TypeForDecl = new(*this,8) ObjCInterfaceType(Type::ObjCInterface, Decl);
+  ObjCInterfaceDecl *OID = const_cast<ObjCInterfaceDecl*>(Decl);
+  Decl->TypeForDecl = new(*this,8) ObjCInterfaceType(Type::ObjCInterface, OID);
   Types.push_back(Decl->TypeForDecl);
   return QualType(Decl->TypeForDecl, 0);
 }
index be23e3039d7308c902d108d8b412af062b9adfff..de10230991a5a52b2daf4fff80c719265da2cec6 100644 (file)
@@ -277,7 +277,7 @@ void ObjCMethodDecl::createImplicitParams(ASTContext &Context,
     // There may be no interface context due to error in declaration
     // of the interface (which has been reported). Recover gracefully.
     if (OID) {
-      selfTy =Context.getObjCInterfaceType(const_cast<ObjCInterfaceDecl*>(OID));
+      selfTy = Context.getObjCInterfaceType(OID);
       selfTy = Context.getPointerType(selfTy);
     } else {
       selfTy = Context.getObjCIdType();
index 984e49e12098afd3bb7ded23f590a42dcf1527b0..5d98b453ac7c51160c051f92a2ff3a34f1256252 100644 (file)
@@ -199,8 +199,7 @@ void CodeGenTypes::UpdateCompletedType(const TagDecl *TD) {
 
 void CodeGenTypes::UpdateCompletedType(const ObjCInterfaceDecl *OID) {
   // Check to see if we have already laid this type out, if not, just return.
-  QualType OIDTy = 
-    Context.getObjCInterfaceType(const_cast<ObjCInterfaceDecl*>(OID));
+  QualType OIDTy = Context.getObjCInterfaceType(OID);
   llvm::DenseMap<Type *, llvm::PATypeHolder>::iterator TCI =
     TypeCache.find(OIDTy.getTypePtr());
   if (TCI == TypeCache.end()) return;