mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-18 20:00:29 +00: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:
1 parent
3610325c38
commit
90f04700e2
27 files changed
+568
-581
No files matched your search
@@ -30,8 +30,9 @@ int main(int argc, char* argv[]) {
|
||||
Carbon::tracing_output = true;
|
||||
}
|
||||
|
||||
Carbon::Arena arena;
|
||||
std::variant<Carbon::AST, Carbon::SyntaxErrorCode> ast_or_error =
|
||||
Carbon::Parse(input_file_name);
|
||||
Carbon::Parse(PtrTo(arena), input_file_name);
|
||||
|
||||
if (auto* error = std::get_if<Carbon::SyntaxErrorCode>(&ast_or_error)) {
|
||||
// Diagnostic already reported to std::cerr; this is just a return code.
|
||||
@@ -39,5 +40,5 @@ int main(int argc, char* argv[]) {
|
||||
}
|
||||
|
||||
// Typecheck and run the parsed program.
|
||||
Carbon::ExecProgram(std::get<Carbon::AST>(ast_or_error));
|
||||
Carbon::ExecProgram(PtrTo(arena), std::get<Carbon::AST>(ast_or_error));
|
||||
}
|
||||
Reference in new issue
Block a user