-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Break out driver environment info into its own type. #4299
Conversation
toolchain/driver/driver.cpp
Outdated
@@ -789,7 +792,7 @@ class Driver::CompilationUnit { | |||
!input_filename_.starts_with(options_.exclude_dump_file_prefix); | |||
} | |||
|
|||
Driver* driver_; | |||
DriverEnv& driver_env_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer fields not to have a reference type, particularly non-const. Can this be made into a pointer instead? I see that some other fields are references too -- what is the motivation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally I think there's a mix in the toolchain, tending more to references than pointers. One constraint of references is that they're implicitly non-null.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps as a stronger argument, three lines down there's a &. This type should be self-consistent.
https://discord.com/channels/655572317891461132/821113559755784242/1283516297686286377 regarding this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trying to read a possible conclusion from current discussion, updated to DriverEnv*
I want to split commands out so that we don't keep piling onto driver (particularly as I'm eyeing clang-related commands). This extracts out the DriverEnv so that it can be easily shared, with the CompilationUnit as an example.
CARBON_VLOG_TO is to remove the vlog_stream_ requirement of CARBON_VLOG.