Skip to content

Commit e133b20

Browse files
committed
GSB: inline some trivial methods
This inlines the comparators since GCC 7 objects to the definition (which is probably due to scoping). However, these methods are templates, which must be visible to the consumers, and should therefore be in the header. Given the size, it seems reasonable to just inline them.
1 parent 746b58e commit e133b20

File tree

2 files changed

+15
-16
lines changed

2 files changed

+15
-16
lines changed

include/swift/AST/GenericSignatureBuilder.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1687,6 +1687,21 @@ class GenericSignatureBuilder::PotentialArchetype {
16871687
friend class GenericSignatureBuilder;
16881688
};
16891689

1690+
template <typename C>
1691+
bool GenericSignatureBuilder::Constraint<C>::isSubjectEqualTo(Type T) const {
1692+
return getSubjectDependentType({ })->isEqual(T);
1693+
}
1694+
1695+
template <typename T>
1696+
bool GenericSignatureBuilder::Constraint<T>::isSubjectEqualTo(const GenericSignatureBuilder::PotentialArchetype *PA) const {
1697+
return getSubjectDependentType({ })->isEqual(PA->getDependentType({ }));
1698+
}
1699+
1700+
template <typename T>
1701+
bool GenericSignatureBuilder::Constraint<T>::hasSameSubjectAs(const GenericSignatureBuilder::Constraint<T> &C) const {
1702+
return getSubjectDependentType({ })->isEqual(C.getSubjectDependentType({ }));
1703+
}
1704+
16901705
/// Describes a requirement whose processing has been delayed for some reason.
16911706
class GenericSignatureBuilder::DelayedRequirement {
16921707
public:

lib/AST/GenericSignatureBuilder.cpp

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1712,22 +1712,6 @@ bool EquivalenceClass::recordConformanceConstraint(
17121712
return inserted;
17131713
}
17141714

1715-
template<typename T>
1716-
bool Constraint<T>::isSubjectEqualTo(Type type) const {
1717-
return getSubjectDependentType({ })->isEqual(type);
1718-
}
1719-
1720-
template<typename T>
1721-
bool Constraint<T>::isSubjectEqualTo(const PotentialArchetype *pa) const {
1722-
return getSubjectDependentType({ })->isEqual(pa->getDependentType({ }));
1723-
}
1724-
1725-
template<typename T>
1726-
bool Constraint<T>::hasSameSubjectAs(const Constraint<T> &other) const {
1727-
return getSubjectDependentType({ })
1728-
->isEqual(other.getSubjectDependentType({ }));
1729-
}
1730-
17311715
Optional<ConcreteConstraint>
17321716
EquivalenceClass::findAnyConcreteConstraintAsWritten(Type preferredType) const {
17331717
// If we don't have a concrete type, there's no source.

0 commit comments

Comments
 (0)