Core and simplifier dumps should list the name of ffi functions called.
Motivation
Given this code
{-# LANGUAGE ForeignFunctionInterface, CPP #-}
{-# LANGUAGE BangPatterns #-}
module Main where
import Data.Bits (setBit)
import Data.Word (Word32)
import Data.Int (Int64)
main :: IO ()
main = offending 100 0 1
offending :: Int64 -> Int64 -> Word32 -> IO ()
offending h i id = do
oldMask <- sendMessage h (2245) 0
let newMask = setBit oldMask (fromIntegral id)
sendMessage h (2244) newMask
return ()
foreign import ccall "func" sendMessage :: Int64 -> Word32 -> Int64 -> IO Int64
--------------------------------
// C Code
#include <stdio.h>
#include <stdint.h>
int64_t func(int64_t a, int64_t d) {
printf("ffi call");
if (a == 1) {
printf(" with corrupted convention\n");
}
else {
printf("\n");
}
return 0;
}
The FFI calls show up as something like this:
case {__pkg_ccall_GC main Int#
-> Word#
-> Int#
-> State# RealWorld
-> (# State# RealWorld, Int# #)}_d14o
ww_s2eI 2244## ds1_d14l ds_d14m
of
{ (# ds2_X15i, ds3_X16f #) ->
src<Main.hs:18:5-13>
(# ds2_X15i, src<Main.hs:18:12-13> GHC.Tuple.() #)
}
But it would really help readability and grepability of these things if they contained the name of the function we are calling.