Skip to content
Snippets Groups Projects
Commit 7542e642 authored by Etienne Kneuss's avatar Etienne Kneuss
Browse files

ChooseInfo.extractFromProgram respects --functions and @library

parent c2cebdcd
No related branches found
No related tags found
No related merge requests found
...@@ -20,9 +20,19 @@ case class ChooseInfo(fd: FunDef, ...@@ -20,9 +20,19 @@ case class ChooseInfo(fd: FunDef,
object ChooseInfo { object ChooseInfo {
def extractFromProgram(ctx: LeonContext, prog: Program): List[ChooseInfo] = { def extractFromProgram(ctx: LeonContext, prog: Program): List[ChooseInfo] = {
val functions = ctx.findOption(SharedOptions.optFunctions) map { _.toSet }
def excludeByDefault(fd: FunDef): Boolean = {
fd.annotations contains "library"
}
val fdFilter = {
import OptionsHelpers._
filterInclusive(functions.map(fdMatcher(prog)), Some(excludeByDefault _))
}
// Look for choose() // Look for choose()
val results = for (f <- prog.definedFunctions if f.body.isDefined; val results = for (f <- prog.definedFunctions if f.body.isDefined && fdFilter(f);
ci <- extractFromFunction(ctx, prog, f)) yield { ci <- extractFromFunction(ctx, prog, f)) yield {
ci ci
} }
......
...@@ -65,14 +65,8 @@ object SynthesisPhase extends LeonPhase[Program, Program] { ...@@ -65,14 +65,8 @@ object SynthesisPhase extends LeonPhase[Program, Program] {
def run(ctx: LeonContext)(program: Program): Program = { def run(ctx: LeonContext)(program: Program): Program = {
val options = processOptions(ctx) val options = processOptions(ctx)
def excludeByDefault(fd: FunDef): Boolean = { fd.annotations contains "library" }
val fdFilter = { val chooses = ChooseInfo.extractFromProgram(ctx, program)
import OptionsHelpers._
filterInclusive(options.functions.map(fdMatcher(program)), Some(excludeByDefault _))
}
val chooses = program.definedFunctions.filter(fdFilter).flatMap(ChooseInfo.extractFromFunction(ctx, program, _))
var functions = Set[FunDef]() var functions = Set[FunDef]()
......
...@@ -86,7 +86,10 @@ class SynthesisSuite extends regression.LeonTestSuite { ...@@ -86,7 +86,10 @@ class SynthesisSuite extends regression.LeonTestSuite {
test(f"Synthesizing ${nextInt()}%3d: [$title]") { test(f"Synthesizing ${nextInt()}%3d: [$title]") {
val ctx = testContext.copy(options = opts ++ testContext.options) val ctx = testContext.copy(options = opts ++ testContext.options)
val pipeline = leon.utils.TemporaryInputPhase andThen leon.frontends.scalac.ExtractionPhase andThen PreprocessingPhase andThen SynthesisProblemExtractionPhase val pipeline = leon.utils.TemporaryInputPhase andThen
leon.frontends.scalac.ExtractionPhase andThen
PreprocessingPhase andThen
SynthesisProblemExtractionPhase
val (program, results) = pipeline.run(ctx)((List(content), Nil)) val (program, results) = pipeline.run(ctx)((List(content), Nil))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment