New Issue: should --llvm compilation generate C headers for export procs?

16930, “mppf”, “should --llvm compilation generate C headers for export procs?”, “2021-01-11T20:32:31Z”

Split off from #12132.

Today with --llvm, we don’t generate C headers for export procs since we don’t make a header at all in that mode. Should we be generating a header in that event?

I would imagine that we would want to generate C headers for export proc and the types used in their arguments during --llvm compilation. I’d expect that we’d want to do that first, before trying to compile anything with LLVM. Then, we can include this code in the C code that we ask the embedded clang to compile.

This is related to ABI support as well because we can’t properly generate function definitons or calls without having C AST for them (because our current strategy uses clang’s ABI support).

If we start generating these headers, we will have to worry about the potential for the user to be including a .h file a user has written for the export procs which might be incompatible (from the point of view of the C type system) with the one we generate. (Here I am thinking about things like the difference between int and int32_t in the C prototypes - these are considered the same in our compiler but are different in the C type system. Another issue that might come up is that our compiler doesn’t represent const int32_t* differently from int32_t *.)