Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci(clang-format): Update to clang-format v19 (and the corresponding yscope-dev-utils) and apply the corresponding formatting changes (fixes #545). #658

Merged
merged 2 commits into from
Jan 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions components/core/src/clp/BoundedReader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ class BoundedReader : public ReaderInterface {
* @return ErrorCode_EndOfFile on EOF or trying to read after hitting checkpoint
* @return ErrorCode_Success on success
*/
[[nodiscard]] auto
try_read(char* buf, size_t num_bytes_to_read, size_t& num_bytes_read) -> ErrorCode override;
[[nodiscard]] auto try_read(char* buf, size_t num_bytes_to_read, size_t& num_bytes_read)
-> ErrorCode override;

/**
* This function is unsupported because BoundedReader can not delegate to a potentially
Expand Down
9 changes: 3 additions & 6 deletions components/core/src/clp/BufferReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,9 @@ auto BufferReader::try_get_pos(size_t& pos) -> ErrorCode {
return ErrorCode_Success;
}

auto BufferReader::try_read_to_delimiter(
char delim,
bool keep_delimiter,
bool append,
std::string& str
) -> ErrorCode {
auto
BufferReader::try_read_to_delimiter(char delim, bool keep_delimiter, bool append, std::string& str)
-> ErrorCode {
if (false == append) {
str.clear();
}
Expand Down
13 changes: 5 additions & 8 deletions components/core/src/clp/BufferReader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ class BufferReader : public ReaderInterface {
* @return ErrorCode_EndOfFile if the buffer doesn't contain any more data
* @return ErrorCode_Success on success
*/
[[nodiscard]] auto
try_read(char* buf, size_t num_bytes_to_read, size_t& num_bytes_read) -> ErrorCode override;
[[nodiscard]] auto try_read(char* buf, size_t num_bytes_to_read, size_t& num_bytes_read)
-> ErrorCode override;

/**
* Tries to seek to the given position, relative to the beginning of the buffer
Expand All @@ -88,12 +88,9 @@ class BufferReader : public ReaderInterface {
* @param str Returns the content read from the buffer
* @return Same as BufferReader::try_read_to_delimiter(char, bool, std::string&, bool&, size_t&)
*/
[[nodiscard]] auto try_read_to_delimiter(
char delim,
bool keep_delimiter,
bool append,
std::string& str
) -> ErrorCode override;
[[nodiscard]] auto
try_read_to_delimiter(char delim, bool keep_delimiter, bool append, std::string& str)
-> ErrorCode override;

private:
// Methods
Expand Down
9 changes: 3 additions & 6 deletions components/core/src/clp/BufferedFileReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,12 +265,9 @@ auto BufferedFileReader::try_read(char* buf, size_t num_bytes_to_read, size_t& n
return ErrorCode_Success;
}

auto BufferedFileReader::try_read_to_delimiter(
char delim,
bool keep_delimiter,
bool append,
string& str
) -> ErrorCode {
auto
BufferedFileReader::try_read_to_delimiter(char delim, bool keep_delimiter, bool append, string& str)
-> ErrorCode {
if (-1 == m_fd) {
return ErrorCode_NotInit;
}
Expand Down
17 changes: 7 additions & 10 deletions components/core/src/clp/BufferedFileReader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ class BufferedFileReader : public ReaderInterface {
* @return ErrorCode_NotInit if the file is not opened
* @return ErrorCode_Success on success
*/
[[nodiscard]] auto
try_peek_buffered_data(char const*& buf, size_t& peek_size) const -> ErrorCode;
[[nodiscard]] auto try_peek_buffered_data(char const*& buf, size_t& peek_size) const
-> ErrorCode;

/**
* Peeks the remaining buffered content without advancing the read head.
Expand Down Expand Up @@ -191,8 +191,8 @@ class BufferedFileReader : public ReaderInterface {
* @return ErrorCode_EndOfFile on EOF
* @return ErrorCode_Success on success
*/
[[nodiscard]] auto
try_read(char* buf, size_t num_bytes_to_read, size_t& num_bytes_read) -> ErrorCode override;
[[nodiscard]] auto try_read(char* buf, size_t num_bytes_to_read, size_t& num_bytes_read)
-> ErrorCode override;

/**
* Tries to read up to an occurrence of the given delimiter
Expand All @@ -206,12 +206,9 @@ class BufferedFileReader : public ReaderInterface {
* @return Same as BufferReader::try_read_to_delimiter if it fails
* @return ErrorCode_Success on success
*/
[[nodiscard]] auto try_read_to_delimiter(
char delim,
bool keep_delimiter,
bool append,
std::string& str
) -> ErrorCode override;
[[nodiscard]] auto
try_read_to_delimiter(char delim, bool keep_delimiter, bool append, std::string& str)
-> ErrorCode override;

private:
// Methods
Expand Down
2 changes: 1 addition & 1 deletion components/core/src/clp/FileDescriptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ FileDescriptor::~FileDescriptor() {
}

auto FileDescriptor::get_size() const -> size_t {
struct stat stat_result {};
struct stat stat_result{};

if (ErrorCode_Success != stat(stat_result)) {
throw OperationFailed(
Expand Down
4 changes: 2 additions & 2 deletions components/core/src/clp/FileDescriptorReader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ class FileDescriptorReader : public ReaderInterface {
* @return ErrorCode_EndOfFile on EOF
* @return ErrorCode_Success on success
*/
[[nodiscard]] auto
try_read(char* buf, size_t num_bytes_to_read, size_t& num_bytes_read) -> ErrorCode override;
[[nodiscard]] auto try_read(char* buf, size_t num_bytes_to_read, size_t& num_bytes_read)
-> ErrorCode override;

/**
* Tries to seek to the given position, relative to the beginning of the file.
Expand Down
6 changes: 2 additions & 4 deletions components/core/src/clp/Grep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -890,10 +890,8 @@ bool Grep::get_bounds_of_next_potential_var(
return (value_length != begin_pos);
}

void Grep::calculate_sub_queries_relevant_to_file(
File const& compressed_file,
vector<Query>& queries
) {
void
Grep::calculate_sub_queries_relevant_to_file(File const& compressed_file, vector<Query>& queries) {
for (auto& query : queries) {
query.make_sub_queries_relevant_to_segment(compressed_file.get_segment_id());
}
Expand Down
12 changes: 5 additions & 7 deletions components/core/src/clp/NetworkReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ extern "C" auto curl_progress_callback(
* @return On success, the number of bytes processed. If this is less than `nmemb`, the download
* will be aborted.
*/
extern "C" auto
curl_write_callback(char* ptr, size_t size, size_t nmemb, void* reader_ptr) -> size_t {
extern "C" auto curl_write_callback(char* ptr, size_t size, size_t nmemb, void* reader_ptr)
-> size_t {
return static_cast<NetworkReader*>(reader_ptr)->buffer_downloaded_data({ptr, size * nmemb});
}
} // namespace
Expand Down Expand Up @@ -304,11 +304,9 @@ auto NetworkReader::get_filled_buffer() -> void {
m_curr_reader_buf.emplace(next_reader_buffer);
}

auto NetworkReader::read_from_filled_buffers(
size_t num_bytes_to_read,
size_t& num_bytes_read,
char* dst
) -> ErrorCode {
auto
NetworkReader::read_from_filled_buffers(size_t num_bytes_to_read, size_t& num_bytes_read, char* dst)
-> ErrorCode {
num_bytes_read = 0;
std::optional<BufferView> dst_view;
if (nullptr != dst) {
Expand Down
12 changes: 5 additions & 7 deletions components/core/src/clp/NetworkReader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ class NetworkReader : public ReaderInterface {
* @return ErrorCode_EndOfFile if there is no more buffered data.
* @return ErrorCode_Success on success.
*/
[[nodiscard]] auto
try_read(char* buf, size_t num_bytes_to_read, size_t& num_bytes_read) -> ErrorCode override {
[[nodiscard]] auto try_read(char* buf, size_t num_bytes_to_read, size_t& num_bytes_read)
-> ErrorCode override {
return read_from_filled_buffers(num_bytes_to_read, num_bytes_read, buf);
}

Expand Down Expand Up @@ -306,11 +306,9 @@ class NetworkReader : public ReaderInterface {
* @return ErrorCode_EndOfFile if the buffer doesn't contain any more data.
* @return ErrorCode_Success on success.
*/
[[nodiscard]] auto read_from_filled_buffers(
size_t num_bytes_to_read,
size_t& num_bytes_read,
char* dst
) -> ErrorCode;
[[nodiscard]] auto
read_from_filled_buffers(size_t num_bytes_to_read, size_t& num_bytes_read, char* dst)
-> ErrorCode;

/**
* Sets the download completion status with the return code from curl.
Expand Down
2 changes: 1 addition & 1 deletion components/core/src/clp/Thread.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class Thread {
};

// Constructors
Thread() : m_thread_running(false) {};
Thread() : m_thread_running(false) {}

// Destructor
virtual ~Thread();
Expand Down
22 changes: 10 additions & 12 deletions components/core/src/clp/aws/AwsAuthenticationSigner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ namespace {
* @param timestamp
* @return The formatted date string.
*/
[[nodiscard]] auto get_formatted_date_string(std::chrono::system_clock::time_point const& timestamp
) -> string;
[[nodiscard]] auto get_formatted_date_string(std::chrono::system_clock::time_point const& timestamp)
-> string;

/**
* Gets the string to sign required by AWS Signature Version 4 protocol.
Expand Down Expand Up @@ -89,8 +89,8 @@ auto is_unreserved_characters(char c) -> bool {
return is_alphabet(c) || is_decimal_digit(c) || c == '-' || c == '_' || c == '.' || c == '~';
}

auto get_formatted_timestamp_string(std::chrono::system_clock::time_point const& timestamp
) -> string {
auto get_formatted_timestamp_string(std::chrono::system_clock::time_point const& timestamp)
-> string {
return fmt::format("{:%Y%m%dT%H%M%SZ}", timestamp);
}

Expand Down Expand Up @@ -203,10 +203,9 @@ S3Url::S3Url(string const& url) {
m_host = fmt::format("{}.s3.{}.{}", m_bucket, m_region, m_end_point);
}

auto AwsAuthenticationSigner::generate_presigned_url(
S3Url const& s3_url,
string& presigned_url
) const -> ErrorCode {
auto
AwsAuthenticationSigner::generate_presigned_url(S3Url const& s3_url, string& presigned_url) const
-> ErrorCode {
auto const s3_region = s3_url.get_region();

auto const now = std::chrono::system_clock::now();
Expand Down Expand Up @@ -245,10 +244,9 @@ auto AwsAuthenticationSigner::generate_presigned_url(
return ErrorCode_Success;
}

auto AwsAuthenticationSigner::get_canonical_query_string(
string_view scope,
string_view timestamp
) const -> string {
auto
AwsAuthenticationSigner::get_canonical_query_string(string_view scope, string_view timestamp) const
-> string {
auto const uri = fmt::format("{}/{}", m_access_key_id, scope);
return fmt::format(
"{}={}&{}={}&{}={}&{}={}&{}={}",
Expand Down
11 changes: 5 additions & 6 deletions components/core/src/clp/aws/AwsAuthenticationSigner.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ class AwsAuthenticationSigner {
* @return ErrorCode_Success on success.
* @return Same as `get_sha256_hash` and `AwsAuthenticationSigner::get_signature` on failure.
*/
[[nodiscard]] auto
generate_presigned_url(S3Url const& s3_url, std::string& presigned_url) const -> ErrorCode;
[[nodiscard]] auto generate_presigned_url(S3Url const& s3_url, std::string& presigned_url) const
-> ErrorCode;

private:
/**
Expand All @@ -92,10 +92,9 @@ class AwsAuthenticationSigner {
* @param timestamp
* @return The canonical query string.
*/
[[nodiscard]] auto get_canonical_query_string(
std::string_view scope,
std::string_view timestamp
) const -> std::string;
[[nodiscard]] auto
get_canonical_query_string(std::string_view scope, std::string_view timestamp) const
-> std::string;

/**
* Gets the signature signing key for the request.
Expand Down
14 changes: 6 additions & 8 deletions components/core/src/clp/error_handling/ErrorCode.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,9 @@ class ErrorCategory : public std::error_category {
* @param condition
* @return Whether the error condition of the given error matches the given condition.
*/
[[nodiscard]] auto equivalent(
int error_num,
std::error_condition const& condition
) const noexcept -> bool override {
[[nodiscard]] auto
equivalent(int error_num, std::error_condition const& condition) const noexcept
-> bool override {
return equivalent(static_cast<ErrorCodeEnum>(error_num), condition);
}

Expand All @@ -69,10 +68,9 @@ class ErrorCategory : public std::error_category {
* @param condition
* @return Whether the error condition of the given error matches the given condition.
*/
[[nodiscard]] auto equivalent(
ErrorCodeEnum error_enum,
std::error_condition const& condition
) const noexcept -> bool;
[[nodiscard]] auto
equivalent(ErrorCodeEnum error_enum, std::error_condition const& condition) const noexcept
-> bool;
};

/**
Expand Down
16 changes: 8 additions & 8 deletions components/core/src/clp/ffi/KeyValuePairLogEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ class JsonSerializationIterator {
* @param value
* @return Whether the given schema tree node type matches the given value's type.
*/
[[nodiscard]] auto
node_type_matches_value_type(SchemaTree::Node::Type type, Value const& value) -> bool;
[[nodiscard]] auto node_type_matches_value_type(SchemaTree::Node::Type type, Value const& value)
-> bool;

/**
* Validates whether the given node-ID value pairs are leaf nodes in the `SchemaTree` forming a
Expand Down Expand Up @@ -560,18 +560,18 @@ auto KeyValuePairLogEvent::create(
};
}

auto KeyValuePairLogEvent::get_auto_gen_keys_schema_subtree_bitmap(
) const -> OUTCOME_V2_NAMESPACE::std_result<std::vector<bool>> {
auto KeyValuePairLogEvent::get_auto_gen_keys_schema_subtree_bitmap() const
-> OUTCOME_V2_NAMESPACE::std_result<std::vector<bool>> {
return get_schema_subtree_bitmap(m_auto_gen_node_id_value_pairs, *m_auto_gen_keys_schema_tree);
}

auto KeyValuePairLogEvent::get_user_gen_keys_schema_subtree_bitmap(
) const -> outcome_v2::std_result<std::vector<bool>> {
auto KeyValuePairLogEvent::get_user_gen_keys_schema_subtree_bitmap() const
-> outcome_v2::std_result<std::vector<bool>> {
return get_schema_subtree_bitmap(m_user_gen_node_id_value_pairs, *m_user_gen_keys_schema_tree);
}

auto KeyValuePairLogEvent::serialize_to_json(
) const -> OUTCOME_V2_NAMESPACE::std_result<std::pair<nlohmann::json, nlohmann::json>> {
auto KeyValuePairLogEvent::serialize_to_json() const
-> OUTCOME_V2_NAMESPACE::std_result<std::pair<nlohmann::json, nlohmann::json>> {
auto const auto_gen_keys_schema_subtree_bitmap_result{get_auto_gen_keys_schema_subtree_bitmap()
};
if (auto_gen_keys_schema_subtree_bitmap_result.has_error()) {
Expand Down
12 changes: 6 additions & 6 deletions components/core/src/clp/ffi/KeyValuePairLogEvent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ class KeyValuePairLogEvent {
* an error code indicating a failure:
* - Forwards `get_schema_subtree_bitmap`'s return values.
*/
[[nodiscard]] auto get_auto_gen_keys_schema_subtree_bitmap(
) const -> OUTCOME_V2_NAMESPACE::std_result<std::vector<bool>>;
[[nodiscard]] auto get_auto_gen_keys_schema_subtree_bitmap() const
-> OUTCOME_V2_NAMESPACE::std_result<std::vector<bool>>;

/**
* @return A result containing a bitmap where every bit corresponds to the ID of a node in the
Expand All @@ -95,8 +95,8 @@ class KeyValuePairLogEvent {
* an error code indicating a failure:
* - Forwards `get_schema_subtree_bitmap`'s return values.
*/
[[nodiscard]] auto get_user_gen_keys_schema_subtree_bitmap(
) const -> OUTCOME_V2_NAMESPACE::std_result<std::vector<bool>>;
[[nodiscard]] auto get_user_gen_keys_schema_subtree_bitmap() const
-> OUTCOME_V2_NAMESPACE::std_result<std::vector<bool>>;

[[nodiscard]] auto get_utc_offset() const -> UtcOffset { return m_utc_offset; }

Expand All @@ -110,8 +110,8 @@ class KeyValuePairLogEvent {
* - Forwards `get_auto_gen_keys_schema_subtree_bitmap`'s return values on failure.
* - Forwards `serialize_node_id_value_pairs_to_json`'s return values on failure.
*/
[[nodiscard]] auto serialize_to_json(
) const -> OUTCOME_V2_NAMESPACE::std_result<std::pair<nlohmann::json, nlohmann::json>>;
[[nodiscard]] auto serialize_to_json() const
-> OUTCOME_V2_NAMESPACE::std_result<std::pair<nlohmann::json, nlohmann::json>>;

private:
// Constructor
Expand Down
4 changes: 2 additions & 2 deletions components/core/src/clp/ffi/SchemaTree.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,8 @@ class SchemaTree {
* @return The node's ID if it exists.
* @return std::nullopt otherwise.
*/
[[nodiscard]] auto try_get_node_id(NodeLocator const& locator
) const -> std::optional<Node::id_t>;
[[nodiscard]] auto try_get_node_id(NodeLocator const& locator) const
-> std::optional<Node::id_t>;

/**
* @param locator
Expand Down
Loading
Loading