Generate better function argument names in global_allocator expansion
This commit is contained in:
parent
bc720ad36b
commit
704aa56ba0
5 changed files with 37 additions and 30 deletions
|
@ -33,29 +33,41 @@ pub enum AllocatorTy {
|
|||
|
||||
pub struct AllocatorMethod {
|
||||
pub name: Symbol,
|
||||
pub inputs: &'static [AllocatorTy],
|
||||
pub inputs: &'static [AllocatorMethodInput],
|
||||
pub output: AllocatorTy,
|
||||
}
|
||||
|
||||
pub struct AllocatorMethodInput {
|
||||
pub name: &'static str,
|
||||
pub ty: AllocatorTy,
|
||||
}
|
||||
|
||||
pub static ALLOCATOR_METHODS: &[AllocatorMethod] = &[
|
||||
AllocatorMethod {
|
||||
name: sym::alloc,
|
||||
inputs: &[AllocatorTy::Layout],
|
||||
inputs: &[AllocatorMethodInput { name: "layout", ty: AllocatorTy::Layout }],
|
||||
output: AllocatorTy::ResultPtr,
|
||||
},
|
||||
AllocatorMethod {
|
||||
name: sym::dealloc,
|
||||
inputs: &[AllocatorTy::Ptr, AllocatorTy::Layout],
|
||||
inputs: &[
|
||||
AllocatorMethodInput { name: "ptr", ty: AllocatorTy::Ptr },
|
||||
AllocatorMethodInput { name: "layout", ty: AllocatorTy::Layout },
|
||||
],
|
||||
output: AllocatorTy::Unit,
|
||||
},
|
||||
AllocatorMethod {
|
||||
name: sym::realloc,
|
||||
inputs: &[AllocatorTy::Ptr, AllocatorTy::Layout, AllocatorTy::Usize],
|
||||
inputs: &[
|
||||
AllocatorMethodInput { name: "ptr", ty: AllocatorTy::Ptr },
|
||||
AllocatorMethodInput { name: "layout", ty: AllocatorTy::Layout },
|
||||
AllocatorMethodInput { name: "new_size", ty: AllocatorTy::Usize },
|
||||
],
|
||||
output: AllocatorTy::ResultPtr,
|
||||
},
|
||||
AllocatorMethod {
|
||||
name: sym::alloc_zeroed,
|
||||
inputs: &[AllocatorTy::Layout],
|
||||
inputs: &[AllocatorMethodInput { name: "layout", ty: AllocatorTy::Layout }],
|
||||
output: AllocatorTy::ResultPtr,
|
||||
},
|
||||
];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue