X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Fmain%2FDriverPipeline.hs;h=1ee2924f33cf4092519c11ea96621298fced5a15;hb=cf411c9ae5d61d6e5baa5e5e6b0ad9803b041236;hp=59f072197c8b47570f727bd6d75da01c8819cc27;hpb=50ebea6a8607f4d83dd2d8d99acf9a55e4d39349;p=ghc-hetmet.git diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs index 59f0721..1ee2924 100644 --- a/compiler/main/DriverPipeline.hs +++ b/compiler/main/DriverPipeline.hs @@ -29,7 +29,7 @@ module DriverPipeline ( import Packages import HeaderInfo import DriverPhases -import SysTools ( newTempName, addFilesToClean, copy ) +import SysTools import qualified SysTools import HscMain import Finder @@ -442,17 +442,19 @@ runPipeline stop_phase dflags (input_fn, mb_phase) output maybe_loc -- Sometimes, a compilation phase doesn't actually generate any output -- (eg. the CPP phase when -fcpp is not turned on). If we end on this -- stage, but we wanted to keep the output, then we have to explicitly - -- copy the file. + -- copy the file, remembering to prepend a {-# LINE #-} pragma so that + -- further compilation stages can tell what the original filename was. case output of Temporary -> return (dflags', output_fn) _other -> do final_fn <- get_output_fn dflags' stop_phase maybe_loc - when (final_fn /= output_fn) $ - copy dflags ("Copying `" ++ output_fn ++ "' to `" ++ final_fn - ++ "'") output_fn final_fn + when (final_fn /= output_fn) $ do + let msg = ("Copying `" ++ output_fn ++"' to `" ++ final_fn ++ "'") + line_prag = Just ("{-# LINE 1 \"" ++ input_fn ++ "\" #-}\n") + copyWithHeader dflags msg line_prag output_fn final_fn return (dflags', final_fn) - + pipeLoop :: DynFlags -> Phase -> Phase