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

Ruoyu Qiu via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 9 23:48:28 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 "
----------------
cabbaken wrote:

Would this be better? 
```cpp
    Expected<OwningBinary<Binary>> OBinary = createBinary(InputFilenames[0]);
    if (auto E = OBinary.takeError()) {
      reportWarning("triple was not specified and could "
                    "not be inferred from the input file",
                    InputFilenames[0]);
      reportError(std::move(E), InputFilenames[0]);
    }
```
I haven't found a better way to incorporate the error text into this message.

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


More information about the llvm-commits mailing list