Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only produce .smt2 files when the save flag is turned on #712

Merged
merged 1 commit into from
Oct 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions src/Language/Fixpoint/Smt/Interface.hs
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,7 @@ module Language.Fixpoint.Smt.Interface (
) where

import Language.Fixpoint.Types.Config ( SMTSolver (..)
, Config
, solver
, smtTimeout
, gradual
, stringTheory)
, Config (solver, smtTimeout, gradual, stringTheory, save))
import qualified Language.Fixpoint.Misc as Misc
import Language.Fixpoint.Types.Errors
import Language.Fixpoint.Utils.Files
Expand Down Expand Up @@ -240,12 +236,18 @@ negativeP
makeContext :: Config -> FilePath -> IO Context
--------------------------------------------------------------------------
makeContext cfg f
= do createDirectoryIfMissing True $ takeDirectory smtFile
hLog <- openFile smtFile WriteMode
hSetBuffering hLog $ BlockBuffering $ Just $ 1024 * 1024 * 64
me <- makeContext' cfg $ Just hLog
= do mb_hLog <- if not (save cfg) then pure Nothing else do
createDirectoryIfMissing True $ takeDirectory smtFile
hLog <- openFile smtFile WriteMode
hSetBuffering hLog $ BlockBuffering $ Just $ 1024 * 1024 * 64
return $ Just hLog
me <- makeContext' cfg mb_hLog
pre <- smtPreamble cfg (solver cfg) me
mapM_ (\l -> SMTLIB.Backends.command_ (ctxSolver me) l >> BS.hPutBuilder hLog l >> LBS.hPutStr hLog "\n") pre
forM_ pre $ \line -> do
SMTLIB.Backends.command_ (ctxSolver me) line
forM_ mb_hLog $ \hLog -> do
BS.hPutBuilder hLog line
LBS.hPutStr hLog "\n"
return me
where
smtFile = extFileName Smt2 f
Expand Down
Loading