Repository: carbon-language/carbon-lang
File: toolchain/testing/file_test.cpp (C++)

Code before:
  return result;
}

auto ToolchainFileTest::GetDefaultArgs() const
    -> llvm::SmallVector<std::string> {
  llvm::SmallVector<std::string> args = {"--include-diagnostic-kind"};

  if (component_ == "format") {
    args.insert(args.end(), {"format", "%s"});
    return args;
  } else if (component_ == "language_server") {
    args.insert(args.end(), {"language-server"});
    return args;
  }

  args.insert(args.end(), {"compile", "--phase=" + component_.str()});

  if (component_ == "lex") {
    args.insert(args.end(), {"--dump-tokens", "--omit-file-boundary-tokens"});
  } else if (component_ == "parse") {
    args.push_back("--dump-parse-tree");
  } else if (component_ == "check") {
    args.push_back("--dump-sem-ir");
  } else if (component_ == "lower") {
    args.insert(args.end(),
                {"--dump-llvm-ir", "--target=x86_64-unknown-linux-gnu"});
  } else {
    CARBON_FATAL("Unexpected test component {0}: {1}", component_, test_name());
  }

  switch (prelude()) {
    case Prelude::Default:
      // Use the install path to exclude prelude files.
      args.push_back("--exclude-dump-file-prefix=" +
                     installation_.core_package());
      break;

    case Prelude::Min:
      // Included files all show up under the `include_files/` prefix, so
      // exclude min_prelude files that way.
      args.insert(args.end(), {"--custom-core",
                               "--exclude-dump-file-prefix=include_files/"});
      break;

    case Prelude::None:
      args.push_back("--no-prelude-import");
      break;
  }

  args.push_back("%s");
  return args;

Review comment (suggestion):
```suggestion
                {"--dump-llvm-ir", "--target=x86_64-linux-gnu"});
```
May as well use the simpler target name here.

Code after:
  return result;
}

auto ToolchainFileTest::GetDefaultArgs() const
    -> llvm::SmallVector<std::string> {
  llvm::SmallVector<std::string> args = {"--include-diagnostic-kind"};

  if (component_ == "format") {
    args.insert(args.end(), {"format", "%s"});
    return args;
  } else if (component_ == "language_server") {
    args.insert(args.end(), {"language-server"});
    return args;
  }

  args.insert(args.end(), {"compile", "--phase=" + component_.str()});

  if (component_ == "lex") {
    args.insert(args.end(), {"--dump-tokens", "--omit-file-boundary-tokens"});
  } else if (component_ == "parse") {
    args.push_back("--dump-parse-tree");
  } else if (component_ == "check") {
    args.push_back("--dump-sem-ir");
  } else if (component_ == "lower") {
    args.insert(args.end(), {"--dump-llvm-ir", "--target=x86_64-linux-gnu"});
  } else {
    CARBON_FATAL("Unexpected test component {0}: {1}", component_, test_name());
  }

  switch (prelude()) {
    case Prelude::Default:
      // Use the install path to exclude prelude files.
      args.push_back("--exclude-dump-file-prefix=" +
                     installation_.core_package());
      break;

    case Prelude::Min:
      // Included files all show up under the `include_files/` prefix, so
      // exclude min_prelude files that way.
      args.insert(args.end(), {"--custom-core",
                               "--exclude-dump-file-prefix=include_files/"});
      break;

    case Prelude::None:
      args.push_back("--no-prelude-import");
      break;
  }

  args.push_back("%s");
  return args;
}