[PATCH] D92639: [analyzer] Add control flow arrows to the analyzer's HTML reports

Valeriy Savchenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 4 02:44:05 PST 2020


vsavchenko added a comment.

In D92639#2433303 <https://reviews.llvm.org/D92639#2433303>, @OikawaKirie wrote:

> It is really a good idea!

Thanks 😊

> The operations that would not leave an event in the report are now clearly printed.
>
> But there are three arrows that confuse me in the example report: the assignment `x = 0` (x -> 0 -> x), the function call `dereference(x)` (x -> dereference), and the return statement `return *x` (int -> *x). I know the arrow is based on the evaluation order of the engine. But from the view of a user, I think these arrows are confusing to some extent.
>
> For the first two, I think it would be better to point just the statement (maybe a `CFGElement`) without inner arrows (x -> 0 -> x and x -> dereference), or point to the location of the operator itself rather than the BeginLoc (e.g. x -> 0 -> =). For the third one, an arrow from the function name to the first `CFGElement` looks good to me. And an arrow from the returned expr to the return type or to a special mark (e.g. ⬅️) can also be added, together with function calls (an arrow from the callstmt to a special mark, e.g. ➡️).

Sorry, for the confusion.  I did not come up with the idea of arrows and neither did I chose which tokens are connected by arrows.  It is an existing feature, and it existed for quite a long time.  The analyzer can produce `plist` files that contain all these locations, `plist` files are further used by Xcode to draw arrows.  You can see a very old example on our website: https://clang-analyzer.llvm.org
Essentially I took this existing information and used it in the HTML report generation as well.  The biggest chunk of this commit is the algorithm for drawing SVG curves.

> By the way, what do you think about adding arrows for data flows of specific symbolic values in the future?

I'm open for many ideas in the ways how we can improve our HTML reports!  I thought of a popup when you hover over an arrow showing values/constraints for symbols actively involved in the report.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D92639



More information about the cfe-commits mailing list