mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-03 22:02:51 +01:00
The lack of comments makes it difficult to be sure, but if any of these are necessary, I'd like to make sure there are comments to explain why a specific value was shown (which I do add for diagnostics_ in this change).
36 lines
1.1 KiB
C++
36 lines
1.1 KiB
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/InitLLVM.h"
|
|
#include "toolchain/driver/driver.h"
|
|
|
|
auto main(int argc, char** argv) -> int {
|
|
if (argc < 1) {
|
|
return EXIT_FAILURE;
|
|
}
|
|
|
|
Carbon::SetWorkingDirForBazel();
|
|
|
|
llvm::setBugReportMsg(
|
|
"Please report issues to "
|
|
"https://github.com/carbon-language/carbon-lang/issues and include the "
|
|
"crash backtrace.\n");
|
|
llvm::InitLLVM init_llvm(argc, argv);
|
|
|
|
// Printing to stderr should flush stdout. This is most noticeable when stderr
|
|
// is piped to stdout.
|
|
llvm::errs().tie(&llvm::outs());
|
|
|
|
llvm::SmallVector<llvm::StringRef> args(argv + 1, argv + argc);
|
|
auto fs = llvm::vfs::getRealFileSystem();
|
|
Carbon::Driver driver(*fs, llvm::outs(), llvm::errs());
|
|
bool success = driver.RunFullCommand(args);
|
|
return success ? EXIT_SUCCESS : EXIT_FAILURE;
|
|
}
|