[PATCH] D86027: [analyzer] Add bool operator modeling for unque_ptr

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Aug 15 18:36:23 PDT 2020


NoQ added inline comments.


================
Comment at: clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp:400
+      ProgramStateRef NotNullState, NullState;
+      std::tie(NotNullState, NullState) = State->assume(CallExprVal.getValue());
+
----------------
vrnithinkumar wrote:
> NoQ wrote:
> > It's always `UnknownVal` because the call has not been evaluated yet. This `assume()` does nothing.
> Okay.
> So in that case the `NotNullState` and `NullState` will be same as the original state?
Yup.


================
Comment at: clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp:411
+      if (NotNullState) {
+        auto NonNullVal = C.getSValBuilder().makeTruthVal(true);
+        NotNullState =
----------------
vrnithinkumar wrote:
> Since the inner pointer value can be any non-null value, I am not sure what should be the value to be added to the map for tracking.
> 
Don't add values, constrain existing values.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86027



More information about the cfe-commits mailing list