From 28cf2a52413df40263c2a073287debaf8ccadd1a Mon Sep 17 00:00:00 2001 From: Paul Cristian Sarbu Date: Thu, 30 Nov 2023 10:52:58 +0100 Subject: ObjectType: Add noexcept specifier --- src/buildtool/file_system/object_type.hpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src') 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; } -- cgit v1.2.3