[llvm] [llvm-objdump] Support --mcpu=help/--mattr=help without -d (PR #165661)

James Henderson via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 10 00:43:05 PST 2025


================
@@ -3533,6 +3533,33 @@ commaSeparatedValues(const llvm::opt::InputArgList &InputArgs, int ID) {
   return Values;
 }
 
+static void mcpuHelp() {
+  std::string Error;
+  Triple TheTriple;
+
+  if (!TripleName.empty()) {
+    TheTriple.setTriple(TripleName);
+  } else {
+    // We can guarantee that InputFilenames won't be empty.
+    Expected<OwningBinary<Binary>> OBinary = createBinary(InputFilenames[0]);
+    // OwningBinary<Binary> OBinary =
+    if (!OBinary)
+      reportError(InputFilenames[0],
+                  "A target triple was not specified and could "
----------------
jh7370 wrote:

I agree it's not perfect, but the additional context for _why_ it cannot be inferred is important, plus this style is already in use elsewhere in some of the LLVM binutils. E.g. https://github.com/llvm/llvm-project/blob/a108881b24ecfea8d194b33dd9fb211943065bca/llvm/tools/llvm-objdump/llvm-objdump.cpp#L1382.

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


More information about the llvm-commits mailing list