summaryrefslogtreecommitdiff
path: root/testsuite/tests/plugins/LinkerTicklingPlugin.hs
blob: 34ff7e3c6495938adb3d90c6c2d8ae0404a3e6eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
module LinkerTicklingPlugin where

import GHC.Plugins
import GHC.Driver.Session
import GHC.Utils.GlobalVars

plugin :: Plugin
plugin = defaultPlugin
   { installCoreToDos = install
   }

-- This tests whether plugins are linking against the *running* GHC or a new
-- instance of it. If it is a new instance (settings unsafeGlobalDynFlags) won't
-- have been initialised, so we'll get a GHC panic here:
install :: [CommandLineOption] -> [CoreToDo] -> CoreM [CoreToDo]
install _options todos = io `seq` return todos
   where
      io = if not unsafeHasPprDebug
            then error "unsafePprDebug should be set: plugin linked against a different GHC?"
            else ()