@@ -14,15 +14,9 @@ namespace swift {
14
14
15
15
// / Represents the nine reflection sections used by Swift
16
16
enum ReflectionSectionKind : uint8_t {
17
- fieldmd,
18
- assocty,
19
- builtin,
20
- capture,
21
- typeref,
22
- reflstr,
23
- conform,
24
- protocs,
25
- acfuncs,
17
+ #define HANDLE_SWIFT_SECTION (KIND, MACHO, ELF, COFF ) KIND,
18
+ #include " llvm/BinaryFormat/Swift.def"
19
+ #undef HANDLE_SWIFT_SECTION
26
20
};
27
21
28
22
// / Abstract base class responsible for providing the correct reflection section
@@ -43,24 +37,11 @@ class SwiftObjectFileFormatMachO : public SwiftObjectFileFormat {
43
37
public:
44
38
llvm::StringRef getSectionName (ReflectionSectionKind section) override {
45
39
switch (section) {
46
- case fieldmd:
47
- return " __swift5_fieldmd" ;
48
- case assocty:
49
- return " __swift5_assocty" ;
50
- case builtin:
51
- return " __swift5_builtin" ;
52
- case capture:
53
- return " __swift5_capture" ;
54
- case typeref:
55
- return " __swift5_typeref" ;
56
- case reflstr:
57
- return " __swift5_reflstr" ;
58
- case conform:
59
- return " __swift5_proto" ;
60
- case protocs:
61
- return " __swift5_protos" ;
62
- case acfuncs:
63
- return " __swift5_acfuncs" ;
40
+ #define HANDLE_SWIFT_SECTION (KIND, MACHO, ELF, COFF ) \
41
+ case KIND: \
42
+ return MACHO;
43
+ #include " llvm/BinaryFormat/Swift.def"
44
+ #undef HANDLE_SWIFT_SECTION
64
45
}
65
46
llvm_unreachable (" Section type not found." );
66
47
}
@@ -78,24 +59,11 @@ class SwiftObjectFileFormatELF : public SwiftObjectFileFormat {
78
59
public:
79
60
llvm::StringRef getSectionName (ReflectionSectionKind section) override {
80
61
switch (section) {
81
- case fieldmd:
82
- return " swift5_fieldmd" ;
83
- case assocty:
84
- return " swift5_assocty" ;
85
- case builtin:
86
- return " swift5_builtin" ;
87
- case capture:
88
- return " swift5_capture" ;
89
- case typeref:
90
- return " swift5_typeref" ;
91
- case reflstr:
92
- return " swift5_reflstr" ;
93
- case conform:
94
- return " swift5_protocol_conformances" ;
95
- case protocs:
96
- return " swift5_protocols" ;
97
- case acfuncs:
98
- return " swift5_accessible_functions" ;
62
+ #define HANDLE_SWIFT_SECTION (KIND, MACHO, ELF, COFF ) \
63
+ case KIND: \
64
+ return ELF;
65
+ #include " llvm/BinaryFormat/Swift.def"
66
+ #undef HANDLE_SWIFT_SECTION
99
67
}
100
68
llvm_unreachable (" Section type not found." );
101
69
}
@@ -110,24 +78,11 @@ class SwiftObjectFileFormatCOFF : public SwiftObjectFileFormat {
110
78
public:
111
79
llvm::StringRef getSectionName (ReflectionSectionKind section) override {
112
80
switch (section) {
113
- case fieldmd:
114
- return " .sw5flmd" ;
115
- case assocty:
116
- return " .sw5asty" ;
117
- case builtin:
118
- return " .sw5bltn" ;
119
- case capture:
120
- return " .sw5cptr" ;
121
- case typeref:
122
- return " .sw5tyrf" ;
123
- case reflstr:
124
- return " .sw5rfst" ;
125
- case conform:
126
- return " .sw5prtc$B" ;
127
- case protocs:
128
- return " .sw5prt$B" ;
129
- case acfuncs:
130
- return " .sw5acfn$B" ;
81
+ #define HANDLE_SWIFT_SECTION (KIND, MACHO, ELF, COFF ) \
82
+ case KIND: \
83
+ return COFF;
84
+ #include " llvm/BinaryFormat/Swift.def"
85
+ #undef HANDLE_SWIFT_SECTION
131
86
}
132
87
llvm_unreachable (" Section not found." );
133
88
}
0 commit comments