Author: Kazu Hirata
Date: 2025-11-15T10:54:09-08:00
New Revision: d3439138e158541b65f3d759f5071a445d3297f2

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

LOG: [Analysis] Remove a redundant cast. (#168214)

callOperatorDecl is already of type FunctionDecl *.

Identified with readability-redundant-casting.

Added: 
    

Modified: 
    clang/lib/Analysis/BodyFarm.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Analysis/BodyFarm.cpp b/clang/lib/Analysis/BodyFarm.cpp
index c5f35b35ad357..94ab69acef13e 100644
--- a/clang/lib/Analysis/BodyFarm.cpp
+++ b/clang/lib/Analysis/BodyFarm.cpp
@@ -293,15 +293,14 @@ static CallExpr *create_call_once_lambda_call(ASTContext 
&C, ASTMaker M,
   FunctionDecl *callOperatorDecl = CallbackDecl->getLambdaCallOperator();
   assert(callOperatorDecl != nullptr);
 
-  DeclRefExpr *callOperatorDeclRef =
-      DeclRefExpr::Create(/* Ctx =*/ C,
-                          /* QualifierLoc =*/ NestedNameSpecifierLoc(),
-                          /* TemplateKWLoc =*/ SourceLocation(),
-                          const_cast<FunctionDecl *>(callOperatorDecl),
-                          /* RefersToEnclosingVariableOrCapture=*/ false,
-                          /* NameLoc =*/ SourceLocation(),
-                          /* T =*/ callOperatorDecl->getType(),
-                          /* VK =*/ VK_LValue);
+  DeclRefExpr *callOperatorDeclRef = DeclRefExpr::Create(
+      /* Ctx =*/C,
+      /* QualifierLoc =*/NestedNameSpecifierLoc(),
+      /* TemplateKWLoc =*/SourceLocation(), callOperatorDecl,
+      /* RefersToEnclosingVariableOrCapture=*/false,
+      /* NameLoc =*/SourceLocation(),
+      /* T =*/callOperatorDecl->getType(),
+      /* VK =*/VK_LValue);
 
   return CXXOperatorCallExpr::Create(
       /*AstContext=*/C, OO_Call, callOperatorDeclRef,


        
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to