[clang] 3d8a44d - [clang][Interp][NFC] Refactor if condition
    Timm Bäder via cfe-commits 
    cfe-commits at lists.llvm.org
       
    Thu May  2 04:47:05 PDT 2024
    
    
  
Author: Timm Bäder
Date: 2024-05-02T13:43:06+02:00
New Revision: 3d8a44d542b15ac9bc21f9fd3494f1649fca1aa9
URL: https://github.com/llvm/llvm-project/commit/3d8a44d542b15ac9bc21f9fd3494f1649fca1aa9
DIFF: https://github.com/llvm/llvm-project/commit/3d8a44d542b15ac9bc21f9fd3494f1649fca1aa9.diff
LOG: [clang][Interp][NFC] Refactor if condition
Move the declaration into the condition.
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 ba957546473e98..515b1f5fde1aa7 100644
--- a/clang/lib/AST/Interp/InterpFrame.cpp
+++ b/clang/lib/AST/Interp/InterpFrame.cpp
@@ -209,10 +209,8 @@ Pointer InterpFrame::getLocalPointer(unsigned Offset) const {
 
 Pointer InterpFrame::getParamPointer(unsigned Off) {
   // Return the block if it was created previously.
-  auto Pt = Params.find(Off);
-  if (Pt != Params.end()) {
+  if (auto Pt = Params.find(Off); Pt != Params.end())
     return Pointer(reinterpret_cast<Block *>(Pt->second.get()));
-  }
 
   // Allocate memory to store the parameter and the block metadata.
   const auto &Desc = Func->getParamDescriptor(Off);
        
    
    
More information about the cfe-commits
mailing list