[PATCH] D42192: [analyzer] Assume that the allocated value is non-null before construction, not after.

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 17 17:25:28 PST 2018


NoQ marked an inline comment as done.
NoQ added inline comments.


================
Comment at: lib/StaticAnalyzer/Core/ExprEngineCXX.cpp:516
+        if (!ProtoType->isNothrow(getContext()))
+          State = State->assume(RetVal.castAs<DefinedOrUnknownSVal>(), true);
+    }
----------------
george.karpenkov wrote:
> This is neither here nor there, but for this and many other cases I think we could be considerably more readable by defining helpers `State->assumeIsTrue` and `State->assumeIsFalse` (or `assumeNonNull`, or whatever is most descriptive)
Dunno, `assume(x, true)` sounds descriptive enough to me, and also feels more like a natural spoken language.


https://reviews.llvm.org/D42192





More information about the cfe-commits mailing list