| ... | ... | @@ -1027,7 +1027,9 @@ pub const Object = struct { |
| 1027 | 1027 | dg.addArgAttr(llvm_func, llvm_arg_i, "noalias"); |
| 1028 | 1028 | } |
| 1029 | 1029 | } |
| 1030 | | dg.addArgAttr(llvm_func, llvm_arg_i, "nonnull"); |
| 1030 | if (param_ty.zigTypeTag() != .Optional) { |
| 1031 | dg.addArgAttr(llvm_func, llvm_arg_i, "nonnull"); |
| 1032 | } |
| 1031 | 1033 | if (!ptr_info.mutable) { |
| 1032 | 1034 | dg.addArgAttr(llvm_func, llvm_arg_i, "readonly"); |
| 1033 | 1035 | } |
| ... | ... | @@ -3117,7 +3119,11 @@ pub const DeclGen = struct { |
| 3117 | 3119 | .slice => { |
| 3118 | 3120 | const param_ty = fn_info.param_types[it.zig_index - 1]; |
| 3119 | 3121 | var buf: Type.SlicePtrFieldTypeBuffer = undefined; |
| 3120 | | const ptr_ty = param_ty.slicePtrFieldType(&buf); |
| 3122 | var opt_buf: Type.Payload.ElemType = undefined; |
| 3123 | const ptr_ty = if (param_ty.zigTypeTag() == .Optional) |
| 3124 | param_ty.optionalChild(&opt_buf).slicePtrFieldType(&buf) |
| 3125 | else |
| 3126 | param_ty.slicePtrFieldType(&buf); |
| 3121 | 3127 | const ptr_llvm_ty = try dg.lowerType(ptr_ty); |
| 3122 | 3128 | const len_llvm_ty = try dg.lowerType(Type.usize); |
| 3123 | 3129 | |
| ... | ... | @@ -10358,7 +10364,8 @@ const ParamTypeIterator = struct { |
| 10358 | 10364 | .Unspecified, .Inline => { |
| 10359 | 10365 | it.zig_index += 1; |
| 10360 | 10366 | it.llvm_index += 1; |
| 10361 | | if (ty.isSlice()) { |
| 10367 | var buf: Type.Payload.ElemType = undefined; |
| 10368 | if (ty.isSlice() or (ty.zigTypeTag() == .Optional and ty.optionalChild(&buf).isSlice())) { |
| 10362 | 10369 | return .slice; |
| 10363 | 10370 | } else if (isByRef(ty)) { |
| 10364 | 10371 | return .byref; |