[clang] d63c8be - [clang][ExprConst] Remove unnecessary cast

Timm Bäder via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 8 06:30:45 PST 2024


Author: Timm Bäder
Date: 2024-02-08T15:30:24+01:00
New Revision: d63c8bee58b5d4dad9f1c550a342e782e0038f28

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

LOG: [clang][ExprConst] Remove unnecessary cast

FD is a FunctionDecl, so no need to cast a FunctionDecl to a
CXXMethodDecl just to assign it to a FunctionDecl.

Added: 
    

Modified: 
    clang/lib/AST/ExprConstant.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index 089bc2094567f..02e153ff10737 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -8006,7 +8006,8 @@ class ExprEvaluatorBase
           assert(CorrespondingCallOpSpecialization &&
                  "We must always have a function call operator specialization "
                  "that corresponds to our static invoker specialization");
-          FD = cast<CXXMethodDecl>(CorrespondingCallOpSpecialization);
+          assert(isa<CXXMethodDecl>(CorrespondingCallOpSpecialization));
+          FD = CorrespondingCallOpSpecialization;
         } else
           FD = LambdaCallOp;
       } else if (FD->isReplaceableGlobalAllocationFunction()) {


        


More information about the cfe-commits mailing list