Skip to content

Commit

Permalink
[DIBuilder.buildTypedef] use radix to determine alignment rather than…
Browse files Browse the repository at this point in the history
… assuming data layout
  • Loading branch information
matthewseaman committed Mar 26, 2021
1 parent ca22dde commit 8387ce9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Sources/LLVM/DIBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -868,7 +868,7 @@ extension DIBuilder {
/// - Parameters:
/// - type: Original type.
/// - name: Typedef name.
/// - alignment: Alignment of the type
/// - alignment: Alignment of the type.
/// - scope: The surrounding context for the typedef.
/// - file: File where this type is defined.
/// - line: Line number.
Expand All @@ -880,10 +880,11 @@ extension DIBuilder {
file: FileMetadata,
line: Int
) -> DIType {
let radix = UInt32(self.module.dataLayout.intPointerType().width)
guard let ty = LLVMDIBuilderCreateTypedef(
self.llvm, type.asMetadata(), name, name.count,
file.asMetadata(), UInt32(line), scope.asMetadata(),
alignment.rawValue * 8)
alignment.rawValue * radix)
else {
fatalError("Failed to allocate metadata")
}
Expand Down

0 comments on commit 8387ce9

Please sign in to comment.