mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Remove global_arena (#814)
With this, only main.cpp instantiates an arena. Maybe we'll want to split that up more later (e.g., so that the runtime interpreter uses its own arena), but given the intent to have type-checking update the AST, I thought this was a reasonable approach for now in order to avoid ownership complexities. Fixes #769
This commit is contained in:
@@ -17,8 +17,8 @@ namespace Carbon {
|
||||
class ParseAndLexContext {
|
||||
public:
|
||||
// Creates an instance analyzing the given input file.
|
||||
ParseAndLexContext(const std::string& input_file)
|
||||
: input_file_name(global_arena->New<std::string>(input_file)) {}
|
||||
ParseAndLexContext(Ptr<const std::string> input_file_name)
|
||||
: input_file_name(input_file_name) {}
|
||||
|
||||
// Writes a syntax error diagnostic containing message to standard error.
|
||||
auto PrintDiagnostic(const std::string& message) -> void;
|
||||
@@ -40,8 +40,9 @@ class ParseAndLexContext {
|
||||
} // namespace Carbon
|
||||
|
||||
// Gives flex the yylex prototype we want.
|
||||
#define YY_DECL \
|
||||
Carbon::Parser::symbol_type yylex(yyscan_t yyscanner, \
|
||||
#define YY_DECL \
|
||||
Carbon::Parser::symbol_type yylex(Carbon::Ptr<Carbon::Arena> arena, \
|
||||
yyscan_t yyscanner, \
|
||||
Carbon::ParseAndLexContext& context)
|
||||
|
||||
// Declares yylex for the parser's sake.
|
||||
|
||||
Reference in New Issue
Block a user