xazax.hun accepted this revision. xazax.hun added inline comments.
================ Comment at: clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp:362-363 + const auto *InnerPointVal = State->get<TrackedRegionMap>(ThisRegion); + if (!InnerPointVal) + return; + ---------------- NoQ wrote: > You'll have to actively handle this case, sooner or later. Consider the > following test cases that won't work until you do: > ```lang=c++ > void foo(std::unique_ptr<A> p) { > A *x = p.get(); > A *y = p.get(); > clang_analyzer_eval(x == y); // expected-warning{{TRUE}} > if (!x) { > y->foo(); // expected-warning{{Called C++ object pointer is null}} > } > } > > ``` You mean the case where we do not have an inner pointer registered in the state yet, right? I believe we might also have to handle similar cases for `operator bool()` as well. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D86029/new/ https://reviews.llvm.org/D86029 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits