[PATCH] D110357: [Analyzer] Extend ConstraintAssignor to handle remainder op

Denys Petrov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 18 02:10:14 PDT 2021


ASDenysPetrov added inline comments.


================
Comment at: clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp:1618-1627
+    const SymbolRef LHS = Sym->getLHS();
+    const llvm::APSInt &Zero =
+        Builder.getBasicValueFactory().getValue(0, Sym->getType());
+    // a % b != 0 implies that a != 0.
+    if (!Constraint.containsZero()) {
+      State = RCM.assumeSymNE(State, LHS, Zero, Zero);
+      if (!State)
----------------
How about using the family of `ProgramState::isNonNull` or `ProgramState::isNull` or `RangeConstraintManager::checkNull` functoins for this stuff?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110357



More information about the cfe-commits mailing list