mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 18:51:11 +01:00
Refactor subcommand addition for sharing. (#4474)
Trying to standardize the setup a little more.
This commit is contained in:
@@ -42,21 +42,6 @@ auto operator<<(llvm::raw_ostream& out, CompileOptions::Phase phase)
|
||||
return out;
|
||||
}
|
||||
|
||||
constexpr CommandLine::CommandInfo CompileOptions::Info = {
|
||||
.name = "compile",
|
||||
.help = R"""(
|
||||
Compile Carbon source code.
|
||||
|
||||
This subcommand runs the Carbon compiler over input source code, checking it for
|
||||
errors and producing the requested output.
|
||||
|
||||
Error messages are written to the standard error stream.
|
||||
|
||||
Different phases of the compiler can be selected to run, and intermediate state
|
||||
can be written to standard output as these phases progress.
|
||||
)""",
|
||||
};
|
||||
|
||||
auto CompileOptions::Build(CommandLine::CommandBuilder& b) -> void {
|
||||
b.AddStringPositionalArg(
|
||||
{
|
||||
@@ -284,6 +269,23 @@ Emit DWARF debug information.
|
||||
});
|
||||
}
|
||||
|
||||
static constexpr CommandLine::CommandInfo SubcommandInfo = {
|
||||
.name = "compile",
|
||||
.help = R"""(
|
||||
Compile Carbon source code.
|
||||
|
||||
This subcommand runs the Carbon compiler over input source code, checking it for
|
||||
errors and producing the requested output.
|
||||
|
||||
Error messages are written to the standard error stream.
|
||||
|
||||
Different phases of the compiler can be selected to run, and intermediate state
|
||||
can be written to standard output as these phases progress.
|
||||
)""",
|
||||
};
|
||||
|
||||
CompileSubcommand::CompileSubcommand() : DriverSubcommand(SubcommandInfo) {}
|
||||
|
||||
auto CompileSubcommand::ValidateOptions(DriverEnv& driver_env) const -> bool {
|
||||
using Phase = CompileOptions::Phase;
|
||||
switch (options_.phase) {
|
||||
|
||||
Reference in New Issue
Block a user