@@ -28,6 +28,8 @@ class SwiftObjectFileFormat {
28
28
public:
29
29
virtual ~SwiftObjectFileFormat () {}
30
30
virtual llvm::StringRef getSectionName (ReflectionSectionKind section) = 0;
31
+ // / Predicate to identify if the named section can contain reflection data.
32
+ virtual bool sectionContainsReflectionData (llvm::StringRef sectionName) = 0;
31
33
};
32
34
33
35
// / Responsible for providing the Mach-O reflection section identifiers.
@@ -50,6 +52,10 @@ class SwiftObjectFileFormatMachO : public SwiftObjectFileFormat {
50
52
}
51
53
llvm_unreachable (" Section type not found." );
52
54
}
55
+
56
+ bool sectionContainsReflectionData (llvm::StringRef sectionName) override {
57
+ return sectionName.startswith (" __swift5_" ) || sectionName == " __const" ;
58
+ }
53
59
};
54
60
55
61
// / Responsible for providing the ELF reflection section identifiers.
@@ -72,6 +78,10 @@ class SwiftObjectFileFormatELF : public SwiftObjectFileFormat {
72
78
}
73
79
llvm_unreachable (" Section type not found." );
74
80
}
81
+
82
+ bool sectionContainsReflectionData (llvm::StringRef sectionName) override {
83
+ return sectionName.startswith (" swift5_" );
84
+ }
75
85
};
76
86
77
87
// / Responsible for providing the COFF reflection section identifiers
@@ -94,6 +104,10 @@ class SwiftObjectFileFormatCOFF : public SwiftObjectFileFormat {
94
104
}
95
105
llvm_unreachable (" Section not found." );
96
106
}
107
+
108
+ bool sectionContainsReflectionData (llvm::StringRef sectionName) override {
109
+ return sectionName.startswith (" .sw5" );
110
+ }
97
111
};
98
112
} // namespace swift
99
113
#endif // SWIFT_ABI_OBJECTFILE_H
0 commit comments