[clang] ccd1922 - Fix variables used only in asserts.

Sterling Augustine via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 9 17:19:59 PDT 2020


Author: Sterling Augustine
Date: 2020-06-09T17:19:38-07:00
New Revision: ccd192204da45cc3f4b42f585f04c4f934b21bef

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

LOG: Fix variables used only in asserts.

Summary: Fix variables used only in asserts.

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D81522

Added: 
    

Modified: 
    clang/unittests/StaticAnalyzer/ParamRegionTest.cpp

Removed: 
    


################################################################################
diff  --git a/clang/unittests/StaticAnalyzer/ParamRegionTest.cpp b/clang/unittests/StaticAnalyzer/ParamRegionTest.cpp
index c58af3f851c4..4edbeb30df1c 100644
--- a/clang/unittests/StaticAnalyzer/ParamRegionTest.cpp
+++ b/clang/unittests/StaticAnalyzer/ParamRegionTest.cpp
@@ -20,8 +20,8 @@ class ParamRegionTestConsumer : public ExprEngineConsumer {
                                 const StackFrameContext *SFC,
                                 const ParmVarDecl *PVD) {
     for (const auto *D2: PVD->redecls()) {
-      const auto *PVD2 = cast<ParmVarDecl>(D2);
-      assert(MRMgr.getVarRegion(PVD, SFC) == MRMgr.getVarRegion(PVD2, SFC));
+      assert(MRMgr.getVarRegion(PVD, SFC) ==
+             MRMgr.getVarRegion(cast<ParmVarDecl>(D2), SFC));
     }
   }
 
@@ -33,29 +33,26 @@ class ParamRegionTestConsumer : public ExprEngineConsumer {
 
     if (const auto *FD = dyn_cast<FunctionDecl>(D)) {
       for (const auto *P : FD->parameters()) {
-        const TypedValueRegion *Reg = MRMgr.getVarRegion(P, SFC);
         if (SFC->inTopFrame())
-          assert(isa<NonParamVarRegion>(Reg));
+          assert(isa<NonParamVarRegion>(MRMgr.getVarRegion(P, SFC)));
         else
-          assert(isa<ParamVarRegion>(Reg));
+          assert(isa<ParamVarRegion>(MRMgr.getVarRegion(P, SFC)));
         checkForSameParamRegions(MRMgr, SFC, P);
       }
     } else if (const auto *CD = dyn_cast<CXXConstructorDecl>(D)) {
       for (const auto *P : CD->parameters()) {
-        const TypedValueRegion *Reg = MRMgr.getVarRegion(P, SFC);
         if (SFC->inTopFrame())
-          assert(isa<NonParamVarRegion>(Reg));
+          assert(isa<NonParamVarRegion>(MRMgr.getVarRegion(P, SFC)));
         else
-          assert(isa<ParamVarRegion>(Reg));
+          assert(isa<ParamVarRegion>(MRMgr.getVarRegion(P, SFC)));
         checkForSameParamRegions(MRMgr, SFC, P);
       }
     } else if (const auto *MD = dyn_cast<ObjCMethodDecl>(D)) {
       for (const auto *P : MD->parameters()) {
-        const TypedValueRegion *Reg = MRMgr.getVarRegion(P, SFC);
         if (SFC->inTopFrame())
-          assert(isa<NonParamVarRegion>(Reg));
+          assert(isa<NonParamVarRegion>(MRMgr.getVarRegion(P, SFC)));
         else
-          assert(isa<ParamVarRegion>(Reg));
+          assert(isa<ParamVarRegion>(MRMgr.getVarRegion(P, SFC)));
         checkForSameParamRegions(MRMgr, SFC, P);
       }
     }


        


More information about the cfe-commits mailing list