[clang] 30d0850 - [clang][NFC] Improve const-correctness in `ParseLexedMethodDeclaration`

Vlad Serebrennikov via cfe-commits cfe-commits at lists.llvm.org
Fri May 17 07:15:51 PDT 2024


Author: Vlad Serebrennikov
Date: 2024-05-17T17:15:44+03:00
New Revision: 30d0850e0f780b17a37522e6503c98ebe197c5fa

URL: https://github.com/llvm/llvm-project/commit/30d0850e0f780b17a37522e6503c98ebe197c5fa
DIFF: https://github.com/llvm/llvm-project/commit/30d0850e0f780b17a37522e6503c98ebe197c5fa.diff

LOG: [clang][NFC] Improve const-correctness in `ParseLexedMethodDeclaration`

Added: 
    

Modified: 
    clang/lib/Parse/ParseCXXInlineMethods.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Parse/ParseCXXInlineMethods.cpp b/clang/lib/Parse/ParseCXXInlineMethods.cpp
index a26568dfd6aae..943ce0fdde3a3 100644
--- a/clang/lib/Parse/ParseCXXInlineMethods.cpp
+++ b/clang/lib/Parse/ParseCXXInlineMethods.cpp
@@ -466,14 +466,14 @@ void Parser::ParseLexedMethodDeclaration(LateParsedMethodDeclaration &LM) {
         ConsumeAnyToken();
     } else if (HasUnparsed) {
       assert(Param->hasInheritedDefaultArg());
-      const FunctionDecl *Old;
+      FunctionDecl *Old;
       if (const auto *FunTmpl = dyn_cast<FunctionTemplateDecl>(LM.Method))
         Old =
             cast<FunctionDecl>(FunTmpl->getTemplatedDecl())->getPreviousDecl();
       else
         Old = cast<FunctionDecl>(LM.Method)->getPreviousDecl();
       if (Old) {
-        ParmVarDecl *OldParam = const_cast<ParmVarDecl*>(Old->getParamDecl(I));
+        ParmVarDecl *OldParam = Old->getParamDecl(I);
         assert(!OldParam->hasUnparsedDefaultArg());
         if (OldParam->hasUninstantiatedDefaultArg())
           Param->setUninstantiatedDefaultArg(


        


More information about the cfe-commits mailing list