[PATCH] D55289: [analyzer] MoveChecker Pt.5: Improve invalidation policies.

Aleksei Sidorin via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 4 22:40:05 PST 2018


a_sidorin added a comment.

Hi Artem,
The change looks fine, just some nits.



================
Comment at: lib/StaticAnalyzer/Checkers/MoveChecker.cpp:537
+    const MemRegion *ThisRegion = nullptr;
+    if (const auto *IC = dyn_cast_or_null<CXXInstanceCall>(Call))
+      ThisRegion = IC->getCXXThisVal().getAsRegion();
----------------
It looks like Call is already checked for null, and we can use just dyn_cast.


================
Comment at: lib/StaticAnalyzer/Checkers/MoveChecker.cpp:545
+      if (ThisRegion != Region)
+        if (std::find(Regions.begin(), Regions.end(), Region) != Regions.end())
+          State = removeFromState(State, Region);
----------------
NoQ wrote:
> This is clumsy. I think we shouldn't include non-invalidated regions in the `ExplicitRegions` array in the first place.
Just a reminder: we have `llvm::find` and a bunch of nice related range wrappers.


Repository:
  rC Clang

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

https://reviews.llvm.org/D55289





More information about the cfe-commits mailing list