summaryrefslogtreecommitdiff
path: root/testsuite/tests/ghc-api/T10942.hs
blob: 359875167647c118a59188330fa6bf189ae66368 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
module Main where

import GHC.Driver.Session
import GHC

import Control.Monad.IO.Class (liftIO)
import System.Environment
import GHC.Parser.Header
import Outputable
import StringBuffer

main :: IO ()
main = do
  [libdir] <- getArgs
  runGhc (Just libdir) $ do
    dflags <- getSessionDynFlags
    let dflags' = dflags `gopt_set` Opt_KeepRawTokenStream
                         `gopt_set` Opt_Haddock
        filename = "T10942_A.hs"
    setSessionDynFlags dflags'
    stringBuffer <- liftIO $ hGetStringBuffer filename
    liftIO $ print (map unLoc (getOptions dflags' stringBuffer filename))