diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2023-11-30 10:52:58 +0100 |
---|---|---|
committer | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2023-11-30 11:26:22 +0100 |
commit | 28cf2a52413df40263c2a073287debaf8ccadd1a (patch) | |
tree | 6da20d2d66b38491ef1a1c20cee73df3c0d5c914 | |
parent | 03a47642ab3e32b561d36fb192bca76ccc677b59 (diff) | |
download | justbuild-28cf2a52413df40263c2a073287debaf8ccadd1a.tar.gz |
ObjectType: Add noexcept specifier
-rw-r--r-- | src/buildtool/file_system/object_type.hpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/buildtool/file_system/object_type.hpp b/src/buildtool/file_system/object_type.hpp index 04457582..ae307513 100644 --- a/src/buildtool/file_system/object_type.hpp +++ b/src/buildtool/file_system/object_type.hpp @@ -25,7 +25,7 @@ enum class ObjectType : std::int8_t { Symlink // non-upwards symbolic link }; -[[nodiscard]] constexpr auto FromChar(char c) -> ObjectType { +[[nodiscard]] constexpr auto FromChar(char c) noexcept -> ObjectType { switch (c) { case 'x': return ObjectType::Executable; @@ -39,7 +39,7 @@ enum class ObjectType : std::int8_t { Ensures(false); // unreachable } -[[nodiscard]] constexpr auto ToChar(ObjectType type) -> char { +[[nodiscard]] constexpr auto ToChar(ObjectType type) noexcept -> char { switch (type) { case ObjectType::File: return 'f'; @@ -53,31 +53,33 @@ enum class ObjectType : std::int8_t { Ensures(false); // unreachable } -[[nodiscard]] constexpr auto IsFileObject(ObjectType type) -> bool { +[[nodiscard]] constexpr auto IsFileObject(ObjectType type) noexcept -> bool { return type == ObjectType::Executable or type == ObjectType::File; } -[[nodiscard]] constexpr auto IsExecutableObject(ObjectType type) -> bool { +[[nodiscard]] constexpr auto IsExecutableObject(ObjectType type) noexcept + -> bool { return type == ObjectType::Executable; } -[[nodiscard]] constexpr auto IsTreeObject(ObjectType type) -> bool { +[[nodiscard]] constexpr auto IsTreeObject(ObjectType type) noexcept -> bool { return type == ObjectType::Tree; } /// \brief Non-upwards symlinks are designated as first-class citizens. -[[nodiscard]] constexpr auto IsSymlinkObject(ObjectType type) -> bool { +[[nodiscard]] constexpr auto IsSymlinkObject(ObjectType type) noexcept -> bool { return type == ObjectType::Symlink; } /// \brief Valid blob sources can be files, executables, or symlinks. -[[nodiscard]] constexpr auto IsBlobObject(ObjectType type) -> bool { +[[nodiscard]] constexpr auto IsBlobObject(ObjectType type) noexcept -> bool { return type == ObjectType::Executable or type == ObjectType::File or type == ObjectType::Symlink; } /// \brief Only regular files, executables, and trees are non-special entries. -[[nodiscard]] constexpr auto IsNonSpecialObject(ObjectType type) -> bool { +[[nodiscard]] constexpr auto IsNonSpecialObject(ObjectType type) noexcept + -> bool { return type == ObjectType::File or type == ObjectType::Executable or type == ObjectType::Tree; } |