fix an uninitialized pointer in BridgedSourceLoc

It's so easy to run into undefined behavior in C++
This commit is contained in:
Erik Eckstein
2023-10-09 17:32:51 +02:00
parent 0cf8e4c2ed
commit 22979b9a7a
3 changed files with 16 additions and 6 deletions

View File

@@ -27,11 +27,11 @@ public struct SourceLoc {
guard bridged.isValid() else {
return nil
}
self.locationInFile = bridged.opaquePointer!
self.locationInFile = bridged.uint8Pointer()!
}
public var bridged: BridgedSourceLoc {
.init(opaquePointer: locationInFile)
.init(locationInFile)
}
}