[PATCH] D83877: [Analyzer] Changed in SmartPtrModeling to handle Swap

Gábor Horváth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 15 08:21:29 PDT 2020


xazax.hun accepted this revision.
xazax.hun added a comment.
This revision is now accepted and ready to land.

LGTM, thanks!



================
Comment at: clang/test/Analysis/Inputs/system-header-simulator-cxx.h:965
+  template <typename T>
+  void swap(unique_ptr<T> &x, unique_ptr<T> &y) noexcept {
+    x.swap(y);
----------------
Maybe it is worth to add a TODO to introduce an additional template parameter once the deleter is added above.

https://en.cppreference.com/w/cpp/memory/unique_ptr/swap2


================
Comment at: clang/test/Analysis/smart-ptr.cpp:124
+
+void derefOnStdSwappedNullPtr() {
+  std::unique_ptr<A> P(new A());
----------------
This test case is very similar to the first one. Maybe you could move them closer. And you could make both pointers invalid to make them more distinct.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83877





More information about the cfe-commits mailing list