[PATCH] D86373: [analyzer] Add modeling for unique_ptr move constructor

Nithin VR via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 26 13:31:34 PDT 2020


vrnithinkumar added inline comments.


================
Comment at: clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp:456
           if (BR.isInteresting(ThisRegion) && IsArgValNull) {
-            OS << "Null pointer value move-assigned to ";
+            OS << "A null pointer value is moved to ";
             ThisRegion->printPretty(OS);
----------------
Same note tag is used for move assignment and move constructor here. 


================
Comment at: clang/test/Analysis/smart-ptr.cpp:21
+  *P.get() = 1; // expected-warning {{Method called on moved-from object 'P' [cplusplus.Move]}}
+  // expected-warning at -1 {{Dereference of null pointer [core.NullDereference]}}
 }
----------------
Now both "use after move" and "null pointer dereference" warnings are coming. I hope it will be only  "null pointer dereference" after smart pointer modeling is complete


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86373



More information about the cfe-commits mailing list