[clang] d343913 - [Analysis] Remove a redundant cast. (#168214)
via cfe-commits
cfe-commits at lists.llvm.org
Sat Nov 15 10:54:12 PST 2025
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,
More information about the cfe-commits
mailing list