diff options
-rw-r--r-- | compiler/GHC/Driver/Pipeline.hs | 13 | ||||
-rw-r--r-- | testsuite/tests/driver/Makefile | 10 | ||||
-rw-r--r-- | testsuite/tests/driver/T21349/A.hs | 5 | ||||
-rw-r--r-- | testsuite/tests/driver/T21349/B.hs | 5 | ||||
-rw-r--r-- | testsuite/tests/driver/T21349/Main.hs | 5 | ||||
-rw-r--r-- | testsuite/tests/driver/all.T | 1 |
6 files changed, 30 insertions, 9 deletions
diff --git a/compiler/GHC/Driver/Pipeline.hs b/compiler/GHC/Driver/Pipeline.hs index 02ca6a4b57..89a4329745 100644 --- a/compiler/GHC/Driver/Pipeline.hs +++ b/compiler/GHC/Driver/Pipeline.hs @@ -229,13 +229,12 @@ compileOne' mHscMessage debugTraceMsg logger 2 (text "compile: input file" <+> text input_fnpp) - let flags = hsc_dflags hsc_env0 - in do unless (gopt Opt_KeepHiFiles flags) $ - addFilesToClean tmpfs TFL_CurrentModule $ - [ml_hi_file $ ms_location summary] - unless (gopt Opt_KeepOFiles flags) $ - addFilesToClean tmpfs TFL_GhcSession $ - [ml_obj_file $ ms_location summary] + unless (gopt Opt_KeepHiFiles lcl_dflags) $ + addFilesToClean tmpfs TFL_CurrentModule $ + [ml_hi_file $ ms_location summary] + unless (gopt Opt_KeepOFiles lcl_dflags) $ + addFilesToClean tmpfs TFL_GhcSession $ + [ml_obj_file $ ms_location summary] plugin_hsc_env <- initializePlugins hsc_env let pipe_env = mkPipeEnv NoStop input_fn pipelineOutput diff --git a/testsuite/tests/driver/Makefile b/testsuite/tests/driver/Makefile index b30c8a77cb..30ca61b8e5 100644 --- a/testsuite/tests/driver/Makefile +++ b/testsuite/tests/driver/Makefile @@ -755,11 +755,11 @@ T16476b: echo '-XCPP' >> unit-a echo '-DTEST' >> unit-a echo 'T16476b.hs' >> unit-a - + echo '--make' > resp echo '-unit' > resp echo '@unit-a' > resp - + "$(TEST_HC)" $(TEST_HC_OPTS) -v0 @resp ./T16476b @@ -767,3 +767,9 @@ T16476b: T20569: "$(TEST_HC)" $(TEST_HC_OPTS) -c T20569/A.hs -i -iT20569 -hidir=interface "$(TEST_HC)" $(TEST_HC_OPTS) -c T20569/B.hs -i -iT20569 -hidir=interface + +.PHONY: T21349 +T21349: + "$(TEST_HC)" $(TEST_HC_OPTS) -v0 Main -working-dir T21349 + [ ! -f T21349/B.o ] || (echo "object file exists" && exit 2) + [ ! -f T21349/B.hi ] || (echo "interface file exists" && exit 2) diff --git a/testsuite/tests/driver/T21349/A.hs b/testsuite/tests/driver/T21349/A.hs new file mode 100644 index 0000000000..bc9832431c --- /dev/null +++ b/testsuite/tests/driver/T21349/A.hs @@ -0,0 +1,5 @@ +module A where + +import B + +foo = b diff --git a/testsuite/tests/driver/T21349/B.hs b/testsuite/tests/driver/T21349/B.hs new file mode 100644 index 0000000000..30dbdafcc1 --- /dev/null +++ b/testsuite/tests/driver/T21349/B.hs @@ -0,0 +1,5 @@ +{-# OPTIONS_GHC -no-keep-hi-files #-} +{-# OPTIONS_GHC -no-keep-o-files #-} +module B where + +b = () diff --git a/testsuite/tests/driver/T21349/Main.hs b/testsuite/tests/driver/T21349/Main.hs new file mode 100644 index 0000000000..ce96eb7408 --- /dev/null +++ b/testsuite/tests/driver/T21349/Main.hs @@ -0,0 +1,5 @@ +module Main where + +import A + +main = print foo diff --git a/testsuite/tests/driver/all.T b/testsuite/tests/driver/all.T index 35ee56dc52..3dc704a19d 100644 --- a/testsuite/tests/driver/all.T +++ b/testsuite/tests/driver/all.T @@ -307,3 +307,4 @@ test('patch-level2', normal, compile, ['-Wcpp-undef']) test('T16476a', normal, makefile_test, []) test('T16476b', normal, makefile_test, []) test('T20569', extra_files(["T20569/"]), makefile_test, []) +test('T21349', extra_files(['T21349']), makefile_test, []) |