diff options
author | Maksim Denisov <denisov.maksim@huawei.com> | 2024-10-02 17:39:13 +0200 |
---|---|---|
committer | Maksim Denisov <denisov.maksim@huawei.com> | 2024-10-07 13:37:39 +0200 |
commit | 72fb5958427ef63181023e8fedce5c6ba642b01a (patch) | |
tree | bb32e9d575c76ed35bef94807671e61780416043 /src/buildtool/build_engine/expression/target_node.hpp | |
parent | 6e74b1448bf8d94d73ef3134aa9e8bf36e51a2aa (diff) | |
download | justbuild-72fb5958427ef63181023e8fedce5c6ba642b01a.tar.gz |
Enable bugprone-empty-catch check.
Diffstat (limited to 'src/buildtool/build_engine/expression/target_node.hpp')
-rw-r--r-- | src/buildtool/build_engine/expression/target_node.hpp | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/src/buildtool/build_engine/expression/target_node.hpp b/src/buildtool/build_engine/expression/target_node.hpp index feed94d6..1e7cbd2e 100644 --- a/src/buildtool/build_engine/expression/target_node.hpp +++ b/src/buildtool/build_engine/expression/target_node.hpp @@ -62,21 +62,23 @@ class TargetNode { [[nodiscard]] auto operator==(TargetNode const& other) const noexcept -> bool { - if (data_.index() == other.data_.index()) { - try { - if (IsValue()) { - return GetValue() == other.GetValue(); - } - auto const& abs_l = GetAbstract(); - auto const& abs_r = other.GetAbstract(); - return abs_l.node_type == abs_r.node_type and - abs_l.string_fields == abs_r.string_fields and - abs_l.target_fields == abs_r.string_fields; - } catch (...) { - // should never happen + if (data_.index() != other.data_.index()) { + return false; + } + + try { + if (IsValue()) { + return GetValue() == other.GetValue(); } + auto const& abs_l = GetAbstract(); + auto const& abs_r = other.GetAbstract(); + return abs_l.node_type == abs_r.node_type and + abs_l.string_fields == abs_r.string_fields and + abs_l.target_fields == abs_r.string_fields; + } catch (...) { + // should never happen + return false; } - return false; } [[nodiscard]] auto ToString() const noexcept -> std::string { @@ -84,8 +86,8 @@ class TargetNode { return ToJson().dump(); } catch (...) { // should never happen + return {}; } - return {}; } [[nodiscard]] auto ToJson() const -> nlohmann::json; |