Skip to content
Open
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
3 changes: 2 additions & 1 deletion docs/dev/clang-tidy-fixes-2026-04.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
- [x] [bugprone-throwing-static-initialization](https://clang.llvm.org/extra/clang-tidy/checks/bugprone/throwing-static-initialization.html) (7)
- [PR #472](https://github.com/Framework-R-D/phlex/pull/472)
- [ ] [bugprone-branch-clone](https://clang.llvm.org/extra/clang-tidy/checks/bugprone/branch-clone.html) (12)
- [ ] [bugprone-throw-keyword-missing](https://clang.llvm.org/extra/clang-tidy/checks/bugprone/throw-keyword-missing.html) (6)
- [x] [bugprone-throw-keyword-missing](https://clang.llvm.org/extra/clang-tidy/checks/bugprone/throw-keyword-missing.html) (6)
- [PR #836](https://github.com/Framework-R-D/phlex/pull/836)
- [x] [bugprone-unchecked-optional-access](https://clang.llvm.org/extra/clang-tidy/checks/bugprone/unchecked-optional-access.html) (15)
- [PR #495](https://github.com/Framework-R-D/phlex/pull/495)
- [x] [cert-dcl50-cpp](https://clang.llvm.org/extra/clang-tidy/checks/cert/dcl50-cpp.html) (2)
Expand Down
15 changes: 7 additions & 8 deletions form/root_storage/root_rfield_read_container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

#include <exception>
#include <mutex>
#include <utility>

namespace {
std::mutex& root_rfield_read_mutex()
Expand All @@ -26,13 +27,13 @@ namespace form::detail::experimental {
{
}

ROOT_RField_Read_ContainerImp::~ROOT_RField_Read_ContainerImp() {}
ROOT_RField_Read_ContainerImp::~ROOT_RField_Read_ContainerImp() = default;

void ROOT_RField_Read_ContainerImp::setFile(std::shared_ptr<IStorage_File> file)
{
Storage_Read_Container::setFile(file);

auto form_root_file = dynamic_cast<ROOT_TFileImp*>(file.get());
auto* form_root_file = dynamic_cast<ROOT_TFileImp*>(file.get());
if (form_root_file) {
m_tfile = form_root_file->getTFile();
} else {
Expand All @@ -45,13 +46,11 @@ namespace form::detail::experimental {
throw std::runtime_error(
"ROOT_RField_Read_ContainerImp::setFile failed to get a TFile from a ROOT_TFileImp");
}

return;
}

void ROOT_RField_Read_ContainerImp::prime(std::type_info const& type)
{
std::lock_guard<std::mutex> guard(root_rfield_read_mutex());
std::scoped_lock guard(root_rfield_read_mutex());

if (!m_tfile) {
throw std::runtime_error("ROOT_RField_Read_ContainerImp::prime No file loaded");
Expand All @@ -72,14 +71,14 @@ namespace form::detail::experimental {

bool ROOT_RField_Read_ContainerImp::read(int id, void const** data, std::type_info const& type)
{
std::lock_guard<std::mutex> guard(root_rfield_read_mutex());
std::scoped_lock guard(root_rfield_read_mutex());

//Connect to file at the last possible moment at the cost of a little run-time branching
if (!m_view) {
createView(type);
}

if (id >= static_cast<int>(m_reader->GetNEntries())) {
if (std::cmp_greater_equal(id, m_reader->GetNEntries())) {
return false;
}

Expand All @@ -103,7 +102,7 @@ namespace form::detail::experimental {

int ROOT_RField_Read_ContainerImp::entries()
{
std::lock_guard<std::mutex> guard(root_rfield_read_mutex());
std::scoped_lock guard(root_rfield_read_mutex());

if (!m_reader) {
if (!m_tfile) {
Expand Down
4 changes: 1 addition & 3 deletions form/root_storage/root_rfield_write_container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ namespace form::detail::experimental {
throw std::runtime_error(
"ROOT_RField_Write_ContainerImp::setFile failed to get a TFile from a ROOT_TFileImp");
}

return;
}

void ROOT_RField_Write_ContainerImp::setParent(std::shared_ptr<IStorage_Write_Container> parent)
Expand Down Expand Up @@ -127,7 +125,7 @@ namespace form::detail::experimental {
<< type_name
<< ". This class is probably using something obsolete like TLorentzVector. Storing it "
"in streamer mode to keep the application going."
<< std::endl;
<< '\n';
field = std::make_unique<ROOT::RStreamerField>(col_name(), type_name);
}
}
Expand Down
2 changes: 1 addition & 1 deletion form/root_storage/root_rfield_write_container.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace form::detail::experimental {

void setFile(std::shared_ptr<IStorage_File> file) override;
void setupWrite(std::type_info const& type) override;
void setParent(std::shared_ptr<IStorage_Write_Container> const parent) override;
void setParent(std::shared_ptr<IStorage_Write_Container> parent) override;
std::uint64_t fill(void const* data) override;
void commit() override;

Expand Down
3 changes: 1 addition & 2 deletions form/root_storage/root_rntuple_write_container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ namespace form::detail::experimental {
void ROOT_RNTuple_Write_ContainerImp::setFile(std::shared_ptr<IStorage_File> file)
{
Storage_Write_Container::setFile(file);
return;
}

std::uint64_t ROOT_RNTuple_Write_ContainerImp::fill(void const* /*data*/)
Expand All @@ -39,5 +38,5 @@ namespace form::detail::experimental {
throw std::runtime_error("ROOT_RNTuple_Write_ContainerImp::commit not implemented");
}

void ROOT_RNTuple_Write_ContainerImp::setupWrite(std::type_info const& /*type*/) { return; }
void ROOT_RNTuple_Write_ContainerImp::setupWrite(std::type_info const& /*type*/) {}
}
6 changes: 2 additions & 4 deletions form/root_storage/root_rntuple_write_container.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@ namespace ROOT {
class RRawPtrWriteEntry;
}
#else
namespace Experimental {
namespace Detail {
class RRawPtrWriteEntry;
}
namespace Experimental::Detail {
class RRawPtrWriteEntry;
}
#endif
}
Expand Down
9 changes: 3 additions & 6 deletions phlex/core/index_router.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "oneapi/tbb/flow_graph.h"
#include "spdlog/spdlog.h"

#include <algorithm>
#include <cassert>
#include <iterator>
#include <ranges>
Expand Down Expand Up @@ -132,9 +133,7 @@ namespace phlex::detail {
sorted_layer_paths_ = std::move(layer_paths_from_driver);
std::size_t initial_deepest_path_depth = 0;
for (auto const& path : sorted_layer_paths_) {
if (path.depth() > initial_deepest_path_depth) {
initial_deepest_path_depth = path.depth();
}
initial_deepest_path_depth = std::max(path.depth(), initial_deepest_path_depth);
}
std::size_t const max_allowed_depth = initial_deepest_path_depth + layer_pairs.size();

Expand Down Expand Up @@ -466,9 +465,7 @@ namespace phlex::detail {
for (auto const& path : sorted_layer_paths_) {
if (path.ends_with(name)) {
std::size_t const depth = path.depth();
if (depth > best) {
best = depth;
}
best = std::max(depth, best);
}
}
return best;
Expand Down
5 changes: 4 additions & 1 deletion plugins/layer_generator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,10 @@ namespace phlex::experimental {
};
}

index_generator layer_generator::execute(data_cell_index_ptr const cell)
// Passing the pointer by value is required because this coroutine may outlive its caller;
// prioritize preserving ownership in the coroutine frame over the extra shared_ptr copy.
// NOLINTNEXTLINE(performance-unnecessary-value-param)
index_generator layer_generator::execute(data_cell_index_ptr cell)
{
// Used in drivers which are close to public API --> easier to stick to strings
auto cell_lp = cell->layer_path().to_string();
Expand Down
2 changes: 0 additions & 2 deletions test/demo-giantdata/waveform_generator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

demo::WaveformGenerator::WaveformGenerator(WGI const& wgi) : maxsize_{wgi.size} {}

demo::WaveformGenerator::~WaveformGenerator() = default;

std::size_t demo::WaveformGenerator::initial_value() const { return 0; }

bool demo::WaveformGenerator::predicate(std::size_t made_so_far) const
Expand Down
2 changes: 1 addition & 1 deletion test/demo-giantdata/waveform_generator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace demo {
WaveformGenerator(WaveformGenerator&&) = delete;
WaveformGenerator& operator=(WaveformGenerator const&) = delete;
WaveformGenerator& operator=(WaveformGenerator&&) = delete;
~WaveformGenerator();
~WaveformGenerator() = default;

std::size_t initial_value() const;

Expand Down
4 changes: 2 additions & 2 deletions test/flush_gate_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ TEST_CASE("flush_gate: two-layer hierarchy (job -> runs -> spills)", "[flush_gat
for (auto const& ft : flushed) {
if (ft->index()->layer_name() == "run"_id) {
CHECK(ft->expected_total_count() == n_spills);
CHECK(ft->committed_count_for_layer(spill_layer_hash) == n_spills);
CHECK(std::cmp_equal(ft->committed_count_for_layer(spill_layer_hash), n_spills));
} else {
REQUIRE(ft->index() == job);
job_flushed = ft;
Expand All @@ -202,7 +202,7 @@ TEST_CASE("flush_gate: two-layer hierarchy (job -> runs -> spills)", "[flush_gat
REQUIRE(job_flushed);
CHECK(job_flushed->expected_total_count() == n_runs);
// Immediate children (runs) counted directly.
CHECK(job_flushed->committed_count_for_layer(run_layer_hash) == n_runs);
CHECK(std::cmp_equal(job_flushed->committed_count_for_layer(run_layer_hash), n_runs));
// Grandchildren (spills) propagated up from the run gates.
CHECK(job_flushed->committed_count_for_layer(spill_layer_hash) == n_runs * n_spills);

Expand Down
Loading