1
Fork 0

Auto merge of #118566 - klensy:cstr-new, r=WaffleLapkin

use c literals in compiler and library

Relands refreshed https://github.com/rust-lang/rust/pull/111647
This commit is contained in:
bors 2023-12-14 11:14:03 +00:00
commit 1aa6aefdc9
23 changed files with 67 additions and 96 deletions

View file

@ -21,7 +21,6 @@ use crate::llvm::debuginfo::{
};
use crate::value::Value;
use cstr::cstr;
use rustc_codegen_ssa::debuginfo::type_names::cpp_like_debuginfo;
use rustc_codegen_ssa::debuginfo::type_names::VTableNameKind;
use rustc_codegen_ssa::traits::*;
@ -856,7 +855,6 @@ pub fn build_compile_unit_di_node<'ll, 'tcx>(
use rustc_session::RemapFileNameExt;
let name_in_debuginfo = name_in_debuginfo.to_string_lossy();
let work_dir = tcx.sess.opts.working_dir.for_codegen(tcx.sess).to_string_lossy();
let flags = "\0";
let output_filenames = tcx.output_filenames(());
let split_name = if tcx.sess.target_can_use_split_dwarf() {
output_filenames
@ -910,7 +908,7 @@ pub fn build_compile_unit_di_node<'ll, 'tcx>(
producer.as_ptr().cast(),
producer.len(),
tcx.sess.opts.optimize != config::OptLevel::No,
flags.as_ptr().cast(),
c"".as_ptr().cast(),
0,
// NB: this doesn't actually have any perceptible effect, it seems. LLVM will instead
// put the path supplied to `MCSplitDwarfFile` into the debug info of the final
@ -940,8 +938,7 @@ pub fn build_compile_unit_di_node<'ll, 'tcx>(
);
let val = llvm::LLVMMetadataAsValue(debug_context.llcontext, gcov_metadata);
let llvm_gcov_ident = cstr!("llvm.gcov");
llvm::LLVMAddNamedMetadataOperand(debug_context.llmod, llvm_gcov_ident.as_ptr(), val);
llvm::LLVMAddNamedMetadataOperand(debug_context.llmod, c"llvm.gcov".as_ptr(), val);
}
return unit_metadata;