Commit 222e99d9 authored by Ben Gamari's avatar Ben Gamari Committed by Ben Gamari

Make up a module name for c-- files

We used to pass a bottoming Module to the NCG, which resulted in panics
when `-v` was used due to debug output (see #11784). Instead we make up
a module name. This is a bit scary since `PIC.howToAccessLabel` might
actually use the Module, but if it wasn't crashing before I suppose it's

Test Plan: `touch hi.cmm; ghc -v2 -c -dcmm-lint hi.cmm`

Reviewers: austin, simonmar

Reviewed By: simonmar

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #11784
parent 5bf344b7
......@@ -1363,10 +1363,13 @@ hscCompileCmmFile hsc_env filename output_filename = runHsc hsc_env $ do
dumpIfSet_dyn dflags Opt_D_dump_cmm_verbose "Parsed Cmm" (ppr cmm)
(_, cmmgroup) <- cmmPipeline hsc_env initTopSRT cmm
rawCmms <- cmmToRawCmm dflags (Stream.yield cmmgroup)
_ <- codeOutput dflags no_mod output_filename no_loc NoStubs [] rawCmms
let -- Make up a module name to give the NCG. We can't pass bottom here
-- lest we reproduce #11784.
mod_name = mkModuleName $ "Cmm$" ++ FilePath.takeFileName filename
cmm_mod = mkModule (thisPackage dflags) mod_name
_ <- codeOutput dflags cmm_mod output_filename no_loc NoStubs [] rawCmms
return ()
no_mod = panic "hscCompileCmmFile: no_mod"
no_loc = ModLocation{ ml_hs_file = Just filename,
ml_hi_file = panic "hscCompileCmmFile: no hi file",
ml_obj_file = panic "hscCompileCmmFile: no obj file" }
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment