Skip to content

Commit 1569e0e

Browse files
authored
[TextAPI] Add an assertion for adding duplicate libraries into a single TBD file (llvm#101744)
This would lead to a malformed TBD file.
1 parent 2b17366 commit 1569e0e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

llvm/lib/TextAPI/InterfaceFile.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ void InterfaceFile::addDocument(std::shared_ptr<InterfaceFile> &&Document) {
8787
const std::shared_ptr<InterfaceFile> &RHS) {
8888
return LHS->InstallName < RHS->InstallName;
8989
});
90+
assert((Pos == Documents.end() ||
91+
(*Pos)->InstallName != Document->InstallName) &&
92+
"Unexpected duplicate document added");
9093
Document->Parent = this;
9194
Documents.insert(Pos, Document);
9295
}

0 commit comments

Comments
 (0)