From: Henry Wong Date: Wed, 30 May 2018 11:46:45 +0000 (+0000) Subject: [analyzer] Remove the redundant check about same state transition in `ArrayBoundCheck... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c6bd6cda63ff7f14021b205670609d5971943986;p=clang [analyzer] Remove the redundant check about same state transition in `ArrayBoundCheckerV2.cpp`. Summary: Since the `addTransitionImpl()` has a check about same state transition, there is no need to check it in `ArrayBoundCheckerV2.cpp`. Reviewers: NoQ, xazax.hun, george.karpenkov Reviewed By: NoQ Subscribers: szepet, rnkovacs, a.sidorin, cfe-commits, MTC Differential Revision: https://reviews.llvm.org/D47451 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333531 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/StaticAnalyzer/Checkers/ArrayBoundCheckerV2.cpp b/lib/StaticAnalyzer/Checkers/ArrayBoundCheckerV2.cpp index ebe9f99f96..933380d494 100644 --- a/lib/StaticAnalyzer/Checkers/ArrayBoundCheckerV2.cpp +++ b/lib/StaticAnalyzer/Checkers/ArrayBoundCheckerV2.cpp @@ -125,7 +125,6 @@ void ArrayBoundCheckerV2::checkLocation(SVal location, bool isLoad, // have some flexibility in defining the base region, we can achieve // various levels of conservatism in our buffer overflow checking. ProgramStateRef state = checkerContext.getState(); - ProgramStateRef originalState = state; SValBuilder &svalBuilder = checkerContext.getSValBuilder(); const RegionRawOffsetV2 &rawOffset = @@ -224,8 +223,7 @@ void ArrayBoundCheckerV2::checkLocation(SVal location, bool isLoad, } while (false); - if (state != originalState) - checkerContext.addTransition(state); + checkerContext.addTransition(state); } void ArrayBoundCheckerV2::reportOOB(