diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2008-10-12 18:40:01 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2008-10-12 18:40:01 +0000 |
commit | d2595ecce5f8350e485c83bfe767549a522b2802 (patch) | |
tree | 80331aca2907d4c4f8d8d6dd27a40a5b82dc459e /lib | |
parent | 42220c5432c141d47cc8ce786e472b49dc907378 (diff) |
Improve the const-ness of a few methods.
No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57417 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/AST/DeclBase.cpp | 6 | ||||
-rw-r--r-- | lib/AST/DeclCXX.cpp | 3 |
2 files changed, 5 insertions, 4 deletions
diff --git a/lib/AST/DeclBase.cpp b/lib/AST/DeclBase.cpp index 1ea545ba5d..265913ccc0 100644 --- a/lib/AST/DeclBase.cpp +++ b/lib/AST/DeclBase.cpp @@ -344,10 +344,10 @@ DeclContext *Decl::castToDeclContext(const Decl *D) { // DeclContext Implementation //===----------------------------------------------------------------------===// -DeclContext *DeclContext::getParent() const { - if (const ScopedDecl *SD = dyn_cast<ScopedDecl>(this)) +DeclContext *DeclContext::getParent() { + if (ScopedDecl *SD = dyn_cast<ScopedDecl>(this)) return SD->getDeclContext(); - else if (const BlockDecl *BD = dyn_cast<BlockDecl>(this)) + else if (BlockDecl *BD = dyn_cast<BlockDecl>(this)) return BD->getParentContext(); else return NULL; diff --git a/lib/AST/DeclCXX.cpp b/lib/AST/DeclCXX.cpp index 0a65ab34f0..3f937914ad 100644 --- a/lib/AST/DeclCXX.cpp +++ b/lib/AST/DeclCXX.cpp @@ -54,7 +54,8 @@ CXXMethodDecl::Create(ASTContext &C, CXXRecordDecl *RD, QualType CXXMethodDecl::getThisType(ASTContext &C) const { assert(isInstance() && "No 'this' for static methods!"); - QualType ClassTy = C.getTagDeclType(cast<CXXRecordDecl>(getParent())); + QualType ClassTy = C.getTagDeclType(const_cast<CXXRecordDecl*>( + cast<CXXRecordDecl>(getParent()))); QualType ThisTy = C.getPointerType(ClassTy); ThisTy.addConst(); return ThisTy; |