[PATCH] D26644: [analyzer] Rename assumeWithinInclusiveRange*()
ddcc updated this revision to Diff 77930. ddcc added a comment. Fix formatting https://reviews.llvm.org/D26644 Files: include/clang/StaticAnalyzer/Core/PathSensitive/ConstraintManager.h include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp lib/StaticAnalyzer/Core/ExprEngine.cpp lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp lib/StaticAnalyzer/Core/SimpleConstraintManager.h Index: lib/StaticAnalyzer/Core/SimpleConstraintManager.h === --- lib/StaticAnalyzer/Core/SimpleConstraintManager.h +++ lib/StaticAnalyzer/Core/SimpleConstraintManager.h @@ -38,7 +38,7 @@ ProgramStateRef assume(ProgramStateRef state, NonLoc Cond, bool Assumption); - ProgramStateRef assumeWithinInclusiveRange(ProgramStateRef State, + ProgramStateRef assumeInclusiveRange(ProgramStateRef State, NonLoc Value, const llvm::APSInt , const llvm::APSInt , Index: lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp === --- lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp +++ lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp @@ -190,7 +190,7 @@ } // end switch } -ProgramStateRef SimpleConstraintManager::assumeWithinInclusiveRange( +ProgramStateRef SimpleConstraintManager::assumeInclusiveRange( ProgramStateRef State, NonLoc Value, const llvm::APSInt , const llvm::APSInt , bool InRange) { @@ -207,7 +207,7 @@ switch (Value.getSubKind()) { default: -llvm_unreachable("'assumeWithinInclusiveRange' is not implemented" +llvm_unreachable("'assumeInclusiveRange' is not implemented" "for this NonLoc"); case nonloc::LocAsIntegerKind: Index: lib/StaticAnalyzer/Core/ExprEngine.cpp === --- lib/StaticAnalyzer/Core/ExprEngine.cpp +++ lib/StaticAnalyzer/Core/ExprEngine.cpp @@ -1836,7 +1836,7 @@ ProgramStateRef StateCase; if (Optional NL = CondV.getAs()) std::tie(StateCase, DefaultSt) = - DefaultSt->assumeWithinInclusiveRange(*NL, V1, V2); + DefaultSt->assumeInclusiveRange(*NL, V1, V2); else // UnknownVal StateCase = DefaultSt; Index: lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp === --- lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp +++ lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp @@ -254,7 +254,7 @@ const llvm::APSInt = BVF.getValue(R[I].first, T); const llvm::APSInt = BVF.getValue(R[I].second, T); assert(Min <= Max); - State = CM.assumeWithinInclusiveRange(State, *N, Min, Max, false); + State = CM.assumeInclusiveRange(State, *N, Min, Max, false); if (!State) break; } @@ -288,24 +288,24 @@ const llvm::APSInt = BVF.getValue(R[0].first - 1ULL, T); if (Left != PlusInf) { assert(MinusInf <= Left); - State = CM.assumeWithinInclusiveRange(State, *N, MinusInf, Left, false); + State = CM.assumeInclusiveRange(State, *N, MinusInf, Left, false); if (!State) return nullptr; } const llvm::APSInt = BVF.getValue(R[E - 1].second + 1ULL, T); if (Right != MinusInf) { assert(Right <= PlusInf); - State = CM.assumeWithinInclusiveRange(State, *N, Right, PlusInf, false); + State = CM.assumeInclusiveRange(State, *N, Right, PlusInf, false); if (!State) return nullptr; } for (size_t I = 1; I != E; ++I) { const llvm::APSInt = BVF.getValue(R[I - 1].second + 1ULL, T); const llvm::APSInt = BVF.getValue(R[I].first - 1ULL, T); assert(Min <= Max); - State = CM.assumeWithinInclusiveRange(State, *N, Min, Max, false); + State = CM.assumeInclusiveRange(State, *N, Min, Max, false); if (!State) return nullptr; } Index: include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h === --- include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h +++ include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h @@ -98,18 +98,18 @@ /// This ctor is used when creating the first ProgramState object. ProgramState(ProgramStateManager *mgr, const Environment& env, StoreRef st, GenericDataMap gdm); - + /// Copy ctor - We must explicitly define this or else the "Next" ptr /// in FoldingSetNode will also get copied. ProgramState(const ProgramState ); - + ~ProgramState(); /// Return the ProgramStateManager associated with this state. ProgramStateManager () const { return *stateMgr; } - + /// Return the ConstraintManager. ConstraintManager ()
[PATCH] D26644: [analyzer] Rename assumeWithinInclusiveRange*()
dcoughlin accepted this revision. dcoughlin added a comment. This revision is now accepted and ready to land. LGTM, other then some indentation issues for arguments and parameters after the rename. Please fix those and commit! And thanks for splitting this up. Comment at: include/clang/StaticAnalyzer/Core/PathSensitive/ConstraintManager.h:103 + virtual ProgramStateRef assumeInclusiveRange(ProgramStateRef State, NonLoc Value, const llvm::APSInt , Nit: The indentation here (and elsewhere) is off after the rename. https://reviews.llvm.org/D26644 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26644: [analyzer] Rename assumeWithinInclusiveRange*()
ddcc created this revision. ddcc added reviewers: zaks.anna, dcoughlin. ddcc added a subscriber: cfe-commits. The name is slightly confusing, since the constraint is not necessarily within the range unless `Assumption` is true. Split out renaming for ConstraintManager.h from https://reviews.llvm.org/D26061 https://reviews.llvm.org/D26644 Files: include/clang/StaticAnalyzer/Core/PathSensitive/ConstraintManager.h include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp lib/StaticAnalyzer/Core/ExprEngine.cpp lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp lib/StaticAnalyzer/Core/SimpleConstraintManager.h Index: lib/StaticAnalyzer/Core/SimpleConstraintManager.h === --- lib/StaticAnalyzer/Core/SimpleConstraintManager.h +++ lib/StaticAnalyzer/Core/SimpleConstraintManager.h @@ -38,7 +38,7 @@ ProgramStateRef assume(ProgramStateRef state, NonLoc Cond, bool Assumption); - ProgramStateRef assumeWithinInclusiveRange(ProgramStateRef State, + ProgramStateRef assumeInclusiveRange(ProgramStateRef State, NonLoc Value, const llvm::APSInt , const llvm::APSInt , Index: lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp === --- lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp +++ lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp @@ -190,7 +190,7 @@ } // end switch } -ProgramStateRef SimpleConstraintManager::assumeWithinInclusiveRange( +ProgramStateRef SimpleConstraintManager::assumeInclusiveRange( ProgramStateRef State, NonLoc Value, const llvm::APSInt , const llvm::APSInt , bool InRange) { @@ -207,7 +207,7 @@ switch (Value.getSubKind()) { default: -llvm_unreachable("'assumeWithinInclusiveRange' is not implemented" +llvm_unreachable("'assumeInclusiveRange' is not implemented" "for this NonLoc"); case nonloc::LocAsIntegerKind: Index: lib/StaticAnalyzer/Core/ExprEngine.cpp === --- lib/StaticAnalyzer/Core/ExprEngine.cpp +++ lib/StaticAnalyzer/Core/ExprEngine.cpp @@ -1836,7 +1836,7 @@ ProgramStateRef StateCase; if (Optional NL = CondV.getAs()) std::tie(StateCase, DefaultSt) = - DefaultSt->assumeWithinInclusiveRange(*NL, V1, V2); + DefaultSt->assumeInclusiveRange(*NL, V1, V2); else // UnknownVal StateCase = DefaultSt; Index: lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp === --- lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp +++ lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp @@ -254,7 +254,7 @@ const llvm::APSInt = BVF.getValue(R[I].first, T); const llvm::APSInt = BVF.getValue(R[I].second, T); assert(Min <= Max); - State = CM.assumeWithinInclusiveRange(State, *N, Min, Max, false); + State = CM.assumeInclusiveRange(State, *N, Min, Max, false); if (!State) break; } @@ -288,24 +288,24 @@ const llvm::APSInt = BVF.getValue(R[0].first - 1ULL, T); if (Left != PlusInf) { assert(MinusInf <= Left); - State = CM.assumeWithinInclusiveRange(State, *N, MinusInf, Left, false); + State = CM.assumeInclusiveRange(State, *N, MinusInf, Left, false); if (!State) return nullptr; } const llvm::APSInt = BVF.getValue(R[E - 1].second + 1ULL, T); if (Right != MinusInf) { assert(Right <= PlusInf); - State = CM.assumeWithinInclusiveRange(State, *N, Right, PlusInf, false); + State = CM.assumeInclusiveRange(State, *N, Right, PlusInf, false); if (!State) return nullptr; } for (size_t I = 1; I != E; ++I) { const llvm::APSInt = BVF.getValue(R[I - 1].second + 1ULL, T); const llvm::APSInt = BVF.getValue(R[I].first - 1ULL, T); assert(Min <= Max); - State = CM.assumeWithinInclusiveRange(State, *N, Min, Max, false); + State = CM.assumeInclusiveRange(State, *N, Min, Max, false); if (!State) return nullptr; } Index: include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h === --- include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h +++ include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h @@ -98,18 +98,18 @@ /// This ctor is used when creating the first ProgramState object. ProgramState(ProgramStateManager *mgr, const Environment& env, StoreRef st, GenericDataMap gdm); - + /// Copy ctor - We must explicitly define this or else the "Next" ptr /// in FoldingSetNode will also get copied. ProgramState(const