mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Sema] Diagnose unsound pointer conversions
Diagnose ephemeral conversions that are passed to @_nonEphemeral parameters. Currently, this defaults to a warning with a frontend flag to upgrade to an error. Hopefully this will become an error by default in a future language version.
This commit is contained in:
@@ -99,7 +99,6 @@ unsigned LocatorPathElt::getNewSummaryFlags() const {
|
||||
switch (getKind()) {
|
||||
case ConstraintLocator::ApplyArgument:
|
||||
case ConstraintLocator::ApplyFunction:
|
||||
case ConstraintLocator::ApplyArgToParam:
|
||||
case ConstraintLocator::SequenceElementType:
|
||||
case ConstraintLocator::ClosureResult:
|
||||
case ConstraintLocator::ConstructorMember:
|
||||
@@ -139,6 +138,11 @@ unsigned LocatorPathElt::getNewSummaryFlags() const {
|
||||
case ConstraintLocator::FunctionArgument:
|
||||
case ConstraintLocator::FunctionResult:
|
||||
return IsFunctionConversion;
|
||||
|
||||
case ConstraintLocator::ApplyArgToParam: {
|
||||
auto flags = castTo<LocatorPathElt::ApplyArgToParam>().getParameterFlags();
|
||||
return flags.isNonEphemeral() ? IsNonEphemeralParam : 0;
|
||||
}
|
||||
}
|
||||
|
||||
llvm_unreachable("Unhandled PathElementKind in switch.");
|
||||
|
||||
Reference in New Issue
Block a user