[PATCH] D86465: [analyzer][solver] Redesign constraint ranges data structure

Denys Petrov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 20 08:11:02 PST 2021


ASDenysPetrov added a comment.

My propositions for the function `negate`.



================
Comment at: clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp:421
+  ContainerType Result;
+  Result.reserve(What.getMinValue() == MIN ? What.size() + 1 : What.size());
 
----------------
Here you can reuse `SampleValue` and simplify a bit this snippet.


================
Comment at: clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp:433-434
+    if (To == MAX) {
+      Result.insert(Result.end(), What.begin(), What.end());
+      return makePersistent(std::move(Result));
+    }
----------------
Here you can just move `What`. And after that you can do `Result.reserve`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86465



More information about the cfe-commits mailing list