66
77package viper .silver .reporter
88
9+ import viper .silver .frontend .SilFrontendConfig
910import viper .silver .plugin .SilverPluginManager
1011import viper .silver .verifier .Success
1112
@@ -23,6 +24,14 @@ object NoopReporter extends Reporter {
2324 def report (msg : Message ): Unit = ()
2425}
2526
27+ trait ConfigurableReporter extends Reporter {
28+ protected var config : Option [SilFrontendConfig ] = None
29+
30+ def setConfig (c : Option [SilFrontendConfig ]): Unit = {
31+ config = c
32+ }
33+ }
34+
2635trait PluginAwareReporter extends Reporter {
2736
2837 protected var plugins : Option [SilverPluginManager ] = None
@@ -115,7 +124,8 @@ case class CSVReporter(name: String = "csv_reporter", path: String = "report.csv
115124 }
116125}
117126
118- case class StdIOReporter (name : String = " stdout_reporter" , timeInfo : Boolean = true ) extends PluginAwareReporter {
127+ case class StdIOReporter (name : String = " stdout_reporter" ,
128+ timeInfo : Boolean = true ) extends PluginAwareReporter with ConfigurableReporter {
119129
120130 var counter = 0
121131
@@ -126,6 +136,8 @@ case class StdIOReporter(name: String = "stdout_reporter", timeInfo: Boolean = t
126136
127137 private def bulletFmt (num_items : Int ): String = s " % ${num_items.toString.length}d "
128138
139+ private def shouldReportPartial = config.isDefined && config.get.reportPartialResults.getOrElse(false )
140+
129141 def doReport (msg : Message ): Unit = {
130142 msg match {
131143 case AstConstructionFailureMessage (t, res) =>
@@ -209,9 +221,12 @@ case class StdIOReporter(name: String = "stdout_reporter", timeInfo: Boolean = t
209221 println( s " encountered missing dependency: $text" )
210222
211223 // These get reported without being transformed by any plugins, it would be an issue if we printed them to STDOUT.
212- case EntitySuccessMessage (_, _, _, _) => // FIXME Currently, we only print overall verification results to STDOUT.
213- case EntityFailureMessage (_, _, _, _, _) => // FIXME Currently, we only print overall verification results to STDOUT.
214- case BranchFailureMessage (_, _, _, _) => // FIXME Currently, we only print overall verification results to STDOUT.
224+ case EntitySuccessMessage (_, _, _, _) =>
225+ if (shouldReportPartial) println(msg)
226+ case EntityFailureMessage (_, _, _, _, _) =>
227+ if (shouldReportPartial) println(msg)
228+ case BranchFailureMessage (_, _, _, _) =>
229+ if (shouldReportPartial) println(msg)
215230 case ConfigurationConfirmation (_) => // TODO use for progress reporting
216231 // println( s"Configuration confirmation: $text" )
217232 case InternalWarningMessage (_) => // TODO use for progress reporting
0 commit comments