mirror of
https://github.com/apple/swift.git
synced 2026-06-20 15:42:51 +02:00
[Type checker] Pull the null check into swift::isSIMDOperator().
This commit is contained in:
+3
-2
@@ -491,6 +491,9 @@ bool DisjunctionStep::shouldStopAt(const DisjunctionChoice &choice) const {
|
||||
}
|
||||
|
||||
bool swift::isSIMDOperator(ValueDecl *value) {
|
||||
if (!value)
|
||||
return false;
|
||||
|
||||
auto func = dyn_cast<FuncDecl>(value);
|
||||
if (!func)
|
||||
return false;
|
||||
@@ -556,10 +559,8 @@ bool DisjunctionStep::shortCircuitDisjunctionAt(
|
||||
// If we have an operator from the SIMDOperators module, and the prior
|
||||
// choice was not from the SIMDOperators module, we're done.
|
||||
if (currentChoice->getKind() == ConstraintKind::BindOverload &&
|
||||
currentChoice->getOverloadChoice().isDecl() &&
|
||||
isSIMDOperator(currentChoice->getOverloadChoice().getDecl()) &&
|
||||
lastSuccessfulChoice->getKind() == ConstraintKind::BindOverload &&
|
||||
lastSuccessfulChoice->getOverloadChoice().isDecl() &&
|
||||
!isSIMDOperator(lastSuccessfulChoice->getOverloadChoice().getDecl()) &&
|
||||
!ctx.LangOpts.SolverEnableOperatorDesignatedTypes) {
|
||||
return true;
|
||||
|
||||
@@ -1473,7 +1473,7 @@ static ArrayRef<OverloadChoice> partitionSIMDOperators(
|
||||
// Check whether we have any SIMD operators.
|
||||
bool foundSIMDOperator = false;
|
||||
for (const auto &choice : choices) {
|
||||
if (choice.isDecl() && isSIMDOperator(choice.getDecl())) {
|
||||
if (isSIMDOperator(choice.getDecl())) {
|
||||
foundSIMDOperator = true;
|
||||
break;
|
||||
}
|
||||
@@ -1485,8 +1485,7 @@ static ArrayRef<OverloadChoice> partitionSIMDOperators(
|
||||
scratch.assign(choices.begin(), choices.end());
|
||||
std::stable_partition(scratch.begin(), scratch.end(),
|
||||
[](const OverloadChoice &choice) {
|
||||
return !choice.isDecl() ||
|
||||
!isSIMDOperator(choice.getDecl());
|
||||
return !isSIMDOperator(choice.getDecl());
|
||||
});
|
||||
|
||||
return scratch;
|
||||
|
||||
Reference in New Issue
Block a user