<div dir="ltr">Hi everyone,<div><br></div><div>I was playing around with the LLVM toolchain and it occurred to me that, should I decide to target LLVM IR, it would be neat to have Clang generate declarations from C header files for easier FFI. Someone seems to have had my same idea [1] [2]. This is kind of the opposite of what other projects have gone for, where they use libclang to parse header files to achieve the same result [3].</div><div><br></div><div>Now, forward declaration generation is doable by patching CodeGenModule.cpp (I kinda have a PoC working locally, except it generates *all* the forward declarations, instead of just the ones from the header files I care about)</div><div><br></div><div>Is this something that you guys would be interested in merging into Clang through a flag? Or what would the proper way to do this be? </div><div>I saw there's a `-femit-all-decls`, but it doesn't really emit all declarations.</div><div><br></div><div><div>Apologies if this is a dumb idea, kinda new to the whole Clang thing :)!</div></div><div><br></div><div>Cheers,</div><div><br></div><div>-yawnt</div><div><br></div><div>[1] <a href="http://stackoverflow.com/questions/24728901/clang-compiling-a-c-header-to-llvm-ir-bitcode">http://stackoverflow.com/questions/24728901/clang-compiling-a-c-header-to-llvm-ir-bitcode</a></div><div>[2] <a href="http://stackoverflow.com/questions/14032496/how-can-i-code-generate-unused-declarations-with-clang?noredirect=1&lq=1">http://stackoverflow.com/questions/14032496/how-can-i-code-generate-unused-declarations-with-clang?noredirect=1&lq=1</a></div><div>[3] <a href="https://github.com/tjfontaine/node-ffi-generate">https://github.com/tjfontaine/node-ffi-generate</a></div></div>