[clang] f8b7506 - [clang][NFC] Move a variable into the closest scope

Timm Bäder via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 26 02:41:32 PDT 2023


Author: Timm Bäder
Date: 2023-10-26T11:40:43+02:00
New Revision: f8b7506e2db2a162deec8343d6942258484be233

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

LOG: [clang][NFC] Move a variable into the closest scope

AllocType is not used anywhere else.

Added: 
    

Modified: 
    clang/lib/AST/ExprConstant.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index eea0827d6f7a8a1..320e2ef12c38db3 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -6867,8 +6867,8 @@ static std::optional<DynAlloc *> CheckDeleteKind(EvalInfo &Info, const Expr *E,
     return std::nullopt;
   }
 
-  QualType AllocType = Pointer.Base.getDynamicAllocType();
   if (DeallocKind != (*Alloc)->getKind()) {
+    QualType AllocType = Pointer.Base.getDynamicAllocType();
     Info.FFDiag(E, diag::note_constexpr_new_delete_mismatch)
         << DeallocKind << (*Alloc)->getKind() << AllocType;
     NoteLValueLocation(Info, Pointer.Base);


        


More information about the cfe-commits mailing list