[llvm] 1569e0e - [TextAPI] Add an assertion for adding duplicate libraries into a single TBD file (#101744)

via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 5 10:06:54 PDT 2024


Author: Cyndy Ishida
Date: 2024-08-05T10:06:50-07:00
New Revision: 1569e0edf3ea5ecc17e3827c07c939a7a2fe2604

URL: https://github.com/llvm/llvm-project/commit/1569e0edf3ea5ecc17e3827c07c939a7a2fe2604
DIFF: https://github.com/llvm/llvm-project/commit/1569e0edf3ea5ecc17e3827c07c939a7a2fe2604.diff

LOG: [TextAPI] Add an assertion for adding duplicate libraries into a single TBD file (#101744)

This would lead to a malformed TBD file.

Added: 
    

Modified: 
    llvm/lib/TextAPI/InterfaceFile.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/TextAPI/InterfaceFile.cpp b/llvm/lib/TextAPI/InterfaceFile.cpp
index 79694c90370f4..efbf33b74776e 100644
--- a/llvm/lib/TextAPI/InterfaceFile.cpp
+++ b/llvm/lib/TextAPI/InterfaceFile.cpp
@@ -87,6 +87,9 @@ void InterfaceFile::addDocument(std::shared_ptr<InterfaceFile> &&Document) {
                                   const std::shared_ptr<InterfaceFile> &RHS) {
                                  return LHS->InstallName < RHS->InstallName;
                                });
+  assert((Pos == Documents.end() ||
+          (*Pos)->InstallName != Document->InstallName) &&
+         "Unexpected duplicate document added");
   Document->Parent = this;
   Documents.insert(Pos, Document);
 }


        


More information about the llvm-commits mailing list