Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

print constraints

  • Loading branch information...
commit 4ba3e2746c32d51dba5369a8fb0b711a35c85d82 1 parent 312b19c
@bblum authored
Showing with 7 additions and 3 deletions.
  1. +3 −2 Check.hs
  2. +4 −1 Main.hs
View
5 Check.hs
@@ -584,9 +584,10 @@ injectAnnotation nobe t (Nothing) = return t
-- Main iteration.
--
-check :: CTranslUnit -> [String]
+check :: CTranslUnit -> ([String], [Constraint])
check (CTranslUnit decls nobe) =
- reverse $ msgs $ execState (mapM_ checkExtDecl decls) defaultChecker
+ let state = execState (mapM_ checkExtDecl decls) defaultChecker
+ in (reverse $ msgs $ state, reverse $ constraints $ state)
checkExtDecl :: CExtDecl -> State Checker ()
checkExtDecl (CDeclExt d) = checkDecl_ d
View
5 Main.hs
@@ -67,7 +67,10 @@ main =
Right (opts, file) ->
do ast <- parseFile opts file
-- print $ pretty ast
- let msgs = check ast
+ let (msgs,constraints) = check ast
mapM_ putStrLn msgs
+ when (not $ null constraints) $
+ do putStrLn "I also found some constraints:"
+ mapM_ (putStrLn . show) constraints
when (not $ null msgs) $ exitWith $ ExitFailure 1
Please sign in to comment.
Something went wrong with that request. Please try again.