[clang] efc76a1 - [analyzer] Silence GCC warnings about unused variables. NFC.

Martin Storsjö via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 29 03:26:47 PDT 2022


Author: Martin Storsjö
Date: 2022-08-29T13:26:13+03:00
New Revision: efc76a1ac5f910776091a48947ca1e90e9068845

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

LOG: [analyzer] Silence GCC warnings about unused variables. NFC.

Use `isa<T>()` instead of `Type *Var = dyn_cast<T>()`
when the result of the cast isn't used.

Added: 
    

Modified: 
    clang/lib/StaticAnalyzer/Core/ExprEngine.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
index 586e89ef2a174..656a7c1fe590a 100644
--- a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
+++ b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
@@ -1217,7 +1217,7 @@ void ExprEngine::ProcessAutomaticObjDtor(const CFGAutomaticObjDtor Dtor,
   }
 
   unsigned Idx = 0;
-  if (const auto *AT = dyn_cast<ArrayType>(varType)) {
+  if (isa<ArrayType>(varType)) {
     SVal ElementCount;
     std::tie(state, Idx) = prepareStateForArrayDestruction(
         state, Region, varType, LCtx, &ElementCount);
@@ -1368,7 +1368,7 @@ void ExprEngine::ProcessMemberDtor(const CFGMemberDtor D,
   SVal FieldVal = State->getLValue(Member, ThisLoc);
 
   unsigned Idx = 0;
-  if (const auto *AT = dyn_cast<ArrayType>(T)) {
+  if (isa<ArrayType>(T)) {
     SVal ElementCount;
     std::tie(State, Idx) = prepareStateForArrayDestruction(
         State, FieldVal.getAsRegion(), T, LCtx, &ElementCount);


        


More information about the cfe-commits mailing list