mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 06:41:06 +01:00
Extract subcommand options from the driver file. (#4300)
I'm separating the options out so that it's easier to review. They include a lot of boilerplate text that I think won't change much, and makes it harder to review changes. To explain filename differences, whereas `CodegenOptions` is shared (by link and compile), `LinkOptions` and `CompileOptions` are subcommand-specific. I'm planning to separate out the subcommands, so I'm putting those in respective subcommand files. I'm still going to try to use the `.h` to declare the interface, `.cpp` for bigger implementation details (for better or worse, including comments on options). I'm also moving out corresponding Driver members to help shrink deltas when refactoring. That is, the bodies aren't changing here, but a refactoring of commands will make some changes. By moving the code to different files now, it should be easier to identify what's changing later. --------- Co-authored-by: Geoff Romer <gromer@google.com>
This commit is contained in:
co-authored by
Geoff Romer
parent
02c263294c
commit
1b956e68fe
@@ -0,0 +1,28 @@
|
||||
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
#include "toolchain/driver/codegen_options.h"
|
||||
|
||||
namespace Carbon {
|
||||
|
||||
void CodegenOptions::Build(CommandLine::CommandBuilder& b) {
|
||||
b.AddStringOption(
|
||||
{
|
||||
.name = "target",
|
||||
.help = R"""(
|
||||
Select a target platform. Uses the LLVM target syntax. Also known as a "triple"
|
||||
for historical reasons.
|
||||
|
||||
This corresponds to the `target` flag to Clang and accepts the same strings
|
||||
documented there:
|
||||
https://clang.llvm.org/docs/CrossCompilation.html#target-triple
|
||||
)""",
|
||||
},
|
||||
[&](auto& arg_b) {
|
||||
arg_b.Default(host);
|
||||
arg_b.Set(&target);
|
||||
});
|
||||
}
|
||||
|
||||
} // namespace Carbon
|
||||
Reference in New Issue
Block a user