diff options
author | Dmitri Gribenko <gribozavr@gmail.com> | 2012-11-03 14:24:57 +0000 |
---|---|---|
committer | Dmitri Gribenko <gribozavr@gmail.com> | 2012-11-03 14:24:57 +0000 |
commit | 1e905da74dbfd353d77dfc548fc9d6ff420d515a (patch) | |
tree | 8479aa6ed4b3de965df5b1ba1ae1d1871d87eacc /lib/AST/ASTContext.cpp | |
parent | 0a591c242b867844d483091cae546e294bbee312 (diff) |
Remove a const_cast by propagating constness to the member function.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167357 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/ASTContext.cpp')
-rw-r--r-- | lib/AST/ASTContext.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index 71764dbd97..2f7288109c 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -411,13 +411,12 @@ comments::FullComment *ASTContext::getCommentForDecl( const RawComment *RC = getRawCommentForAnyRedecl(D, &OriginalDecl); if (!RC) { if (isa<ObjCMethodDecl>(D) || isa<FunctionDecl>(D)) { - SmallVector<const NamedDecl*, 8> overridden; + SmallVector<const NamedDecl*, 8> Overridden; if (const ObjCMethodDecl *OMD = dyn_cast<ObjCMethodDecl>(D)) - addRedeclaredMethods(OMD, overridden); - const_cast<ASTContext *>(this)->getOverriddenMethods(dyn_cast<NamedDecl>(D), - overridden); - for (unsigned i = 0, e = overridden.size(); i < e; i++) { - if (comments::FullComment *FC = getCommentForDecl(overridden[i], PP)) { + addRedeclaredMethods(OMD, Overridden); + getOverriddenMethods(dyn_cast<NamedDecl>(D), Overridden); + for (unsigned i = 0, e = Overridden.size(); i < e; i++) { + if (comments::FullComment *FC = getCommentForDecl(Overridden[i], PP)) { comments::FullComment *CFC = cloneFullComment(FC, D); return CFC; } @@ -1082,8 +1081,9 @@ void ASTContext::addOverriddenMethod(const CXXMethodDecl *Method, OverriddenMethods[Method].push_back(Overridden); } -void ASTContext::getOverriddenMethods(const NamedDecl *D, - SmallVectorImpl<const NamedDecl *> &Overridden) { +void ASTContext::getOverriddenMethods( + const NamedDecl *D, + SmallVectorImpl<const NamedDecl *> &Overridden) const { assert(D); if (const CXXMethodDecl *CXXMethod = dyn_cast<CXXMethodDecl>(D)) { |