[PATCH] D71554: [llvm-ranlib] Handle -D and -U command line flag

Jordan Rupprecht via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 17 10:44:59 PST 2019


rupprecht accepted this revision.
rupprecht added a comment.
This revision is now accepted and ready to land.

Looks good for D/U, but looks like --help and --version options are also supported as combined short args; do you mind adding those too while you're here?

Thanks for the patch!



================
Comment at: llvm/tools/llvm-ar/llvm-ar.cpp:68
+  -h --help             - Display available options
+  --version             - Display the version of this program
+  -D                    - Use zero for timestamps and uids/gids (default)
----------------
`-v --version`


================
Comment at: llvm/tools/llvm-ar/llvm-ar.cpp:1164-1176
+    } else if (arg.consume_front("-")) {
+      // Handle the -D/-U flag
+      while (!arg.empty()) {
+        if (arg.front() == 'D') {
+          Deterministic = true;
+        } else if (arg.front() == 'U') {
+          Deterministic = false;
----------------
```
  } else if (arg.front() == 'h') {
    printHelpMessage();
    return 0;
  } else if (arg.front() == 'v') {
    cl::PrintVersionMessage();
    return 0;
  }
```

Actually, `ranlib -vh` and `ranlib -hv` (on my machine at least) both print the help message. I don't think we need *that* level of compatibility though -- we can go with first-one-wins.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71554/new/

https://reviews.llvm.org/D71554





More information about the llvm-commits mailing list