diff options
| author | John McCall <rjmccall@apple.com> | 2010-02-16 03:57:14 +0000 |
|---|---|---|
| committer | John McCall <rjmccall@apple.com> | 2010-02-16 03:57:14 +0000 |
| commit | 19c8576b7328f4dc2d07682f5da552875c1912ef (patch) | |
| tree | 58a9f7d18d952de3d8083e6a5baa70ec0148340f /include | |
| parent | fcd302b5e44e21fce82b5d78133c5c8ba6ed0727 (diff) | |
| download | clang-19c8576b7328f4dc2d07682f5da552875c1912ef.tar.gz clang-19c8576b7328f4dc2d07682f5da552875c1912ef.tar.bz2 clang-19c8576b7328f4dc2d07682f5da552875c1912ef.tar.xz | |
Make the various type-decl Types (and their associated ASTContext routines)
accept const decls.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96325 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
| -rw-r--r-- | include/clang/AST/ASTContext.h | 4 | ||||
| -rw-r--r-- | include/clang/AST/Type.h | 22 |
2 files changed, 14 insertions, 12 deletions
diff --git a/include/clang/AST/ASTContext.h b/include/clang/AST/ASTContext.h index b1842c9d42..2ed9fd7080 100644 --- a/include/clang/AST/ASTContext.h +++ b/include/clang/AST/ASTContext.h @@ -537,11 +537,11 @@ public: /// getTypeDeclType - Return the unique reference to the type for /// the specified type declaration. - QualType getTypeDeclType(TypeDecl *Decl, TypeDecl* PrevDecl=0); + QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl* PrevDecl=0); /// getTypedefType - Return the unique reference to the type for the /// specified typename decl. - QualType getTypedefType(TypedefDecl *Decl); + QualType getTypedefType(const TypedefDecl *Decl); QualType getSubstTemplateTypeParmType(const TemplateTypeParmType *Replaced, QualType Replacement); diff --git a/include/clang/AST/Type.h b/include/clang/AST/Type.h index 2fe041f5e7..40e50988e6 100644 --- a/include/clang/AST/Type.h +++ b/include/clang/AST/Type.h @@ -1922,8 +1922,9 @@ public: class UnresolvedUsingType : public Type { UnresolvedUsingTypenameDecl *Decl; - UnresolvedUsingType(UnresolvedUsingTypenameDecl *D) - : Type(UnresolvedUsing, QualType(), true), Decl(D) {} + UnresolvedUsingType(const UnresolvedUsingTypenameDecl *D) + : Type(UnresolvedUsing, QualType(), true), + Decl(const_cast<UnresolvedUsingTypenameDecl*>(D)) {} friend class ASTContext; // ASTContext creates these. public: @@ -1950,8 +1951,9 @@ public: class TypedefType : public Type { TypedefDecl *Decl; protected: - TypedefType(TypeClass tc, TypedefDecl *D, QualType can) - : Type(tc, can, can->isDependentType()), Decl(D) { + TypedefType(TypeClass tc, const TypedefDecl *D, QualType can) + : Type(tc, can, can->isDependentType()), + Decl(const_cast<TypedefDecl*>(D)) { assert(!isa<TypedefType>(can) && "Invalid canonical type"); } friend class ASTContext; // ASTContext creates these. @@ -2100,7 +2102,7 @@ class TagType : public Type { friend class TagDecl; protected: - TagType(TypeClass TC, TagDecl *D, QualType can); + TagType(TypeClass TC, const TagDecl *D, QualType can); public: TagDecl *getDecl() const { return decl.getPointer(); } @@ -2124,10 +2126,10 @@ public: /// to detect TagType objects of structs/unions/classes. class RecordType : public TagType { protected: - explicit RecordType(RecordDecl *D) - : TagType(Record, reinterpret_cast<TagDecl*>(D), QualType()) { } + explicit RecordType(const RecordDecl *D) + : TagType(Record, reinterpret_cast<const TagDecl*>(D), QualType()) { } explicit RecordType(TypeClass TC, RecordDecl *D) - : TagType(TC, reinterpret_cast<TagDecl*>(D), QualType()) { } + : TagType(TC, reinterpret_cast<const TagDecl*>(D), QualType()) { } friend class ASTContext; // ASTContext creates these. public: @@ -2157,8 +2159,8 @@ public: /// EnumType - This is a helper class that allows the use of isa/cast/dyncast /// to detect TagType objects of enums. class EnumType : public TagType { - explicit EnumType(EnumDecl *D) - : TagType(Enum, reinterpret_cast<TagDecl*>(D), QualType()) { } + explicit EnumType(const EnumDecl *D) + : TagType(Enum, reinterpret_cast<const TagDecl*>(D), QualType()) { } friend class ASTContext; // ASTContext creates these. public: |
