diff options
author | Jay Foad <jay.foad@gmail.com> | 2011-01-12 09:06:06 +0000 |
---|---|---|
committer | Jay Foad <jay.foad@gmail.com> | 2011-01-12 09:06:06 +0000 |
commit | 39c7980772fd980ff06384453d0df1c25ed4fe7e (patch) | |
tree | 03b3de9c2e0547301263cf88e9a498c7bbb68ddc /clang/lib/AST/DeclCXX.cpp | |
parent | ebbeb792345cf5ef490f2a8d75d1e271082ef457 (diff) | |
download | bcm5719-llvm-39c7980772fd980ff06384453d0df1c25ed4fe7e.tar.gz bcm5719-llvm-39c7980772fd980ff06384453d0df1c25ed4fe7e.zip |
PR3558: mark "logically const" accessor methods in ASTContext as const,
and mark the fields they use as mutable. This allows us to remove a few
const_casts.
llvm-svn: 123314
Diffstat (limited to 'clang/lib/AST/DeclCXX.cpp')
-rw-r--r-- | clang/lib/AST/DeclCXX.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/clang/lib/AST/DeclCXX.cpp b/clang/lib/AST/DeclCXX.cpp index 0d55b51778a..72d522debb7 100644 --- a/clang/lib/AST/DeclCXX.cpp +++ b/clang/lib/AST/DeclCXX.cpp @@ -48,9 +48,9 @@ CXXRecordDecl::CXXRecordDecl(Kind K, TagKind TK, DeclContext *DC, DefinitionData(PrevDecl ? PrevDecl->DefinitionData : 0), TemplateOrInstantiation() { } -CXXRecordDecl *CXXRecordDecl::Create(ASTContext &C, TagKind TK, DeclContext *DC, - SourceLocation L, IdentifierInfo *Id, - SourceLocation TKL, +CXXRecordDecl *CXXRecordDecl::Create(const ASTContext &C, TagKind TK, + DeclContext *DC, SourceLocation L, + IdentifierInfo *Id, SourceLocation TKL, CXXRecordDecl* PrevDecl, bool DelayTypeCreation) { CXXRecordDecl* R = new (C) CXXRecordDecl(CXXRecord, TK, DC, L, Id, @@ -62,7 +62,7 @@ CXXRecordDecl *CXXRecordDecl::Create(ASTContext &C, TagKind TK, DeclContext *DC, return R; } -CXXRecordDecl *CXXRecordDecl::Create(ASTContext &C, EmptyShell Empty) { +CXXRecordDecl *CXXRecordDecl::Create(const ASTContext &C, EmptyShell Empty) { return new (C) CXXRecordDecl(CXXRecord, TTK_Struct, 0, SourceLocation(), 0, 0, SourceLocation()); } @@ -214,7 +214,7 @@ bool CXXRecordDecl::hasAnyDependentBases() const { return !forallBases(SawBase, 0); } -bool CXXRecordDecl::hasConstCopyConstructor(ASTContext &Context) const { +bool CXXRecordDecl::hasConstCopyConstructor(const ASTContext &Context) const { return getCopyConstructor(Context, Qualifiers::Const) != 0; } @@ -241,7 +241,7 @@ GetBestOverloadCandidateSimple( return Cands[Best].first; } -CXXConstructorDecl *CXXRecordDecl::getCopyConstructor(ASTContext &Context, +CXXConstructorDecl *CXXRecordDecl::getCopyConstructor(const ASTContext &Context, unsigned TypeQuals) const{ QualType ClassType = Context.getTypeDeclType(const_cast<CXXRecordDecl*>(this)); |