aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Waern <david.waern@gmail.com>2012-04-01 20:21:03 +0200
committerDavid Waern <david.waern@gmail.com>2012-04-01 20:21:03 +0200
commit7e3eb8d3aa0d5ff2caa62bde637d8c577b72f92d (patch)
tree6461e741482b0acc6e49ae94080845e8570036ea /src
parentfaf1c0231e199206ff26c13f982d853bf81517f3 (diff)
parenteada277a0f492e20d034ec6b8fb08a476232c7c4 (diff)
Merge branch 'dev' of https://github.com/sol/haddock into ghc-7.4
Diffstat (limited to 'src')
-rw-r--r--src/Main.hs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/Main.hs b/src/Main.hs
index 0a3c9ffc..c0b7df4b 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -57,6 +57,7 @@ import Paths_haddock
import GHC hiding (flags, verbosity)
import Config
import DynFlags hiding (flags, verbosity)
+import StaticFlags (saveStaticFlagGlobals, restoreStaticFlagGlobals)
import Panic (panic, handleGhcException)
import Module
@@ -290,7 +291,7 @@ dumpInterfaceFile path ifaces homeLinks = writeInterfaceFile path ifaceFile
-- | Start a GHC session with the -haddock flag set. Also turn off
-- compilation and linking. Then run the given 'Ghc' action.
withGhc :: String -> [String] -> (DynFlags -> Ghc a) -> IO a
-withGhc libDir flags ghcActs = do
+withGhc libDir flags ghcActs = saveStaticFlagGlobals >>= \savedFlags -> do
-- TODO: handle warnings?
(restFlags, _) <- parseStaticFlags (map noLoc flags)
runGhc (Just libDir) $ do
@@ -308,6 +309,7 @@ withGhc libDir flags ghcActs = do
-- dynamic or static linking at all!
_ <- setSessionDynFlags dynflags'''
ghcActs dynflags'''
+ `finally` restoreStaticFlagGlobals savedFlags
where
parseGhcFlags :: Monad m => DynFlags -> [Located String]
-> [String] -> m DynFlags