summaryrefslogtreecommitdiff
path: root/cmdline/cmdline_parser.h
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2022-03-30 14:07:33 +0000
committer Treehugger Robot <treehugger-gerrit@google.com> 2022-04-05 12:49:09 +0000
commit714328e2d2f64a5d3976f19e6ffa781c69e9f6de (patch)
tree97693939392e5fe30398b15c3cb8e1e66fde4d49 /cmdline/cmdline_parser.h
parent47eea60033fc45b762a41dbaeae41b3296182e76 (diff)
ART: Minor cleanup in cmdline/.
Avoid `std::function<>` when dumping help. Avoid `std::optional<>::value()` because it is specified as throwing an exception and we do not use C++ exceptions in ART. Use `std::optional<>::has_value()` instead of implicit conversion to `bool`. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Change-Id: I7addd70b6a69dcaff7a03a829953ed476896bdc0
Diffstat (limited to 'cmdline/cmdline_parser.h')
-rw-r--r--cmdline/cmdline_parser.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/cmdline/cmdline_parser.h b/cmdline/cmdline_parser.h
index 5cdf446474..8685da295d 100644
--- a/cmdline/cmdline_parser.h
+++ b/cmdline/cmdline_parser.h
@@ -739,11 +739,11 @@ void CmdlineParser<TVariantMap, TVariantMapKey>::DumpHelp(VariableIndentationOut
std::unordered_map<std::string, std::vector<detail::CmdlineParseArgumentAny*>> args;
for (const std::unique_ptr<detail::CmdlineParseArgumentAny>& it : completed_arguments_) {
auto cat = it->GetCategory();
- if (cat) {
- if (args.find(cat.value()) == args.end()) {
- args[cat.value()] = {};
+ if (cat.has_value()) {
+ if (args.find(*cat) == args.end()) {
+ args[*cat] = {};
}
- args.at(cat.value()).push_back(it.get());
+ args.at(*cat).push_back(it.get());
} else {
uncat.push_back(it.get());
}