-
Notifications
You must be signed in to change notification settings - Fork 13.8k
Replace LLVMRustContextCreate
with normal LLVM-C API calls
#147549
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Some changes occurred in compiler/rustc_codegen_gcc |
r? @nnethercote rustbot has assigned @nnethercote. Use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm no expert on this, but is this actually an improvement? LLVMRustContextCreate
isn't mentioned in #46437. And #46437 is now almost eight years old, and very little progress has apparently been made on it, which maybe suggests that it's not so important?
if a PR was filed that converted a whole bunch of the functions mentioned in #46437, that might be more compelling. But changing a single function like this... is it really worthwhile?
|
||
unsafe extern "C" { | ||
// Create and destroy contexts. | ||
pub(crate) fn LLVMContextCreate() -> &'static mut Context; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remark: Seeing &'static mut
is always terrifying, but since the existing LLVMRust binding already does the same thing, I guess this isn't making things any worse.
I've been planning some changes of my own to replace these with raw pointers, but I can just as easily do that after merging this PR, so this is fine.
IMO there is a modest benefit in making this change, since removing LLVMRust bindings makes it easier to audit the ones that remain. And in fact I was already planning a similar change of my own, so I'm willing to vouch for this being worthwhile. |
r? Zalathar |
Since `LLVMRustContextCreate` can easily be replaced with a call to `LLVMContextCreate` and `LLVMContextSetDiscardValueNames`.
5f8c98b
to
0abecda
Compare
Since
LLVMRustContextCreate
can easily be replaced with a call toLLVMContextCreate
andLLVMContextSetDiscardValueNames
.Work towards #46437