rustc_codegen_llvm: use safe mutable references for output parameters.
This commit is contained in:
parent
c1eeb69ce8
commit
92af9694b9
2 changed files with 12 additions and 12 deletions
|
@ -273,7 +273,7 @@ pub fn const_get_real(v: &'ll Value) -> Option<(f64, bool)> {
|
||||||
unsafe {
|
unsafe {
|
||||||
if is_const_real(v) {
|
if is_const_real(v) {
|
||||||
let mut loses_info: llvm::Bool = ::std::mem::uninitialized();
|
let mut loses_info: llvm::Bool = ::std::mem::uninitialized();
|
||||||
let r = llvm::LLVMConstRealGetDouble(v, &mut loses_info as *mut llvm::Bool);
|
let r = llvm::LLVMConstRealGetDouble(v, &mut loses_info);
|
||||||
let loses_info = if loses_info == 1 { true } else { false };
|
let loses_info = if loses_info == 1 { true } else { false };
|
||||||
Some((r, loses_info))
|
Some((r, loses_info))
|
||||||
} else {
|
} else {
|
||||||
|
@ -311,7 +311,7 @@ pub fn const_to_opt_u128(v: &'ll Value, sign_ext: bool) -> Option<u128> {
|
||||||
if is_const_integral(v) {
|
if is_const_integral(v) {
|
||||||
let (mut lo, mut hi) = (0u64, 0u64);
|
let (mut lo, mut hi) = (0u64, 0u64);
|
||||||
let success = llvm::LLVMRustConstInt128Get(v, sign_ext,
|
let success = llvm::LLVMRustConstInt128Get(v, sign_ext,
|
||||||
&mut hi as *mut u64, &mut lo as *mut u64);
|
&mut hi, &mut lo);
|
||||||
if success {
|
if success {
|
||||||
Some(hi_lo_to_u128(lo, hi))
|
Some(hi_lo_to_u128(lo, hi))
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -559,8 +559,8 @@ extern "C" {
|
||||||
pub fn LLVMConstIntOfArbitraryPrecision(IntTy: &Type, Wn: c_uint, Ws: *const u64) -> &Value;
|
pub fn LLVMConstIntOfArbitraryPrecision(IntTy: &Type, Wn: c_uint, Ws: *const u64) -> &Value;
|
||||||
pub fn LLVMConstIntGetZExtValue(ConstantVal: &Value) -> c_ulonglong;
|
pub fn LLVMConstIntGetZExtValue(ConstantVal: &Value) -> c_ulonglong;
|
||||||
pub fn LLVMRustConstInt128Get(ConstantVal: &Value, SExt: bool,
|
pub fn LLVMRustConstInt128Get(ConstantVal: &Value, SExt: bool,
|
||||||
high: *mut u64, low: *mut u64) -> bool;
|
high: &mut u64, low: &mut u64) -> bool;
|
||||||
pub fn LLVMConstRealGetDouble (ConstantVal: &Value, losesInfo: *mut Bool) -> f64;
|
pub fn LLVMConstRealGetDouble (ConstantVal: &Value, losesInfo: &mut Bool) -> f64;
|
||||||
|
|
||||||
|
|
||||||
// Operations on composite constants
|
// Operations on composite constants
|
||||||
|
@ -1470,13 +1470,13 @@ extern "C" {
|
||||||
pub fn LLVMRustOpenArchive(path: *const c_char) -> Option<&'static mut Archive>;
|
pub fn LLVMRustOpenArchive(path: *const c_char) -> Option<&'static mut Archive>;
|
||||||
pub fn LLVMRustArchiveIteratorNew(AR: &Archive) -> ArchiveIteratorRef;
|
pub fn LLVMRustArchiveIteratorNew(AR: &Archive) -> ArchiveIteratorRef;
|
||||||
pub fn LLVMRustArchiveIteratorNext(AIR: ArchiveIteratorRef) -> ArchiveChildRef;
|
pub fn LLVMRustArchiveIteratorNext(AIR: ArchiveIteratorRef) -> ArchiveChildRef;
|
||||||
pub fn LLVMRustArchiveChildName(ACR: ArchiveChildRef, size: *mut size_t) -> *const c_char;
|
pub fn LLVMRustArchiveChildName(ACR: ArchiveChildRef, size: &mut size_t) -> *const c_char;
|
||||||
pub fn LLVMRustArchiveChildData(ACR: ArchiveChildRef, size: *mut size_t) -> *const c_char;
|
pub fn LLVMRustArchiveChildData(ACR: ArchiveChildRef, size: &mut size_t) -> *const c_char;
|
||||||
pub fn LLVMRustArchiveChildFree(ACR: ArchiveChildRef);
|
pub fn LLVMRustArchiveChildFree(ACR: ArchiveChildRef);
|
||||||
pub fn LLVMRustArchiveIteratorFree(AIR: ArchiveIteratorRef);
|
pub fn LLVMRustArchiveIteratorFree(AIR: ArchiveIteratorRef);
|
||||||
pub fn LLVMRustDestroyArchive(AR: &'static mut Archive);
|
pub fn LLVMRustDestroyArchive(AR: &'static mut Archive);
|
||||||
|
|
||||||
pub fn LLVMRustGetSectionName(SI: SectionIteratorRef, data: *mut *const c_char) -> size_t;
|
pub fn LLVMRustGetSectionName(SI: SectionIteratorRef, data: &mut *const c_char) -> size_t;
|
||||||
|
|
||||||
pub fn LLVMRustWriteTwineToString(T: &Twine, s: &RustString);
|
pub fn LLVMRustWriteTwineToString(T: &Twine, s: &RustString);
|
||||||
|
|
||||||
|
@ -1492,9 +1492,9 @@ extern "C" {
|
||||||
loc_filename_out: &RustString,
|
loc_filename_out: &RustString,
|
||||||
message_out: &RustString);
|
message_out: &RustString);
|
||||||
pub fn LLVMRustUnpackInlineAsmDiagnostic(DI: &'a DiagnosticInfo,
|
pub fn LLVMRustUnpackInlineAsmDiagnostic(DI: &'a DiagnosticInfo,
|
||||||
cookie_out: *mut c_uint,
|
cookie_out: &mut c_uint,
|
||||||
message_out: *mut Option<&'a Twine>,
|
message_out: &mut Option<&'a Twine>,
|
||||||
instruction_out: *mut Option<&'a Value>);
|
instruction_out: &mut Option<&'a Value>);
|
||||||
|
|
||||||
pub fn LLVMRustWriteDiagnosticInfoToString(DI: &DiagnosticInfo, s: &RustString);
|
pub fn LLVMRustWriteDiagnosticInfoToString(DI: &DiagnosticInfo, s: &RustString);
|
||||||
pub fn LLVMRustGetDiagInfoKind(DI: &DiagnosticInfo) -> DiagnosticKind;
|
pub fn LLVMRustGetDiagInfoKind(DI: &DiagnosticInfo) -> DiagnosticKind;
|
||||||
|
@ -1572,8 +1572,8 @@ extern "C" {
|
||||||
Identifier: *const c_char,
|
Identifier: *const c_char,
|
||||||
) -> Option<&Module>;
|
) -> Option<&Module>;
|
||||||
pub fn LLVMRustThinLTOGetDICompileUnit(M: &Module,
|
pub fn LLVMRustThinLTOGetDICompileUnit(M: &Module,
|
||||||
CU1: *mut *mut c_void,
|
CU1: &mut *mut c_void,
|
||||||
CU2: *mut *mut c_void);
|
CU2: &mut *mut c_void);
|
||||||
pub fn LLVMRustThinLTOPatchDICompileUnit(M: &Module, CU: *mut c_void);
|
pub fn LLVMRustThinLTOPatchDICompileUnit(M: &Module, CU: *mut c_void);
|
||||||
|
|
||||||
pub fn LLVMRustLinkerNew(M: &Module) -> LinkerRef;
|
pub fn LLVMRustLinkerNew(M: &Module) -> LinkerRef;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue