[cfe-commits] r69772 - in /cfe/trunk: 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
Daniel Dunbar
daniel at zuster.org
Tue Apr 21 21:35:01 PDT 2009
Author: ddunbar
Date: Tue Apr 21 23:34:53 2009
New Revision: 69772
URL: http://llvm.org/viewvc/llvm-project?rev=69772&view=rev
Log:
Mark another TypeForDecl const and make getObjCInterfaceType's argument const.
Modified:
cfe/trunk/include/clang/AST/ASTContext.h
cfe/trunk/include/clang/AST/DeclObjC.h
cfe/trunk/include/clang/Analysis/PathSensitive/MemRegion.h
cfe/trunk/lib/AST/ASTContext.cpp
cfe/trunk/lib/AST/DeclObjC.cpp
cfe/trunk/lib/CodeGen/CodeGenTypes.cpp
Modified: cfe/trunk/include/clang/AST/ASTContext.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTContext.h?rev=69772&r1=69771&r2=69772&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/ASTContext.h (original)
+++ cfe/trunk/include/clang/AST/ASTContext.h Tue Apr 21 23:34:53 2009
@@ -299,7 +299,7 @@
/// 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);
Modified: cfe/trunk/include/clang/AST/DeclObjC.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclObjC.h?rev=69772&r1=69771&r2=69772&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclObjC.h (original)
+++ cfe/trunk/include/clang/AST/DeclObjC.h Tue Apr 21 23:34:53 2009
@@ -368,7 +368,7 @@
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 @@
// 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; }
Modified: cfe/trunk/include/clang/Analysis/PathSensitive/MemRegion.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/PathSensitive/MemRegion.h?rev=69772&r1=69771&r2=69772&view=diff
==============================================================================
--- cfe/trunk/include/clang/Analysis/PathSensitive/MemRegion.h (original)
+++ cfe/trunk/include/clang/Analysis/PathSensitive/MemRegion.h Tue Apr 21 23:34:53 2009
@@ -463,8 +463,7 @@
}
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) {
Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=69772&r1=69771&r2=69772&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Tue Apr 21 23:34:53 2009
@@ -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);
}
Modified: cfe/trunk/lib/AST/DeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclObjC.cpp?rev=69772&r1=69771&r2=69772&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclObjC.cpp (original)
+++ cfe/trunk/lib/AST/DeclObjC.cpp Tue Apr 21 23:34:53 2009
@@ -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();
Modified: cfe/trunk/lib/CodeGen/CodeGenTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenTypes.cpp?rev=69772&r1=69771&r2=69772&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenTypes.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenTypes.cpp Tue Apr 21 23:34:53 2009
@@ -199,8 +199,7 @@
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;
More information about the cfe-commits
mailing list