Cleanup: Various clang-tidy warnings in functions
Pull Request: https://projects.blender.org/blender/blender/pulls/133734
This commit is contained in:
@@ -232,7 +232,7 @@ class FieldOperation : public FieldNode {
|
||||
public:
|
||||
FieldOperation(std::shared_ptr<const mf::MultiFunction> function, Vector<GField> inputs = {});
|
||||
FieldOperation(const mf::MultiFunction &function, Vector<GField> inputs = {});
|
||||
~FieldOperation();
|
||||
~FieldOperation() override;
|
||||
|
||||
Span<GField> inputs() const;
|
||||
const mf::MultiFunction &multi_function() const;
|
||||
@@ -273,7 +273,7 @@ class FieldInput : public FieldNode {
|
||||
|
||||
public:
|
||||
FieldInput(const CPPType &type, std::string debug_name = "");
|
||||
~FieldInput();
|
||||
~FieldInput() override;
|
||||
|
||||
/**
|
||||
* Get the value of this specific input based on the given context. The returned virtual array,
|
||||
@@ -298,7 +298,7 @@ class FieldConstant : public FieldNode {
|
||||
|
||||
public:
|
||||
FieldConstant(const CPPType &type, const void *value);
|
||||
~FieldConstant();
|
||||
~FieldConstant() override;
|
||||
|
||||
const CPPType &output_cpp_type(int output_index) const override;
|
||||
const CPPType &type() const;
|
||||
|
||||
@@ -139,7 +139,6 @@ class Params {
|
||||
std::atomic<bool> allow_multi_threading_;
|
||||
#endif
|
||||
|
||||
public:
|
||||
Params(const LazyFunction &fn, bool allow_multi_threading_initially);
|
||||
|
||||
/**
|
||||
|
||||
@@ -99,7 +99,7 @@ inline void execute_lazy_function_eagerly_impl(const LazyFunction &fn,
|
||||
[&]() {
|
||||
constexpr size_t I = InIndices;
|
||||
/* Use `typedef` instead of `using` to work around a compiler bug. */
|
||||
typedef Inputs T;
|
||||
using T = Inputs;
|
||||
const CPPType &type = CPPType::get<T>();
|
||||
input_pointers[I] = {type, &std::get<I>(inputs)};
|
||||
}(),
|
||||
@@ -108,7 +108,7 @@ inline void execute_lazy_function_eagerly_impl(const LazyFunction &fn,
|
||||
[&]() {
|
||||
constexpr size_t I = OutIndices;
|
||||
/* Use `typedef` instead of `using` to work around a compiler bug. */
|
||||
typedef Outputs T;
|
||||
using T = Outputs;
|
||||
const CPPType &type = CPPType::get<T>();
|
||||
output_pointers[I] = {type, std::get<I>(outputs)};
|
||||
}(),
|
||||
|
||||
@@ -44,7 +44,7 @@ class MultiFunction : NonCopyable, NonMovable {
|
||||
const Signature *signature_ref_ = nullptr;
|
||||
|
||||
public:
|
||||
virtual ~MultiFunction() {}
|
||||
virtual ~MultiFunction() = default;
|
||||
|
||||
/**
|
||||
* The result is the same as using #call directly but this method has some additional features.
|
||||
|
||||
@@ -65,8 +65,8 @@ struct AllSpanOrSingle {
|
||||
const std::tuple<LoadedParams...> &loaded_params) const
|
||||
{
|
||||
return std::make_tuple([&]() {
|
||||
typedef ParamTags ParamTag;
|
||||
typedef typename ParamTag::base_type T;
|
||||
using ParamTag = ParamTags;
|
||||
using T = typename ParamTag::base_type;
|
||||
if constexpr (ParamTag::category == ParamCategory::SingleInput) {
|
||||
const GVArrayImpl &varray_impl = *std::get<I>(loaded_params);
|
||||
return GVArrayDevirtualizer<T, true, true>{varray_impl};
|
||||
@@ -97,8 +97,8 @@ template<size_t... Indices> struct SomeSpanOrSingle {
|
||||
const std::tuple<LoadedParams...> &loaded_params) const
|
||||
{
|
||||
return std::make_tuple([&]() {
|
||||
typedef ParamTags ParamTag;
|
||||
typedef typename ParamTag::base_type T;
|
||||
using ParamTag = ParamTags;
|
||||
using T = typename ParamTag::base_type;
|
||||
|
||||
if constexpr (ParamTag::category == ParamCategory::SingleInput) {
|
||||
constexpr bool UseSpan = ValueSequence<size_t, Indices...>::template contains<I>();
|
||||
@@ -216,8 +216,8 @@ inline void execute_materialized(TypeSequence<ParamTags...> /*param_tags*/,
|
||||
/* Setup information for all parameters. */
|
||||
[&] {
|
||||
/* Use `typedef` instead of `using` to work around a compiler bug. */
|
||||
typedef ParamTags ParamTag;
|
||||
typedef typename ParamTag::base_type T;
|
||||
using ParamTag = ParamTags;
|
||||
using T = typename ParamTag::base_type;
|
||||
[[maybe_unused]] MaterializeArgInfo<ParamTags> &arg_info = std::get<I>(args_info);
|
||||
if constexpr (ParamTag::category == ParamCategory::SingleInput) {
|
||||
const GVArrayImpl &varray_impl = *std::get<I>(loaded_params);
|
||||
@@ -258,8 +258,8 @@ inline void execute_materialized(TypeSequence<ParamTags...> /*param_tags*/,
|
||||
(
|
||||
[&] {
|
||||
/* Use `typedef` instead of `using` to work around a compiler bug. */
|
||||
typedef ParamTags ParamTag;
|
||||
typedef typename ParamTag::base_type T;
|
||||
using ParamTag = ParamTags;
|
||||
using T = typename ParamTag::base_type;
|
||||
if constexpr (ParamTag::category == ParamCategory::SingleMutable) {
|
||||
T *tmp_buffer = std::get<I>(temporary_buffers).ptr();
|
||||
T *param_buffer = std::get<I>(loaded_params);
|
||||
@@ -317,11 +317,9 @@ inline void execute_materialized(TypeSequence<ParamTags...> /*param_tags*/,
|
||||
T *param_buffer = std::get<I>(loaded_params);
|
||||
return param_buffer + mask_start;
|
||||
}
|
||||
else {
|
||||
/* Use the temporary buffer. The values will have to be copied out of that
|
||||
* buffer into the caller-provided buffer afterwards. */
|
||||
return const_cast<T *>(tmp_buffer);
|
||||
}
|
||||
/* Use the temporary buffer. The values will have to be copied out of that
|
||||
* buffer into the caller-provided buffer afterwards. */
|
||||
return tmp_buffer;
|
||||
}
|
||||
}()...);
|
||||
|
||||
@@ -330,8 +328,8 @@ inline void execute_materialized(TypeSequence<ParamTags...> /*param_tags*/,
|
||||
(
|
||||
[&] {
|
||||
/* Use `typedef` instead of `using` to work around a compiler bug. */
|
||||
typedef ParamTags ParamTag;
|
||||
typedef typename ParamTag::base_type T;
|
||||
using ParamTag = ParamTags;
|
||||
using T = typename ParamTag::base_type;
|
||||
if constexpr (ELEM(ParamTag::category,
|
||||
ParamCategory::SingleOutput,
|
||||
ParamCategory::SingleMutable))
|
||||
@@ -351,8 +349,8 @@ inline void execute_materialized(TypeSequence<ParamTags...> /*param_tags*/,
|
||||
/* Destruct values that have been materialized before. */
|
||||
[&] {
|
||||
/* Use `typedef` instead of `using` to work around a compiler bug. */
|
||||
typedef ParamTags ParamTag;
|
||||
typedef typename ParamTag::base_type T;
|
||||
using ParamTag = ParamTags;
|
||||
using T = typename ParamTag::base_type;
|
||||
[[maybe_unused]] MaterializeArgInfo<ParamTags> &arg_info = std::get<I>(args_info);
|
||||
if constexpr (ParamTag::category == ParamCategory::SingleInput) {
|
||||
if (arg_info.mode == MaterializeArgMode::Materialized) {
|
||||
@@ -368,8 +366,8 @@ inline void execute_materialized(TypeSequence<ParamTags...> /*param_tags*/,
|
||||
/* Destruct buffers for single value inputs. */
|
||||
[&] {
|
||||
/* Use `typedef` instead of `using` to work around a compiler bug. */
|
||||
typedef ParamTags ParamTag;
|
||||
typedef typename ParamTag::base_type T;
|
||||
using ParamTag = ParamTags;
|
||||
using T = typename ParamTag::base_type;
|
||||
[[maybe_unused]] MaterializeArgInfo<ParamTags> &arg_info = std::get<I>(args_info);
|
||||
if constexpr (ParamTag::category == ParamCategory::SingleInput) {
|
||||
if (arg_info.mode == MaterializeArgMode::Single) {
|
||||
@@ -394,8 +392,8 @@ inline void execute_element_fn_as_multi_function(const ElementFn element_fn,
|
||||
/* Contains `const GVArrayImpl *` for inputs and `T *` for outputs. */
|
||||
const auto loaded_params = std::make_tuple([&]() {
|
||||
/* Use `typedef` instead of `using` to work around a compiler bug. */
|
||||
typedef ParamTags ParamTag;
|
||||
typedef typename ParamTag::base_type T;
|
||||
using ParamTag = ParamTags;
|
||||
using T = typename ParamTag::base_type;
|
||||
|
||||
if constexpr (ParamTag::category == ParamCategory::SingleInput) {
|
||||
return params.readonly_single_input(I).get_implementation();
|
||||
@@ -463,8 +461,8 @@ inline void execute_element_fn_as_multi_function(const ElementFn element_fn,
|
||||
execute_array(
|
||||
TypeSequence<ParamTags...>(), std::index_sequence<I...>(), element_fn, segment, [&]() {
|
||||
/* Use `typedef` instead of `using` to work around a compiler bug. */
|
||||
typedef ParamTags ParamTag;
|
||||
typedef typename ParamTag::base_type T;
|
||||
using ParamTag = ParamTags;
|
||||
using T = typename ParamTag::base_type;
|
||||
if constexpr (ParamTag::category == ParamCategory::SingleInput) {
|
||||
const GVArrayImpl &varray_impl = *std::get<I>(loaded_params);
|
||||
return GVArray(&varray_impl).typed<T>();
|
||||
@@ -753,7 +751,7 @@ class CustomMF_GenericConstant : public MultiFunction {
|
||||
|
||||
public:
|
||||
CustomMF_GenericConstant(const CPPType &type, const void *value, bool make_value_copy);
|
||||
~CustomMF_GenericConstant();
|
||||
~CustomMF_GenericConstant() override;
|
||||
void call(const IndexMask &mask, Params params, Context context) const override;
|
||||
uint64_t hash() const override;
|
||||
bool equals(const MultiFunction &other) const override;
|
||||
|
||||
@@ -109,7 +109,7 @@ void *RemappedParams::get_output_data_ptr_impl(const int index)
|
||||
|
||||
void RemappedParams::output_set_impl(const int index)
|
||||
{
|
||||
return base_params_.output_set(output_map_[index]);
|
||||
base_params_.output_set(output_map_[index]);
|
||||
}
|
||||
|
||||
bool RemappedParams::output_was_set_impl(const int index) const
|
||||
@@ -124,7 +124,7 @@ lf::ValueUsage RemappedParams::get_output_usage_impl(const int index) const
|
||||
|
||||
void RemappedParams::set_input_unused_impl(const int index)
|
||||
{
|
||||
return base_params_.set_input_unused(input_map_[index]);
|
||||
base_params_.set_input_unused(input_map_[index]);
|
||||
}
|
||||
|
||||
bool RemappedParams::try_enable_multi_threading_impl()
|
||||
|
||||
@@ -45,7 +45,7 @@ struct VariableValue {
|
||||
|
||||
/* This variable is the unmodified virtual array from the caller. */
|
||||
struct VariableValue_GVArray : public VariableValue {
|
||||
static inline constexpr ValueType static_type = ValueType::GVArray;
|
||||
static constexpr ValueType static_type = ValueType::GVArray;
|
||||
const GVArray &data;
|
||||
|
||||
VariableValue_GVArray(const GVArray &data) : VariableValue(static_type), data(data)
|
||||
@@ -57,7 +57,7 @@ struct VariableValue_GVArray : public VariableValue {
|
||||
/* This variable has a different value for every index. Some values may be uninitialized. The span
|
||||
* may be owned by the caller. */
|
||||
struct VariableValue_Span : public VariableValue {
|
||||
static inline constexpr ValueType static_type = ValueType::Span;
|
||||
static constexpr ValueType static_type = ValueType::Span;
|
||||
void *data;
|
||||
bool owned;
|
||||
|
||||
@@ -68,7 +68,7 @@ struct VariableValue_Span : public VariableValue {
|
||||
|
||||
/* This variable is the unmodified virtual vector array from the caller. */
|
||||
struct VariableValue_GVVectorArray : public VariableValue {
|
||||
static inline constexpr ValueType static_type = ValueType::GVVectorArray;
|
||||
static constexpr ValueType static_type = ValueType::GVVectorArray;
|
||||
const GVVectorArray &data;
|
||||
|
||||
VariableValue_GVVectorArray(const GVVectorArray &data) : VariableValue(static_type), data(data)
|
||||
@@ -78,7 +78,7 @@ struct VariableValue_GVVectorArray : public VariableValue {
|
||||
|
||||
/* This variable has a different vector for every index. */
|
||||
struct VariableValue_GVectorArray : public VariableValue {
|
||||
static inline constexpr ValueType static_type = ValueType::GVectorArray;
|
||||
static constexpr ValueType static_type = ValueType::GVectorArray;
|
||||
GVectorArray &data;
|
||||
bool owned;
|
||||
|
||||
@@ -90,7 +90,7 @@ struct VariableValue_GVectorArray : public VariableValue {
|
||||
|
||||
/* This variable has the same value for every index. */
|
||||
struct VariableValue_OneSingle : public VariableValue {
|
||||
static inline constexpr ValueType static_type = ValueType::OneSingle;
|
||||
static constexpr ValueType static_type = ValueType::OneSingle;
|
||||
void *data;
|
||||
bool is_initialized = false;
|
||||
|
||||
@@ -99,7 +99,7 @@ struct VariableValue_OneSingle : public VariableValue {
|
||||
|
||||
/* This variable has the same vector for every index. */
|
||||
struct VariableValue_OneVector : public VariableValue {
|
||||
static inline constexpr ValueType static_type = ValueType::OneVector;
|
||||
static constexpr ValueType static_type = ValueType::OneVector;
|
||||
GVectorArray &data;
|
||||
|
||||
VariableValue_OneVector(GVectorArray &data) : VariableValue(static_type), data(data) {}
|
||||
@@ -124,7 +124,7 @@ class ValueAllocator : NonCopyable, NonMovable {
|
||||
* Allocate with 64 byte alignment for better reusability of buffers and improved cache
|
||||
* performance.
|
||||
*/
|
||||
static constexpr inline int min_alignment = 64;
|
||||
static constexpr int min_alignment = 64;
|
||||
|
||||
/** All buffers in the free-lists below have been allocated with this allocator. */
|
||||
LinearAllocator<> &linear_allocator_;
|
||||
@@ -143,8 +143,8 @@ class ValueAllocator : NonCopyable, NonMovable {
|
||||
Map<int, Stack<void *>> span_buffers_free_lists_;
|
||||
|
||||
/** Cache buffers for single values of different types. */
|
||||
static constexpr inline int small_value_max_size = 16;
|
||||
static constexpr inline int small_value_max_alignment = 8;
|
||||
static constexpr int small_value_max_size = 16;
|
||||
static constexpr int small_value_max_alignment = 8;
|
||||
Stack<void *> small_single_value_free_list_;
|
||||
Map<const CPPType *, Stack<void *>> single_value_free_lists_;
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#include "FN_lazy_function_graph_executor.hh"
|
||||
|
||||
#include "BLI_task.h"
|
||||
#include "BLI_timeit.hh"
|
||||
|
||||
namespace blender::fn::lazy_function::tests {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user