summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2021-09-27 10:28:43 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-09-30 19:41:44 -0400
commitadc41a7747a72a526dd30e63afb03c61cee13e9a (patch)
treea4beb29496b93cf8d887d0a05dee2af9b47efc74
parent941d3792b2e6656bebdc4099be67b74a02d1f516 (diff)
downloadhaskell-adc41a7747a72a526dd30e63afb03c61cee13e9a.tar.gz
driver: Fix -E -XCPP, copy output from CPP ouput rather than .hs output
Fixes #20416 I thought about adding a test for this case but I struggled to think of something robust. Grepping -v3 will include different paths on different systems and the structure of the result file depends on which preprocessor you are using.
-rw-r--r--compiler/GHC/Driver/Pipeline.hs4
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/GHC/Driver/Pipeline.hs b/compiler/GHC/Driver/Pipeline.hs
index 4f27c99d26..8362af9423 100644
--- a/compiler/GHC/Driver/Pipeline.hs
+++ b/compiler/GHC/Driver/Pipeline.hs
@@ -904,10 +904,10 @@ pipelineStart pipe_env hsc_env input_fn =
-- File name we expected the output to have
final_fn <- liftIO $ phaseOutputFilenameNew (Hsc HsSrcFile) pipe_env hsc_env Nothing
when (final_fn /= out_fn) $ do
- let msg = "Copying `" ++ input_fn ++"' to `" ++ final_fn ++ "'"
+ let msg = "Copying `" ++ out_fn ++"' to `" ++ final_fn ++ "'"
line_prag = "{-# LINE 1 \"" ++ src_filename pipe_env ++ "\" #-}\n"
liftIO (showPass logger msg)
- liftIO (copyWithHeader line_prag input_fn final_fn)
+ liftIO (copyWithHeader line_prag out_fn final_fn)
return Nothing
_ -> objFromLinkable <$> fullPipeline pipe_env hsc_env input_fn sf
c :: P m => Phase -> m (Maybe FilePath)