summaryrefslogtreecommitdiff
path: root/compiler/nativeGen/PprBase.hs
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2019-01-17 13:34:32 +0100
committerBen Gamari <ben@smart-cactus.org>2019-01-31 12:46:51 -0500
commit4fa32293c9d2658ce504b8fe6d909db2acf59983 (patch)
tree6c7519fd6a320cbaf2264c2cbfdfe1eef0d70acc /compiler/nativeGen/PprBase.hs
parentdeab6d64eac085b2e0ec68bfb3eeeda608dfb85a (diff)
downloadhaskell-4fa32293c9d2658ce504b8fe6d909db2acf59983.tar.gz
Use ByteString to represent Cmm string literals (#16198)
Also used ByteString in some other relevant places
Diffstat (limited to 'compiler/nativeGen/PprBase.hs')
-rw-r--r--compiler/nativeGen/PprBase.hs6
1 files changed, 4 insertions, 2 deletions
diff --git a/compiler/nativeGen/PprBase.hs b/compiler/nativeGen/PprBase.hs
index 58566cf812..4cdcceec9e 100644
--- a/compiler/nativeGen/PprBase.hs
+++ b/compiler/nativeGen/PprBase.hs
@@ -34,6 +34,8 @@ import Control.Monad.ST
import Data.Word
import Data.Char
+import Data.ByteString (ByteString)
+import qualified Data.ByteString as BS
@@ -90,13 +92,13 @@ doubleToBytes d
-- Print as a string and escape non-printable characters.
-- This is similar to charToC in Utils.
-pprASCII :: [Word8] -> SDoc
+pprASCII :: ByteString -> SDoc
pprASCII str
-- Transform this given literal bytestring to escaped string and construct
-- the literal SDoc directly.
-- See Trac #14741
-- and Note [Pretty print ASCII when AsmCodeGen]
- = text $ foldr (\w s -> (do1 . fromIntegral) w ++ s) "" str
+ = text $ foldr (\w s -> (do1 . fromIntegral) w ++ s) "" (BS.unpack str)
where
do1 :: Int -> String
do1 w | '\t' <- chr w = "\\t"