|
24 | 24 |
|
25 | 25 | #include <iostream>
|
26 | 26 |
|
| 27 | +[[noreturn]] |
| 28 | +static void unreachable(const char *Message) { |
| 29 | + std::cerr << "fatal error: " << Message << "\n"; |
| 30 | + std::abort(); |
| 31 | +} |
| 32 | + |
27 | 33 | using namespace swift;
|
28 | 34 | using namespace reflection;
|
29 | 35 |
|
@@ -167,7 +173,7 @@ class PrintTypeInfo {
|
167 | 173 | }
|
168 | 174 | }
|
169 | 175 |
|
170 |
| - assert(false && "Bad TypeInfo kind"); |
| 176 | + unreachable("Bad TypeInfo kind"); |
171 | 177 | }
|
172 | 178 | };
|
173 | 179 |
|
@@ -675,13 +681,13 @@ class HasSingletonMetatype
|
675 | 681 |
|
676 | 682 | MetatypeRepresentation
|
677 | 683 | visitGenericTypeParameterTypeRef(const GenericTypeParameterTypeRef *GTP) {
|
678 |
| - assert(false && "Must have concrete TypeRef"); |
| 684 | + unreachable("Must have concrete TypeRef"); |
679 | 685 | return MetatypeRepresentation::Unknown;
|
680 | 686 | }
|
681 | 687 |
|
682 | 688 | MetatypeRepresentation
|
683 | 689 | visitDependentMemberTypeRef(const DependentMemberTypeRef *DM) {
|
684 |
| - assert(false && "Must have concrete TypeRef"); |
| 690 | + unreachable("Must have concrete TypeRef"); |
685 | 691 | return MetatypeRepresentation::Unknown;
|
686 | 692 | }
|
687 | 693 |
|
@@ -893,13 +899,13 @@ class LowerType
|
893 | 899 |
|
894 | 900 | const TypeInfo *
|
895 | 901 | visitGenericTypeParameterTypeRef(const GenericTypeParameterTypeRef *GTP) {
|
896 |
| - assert(false && "Must have concrete TypeRef"); |
| 902 | + unreachable("Must have concrete TypeRef"); |
897 | 903 | return nullptr;
|
898 | 904 | }
|
899 | 905 |
|
900 | 906 | const TypeInfo *
|
901 | 907 | visitDependentMemberTypeRef(const DependentMemberTypeRef *DM) {
|
902 |
| - assert(false && "Must have concrete TypeRef"); |
| 908 | + unreachable("Must have concrete TypeRef"); |
903 | 909 | return nullptr;
|
904 | 910 | }
|
905 | 911 |
|
@@ -980,7 +986,7 @@ class LowerType
|
980 | 986 | }
|
981 | 987 |
|
982 | 988 | const TypeInfo *visitOpaqueTypeRef(const OpaqueTypeRef *O) {
|
983 |
| - assert(false && "Can't lower opaque TypeRef"); |
| 989 | + unreachable("Can't lower opaque TypeRef"); |
984 | 990 | return nullptr;
|
985 | 991 | }
|
986 | 992 | };
|
|
0 commit comments