================
@@ -135,6 +137,44 @@ static Error bundleImages() {
   return Error::success();
 }
 
+// Extract a single OffloadBinary, recursively handling nested OffloadBinaries.
+static Error extractBinary(const OffloadBinary *Binary, StringRef InputFile,
+                           uint64_t &Idx, StringSaver &Saver) {
+  StringRef ImageData = Binary->getImage();
+
+  // Check if the image contains a nested OffloadBinary.
+  if (identify_magic(ImageData) == file_magic::offload_binary) {
+    // Parse nested OffloadBinary.
+    MemoryBufferRef InnerBuffer(ImageData, "nested-offload-binary");
+    SmallVector<OffloadFile> InnerBinaries;
+    if (Error Err = extractOffloadBinaries(InnerBuffer, InnerBinaries))
+      return Err;
----------------
jh7370 wrote:

You need test cases that exercise this and the other failure case in this 
method, to show that they are handled properly.

https://github.com/llvm/llvm-project/pull/184774
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to