Files
carbon-lang/explorer/parse_and_execute/parse_and_execute.h
T
Jon Ross-Perkins c43839e1b1 Switch FileTest to use StringRefs instead of files. (#2885)
In explorer, we already support parsing a string_view, so use that. In toolchain, we need to build support, probably using vfs, so that's a todo.

bazel test //explorer:file_test --runs_per_test=5

- branch: Stats over 250 runs: max = 18.3s, min = 5.2s, avg = 11.2s, dev = 2.9s
- trunk: Stats over 250 runs: max = 22.3s, min = 5.9s, avg = 12.1s, dev = 2.8s

Not a dramatic improvement, but maybe more effective long-term, and this'd been requested on #2876
2023-06-09 09:05:27 -07:00

32 lines
1.3 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
#ifndef CARBON_EXPLORER_PARSE_AND_EXECUTE_PARSE_AND_EXECUTE_H_
#define CARBON_EXPLORER_PARSE_AND_EXECUTE_PARSE_AND_EXECUTE_H_
#include "common/error.h"
#include "explorer/common/trace_stream.h"
namespace Carbon {
// Parses and executes the input file, returning the program result on success.
// This API is intended for use by main execution.
auto ParseAndExecuteFile(std::string_view prelude_path,
std::string_view input_file_name, bool parser_debug,
Nonnull<TraceStream*> trace_stream,
Nonnull<llvm::raw_ostream*> print_stream)
-> ErrorOr<int>;
// Parses and executes the source, returning the program result on success.
// Discards output.
auto ParseAndExecute(std::string_view prelude_path,
std::string_view input_file_name,
std::string_view file_contents, bool parser_debug,
Nonnull<TraceStream*> trace_stream,
Nonnull<llvm::raw_ostream*> print_stream) -> ErrorOr<int>;
} // namespace Carbon
#endif // CARBON_EXPLORER_PARSE_AND_EXECUTE_PARSE_AND_EXECUTE_H_