Skip to content

Commit 20cb4ec

Browse files
authored
[analyzer] Print the PostInitializer target in exploded-graph-rewriter (#116034)
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)
1 parent 720a4c7 commit 20cb4ec

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

clang/utils/analyzer/exploded-graph-rewriter.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@ def __init__(self, json_pp):
9090
self.callee_decl = json_pp.get("callee_decl", "None")
9191
elif self.kind == "BlockEntrance":
9292
self.block_id = json_pp["block_id"]
93+
elif self.kind == "PostInitializer":
94+
if "field_decl" in json_pp:
95+
self.target = json_pp["field_decl"]
96+
else:
97+
self.target = json_pp["type"]
9398

9499

95100
# A single expression acting as a key in a deserialized Environment.
@@ -627,6 +632,13 @@ def visit_program_point(self, p):
627632
'<font color="%s">%s</font></td>'
628633
'<td align="left">%s</td></tr>' % (color, p.kind, p.callee_decl)
629634
)
635+
elif p.kind == "PostInitializer":
636+
self._dump(
637+
'<td width="0"></td>'
638+
'<td align="left" width="0">'
639+
'<font color="%s">%s</font></td>'
640+
'<td align="left">%s</td></tr>' % (color, p.kind, p.target)
641+
)
630642
else:
631643
# TODO: Print more stuff for other kinds of points.
632644
self._dump(

0 commit comments

Comments
 (0)