Skip to content

Commit e6b9374

Browse files
committed
SIL: add AccessBase.storageIsLexical
1 parent d2f8c0c commit e6b9374

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

SwiftCompilerSources/Sources/SIL/Utilities/AccessUtils.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,21 @@ public enum AccessBase : CustomStringConvertible, Hashable {
223223
}
224224
}
225225

226+
public var storageIsLexical: Bool {
227+
switch self {
228+
case .argument(let arg):
229+
return arg.isLexical
230+
case .stack(let allocStack):
231+
return allocStack.isLexical
232+
case .global:
233+
return true
234+
case .box, .class, .tail:
235+
return reference!.referenceRoot.isLexical
236+
case .yield, .pointer, .index, .storeBorrow, .unidentified:
237+
return false
238+
}
239+
}
240+
226241
/// Returns true if it's guaranteed that this access has the same base address as the `other` access.
227242
///
228243
/// `isEqual` abstracts away the projection instructions that are included as part of the AccessBase:

0 commit comments

Comments
 (0)