Skip to content
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
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 @@ -118,7 +118,8 @@
- [PR #733](https://github.com/Framework-R-D/phlex/pull/733)
- [x] [modernize-use-emplace](https://clang.llvm.org/extra/clang-tidy/checks/modernize/use-emplace.html) (1)
- [PR #793](https://github.com/Framework-R-D/phlex/pull/793)
- [ ] [modernize-use-designated-initializers](https://clang.llvm.org/extra/clang-tidy/checks/modernize/use-designated-initializers.html) (69)
- [x] [modernize-use-designated-initializers](https://clang.llvm.org/extra/clang-tidy/checks/modernize/use-designated-initializers.html) (69)
- [PR #835](https://github.com/Framework-R-D/phlex/pull/835)
- [x] [modernize-use-equals-default](https://clang.llvm.org/extra/clang-tidy/checks/modernize/use-equals-default.html) (7)
- [PR #784](https://github.com/Framework-R-D/phlex/pull/784)
- [x] [modernize-use-integer-sign-comparison](https://clang.llvm.org/extra/clang-tidy/checks/modernize/use-integer-sign-comparison.html) (7)
Expand Down
6 changes: 3 additions & 3 deletions form/core/technology.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ namespace form::technology {
};

// Backends: valid (major, minor) pairs, stable numeric values as a future Token may persist them
inline constexpr Id ROOT_TTREE{Major::root, 1};
inline constexpr Id ROOT_RNTUPLE{Major::root, 2};
inline constexpr Id HDF5{Major::hdf5, 1};
inline constexpr Id ROOT_TTREE{.major = Major::root, .minor = 1};
inline constexpr Id ROOT_RNTUPLE{.major = Major::root, .minor = 2};
inline constexpr Id HDF5{.major = Major::hdf5, .minor = 1};
Comment thread
knoepfel marked this conversation as resolved.

// Canonical string -> technology mapping: the single place a technology string is parsed, replacing the copies that used to live in each module/source/test
inline Id from_string(std::string_view name)
Expand Down
4 changes: 3 additions & 1 deletion form/form/form_source_type_registry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ namespace form::experimental {

std::scoped_lock lock(form_type_registry_mutex());
mutable_form_type_registry()[std::move(product_type)] =
form_source_type_entry{std::move(type), &cpp_type, std::move(product_from_data_fn)};
form_source_type_entry{.type_id = std::move(type),
.cpp_type = &cpp_type,
.product_from_data_fn = std::move(product_from_data_fn)};
}

// Returns a pointer to the registry entry. The registry is is immutable after the first call to this function.
Expand Down
3 changes: 2 additions & 1 deletion form/form_source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ namespace {
form::experimental::form_source_type_entry const* entry =
form::experimental::find_form_product_type(product_type);
if (entry && entry->cpp_type && entry->product_from_data_fn) {
form::experimental::product_with_name pb{product_name, nullptr, entry->cpp_type};
form::experimental::product_with_name pb{
.label = product_name, .data = nullptr, .type = entry->cpp_type};
reader_->read(creator, index_str, pb);
return entry->product_from_data_fn(pb.data, product_name, index_str);
}
Expand Down
6 changes: 3 additions & 3 deletions phlex/app/load_module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ namespace phlex::detail {

auto const& spec = value_to<std::string>(adjusted_config.at("cpp"));
auto [lib, fn] = plugin_loader<internal::module_creator_t>(spec, "create_module");
auto& creator = create_module.emplace_back(module_plugin{std::move(lib), fn});
auto& creator = create_module.emplace_back(module_plugin{.lib = std::move(lib), .fn = fn});

configuration const config{adjusted_config};
creator(g.module_proxy(config), config);
Expand All @@ -138,7 +138,7 @@ namespace phlex::detail {

auto const& spec = value_to<std::string>(adjusted_config.at("cpp"));
auto [lib, fn] = plugin_loader<internal::source_creator_t>(spec, "create_source");
auto& creator = create_source.emplace_back(source_plugin{std::move(lib), fn});
auto& creator = create_source.emplace_back(source_plugin{.lib = std::move(lib), .fn = fn});

// FIXME: Should probably use the parameter name (e.g.) 'plugin_label' instead of
// 'module_label', but that requires adjusting other parts of the system
Expand All @@ -158,7 +158,7 @@ namespace phlex::detail {
// internal reference counting in classification.hpp.
// NOLINTNEXTLINE(clang-analyzer-cplusplus.NewDeleteLeaks,clang-analyzer-cplusplus.NewDelete)
auto [lib, fn] = plugin_loader<internal::driver_shim_t>(spec, "create_driver");
create_driver.emplace(driver_plugin{std::move(lib), fn});
create_driver.emplace(driver_plugin{.lib = std::move(lib), .fn = fn});
driver_bundle result;
(*create_driver)(g.driver_proxy(required_sources), config, &result);
g.add_driver(result);
Expand Down
2 changes: 1 addition & 1 deletion phlex/core/filter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ namespace phlex::detail {
return {};
}
for (auto const& [port, store] : std::views::zip(downstream_ports_, stores)) {
port->try_put({store, msg_id});
port->try_put({.store = store, .id = msg_id});
}
// Decision must be erased while access is claimed
decisions_.erase(a);
Expand Down
5 changes: 4 additions & 1 deletion phlex/core/framework_graph.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,10 @@ namespace phlex::detail {

source_bundle source_proxy(configuration const& config)
{
return {config, graph_, nodes_, registration_errors_};
return {.config = config,
.graph = graph_,
.nodes = nodes_,
.registration_errors = registration_errors_};
}

phlex::detail::driver_proxy driver_proxy(std::vector<std::string> const& strings = {})
Expand Down
8 changes: 5 additions & 3 deletions phlex/core/make_computational_edges.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ namespace phlex::detail {
input_product.to_string());
make_edge(matched_provider->output_port(), *port);
} else {
unconsumed_head_ports[node_name].push_back({input_product, port});
unconsumed_head_ports[node_name].push_back(
{.input_product = input_product, .port = port});
}
}
}
Expand Down Expand Up @@ -92,7 +93,8 @@ namespace phlex::detail {
// If we have a source node that can produce this product, use it.
auto bundles = find_matching_implicit_providers(sources, input_product);
if (bundles.empty()) {
unconsumed_head_ports[node_name].push_back({input_product, port});
unconsumed_head_ports[node_name].push_back(
{.input_product = input_product, .port = port});
continue;
}

Expand Down Expand Up @@ -142,7 +144,7 @@ namespace phlex::detail {
auto const* producer = producers.find_producer(query, node->name());
if (not producer) {
// Is there a way to detect mis-specified product dependencies?
result[node_name].push_back({query, receiver_port});
result[node_name].push_back({.input_product = query, .port = receiver_port});
continue;
}

Expand Down
6 changes: 3 additions & 3 deletions plugins/generate_layers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ PHLEX_REGISTER_DRIVER(d, config)
for (auto const& key : layers.keys()) {
auto const layer_config = layers.get<configuration>(key);
gen->add_layer(key,
{.parent_layer_name = layer_config.get<std::string>("parent", "job"),
.total_per_parent_data_cell = layer_config.get<unsigned int>("total"),
.starting_value = layer_config.get<unsigned int>("starting_number", 0)});
{.parent_layer = layer_config.get<std::string>("parent", "job"),
.count = layer_config.get<unsigned int>("total"),
.start_at = layer_config.get<unsigned int>("starting_number", 0)});
}

return d.driver(gen);
Expand Down
12 changes: 6 additions & 6 deletions plugins/layer_generator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ namespace phlex::experimental {

auto layer_handle = layers_.extract(old_layer_path);
layer_handle.key() = new_layer_path;
auto const old_parent_path = layer_handle.mapped().parent_layer_name;
auto const old_parent_path = layer_handle.mapped().parent_layer;
auto const new_parent_path = new_layer_path.substr(0, new_layer_path.find_last_of('/'));
layer_handle.mapped().parent_layer_name = new_parent_path;
layer_handle.mapped().parent_layer = new_parent_path;
layers_.insert(std::move(layer_handle));

auto emitted_handle = emitted_cells_.extract(old_layer_path);
Expand All @@ -110,15 +110,15 @@ namespace phlex::experimental {

void layer_generator::add_layer(std::string layer_name, layer_spec lspec)
{
auto const parent_full_path = parent_path(layer_name, lspec.parent_layer_name);
auto const parent_full_path = parent_path(layer_name, lspec.parent_layer);

// We need to make sure that we can distinguish between (e.g.) /events and /run/events.
// When a layer is added, the parent layers are also included as part of the path.
maybe_rebase_layer_paths(layer_name, parent_full_path);

auto full_path = parent_full_path + "/" + layer_name;

lspec.parent_layer_name = parent_full_path;
lspec.parent_layer = parent_full_path;
layers_[full_path] = std::move(lspec);
emitted_cells_[full_path] = 0ull;
parent_to_children_[parent_full_path].push_back(std::move(layer_name));
Expand Down Expand Up @@ -154,9 +154,9 @@ namespace phlex::experimental {

for (auto const& child : it->second) {
auto const full_child_path = fmt::format("{}/{}", cell_lp, child);
auto const& [_, total_per_parent, starting_value] = layers_.at(full_child_path);
auto const& [_, count, start_at] = layers_.at(full_child_path);
bool const has_children = parent_to_children_.contains(full_child_path);
for (unsigned int i : std::views::iota(starting_value, total_per_parent + starting_value)) {
for (unsigned int i : std::views::iota(start_at, count + start_at)) {
auto child_cell = cell->make_child(child, i);
++emitted_cells_.at(full_child_path);
co_yield child_cell;
Expand Down
6 changes: 3 additions & 3 deletions plugins/layer_generator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@

namespace phlex::experimental {
struct layer_spec {
std::string parent_layer_name;
std::size_t total_per_parent_data_cell{};
std::size_t starting_value = 0;
std::string parent_layer;
std::size_t count{};
std::size_t start_at = 0;
};

// Inherit enable_shared_from_this so driver_function can capture a shared_ptr to this,
Expand Down
120 changes: 57 additions & 63 deletions plugins/python/src/configwrap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,75 +221,69 @@ static PyObject* pcm_subscript(py_config_map* pycmap, PyObject* pykey)

// PyMappingMethods must be non-const; tp_as_mapping in PyTypeObject takes a non-const pointer.
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
static PyMappingMethods pcm_as_mapping = {
nullptr, reinterpret_cast<binaryfunc>(pcm_subscript), nullptr};
static PyMappingMethods pcm_as_mapping = {.mp_length = nullptr,
.mp_subscript =
reinterpret_cast<binaryfunc>(pcm_subscript),
.mp_ass_subscript = nullptr};

// clang-format off
// PyType_Ready() modifies PyTypeObject in-place; the Python C API requires non-const.
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
PyTypeObject phlex::experimental::PhlexConfig_Type = {
PyVarObject_HEAD_INIT(&PyType_Type, 0)
"pyphlex.configuration", // tp_name
sizeof(py_config_map), // tp_basicsize
0, // tp_itemsize
reinterpret_cast<destructor>(pcm_dealloc), // tp_dealloc
0, // tp_vectorcall_offset / tp_print
nullptr, // tp_getattr
nullptr, // tp_setattr
nullptr, // tp_as_async / tp_compare
nullptr, // tp_repr
nullptr, // tp_as_number
nullptr, // tp_as_sequence
&pcm_as_mapping, // tp_as_mapping
nullptr, // tp_hash
nullptr, // tp_call
nullptr, // tp_str
nullptr, // tp_getattro
nullptr, // tp_setattro
nullptr, // tp_as_buffer
Py_TPFLAGS_DEFAULT, // tp_flags
"phlex configuration object-as-dictionary", // tp_doc
nullptr, // tp_traverse
nullptr, // tp_clear
nullptr, // tp_richcompare
0, // tp_weaklistoffset
nullptr, // tp_iter
nullptr, // tp_iternext
nullptr, // tp_methods
nullptr, // tp_members
nullptr, // tp_getset
nullptr, // tp_base
nullptr, // tp_dict
nullptr, // tp_descr_get
nullptr, // tp_descr_set
offsetof(py_config_map, ph_config_cache), // tp_dictoffset
nullptr, // tp_init
nullptr, // tp_alloc
reinterpret_cast<newfunc>(pcm_new), // tp_new
nullptr, // tp_free
nullptr, // tp_is_gc
nullptr, // tp_bases
nullptr, // tp_mro
nullptr, // tp_cache
nullptr, // tp_subclasses
nullptr // tp_weaklist
#if PY_VERSION_HEX >= 0x02030000
, nullptr // tp_del
#endif
#if PY_VERSION_HEX >= 0x02060000
, 0 // tp_version_tag
#endif
#if PY_VERSION_HEX >= 0x03040000
, nullptr // tp_finalize
#endif
#if PY_VERSION_HEX >= 0x03080000
, nullptr // tp_vectorcall
#endif
// clang-format off
.ob_base = PyVarObject_HEAD_INIT(&PyType_Type, 0)
.tp_name = "pyphlex.configuration",
// clang-format on
.tp_basicsize = sizeof(py_config_map),
.tp_itemsize = 0,
.tp_dealloc = reinterpret_cast<destructor>(pcm_dealloc),
.tp_vectorcall_offset = 0,
.tp_getattr = nullptr,
.tp_setattr = nullptr,
.tp_as_async = nullptr,
.tp_repr = nullptr,
.tp_as_number = nullptr,
.tp_as_sequence = nullptr,
.tp_as_mapping = &pcm_as_mapping,
.tp_hash = nullptr,
.tp_call = nullptr,
.tp_str = nullptr,
.tp_getattro = nullptr,
.tp_setattro = nullptr,
.tp_as_buffer = nullptr,
.tp_flags = Py_TPFLAGS_DEFAULT,
.tp_doc = "phlex configuration object-as-dictionary",
.tp_traverse = nullptr,
.tp_clear = nullptr,
.tp_richcompare = nullptr,
.tp_weaklistoffset = 0,
.tp_iter = nullptr,
.tp_iternext = nullptr,
.tp_methods = nullptr,
.tp_members = nullptr,
.tp_getset = nullptr,
.tp_base = nullptr,
.tp_dict = nullptr,
.tp_descr_get = nullptr,
.tp_descr_set = nullptr,
.tp_dictoffset = offsetof(py_config_map, ph_config_cache),
.tp_init = nullptr,
.tp_alloc = nullptr,
.tp_new = reinterpret_cast<newfunc>(pcm_new),
.tp_free = nullptr,
.tp_is_gc = nullptr,
.tp_bases = nullptr,
.tp_mro = nullptr,
.tp_cache = nullptr,
.tp_subclasses = nullptr,
.tp_weaklist = nullptr,
.tp_del = nullptr,
.tp_version_tag = 0,
.tp_finalize = nullptr,
.tp_vectorcall = nullptr,
#if PY_VERSION_HEX >= 0x030c0000
, 0 // tp_watched
.tp_watched = 0,
#endif
#if PY_VERSION_HEX >= 0x030d0000
, 0 // tp_versions_used
.tp_versions_used = 0,
#endif
};
// clang-format on
Loading
Loading