cg_llvm: Replace some DIBuilder wrappers with LLVM-C API bindings (part 5)#146763
Merged
bors merged 6 commits intorust-lang:masterfrom Sep 28, 2025
Merged
cg_llvm: Replace some DIBuilder wrappers with LLVM-C API bindings (part 5)#146763bors merged 6 commits intorust-lang:masterfrom
bors merged 6 commits intorust-lang:masterfrom
Conversation
In each of these casts, the LHS is already `u64`.
Collaborator
|
rustbot has assigned @jdonszelmann. Use |
These should have been removed earlier, when we switched to the corresponding LLVM-C bindings.
Contributor
|
Seems like a well deserved cleanup removing some ancient cruft. Though I'm no expert on LLVM internals, this doesn't look like a very complicated nor dangerous change, and no test output changed, so I'll approve it as is. @bors r+ |
Collaborator
Zalathar
added a commit
to Zalathar/rust
that referenced
this pull request
Sep 28, 2025
cg_llvm: Replace some DIBuilder wrappers with LLVM-C API bindings (part 5) - Part of rust-lang#134001 - Follow-up to rust-lang#146673 --- This is another batch of LLVMDIBuilder binding migrations, replacing some our own LLVMRust bindings with bindings to upstream LLVM-C APIs. Some of these are a little more complex than most of the previous migrations, because they split one LLVMRust binding into multiple LLVM bindings, but nothing too fancy. This appears to be the last of the low-hanging fruit. As noted in rust-lang#134001 (comment), the remaining bindings are difficult or impossible to migrate at present.
bors
added a commit
that referenced
this pull request
Sep 28, 2025
Rollup of 16 pull requests Successful merges: - #142139 (Include additional hashes in src/stage0) - #146745 (Clarified error note for usize range matching) - #146763 (cg_llvm: Replace some DIBuilder wrappers with LLVM-C API bindings (part 5)) - #146788 (chore: removes deprecated discord.) - #146942 ([rustdoc] Finish getting rid of usages `write_str`) - #147002 (rustdoc-search: stringdex update with more packing) - #147061 (fix rebasing cycle heads when not reaching a fixpoint) - #147066 (Fix tracking issue number for feature(macro_attr)) - #147081 (doc: fix a typo in platform-support.md) - #147082 (formatting_options: fix alternate docs 0b/0o mixup) - #147086 (compiletest: Use `PanicHookInfo::payload_as_str` now that it's stable in beta) - #147092 (Do not compute optimized MIR if code does not type-check.) - #147093 (redox: switch to colon as path separator) - #147095 (Library: Remove remaining private `#[repr]` workarounds) - #147098 (Add auto extra-checks in pre-push hook) - #147110 (Fix typo) r? `@ghost` `@rustbot` modify labels: rollup
bors
added a commit
that referenced
this pull request
Sep 28, 2025
Rollup of 14 pull requests Successful merges: - #142139 (Include additional hashes in src/stage0) - #146745 (Clarified error note for usize range matching) - #146763 (cg_llvm: Replace some DIBuilder wrappers with LLVM-C API bindings (part 5)) - #146788 (chore: removes deprecated discord.) - #146942 ([rustdoc] Finish getting rid of usages `write_str`) - #147061 (fix rebasing cycle heads when not reaching a fixpoint) - #147066 (Fix tracking issue number for feature(macro_attr)) - #147081 (doc: fix a typo in platform-support.md) - #147082 (formatting_options: fix alternate docs 0b/0o mixup) - #147086 (compiletest: Use `PanicHookInfo::payload_as_str` now that it's stable in beta) - #147093 (redox: switch to colon as path separator) - #147095 (Library: Remove remaining private `#[repr]` workarounds) - #147098 (Add auto extra-checks in pre-push hook) - #147110 (Fix typo) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
that referenced
this pull request
Sep 28, 2025
Rollup merge of #146763 - Zalathar:di-builder, r=jdonszelmann cg_llvm: Replace some DIBuilder wrappers with LLVM-C API bindings (part 5) - Part of #134001 - Follow-up to #146673 --- This is another batch of LLVMDIBuilder binding migrations, replacing some our own LLVMRust bindings with bindings to upstream LLVM-C APIs. Some of these are a little more complex than most of the previous migrations, because they split one LLVMRust binding into multiple LLVM bindings, but nothing too fancy. This appears to be the last of the low-hanging fruit. As noted in #134001 (comment), the remaining bindings are difficult or impossible to migrate at present.
GuillaumeGomez
added a commit
to GuillaumeGomez/rust
that referenced
this pull request
Oct 13, 2025
cg_llvm: Use `LLVMDIBuilderCreateGlobalVariableExpression` - Part of rust-lang#134001 - Follow-up to rust-lang#146763 --- This PR dismantles the somewhat complicated `LLVMRustDIBuilderCreateStaticVariable` function, and replaces it with equivalent calls to `LLVMDIBuilderCreateGlobalVariableExpression` and `LLVMGlobalSetMetadata`. A key difference is that the new code does not replicate the attempted downcast of `InitVal`. As far as I can tell, those downcasts were actually dead, because `llvm::ConstantInt` and `llvm::ConstantFP` are not subclasses of `llvm::GlobalVariable`. I tried replacing those code paths with fatal errors, and was unable to induce failure in any of the relevant test suites I ran. I have also confirmed that if the calls to `create_static_variable` are commented out, debuginfo tests will fail, demonstrating some amount of relevant test coverage. The new `DIBuilder` methods have been added via an extension trait, not as inherent methods, to avoid impeding rust-lang#142897.
GuillaumeGomez
added a commit
to GuillaumeGomez/rust
that referenced
this pull request
Oct 13, 2025
cg_llvm: Use `LLVMDIBuilderCreateGlobalVariableExpression` - Part of rust-lang#134001 - Follow-up to rust-lang#146763 --- This PR dismantles the somewhat complicated `LLVMRustDIBuilderCreateStaticVariable` function, and replaces it with equivalent calls to `LLVMDIBuilderCreateGlobalVariableExpression` and `LLVMGlobalSetMetadata`. A key difference is that the new code does not replicate the attempted downcast of `InitVal`. As far as I can tell, those downcasts were actually dead, because `llvm::ConstantInt` and `llvm::ConstantFP` are not subclasses of `llvm::GlobalVariable`. I tried replacing those code paths with fatal errors, and was unable to induce failure in any of the relevant test suites I ran. I have also confirmed that if the calls to `create_static_variable` are commented out, debuginfo tests will fail, demonstrating some amount of relevant test coverage. The new `DIBuilder` methods have been added via an extension trait, not as inherent methods, to avoid impeding rust-lang#142897.
rust-timer
added a commit
that referenced
this pull request
Oct 13, 2025
Rollup merge of #147608 - Zalathar:debuginfo, r=nnethercote cg_llvm: Use `LLVMDIBuilderCreateGlobalVariableExpression` - Part of #134001 - Follow-up to #146763 --- This PR dismantles the somewhat complicated `LLVMRustDIBuilderCreateStaticVariable` function, and replaces it with equivalent calls to `LLVMDIBuilderCreateGlobalVariableExpression` and `LLVMGlobalSetMetadata`. A key difference is that the new code does not replicate the attempted downcast of `InitVal`. As far as I can tell, those downcasts were actually dead, because `llvm::ConstantInt` and `llvm::ConstantFP` are not subclasses of `llvm::GlobalVariable`. I tried replacing those code paths with fatal errors, and was unable to induce failure in any of the relevant test suites I ran. I have also confirmed that if the calls to `create_static_variable` are commented out, debuginfo tests will fail, demonstrating some amount of relevant test coverage. The new `DIBuilder` methods have been added via an extension trait, not as inherent methods, to avoid impeding #142897.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
cg_llvmdebuginfo handling to use the LLVM-C API #134001This is another batch of LLVMDIBuilder binding migrations, replacing some our own LLVMRust bindings with bindings to upstream LLVM-C APIs.
Some of these are a little more complex than most of the previous migrations, because they split one LLVMRust binding into multiple LLVM bindings, but nothing too fancy.
This appears to be the last of the low-hanging fruit. As noted in #134001 (comment), the remaining bindings are difficult or impossible to migrate at present.