[PATCH] D27773: [analyzer] Add checker modeling gtest APIs.

Devin Coughlin via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 15 13:20:21 PST 2016


dcoughlin marked 2 inline comments as done.
dcoughlin added inline comments.


================
Comment at: lib/StaticAnalyzer/Checkers/GTestChecker.cpp:30
+//
+// The gtest unit testing API provides macros for assertions that that expand
+// into an if statement that calls a series of constructors and returns
----------------
a.sidorin wrote:
> "that that"
Thanks!


================
Comment at: lib/StaticAnalyzer/Checkers/GTestChecker.cpp:182
+
+  SVal ThisSuccess = getAssertionResultSuccessFieldValue(AssertResultClassDecl,
+                                                         ThisVal, State);
----------------
a.sidorin wrote:
> Shouldn't we just bind OtherSuccess to our field?
Unfortunately since this is a PostCall, the result of the constructor has already entered value land. It is a LazyCompoundValue with a reference to a previous store. Even if we look through the lazy compound value to get at the memory region, binding it in the current store will have no effect on the returned value.

We could perform the bind and load the result value again -- but then we'd have to replace the result value in the environment, which is not compositional with respect to other checkers' PostCalls, since they may have done their own thing with the old value.


https://reviews.llvm.org/D27773





More information about the cfe-commits mailing list