Skip to content

Commit 53078e9

Browse files
committed
CMD: add cmd-line options
1 parent 600ffe2 commit 53078e9

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

chc/cmdline/c_file/cfileutil.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,7 @@ def cfile_report_file(args: argparse.Namespace) -> NoReturn:
285285
xcfilename: str = args.filename
286286
opttgtpath: Optional[str] = args.tgtpath
287287
cshowcode: bool = args.showcode
288+
cshowinvariants: bool = args.showinvariants
288289
cfunctions: Optional[List[str]] = args.functions
289290
copen: bool = args.open
290291
jsonoutput: bool = args.json
@@ -334,7 +335,8 @@ def pofilter(po: "CFunctionPO") -> bool:
334335

335336
if cfunctions is None:
336337
if cshowcode:
337-
print(RP.file_code_tostring(cfile, pofilter=pofilter))
338+
print(RP.file_code_tostring(
339+
cfile, pofilter=pofilter, showinvs=cshowinvariants))
338340

339341
print(RP.file_proofobligation_stats_tostring(cfile))
340342
exit(0)
@@ -356,6 +358,7 @@ def cfile_run_file(args: argparse.Namespace) -> NoReturn:
356358
opttgtpath: Optional[str] = args.tgtpath
357359
cshowcode: bool = args.showcode
358360
copen: bool = args.open
361+
cshowinvariants: bool = args.showinvariants
359362
jsonoutput: bool = args.json
360363
outputfile: Optional[str] = args.output
361364
verbose: bool = args.verbose
@@ -492,7 +495,8 @@ def pofilter(po: "CFunctionPO") -> bool:
492495
return True
493496

494497
if cshowcode:
495-
print(RP.file_code_tostring(cfile, pofilter=pofilter))
498+
print(RP.file_code_tostring(
499+
cfile, pofilter=pofilter, showinvs=cshowinvariants))
496500

497501
print(RP.file_proofobligation_stats_tostring(cfile))
498502
exit(0)

chc/cmdline/chkc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -703,6 +703,10 @@ def parse() -> argparse.Namespace:
703703
"--open",
704704
action="store_true",
705705
help="only show open proof obligations")
706+
cfilereport.add_argument(
707+
"--showinvariants",
708+
action="store_true",
709+
help="show location invariants on the code")
706710
cfilereport.add_argument(
707711
"--json",
708712
action="store_true",
@@ -742,6 +746,10 @@ def parse() -> argparse.Namespace:
742746
"--open",
743747
action="store_true",
744748
help="only show open proof obligations")
749+
cfilerun.add_argument(
750+
"--showinvariants",
751+
action="store_true",
752+
help="show location invariants on the code")
745753
cfilerun.add_argument(
746754
"--json",
747755
action="store_true",

0 commit comments

Comments
 (0)