[llvm] Add --dump-offload-bundle option to llvm-objcopy (PR #143347)

via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 21 13:02:38 PDT 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff HEAD~1 HEAD --extensions cpp,h -- llvm/include/llvm/ObjCopy/CommonConfig.h llvm/include/llvm/Object/OffloadBundle.h llvm/lib/ObjCopy/ELF/ELFObjcopy.cpp llvm/lib/Object/OffloadBundle.cpp llvm/tools/llvm-objcopy/ObjcopyOptions.cpp llvm/tools/llvm-objcopy/ObjcopyOptions.h llvm/tools/llvm-objcopy/llvm-objcopy.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/include/llvm/Object/OffloadBundle.h b/llvm/include/llvm/Object/OffloadBundle.h
index 7e5727911..b67edc1b3 100644
--- a/llvm/include/llvm/Object/OffloadBundle.h
+++ b/llvm/include/llvm/Object/OffloadBundle.h
@@ -132,8 +132,9 @@ public:
     switch (Type) {
     case FILE_URI:
       return createFileURI(Str);
-  //    if (Expected<std::unique_ptr<OffloadBundleURI>> URIOrErr = createFileURI(Str))
-//	      return URIOrErr.takeError();
+      //    if (Expected<std::unique_ptr<OffloadBundleURI>> URIOrErr =
+      //    createFileURI(Str))
+      //	      return URIOrErr.takeError();
       break;
     case MEMORY_URI:
       return createMemoryURI(Str);
diff --git a/llvm/tools/llvm-objcopy/ObjcopyOptions.cpp b/llvm/tools/llvm-objcopy/ObjcopyOptions.cpp
index f9735121d..11f6e1758 100644
--- a/llvm/tools/llvm-objcopy/ObjcopyOptions.cpp
+++ b/llvm/tools/llvm-objcopy/ObjcopyOptions.cpp
@@ -286,13 +286,15 @@ static Expected<uint8_t> parseVisibilityType(StringRef VisType) {
   return type;
 }
 
-//static void llvm::objcopy::parseDumpOffloadBundle(StringRef URI) {
-static Expected<StringRef> llvm::objcopy::parseDumpOffloadBundle(StringRef URI) {
+// static void llvm::objcopy::parseDumpOffloadBundle(StringRef URI) {
+static Expected<StringRef>
+llvm::objcopy::parseDumpOffloadBundle(StringRef URI) {
   if (Error Err = object::extractOffloadBundleByURI(URI))
-    //errs() << "Failed to extract from URI.";
-    return createStringError(errc::invalid_argument,"Failed to extract from URI");
+    // errs() << "Failed to extract from URI.";
+    return createStringError(errc::invalid_argument,
+                             "Failed to extract from URI");
 
-   return URI;
+  return URI;
 }
 
 namespace {
@@ -1503,9 +1505,8 @@ objcopy::parseBitcodeStripOptions(ArrayRef<const char *> ArgsArr,
   for (auto *Arg : InputArgs.filtered(BITCODE_STRIP_INPUT))
     Positional.push_back(Arg->getValue());
   if (Positional.size() > 1)
-    return createStringError(
-        errc::invalid_argument,
-        "llvm-bitcode-strip expects a single input file");
+    return createStringError(errc::invalid_argument,
+                             "llvm-bitcode-strip expects a single input file");
   assert(!Positional.empty());
   Config.InputFilename = Positional[0];
 
@@ -1583,8 +1584,7 @@ objcopy::parseStripOptions(ArrayRef<const char *> RawArgsArr,
   std::copy(DashDash, RawArgsArr.end(), std::back_inserter(Positional));
 
   if (Positional.empty())
-    return createStringError(errc::invalid_argument,
-                             "no input file specified");
+    return createStringError(errc::invalid_argument, "no input file specified");
 
   if (Positional.size() > 1 && InputArgs.hasArg(STRIP_output)) {
     return createStringError(
diff --git a/llvm/tools/llvm-objcopy/ObjcopyOptions.h b/llvm/tools/llvm-objcopy/ObjcopyOptions.h
index 46328b702..38b02d7a1 100644
--- a/llvm/tools/llvm-objcopy/ObjcopyOptions.h
+++ b/llvm/tools/llvm-objcopy/ObjcopyOptions.h
@@ -52,8 +52,8 @@ Expected<DriverConfig>
 parseStripOptions(ArrayRef<const char *> ArgsArr,
                   llvm::function_ref<Error(Error)> ErrorCallback);
 
-// parseDumpOffloadBundle reads a URI as a string and extracts the raw memory into a
-// code object file named from the URI string given.
+// parseDumpOffloadBundle reads a URI as a string and extracts the raw memory
+// into a code object file named from the URI string given.
 static Expected<StringRef> parseDumpOffloadBundle(StringRef URI);
 
 } // namespace objcopy

``````````

</details>


https://github.com/llvm/llvm-project/pull/143347


More information about the llvm-commits mailing list