JuliaHubOSS / llvm-cbe

resurrected LLVM "C Backend", with improvements
Other
826 stars 141 forks source link

Ensure function and array types referenced by functions are declared #135

Closed hikari-no-yume closed 2 years ago

hikari-no-yume commented 3 years ago

A check is also added to skip metadata types in function parameter lists, which are seen in Clang output. This avoids an assertion.


This pull request fixes one of the issues described in https://github.com/JuliaComputingOSS/llvm-cbe/issues/132. The struct types change is the main part of this, but adding that revealed additional issues (metadata, array types) so I had to fix them too.

I'll freely admit this patch is suboptimal. It will create unused function typedefs for all the global functions, and I would guess it forward-declares array types unnecessarily sometimes. It does also fix real problems, though. I think in the longer term, it might be a good idea to completely rewrite the code for handling definitions and declarations…