mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +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
1 changed files with 12 additions and 3 deletions
|
|
@ -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…
Add table
Reference in a new issue