[clang] 271a73d - [dataflow] HTMLLogger: fix off-by-one in the BB listing

Sam McCall via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 24 06:57:01 PDT 2023


Author: Sam McCall
Date: 2023-04-24T15:55:21+02:00
New Revision: 271a73dae32f5eac2011a2f85351975484496262

URL: https://github.com/llvm/llvm-project/commit/271a73dae32f5eac2011a2f85351975484496262
DIFF: https://github.com/llvm/llvm-project/commit/271a73dae32f5eac2011a2f85351975484496262.diff

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

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

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/clang/lib/Analysis/FlowSensitive/HTMLLogger.html b/clang/lib/Analysis/FlowSensitive/HTMLLogger.html
index c97f3ea8ac7d4..99d4debd05be3 100644
--- a/clang/lib/Analysis/FlowSensitive/HTMLLogger.html
+++ b/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>


        


More information about the cfe-commits mailing list