diff options
author | Maksim Denisov <denisov.maksim@huawei.com> | 2024-12-05 17:02:06 +0100 |
---|---|---|
committer | Maksim Denisov <denisov.maksim@huawei.com> | 2024-12-09 13:01:58 +0100 |
commit | c60468fed42df70e4897d9144a89db55ffbf9af3 (patch) | |
tree | ecdbd60d305c50dea92d838ee3692bcd2bf6c00b /src/buildtool/main | |
parent | 99ada0d961bda4baa717f56c7bb24f08e1c4dfb9 (diff) | |
download | justbuild-c60468fed42df70e4897d9144a89db55ffbf9af3.tar.gz |
Localize error_msg argument of ParseRoot
...and use expected to replace it.
Diffstat (limited to 'src/buildtool/main')
-rw-r--r-- | src/buildtool/main/main.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/buildtool/main/main.cpp b/src/buildtool/main/main.cpp index 34125fcd..6a37feec 100644 --- a/src/buildtool/main/main.cpp +++ b/src/buildtool/main/main.cpp @@ -551,12 +551,12 @@ auto DetermineRoots(gsl::not_null<RepositoryConfig*> const& repository_config, repos[main_repo] = nlohmann::json::object(); } - std::string error_msg; for (auto const& [repo, desc] : repos.items()) { std::optional<FileRoot> ws_root{}; bool const is_main_repo{repo == main_repo}; auto it_ws = desc.find("workspace_root"); if (it_ws != desc.end()) { + std::string error_msg; if (auto parsed_root = FileRoot::ParseRoot( repo, "workspace_root", *it_ws, &error_msg)) { ws_root = std::move(parsed_root->first); @@ -589,14 +589,13 @@ auto DetermineRoots(gsl::not_null<RepositoryConfig*> const& repository_config, std::exit(kExitFailure); } auto info = RepositoryConfig::RepositoryInfo{std::move(*ws_root)}; - auto parse_keyword_root = [&desc = desc, - &repo = repo, - &error_msg = error_msg, - is_main_repo](FileRoot* keyword_root, - std::string const& keyword, - auto const& keyword_carg) { + auto parse_keyword_root = [&desc = desc, &repo = repo, is_main_repo]( + FileRoot* keyword_root, + std::string const& keyword, + auto const& keyword_carg) { auto it = desc.find(keyword); if (it != desc.end()) { + std::string error_msg; if (auto parsed_root = FileRoot::ParseRoot(repo, keyword, *it, &error_msg)) { (*keyword_root) = parsed_root->first; |