[llvm] Add Offoading to llvm-readobj and llvm-objcopy (PR #141978)

David Salinas via llvm-commits llvm-commits at lists.llvm.org
Thu May 29 11:05:31 PDT 2025


================
@@ -1474,13 +1493,16 @@ objcopy::parseBitcodeStripOptions(ArrayRef<const char *> ArgsArr,
                              Arg->getAsString(InputArgs).c_str());
 
   SmallVector<StringRef, 2> Positional;
-  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");
-  assert(!Positional.empty());
-  Config.InputFilename = Positional[0];
+  if (Config.NeedPositional) {
+    for (auto *Arg : InputArgs.filtered(BITCODE_STRIP_INPUT))
+      Positional.push_back(Arg->getValue());
+    if (Positional.size() > 1)
----------------
david-salinas wrote:

I'm just moving existing code because I need to add a check for "if (Config.NeedPositional)". And the only reason I need to do that is that the llvm-objcopy tool currently, requires an input file argument.  But because I'm adding a new option "--dump-offload-bundle=<URI", the input file is in the URI. So to turn that requirement off I need to set "NeedPositional" to false if the --dump-offload-bundle option is specified.  Which is a whole other potential design issue.  :-)

 I can add the braces, but I don't know if clang-format will ask me to remove them.

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


More information about the llvm-commits mailing list