-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Description
Integrating libclang into our llvm build is a "very likely candidate" for solving all of the following issues:
- Building and compiling C code with rustc/cargo #1850 Building and compiling C code with rustc/cargo (and sub-ticket rustc should support compiling C code #1862)
- Add swig binding and/or C-compiler-fe-based bindings generator #104 Add swig binding and/or C-compiler-fe-based bindings generator (see also: Adopt rust-bindgen #2045 Adopt rust-bindgen)
- OS X Universal Binary Support #2024 OS X Universal Binary Support (clang knows how to operate
lipo
on OSX) - support LLVM subtargets #1879 support LLVM subtargets
- Use msvc on windows, not mingw #1768 Use msvc on windows, not mingw
I have a submodule'd version of the requisite pieces in my workspace here and it seems to work ok. It makes initial llvm build time longer and will involve expanding the librustllvm we ship (or shipping an additional lib). Not sure exactly how much, size-wise, but it seems to be a bit "pay as you go", so for example I think we could start using its driver module (that knows how to run various toolchains on different platforms) before we did anything concerning bindgen or compiling C code through our own libclang (vs. handing to the 'native' compiler).
Ideally, going down this road could eventually free us from using external toolchains at all; that is, once LLVM has its own linker, I expect the clang driver module will default to invoke it too, and at that point our download would be "self contained" on all platforms. Despite possibly carrying a C compiler in its belly.
Comments welcome. I realize this is a contentious proposal. But it seems like it'd be very useful, to me, and the "integration" into our build seems trivial (I just did it; took ~3 hours, mostly due to waiting on LLVM devs to fix a bug I hit).