File tree Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Expand file tree Collapse file tree 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(
102102
103103 std::string str_name (name);
104104
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)
108107 return llvm::Error::success ();
109- }
110108
111109 const char *error_str = nullptr ;
112110 if (!can_replace)
@@ -117,7 +115,7 @@ llvm::Error CommandObjectMultiword::LoadUserSubcommand(
117115 if (error_str) {
118116 return llvm::createStringError (llvm::inconvertibleErrorCode (), error_str);
119117 }
120- m_subcommand_dict[str_name] = cmd_obj_sp;
118+ pos-> second = cmd_obj_sp;
121119 return llvm::Error::success ();
122120}
123121
You can’t perform that action at this time.
0 commit comments