[cfe-commits] r123814 - in /cfe/trunk: include/clang/AST/ include/clang/Sema/ lib/AST/ lib/Analysis/ lib/CodeGen/ lib/Frontend/ lib/Rewrite/ lib/Sema/ lib/Serialization/ lib/StaticAnalyzer/ lib/StaticAnalyzer/Checkers/ tools/libclang/
John McCall
rjmccall at apple.com
Tue Jan 18 22:33:43 PST 2011
Author: rjmccall
Date: Wed Jan 19 00:33:43 2011
New Revision: 123814
URL: http://llvm.org/viewvc/llvm-project?rev=123814&view=rev
Log:
Change QualType::getTypePtr() to return a const pointer, then change a
thousand other things which were (generally inadvertantly) relying on that.
Modified:
cfe/trunk/include/clang/AST/ASTContext.h
cfe/trunk/include/clang/AST/ASTImporter.h
cfe/trunk/include/clang/AST/CanonicalType.h
cfe/trunk/include/clang/AST/Decl.h
cfe/trunk/include/clang/AST/DeclCXX.h
cfe/trunk/include/clang/AST/DeclObjC.h
cfe/trunk/include/clang/AST/ExprObjC.h
cfe/trunk/include/clang/AST/NestedNameSpecifier.h
cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
cfe/trunk/include/clang/AST/StmtIterator.h
cfe/trunk/include/clang/AST/Type.h
cfe/trunk/include/clang/AST/TypeLoc.h
cfe/trunk/include/clang/AST/TypeVisitor.h
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/AST/ASTContext.cpp
cfe/trunk/lib/AST/ASTImporter.cpp
cfe/trunk/lib/AST/Decl.cpp
cfe/trunk/lib/AST/DeclCXX.cpp
cfe/trunk/lib/AST/DeclPrinter.cpp
cfe/trunk/lib/AST/DumpXML.cpp
cfe/trunk/lib/AST/Expr.cpp
cfe/trunk/lib/AST/ExprCXX.cpp
cfe/trunk/lib/AST/ItaniumMangle.cpp
cfe/trunk/lib/AST/MicrosoftMangle.cpp
cfe/trunk/lib/AST/NestedNameSpecifier.cpp
cfe/trunk/lib/AST/StmtIterator.cpp
cfe/trunk/lib/Analysis/CFG.cpp
cfe/trunk/lib/Analysis/CocoaConventions.cpp
cfe/trunk/lib/CodeGen/CGBlocks.cpp
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
cfe/trunk/lib/CodeGen/CGExprScalar.cpp
cfe/trunk/lib/CodeGen/CodeGenTBAA.cpp
cfe/trunk/lib/CodeGen/CodeGenTypes.cpp
cfe/trunk/lib/CodeGen/CodeGenTypes.h
cfe/trunk/lib/Frontend/TypeXML.cpp
cfe/trunk/lib/Rewrite/RewriteObjC.cpp
cfe/trunk/lib/Sema/SemaCXXScopeSpec.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/lib/Sema/SemaExprCXX.cpp
cfe/trunk/lib/Sema/SemaOverload.cpp
cfe/trunk/lib/Sema/SemaTemplate.cpp
cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
cfe/trunk/lib/Sema/SemaType.cpp
cfe/trunk/lib/Sema/TreeTransform.h
cfe/trunk/lib/Serialization/ASTReader.cpp
cfe/trunk/lib/StaticAnalyzer/CXXExprEngine.cpp
cfe/trunk/lib/StaticAnalyzer/Checkers/CastSizeChecker.cpp
cfe/trunk/lib/StaticAnalyzer/Checkers/CastToStructChecker.cpp
cfe/trunk/lib/StaticAnalyzer/RegionStore.cpp
cfe/trunk/tools/libclang/CIndex.cpp
cfe/trunk/tools/libclang/CXType.cpp
Modified: cfe/trunk/include/clang/AST/ASTContext.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTContext.h?rev=123814&r1=123813&r2=123814&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/ASTContext.h (original)
+++ cfe/trunk/include/clang/AST/ASTContext.h Wed Jan 19 00:33:43 2011
@@ -1092,6 +1092,7 @@
/// to be free of any of these, allowing two canonical types to be compared
/// for exact equality with a simple pointer comparison.
CanQualType getCanonicalType(QualType T) const;
+
const Type *getCanonicalType(const Type *T) const {
return T->getCanonicalTypeInternal().getTypePtr();
}
@@ -1281,7 +1282,7 @@
private:
// Helper for integer ordering
- unsigned getIntegerRank(Type* T) const;
+ unsigned getIntegerRank(const Type *T) const;
public:
Modified: cfe/trunk/include/clang/AST/ASTImporter.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTImporter.h?rev=123814&r1=123813&r2=123814&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/ASTImporter.h (original)
+++ cfe/trunk/include/clang/AST/ASTImporter.h Wed Jan 19 00:33:43 2011
@@ -51,7 +51,7 @@
/// \brief Mapping from the already-imported types in the "from" context
/// to the corresponding types in the "to" context.
- llvm::DenseMap<Type *, Type *> ImportedTypes;
+ llvm::DenseMap<const Type *, const Type *> ImportedTypes;
/// \brief Mapping from the already-imported declarations in the "from"
/// context to the corresponding declarations in the "to" context.
Modified: cfe/trunk/include/clang/AST/CanonicalType.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/CanonicalType.h?rev=123814&r1=123813&r2=123814&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/CanonicalType.h (original)
+++ cfe/trunk/include/clang/AST/CanonicalType.h Wed Jan 19 00:33:43 2011
@@ -68,12 +68,12 @@
/// canonical type.
///
/// The underlying pointer must not be NULL.
- T *getTypePtr() const { return cast<T>(Stored.getTypePtr()); }
+ const T *getTypePtr() const { return cast<T>(Stored.getTypePtr()); }
/// \brief Retrieve the underlying type pointer, which refers to a
/// canonical type, or NULL.
///
- T *getTypePtrOrNull() const {
+ const T *getTypePtrOrNull() const {
return cast_or_null<T>(Stored.getTypePtrOrNull());
}
@@ -87,6 +87,8 @@
return Stored.isNull();
}
+ SplitQualType split() const { return Stored.split(); }
+
/// \brief Retrieve a canonical type pointer with a different static type,
/// upcasting or downcasting as needed.
///
@@ -225,7 +227,7 @@
public:
/// \brief Retrieve the pointer to the underlying Type
- T* getTypePtr() const { return Stored.getTypePtr(); }
+ const T *getTypePtr() const { return Stored.getTypePtr(); }
/// \brief Implicit conversion to the underlying pointer.
///
@@ -345,7 +347,7 @@
/// to return smart pointer (proxies?).
template<typename T>
struct simplify_type<const ::clang::CanQual<T> > {
- typedef T* SimpleType;
+ typedef const T *SimpleType;
static SimpleType getSimplifiedValue(const ::clang::CanQual<T> &Val) {
return Val.getTypePtr();
}
Modified: cfe/trunk/include/clang/AST/Decl.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Decl.h?rev=123814&r1=123813&r2=123814&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Decl.h (original)
+++ cfe/trunk/include/clang/AST/Decl.h Wed Jan 19 00:33:43 2011
@@ -1850,7 +1850,7 @@
/// this TypeDecl. It is a cache maintained by
/// ASTContext::getTypedefType, ASTContext::getTagDeclType, and
/// ASTContext::getTemplateTypeParmType, and TemplateTypeParmDecl.
- mutable Type *TypeForDecl;
+ mutable const Type *TypeForDecl;
friend class ASTContext;
friend class DeclContext;
friend class TagDecl;
@@ -1864,8 +1864,8 @@
public:
// Low-level accessor
- Type *getTypeForDecl() const { return TypeForDecl; }
- void setTypeForDecl(Type *TD) { TypeForDecl = TD; }
+ const Type *getTypeForDecl() const { return TypeForDecl; }
+ void setTypeForDecl(const Type *TD) { TypeForDecl = TD; }
// Implement isa/cast/dyncast/etc.
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
Modified: cfe/trunk/include/clang/AST/DeclCXX.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclCXX.h?rev=123814&r1=123813&r2=123814&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclCXX.h (original)
+++ cfe/trunk/include/clang/AST/DeclCXX.h Wed Jan 19 00:33:43 2011
@@ -1220,7 +1220,6 @@
/// If this is a base class initializer, returns the type of the base class.
/// Otherwise, returns NULL.
const Type *getBaseClass() const;
- Type *getBaseClass();
/// Returns whether the base is virtual or not.
bool isBaseVirtual() const {
Modified: cfe/trunk/include/clang/AST/DeclObjC.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclObjC.h?rev=123814&r1=123813&r2=123814&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclObjC.h (original)
+++ cfe/trunk/include/clang/AST/DeclObjC.h Wed Jan 19 00:33:43 2011
@@ -437,7 +437,7 @@
class ObjCInterfaceDecl : public ObjCContainerDecl {
/// TypeForDecl - This indicates the Type object that represents this
/// TypeDecl. It is a cache maintained by ASTContext::getObjCInterfaceType
- mutable Type *TypeForDecl;
+ mutable const Type *TypeForDecl;
friend class ASTContext;
/// Class's super class.
@@ -665,8 +665,8 @@
bool RHSIsQualifiedID = false);
// Low-level accessor
- Type *getTypeForDecl() const { return TypeForDecl; }
- void setTypeForDecl(Type *TD) const { TypeForDecl = TD; }
+ const Type *getTypeForDecl() const { return TypeForDecl; }
+ void setTypeForDecl(const Type *TD) const { TypeForDecl = TD; }
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
static bool classof(const ObjCInterfaceDecl *D) { return true; }
Modified: cfe/trunk/include/clang/AST/ExprObjC.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ExprObjC.h?rev=123814&r1=123813&r2=123814&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/ExprObjC.h (original)
+++ cfe/trunk/include/clang/AST/ExprObjC.h Wed Jan 19 00:33:43 2011
@@ -245,7 +245,7 @@
/// the location of the 'super' keyword. When it's an interface,
/// this is that interface.
SourceLocation ReceiverLoc;
- llvm::PointerUnion3<Stmt*, Type*, ObjCInterfaceDecl*> Receiver;
+ llvm::PointerUnion3<Stmt*, const Type*, ObjCInterfaceDecl*> Receiver;
public:
ObjCPropertyRefExpr(ObjCPropertyDecl *PD, QualType t,
@@ -340,13 +340,13 @@
SourceLocation getReceiverLocation() const { return ReceiverLoc; }
QualType getSuperReceiverType() const {
- return QualType(Receiver.get<Type*>(), 0);
+ return QualType(Receiver.get<const Type*>(), 0);
}
ObjCInterfaceDecl *getClassReceiver() const {
return Receiver.get<ObjCInterfaceDecl*>();
}
bool isObjectReceiver() const { return Receiver.is<Stmt*>(); }
- bool isSuperReceiver() const { return Receiver.is<Type*>(); }
+ bool isSuperReceiver() const { return Receiver.is<const Type*>(); }
bool isClassReceiver() const { return Receiver.is<ObjCInterfaceDecl*>(); }
virtual SourceRange getSourceRange() const {
Modified: cfe/trunk/include/clang/AST/NestedNameSpecifier.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/NestedNameSpecifier.h?rev=123814&r1=123813&r2=123814&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/NestedNameSpecifier.h (original)
+++ cfe/trunk/include/clang/AST/NestedNameSpecifier.h Wed Jan 19 00:33:43 2011
@@ -111,7 +111,7 @@
/// \brief Builds a nested name specifier that names a type.
static NestedNameSpecifier *Create(const ASTContext &Context,
NestedNameSpecifier *Prefix,
- bool Template, Type *T);
+ bool Template, const Type *T);
/// \brief Builds a specifier that consists of just an identifier.
///
@@ -161,10 +161,10 @@
}
/// \brief Retrieve the type stored in this nested name specifier.
- Type *getAsType() const {
+ const Type *getAsType() const {
if (Prefix.getInt() == TypeSpec ||
Prefix.getInt() == TypeSpecWithTemplate)
- return (Type *)Specifier;
+ return (const Type *)Specifier;
return 0;
}
Modified: cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/RecursiveASTVisitor.h?rev=123814&r1=123813&r2=123814&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/RecursiveASTVisitor.h (original)
+++ cfe/trunk/include/clang/AST/RecursiveASTVisitor.h Wed Jan 19 00:33:43 2011
@@ -442,7 +442,8 @@
switch (T->getTypeClass()) {
#define ABSTRACT_TYPE(CLASS, BASE)
#define TYPE(CLASS, BASE) \
- case Type::CLASS: DISPATCH(CLASS##Type, CLASS##Type, T.getTypePtr());
+ case Type::CLASS: DISPATCH(CLASS##Type, CLASS##Type, \
+ const_cast<Type*>(T.getTypePtr()));
#include "clang/AST/TypeNodes.def"
}
@@ -781,7 +782,7 @@
template<typename Derived> \
bool RecursiveASTVisitor<Derived>::Traverse##TYPE##Loc(TYPE##Loc TL) { \
if (getDerived().shouldWalkTypesOfTypeLocs()) \
- TRY_TO(WalkUpFrom##TYPE(TL.getTypePtr())); \
+ TRY_TO(WalkUpFrom##TYPE(const_cast<TYPE*>(TL.getTypePtr()))); \
TRY_TO(WalkUpFrom##TYPE##Loc(TL)); \
{ CODE; } \
return true; \
@@ -893,7 +894,7 @@
DEF_TRAVERSE_TYPELOC(FunctionProtoType, {
TRY_TO(TraverseTypeLoc(TL.getResultLoc()));
- FunctionProtoType *T = TL.getTypePtr();
+ const FunctionProtoType *T = TL.getTypePtr();
for (unsigned I = 0, E = TL.getNumArgs(); I != E; ++I) {
TRY_TO(TraverseDecl(TL.getArg(I)));
Modified: cfe/trunk/include/clang/AST/StmtIterator.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/StmtIterator.h?rev=123814&r1=123813&r2=123814&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/StmtIterator.h (original)
+++ cfe/trunk/include/clang/AST/StmtIterator.h Wed Jan 19 00:33:43 2011
@@ -51,11 +51,11 @@
return (RawVAPtr & Flags) == 0;
}
- VariableArrayType* getVAPtr() const {
- return reinterpret_cast<VariableArrayType*>(RawVAPtr & ~Flags);
+ const VariableArrayType *getVAPtr() const {
+ return reinterpret_cast<const VariableArrayType*>(RawVAPtr & ~Flags);
}
- void setVAPtr(VariableArrayType* P) {
+ void setVAPtr(const VariableArrayType *P) {
assert (inDecl() || inDeclGroup() || inSizeOfTypeVA());
RawVAPtr = reinterpret_cast<uintptr_t>(P) | (RawVAPtr & Flags);
}
@@ -68,7 +68,7 @@
StmtIteratorBase(Stmt **s) : stmt(s), decl(0), RawVAPtr(0) {}
StmtIteratorBase(Decl *d, Stmt **s);
- StmtIteratorBase(VariableArrayType *t);
+ StmtIteratorBase(const VariableArrayType *t);
StmtIteratorBase(Decl **dgi, Decl **dge);
StmtIteratorBase() : stmt(0), decl(0), RawVAPtr(0) {}
};
@@ -86,7 +86,7 @@
StmtIteratorImpl(Stmt **s) : StmtIteratorBase(s) {}
StmtIteratorImpl(Decl **dgi, Decl **dge) : StmtIteratorBase(dgi, dge) {}
StmtIteratorImpl(Decl *d, Stmt **s) : StmtIteratorBase(d, s) {}
- StmtIteratorImpl(VariableArrayType* t) : StmtIteratorBase(t) {}
+ StmtIteratorImpl(const VariableArrayType *t) : StmtIteratorBase(t) {}
DERIVED& operator++() {
if (inDecl() || inDeclGroup()) {
@@ -130,7 +130,7 @@
StmtIterator(Decl** dgi, Decl** dge)
: StmtIteratorImpl<StmtIterator,Stmt*&>(dgi, dge) {}
- StmtIterator(VariableArrayType* t)
+ StmtIterator(const VariableArrayType *t)
: StmtIteratorImpl<StmtIterator,Stmt*&>(t) {}
StmtIterator(Decl* D, Stmt **s = 0)
Modified: cfe/trunk/include/clang/AST/Type.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Type.h?rev=123814&r1=123813&r2=123814&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Type.h (original)
+++ cfe/trunk/include/clang/AST/Type.h Wed Jan 19 00:33:43 2011
@@ -479,7 +479,7 @@
///
/// This function requires that the type not be NULL. If the type might be
/// NULL, use the (slightly less efficient) \c getTypePtrOrNull().
- Type *getTypePtr() const {
+ const Type *getTypePtr() const {
assert(!isNull() && "Cannot retrieve a NULL type pointer");
uintptr_t CommonPtrVal
= reinterpret_cast<uintptr_t>(Value.getOpaqueValue());
@@ -489,12 +489,12 @@
return const_cast<Type *>(CommonPtr->BaseType);
}
- Type *getTypePtrOrNull() const {
+ const Type *getTypePtrOrNull() const {
uintptr_t TypePtrPtrVal
= reinterpret_cast<uintptr_t>(Value.getOpaqueValue());
TypePtrPtrVal &= ~(uintptr_t)((1 << TypeAlignmentInBits) - 1);
Type **TypePtrPtr = reinterpret_cast<Type**>(TypePtrPtrVal);
- return TypePtrPtr? *TypePtrPtr : 0;
+ return TypePtrPtr ? *TypePtrPtr : 0;
}
/// Divides a QualType into its unqualified type and a set of local
@@ -511,17 +511,17 @@
}
void *getAsOpaquePtr() const { return Value.getOpaqueValue(); }
- static QualType getFromOpaquePtr(void *Ptr) {
+ static QualType getFromOpaquePtr(const void *Ptr) {
QualType T;
- T.Value.setFromOpaqueValue(Ptr);
+ T.Value.setFromOpaqueValue(const_cast<void*>(Ptr));
return T;
}
- Type &operator*() const {
+ const Type &operator*() const {
return *getTypePtr();
}
- Type *operator->() const {
+ const Type *operator->() const {
return getTypePtr();
}
@@ -805,7 +805,7 @@
/// Implement simplify_type for QualType, so that we can dyn_cast from QualType
/// to a specific Type class.
template<> struct simplify_type<const ::clang::QualType> {
- typedef ::clang::Type* SimpleType;
+ typedef const ::clang::Type *SimpleType;
static SimpleType getSimplifiedValue(const ::clang::QualType &Val) {
return Val.getTypePtr();
}
@@ -3830,8 +3830,8 @@
if ((*this)->isPointerType()) {
QualType BaseType = (*this)->getAs<PointerType>()->getPointeeType();
if (isa<VariableArrayType>(BaseType)) {
- ArrayType *AT = dyn_cast<ArrayType>(BaseType);
- VariableArrayType *VAT = cast<VariableArrayType>(AT);
+ const ArrayType *AT = dyn_cast<ArrayType>(BaseType);
+ const VariableArrayType *VAT = cast<VariableArrayType>(AT);
if (VAT->getSizeExpr())
T = BaseType.getTypePtr();
}
Modified: cfe/trunk/include/clang/AST/TypeLoc.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/TypeLoc.h?rev=123814&r1=123813&r2=123814&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/TypeLoc.h (original)
+++ cfe/trunk/include/clang/AST/TypeLoc.h Wed Jan 19 00:33:43 2011
@@ -38,7 +38,7 @@
protected:
// The correctness of this relies on the property that, for Type *Ty,
// QualType(Ty, 0).getAsOpaquePtr() == (void*) Ty
- void *Ty;
+ const void *Ty;
void *Data;
public:
@@ -56,7 +56,7 @@
TypeLoc() : Ty(0), Data(0) { }
TypeLoc(QualType ty, void *opaqueData)
: Ty(ty.getAsOpaquePtr()), Data(opaqueData) { }
- TypeLoc(Type *ty, void *opaqueData)
+ TypeLoc(const Type *ty, void *opaqueData)
: Ty(ty), Data(opaqueData) { }
TypeLocClass getTypeLocClass() const {
@@ -76,7 +76,7 @@
return QualType::getFromOpaquePtr(Ty);
}
- Type *getTypePtr() const {
+ const Type *getTypePtr() const {
return QualType::getFromOpaquePtr(Ty).getTypePtr();
}
@@ -174,10 +174,10 @@
class UnqualTypeLoc : public TypeLoc {
public:
UnqualTypeLoc() {}
- UnqualTypeLoc(Type *Ty, void *Data) : TypeLoc(Ty, Data) {}
+ UnqualTypeLoc(const Type *Ty, void *Data) : TypeLoc(Ty, Data) {}
- Type *getTypePtr() const {
- return reinterpret_cast<Type*>(Ty);
+ const Type *getTypePtr() const {
+ return reinterpret_cast<const Type*>(Ty);
}
TypeLocClass getTypeLocClass() const {
@@ -306,7 +306,7 @@
return getNextTypeLoc(asDerived()->getInnerType());
}
- TypeClass *getTypePtr() const {
+ const TypeClass *getTypePtr() const {
return cast<TypeClass>(Base::getTypePtr());
}
@@ -379,7 +379,7 @@
return true;
}
- TypeClass *getTypePtr() const {
+ const TypeClass *getTypePtr() const {
return cast<TypeClass>(Base::getTypePtr());
}
};
Modified: cfe/trunk/include/clang/AST/TypeVisitor.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/TypeVisitor.h?rev=123814&r1=123813&r2=123814&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/TypeVisitor.h (original)
+++ cfe/trunk/include/clang/AST/TypeVisitor.h Wed Jan 19 00:33:43 2011
@@ -19,12 +19,13 @@
namespace clang {
#define DISPATCH(CLASS) \
- return static_cast<ImplClass*>(this)->Visit ## CLASS(static_cast<CLASS*>(T))
+ return static_cast<ImplClass*>(this)-> \
+ Visit##CLASS(static_cast<const CLASS*>(T))
template<typename ImplClass, typename RetTy=void>
class TypeVisitor {
public:
- RetTy Visit(Type *T) {
+ RetTy Visit(const Type *T) {
// Top switch stmt: dispatch to VisitFooType for each FooType.
switch (T->getTypeClass()) {
default: assert(0 && "Unknown type class!");
@@ -36,13 +37,13 @@
// If the implementation chooses not to implement a certain visit method, fall
// back on superclass.
-#define TYPE(CLASS, PARENT) RetTy Visit##CLASS##Type(CLASS##Type *T) { \
+#define TYPE(CLASS, PARENT) RetTy Visit##CLASS##Type(const CLASS##Type *T) { \
DISPATCH(PARENT); \
}
#include "clang/AST/TypeNodes.def"
// Base case, ignore it. :)
- RetTy VisitType(Type*) { return RetTy(); }
+ RetTy VisitType(const Type*) { return RetTy(); }
};
#undef DISPATCH
Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=123814&r1=123813&r2=123814&view=diff
==============================================================================
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Wed Jan 19 00:33:43 2011
@@ -1007,8 +1007,8 @@
QualType& ConvertedType, bool &IncompatibleObjC);
bool isObjCPointerConversion(QualType FromType, QualType ToType,
QualType& ConvertedType, bool &IncompatibleObjC);
- bool FunctionArgTypesAreEqual (FunctionProtoType* OldType,
- FunctionProtoType* NewType);
+ bool FunctionArgTypesAreEqual(const FunctionProtoType *OldType,
+ const FunctionProtoType *NewType);
bool CheckPointerConversion(Expr *From, QualType ToType,
CastKind &Kind,
Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=123814&r1=123813&r2=123814&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Wed Jan 19 00:33:43 2011
@@ -573,7 +573,7 @@
unsigned ArrayAlign = Target.getLargeArrayAlign();
if (isa<VariableArrayType>(T) && MinWidth != 0)
Align = std::max(Align, ArrayAlign);
- if (ConstantArrayType *CT = dyn_cast<ConstantArrayType>(T)) {
+ if (const ConstantArrayType *CT = dyn_cast<ConstantArrayType>(T)) {
unsigned Size = getTypeSize(CT);
if (MinWidth != 0 && MinWidth <= Size)
Align = std::max(Align, ArrayAlign);
@@ -1661,7 +1661,7 @@
/// the specified element type and size. VectorType must be a built-in type.
QualType ASTContext::getVectorType(QualType vecType, unsigned NumElts,
VectorType::VectorKind VecKind) const {
- BuiltinType *BaseType;
+ const BuiltinType *BaseType;
BaseType = dyn_cast<BuiltinType>(getCanonicalType(vecType).getTypePtr());
assert(BaseType != 0 && "getVectorType(): Expecting a built-in type");
@@ -1695,7 +1695,7 @@
/// the specified element type and size. VectorType must be a built-in type.
QualType
ASTContext::getExtVectorType(QualType vecType, unsigned NumElts) const {
- BuiltinType *baseType;
+ const BuiltinType *baseType;
baseType = dyn_cast<BuiltinType>(getCanonicalType(vecType).getTypePtr());
assert(baseType != 0 && "getExtVectorType(): Expecting a built-in type");
@@ -1893,9 +1893,10 @@
Decl->TypeForDecl = PrevDecl->TypeForDecl;
assert(isa<InjectedClassNameType>(Decl->TypeForDecl));
} else {
- Decl->TypeForDecl =
+ Type *newType =
new (*this, TypeAlignment) InjectedClassNameType(Decl, TST);
- Types.push_back(Decl->TypeForDecl);
+ Decl->TypeForDecl = newType;
+ Types.push_back(newType);
}
return QualType(Decl->TypeForDecl, 0);
}
@@ -1923,11 +1924,12 @@
return getEnumType(Enum);
} else if (const UnresolvedUsingTypenameDecl *Using =
dyn_cast<UnresolvedUsingTypenameDecl>(Decl)) {
- Decl->TypeForDecl = new (*this, TypeAlignment) UnresolvedUsingType(Using);
+ Type *newType = new (*this, TypeAlignment) UnresolvedUsingType(Using);
+ Decl->TypeForDecl = newType;
+ Types.push_back(newType);
} else
llvm_unreachable("TypeDecl without a type?");
- Types.push_back(Decl->TypeForDecl);
return QualType(Decl->TypeForDecl, 0);
}
@@ -1939,10 +1941,11 @@
if (Canonical.isNull())
Canonical = getCanonicalType(Decl->getUnderlyingType());
- Decl->TypeForDecl = new(*this, TypeAlignment)
+ TypedefType *newType = new(*this, TypeAlignment)
TypedefType(Type::Typedef, Decl, Canonical);
- Types.push_back(Decl->TypeForDecl);
- return QualType(Decl->TypeForDecl, 0);
+ Decl->TypeForDecl = newType;
+ Types.push_back(newType);
+ return QualType(newType, 0);
}
QualType ASTContext::getRecordType(const RecordDecl *Decl) const {
@@ -1952,9 +1955,10 @@
if (PrevDecl->TypeForDecl)
return QualType(Decl->TypeForDecl = PrevDecl->TypeForDecl, 0);
- Decl->TypeForDecl = new (*this, TypeAlignment) RecordType(Decl);
- Types.push_back(Decl->TypeForDecl);
- return QualType(Decl->TypeForDecl, 0);
+ RecordType *newType = new (*this, TypeAlignment) RecordType(Decl);
+ Decl->TypeForDecl = newType;
+ Types.push_back(newType);
+ return QualType(newType, 0);
}
QualType ASTContext::getEnumType(const EnumDecl *Decl) const {
@@ -1964,9 +1968,10 @@
if (PrevDecl->TypeForDecl)
return QualType(Decl->TypeForDecl = PrevDecl->TypeForDecl, 0);
- Decl->TypeForDecl = new (*this, TypeAlignment) EnumType(Decl);
- Types.push_back(Decl->TypeForDecl);
- return QualType(Decl->TypeForDecl, 0);
+ EnumType *newType = new (*this, TypeAlignment) EnumType(Decl);
+ Decl->TypeForDecl = newType;
+ Types.push_back(newType);
+ return QualType(newType, 0);
}
QualType ASTContext::getAttributedType(AttributedType::Kind attrKind,
@@ -2667,7 +2672,7 @@
// If the type qualifiers are on an array type, get the canonical
// type of the array with the qualifiers applied to the element
// type.
- ArrayType *AT = dyn_cast<ArrayType>(CanType);
+ const ArrayType *AT = dyn_cast<ArrayType>(CanType);
if (!AT)
return CanQualType::CreateUnsafe(getQualifiedType(CanType, Quals));
@@ -2676,17 +2681,17 @@
QualType NewEltTy = getQualifiedType(AT->getElementType(), Quals);
NewEltTy = getCanonicalType(NewEltTy);
- if (ConstantArrayType *CAT = dyn_cast<ConstantArrayType>(AT))
+ if (const ConstantArrayType *CAT = dyn_cast<ConstantArrayType>(AT))
return CanQualType::CreateUnsafe(
getConstantArrayType(NewEltTy, CAT->getSize(),
CAT->getSizeModifier(),
CAT->getIndexTypeCVRQualifiers()));
- if (IncompleteArrayType *IAT = dyn_cast<IncompleteArrayType>(AT))
+ if (const IncompleteArrayType *IAT = dyn_cast<IncompleteArrayType>(AT))
return CanQualType::CreateUnsafe(
getIncompleteArrayType(NewEltTy, IAT->getSizeModifier(),
IAT->getIndexTypeCVRQualifiers()));
- if (DependentSizedArrayType *DSAT = dyn_cast<DependentSizedArrayType>(AT))
+ if (const DependentSizedArrayType *DSAT = dyn_cast<DependentSizedArrayType>(AT))
return CanQualType::CreateUnsafe(
getDependentSizedArrayType(NewEltTy,
DSAT->getSizeExpr(),
@@ -2694,7 +2699,7 @@
DSAT->getIndexTypeCVRQualifiers(),
DSAT->getBracketsRange())->getCanonicalTypeInternal());
- VariableArrayType *VAT = cast<VariableArrayType>(AT);
+ const VariableArrayType *VAT = cast<VariableArrayType>(AT);
return CanQualType::CreateUnsafe(getVariableArrayType(NewEltTy,
VAT->getSizeExpr(),
VAT->getSizeModifier(),
@@ -3134,9 +3139,9 @@
/// getIntegerRank - Return an integer conversion rank (C99 6.3.1.1p1). This
/// routine will assert if passed a built-in type that isn't an integer or enum,
/// or if it is not canonicalized.
-unsigned ASTContext::getIntegerRank(Type *T) const {
+unsigned ASTContext::getIntegerRank(const Type *T) const {
assert(T->isCanonicalUnqualified() && "T should be canonicalized");
- if (EnumType* ET = dyn_cast<EnumType>(T))
+ if (const EnumType* ET = dyn_cast<EnumType>(T))
T = ET->getDecl()->getPromotionType().getTypePtr();
if (T->isSpecificBuiltinType(BuiltinType::WChar_S) ||
@@ -3230,8 +3235,8 @@
/// C99 6.3.1.8p1. If LHS > RHS, return 1. If LHS == RHS, return 0. If
/// LHS < RHS, return -1.
int ASTContext::getIntegerTypeOrder(QualType LHS, QualType RHS) const {
- Type *LHSC = getCanonicalType(LHS).getTypePtr();
- Type *RHSC = getCanonicalType(RHS).getTypePtr();
+ const Type *LHSC = getCanonicalType(LHS).getTypePtr();
+ const Type *RHSC = getCanonicalType(RHS).getTypePtr();
if (LHSC == RHSC) return 0;
bool LHSUnsigned = LHSC->isUnsignedIntegerType();
@@ -4505,7 +4510,7 @@
/// FIXME: Move to Type.
///
bool ASTContext::isObjCNSObjectType(QualType Ty) const {
- if (TypedefType *TDT = dyn_cast<TypedefType>(Ty)) {
+ if (const TypedefType *TDT = dyn_cast<TypedefType>(Ty)) {
if (TypedefDecl *TD = TDT->getDecl())
if (TD->getAttr<ObjCNSObjectAttr>())
return true;
@@ -5513,7 +5518,7 @@
//===----------------------------------------------------------------------===//
unsigned ASTContext::getIntWidth(QualType T) const {
- if (EnumType *ET = dyn_cast<EnumType>(T))
+ if (const EnumType *ET = dyn_cast<EnumType>(T))
T = ET->getDecl()->getIntegerType();
if (T->isBooleanType())
return 1;
Modified: cfe/trunk/lib/AST/ASTImporter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTImporter.cpp?rev=123814&r1=123813&r2=123814&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTImporter.cpp (original)
+++ cfe/trunk/lib/AST/ASTImporter.cpp Wed Jan 19 00:33:43 2011
@@ -41,41 +41,41 @@
using StmtVisitor<ASTNodeImporter, Stmt *>::Visit;
// Importing types
- QualType VisitType(Type *T);
- QualType VisitBuiltinType(BuiltinType *T);
- QualType VisitComplexType(ComplexType *T);
- QualType VisitPointerType(PointerType *T);
- QualType VisitBlockPointerType(BlockPointerType *T);
- QualType VisitLValueReferenceType(LValueReferenceType *T);
- QualType VisitRValueReferenceType(RValueReferenceType *T);
- QualType VisitMemberPointerType(MemberPointerType *T);
- QualType VisitConstantArrayType(ConstantArrayType *T);
- QualType VisitIncompleteArrayType(IncompleteArrayType *T);
- QualType VisitVariableArrayType(VariableArrayType *T);
+ QualType VisitType(const Type *T);
+ QualType VisitBuiltinType(const BuiltinType *T);
+ QualType VisitComplexType(const ComplexType *T);
+ QualType VisitPointerType(const PointerType *T);
+ QualType VisitBlockPointerType(const BlockPointerType *T);
+ QualType VisitLValueReferenceType(const LValueReferenceType *T);
+ QualType VisitRValueReferenceType(const RValueReferenceType *T);
+ QualType VisitMemberPointerType(const MemberPointerType *T);
+ QualType VisitConstantArrayType(const ConstantArrayType *T);
+ QualType VisitIncompleteArrayType(const IncompleteArrayType *T);
+ QualType VisitVariableArrayType(const VariableArrayType *T);
// FIXME: DependentSizedArrayType
// FIXME: DependentSizedExtVectorType
- QualType VisitVectorType(VectorType *T);
- QualType VisitExtVectorType(ExtVectorType *T);
- QualType VisitFunctionNoProtoType(FunctionNoProtoType *T);
- QualType VisitFunctionProtoType(FunctionProtoType *T);
+ QualType VisitVectorType(const VectorType *T);
+ QualType VisitExtVectorType(const ExtVectorType *T);
+ QualType VisitFunctionNoProtoType(const FunctionNoProtoType *T);
+ QualType VisitFunctionProtoType(const FunctionProtoType *T);
// FIXME: UnresolvedUsingType
- QualType VisitTypedefType(TypedefType *T);
- QualType VisitTypeOfExprType(TypeOfExprType *T);
+ QualType VisitTypedefType(const TypedefType *T);
+ QualType VisitTypeOfExprType(const TypeOfExprType *T);
// FIXME: DependentTypeOfExprType
- QualType VisitTypeOfType(TypeOfType *T);
- QualType VisitDecltypeType(DecltypeType *T);
+ QualType VisitTypeOfType(const TypeOfType *T);
+ QualType VisitDecltypeType(const DecltypeType *T);
// FIXME: DependentDecltypeType
- QualType VisitRecordType(RecordType *T);
- QualType VisitEnumType(EnumType *T);
+ QualType VisitRecordType(const RecordType *T);
+ QualType VisitEnumType(const EnumType *T);
// FIXME: TemplateTypeParmType
// FIXME: SubstTemplateTypeParmType
- QualType VisitTemplateSpecializationType(TemplateSpecializationType *T);
- QualType VisitElaboratedType(ElaboratedType *T);
+ QualType VisitTemplateSpecializationType(const TemplateSpecializationType *T);
+ QualType VisitElaboratedType(const ElaboratedType *T);
// FIXME: DependentNameType
// FIXME: DependentTemplateSpecializationType
- QualType VisitObjCInterfaceType(ObjCInterfaceType *T);
- QualType VisitObjCObjectType(ObjCObjectType *T);
- QualType VisitObjCObjectPointerType(ObjCObjectPointerType *T);
+ QualType VisitObjCInterfaceType(const ObjCInterfaceType *T);
+ QualType VisitObjCObjectType(const ObjCObjectType *T);
+ QualType VisitObjCObjectPointerType(const ObjCObjectPointerType *T);
// Importing declarations
bool ImportDeclParts(NamedDecl *D, DeclContext *&DC,
@@ -1279,13 +1279,13 @@
// Import Types
//----------------------------------------------------------------------------
-QualType ASTNodeImporter::VisitType(Type *T) {
+QualType ASTNodeImporter::VisitType(const Type *T) {
Importer.FromDiag(SourceLocation(), diag::err_unsupported_ast_node)
<< T->getTypeClassName();
return QualType();
}
-QualType ASTNodeImporter::VisitBuiltinType(BuiltinType *T) {
+QualType ASTNodeImporter::VisitBuiltinType(const BuiltinType *T) {
switch (T->getKind()) {
case BuiltinType::Void: return Importer.getToContext().VoidTy;
case BuiltinType::Bool: return Importer.getToContext().BoolTy;
@@ -1365,7 +1365,7 @@
return QualType();
}
-QualType ASTNodeImporter::VisitComplexType(ComplexType *T) {
+QualType ASTNodeImporter::VisitComplexType(const ComplexType *T) {
QualType ToElementType = Importer.Import(T->getElementType());
if (ToElementType.isNull())
return QualType();
@@ -1373,7 +1373,7 @@
return Importer.getToContext().getComplexType(ToElementType);
}
-QualType ASTNodeImporter::VisitPointerType(PointerType *T) {
+QualType ASTNodeImporter::VisitPointerType(const PointerType *T) {
QualType ToPointeeType = Importer.Import(T->getPointeeType());
if (ToPointeeType.isNull())
return QualType();
@@ -1381,7 +1381,7 @@
return Importer.getToContext().getPointerType(ToPointeeType);
}
-QualType ASTNodeImporter::VisitBlockPointerType(BlockPointerType *T) {
+QualType ASTNodeImporter::VisitBlockPointerType(const BlockPointerType *T) {
// FIXME: Check for blocks support in "to" context.
QualType ToPointeeType = Importer.Import(T->getPointeeType());
if (ToPointeeType.isNull())
@@ -1390,7 +1390,8 @@
return Importer.getToContext().getBlockPointerType(ToPointeeType);
}
-QualType ASTNodeImporter::VisitLValueReferenceType(LValueReferenceType *T) {
+QualType
+ASTNodeImporter::VisitLValueReferenceType(const LValueReferenceType *T) {
// FIXME: Check for C++ support in "to" context.
QualType ToPointeeType = Importer.Import(T->getPointeeTypeAsWritten());
if (ToPointeeType.isNull())
@@ -1399,7 +1400,8 @@
return Importer.getToContext().getLValueReferenceType(ToPointeeType);
}
-QualType ASTNodeImporter::VisitRValueReferenceType(RValueReferenceType *T) {
+QualType
+ASTNodeImporter::VisitRValueReferenceType(const RValueReferenceType *T) {
// FIXME: Check for C++0x support in "to" context.
QualType ToPointeeType = Importer.Import(T->getPointeeTypeAsWritten());
if (ToPointeeType.isNull())
@@ -1408,7 +1410,7 @@
return Importer.getToContext().getRValueReferenceType(ToPointeeType);
}
-QualType ASTNodeImporter::VisitMemberPointerType(MemberPointerType *T) {
+QualType ASTNodeImporter::VisitMemberPointerType(const MemberPointerType *T) {
// FIXME: Check for C++ support in "to" context.
QualType ToPointeeType = Importer.Import(T->getPointeeType());
if (ToPointeeType.isNull())
@@ -1419,7 +1421,7 @@
ClassType.getTypePtr());
}
-QualType ASTNodeImporter::VisitConstantArrayType(ConstantArrayType *T) {
+QualType ASTNodeImporter::VisitConstantArrayType(const ConstantArrayType *T) {
QualType ToElementType = Importer.Import(T->getElementType());
if (ToElementType.isNull())
return QualType();
@@ -1430,7 +1432,8 @@
T->getIndexTypeCVRQualifiers());
}
-QualType ASTNodeImporter::VisitIncompleteArrayType(IncompleteArrayType *T) {
+QualType
+ASTNodeImporter::VisitIncompleteArrayType(const IncompleteArrayType *T) {
QualType ToElementType = Importer.Import(T->getElementType());
if (ToElementType.isNull())
return QualType();
@@ -1440,7 +1443,7 @@
T->getIndexTypeCVRQualifiers());
}
-QualType ASTNodeImporter::VisitVariableArrayType(VariableArrayType *T) {
+QualType ASTNodeImporter::VisitVariableArrayType(const VariableArrayType *T) {
QualType ToElementType = Importer.Import(T->getElementType());
if (ToElementType.isNull())
return QualType();
@@ -1456,7 +1459,7 @@
Brackets);
}
-QualType ASTNodeImporter::VisitVectorType(VectorType *T) {
+QualType ASTNodeImporter::VisitVectorType(const VectorType *T) {
QualType ToElementType = Importer.Import(T->getElementType());
if (ToElementType.isNull())
return QualType();
@@ -1466,7 +1469,7 @@
T->getVectorKind());
}
-QualType ASTNodeImporter::VisitExtVectorType(ExtVectorType *T) {
+QualType ASTNodeImporter::VisitExtVectorType(const ExtVectorType *T) {
QualType ToElementType = Importer.Import(T->getElementType());
if (ToElementType.isNull())
return QualType();
@@ -1475,7 +1478,8 @@
T->getNumElements());
}
-QualType ASTNodeImporter::VisitFunctionNoProtoType(FunctionNoProtoType *T) {
+QualType
+ASTNodeImporter::VisitFunctionNoProtoType(const FunctionNoProtoType *T) {
// FIXME: What happens if we're importing a function without a prototype
// into C++? Should we make it variadic?
QualType ToResultType = Importer.Import(T->getResultType());
@@ -1486,7 +1490,7 @@
T->getExtInfo());
}
-QualType ASTNodeImporter::VisitFunctionProtoType(FunctionProtoType *T) {
+QualType ASTNodeImporter::VisitFunctionProtoType(const FunctionProtoType *T) {
QualType ToResultType = Importer.Import(T->getResultType());
if (ToResultType.isNull())
return QualType();
@@ -1520,7 +1524,7 @@
ArgTypes.size(), EPI);
}
-QualType ASTNodeImporter::VisitTypedefType(TypedefType *T) {
+QualType ASTNodeImporter::VisitTypedefType(const TypedefType *T) {
TypedefDecl *ToDecl
= dyn_cast_or_null<TypedefDecl>(Importer.Import(T->getDecl()));
if (!ToDecl)
@@ -1529,7 +1533,7 @@
return Importer.getToContext().getTypeDeclType(ToDecl);
}
-QualType ASTNodeImporter::VisitTypeOfExprType(TypeOfExprType *T) {
+QualType ASTNodeImporter::VisitTypeOfExprType(const TypeOfExprType *T) {
Expr *ToExpr = Importer.Import(T->getUnderlyingExpr());
if (!ToExpr)
return QualType();
@@ -1537,7 +1541,7 @@
return Importer.getToContext().getTypeOfExprType(ToExpr);
}
-QualType ASTNodeImporter::VisitTypeOfType(TypeOfType *T) {
+QualType ASTNodeImporter::VisitTypeOfType(const TypeOfType *T) {
QualType ToUnderlyingType = Importer.Import(T->getUnderlyingType());
if (ToUnderlyingType.isNull())
return QualType();
@@ -1545,7 +1549,7 @@
return Importer.getToContext().getTypeOfType(ToUnderlyingType);
}
-QualType ASTNodeImporter::VisitDecltypeType(DecltypeType *T) {
+QualType ASTNodeImporter::VisitDecltypeType(const DecltypeType *T) {
Expr *ToExpr = Importer.Import(T->getUnderlyingExpr());
if (!ToExpr)
return QualType();
@@ -1553,7 +1557,7 @@
return Importer.getToContext().getDecltypeType(ToExpr);
}
-QualType ASTNodeImporter::VisitRecordType(RecordType *T) {
+QualType ASTNodeImporter::VisitRecordType(const RecordType *T) {
RecordDecl *ToDecl
= dyn_cast_or_null<RecordDecl>(Importer.Import(T->getDecl()));
if (!ToDecl)
@@ -1562,7 +1566,7 @@
return Importer.getToContext().getTagDeclType(ToDecl);
}
-QualType ASTNodeImporter::VisitEnumType(EnumType *T) {
+QualType ASTNodeImporter::VisitEnumType(const EnumType *T) {
EnumDecl *ToDecl
= dyn_cast_or_null<EnumDecl>(Importer.Import(T->getDecl()));
if (!ToDecl)
@@ -1572,7 +1576,7 @@
}
QualType ASTNodeImporter::VisitTemplateSpecializationType(
- TemplateSpecializationType *T) {
+ const TemplateSpecializationType *T) {
TemplateName ToTemplate = Importer.Import(T->getTemplateName());
if (ToTemplate.isNull())
return QualType();
@@ -1595,7 +1599,7 @@
ToCanonType);
}
-QualType ASTNodeImporter::VisitElaboratedType(ElaboratedType *T) {
+QualType ASTNodeImporter::VisitElaboratedType(const ElaboratedType *T) {
NestedNameSpecifier *ToQualifier = 0;
// Note: the qualifier in an ElaboratedType is optional.
if (T->getQualifier()) {
@@ -1612,7 +1616,7 @@
ToQualifier, ToNamedType);
}
-QualType ASTNodeImporter::VisitObjCInterfaceType(ObjCInterfaceType *T) {
+QualType ASTNodeImporter::VisitObjCInterfaceType(const ObjCInterfaceType *T) {
ObjCInterfaceDecl *Class
= dyn_cast_or_null<ObjCInterfaceDecl>(Importer.Import(T->getDecl()));
if (!Class)
@@ -1621,7 +1625,7 @@
return Importer.getToContext().getObjCInterfaceType(Class);
}
-QualType ASTNodeImporter::VisitObjCObjectType(ObjCObjectType *T) {
+QualType ASTNodeImporter::VisitObjCObjectType(const ObjCObjectType *T) {
QualType ToBaseType = Importer.Import(T->getBaseType());
if (ToBaseType.isNull())
return QualType();
@@ -1642,7 +1646,8 @@
Protocols.size());
}
-QualType ASTNodeImporter::VisitObjCObjectPointerType(ObjCObjectPointerType *T) {
+QualType
+ASTNodeImporter::VisitObjCObjectPointerType(const ObjCObjectPointerType *T) {
QualType ToPointeeType = Importer.Import(T->getPointeeType());
if (ToPointeeType.isNull())
return QualType();
@@ -3920,23 +3925,25 @@
QualType ASTImporter::Import(QualType FromT) {
if (FromT.isNull())
return QualType();
+
+ const Type *fromTy = FromT.getTypePtr();
// Check whether we've already imported this type.
- llvm::DenseMap<Type *, Type *>::iterator Pos
- = ImportedTypes.find(FromT.getTypePtr());
+ llvm::DenseMap<const Type *, const Type *>::iterator Pos
+ = ImportedTypes.find(fromTy);
if (Pos != ImportedTypes.end())
- return ToContext.getQualifiedType(Pos->second, FromT.getQualifiers());
+ return ToContext.getQualifiedType(Pos->second, FromT.getLocalQualifiers());
// Import the type
ASTNodeImporter Importer(*this);
- QualType ToT = Importer.Visit(FromT.getTypePtr());
+ QualType ToT = Importer.Visit(fromTy);
if (ToT.isNull())
return ToT;
// Record the imported type.
- ImportedTypes[FromT.getTypePtr()] = ToT.getTypePtr();
+ ImportedTypes[fromTy] = ToT.getTypePtr();
- return ToContext.getQualifiedType(ToT, FromT.getQualifiers());
+ return ToContext.getQualifiedType(ToT, FromT.getLocalQualifiers());
}
TypeSourceInfo *ASTImporter::Import(TypeSourceInfo *FromTSI) {
@@ -4282,7 +4289,7 @@
}
bool ASTImporter::IsStructurallyEquivalent(QualType From, QualType To) {
- llvm::DenseMap<Type *, Type *>::iterator Pos
+ llvm::DenseMap<const Type *, const Type *>::iterator Pos
= ImportedTypes.find(From.getTypePtr());
if (Pos != ImportedTypes.end() && ToContext.hasSameType(Import(From), To))
return true;
Modified: cfe/trunk/lib/AST/Decl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=123814&r1=123813&r2=123814&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Decl.cpp (original)
+++ cfe/trunk/lib/AST/Decl.cpp Wed Jan 19 00:33:43 2011
@@ -1891,7 +1891,7 @@
void TagDecl::setTypedefForAnonDecl(TypedefDecl *TDD) {
TypedefDeclOrQualifier = TDD;
if (TypeForDecl)
- TypeForDecl->ClearLinkageCache();
+ const_cast<Type*>(TypeForDecl)->ClearLinkageCache();
ClearLinkageCache();
}
Modified: cfe/trunk/lib/AST/DeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclCXX.cpp?rev=123814&r1=123813&r2=123814&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclCXX.cpp (original)
+++ cfe/trunk/lib/AST/DeclCXX.cpp Wed Jan 19 00:33:43 2011
@@ -1068,13 +1068,6 @@
return TypeLoc();
}
-Type *CXXCtorInitializer::getBaseClass() {
- if (isBaseInitializer())
- return Initializee.get<TypeSourceInfo*>()->getType().getTypePtr();
- else
- return 0;
-}
-
const Type *CXXCtorInitializer::getBaseClass() const {
if (isBaseInitializer())
return Initializee.get<TypeSourceInfo*>()->getType().getTypePtr();
Modified: cfe/trunk/lib/AST/DeclPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclPrinter.cpp?rev=123814&r1=123813&r2=123814&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclPrinter.cpp (original)
+++ cfe/trunk/lib/AST/DeclPrinter.cpp Wed Jan 19 00:33:43 2011
@@ -368,7 +368,7 @@
std::string Proto = D->getNameInfo().getAsString();
QualType Ty = D->getType();
- while (ParenType* PT = dyn_cast<ParenType>(Ty)) {
+ while (const ParenType *PT = dyn_cast<ParenType>(Ty)) {
Proto = '(' + Proto + ')';
Ty = PT->getInnerType();
}
Modified: cfe/trunk/lib/AST/DumpXML.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DumpXML.cpp?rev=123814&r1=123813&r2=123814&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DumpXML.cpp (original)
+++ cfe/trunk/lib/AST/DumpXML.cpp Wed Jan 19 00:33:43 2011
@@ -226,7 +226,7 @@
//---- General utilities -------------------------------------------//
- void setPointer(llvm::StringRef prop, void *p) {
+ void setPointer(llvm::StringRef prop, const void *p) {
llvm::SmallString<10> buffer;
llvm::raw_svector_ostream os(buffer);
os << p;
Modified: cfe/trunk/lib/AST/Expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Expr.cpp?rev=123814&r1=123813&r2=123814&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Expr.cpp (original)
+++ cfe/trunk/lib/AST/Expr.cpp Wed Jan 19 00:33:43 2011
@@ -2768,7 +2768,7 @@
// size expression of the VLA needs to be treated as an executable expression.
// Why isn't this weirdness documented better in StmtIterator?
if (isArgumentType()) {
- if (VariableArrayType* T = dyn_cast<VariableArrayType>(
+ if (const VariableArrayType* T = dyn_cast<VariableArrayType>(
getArgumentType().getTypePtr()))
return child_iterator(T);
return child_iterator();
Modified: cfe/trunk/lib/AST/ExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprCXX.cpp?rev=123814&r1=123813&r2=123814&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ExprCXX.cpp (original)
+++ cfe/trunk/lib/AST/ExprCXX.cpp Wed Jan 19 00:33:43 2011
@@ -995,7 +995,7 @@
// lookup.
CXXRecordDecl *Record = 0;
if (getQualifier()) {
- Type *T = getQualifier()->getAsType();
+ const Type *T = getQualifier()->getAsType();
assert(T && "qualifier in member expression does not name type");
Record = T->getAsCXXRecordDecl();
assert(Record && "qualifier in member expression does not name record");
Modified: cfe/trunk/lib/AST/ItaniumMangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ItaniumMangle.cpp?rev=123814&r1=123813&r2=123814&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ItaniumMangle.cpp (original)
+++ cfe/trunk/lib/AST/ItaniumMangle.cpp Wed Jan 19 00:33:43 2011
@@ -381,7 +381,8 @@
// Do the canonicalization out here because parameter types can
// undergo additional canonicalization (e.g. array decay).
- FunctionType *FT = cast<FunctionType>(Context.getASTContext()
+ const FunctionType *FT
+ = cast<FunctionType>(Context.getASTContext()
.getCanonicalType(FD->getType()));
mangleBareFunctionType(FT, MangleReturnType);
Modified: cfe/trunk/lib/AST/MicrosoftMangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/MicrosoftMangle.cpp?rev=123814&r1=123813&r2=123814&view=diff
==============================================================================
--- cfe/trunk/lib/AST/MicrosoftMangle.cpp (original)
+++ cfe/trunk/lib/AST/MicrosoftMangle.cpp Wed Jan 19 00:33:43 2011
@@ -238,7 +238,7 @@
Out << 'A';
} else if (Ty->isArrayType()) {
// Global arrays are funny, too.
- mangleType(static_cast<ArrayType *>(Ty.getTypePtr()), true);
+ mangleType(cast<ArrayType>(Ty.getTypePtr()), true);
Out << 'A';
} else {
mangleType(Ty.getLocalUnqualifiedType());
Modified: cfe/trunk/lib/AST/NestedNameSpecifier.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/NestedNameSpecifier.cpp?rev=123814&r1=123813&r2=123814&view=diff
==============================================================================
--- cfe/trunk/lib/AST/NestedNameSpecifier.cpp (original)
+++ cfe/trunk/lib/AST/NestedNameSpecifier.cpp Wed Jan 19 00:33:43 2011
@@ -68,12 +68,12 @@
NestedNameSpecifier *
NestedNameSpecifier::Create(const ASTContext &Context,
NestedNameSpecifier *Prefix,
- bool Template, Type *T) {
+ bool Template, const Type *T) {
assert(T && "Type cannot be NULL");
NestedNameSpecifier Mockup;
Mockup.Prefix.setPointer(Prefix);
Mockup.Prefix.setInt(Template? TypeSpecWithTemplate : TypeSpec);
- Mockup.Specifier = T;
+ Mockup.Specifier = const_cast<Type*>(T);
return FindOrInsert(Context, Mockup);
}
@@ -159,7 +159,7 @@
case TypeSpec: {
std::string TypeStr;
- Type *T = getAsType();
+ const Type *T = getAsType();
PrintingPolicy InnerPolicy(Policy);
InnerPolicy.SuppressScope = true;
Modified: cfe/trunk/lib/AST/StmtIterator.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtIterator.cpp?rev=123814&r1=123813&r2=123814&view=diff
==============================================================================
--- cfe/trunk/lib/AST/StmtIterator.cpp (original)
+++ cfe/trunk/lib/AST/StmtIterator.cpp Wed Jan 19 00:33:43 2011
@@ -18,9 +18,9 @@
// FIXME: Add support for dependent-sized array types in C++?
// Does it even make sense to build a CFG for an uninstantiated template?
-static inline VariableArrayType* FindVA(Type* t) {
- while (ArrayType* vt = dyn_cast<ArrayType>(t)) {
- if (VariableArrayType* vat = dyn_cast<VariableArrayType>(vt))
+static inline const VariableArrayType *FindVA(const Type* t) {
+ while (const ArrayType *vt = dyn_cast<ArrayType>(t)) {
+ if (const VariableArrayType *vat = dyn_cast<VariableArrayType>(vt))
if (vat->getSizeExpr())
return vat;
@@ -33,7 +33,7 @@
void StmtIteratorBase::NextVA() {
assert (getVAPtr());
- VariableArrayType* p = getVAPtr();
+ const VariableArrayType *p = getVAPtr();
p = FindVA(p->getElementType().getTypePtr());
setVAPtr(p);
@@ -90,7 +90,7 @@
bool StmtIteratorBase::HandleDecl(Decl* D) {
if (VarDecl* VD = dyn_cast<VarDecl>(D)) {
- if (VariableArrayType* VAPtr = FindVA(VD->getType().getTypePtr())) {
+ if (const VariableArrayType* VAPtr = FindVA(VD->getType().getTypePtr())) {
setVAPtr(VAPtr);
return true;
}
@@ -99,7 +99,7 @@
return true;
}
else if (TypedefDecl* TD = dyn_cast<TypedefDecl>(D)) {
- if (VariableArrayType* VAPtr =
+ if (const VariableArrayType* VAPtr =
FindVA(TD->getUnderlyingType().getTypePtr())) {
setVAPtr(VAPtr);
return true;
@@ -124,16 +124,16 @@
NextDecl(false);
}
-StmtIteratorBase::StmtIteratorBase(VariableArrayType* t)
+StmtIteratorBase::StmtIteratorBase(const VariableArrayType* t)
: stmt(0), decl(0), RawVAPtr(SizeOfTypeVAMode) {
RawVAPtr |= reinterpret_cast<uintptr_t>(t);
}
Stmt*& StmtIteratorBase::GetDeclExpr() const {
- if (VariableArrayType* VAPtr = getVAPtr()) {
+ if (const VariableArrayType* VAPtr = getVAPtr()) {
assert (VAPtr->SizeExpr);
- return VAPtr->SizeExpr;
+ return const_cast<Stmt*&>(VAPtr->SizeExpr);
}
assert (inDecl() || inDeclGroup());
Modified: cfe/trunk/lib/Analysis/CFG.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CFG.cpp?rev=123814&r1=123813&r2=123814&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/CFG.cpp (original)
+++ cfe/trunk/lib/Analysis/CFG.cpp Wed Jan 19 00:33:43 2011
@@ -419,9 +419,9 @@
// FIXME: Add support for dependent-sized array types in C++?
// Does it even make sense to build a CFG for an uninstantiated template?
-static VariableArrayType* FindVA(Type* t) {
- while (ArrayType* vt = dyn_cast<ArrayType>(t)) {
- if (VariableArrayType* vat = dyn_cast<VariableArrayType>(vt))
+static const VariableArrayType *FindVA(const Type *t) {
+ while (const ArrayType *vt = dyn_cast<ArrayType>(t)) {
+ if (const VariableArrayType *vat = dyn_cast<VariableArrayType>(vt))
if (vat->getSizeExpr())
return vat;
@@ -1309,8 +1309,8 @@
}
// If the type of VD is a VLA, then we must process its size expressions.
- for (VariableArrayType* VA = FindVA(VD->getType().getTypePtr()); VA != 0;
- VA = FindVA(VA->getElementType().getTypePtr()))
+ for (const VariableArrayType* VA = FindVA(VD->getType().getTypePtr());
+ VA != 0; VA = FindVA(VA->getElementType().getTypePtr()))
Block = addStmt(VA->getSizeExpr());
// Remove variable from local scope.
@@ -2100,7 +2100,7 @@
// VLA types have expressions that must be evaluated.
if (E->isArgumentType()) {
- for (VariableArrayType* VA = FindVA(E->getArgumentType().getTypePtr());
+ for (const VariableArrayType *VA =FindVA(E->getArgumentType().getTypePtr());
VA != 0; VA = FindVA(VA->getElementType().getTypePtr()))
addStmt(VA->getSizeExpr());
}
Modified: cfe/trunk/lib/Analysis/CocoaConventions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CocoaConventions.cpp?rev=123814&r1=123813&r2=123814&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/CocoaConventions.cpp (original)
+++ cfe/trunk/lib/Analysis/CocoaConventions.cpp Wed Jan 19 00:33:43 2011
@@ -118,7 +118,7 @@
bool cocoa::isRefType(QualType RetTy, llvm::StringRef Prefix,
llvm::StringRef Name) {
// Recursively walk the typedef stack, allowing typedefs of reference types.
- while (TypedefType* TD = dyn_cast<TypedefType>(RetTy.getTypePtr())) {
+ while (const TypedefType *TD = dyn_cast<TypedefType>(RetTy.getTypePtr())) {
llvm::StringRef TDName = TD->getDecl()->getIdentifier()->getName();
if (TDName.startswith(Prefix) && TDName.endswith("Ref"))
return true;
Modified: cfe/trunk/lib/CodeGen/CGBlocks.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBlocks.cpp?rev=123814&r1=123813&r2=123814&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGBlocks.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBlocks.cpp Wed Jan 19 00:33:43 2011
@@ -821,7 +821,7 @@
SC_Static,
SC_None,
false, HasPrototype);
- if (FunctionProtoType *FT = dyn_cast<FunctionProtoType>(FnType)) {
+ if (const FunctionProtoType *FT = dyn_cast<FunctionProtoType>(FnType)) {
const FunctionDecl *CFD = dyn_cast<FunctionDecl>(CurCodeDecl);
FunctionDecl *FD = const_cast<FunctionDecl *>(CFD);
llvm::SmallVector<ParmVarDecl*, 16> Params;
Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=123814&r1=123813&r2=123814&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Wed Jan 19 00:33:43 2011
@@ -1307,11 +1307,9 @@
case Type::TemplateSpecialization:
T = cast<TemplateSpecializationType>(T)->desugar();
break;
- case Type::TypeOfExpr: {
- TypeOfExprType *Ty = cast<TypeOfExprType>(T);
- T = Ty->getUnderlyingExpr()->getType();
+ case Type::TypeOfExpr:
+ T = cast<TypeOfExprType>(T)->getUnderlyingExpr()->getType();
break;
- }
case Type::TypeOf:
T = cast<TypeOfType>(T)->getUnderlyingType();
break;
Modified: cfe/trunk/lib/CodeGen/CGExprScalar.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprScalar.cpp?rev=123814&r1=123813&r2=123814&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprScalar.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprScalar.cpp Wed Jan 19 00:33:43 2011
@@ -2065,8 +2065,7 @@
*SecondVecArg = RHS;
QualType ElTy = LHSTy->getAs<VectorType>()->getElementType();
- Type *Ty = CGF.getContext().getCanonicalType(ElTy).getTypePtr();
- const BuiltinType *BTy = dyn_cast<BuiltinType>(Ty);
+ const BuiltinType *BTy = ElTy->getAs<BuiltinType>();
BuiltinType::Kind ElementKind = BTy->getKind();
switch(E->getOpcode()) {
Modified: cfe/trunk/lib/CodeGen/CodeGenTBAA.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenTBAA.cpp?rev=123814&r1=123813&r2=123814&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenTBAA.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenTBAA.cpp Wed Jan 19 00:33:43 2011
@@ -100,7 +100,7 @@
if (TypeHasMayAlias(QTy))
return getChar();
- Type *Ty = Context.getCanonicalType(QTy).getTypePtr();
+ const Type *Ty = Context.getCanonicalType(QTy).getTypePtr();
if (llvm::MDNode *N = MetadataCache[Ty])
return N;
Modified: cfe/trunk/lib/CodeGen/CodeGenTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenTypes.cpp?rev=123814&r1=123813&r2=123814&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenTypes.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenTypes.cpp Wed Jan 19 00:33:43 2011
@@ -85,7 +85,7 @@
T = Context.getCanonicalType(T);
// See if type is already cached.
- llvm::DenseMap<Type *, llvm::PATypeHolder>::iterator
+ llvm::DenseMap<const Type *, llvm::PATypeHolder>::iterator
I = TypeCache.find(T.getTypePtr());
// If type is found in map and this is not a definition for a opaque
// place holder type then use it. Otherwise, convert type T.
Modified: cfe/trunk/lib/CodeGen/CodeGenTypes.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenTypes.h?rev=123814&r1=123813&r2=123814&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenTypes.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenTypes.h Wed Jan 19 00:33:43 2011
@@ -88,7 +88,7 @@
/// and maps llvm::Types to corresponding clang::Type. llvm::PATypeHolder is
/// used instead of llvm::Type because it allows us to bypass potential
/// dangling type pointers due to type refinement on llvm side.
- llvm::DenseMap<Type *, llvm::PATypeHolder> TypeCache;
+ llvm::DenseMap<const Type *, llvm::PATypeHolder> TypeCache;
/// ConvertNewType - Convert type T into a llvm::Type. Do not use this
/// method directly because it does not do any type caching. This method
Modified: cfe/trunk/lib/Frontend/TypeXML.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/TypeXML.cpp?rev=123814&r1=123813&r2=123814&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/TypeXML.cpp (original)
+++ cfe/trunk/lib/Frontend/TypeXML.cpp Wed Jan 19 00:33:43 2011
@@ -29,7 +29,7 @@
TypeWriter(DocumentXML& doc) : Doc(doc) {}
#define NODE_XML( CLASS, NAME ) \
- void Visit##CLASS(CLASS* T) { \
+ void Visit##CLASS(const CLASS* T) { \
Doc.addSubNode(NAME);
#define ID_ATTRIBUTE_XML // done by the Document class itself
@@ -82,7 +82,7 @@
TypeAdder(DocumentXML& doc) : Doc(doc) {}
#define NODE_XML( CLASS, NAME ) \
- void Visit##CLASS(CLASS* T) \
+ void Visit##CLASS(const CLASS* T) \
{
#define ID_ATTRIBUTE_XML
@@ -101,7 +101,7 @@
//---------------------------------------------------------
void DocumentXML::addParentTypes(const Type* pType) {
- TypeAdder(*this).Visit(const_cast<Type*>(pType));
+ TypeAdder(*this).Visit(pType);
}
//---------------------------------------------------------
Modified: cfe/trunk/lib/Rewrite/RewriteObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Rewrite/RewriteObjC.cpp?rev=123814&r1=123813&r2=123814&view=diff
==============================================================================
--- cfe/trunk/lib/Rewrite/RewriteObjC.cpp (original)
+++ cfe/trunk/lib/Rewrite/RewriteObjC.cpp Wed Jan 19 00:33:43 2011
@@ -472,7 +472,7 @@
void RewriteObjC::RewriteBlocksInFunctionProtoType(QualType funcType,
NamedDecl *D) {
- if (FunctionProtoType *fproto
+ if (const FunctionProtoType *fproto
= dyn_cast<FunctionProtoType>(funcType.IgnoreParens())) {
for (FunctionProtoType::arg_type_iterator I = fproto->arg_type_begin(),
E = fproto->arg_type_end(); I && (I != E); ++I)
@@ -1410,7 +1410,7 @@
const Expr *BaseExpr = IV->getBase();
if (CurMethodDef) {
if (BaseExpr->getType()->isObjCObjectPointerType()) {
- ObjCInterfaceType *iFaceDecl =
+ const ObjCInterfaceType *iFaceDecl =
dyn_cast<ObjCInterfaceType>(BaseExpr->getType()->getPointeeType());
assert(iFaceDecl && "RewriteObjCIvarRefExpr - iFaceDecl is null");
// lookup which class implements the instance variable.
@@ -1457,7 +1457,7 @@
// Explicit ivar refs need to have a cast inserted.
// FIXME: consider sharing some of this code with the code above.
if (BaseExpr->getType()->isObjCObjectPointerType()) {
- ObjCInterfaceType *iFaceDecl =
+ const ObjCInterfaceType *iFaceDecl =
dyn_cast<ObjCInterfaceType>(BaseExpr->getType()->getPointeeType());
// lookup which class implements the instance variable.
ObjCInterfaceDecl *clsDeclared = 0;
Modified: cfe/trunk/lib/Sema/SemaCXXScopeSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCXXScopeSpec.cpp?rev=123814&r1=123813&r2=123814&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaCXXScopeSpec.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCXXScopeSpec.cpp Wed Jan 19 00:33:43 2011
@@ -518,7 +518,6 @@
// a declaration context.
if (NamespaceAliasDecl *Alias = dyn_cast<NamespaceAliasDecl>(SD))
return NestedNameSpecifier::Create(Context, Prefix,
-
Alias->getNamespace());
QualType T = Context.getTypeDeclType(cast<TypeDecl>(SD));
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=123814&r1=123813&r2=123814&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Wed Jan 19 00:33:43 2011
@@ -827,7 +827,7 @@
// Create Decl objects for each parameter, adding them to the
// FunctionDecl.
- if (FunctionProtoType *FT = dyn_cast<FunctionProtoType>(R)) {
+ if (const FunctionProtoType *FT = dyn_cast<FunctionProtoType>(R)) {
llvm::SmallVector<ParmVarDecl*, 16> Params;
for (unsigned i = 0, e = FT->getNumArgs(); i != e; ++i)
Params.push_back(ParmVarDecl::Create(Context, New, SourceLocation(), 0,
@@ -6143,7 +6143,8 @@
} else {
// If the type is currently being defined, complain
// about a nested redefinition.
- TagType *Tag = cast<TagType>(Context.getTagDeclType(PrevTagDecl));
+ const TagType *Tag
+ = cast<TagType>(Context.getTagDeclType(PrevTagDecl));
if (Tag->isBeingDefined()) {
Diag(NameLoc, diag::err_nested_redefinition) << Name;
Diag(PrevTagDecl->getLocation(),
@@ -7108,7 +7109,7 @@
FieldDecl *FD = cast<FieldDecl>(Fields[i]);
// Get the type for the field.
- Type *FDTy = FD->getType().getTypePtr();
+ const Type *FDTy = FD->getType().getTypePtr();
if (!FD->isAnonymousStructOrUnion()) {
// Remember all fields written by the user.
Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=123814&r1=123813&r2=123814&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Wed Jan 19 00:33:43 2011
@@ -2028,7 +2028,7 @@
}
static void *GetKeyForBase(ASTContext &Context, QualType BaseType) {
- return Context.getCanonicalType(BaseType).getTypePtr();
+ return const_cast<Type*>(Context.getCanonicalType(BaseType).getTypePtr());
}
static void *GetKeyForMember(ASTContext &Context,
@@ -2167,7 +2167,7 @@
<< Field->getDeclName()
<< Init->getSourceRange();
else {
- Type *BaseClass = Init->getBaseClass();
+ const Type *BaseClass = Init->getBaseClass();
assert(BaseClass && "neither field nor base");
S.Diag(Init->getSourceLocation(),
diag::err_multiple_base_initialization)
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=123814&r1=123813&r2=123814&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Wed Jan 19 00:33:43 2011
@@ -7986,7 +7986,7 @@
// Unary Operators. 'Tok' is the token for the operator.
ExprResult Sema::ActOnUnaryOp(Scope *S, SourceLocation OpLoc,
- tok::TokenKind Op, Expr *Input) {
+ tok::TokenKind Op, Expr *Input) {
return BuildUnaryOp(S, OpLoc, ConvertTokenKindToUnaryOpcode(Op), Input);
}
Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=123814&r1=123813&r2=123814&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Wed Jan 19 00:33:43 2011
@@ -375,7 +375,7 @@
/// Retrieve the UuidAttr associated with QT.
static UuidAttr *GetUuidAttrOfType(QualType QT) {
// Optionally remove one level of pointer, reference or array indirection.
- Type *Ty = QT.getTypePtr();;
+ const Type *Ty = QT.getTypePtr();;
if (QT->isPointerType() || QT->isReferenceType())
Ty = QT->getPointeeType().getTypePtr();
else if (QT->isArrayType())
Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=123814&r1=123813&r2=123814&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Wed Jan 19 00:33:43 2011
@@ -647,8 +647,8 @@
isa<FunctionNoProtoType>(NewQType.getTypePtr()))
return false;
- FunctionProtoType* OldType = cast<FunctionProtoType>(OldQType);
- FunctionProtoType* NewType = cast<FunctionProtoType>(NewQType);
+ const FunctionProtoType* OldType = cast<FunctionProtoType>(OldQType);
+ const FunctionProtoType* NewType = cast<FunctionProtoType>(NewQType);
// The signature of a function includes the types of its
// parameters (C++ 1.3.10), which includes the presence or absence
@@ -1012,7 +1012,7 @@
FromType = Fn->getType();
if (CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(Fn)) {
if (!Method->isStatic()) {
- Type *ClassType
+ const Type *ClassType
= S.Context.getTypeDeclType(Method->getParent()).getTypePtr();
FromType = S.Context.getMemberPointerType(FromType, ClassType);
}
@@ -1760,8 +1760,8 @@
/// for equlity of their argument types. Caller has already checked that
/// they have same number of arguments. This routine assumes that Objective-C
/// pointer types which only differ in their protocol qualifiers are equal.
-bool Sema::FunctionArgTypesAreEqual(FunctionProtoType* OldType,
- FunctionProtoType* NewType){
+bool Sema::FunctionArgTypesAreEqual(const FunctionProtoType *OldType,
+ const FunctionProtoType *NewType) {
if (!getLangOptions().ObjC1)
return std::equal(OldType->arg_type_begin(), OldType->arg_type_end(),
NewType->arg_type_begin());
Modified: cfe/trunk/lib/Sema/SemaTemplate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplate.cpp?rev=123814&r1=123813&r2=123814&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplate.cpp Wed Jan 19 00:33:43 2011
@@ -5192,7 +5192,7 @@
// C++98 has the same restriction, just worded differently.
for (NestedNameSpecifier *NNS = (NestedNameSpecifier *)SS.getScopeRep();
NNS; NNS = NNS->getPrefix())
- if (Type *T = NNS->getAsType())
+ if (const Type *T = NNS->getAsType())
if (isa<TemplateSpecializationType>(T))
return true;
@@ -5867,7 +5867,7 @@
// TODO: it's really silly that we make a template specialization
// type earlier only to drop it again here.
- TemplateSpecializationType *TST = cast<TemplateSpecializationType>(T);
+ const TemplateSpecializationType *TST = cast<TemplateSpecializationType>(T);
DependentTemplateName *DTN =
TST->getTemplateName().getAsDependentTemplateName();
assert(DTN && "dependent template has non-dependent name?");
Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp?rev=123814&r1=123813&r2=123814&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp Wed Jan 19 00:33:43 2011
@@ -1108,7 +1108,7 @@
QualType
TemplateInstantiator::TransformTemplateTypeParmType(TypeLocBuilder &TLB,
TemplateTypeParmTypeLoc TL) {
- TemplateTypeParmType *T = TL.getTypePtr();
+ const TemplateTypeParmType *T = TL.getTypePtr();
if (T->getDepth() < TemplateArgs.getNumLevels()) {
// Replace the template type parameter with its corresponding
// template argument.
Modified: cfe/trunk/lib/Sema/SemaType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=123814&r1=123813&r2=123814&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaType.cpp (original)
+++ cfe/trunk/lib/Sema/SemaType.cpp Wed Jan 19 00:33:43 2011
@@ -1388,7 +1388,7 @@
}
TypeSourceInfo *DI = 0;
- if (LocInfoType *LIT = dyn_cast<LocInfoType>(QT)) {
+ if (const LocInfoType *LIT = dyn_cast<LocInfoType>(QT)) {
QT = LIT->getType();
DI = LIT->getTypeSourceInfo();
}
Modified: cfe/trunk/lib/Sema/TreeTransform.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/TreeTransform.h?rev=123814&r1=123813&r2=123814&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/TreeTransform.h (original)
+++ cfe/trunk/lib/Sema/TreeTransform.h Wed Jan 19 00:33:43 2011
@@ -3237,7 +3237,7 @@
QualType
TreeTransform<Derived>::TransformMemberPointerType(TypeLocBuilder &TLB,
MemberPointerTypeLoc TL) {
- MemberPointerType *T = TL.getTypePtr();
+ const MemberPointerType *T = TL.getTypePtr();
QualType PointeeType = getDerived().TransformType(TLB, TL.getPointeeLoc());
if (PointeeType.isNull())
@@ -3269,7 +3269,7 @@
QualType
TreeTransform<Derived>::TransformConstantArrayType(TypeLocBuilder &TLB,
ConstantArrayTypeLoc TL) {
- ConstantArrayType *T = TL.getTypePtr();
+ const ConstantArrayType *T = TL.getTypePtr();
QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
if (ElementType.isNull())
return QualType();
@@ -3304,7 +3304,7 @@
QualType TreeTransform<Derived>::TransformIncompleteArrayType(
TypeLocBuilder &TLB,
IncompleteArrayTypeLoc TL) {
- IncompleteArrayType *T = TL.getTypePtr();
+ const IncompleteArrayType *T = TL.getTypePtr();
QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
if (ElementType.isNull())
return QualType();
@@ -3332,7 +3332,7 @@
QualType
TreeTransform<Derived>::TransformVariableArrayType(TypeLocBuilder &TLB,
VariableArrayTypeLoc TL) {
- VariableArrayType *T = TL.getTypePtr();
+ const VariableArrayType *T = TL.getTypePtr();
QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
if (ElementType.isNull())
return QualType();
@@ -3372,7 +3372,7 @@
QualType
TreeTransform<Derived>::TransformDependentSizedArrayType(TypeLocBuilder &TLB,
DependentSizedArrayTypeLoc TL) {
- DependentSizedArrayType *T = TL.getTypePtr();
+ const DependentSizedArrayType *T = TL.getTypePtr();
QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
if (ElementType.isNull())
return QualType();
@@ -3415,7 +3415,7 @@
QualType TreeTransform<Derived>::TransformDependentSizedExtVectorType(
TypeLocBuilder &TLB,
DependentSizedExtVectorTypeLoc TL) {
- DependentSizedExtVectorType *T = TL.getTypePtr();
+ const DependentSizedExtVectorType *T = TL.getTypePtr();
// FIXME: ext vector locs should be nested
QualType ElementType = getDerived().TransformType(T->getElementType());
@@ -3456,7 +3456,7 @@
template<typename Derived>
QualType TreeTransform<Derived>::TransformVectorType(TypeLocBuilder &TLB,
VectorTypeLoc TL) {
- VectorType *T = TL.getTypePtr();
+ const VectorType *T = TL.getTypePtr();
QualType ElementType = getDerived().TransformType(T->getElementType());
if (ElementType.isNull())
return QualType();
@@ -3479,7 +3479,7 @@
template<typename Derived>
QualType TreeTransform<Derived>::TransformExtVectorType(TypeLocBuilder &TLB,
ExtVectorTypeLoc TL) {
- VectorType *T = TL.getTypePtr();
+ const VectorType *T = TL.getTypePtr();
QualType ElementType = getDerived().TransformType(T->getElementType());
if (ElementType.isNull())
return QualType();
@@ -3733,7 +3733,7 @@
//
llvm::SmallVector<QualType, 4> ParamTypes;
llvm::SmallVector<ParmVarDecl*, 4> ParamDecls;
- FunctionProtoType *T = TL.getTypePtr();
+ const FunctionProtoType *T = TL.getTypePtr();
QualType ResultType;
@@ -3791,7 +3791,7 @@
QualType TreeTransform<Derived>::TransformFunctionNoProtoType(
TypeLocBuilder &TLB,
FunctionNoProtoTypeLoc TL) {
- FunctionNoProtoType *T = TL.getTypePtr();
+ const FunctionNoProtoType *T = TL.getTypePtr();
QualType ResultType = getDerived().TransformType(TLB, TL.getResultLoc());
if (ResultType.isNull())
return QualType();
@@ -3812,7 +3812,7 @@
template<typename Derived> QualType
TreeTransform<Derived>::TransformUnresolvedUsingType(TypeLocBuilder &TLB,
UnresolvedUsingTypeLoc TL) {
- UnresolvedUsingType *T = TL.getTypePtr();
+ const UnresolvedUsingType *T = TL.getTypePtr();
Decl *D = getDerived().TransformDecl(TL.getNameLoc(), T->getDecl());
if (!D)
return QualType();
@@ -3835,7 +3835,7 @@
template<typename Derived>
QualType TreeTransform<Derived>::TransformTypedefType(TypeLocBuilder &TLB,
TypedefTypeLoc TL) {
- TypedefType *T = TL.getTypePtr();
+ const TypedefType *T = TL.getTypePtr();
TypedefDecl *Typedef
= cast_or_null<TypedefDecl>(getDerived().TransformDecl(TL.getNameLoc(),
T->getDecl()));
@@ -3910,7 +3910,7 @@
template<typename Derived>
QualType TreeTransform<Derived>::TransformDecltypeType(TypeLocBuilder &TLB,
DecltypeTypeLoc TL) {
- DecltypeType *T = TL.getTypePtr();
+ const DecltypeType *T = TL.getTypePtr();
// decltype expressions are not potentially evaluated contexts
EnterExpressionEvaluationContext Unevaluated(SemaRef, Sema::Unevaluated);
@@ -3937,7 +3937,7 @@
template<typename Derived>
QualType TreeTransform<Derived>::TransformRecordType(TypeLocBuilder &TLB,
RecordTypeLoc TL) {
- RecordType *T = TL.getTypePtr();
+ const RecordType *T = TL.getTypePtr();
RecordDecl *Record
= cast_or_null<RecordDecl>(getDerived().TransformDecl(TL.getNameLoc(),
T->getDecl()));
@@ -3961,7 +3961,7 @@
template<typename Derived>
QualType TreeTransform<Derived>::TransformEnumType(TypeLocBuilder &TLB,
EnumTypeLoc TL) {
- EnumType *T = TL.getTypePtr();
+ const EnumType *T = TL.getTypePtr();
EnumDecl *Enum
= cast_or_null<EnumDecl>(getDerived().TransformDecl(TL.getNameLoc(),
T->getDecl()));
@@ -4136,7 +4136,7 @@
QualType
TreeTransform<Derived>::TransformElaboratedType(TypeLocBuilder &TLB,
ElaboratedTypeLoc TL) {
- ElaboratedType *T = TL.getTypePtr();
+ const ElaboratedType *T = TL.getTypePtr();
NestedNameSpecifier *NNS = 0;
// NOTE: the qualifier in an ElaboratedType is optional.
@@ -4230,7 +4230,7 @@
template<typename Derived>
QualType TreeTransform<Derived>::TransformDependentNameType(TypeLocBuilder &TLB,
DependentNameTypeLoc TL) {
- DependentNameType *T = TL.getTypePtr();
+ const DependentNameType *T = TL.getTypePtr();
NestedNameSpecifier *NNS
= getDerived().TransformNestedNameSpecifier(T->getQualifier(),
@@ -4267,7 +4267,7 @@
QualType TreeTransform<Derived>::
TransformDependentTemplateSpecializationType(TypeLocBuilder &TLB,
DependentTemplateSpecializationTypeLoc TL) {
- DependentTemplateSpecializationType *T = TL.getTypePtr();
+ const DependentTemplateSpecializationType *T = TL.getTypePtr();
NestedNameSpecifier *NNS
= getDerived().TransformNestedNameSpecifier(T->getQualifier(),
@@ -4284,7 +4284,7 @@
TransformDependentTemplateSpecializationType(TypeLocBuilder &TLB,
DependentTemplateSpecializationTypeLoc TL,
NestedNameSpecifier *NNS) {
- DependentTemplateSpecializationType *T = TL.getTypePtr();
+ const DependentTemplateSpecializationType *T = TL.getTypePtr();
TemplateArgumentListInfo NewTemplateArgs;
NewTemplateArgs.setLAngleLoc(TL.getLAngleLoc());
Modified: cfe/trunk/lib/Serialization/ASTReader.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=123814&r1=123813&r2=123814&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReader.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReader.cpp Wed Jan 19 00:33:43 2011
@@ -2922,7 +2922,7 @@
}
bool IsDependent = Record[0];
QualType T = Context->getRecordType(cast<RecordDecl>(GetDecl(Record[1])));
- T->setDependent(IsDependent);
+ const_cast<Type*>(T.getTypePtr())->setDependent(IsDependent);
return T;
}
@@ -2933,7 +2933,7 @@
}
bool IsDependent = Record[0];
QualType T = Context->getEnumType(cast<EnumDecl>(GetDecl(Record[1])));
- T->setDependent(IsDependent);
+ const_cast<Type*>(T.getTypePtr())->setDependent(IsDependent);
return T;
}
@@ -3093,7 +3093,7 @@
else
T = Context->getTemplateSpecializationType(Name, Args.data(),
Args.size(), Canon);
- T->setDependent(IsDependent);
+ const_cast<Type*>(T.getTypePtr())->setDependent(IsDependent);
return T;
}
}
@@ -4475,7 +4475,7 @@
case NestedNameSpecifier::TypeSpec:
case NestedNameSpecifier::TypeSpecWithTemplate: {
- Type *T = GetType(Record[Idx++]).getTypePtrOrNull();
+ const Type *T = GetType(Record[Idx++]).getTypePtrOrNull();
if (!T)
return 0;
Modified: cfe/trunk/lib/StaticAnalyzer/CXXExprEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/CXXExprEngine.cpp?rev=123814&r1=123813&r2=123814&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/CXXExprEngine.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/CXXExprEngine.cpp Wed Jan 19 00:33:43 2011
@@ -63,7 +63,7 @@
const CXXThisRegion *ExprEngine::getCXXThisRegion(const CXXRecordDecl *D,
const StackFrameContext *SFC) {
- Type *T = D->getTypeForDecl();
+ const Type *T = D->getTypeForDecl();
QualType PT = getContext().getPointerType(QualType(T, 0));
return svalBuilder.getRegionManager().getCXXThisRegion(PT, SFC);
}
Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/CastSizeChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/CastSizeChecker.cpp?rev=123814&r1=123813&r2=123814&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/CastSizeChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/CastSizeChecker.cpp Wed Jan 19 00:33:43 2011
@@ -38,7 +38,7 @@
const Expr *E = CE->getSubExpr();
ASTContext &Ctx = C.getASTContext();
QualType ToTy = Ctx.getCanonicalType(CE->getType());
- PointerType *ToPTy = dyn_cast<PointerType>(ToTy.getTypePtr());
+ const PointerType *ToPTy = dyn_cast<PointerType>(ToTy.getTypePtr());
if (!ToPTy)
return;
Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/CastToStructChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/CastToStructChecker.cpp?rev=123814&r1=123813&r2=123814&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/CastToStructChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/CastToStructChecker.cpp Wed Jan 19 00:33:43 2011
@@ -43,8 +43,8 @@
QualType OrigTy = Ctx.getCanonicalType(E->getType());
QualType ToTy = Ctx.getCanonicalType(CE->getType());
- PointerType *OrigPTy = dyn_cast<PointerType>(OrigTy.getTypePtr());
- PointerType *ToPTy = dyn_cast<PointerType>(ToTy.getTypePtr());
+ const PointerType *OrigPTy = dyn_cast<PointerType>(OrigTy.getTypePtr());
+ const PointerType *ToPTy = dyn_cast<PointerType>(ToTy.getTypePtr());
if (!ToPTy || !OrigPTy)
return;
Modified: cfe/trunk/lib/StaticAnalyzer/RegionStore.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/RegionStore.cpp?rev=123814&r1=123813&r2=123814&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/RegionStore.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/RegionStore.cpp Wed Jan 19 00:33:43 2011
@@ -801,7 +801,7 @@
// Strip off typedefs from the ArrayRegion's ValueType.
QualType T = ArrayR->getValueType().getDesugaredType(Ctx);
- ArrayType *AT = cast<ArrayType>(T);
+ const ArrayType *AT = cast<ArrayType>(T);
T = AT->getElementType();
NonLoc ZeroIdx = svalBuilder.makeZeroArrayIndex();
Modified: cfe/trunk/tools/libclang/CIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndex.cpp?rev=123814&r1=123813&r2=123814&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CIndex.cpp (original)
+++ cfe/trunk/tools/libclang/CIndex.cpp Wed Jan 19 00:33:43 2011
@@ -1172,7 +1172,7 @@
// If the type has a form where we know that the beginning of the source
// range matches up with a reference cursor. Visit the appropriate reference
// cursor.
- Type *T = NNS->getAsType();
+ const Type *T = NNS->getAsType();
if (const TypedefType *Typedef = dyn_cast<TypedefType>(T))
return Visit(MakeCursorTypeRef(Typedef->getDecl(), Range.getBegin(), TU));
if (const TagType *Tag = dyn_cast<TagType>(T))
Modified: cfe/trunk/tools/libclang/CXType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CXType.cpp?rev=123814&r1=123813&r2=123814&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CXType.cpp (original)
+++ cfe/trunk/tools/libclang/CXType.cpp Wed Jan 19 00:33:43 2011
@@ -64,7 +64,7 @@
}
static CXTypeKind GetTypeKind(QualType T) {
- Type *TP = T.getTypePtrOrNull();
+ const Type *TP = T.getTypePtrOrNull();
if (!TP)
return CXType_Invalid;
@@ -187,7 +187,7 @@
CXType clang_getPointeeType(CXType CT) {
QualType T = GetQualType(CT);
- Type *TP = T.getTypePtrOrNull();
+ const Type *TP = T.getTypePtrOrNull();
if (!TP)
return MakeCXType(QualType(), GetTU(CT));
@@ -218,7 +218,7 @@
return cxcursor::MakeCXCursorInvalid(CXCursor_NoDeclFound);
QualType T = GetQualType(CT);
- Type *TP = T.getTypePtrOrNull();
+ const Type *TP = T.getTypePtrOrNull();
if (!TP)
return cxcursor::MakeCXCursorInvalid(CXCursor_NoDeclFound);
More information about the cfe-commits
mailing list