Skip to content

Commit c38f6ab

Browse files
committed
AST: inline the definition for AnyValue::Holder<Type>::equals
Unfortunately, MSVC will not preserve the template specialization in swiftAST. However, the function is pretty tiny, so simply inline it into the header. This allows the template specialization to be instantiated and inlined at the use site. The overall size impact should be negligible and this repairs the Windows build.
1 parent 155a155 commit c38f6ab

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

include/swift/AST/TypeCheckRequests.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,11 @@ class PropertyDelegateBackingPropertyInfoRequest :
550550
// Allow AnyValue to compare two Type values, even though Type doesn't
551551
// support ==.
552552
template<>
553-
bool AnyValue::Holder<Type>::equals(const HolderBase &other) const;
553+
inline bool AnyValue::Holder<Type>::equals(const HolderBase &other) const {
554+
assert(typeID == other.typeID && "Caller should match type IDs");
555+
return value.getPointer() ==
556+
static_cast<const Holder<Type> &>(other).value.getPointer();
557+
}
554558

555559
void simple_display(llvm::raw_ostream &out, const Type &type);
556560

lib/AST/TypeCheckRequests.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -646,14 +646,6 @@ void swift::simple_display(
646646
out << " }";
647647
}
648648

649-
650-
template<>
651-
bool swift::AnyValue::Holder<Type>::equals(const HolderBase &other) const {
652-
assert(typeID == other.typeID && "Caller should match type IDs");
653-
return value.getPointer() ==
654-
static_cast<const Holder<Type> &>(other).value.getPointer();
655-
}
656-
657649
void swift::simple_display(llvm::raw_ostream &out, const Type &type) {
658650
if (type)
659651
type.print(out);

0 commit comments

Comments
 (0)