Skip to content

Commit b0e5553

Browse files
committed
Generate ASCII / DOT file client side
1 parent 311593a commit b0e5553

File tree

7 files changed

+23
-30
lines changed

7 files changed

+23
-30
lines changed

Diff for: src/main/scala/viper/silver/frontend/SilFrontend.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -283,9 +283,9 @@ trait SilFrontend extends DefaultFrontend {
283283
val res = plugins.beforeFinish(tRes)
284284
val filteredRes = res match {
285285
case Success => res
286-
case Failure(errors,branchTree) =>
286+
case Failure(errors,exploredBranches) =>
287287
// Remove duplicate errors
288-
Failure(errors.distinctBy(failureFilterAndGroupingCriterion),branchTree)
288+
Failure(errors.distinctBy(failureFilterAndGroupingCriterion),exploredBranches)
289289
}
290290
_verificationResult = Some(filteredRes)
291291
filteredRes match {

Diff for: src/main/scala/viper/silver/plugin/standard/predicateinstance/PredicateInstancePlugin.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,11 @@ class PredicateInstancePlugin(@unused reporter: viper.silver.reporter.Reporter,
103103
private def translateVerificationResult(input: VerificationResult): VerificationResult = {
104104
input match {
105105
case Success => input
106-
case Failure(errors,branchTree) =>
106+
case Failure(errors,exploredBranches) =>
107107
Failure(errors.map {
108108
case e@PreconditionInAppFalse(_, _, _) => e.transformedError()
109109
case e => e
110-
},branchTree)
110+
},exploredBranches)
111111
}
112112
}
113113

Diff for: src/main/scala/viper/silver/plugin/standard/refute/RefutePlugin.scala

+4-4
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,14 @@ class RefutePlugin(@unused reporter: viper.silver.reporter.Reporter,
7474
mapVerificationResultsForNode(program, input)
7575

7676
private def mapVerificationResultsForNode(n: Node, input: VerificationResult): VerificationResult = {
77-
val (refutesForWhichErrorOccurred, otherErrors, branchTree_) = input match {
77+
val (refutesForWhichErrorOccurred, otherErrors, exploredBranches_) = input match {
7878
case Success => (Seq.empty, Seq.empty,None)
79-
case Failure(errors,branchTree) =>
79+
case Failure(errors,exploredBranches) =>
8080
val partErrs = errors.partitionMap {
8181
case AssertFailed(NodeWithRefuteInfo(RefuteInfo(r)), _, _) => Left((r, r.pos))
8282
case err => Right(err)
8383
}
84-
(partErrs._1, partErrs._2, branchTree)
84+
(partErrs._1, partErrs._2, exploredBranches)
8585
}
8686
val refutesContainedInNode = n.collect {
8787
case NodeWithRefuteInfo(RefuteInfo(r)) => (r, r.pos)
@@ -95,7 +95,7 @@ class RefutePlugin(@unused reporter: viper.silver.reporter.Reporter,
9595

9696
val errors = otherErrors ++ missingErrorsInNode
9797
if (errors.isEmpty) Success
98-
else Failure(errors, branchTree_)
98+
else Failure(errors, exploredBranches_)
9999
}
100100
}
101101

Diff for: src/main/scala/viper/silver/plugin/standard/termination/TerminationPlugin.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -297,10 +297,10 @@ class TerminationPlugin(@unused reporter: viper.silver.reporter.Reporter,
297297

298298
input match {
299299
case Success => input
300-
case Failure(errors,branchTree) => Failure(errors.map({
300+
case Failure(errors,exploredBranches) => Failure(errors.map({
301301
case a@AssertFailed(Assert(_), _, _) => a.transformedError()
302302
case e => e
303-
}),branchTree)
303+
}),exploredBranches)
304304
}
305305
}
306306

Diff for: src/main/scala/viper/silver/reporter/Message.scala

+6-14
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ package viper.silver.reporter
88

99
import viper.silver.reporter.BackendSubProcessStages.BackendSubProcessStage
1010
import viper.silver.verifier._
11-
import viper.silver.ast.{Exp, Method, QuantifiedExp, Trigger}
11+
import viper.silver.ast.{Method, QuantifiedExp, Trigger}
1212
import viper.silver.parser.PProgram
1313

1414
/**
@@ -169,22 +169,14 @@ case class BranchFailureMessage(verifier: String, concerning: Entity,
169169
s"result=${result.toString}, cached=$cached)"
170170
}
171171

172-
trait BranchTree {
173-
val DotFilePath : String
174-
var cached: Boolean = false
175-
def getMethod() : Method
176-
def getBeams() : Seq[BeamInfo]
177-
def prettyPrint() : String
178-
def toDotFile() : Unit
179-
}
180-
case class BeamInfo(e: Exp, isLeftFatal : Boolean, isRightFatal : Boolean)
181-
case class BranchTreeReport(tree : BranchTree)
172+
case class ExploredBranches(method: Method, paths: Vector[(Seq[Exp], Boolean)], var cached : Boolean = false)
173+
case class ExploredBranchesReport(exploredBranches : ExploredBranches)
182174
extends Message {
183175

184-
override lazy val toString: String = s"branch_tree_report(" +
185-
s"method=${tree.getMethod().name}, tree=${tree.prettyPrint()}, beams=${tree.getBeams()}"
176+
override lazy val toString: String = s"explored_branches_report(" +
177+
s"method=${exploredBranches.method.name}, paths=${exploredBranches.paths}"
186178

187-
override val name = "branch_tree"
179+
override val name = "explored_branches"
188180
}
189181

190182
case class StatisticsReport(nOfMethods: Int, nOfFunctions: Int, nOfPredicates: Int,

Diff for: src/main/scala/viper/silver/reporter/Reporter.scala

+3-3
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ case class CSVReporter(name: String = "csv_reporter", path: String = "report.csv
6868

6969
case BranchFailureMessage(_, concerning, _, cached) =>
7070
csv_file.write(s"BranchFailureMessage,${concerning.name},${cached}\n")
71-
case BranchTreeReport(tree) =>
72-
csv_file.write(s"BranchTreeReport,${tree.getMethod().name},${tree.prettyPrint()}\n")
71+
case ExploredBranchesReport(eb) =>
72+
csv_file.write(s"ExploredBranchesReport,${eb.method.name},${eb.paths}, ${eb.cached}\n")
7373

7474
case _: SimpleMessage | _: CopyrightReport | _: MissingDependencyReport | _: BackendSubProcessReport |
7575
_: InternalWarningMessage | _: ConfigurationConfirmation=> // Irrelevant for reporting
@@ -181,7 +181,7 @@ case class StdIOReporter(name: String = "stdout_reporter", timeInfo: Boolean = t
181181
case EntitySuccessMessage(_, _, _, _) => // FIXME Currently, we only print overall verification results to STDOUT.
182182
case EntityFailureMessage(_, _, _, _, _) => // FIXME Currently, we only print overall verification results to STDOUT.
183183
case BranchFailureMessage(_, _, _, _) => // FIXME Currently, we only print overall verification results to STDOUT.
184-
case BranchTreeReport(_) =>
184+
case ExploredBranchesReport(_) =>
185185
case ConfigurationConfirmation(_) => // TODO use for progress reporting
186186
//println( s"Configuration confirmation: $text" )
187187
case InternalWarningMessage(_) => // TODO use for progress reporting

Diff for: src/main/scala/viper/silver/verifier/VerificationResult.scala

+4-3
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@
77
package viper.silver.verifier
88

99
import viper.silver.ast._
10-
import viper.silver.reporter.BranchTree
10+
import viper.silver.reporter.ExploredBranches
1111

1212
import scala.annotation.unused
13+
import viper.silver.reporter.ExploredBranches
1314

1415
/** Describes the outcome of a verification attempt of a Viper program.
1516
@@ -28,12 +29,12 @@ object Success extends VerificationResult {
2829
*
2930
* @param errors The errors encountered during parsing, translation or verification.
3031
*/
31-
case class Failure(errors: Seq[AbstractError], branchTree : Option[BranchTree] = None) extends VerificationResult {
32+
case class Failure(errors: Seq[AbstractError], exploredBranches : Option[ExploredBranches] = None) extends VerificationResult {
3233
override def toString = {
3334
s"Verification failed with ${errors.size} errors:\n " +
3435
(errors map (e => "[" + e.fullId + "] " + e.readableMessage)).mkString("\n ")
3536
}
36-
override def transformedResult(): VerificationResult = Failure(errors.map(_.transformedError()), branchTree)
37+
override def transformedResult(): VerificationResult = Failure(errors.map(_.transformedError()), exploredBranches)
3738
}
3839

3940
/**

0 commit comments

Comments
 (0)