Skip to content

Commit

Permalink
Merge pull request #231 from llvm-swift/alignment-radix
Browse files Browse the repository at this point in the history
[DIBuilder.buildTypedef] Use radix to determine alignment rather than assume data layout
  • Loading branch information
matthewseaman authored Mar 26, 2021
2 parents ca22dde + 8387ce9 commit 601476c
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 601476c

Please sign in to comment.