main.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. #ifndef CARBON_EXPLORER_MAIN_H_
  5. #define CARBON_EXPLORER_MAIN_H_
  6. #include "common/ostream.h"
  7. #include "llvm/ADT/StringRef.h"
  8. #include "llvm/Support/VirtualFileSystem.h"
  9. namespace Carbon {
  10. // Runs explorer. relative_prelude_path must be POSIX-style, not native, and
  11. // will be translated to native.
  12. auto ExplorerMain(int argc, char** argv, void* static_for_main_addr,
  13. llvm::StringRef relative_prelude_path) -> int;
  14. // Wrapped by the above, but without some process init. This is used directly by
  15. // tests, whereas the above is used directly by main binaries. The
  16. // out_stream_for_trace is only used when `--trace_file=-` is specified.
  17. //
  18. // TODO: We use argc/argv for parameters because command line parsing requires
  19. // it. When that's replaced, we should switch to
  20. // llvm::SmallVector<llvm::StringRef> args because it'll work better with tests.
  21. auto ExplorerMain(int argc, const char** argv, llvm::StringRef install_path,
  22. llvm::StringRef relative_prelude_path,
  23. llvm::raw_ostream& out_stream, llvm::raw_ostream& err_stream,
  24. llvm::raw_ostream& out_stream_for_trace,
  25. llvm::vfs::FileSystem& fs) -> int;
  26. } // namespace Carbon
  27. #endif // CARBON_EXPLORER_MAIN_H_