Skip to content

Commit 7018bd3

Browse files
waskyosipma
authored andcommitted
include supporting proof obligations in the json output
this brings a bit of parity to the json and text report. also add a note that we should add the API details to the json output later on for full parity
1 parent 4d28fea commit 7018bd3

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

chc/cmdline/jsonresultutil.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,19 @@ def ppo_to_json_result(po: "CFunctionPO") -> JSONResult:
108108

109109
def fn_proofobligations_to_json_result(fn: "CFunction") -> JSONResult:
110110
content: Dict[str, Any] = {}
111+
# XXX: Add fn.api like in the text report
111112
ppos: Sequence["CFunctionPO"] = fn.get_ppos()
112113
jppos: List[Dict[str, Any]] = []
113114
for ppo in sorted(ppos, key=lambda po: po.line):
114115
pporesult = ppo_to_json_result(ppo)
115116
jppos.append(pporesult.content)
116117
content["ppos"] = jppos
118+
spos = fn.get_spos()
119+
jspos: List[Dict[str, Any]] = []
120+
for spo in sorted(spos, key=lambda po: po.line):
121+
sporesult = ppo_to_json_result(spo)
122+
jspos.append(sporesult.content)
123+
content["spos"] = jspos
117124
return JSONResult("cfunppos", content, "ok")
118125

119126

@@ -125,7 +132,7 @@ def file_proofobligations_to_json_result(cfile: "CFile") -> JSONResult:
125132
for fn in cfile.get_functions():
126133
fndata: Dict[str, Any] = {}
127134
fndata["functiondata"] = jsonfunctiondata(fn)
128-
fndata["ppos"] = fn_proofobligations_to_json_result(fn).content
135+
fndata["pos"] = fn_proofobligations_to_json_result(fn).content
129136
fnsdata.append(fndata)
130137
content["functions"] = fnsdata
131138
return JSONResult("fileproofobligations", content, "ok")

0 commit comments

Comments
 (0)