aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSterling Augustine <saugustine@google.com>2020-06-09 17:10:22 -0700
committerSterling Augustine <saugustine@google.com>2020-06-09 17:19:38 -0700
commitccd192204da45cc3f4b42f585f04c4f934b21bef (patch)
tree799e38288a6979b151de2632007943410cd01ece
parent938cc573ee1ae7fd628da0c2a9a0bcbc36c451e7 (diff)
downloadllvm-ccd192204da45cc3f4b42f585f04c4f934b21bef.zip
llvm-ccd192204da45cc3f4b42f585f04c4f934b21bef.tar.gz
llvm-ccd192204da45cc3f4b42f585f04c4f934b21bef.tar.bz2
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
-rw-r--r--clang/unittests/StaticAnalyzer/ParamRegionTest.cpp19
1 files changed, 8 insertions, 11 deletions
diff --git a/clang/unittests/StaticAnalyzer/ParamRegionTest.cpp b/clang/unittests/StaticAnalyzer/ParamRegionTest.cpp
index c58af3f..4edbeb3 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);
}
}