summaryrefslogtreecommitdiff
path: root/llvm/lib/TextAPI/InterfaceFile.cpp
diff options
context:
space:
mode:
authorCyndy Ishida <cyndy_ishida@apple.com>2023-02-22 17:13:14 -0800
committerCyndy Ishida <cyndy_ishida@apple.com>2023-02-22 19:39:26 -0800
commitbc85cf1687435f28fb01b1aa5303317e6118490c (patch)
tree8e27117bef76288aa7d62d883be7cc685c5d660f /llvm/lib/TextAPI/InterfaceFile.cpp
parent471c0e000af7f2534c84fac9beb0973e4b1c7a62 (diff)
[TextAPI] Add support for TBDv5 Files to nm & tapi-diff
This includes handling of new attributes for symbols & rpath. In the event that an older format file is compared to tbd_v5, ignore these new attributes. Reviewed By: ributzka Differential Revision: https://reviews.llvm.org/D144529
Diffstat (limited to 'llvm/lib/TextAPI/InterfaceFile.cpp')
-rw-r--r--llvm/lib/TextAPI/InterfaceFile.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/lib/TextAPI/InterfaceFile.cpp b/llvm/lib/TextAPI/InterfaceFile.cpp
index f9b5e95d5f6f..5d3cf851dadc 100644
--- a/llvm/lib/TextAPI/InterfaceFile.cpp
+++ b/llvm/lib/TextAPI/InterfaceFile.cpp
@@ -141,6 +141,10 @@ void InterfaceFile::addDocument(std::shared_ptr<InterfaceFile> &&Document) {
Documents.insert(Pos, Document);
}
+static bool isYAMLTextStub(const FileType &Kind) {
+ return (Kind >= FileType::TBD_V1) && (Kind < FileType::TBD_V5);
+}
+
bool InterfaceFile::operator==(const InterfaceFile &O) const {
if (Targets != O.Targets)
return false;
@@ -165,6 +169,13 @@ bool InterfaceFile::operator==(const InterfaceFile &O) const {
return false;
if (Symbols != O.Symbols)
return false;
+ // Don't compare run search paths for older filetypes that cannot express
+ // them.
+ if (!(isYAMLTextStub(FileKind)) && !(isYAMLTextStub(O.FileKind))) {
+ if (RPaths != O.RPaths)
+ return false;
+ }
+
if (!std::equal(Documents.begin(), Documents.end(), O.Documents.begin(),
O.Documents.end(),
[](const std::shared_ptr<InterfaceFile> LHS,