summaryrefslogtreecommitdiff
path: root/compiler/GHC/Tc/Gen/Foreign.hs
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2020-06-29 22:36:40 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-07-22 20:19:59 -0400
commitf7cc431341e5b5b31758eecc8504cae8b2390c10 (patch)
tree7404d90376432d5a311a7fc6355b02085a1a5367 /compiler/GHC/Tc/Gen/Foreign.hs
parent735f9d6bac316a0c1c68a8b49bba465f07b01cdd (diff)
downloadhaskell-f7cc431341e5b5b31758eecc8504cae8b2390c10.tar.gz
Replace HscTarget with Backend
They both have the same role and Backend name is more explicit. Metric Decrease: T3064 Update Haddock submodule
Diffstat (limited to 'compiler/GHC/Tc/Gen/Foreign.hs')
-rw-r--r--compiler/GHC/Tc/Gen/Foreign.hs33
1 files changed, 17 insertions, 16 deletions
diff --git a/compiler/GHC/Tc/Gen/Foreign.hs b/compiler/GHC/Tc/Gen/Foreign.hs
index df699b9b78..902829fb68 100644
--- a/compiler/GHC/Tc/Gen/Foreign.hs
+++ b/compiler/GHC/Tc/Gen/Foreign.hs
@@ -57,6 +57,7 @@ import GHC.Core.TyCon
import GHC.Tc.Utils.TcType
import GHC.Builtin.Names
import GHC.Driver.Session
+import GHC.Driver.Backend
import GHC.Utils.Outputable as Outputable
import GHC.Platform
import GHC.Types.SrcLoc
@@ -474,31 +475,31 @@ checkSafe, noCheckSafe :: Bool
checkSafe = True
noCheckSafe = False
--- Checking a supported backend is in use
-
-checkCOrAsmOrLlvm :: HscTarget -> Validity
-checkCOrAsmOrLlvm HscC = IsValid
-checkCOrAsmOrLlvm HscAsm = IsValid
-checkCOrAsmOrLlvm HscLlvm = IsValid
+-- | Checking a supported backend is in use
+checkCOrAsmOrLlvm :: Backend -> Validity
+checkCOrAsmOrLlvm ViaC = IsValid
+checkCOrAsmOrLlvm NCG = IsValid
+checkCOrAsmOrLlvm LLVM = IsValid
checkCOrAsmOrLlvm _
= NotValid (text "requires unregisterised, llvm (-fllvm) or native code generation (-fasm)")
-checkCOrAsmOrLlvmOrInterp :: HscTarget -> Validity
-checkCOrAsmOrLlvmOrInterp HscC = IsValid
-checkCOrAsmOrLlvmOrInterp HscAsm = IsValid
-checkCOrAsmOrLlvmOrInterp HscLlvm = IsValid
-checkCOrAsmOrLlvmOrInterp HscInterpreted = IsValid
+-- | Checking a supported backend is in use
+checkCOrAsmOrLlvmOrInterp :: Backend -> Validity
+checkCOrAsmOrLlvmOrInterp ViaC = IsValid
+checkCOrAsmOrLlvmOrInterp NCG = IsValid
+checkCOrAsmOrLlvmOrInterp LLVM = IsValid
+checkCOrAsmOrLlvmOrInterp Interpreter = IsValid
checkCOrAsmOrLlvmOrInterp _
= NotValid (text "requires interpreted, unregisterised, llvm or native code generation")
-checkCg :: (HscTarget -> Validity) -> TcM ()
+checkCg :: (Backend -> Validity) -> TcM ()
checkCg check = do
dflags <- getDynFlags
- let target = hscTarget dflags
- case target of
- HscNothing -> return ()
+ let bcknd = backend dflags
+ case bcknd of
+ NoBackend -> return ()
_ ->
- case check target of
+ case check bcknd of
IsValid -> return ()
NotValid err -> addErrTc (text "Illegal foreign declaration:" <+> err)