}
}
+impl CodegenCx<'ll, 'tcx> {
+ crate fn type_named_struct(&self, name: &str) -> &'ll Type {
+ let name = SmallCStr::new(name);
+ unsafe {
+ llvm::LLVMStructCreateNamed(self.llcx, name.as_ptr())
+ }
+ }
+
+ crate fn set_struct_body(&self, ty: &'ll Type, els: &[&'ll Type], packed: bool) {
+ unsafe {
+ llvm::LLVMStructSetBody(ty, els.as_ptr(),
+ els.len() as c_uint, packed as Bool)
+ }
+ }
+}
+
impl BaseTypeMethods<'tcx> for CodegenCx<'ll, 'tcx> {
fn type_void(&self) -> &'ll Type {
unsafe {
}
}
- fn type_named_struct(&self, name: &str) -> &'ll Type {
- let name = SmallCStr::new(name);
- unsafe {
- llvm::LLVMStructCreateNamed(self.llcx, name.as_ptr())
- }
- }
-
fn type_array(&self, ty: &'ll Type, len: u64) -> &'ll Type {
unsafe {
}
}
- fn set_struct_body(&self, ty: &'ll Type, els: &[&'ll Type], packed: bool) {
- unsafe {
- llvm::LLVMStructSetBody(ty, els.as_ptr(),
- els.len() as c_uint, packed as Bool)
- }
- }
-
fn type_ptr_to(&self, ty: &'ll Type) -> &'ll Type {
assert_ne!(self.type_kind(ty), TypeKind::Function,
"don't call ptr_to on function types, use ptr_to_llvm_type on FnType instead");
}
}
- // Creates an integer type with the given number of bits, e.g. i24
+ // Creates an integer type with the given number of bits, e.g., i24
pub fn ix_llcx(
llcx: &llvm::Context,
num_bits: u64