Repository: carbon-language/carbon-lang
File: toolchain/driver/compile_subcommand.cpp (C++)

Code before:
    out << "Filename: " << input_filename_ << "\n";
  });
  CARBON_VLOG("*** {0}: {1} ***\n", logging_label, input_filename_);
  Timings::ScopedTiming timing(timings_ ? &*timings_ : nullptr, timing_label);
  fn();
  CARBON_VLOG("*** {0} done ***\n", logging_label);
}

auto CompileSubcommand::Run(DriverEnv& driver_env) -> DriverResult {
  if (!ValidateOptions(driver_env.emitter)) {
    return {.success = false};
  }

  std::shared_ptr<clang::CompilerInvocation> clang_invocation;
  // Build a clang invocation. We do this regardless of whether we're running
  // check, because this is essentially performing further option validation,
  // and we generally validate all options even if we're not using them for the
  // selected phases of compilation.
  // TODO: Share any arguments we specify here with the `carbon clang`
  // subcommand.
  {
    llvm::SmallVector<std::string> clang_path_and_args = {
        driver_env.installation->clang_path(),
        // Propagate the target to Clang.
        "-target",
        options_.codegen_options.target.str(),
        // Enable PIE by default, but allow it to be overridden by Clang
        // arguments. Clang's default is configurable, but we'd like our
        // defaults to be more stable.
        // TODO: Decide if we want this.
        "-fPIE",
    };
    for (auto str : options_.clang_args) {
      clang_path_and_args.push_back(str.str());
    }
    clang_invocation = Check::BuildClangInvocation(
        driver_env.consumer, driver_env.fs, clang_path_and_args);
    if (!clang_invocation) {
      return {.success = false};
    }
  }

  // Find the files comprising the prelude if we are importing it.
  // TODO: Replace this with a search for library api files in a
  // package-specific search path based on the library name.
  llvm::SmallVector<std::string> prelude;
  if (options_.prelude_import && !options_.custom_core &&
      options_.phase >= CompileOptions::Phase::Check) {
    if (auto find = driver_env.installation->ReadPreludeManifest(); find.ok()) {
      prelude = std::move(*find);
    } else {

Review comment (suggestion):
Optional, but I always prefer joined options when we can...

```suggestion
        llvm::formatv("--target=$0", options_.codegen_options.target).str(),
```

Code after:
  PrettyStackTraceFunction trace_file([&](llvm::raw_ostream& out) {
    out << "Filename: " << input_filename_ << "\n";
  });
  CARBON_VLOG("*** {0}: {1} ***\n", logging_label, input_filename_);
  Timings::ScopedTiming timing(timings_ ? &*timings_ : nullptr, timing_label);
  fn();
  CARBON_VLOG("*** {0} done ***\n", logging_label);
}

auto CompileSubcommand::Run(DriverEnv& driver_env) -> DriverResult {
  if (!ValidateOptions(driver_env.emitter)) {
    return {.success = false};
  }

  std::shared_ptr<clang::CompilerInvocation> clang_invocation;
  // Build a clang invocation. We do this regardless of whether we're running
  // check, because this is essentially performing further option validation,
  // and we generally validate all options even if we're not using them for the
  // selected phases of compilation.
  // TODO: Share any arguments we specify here with the `carbon clang`
  // subcommand.
  {
    llvm::SmallVector<std::string> clang_path_and_args = {
        driver_env.installation->clang_path(),
        // Propagate the target to Clang.
        llvm::formatv("--target={0}", options_.codegen_options.target).str(),
        // Enable PIE by default, but allow it to be overridden by Clang
        // arguments. Clang's default is configurable, but we'd like our
        // defaults to be more stable.
        // TODO: Decide if we want this.
        "-fPIE",
    };
    for (auto str : options_.clang_args) {
      clang_path_and_args.push_back(str.str());
    }
    clang_invocation = BuildClangInvocation(driver_env.consumer, driver_env.fs,
                                            clang_path_and_args);
    if (!clang_invocation) {
      return {.success = false};
    }
  }

  // Find the files comprising the prelude if we are importing it.
  // TODO: Replace this with a search for library api files in a
  // package-specific search path based on the library name.
  llvm::SmallVector<std::string> prelude;
  if (options_.prelude_import && !options_.custom_core &&
      options_.phase >= CompileOptions::Phase::Check) {
    if (auto find = driver_env.installation->ReadPreludeManifest(); find.ok()) {
      prelude = std::move(*find);
    } else {