Files
carbon-lang/toolchain/driver/driver_main.cpp
T
Jon Ross-Perkins 0b9bda10b7 Refactor common main logic (#2260)
1) toolchain and explorer use the same working dir logic, share it
2) explorer's carbon.cpp and main_bin.cpp use the same relative path logic, share it
3) You can append a longer path in one call with the right kind of iterator
4) Fix what's maybe a bug in passing `relative_prelude_path.str()` to `cl::init`
5) Collapse Main and ExplorerMain to avoid passing more parameters between
2022-10-05 17:34:04 -07:00

25 lines
709 B
C++

// 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 <cstdlib>
#include "common/bazel_working_dir.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/FileSystem.h"
#include "toolchain/driver/driver.h"
auto main(int argc, char** argv) -> int {
if (argc < 1) {
return EXIT_FAILURE;
}
Carbon::SetWorkingDirForBazel();
llvm::SmallVector<llvm::StringRef, 16> args(argv + 1, argv + argc);
Carbon::Driver driver;
bool success = driver.RunFullCommand(args);
return success ? EXIT_SUCCESS : EXIT_FAILURE;
}