2
2
3
3
use std:: ffi:: CString ;
4
4
5
+ use cstr:: cstr;
5
6
use rustc_codegen_ssa:: traits:: * ;
6
- use rustc_data_structures:: const_cstr;
7
7
use rustc_data_structures:: fx:: FxHashMap ;
8
8
use rustc_data_structures:: small_c_str:: SmallCStr ;
9
9
use rustc_hir:: def_id:: DefId ;
@@ -75,8 +75,8 @@ pub fn set_frame_pointer_elimination(cx: &CodegenCx<'ll, '_>, llfn: &'ll Value)
75
75
llvm:: AddFunctionAttrStringValue (
76
76
llfn,
77
77
llvm:: AttributePlace :: Function ,
78
- const_cstr ! ( "frame-pointer" ) ,
79
- const_cstr ! ( "all" ) ,
78
+ cstr ! ( "frame-pointer" ) ,
79
+ cstr ! ( "all" ) ,
80
80
) ;
81
81
}
82
82
}
@@ -95,7 +95,7 @@ fn set_instrument_function(cx: &CodegenCx<'ll, '_>, llfn: &'ll Value) {
95
95
llvm:: AddFunctionAttrStringValue (
96
96
llfn,
97
97
llvm:: AttributePlace :: Function ,
98
- const_cstr ! ( "instrument-function-entry-inlined" ) ,
98
+ cstr ! ( "instrument-function-entry-inlined" ) ,
99
99
& mcount_name,
100
100
) ;
101
101
}
@@ -129,24 +129,24 @@ fn set_probestack(cx: &CodegenCx<'ll, '_>, llfn: &'ll Value) {
129
129
StackProbeType :: None => None ,
130
130
// Request LLVM to generate the probes inline. If the given LLVM version does not support
131
131
// 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" ) ) ,
133
133
// Flag our internal `__rust_probestack` function as the stack probe symbol.
134
134
// 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" ) ) ,
136
136
// Pick from the two above based on the LLVM version.
137
137
StackProbeType :: InlineOrCall { min_llvm_version_for_inline } => {
138
138
if llvm_util:: get_version ( ) < min_llvm_version_for_inline {
139
- Some ( const_cstr ! ( "__rust_probestack" ) )
139
+ Some ( cstr ! ( "__rust_probestack" ) )
140
140
} else {
141
- Some ( const_cstr ! ( "inline-asm" ) )
141
+ Some ( cstr ! ( "inline-asm" ) )
142
142
}
143
143
}
144
144
} ;
145
145
if let Some ( attr_value) = attr_value {
146
146
llvm:: AddFunctionAttrStringValue (
147
147
llfn,
148
148
llvm:: AttributePlace :: Function ,
149
- const_cstr ! ( "probe-stack" ) ,
149
+ cstr ! ( "probe-stack" ) ,
150
150
attr_value,
151
151
) ;
152
152
}
@@ -169,7 +169,7 @@ pub fn apply_target_cpu_attr(cx: &CodegenCx<'ll, '_>, llfn: &'ll Value) {
169
169
llvm:: AddFunctionAttrStringValue (
170
170
llfn,
171
171
llvm:: AttributePlace :: Function ,
172
- const_cstr ! ( "target-cpu" ) ,
172
+ cstr ! ( "target-cpu" ) ,
173
173
target_cpu. as_c_str ( ) ,
174
174
) ;
175
175
}
@@ -180,7 +180,7 @@ pub fn apply_tune_cpu_attr(cx: &CodegenCx<'ll, '_>, llfn: &'ll Value) {
180
180
llvm:: AddFunctionAttrStringValue (
181
181
llfn,
182
182
llvm:: AttributePlace :: Function ,
183
- const_cstr ! ( "tune-cpu" ) ,
183
+ cstr ! ( "tune-cpu" ) ,
184
184
tune_cpu. as_c_str ( ) ,
185
185
) ;
186
186
}
@@ -289,7 +289,7 @@ pub fn from_fn_attrs(cx: &CodegenCx<'ll, 'tcx>, llfn: &'ll Value, instance: ty::
289
289
Attribute :: NoAlias . apply_llfn ( llvm:: AttributePlace :: ReturnValue , llfn) ;
290
290
}
291
291
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" ) ) ;
293
293
}
294
294
sanitize ( cx, codegen_fn_attrs. no_sanitize , llfn) ;
295
295
@@ -319,7 +319,7 @@ pub fn from_fn_attrs(cx: &CodegenCx<'ll, 'tcx>, llfn: &'ll Value, instance: ty::
319
319
llvm:: AddFunctionAttrStringValue (
320
320
llfn,
321
321
llvm:: AttributePlace :: Function ,
322
- const_cstr ! ( "target-features" ) ,
322
+ cstr ! ( "target-features" ) ,
323
323
& val,
324
324
) ;
325
325
}
@@ -332,7 +332,7 @@ pub fn from_fn_attrs(cx: &CodegenCx<'ll, 'tcx>, llfn: &'ll Value, instance: ty::
332
332
llvm:: AddFunctionAttrStringValue (
333
333
llfn,
334
334
llvm:: AttributePlace :: Function ,
335
- const_cstr ! ( "wasm-import-module" ) ,
335
+ cstr ! ( "wasm-import-module" ) ,
336
336
& module,
337
337
) ;
338
338
@@ -342,7 +342,7 @@ pub fn from_fn_attrs(cx: &CodegenCx<'ll, 'tcx>, llfn: &'ll Value, instance: ty::
342
342
llvm:: AddFunctionAttrStringValue (
343
343
llfn,
344
344
llvm:: AttributePlace :: Function ,
345
- const_cstr ! ( "wasm-import-name" ) ,
345
+ cstr ! ( "wasm-import-name" ) ,
346
346
& name,
347
347
) ;
348
348
}
0 commit comments