forked from bazelbuild/bazel
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Client, refactor: simplify nullary flag handling
Nullary startup flags (e.g. --[no]master_bazelrc) are registered with StartupOptions::RegisterNullaryStartupOption. Important change: `--host_jvm_debug` now supports the negative flag (`--nohost_jvm_debug`). I suspect the missing support was a bug resulting from the code duplication this PR eliminates. Until now, nullary flags also had their special handling logic, even though the logic was always the same. Now, nullary flags are registered together with their member variable's pointer, and there's only one code path to handle all. Startup flags forbidden in .bazelrc files are handled specially. Until now, we searched the handler code linearly via a long if-elseif-elseif-... chain, so parsing N flags out of M possible flags performed O(N*M) string comparisons. Now, we look up the nullary flag names from a std::unordered_map, which has O(1) lookup complexity, reducing the total complexity to O(M). Also a drive-by improvement in blaze.cc: use std::unique_ptr instead of manual new/delete. Change-Id: Ie3dcba4ae6afa959e84657b7ff9bb8f4c87777fd Closes bazelbuild#9121. Change-Id: I794cdc553ea833620b174375fbfdaa7492113d13 PiperOrigin-RevId: 265010164
- Loading branch information
1 parent
166efd6
commit 5697da9
Showing
6 changed files
with
150 additions
and
198 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.