Skip to content

Commit 8673d0e

Browse files
[lldb] Avoid repeated map lookups (NFC) (#113073)
1 parent 6ec113d commit 8673d0e

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

lldb/source/Interpreter/Options.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -251,12 +251,9 @@ Option *Options::GetLongOptions() {
251251
m_getopt_table[i].flag = nullptr;
252252
m_getopt_table[i].val = short_opt;
253253

254-
if (option_seen.find(short_opt) == option_seen.end()) {
255-
option_seen[short_opt] = i;
256-
} else if (short_opt) {
254+
auto [pos, inserted] = option_seen.try_emplace(short_opt, i);
255+
if (!inserted && short_opt) {
257256
m_getopt_table[i].val = 0;
258-
std::map<int, uint32_t>::const_iterator pos =
259-
option_seen.find(short_opt);
260257
StreamString strm;
261258
if (defs[i].HasShortOption())
262259
Debugger::ReportError(

0 commit comments

Comments
 (0)