+
+-- -----------------------------------------------------------------------------
+-- Misc.
+
+hscNextPhase :: HscLang -> IO Phase
+hscNextPhase hsc_lang = do
+ split <- readIORef v_Split_object_files
+ return (case hsc_lang of
+ HscC -> HCc
+ HscAsm | split -> SplitMangle
+ | otherwise -> As
+ HscNothing -> HCc
+ )
+
+hscMaybeAdjustLang :: HscLang -> IO HscLang
+hscMaybeAdjustLang current_hsc_lang = do
+ todo <- readIORef v_GhcMode
+ keep_hc <- readIORef v_Keep_hc_files
+ let hsc_lang
+ -- don't change the lang if we're interpreting
+ | current_hsc_lang == HscInterpreted = current_hsc_lang
+ -- force -fvia-C if we are being asked for a .hc file
+ | todo == StopBefore HCc || keep_hc = HscC
+ -- otherwise, stick to the plan
+ | otherwise = current_hsc_lang
+ return hsc_lang