mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
SIL: a few changes regarding access to a GlobalVariable's static initializer instructions
* add `GlobalVariable.staticInitializerInstructions` to access all initializer instructions of a global * implement `GlobalVariable.staticInitValue` with `GlobalVariable.staticInitializerInstructions` * this requires that `InstructionList.reversed()` works without accessing the parent block of the iterator instruction * allow `Context.erase(instruction:)` to delete instructions from a global's initializer list, which means to handle the case where a deleted instruction has no parent function.
This commit is contained in:
@@ -97,7 +97,7 @@ public struct InstructionList : CollectionLikeSequence, IteratorProtocol {
|
||||
|
||||
public func reversed() -> ReverseInstructionList {
|
||||
if let inst = currentInstruction {
|
||||
let lastInst = inst.parentBlock.bridged.getLastInst().instruction
|
||||
let lastInst = inst.bridged.getLastInstOfParent().instruction
|
||||
return ReverseInstructionList(first: lastInst)
|
||||
}
|
||||
return ReverseInstructionList(first: nil)
|
||||
|
||||
Reference in New Issue
Block a user