cg_llvm: Use LLVMDIBuilderCreateGlobalVariableExpression#147608
Merged
bors merged 5 commits intorust-lang:masterfrom Oct 13, 2025
Merged
cg_llvm: Use LLVMDIBuilderCreateGlobalVariableExpression#147608bors merged 5 commits intorust-lang:masterfrom
LLVMDIBuilderCreateGlobalVariableExpression#147608bors merged 5 commits intorust-lang:masterfrom
Conversation
Collaborator
|
r? @nnethercote rustbot has assigned @nnethercote. Use |
Note that the code in `LLVMRustDIBuilderCreateStaticVariable` that tried to downcast `InitVal` appears to have been dead, because `llvm::ConstantInt` and `llvm::ConstantFP` are not subclasses of `llvm::GlobalVariable`.
nnethercote
approved these changes
Oct 13, 2025
Contributor
|
@bors r+ rollup |
Collaborator
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.
This was referenced Oct 13, 2025
bors
added a commit
that referenced
this pull request
Oct 13, 2025
Rollup of 6 pull requests Successful merges: - #147514 (repr_transparent_external_private_fields: normalize types during traversal) - #147605 (Add doc links between `{integer}::from_str_radix` and `from_str`) - #147608 (cg_llvm: Use `LLVMDIBuilderCreateGlobalVariableExpression`) - #147623 (Clear `ChunkedBitSet` without reallocating) - #147625 (Add a warning when running tests with the GCC backend and debug assertions are enabled) - #147626 (Generalize configuring LLD as the default linker in bootstrap) r? `@ghost` `@rustbot` modify labels: rollup
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 PR dismantles the somewhat complicated
LLVMRustDIBuilderCreateStaticVariablefunction, and replaces it with equivalent calls toLLVMDIBuilderCreateGlobalVariableExpressionandLLVMGlobalSetMetadata.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, becausellvm::ConstantIntandllvm::ConstantFPare not subclasses ofllvm::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_variableare commented out, debuginfo tests will fail, demonstrating some amount of relevant test coverage.The new
DIBuildermethods have been added via an extension trait, not as inherent methods, to avoid impeding #142897.