File tree 1 file changed +3
-5
lines changed 1 file changed +3
-5
lines changed Original file line number Diff line number Diff line change @@ -102,11 +102,9 @@ llvm::Error CommandObjectMultiword::LoadUserSubcommand(
102
102
103
103
std::string str_name (name);
104
104
105
- auto pos = m_subcommand_dict.find (str_name);
106
- if (pos == m_subcommand_dict.end ()) {
107
- m_subcommand_dict[str_name] = cmd_obj_sp;
105
+ auto [pos, inserted] = m_subcommand_dict.try_emplace (str_name, cmd_obj_sp);
106
+ if (inserted)
108
107
return llvm::Error::success ();
109
- }
110
108
111
109
const char *error_str = nullptr ;
112
110
if (!can_replace)
@@ -117,7 +115,7 @@ llvm::Error CommandObjectMultiword::LoadUserSubcommand(
117
115
if (error_str) {
118
116
return llvm::createStringError (llvm::inconvertibleErrorCode (), error_str);
119
117
}
120
- m_subcommand_dict[str_name] = cmd_obj_sp;
118
+ pos-> second = cmd_obj_sp;
121
119
return llvm::Error::success ();
122
120
}
123
121
You can’t perform that action at this time.
0 commit comments