Skip to content

Commit

Permalink
[dataflow] HTMLLogger: fix off-by-one in the BB listing
Browse files Browse the repository at this point in the history
The indexes of analysis state within a BB element is a bit odd:
  BB.0 is the initial state
  BB.1 is the state after the first element
etc

This means we have N+1 states and we need N+1 elements in the BB list.
We add a dummy element at the beginning rather than the end, because we want
selecting a CFG element to show the state *afterwards*.
For example, if we click on an expr, we want to be able to see its value model!

Differential Revision: https://reviews.llvm.org/D148951
  • Loading branch information
sam-mccall committed Apr 24, 2023
1 parent 1162a38 commit 271a73d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions clang/lib/Analysis/FlowSensitive/HTMLLogger.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,15 @@
</template>
</div>
<table id="bb-elements">
<template>
<tr id="{{selection.bb}}.0">
<td class="{{selection.bb}}">{{selection.bb}}.0</td>
<td>(initial state)</td>
</tr>
</template>
<template data-for="elt in cfg[selection.bb].elements">
<tr id="{{selection.bb}}.{{elt_index}}">
<td class="{{selection.bb}}">{{selection.bb}}.{{elt_index}}</td>
<tr id="{{selection.bb}}.{{elt_index+1}}">
<td class="{{selection.bb}}">{{selection.bb}}.{{elt_index+1}}</td>
<td>{{elt}}</td>
</tr>
</template>
Expand Down

0 comments on commit 271a73d

Please sign in to comment.