summaryrefslogtreecommitdiff
path: root/absl/flags/internal/usage.cc
diff options
context:
space:
mode:
authorGravatar Abseil Team <absl-team@google.com>2021-08-11 11:57:03 -0700
committerGravatar Derek Mauro <dmauro@google.com>2021-08-11 20:41:24 +0000
commitb699707f0bfeae034e36cdfd909b66b0fcab696c (patch)
treec961ce4c7b9a040b47a42abbdabdec10a4d7f043 /absl/flags/internal/usage.cc
parent8e088c5f3c290c5ac53dd5010fd501d80b483115 (diff)
Export of internal Abseil changes
-- 228b5878d7a994656f383666cfaee34e33e0b09b by Abseil Team <absl-team@google.com>: Add element_type typedef to match std::span<T> PiperOrigin-RevId: 390186160 -- c91d96c88c60be793c525158f76dfcaa5e32d161 by Abseil Team <absl-team@google.com>: Rollback change to only hide retired flags if human-readable output is requested PiperOrigin-RevId: 390183146 -- 170192c10ef8d513de80f29298ce93eeccc3712c by Abseil Team <absl-team@google.com>: Move alignas(16) before ABSL_CONST_INIT and ABSL_DLL. PiperOrigin-RevId: 390182845 -- 77a5ee5081c81cef625fac7bbcf993cc028b32ed by Evan Brown <ezb@google.com>: Use simple SlotOffset and AllocSize logic instead of container_internal::Layout in order to save linker input size for non-opt and sanitizer builds. In opt mode, all of this logic is inlined so we don't save linker input size in opt mode. PiperOrigin-RevId: 389914594 GitOrigin-RevId: 228b5878d7a994656f383666cfaee34e33e0b09b Change-Id: I3b904068687574931d8390071b322c0c3c083283
Diffstat (limited to 'absl/flags/internal/usage.cc')
-rw-r--r--absl/flags/internal/usage.cc17
1 files changed, 4 insertions, 13 deletions
diff --git a/absl/flags/internal/usage.cc b/absl/flags/internal/usage.cc
index a883567f..949709e8 100644
--- a/absl/flags/internal/usage.cc
+++ b/absl/flags/internal/usage.cc
@@ -17,7 +17,6 @@
#include <stdint.h>
-#include <algorithm>
#include <functional>
#include <map>
#include <ostream>
@@ -256,6 +255,9 @@ void FlagsHelpImpl(std::ostream& out, PerFlagFilter filter_cb,
matching_flags;
flags_internal::ForEachFlag([&](absl::CommandLineFlag& flag) {
+ // Ignore retired flags.
+ if (flag.IsRetired()) return;
+
// If the flag has been stripped, pretend that it doesn't exist.
if (flag.Help() == flags_internal::kStrippedFlagHelp) return;
@@ -273,14 +275,6 @@ void FlagsHelpImpl(std::ostream& out, PerFlagFilter filter_cb,
absl::string_view file_separator; // controls blank lines between files
for (auto& package : matching_flags) {
if (format == HelpFormat::kHumanReadable) {
- // Hide packages with only retired flags
- bool all_package_flags_are_retired = true;
- for (const auto& flags_in_file : package.second) {
- for (const auto* flag : flags_in_file.second) {
- all_package_flags_are_retired &= flag->IsRetired();
- }
- }
- if (all_package_flags_are_retired) continue;
out << package_separator;
package_separator = "\n\n";
}
@@ -340,11 +334,8 @@ void FlagsHelpImpl(std::ostream& out,
// Produces the help message describing specific flag.
void FlagHelp(std::ostream& out, const CommandLineFlag& flag,
HelpFormat format) {
- if (format == HelpFormat::kHumanReadable) {
- // Ignore retired flags
- if (flag.IsRetired()) return;
+ if (format == HelpFormat::kHumanReadable)
flags_internal::FlagHelpHumanReadable(flag, out);
- }
}
// --------------------------------------------------------------------