mirror of
https://github.com/ziglang/zig.git
synced 2026-02-12 20:37:54 +00:00
Merge pull request #14078 from jacobly0/llvm-opaque-ptrs
llvm: remove unnecessary code for opaque pointers
This commit is contained in:
commit
3a7a39cb91
File diff suppressed because it is too large
Load Diff
@ -287,9 +287,6 @@ pub const Type = opaque {
|
||||
pub const getUndef = LLVMGetUndef;
|
||||
extern fn LLVMGetUndef(Ty: *Type) *Value;
|
||||
|
||||
pub const pointerType = LLVMPointerType;
|
||||
extern fn LLVMPointerType(ElementType: *Type, AddressSpace: c_uint) *Type;
|
||||
|
||||
pub const arrayType = LLVMArrayType;
|
||||
extern fn LLVMArrayType(ElementType: *Type, ElementCount: c_uint) *Type;
|
||||
|
||||
|
||||
@ -1430,6 +1430,12 @@ test "struct has only one reference" {
|
||||
fn errorUnionStructReturn() error{Foo}!struct { x: u8 } {
|
||||
return error.Foo;
|
||||
}
|
||||
|
||||
fn pointerPackedStruct(_: *packed struct { x: u8 }) void {}
|
||||
fn nestedPointerPackedStruct(_: struct { x: *packed struct { x: u8 } }) void {}
|
||||
fn pointerNestedPackedStruct(_: *struct { x: packed struct { x: u8 } }) void {}
|
||||
fn pointerNestedPointerPackedStruct(_: *struct { x: *packed struct { x: u8 } }) void {}
|
||||
|
||||
fn optionalComptimeIntParam(comptime x: ?comptime_int) comptime_int {
|
||||
return x.?;
|
||||
}
|
||||
@ -1446,6 +1452,14 @@ test "struct has only one reference" {
|
||||
const error_union_struct_return: *const anyopaque = &S.errorUnionStructReturn;
|
||||
try expect(optional_struct_return != error_union_struct_return);
|
||||
|
||||
const pointer_packed_struct: *const anyopaque = &S.pointerPackedStruct;
|
||||
const nested_pointer_packed_struct: *const anyopaque = &S.nestedPointerPackedStruct;
|
||||
try expect(pointer_packed_struct != nested_pointer_packed_struct);
|
||||
|
||||
const pointer_nested_packed_struct: *const anyopaque = &S.pointerNestedPackedStruct;
|
||||
const pointer_nested_pointer_packed_struct: *const anyopaque = &S.pointerNestedPointerPackedStruct;
|
||||
try expect(pointer_nested_packed_struct != pointer_nested_pointer_packed_struct);
|
||||
|
||||
try expectEqual(@alignOf(struct {}), S.optionalComptimeIntParam(@alignOf(struct {})));
|
||||
try expectEqual(@alignOf(struct { x: u8 }), S.errorUnionComptimeIntParam(@alignOf(struct { x: u8 })));
|
||||
try expectEqual(@sizeOf(struct { x: u16 }), S.optionalComptimeIntParam(@sizeOf(struct { x: u16 })));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user