Skip to content

Commit 96ea85a

Browse files
committed
[CSDiag] NFC: Remove all code from visitInOutExpr since it's now obsolete
1 parent e9aa04a commit 96ea85a

File tree

1 file changed

+0
-45
lines changed

1 file changed

+0
-45
lines changed

lib/Sema/CSDiag.cpp

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -4389,52 +4389,7 @@ bool FailureDiagnosis::visitAssignExpr(AssignExpr *assignExpr) {
43894389
return false;
43904390
}
43914391

4392-
4393-
/// Return true if this type is known to be an ArrayType.
4394-
static bool isKnownToBeArrayType(Type ty) {
4395-
if (!ty) return false;
4396-
4397-
auto bgt = ty->getAs<BoundGenericType>();
4398-
if (!bgt) return false;
4399-
4400-
auto &ctx = bgt->getASTContext();
4401-
return bgt->getDecl() == ctx.getArrayDecl();
4402-
}
4403-
44044392
bool FailureDiagnosis::visitInOutExpr(InOutExpr *IOE) {
4405-
// If we have a contextual type, it must be an inout type.
4406-
auto contextualType = CS.getContextualType();
4407-
if (contextualType) {
4408-
// If the contextual type is one of the UnsafePointer<T> types, then the
4409-
// contextual type of the subexpression must be T.
4410-
Type unwrappedType = contextualType;
4411-
if (auto unwrapped = contextualType->getOptionalObjectType())
4412-
unwrappedType = unwrapped;
4413-
4414-
if (auto pointerEltType = unwrappedType->getAnyPointerElementType()) {
4415-
4416-
// If the element type is Void, then we allow any input type, since
4417-
// everything is convertible to UnsafeRawPointer
4418-
if (pointerEltType->isVoid())
4419-
contextualType = Type();
4420-
else
4421-
contextualType = pointerEltType;
4422-
4423-
// Furthermore, if the subexpr type is already known to be an array type,
4424-
// then we must have an attempt at an array to pointer conversion.
4425-
if (isKnownToBeArrayType(CS.getType(IOE->getSubExpr()))) {
4426-
contextualType = ArraySliceType::get(contextualType);
4427-
}
4428-
} else if (contextualType->is<InOutType>()) {
4429-
contextualType = contextualType->getInOutObjectType();
4430-
}
4431-
}
4432-
4433-
if (!typeCheckChildIndependently(IOE->getSubExpr(), contextualType,
4434-
CS.getContextualTypePurpose(),
4435-
TCC_AllowLValue)) {
4436-
return true;
4437-
}
44384393
return false;
44394394
}
44404395

0 commit comments

Comments
 (0)