Skip to content

Commit

Permalink
chore(avm): codegen cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
fcarreiro committed Jul 11, 2024
1 parent 399917b commit 9e5ff3e
Show file tree
Hide file tree
Showing 7 changed files with 210 additions and 2,232 deletions.
9 changes: 7 additions & 2 deletions barretenberg/cpp/src/barretenberg/flavor/flavor_macros.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ template <typename T, typename... BaseClass> auto _concatenate_base_class_get_la
}
} // namespace bb::detail

// Needed to force expansion of __VA_ARGS__ before converting to string.
#define VARARGS_TO_STRING(...) #__VA_ARGS__

#define DEFINE_REF_VIEW(...) \
[[nodiscard]] auto get_all() \
{ \
Expand All @@ -57,9 +60,11 @@ template <typename T, typename... BaseClass> auto _concatenate_base_class_get_la
#define DEFINE_FLAVOR_MEMBERS(DataType, ...) \
DataType __VA_ARGS__; \
DEFINE_REF_VIEW(__VA_ARGS__) \
std::vector<std::string> get_labels() const \
const std::vector<std::string>& get_labels() const \
{ \
return bb::detail::split_and_trim(#__VA_ARGS__, ','); \
static const std::vector<std::string> labels = \
bb::detail::split_and_trim(VARARGS_TO_STRING(__VA_ARGS__), ','); \
return labels; \
} \
constexpr std::size_t size() const \
{ \
Expand Down
Loading

0 comments on commit 9e5ff3e

Please sign in to comment.