summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/include/clang/AST/ASTContext.h2
-rw-r--r--clang/include/clang/AST/DeclObjC.h4
-rw-r--r--clang/include/clang/Analysis/PathSensitive/MemRegion.h3
-rw-r--r--clang/lib/AST/ASTContext.cpp5
-rw-r--r--clang/lib/AST/DeclObjC.cpp2
-rw-r--r--clang/lib/CodeGen/CodeGenTypes.cpp3
6 files changed, 9 insertions, 10 deletions
diff --git a/clang/include/clang/AST/ASTContext.h b/clang/include/clang/AST/ASTContext.h
index 11f629a6f95..2be3689bc01 100644
--- a/clang/include/clang/AST/ASTContext.h
+++ b/clang/include/clang/AST/ASTContext.h
@@ -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);
diff --git a/clang/include/clang/AST/DeclObjC.h b/clang/include/clang/AST/DeclObjC.h
index 60bbd6fe140..ddcbb0c2eae 100644
--- a/clang/include/clang/AST/DeclObjC.h
+++ b/clang/include/clang/AST/DeclObjC.h
@@ -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; }
diff --git a/clang/include/clang/Analysis/PathSensitive/MemRegion.h b/clang/include/clang/Analysis/PathSensitive/MemRegion.h
index 7397c921380..290599d1374 100644
--- a/clang/include/clang/Analysis/PathSensitive/MemRegion.h
+++ b/clang/include/clang/Analysis/PathSensitive/MemRegion.h
@@ -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) {
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index a3a2778860e..af7cf124ef2 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -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);
}
diff --git a/clang/lib/AST/DeclObjC.cpp b/clang/lib/AST/DeclObjC.cpp
index be23e3039d7..de10230991a 100644
--- a/clang/lib/AST/DeclObjC.cpp
+++ b/clang/lib/AST/DeclObjC.cpp
@@ -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();
diff --git a/clang/lib/CodeGen/CodeGenTypes.cpp b/clang/lib/CodeGen/CodeGenTypes.cpp
index 984e49e1209..5d98b453ac7 100644
--- a/clang/lib/CodeGen/CodeGenTypes.cpp
+++ b/clang/lib/CodeGen/CodeGenTypes.cpp
@@ -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;
OpenPOWER on IntegriCloud