Mark another TypeForDecl const and make getObjCInterfaceType's argument const.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69772 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp
index a3a2778..af7cf12 100644
--- a/lib/AST/ASTContext.cpp
+++ b/lib/AST/ASTContext.cpp
@@ -1383,10 +1383,11 @@
 
 /// 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);
 }
diff --git a/lib/AST/DeclObjC.cpp b/lib/AST/DeclObjC.cpp
index be23e30..de10230 100644
--- a/lib/AST/DeclObjC.cpp
+++ b/lib/AST/DeclObjC.cpp
@@ -277,7 +277,7 @@
     // 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();