22
33use std:: ffi:: CString ;
44
5+ use cstr:: cstr;
56use rustc_codegen_ssa:: traits:: * ;
6- use rustc_data_structures:: const_cstr;
77use rustc_data_structures:: fx:: FxHashMap ;
88use rustc_data_structures:: small_c_str:: SmallCStr ;
99use rustc_hir:: def_id:: DefId ;
@@ -75,8 +75,8 @@ pub fn set_frame_pointer_elimination(cx: &CodegenCx<'ll, '_>, llfn: &'ll Value)
7575 llvm:: AddFunctionAttrStringValue (
7676 llfn,
7777 llvm:: AttributePlace :: Function ,
78- const_cstr ! ( "frame-pointer" ) ,
79- const_cstr ! ( "all" ) ,
78+ cstr ! ( "frame-pointer" ) ,
79+ cstr ! ( "all" ) ,
8080 ) ;
8181 }
8282}
@@ -95,7 +95,7 @@ fn set_instrument_function(cx: &CodegenCx<'ll, '_>, llfn: &'ll Value) {
9595 llvm:: AddFunctionAttrStringValue (
9696 llfn,
9797 llvm:: AttributePlace :: Function ,
98- const_cstr ! ( "instrument-function-entry-inlined" ) ,
98+ cstr ! ( "instrument-function-entry-inlined" ) ,
9999 & mcount_name,
100100 ) ;
101101 }
@@ -129,24 +129,24 @@ fn set_probestack(cx: &CodegenCx<'ll, '_>, llfn: &'ll Value) {
129129 StackProbeType :: None => None ,
130130 // Request LLVM to generate the probes inline. If the given LLVM version does not support
131131 // this, no probe is generated at all (even if the attribute is specified).
132- StackProbeType :: Inline => Some ( const_cstr ! ( "inline-asm" ) ) ,
132+ StackProbeType :: Inline => Some ( cstr ! ( "inline-asm" ) ) ,
133133 // Flag our internal `__rust_probestack` function as the stack probe symbol.
134134 // This is defined in the `compiler-builtins` crate for each architecture.
135- StackProbeType :: Call => Some ( const_cstr ! ( "__rust_probestack" ) ) ,
135+ StackProbeType :: Call => Some ( cstr ! ( "__rust_probestack" ) ) ,
136136 // Pick from the two above based on the LLVM version.
137137 StackProbeType :: InlineOrCall { min_llvm_version_for_inline } => {
138138 if llvm_util:: get_version ( ) < min_llvm_version_for_inline {
139- Some ( const_cstr ! ( "__rust_probestack" ) )
139+ Some ( cstr ! ( "__rust_probestack" ) )
140140 } else {
141- Some ( const_cstr ! ( "inline-asm" ) )
141+ Some ( cstr ! ( "inline-asm" ) )
142142 }
143143 }
144144 } ;
145145 if let Some ( attr_value) = attr_value {
146146 llvm:: AddFunctionAttrStringValue (
147147 llfn,
148148 llvm:: AttributePlace :: Function ,
149- const_cstr ! ( "probe-stack" ) ,
149+ cstr ! ( "probe-stack" ) ,
150150 attr_value,
151151 ) ;
152152 }
@@ -169,7 +169,7 @@ pub fn apply_target_cpu_attr(cx: &CodegenCx<'ll, '_>, llfn: &'ll Value) {
169169 llvm:: AddFunctionAttrStringValue (
170170 llfn,
171171 llvm:: AttributePlace :: Function ,
172- const_cstr ! ( "target-cpu" ) ,
172+ cstr ! ( "target-cpu" ) ,
173173 target_cpu. as_c_str ( ) ,
174174 ) ;
175175}
@@ -180,7 +180,7 @@ pub fn apply_tune_cpu_attr(cx: &CodegenCx<'ll, '_>, llfn: &'ll Value) {
180180 llvm:: AddFunctionAttrStringValue (
181181 llfn,
182182 llvm:: AttributePlace :: Function ,
183- const_cstr ! ( "tune-cpu" ) ,
183+ cstr ! ( "tune-cpu" ) ,
184184 tune_cpu. as_c_str ( ) ,
185185 ) ;
186186 }
@@ -289,7 +289,7 @@ pub fn from_fn_attrs(cx: &CodegenCx<'ll, 'tcx>, llfn: &'ll Value, instance: ty::
289289 Attribute :: NoAlias . apply_llfn ( llvm:: AttributePlace :: ReturnValue , llfn) ;
290290 }
291291 if codegen_fn_attrs. flags . contains ( CodegenFnAttrFlags :: CMSE_NONSECURE_ENTRY ) {
292- llvm:: AddFunctionAttrString ( llfn, Function , const_cstr ! ( "cmse_nonsecure_entry" ) ) ;
292+ llvm:: AddFunctionAttrString ( llfn, Function , cstr ! ( "cmse_nonsecure_entry" ) ) ;
293293 }
294294 sanitize ( cx, codegen_fn_attrs. no_sanitize , llfn) ;
295295
@@ -319,7 +319,7 @@ pub fn from_fn_attrs(cx: &CodegenCx<'ll, 'tcx>, llfn: &'ll Value, instance: ty::
319319 llvm:: AddFunctionAttrStringValue (
320320 llfn,
321321 llvm:: AttributePlace :: Function ,
322- const_cstr ! ( "target-features" ) ,
322+ cstr ! ( "target-features" ) ,
323323 & val,
324324 ) ;
325325 }
@@ -332,7 +332,7 @@ pub fn from_fn_attrs(cx: &CodegenCx<'ll, 'tcx>, llfn: &'ll Value, instance: ty::
332332 llvm:: AddFunctionAttrStringValue (
333333 llfn,
334334 llvm:: AttributePlace :: Function ,
335- const_cstr ! ( "wasm-import-module" ) ,
335+ cstr ! ( "wasm-import-module" ) ,
336336 & module,
337337 ) ;
338338
@@ -342,7 +342,7 @@ pub fn from_fn_attrs(cx: &CodegenCx<'ll, 'tcx>, llfn: &'ll Value, instance: ty::
342342 llvm:: AddFunctionAttrStringValue (
343343 llfn,
344344 llvm:: AttributePlace :: Function ,
345- const_cstr ! ( "wasm-import-name" ) ,
345+ cstr ! ( "wasm-import-name" ) ,
346346 & name,
347347 ) ;
348348 }
0 commit comments