[Lldb-commits] [lldb] [lldb] Avoid repeated map lookups (NFC) (PR #113073)
Kazu Hirata via lldb-commits
lldb-commits at lists.llvm.org
Sat Oct 19 21:00:53 PDT 2024
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/113073
None
>From dbf7499daa94da6c395e3de56d8b69be48a3f08b Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sat, 19 Oct 2024 18:08:57 -0700
Subject: [PATCH] [lldb] Avoid repeated map lookups (NFC)
---
lldb/source/Interpreter/Options.cpp | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/lldb/source/Interpreter/Options.cpp b/lldb/source/Interpreter/Options.cpp
index 6a90b2cc9b9896..893a3b71604ba8 100644
--- a/lldb/source/Interpreter/Options.cpp
+++ b/lldb/source/Interpreter/Options.cpp
@@ -251,12 +251,9 @@ Option *Options::GetLongOptions() {
m_getopt_table[i].flag = nullptr;
m_getopt_table[i].val = short_opt;
- if (option_seen.find(short_opt) == option_seen.end()) {
- option_seen[short_opt] = i;
- } else if (short_opt) {
+ auto [pos, inserted] = option_seen.try_emplace(short_opt, i);
+ if (!inserted && short_opt) {
m_getopt_table[i].val = 0;
- std::map<int, uint32_t>::const_iterator pos =
- option_seen.find(short_opt);
StreamString strm;
if (defs[i].HasShortOption())
Debugger::ReportError(
More information about the lldb-commits
mailing list