xazax.hun added inline comments.
================ Comment at: clang/lib/StaticAnalyzer/Checkers/NullPtrInterferenceChecker.cpp:166 +/// child is a sink node. +static bool unconditionallyLeadsHere(const ExplodedNode *N) { + size_t NonSinkNodeCount = llvm::count_if( ---------------- xazax.hun wrote: > Consider the following code snippet: > ``` > void f(int *p, bool b) > { > if (b) { > *p = 4; > } > if (p) { > ... > } > } > ``` > > I suspect that we would get a warning for the code above. I think warning on > the code above might be reasonable (the values of `b` and `p` might be > correlated but in some cases the analyzer has no way to know this, probably > some assertions could make the code clearer in that case). > > My problem is with the wording of the error message. > The warning `Pointer is unconditionally non-null here` on the null check is > not true for the code above. Also, if the check would warn for the code snippet above, the note "suggest moving the condition here" would also be incorrect. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D120992/new/ https://reviews.llvm.org/D120992 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits