Reduce the state kept in OptionProcessor.

Make the list of rc files a local variable as it need not be a class
attribute, and drop the unused rcoptions_ field.

This is a trivial refactoring and the remaining code is still too
confusing.  It'd be worth splitting OptionProcessor in two pieces:
OptionProcessor to exclusively keep the virtual ParseOptions method
and no state, and a new ParsedOptions type to act as the immutable
return value of ParseOptions.  This would decouple all state
mutations.

RELNOTES: None.
PiperOrigin-RevId: 193557347
diff --git a/src/main/cpp/option_processor.cc b/src/main/cpp/option_processor.cc
index fdfd180..864d968 100644
--- a/src/main/cpp/option_processor.cc
+++ b/src/main/cpp/option_processor.cc
@@ -297,25 +297,26 @@
     return blaze_exit_code::BAD_ARGV;
   }
 
-  // Populate rc_files_. This depends on the startup options in argv since these
+  // Read the rc files. This depends on the startup options in argv since these
   // may contain rc-modifying options. For all other options, the precedence of
   // options will be rc first, then command line options, though, despite this
   // exception.
+  std::vector<std::unique_ptr<RcFile>> rc_files;
   const blaze_exit_code::ExitCode rc_parsing_exit_code = GetRcFiles(
-      workspace_layout_, workspace, cwd, cmd_line_.get(), &rc_files_, error);
+      workspace_layout_, workspace, cwd, cmd_line_.get(), &rc_files, error);
   if (rc_parsing_exit_code != blaze_exit_code::SUCCESS) {
     return rc_parsing_exit_code;
   }
 
   // Parse the startup options in the correct priority order.
   const blaze_exit_code::ExitCode parse_startup_options_exit_code =
-      ParseStartupOptions(error);
+      ParseStartupOptions(rc_files, error);
   if (parse_startup_options_exit_code != blaze_exit_code::SUCCESS) {
     return parse_startup_options_exit_code;
   }
 
   blazerc_and_env_command_args_ =
-      GetBlazercAndEnvCommandArgs(cwd, rc_files_, GetProcessedEnv());
+      GetBlazercAndEnvCommandArgs(cwd, rc_files, GetProcessedEnv());
   return blaze_exit_code::SUCCESS;
 }
 
@@ -357,15 +358,15 @@
 }
 
 blaze_exit_code::ExitCode OptionProcessor::ParseStartupOptions(
+    const std::vector<std::unique_ptr<RcFile>> &rc_files,
     std::string *error) {
   // Rc files can import other files at any point, and these imported rcs are
-  // expanded in place. The effective ordering of rc flags is stored in
-  // rcoptions_ and should be processed in that order. Here, we isolate just the
-  // startup options, but keep the file they came from attached for the
-  // option_sources tracking and for sending to the server.
+  // expanded in place. Here, we isolate just the startup options but keep the
+  // file they came from attached for the option_sources tracking and for
+  // sending to the server.
   std::vector<RcStartupFlag> rcstartup_flags;
 
-  for (const auto& blazerc : rc_files_) {
+  for (const auto& blazerc : rc_files) {
     const auto iter = blazerc->options().find("startup");
     if (iter == blazerc->options().end()) continue;
 
diff --git a/src/main/cpp/option_processor.h b/src/main/cpp/option_processor.h
index 736c004..2ae1798 100644
--- a/src/main/cpp/option_processor.h
+++ b/src/main/cpp/option_processor.h
@@ -16,7 +16,6 @@
 #define BAZEL_SRC_MAIN_CPP_OPTION_PROCESSOR_H_
 
 #include <list>
-#include <map>
 #include <memory>
 #include <string>
 #include <vector>
@@ -135,15 +134,9 @@
       std::string* user_blazerc_file, std::string* error) const;
 
  private:
-  blaze_exit_code::ExitCode ParseStartupOptions(std::string* error);
-
-  // The list of parsed rc files, this field is initialized by ParseOptions.
-  std::vector<std::unique_ptr<RcFile>> rc_files_;
-
-  // A map representing the flags parsed from the bazelrc files.
-  // A key is a command (e.g. 'build', 'startup') and its value is an ordered
-  // list of RcOptions.
-  std::map<std::string, std::vector<RcOption>> rcoptions_;
+  blaze_exit_code::ExitCode ParseStartupOptions(
+      const std::vector<std::unique_ptr<RcFile>>& rc_files,
+      std::string* error);
 
   // An ordered list of command args that contain information about the
   // execution environment and the flags passed via the bazelrc files.