[clang] [analyzer] Print the PostInitializer target in exploded-graph-rewriter (PR #116034)

via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 13 03:57:38 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang-static-analyzer-1

Author: Balazs Benics (steakhal)

<details>
<summary>Changes</summary>

This aids debugging PostInitializer program points by knowing what is the location being initialized.

![Screenshot from 2024-11-11 09-50-51](https://github.com/user-attachments/assets/481f79f2-5cc5-4d0c-ac7d-ac24b4b23bc5)


---
Full diff: https://github.com/llvm/llvm-project/pull/116034.diff


1 Files Affected:

- (modified) clang/utils/analyzer/exploded-graph-rewriter.py (+9) 


``````````diff
diff --git a/clang/utils/analyzer/exploded-graph-rewriter.py b/clang/utils/analyzer/exploded-graph-rewriter.py
index 5eaa7738103f79..2eff20fd5899f3 100755
--- a/clang/utils/analyzer/exploded-graph-rewriter.py
+++ b/clang/utils/analyzer/exploded-graph-rewriter.py
@@ -88,6 +88,8 @@ def __init__(self, json_pp):
             )
         elif self.kind == "BlockEntrance":
             self.block_id = json_pp["block_id"]
+        elif self.kind == "PostInitializer":
+            self.target = json_pp["field_decl"] if "field_decl" in json_pp else json_pp["type"]
 
 
 # A single expression acting as a key in a deserialized Environment.
@@ -618,6 +620,13 @@ def visit_program_point(self, p):
                 '<font color="%s">%s</font></td>'
                 '<td align="left">[B%d]</td></tr>' % (color, p.kind, p.block_id)
             )
+        elif p.kind == "PostInitializer":
+            self._dump(
+                '<td width="0"></td>'
+                '<td align="left" width="0">'
+                '<font color="%s">%s</font></td>'
+                '<td align="left">%s</td></tr>' % (color, p.kind, p.target)
+            )
         else:
             # TODO: Print more stuff for other kinds of points.
             self._dump(

``````````

</details>


https://github.com/llvm/llvm-project/pull/116034


More information about the cfe-commits mailing list