]> granicus.if.org Git - clang/commitdiff
Remove a const_cast by propagating constness to called functions
authorDmitri Gribenko <gribozavr@gmail.com>
Thu, 14 Feb 2013 13:53:30 +0000 (13:53 +0000)
committerDmitri Gribenko <gribozavr@gmail.com>
Thu, 14 Feb 2013 13:53:30 +0000 (13:53 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175161 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Sema/CodeCompleteConsumer.h
lib/Sema/SemaCodeComplete.cpp

index 17c8ee890d5dc158a4fdc32513ecf56244df447d..307dd57e109c2384b9c9c98522ad353f5065f49b 100644 (file)
@@ -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),
index 738e31ac57c0f5cb7d1174b9aaad2f1a9130dc7a..e145d3ff66da5c9d56b2f0b2572ec0025619749f 100644 (file)
@@ -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<CXXMethodDecl *>(*M);
+    const CXXMethodDecl *Overridden = *M;
     if (Overridden->getCanonicalDecl() == Method->getCanonicalDecl())
       continue;