mirror of
https://github.com/ziglang/zig.git
synced 2026-02-14 21:38:33 +00:00
llvm: Don't set nonnull attribute on pointers in non-generic address spaces.
LLVM considers null pointers to be valid for such address spaces.
This commit is contained in:
parent
e9ae9a5fc4
commit
427810f3ed
@ -1341,7 +1341,10 @@ pub const Object = struct {
|
||||
try attributes.addParamAttr(llvm_arg_i, .@"noalias", &o.builder);
|
||||
}
|
||||
}
|
||||
if (param_ty.zigTypeTag(zcu) != .optional and !ptr_info.flags.is_allowzero) {
|
||||
if (param_ty.zigTypeTag(zcu) != .optional and
|
||||
!ptr_info.flags.is_allowzero and
|
||||
ptr_info.flags.address_space == .generic)
|
||||
{
|
||||
try attributes.addParamAttr(llvm_arg_i, .nonnull, &o.builder);
|
||||
}
|
||||
if (ptr_info.flags.is_const) {
|
||||
@ -4358,7 +4361,10 @@ pub const Object = struct {
|
||||
try attributes.addParamAttr(llvm_arg_i, .@"noalias", &o.builder);
|
||||
}
|
||||
}
|
||||
if (!param_ty.isPtrLikeOptional(zcu) and !ptr_info.flags.is_allowzero) {
|
||||
if (!param_ty.isPtrLikeOptional(zcu) and
|
||||
!ptr_info.flags.is_allowzero and
|
||||
ptr_info.flags.address_space == .generic)
|
||||
{
|
||||
try attributes.addParamAttr(llvm_arg_i, .nonnull, &o.builder);
|
||||
}
|
||||
switch (fn_info.cc) {
|
||||
@ -5410,7 +5416,10 @@ pub const FuncGen = struct {
|
||||
try attributes.addParamAttr(llvm_arg_i, .@"noalias", &o.builder);
|
||||
}
|
||||
}
|
||||
if (param_ty.zigTypeTag(zcu) != .optional and !ptr_info.flags.is_allowzero) {
|
||||
if (param_ty.zigTypeTag(zcu) != .optional and
|
||||
!ptr_info.flags.is_allowzero and
|
||||
ptr_info.flags.address_space == .generic)
|
||||
{
|
||||
try attributes.addParamAttr(llvm_arg_i, .nonnull, &o.builder);
|
||||
}
|
||||
if (ptr_info.flags.is_const) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user