Skip to content
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

Migrate to LLVM{Get,Set}ValueName2 #67033

Merged
merged 1 commit into from Dec 6, 2019
Merged

Migrate to LLVM{Get,Set}ValueName2 #67033

merged 1 commit into from Dec 6, 2019

Conversation

@cuviper
Copy link
Member

cuviper commented Dec 4, 2019

The deprecated LLVM{Get,Set}ValueName only work with NUL-terminated
strings, but the 2 variants use explicit lengths, which fits better
with Rust strings and slices. We now use these in new helper functions
llvm::{get,set}_value_name that convert to/from &[u8].

Closes #64223.
r? @rkruppe

The deprecated `LLVM{Get,Set}ValueName` only work with NUL-terminated
strings, but the `2` variants use explicit lengths, which fits better
with Rust strings and slices. We now use these in new helper functions
`llvm::{get,set}_value_name` that convert to/from `&[u8]`.
@@ -774,7 +774,8 @@ extern "C" {
pub fn LLVMIsAGlobalVariable(GlobalVar: &Value) -> Option<&Value>;
pub fn LLVMAddGlobal(M: &'a Module, Ty: &'a Type, Name: *const c_char) -> &'a Value;
pub fn LLVMGetNamedGlobal(M: &Module, Name: *const c_char) -> Option<&Value>;
pub fn LLVMRustGetOrInsertGlobal(M: &'a Module, Name: *const c_char, T: &'a Type) -> &'a Value;
pub fn LLVMRustGetOrInsertGlobal(M: &'a Module, Name: *const c_char, NameLen: size_t,
T: &'a Type) -> &'a Value;

This comment has been minimized.

Copy link
@cuviper

cuviper Dec 4, 2019

Author Member

FWIW, I think there's an opportunity to convert a lot more of these LLVMRust wrappers to pointer+len strings, using StringRef on the actual C++ LLVM call, but for now I only changed a couple that were involved with the ValueName calls.

This comment has been minimized.

Copy link
@rkruppe

rkruppe Dec 4, 2019

Member

Agreed. I also wouldn't object if you did the rest too but it's not necessary.

This comment has been minimized.

Copy link
@cuviper

cuviper Dec 4, 2019

Author Member

I'll probably work on those incrementally, in separate PRs.

@rkruppe

This comment has been minimized.

Copy link
Member

rkruppe commented Dec 4, 2019

Thanks! @bors r+

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Dec 4, 2019

📌 Commit 16d2178 has been approved by rkruppe

JohnTitor added a commit to JohnTitor/rust that referenced this pull request Dec 6, 2019
Migrate to LLVM{Get,Set}ValueName2

The deprecated `LLVM{Get,Set}ValueName` only work with NUL-terminated
strings, but the `2` variants use explicit lengths, which fits better
with Rust strings and slices. We now use these in new helper functions
`llvm::{get,set}_value_name` that convert to/from `&[u8]`.

Closes rust-lang#64223.
r? @rkruppe
bors added a commit that referenced this pull request Dec 6, 2019
Rollup of 11 pull requests

Successful merges:

 - #66846 (Make try_mark_previous_green aware of cycles.)
 - #66959 (Remove potential cfgs duplicates)
 - #66988 (Fix angle bracket formatting when dumping MIR debug vars)
 - #66998 (Modified the testcases for VxWorks)
 - #67008 (rustdoc: Add test for fixed issue)
 - #67023 (SGX: Fix target linker used by bootstrap)
 - #67033 (Migrate to LLVM{Get,Set}ValueName2)
 - #67049 (Simplify {IoSlice, IoSliceMut}::advance examples and tests)
 - #67054 (codegen "unreachable" for invalid SetDiscriminant)
 - #67081 (Fix Query type docs)
 - #67085 (Remove boxed closures in address parser.)

Failed merges:

r? @ghost
@bors bors merged commit 16d2178 into rust-lang:master Dec 6, 2019
4 checks passed
4 checks passed
pr #20191204.42 succeeded
Details
pr (Linux mingw-check) Linux mingw-check succeeded
Details
pr (Linux x86_64-gnu-llvm-7) Linux x86_64-gnu-llvm-7 succeeded
Details
pr (Linux x86_64-gnu-tools) Linux x86_64-gnu-tools succeeded
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.