[clang] [analyzer] Print the PostInitializer target in exploded-graph-rewriter (PR #116034)
Balazs Benics via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 13 22:59:15 PST 2024
https://github.com/steakhal updated https://github.com/llvm/llvm-project/pull/116034
>From 7faee31bc4bc0b1a9fd037a99f54856c84affc91 Mon Sep 17 00:00:00 2001
From: Balazs Benics <benicsbalazs at gmail.com>
Date: Wed, 13 Nov 2024 12:55:06 +0100
Subject: [PATCH 1/2] [analyzer] Print the PostInitializer target in
exploded-graph-rewriter
This aids debugging PostInitializer program points by knowing what is
the location being initialized.
---
clang/utils/analyzer/exploded-graph-rewriter.py | 9 +++++++++
1 file changed, 9 insertions(+)
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(
>From e3904f6cba072c602f2a3b9935b3cd6d185296c6 Mon Sep 17 00:00:00 2001
From: Balazs Benics <benicsbalazs at gmail.com>
Date: Thu, 14 Nov 2024 07:58:23 +0100
Subject: [PATCH 2/2] NFC Reformat code to satisfy darker
---
clang/utils/analyzer/exploded-graph-rewriter.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/clang/utils/analyzer/exploded-graph-rewriter.py b/clang/utils/analyzer/exploded-graph-rewriter.py
index 2eff20fd5899f3..3706dccf011ea4 100755
--- a/clang/utils/analyzer/exploded-graph-rewriter.py
+++ b/clang/utils/analyzer/exploded-graph-rewriter.py
@@ -89,7 +89,10 @@ 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"]
+ if "field_decl" in json_pp:
+ self.target = json_pp["field_decl"]
+ else:
+ self.target = json_pp["type"]
# A single expression acting as a key in a deserialized Environment.
More information about the cfe-commits
mailing list