Skip to content

[readtapi] add optional --<option>"=" to some cli opts #72426

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions llvm/tools/llvm-readtapi/TapiOpts.td
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@
include "llvm/Option/OptParser.td"

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

//
// General Driver options
//
def help : FF<"help", "display this help">;
def output: JS<"o", "write output to <file>","<file>">;
defm output: JS<"o", "write output to <file>","<file>">;

//
// Compare options
Expand Down
2 changes: 1 addition & 1 deletion llvm/tools/llvm-readtapi/llvm-readtapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ int main(int Argc, char **Argv) {
for (opt::Arg *A : Args.filtered(OPT_INPUT))
Ctx.Inputs.push_back(A->getValue());

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