/// 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);
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.
// 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; }
}
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) {
/// 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);
}
// 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();
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;