6666from chc .app .CApplication import CApplication
6767from chc .app .CPrettyPrinter import CPrettyPrinter
6868
69+ from chc .proof .OutputParameterChecker import OutputParameterChecker
70+
6971import chc .reporting .ProofObligations as RP
7072
7173from chc .util .Config import Config
@@ -421,7 +423,10 @@ def cfile_analyze_file(args: argparse.Namespace) -> NoReturn:
421423 opttgtpath : Optional [str ] = args .tgtpath
422424 wordsize : int = args .wordsize
423425 keep_system_includes : bool = args .keep_system_includes
426+ analysis : str = args .analysis
424427 verbose : bool = args .verbose
428+ analysisdomains : str = args .analysis_domains
429+ collectdiagnostics : bool = args .collect_diagnostics
425430 loglevel : str = args .loglevel
426431 logfilename : Optional [str ] = args .logfilename
427432 logfilemode : str = args .logfilemode
@@ -433,6 +438,8 @@ def cfile_analyze_file(args: argparse.Namespace) -> NoReturn:
433438 cfilename = cfilename_ext [:- 2 ]
434439 projectname = cfilename
435440
441+ po_cmd = analysis + "-primary"
442+
436443 set_logging (
437444 loglevel ,
438445 targetpath ,
@@ -484,20 +491,21 @@ def cfile_analyze_file(args: argparse.Namespace) -> NoReturn:
484491 am = AnalysisManager (
485492 capp ,
486493 verbose = verbose ,
494+ collectdiagnostics = collectdiagnostics ,
487495 wordsize = wordsize ,
488496 keep_system_includes = keep_system_includes )
489497
490- am .create_file_primary_proofobligations (cfilename )
498+ am .create_file_primary_proofobligations (cfilename , po_cmd = po_cmd )
491499 am .reset_tables (cfile )
492500 capp .collect_post_assumes ()
493501
494- am .generate_and_check_file (cfilename , None , "llrvisp" )
502+ am .generate_and_check_file (cfilename , None , analysisdomains )
495503 am .reset_tables (cfile )
496504 capp .collect_post_assumes ()
497505
498506 for k in range (5 ):
499507 capp .update_spos ()
500- am .generate_and_check_file (cfilename , None , "llrvisp" )
508+ am .generate_and_check_file (cfilename , None , analysisdomains )
501509 am .reset_tables (cfile )
502510
503511 chklogger .logger .info ("cfile analyze completed" )
@@ -518,6 +526,7 @@ def cfile_report_file(args: argparse.Namespace) -> NoReturn:
518526 # arguments
519527 xcfilename : str = args .filename
520528 opttgtpath : Optional [str ] = args .tgtpath
529+ canalysis : str = args .analysis
521530 cshowcode : bool = args .showcode
522531 cshowinvariants : bool = args .showinvariants
523532 cfunctions : Optional [List [str ]] = args .functions
@@ -573,6 +582,16 @@ def pofilter(po: "CFunctionPO") -> bool:
573582 cfile , pofilter = pofilter , showinvs = cshowinvariants ))
574583
575584 print (RP .file_proofobligation_stats_tostring (cfile ))
585+
586+ if canalysis == "outputparameters" :
587+ for cfun in cfile .functions .values ():
588+ try :
589+ op_checker = OutputParameterChecker (cfun )
590+ print (str (op_checker ))
591+ except UF .CHCError as e :
592+ print ("Skipping function " + cfun .name )
593+ continue
594+
576595 exit (0 )
577596
578597 for fnname in cfunctions :
@@ -591,6 +610,9 @@ def cfile_run_file(args: argparse.Namespace) -> NoReturn:
591610 pcfilename : str = os .path .abspath (args .filename )
592611 opttgtpath : Optional [str ] = args .tgtpath
593612 keep_system_includes : bool = args .keep_system_includes
613+ analysis : str = args .analysis
614+ analysisdomains : str = args .analysis_domains
615+ collectdiagnostics : bool = args .collect_diagnostics
594616 cshowcode : bool = args .showcode
595617 copen : bool = args .open
596618 cshowinvariants : bool = args .showinvariants
@@ -622,6 +644,8 @@ def cfile_run_file(args: argparse.Namespace) -> NoReturn:
622644 cfilename = cfilename_c [:- 2 ]
623645 projectname = cfilename
624646
647+ po_cmd = analysis + "-primary"
648+
625649 if not os .path .isdir (targetpath ):
626650 print_error ("Target directory: " + targetpath + " does not exist" )
627651 exit (1 )
@@ -696,19 +720,23 @@ def cfile_run_file(args: argparse.Namespace) -> NoReturn:
696720 capp .initialize_single_file (cfilename )
697721 cfile = capp .get_cfile ()
698722
699- am = AnalysisManager (capp , verbose = verbose )
723+ am = AnalysisManager (
724+ capp ,
725+ verbose = verbose ,
726+ collectdiagnostics = collectdiagnostics ,
727+ keep_system_includes = keep_system_includes )
700728
701- am .create_file_primary_proofobligations (cfilename )
729+ am .create_file_primary_proofobligations (cfilename , po_cmd = po_cmd )
702730 am .reset_tables (cfile )
703731 capp .collect_post_assumes ()
704732
705- am .generate_and_check_file (cfilename , None , "llrvisp" )
733+ am .generate_and_check_file (cfilename , None , analysisdomains )
706734 am .reset_tables (cfile )
707735 capp .collect_post_assumes ()
708736
709737 for k in range (5 ):
710738 capp .update_spos ()
711- am .generate_and_check_file (cfilename , None , "llrvisp" )
739+ am .generate_and_check_file (cfilename , None , analysisdomains )
712740 am .reset_tables (cfile )
713741
714742 chklogger .logger .info ("cfile analyze completed" )
@@ -745,6 +773,16 @@ def pofilter(po: "CFunctionPO") -> bool:
745773 cfile , pofilter = pofilter , showinvs = cshowinvariants ))
746774
747775 print (RP .file_proofobligation_stats_tostring (cfile ))
776+
777+ if analysis == "outputparameters" :
778+ for cfun in cfile .functions .values ():
779+ try :
780+ op_checker = OutputParameterChecker (cfun )
781+ print (str (op_checker ))
782+ except UF .CHCError as e :
783+ print ("Skipping function " + cfun .name + ": " + str (e ))
784+ continue
785+
748786 exit (0 )
749787
750788
0 commit comments