[clang] f8c9947 - [clang][Interp][NFC] Move dyn_cast check into if condition

Timm Bäder via cfe-commits cfe-commits at lists.llvm.org
Wed May 17 01:28:00 PDT 2023


Author: Timm Bäder
Date: 2023-05-17T10:27:44+02:00
New Revision: f8c99477d4b3e8c9faf0f316178e8ab92e281602

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

LOG: [clang][Interp][NFC] Move dyn_cast check into if condition

M is not used anywhere else.

Added: 
    

Modified: 
    clang/lib/AST/Interp/InterpFrame.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/Interp/InterpFrame.cpp b/clang/lib/AST/Interp/InterpFrame.cpp
index a8c4aab84ef8d..6acfbd3fa6143 100644
--- a/clang/lib/AST/Interp/InterpFrame.cpp
+++ b/clang/lib/AST/Interp/InterpFrame.cpp
@@ -147,8 +147,8 @@ void print(llvm::raw_ostream &OS, const Pointer &P, ASTContext &Ctx,
 
 void InterpFrame::describe(llvm::raw_ostream &OS) {
   const FunctionDecl *F = getCallee();
-  auto *M = dyn_cast<CXXMethodDecl>(F);
-  if (M && M->isInstance() && !isa<CXXConstructorDecl>(F)) {
+  if (const auto *M = dyn_cast<CXXMethodDecl>(F);
+      M && M->isInstance() && !isa<CXXConstructorDecl>(F)) {
     print(OS, This, S.getCtx(), S.getCtx().getRecordType(M->getParent()));
     OS << "->";
   }


        


More information about the cfe-commits mailing list