[llvm] 6eb7273 - [readtapi] Ensure universal dylibs record the same input path location across slices (#80875)

via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 6 10:01:49 PST 2024


Author: Cyndy Ishida
Date: 2024-02-06T10:01:45-08:00
New Revision: 6eb7273b11e6a3ec7c5ddb2d55bc585a25c0a923

URL: https://github.com/llvm/llvm-project/commit/6eb7273b11e6a3ec7c5ddb2d55bc585a25c0a923
DIFF: https://github.com/llvm/llvm-project/commit/6eb7273b11e6a3ec7c5ddb2d55bc585a25c0a923.diff

LOG: [readtapi] Ensure universal dylibs record the same input path location across slices (#80875)

resolves: https://github.com/llvm/llvm-project/issues/80868

Added: 
    

Modified: 
    llvm/lib/TextAPI/BinaryReader/DylibReader.cpp
    llvm/tools/llvm-readtapi/llvm-readtapi.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/TextAPI/BinaryReader/DylibReader.cpp b/llvm/lib/TextAPI/BinaryReader/DylibReader.cpp
index 40b57b5e40ea33..25b9499d189577 100644
--- a/llvm/lib/TextAPI/BinaryReader/DylibReader.cpp
+++ b/llvm/lib/TextAPI/BinaryReader/DylibReader.cpp
@@ -408,6 +408,7 @@ Expected<Records> DylibReader::readFile(MemoryBufferRef Buffer,
         Results.emplace_back(std::make_shared<RecordsSlice>(RecordsSlice({T})));
         if (auto Err = load(&Obj, *Results.back(), Opt, Arch))
           return std::move(Err);
+        Results.back()->getBinaryAttrs().Path = Buffer.getBufferIdentifier();
       }
       break;
     }

diff  --git a/llvm/tools/llvm-readtapi/llvm-readtapi.cpp b/llvm/tools/llvm-readtapi/llvm-readtapi.cpp
index 5944b1cd1f5910..80064ed9848517 100644
--- a/llvm/tools/llvm-readtapi/llvm-readtapi.cpp
+++ b/llvm/tools/llvm-readtapi/llvm-readtapi.cpp
@@ -199,6 +199,7 @@ static void stubifyImpl(std::unique_ptr<InterfaceFile> IF, Context &Ctx) {
   // TODO: Add inlining and magic merge support.
   if (Ctx.OutStream == nullptr) {
     std::error_code EC;
+    assert(!IF->getPath().empty() && "Unknown output location");
     SmallString<PATH_MAX> OutputLoc = IF->getPath();
     replace_extension(OutputLoc, ".tbd");
     Ctx.OutStream = std::make_unique<llvm::raw_fd_stream>(OutputLoc, EC);


        


More information about the llvm-commits mailing list