[PATCH] D81522: Fix variables used only in asserts.

Sterling Augustine via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 9 17:43:10 PDT 2020


This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rGccd192204da4: Fix variables used only in asserts. (authored by saugustine).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D81522/new/

https://reviews.llvm.org/D81522

Files:
  clang/unittests/StaticAnalyzer/ParamRegionTest.cpp


Index: clang/unittests/StaticAnalyzer/ParamRegionTest.cpp
===================================================================
--- clang/unittests/StaticAnalyzer/ParamRegionTest.cpp
+++ clang/unittests/StaticAnalyzer/ParamRegionTest.cpp
@@ -20,8 +20,8 @@
                                 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 @@
 
     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);
       }
     }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81522.269711.patch
Type: text/x-patch
Size: 2242 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200610/8c8936cc/attachment.bin>


More information about the cfe-commits mailing list