Skip to content

Commit 9d80ea2

Browse files
committed
use startswith for elf and coff too
1 parent fd30545 commit 9d80ea2

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

include/swift/ABI/ObjectFile.h

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,7 @@ class SwiftObjectFileFormat {
3232
return {};
3333
}
3434
/// Predicate to identify if the named section can contain reflection data.
35-
virtual bool sectionContainsReflectionData(llvm::StringRef sectionName) {
36-
return sectionName == getSectionName(fieldmd) ||
37-
sectionName == getSectionName(assocty) ||
38-
sectionName == getSectionName(builtin) ||
39-
sectionName == getSectionName(capture) ||
40-
sectionName == getSectionName(typeref) ||
41-
sectionName == getSectionName(reflstr);
42-
}
35+
virtual bool sectionContainsReflectionData(llvm::StringRef sectionName) = 0;
4336
};
4437

4538
/// Responsible for providing the Mach-O reflection section identifiers.
@@ -96,6 +89,10 @@ class SwiftObjectFileFormatELF : public SwiftObjectFileFormat {
9689
}
9790
llvm_unreachable("Section type not found.");
9891
}
92+
93+
bool sectionContainsReflectionData(llvm::StringRef sectionName) override {
94+
return sectionName.startswith("swift5_");
95+
}
9996
};
10097

10198
/// Responsible for providing the COFF reflection section identifiers
@@ -118,6 +115,10 @@ class SwiftObjectFileFormatCOFF : public SwiftObjectFileFormat {
118115
}
119116
llvm_unreachable("Section not found.");
120117
}
118+
119+
bool sectionContainsReflectionData(llvm::StringRef sectionName) override {
120+
return sectionName.startswith(".sw5");
121+
}
121122
};
122123
} // namespace swift
123124
#endif // SWIFT_ABI_OBJECTFILE_H

0 commit comments

Comments
 (0)