[PATCH] D148951: [dataflow] HTMLLogger: fix off-by-one in the BB listing

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 21 12:23:07 PDT 2023


sammccall created this revision.
sammccall added a reviewer: mboehme.
Herald added subscribers: martong, xazax.hun.
Herald added a reviewer: NoQ.
Herald added a project: All.
sammccall requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

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!


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D148951

Files:
  clang/lib/Analysis/FlowSensitive/HTMLLogger.html


Index: clang/lib/Analysis/FlowSensitive/HTMLLogger.html
===================================================================
--- clang/lib/Analysis/FlowSensitive/HTMLLogger.html
+++ clang/lib/Analysis/FlowSensitive/HTMLLogger.html
@@ -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>


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D148951.515868.patch
Type: text/x-patch
Size: 785 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230421/966d9cce/attachment.bin>


More information about the cfe-commits mailing list