Skip to content

Commit 4cb0a8d

Browse files
committed
Add accessor to check if a struct is literal
1 parent d0da56b commit 4cb0a8d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Sources/LLVM/StructType.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,15 @@ public struct StructType: IRType {
133133
public var isPacked: Bool {
134134
return LLVMIsPackedStruct(self.llvm) != 0
135135
}
136+
137+
/// Returns true if this is a literal struct type.
138+
///
139+
/// A literal struct type is uniqued by structural equivalence - that is,
140+
/// regardless of how it is named, two literal structures are equal if
141+
/// their fields are equal.
142+
public var isLiteral: Bool {
143+
return LLVMIsLiteralStruct(self.llvm) != 0
144+
}
136145
}
137146

138147
extension StructType: Equatable {

0 commit comments

Comments
 (0)