summaryrefslogtreecommitdiff
path: root/compiler/GHC/Driver/CodeOutput.hs
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2021-01-27 09:58:59 +0000
committerMatthew Pickering <matthewtpickering@gmail.com>2021-03-03 19:11:08 +0000
commit7b9767b81f4f0b25b0c0402593be1182b9546bab (patch)
treee446784907016969d94c30cd1beabed6af45d462 /compiler/GHC/Driver/CodeOutput.hs
parentf121ffe4be7dd156701d856fbc9afeaf50e7038e (diff)
downloadhaskell-7b9767b81f4f0b25b0c0402593be1182b9546bab.tar.gz
Use a newtype for CHeader and CStub in ForeignStubs
Diffstat (limited to 'compiler/GHC/Driver/CodeOutput.hs')
-rw-r--r--compiler/GHC/Driver/CodeOutput.hs12
1 files changed, 6 insertions, 6 deletions
diff --git a/compiler/GHC/Driver/CodeOutput.hs b/compiler/GHC/Driver/CodeOutput.hs
index 5e0c5f0c05..b459b7b447 100644
--- a/compiler/GHC/Driver/CodeOutput.hs
+++ b/compiler/GHC/Driver/CodeOutput.hs
@@ -210,7 +210,7 @@ outputForeignStubs logger dflags unit_state mod location stubs
NoStubs ->
return (False, Nothing)
- ForeignStubs h_code c_code -> do
+ ForeignStubs (CHeader h_code) (CStub c_code) -> do
let
stub_c_output_d = pprCode CStyle c_code
stub_c_output_w = showSDoc dflags stub_c_output_d
@@ -285,9 +285,9 @@ outputForeignStubs_help fname doc_str header footer
-- module;
-- | Generate code to initialise cost centres
-profilingInitCode :: Platform -> Module -> CollectedCCs -> SDoc
+profilingInitCode :: Platform -> Module -> CollectedCCs -> CStub
profilingInitCode platform this_mod (local_CCs, singleton_CCSs)
- = vcat
+ = CStub $ vcat
$ map emit_cc_decl local_CCs
++ map emit_ccs_decl singleton_CCSs
++ [emit_cc_list local_CCs]
@@ -325,11 +325,11 @@ profilingInitCode platform this_mod (local_CCs, singleton_CCSs)
-- | Generate code to initialise info pointer origin
-- See note [Mapping Info Tables to Source Positions]
-ipInitCode :: DynFlags -> Module -> [InfoProvEnt] -> SDoc
+ipInitCode :: DynFlags -> Module -> [InfoProvEnt] -> CStub
ipInitCode dflags this_mod ents
= if not (gopt Opt_InfoTableMap dflags)
- then empty
- else withPprStyle (PprCode CStyle) $ vcat
+ then mempty
+ else CStub $ vcat
$ map emit_ipe_decl ents
++ [emit_ipe_list ents]
++ [ text "static void ip_init_" <> ppr this_mod