Skip to content

Commit 8dc6b08

Browse files
committed
Handle negative results from 'SwiftyLLVMGetStackAlignment'
1 parent b84ecca commit 8dc6b08

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

Sources/SwiftyLLVM/DataLayout.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ public struct DataLayout: ~Copyable {
7474

7575
/// The natural stack alignment of the target, or `nil` if it isn't specified.
7676
public var stackAlignment: Int? {
77-
Int(SwiftyLLVMGetStackAlignment(llvm))
77+
let a = SwiftyLLVMGetStackAlignment(llvm)
78+
return (a >= 0) ? Int(a) : nil
7879
}
7980

8081
/// The size of pointers in bytes in the default address space.

0 commit comments

Comments
 (0)