Skip to content

Commit 6e0cfb5

Browse files
committed
[AST] NonCopyableGenerics: Remove a few uses for getMarking(...).getPositive()
1 parent 937d9d0 commit 6e0cfb5

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

lib/AST/Decl.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4945,21 +4945,19 @@ conformanceExists(TypeDecl const *decl, InvertibleProtocolKind ip) {
49454945

49464946
TypeDecl::CanBeInvertible::Result TypeDecl::canBeCopyable() const {
49474947
if (!getASTContext().LangOpts.hasFeature(Feature::NoncopyableGenerics)) {
4948-
auto copyable = getMarking(InvertibleProtocolKind::Copyable);
4949-
return !copyable.getInverse() || bool(copyable.getPositive())
4950-
? CanBeInvertible::Always
4951-
: CanBeInvertible::Never;
4948+
return !hasInverseMarking(InvertibleProtocolKind::Copyable)
4949+
? CanBeInvertible::Always
4950+
: CanBeInvertible::Never;
49524951
}
49534952

49544953
return conformanceExists(this, InvertibleProtocolKind::Copyable);
49554954
}
49564955

49574956
TypeDecl::CanBeInvertible::Result TypeDecl::canBeEscapable() const {
49584957
if (!getASTContext().LangOpts.hasFeature(Feature::NoncopyableGenerics)) {
4959-
auto escapable = getMarking(InvertibleProtocolKind::Escapable);
4960-
return !escapable.getInverse() || bool(escapable.getPositive())
4961-
? CanBeInvertible::Always
4962-
: CanBeInvertible::Never;
4958+
return !hasInverseMarking(InvertibleProtocolKind::Escapable)
4959+
? CanBeInvertible::Always
4960+
: CanBeInvertible::Never;
49634961
}
49644962

49654963
return conformanceExists(this, InvertibleProtocolKind::Escapable);

lib/AST/ProtocolConformance.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,8 +1095,7 @@ void NominalTypeDecl::prepareConformanceTable() const {
10951095
if (!isa<ClassDecl>(this)) {
10961096
bool missingOne = false;
10971097
for (auto ip : InvertibleProtocolSet::full()) {
1098-
auto invertible = getMarking(ip);
1099-
if (!invertible.getInverse() || bool(invertible.getPositive()))
1098+
if (!hasInverseMarking(ip))
11001099
addSynthesized(ctx.getProtocol(getKnownProtocolKind(ip)));
11011100
else
11021101
missingOne = true;

0 commit comments

Comments
 (0)