mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[SR-8272] Drop the last remnants of LogicValue
Removes the _getBuiltinLogicValue intrinsic in favor of an open-coded struct_extract in SIL. This removes Sema's last non-literal use of builtin integer types and unblocks a bunch of cleanup. This patch would be NFC, but it improves line information for conditional expression codegen.
This commit is contained in:
@@ -687,3 +687,19 @@ Optional<ASTNode> SILGenFunction::getPGOParent(ASTNode Node) const {
|
||||
return SP->getPGOParent(Node);
|
||||
return None;
|
||||
}
|
||||
|
||||
SILValue SILGenFunction::emitUnwrapIntegerResult(SILLocation loc,
|
||||
SILValue value) {
|
||||
// This is a loop because we want to handle types that wrap integer types,
|
||||
// like ObjCBool (which may be Bool or Int8).
|
||||
while (!value->getType().is<BuiltinIntegerType>()) {
|
||||
auto structDecl = value->getType().getStructOrBoundGenericStruct();
|
||||
assert(structDecl && "value for error result wasn't of struct type!");
|
||||
assert(std::next(structDecl->getStoredProperties().begin())
|
||||
== structDecl->getStoredProperties().end());
|
||||
auto property = *structDecl->getStoredProperties().begin();
|
||||
value = B.createStructExtract(loc, value, property);
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user