From 6cfb1537b62470b424fae8a9b64ddfa85092359a Mon Sep 17 00:00:00 2001 From: Dmitri Gribenko Date: Thu, 14 Feb 2013 13:53:30 +0000 Subject: [PATCH] Remove a const_cast by propagating constness to called functions llvm-svn: 175161 --- clang/include/clang/Sema/CodeCompleteConsumer.h | 2 +- clang/lib/Sema/SemaCodeComplete.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/clang/include/clang/Sema/CodeCompleteConsumer.h b/clang/include/clang/Sema/CodeCompleteConsumer.h index 17c8ee890d5d..307dd57e109c 100644 --- a/clang/include/clang/Sema/CodeCompleteConsumer.h +++ b/clang/include/clang/Sema/CodeCompleteConsumer.h @@ -745,7 +745,7 @@ public: unsigned Priority = CCP_CodePattern, CXCursorKind CursorKind = CXCursor_NotImplemented, CXAvailabilityKind Availability = CXAvailability_Available, - NamedDecl *D = 0) + const NamedDecl *D = 0) : Declaration(D), Pattern(Pattern), Priority(Priority), StartParameter(0), Kind(RK_Pattern), CursorKind(CursorKind), Availability(Availability), Hidden(false), QualifierIsInformative(0), diff --git a/clang/lib/Sema/SemaCodeComplete.cpp b/clang/lib/Sema/SemaCodeComplete.cpp index 738e31ac57c0..e145d3ff66da 100644 --- a/clang/lib/Sema/SemaCodeComplete.cpp +++ b/clang/lib/Sema/SemaCodeComplete.cpp @@ -315,7 +315,7 @@ namespace { void ExitScope(); /// \brief Ignore this declaration, if it is seen again. - void Ignore(Decl *D) { AllDeclsFound.insert(D->getCanonicalDecl()); } + void Ignore(const Decl *D) { AllDeclsFound.insert(D->getCanonicalDecl()); } /// \name Name lookup predicates /// @@ -3094,7 +3094,7 @@ static void MaybeAddOverrideCalls(Sema &S, DeclContext *InContext, M != MEnd; ++M) { CodeCompletionBuilder Builder(Results.getAllocator(), Results.getCodeCompletionTUInfo()); - CXXMethodDecl *Overridden = const_cast(*M); + const CXXMethodDecl *Overridden = *M; if (Overridden->getCanonicalDecl() == Method->getCanonicalDecl()) continue;