X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=compiler%2Fmain%2FMain.hs;h=55234e7636d556aed15a8fe81d944793e9993295;hp=52097d9aa4cd320bb67d82ab2e50d41f42f48572;hb=b00b5bc04ff36a551552470060064f0b7d84ca30;hpb=e69ddd9cc12f59c7ef7103e54fee2d1c55b9fc14 diff --git a/compiler/main/Main.hs b/compiler/main/Main.hs index 52097d9..55234e7 100644 --- a/compiler/main/Main.hs +++ b/compiler/main/Main.hs @@ -19,6 +19,7 @@ import CmdLineParser -- Implementations of the various modes (--show-iface, mkdependHS. etc.) import LoadIface ( showIface ) +import HscMain ( newHscEnv ) import DriverPipeline ( oneShot, compileFile ) import DriverMkDepend ( doMkDependHS ) #ifdef GHCI @@ -27,13 +28,13 @@ import InteractiveUI ( ghciWelcomeMsg, interactiveUI ) -- Various other random stuff that we need import Config ( cProjectVersion, cBooterVersion, cProjectName ) -import Packages ( dumpPackages, initPackages ) +import Packages ( dumpPackages ) import DriverPhases ( Phase(..), isSourceFilename, anyHsc, startPhase, isHaskellSrcFilename ) import StaticFlags ( staticFlags, v_Ld_inputs, parseStaticFlags ) import DynFlags ( defaultDynFlags ) import BasicTypes ( failed ) -import ErrUtils ( Message, debugTraceMsg, putMsg ) +import ErrUtils ( putMsg ) import FastString ( getFastStringTable, isZEncoded, hasZEncoding ) import Outputable import Util @@ -147,7 +148,7 @@ main = PrintLibdir -> putStrLn (topDir dflags) ShowVersion -> showVersion ShowNumVersion -> putStrLn cProjectVersion - ShowInterface f -> showIface f + ShowInterface f -> doShowIface dflags f DoMake -> doMake session srcs DoMkDependHS -> doMkDependHS session (map fst srcs) StopBefore p -> oneShot dflags p srcs @@ -395,6 +396,15 @@ doMake sess srcs = do when (failed ok_flag) (exitWith (ExitFailure 1)) return () + +-- --------------------------------------------------------------------------- +-- --show-iface mode + +doShowIface :: DynFlags -> FilePath -> IO () +doShowIface dflags file = do + hsc_env <- newHscEnv dflags + showIface hsc_env file + -- --------------------------------------------------------------------------- -- Various banners and verbosity output.