Skip to content

Commit 55f28eb

Browse files
committed
[readtapi] add optional --<option>"=" to some cli opts (llvm#72426)
(cherry picked from commit 3b48a7a)
1 parent 4d6c333 commit 55f28eb

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

llvm/tools/llvm-readtapi/TapiOpts.td

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,16 @@
22
include "llvm/Option/OptParser.td"
33

44
class FF<string name, string help>: Flag<["-", "--"], name>, HelpText<help>;
5-
class JS<string name, string help, string var = ""> : JoinedOrSeparate<["-", "--"], name>, HelpText<help>, MetaVarName<var>;
5+
multiclass JS<string name, string help, string var = ""> {
6+
def NAME #_EQ : Joined<["--"], name #"=">, HelpText<help>, MetaVarName<var>;
7+
def : Separate<["-", "--"], name>, Alias<!cast<Joined>(NAME #_EQ)>;
8+
}
69

710
//
811
// General Driver options
912
//
1013
def help : FF<"help", "display this help">;
11-
def output: JS<"o", "write output to <file>","<file>">;
14+
defm output: JS<"o", "write output to <file>","<file>">;
1215

1316
//
1417
// Compare options

llvm/tools/llvm-readtapi/llvm-readtapi.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ int main(int Argc, char **Argv) {
127127
for (opt::Arg *A : Args.filtered(OPT_INPUT))
128128
Ctx.Inputs.push_back(A->getValue());
129129

130-
if (opt::Arg *A = Args.getLastArg(OPT_output)) {
130+
if (opt::Arg *A = Args.getLastArg(OPT_output_EQ)) {
131131
std::string OutputLoc = std::move(A->getValue());
132132
std::error_code EC;
133133
Ctx.OutStream = std::make_unique<llvm::raw_fd_stream>(OutputLoc, EC);

0 commit comments

Comments
 (0)