From 81d06b0fdff36b60ef55b33004a4b411e9b37f7a Mon Sep 17 00:00:00 2001 From: Yingxin Cheng Date: Fri, 18 Dec 2020 10:55:43 +0800 Subject: [PATCH] crimson/onode-staged-tree: fix explicit template instantiation for clang Signed-off-by: Yingxin Cheng --- .../stages/item_iterator_stage.cc | 17 +++--- .../staged-fltree/stages/node_stage.cc | 54 ++++++++++--------- .../staged-fltree/stages/node_stage_layout.cc | 9 ++-- .../staged-fltree/stages/sub_items_stage.cc | 12 ++--- 4 files changed, 49 insertions(+), 43 deletions(-) diff --git a/src/crimson/os/seastore/onode_manager/staged-fltree/stages/item_iterator_stage.cc b/src/crimson/os/seastore/onode_manager/staged-fltree/stages/item_iterator_stage.cc index 826de16631b..5a2b4557754 100644 --- a/src/crimson/os/seastore/onode_manager/staged-fltree/stages/item_iterator_stage.cc +++ b/src/crimson/os/seastore/onode_manager/staged-fltree/stages/item_iterator_stage.cc @@ -9,9 +9,6 @@ namespace crimson::os::seastore::onode { #define ITER_T item_iterator_t #define ITER_INST(NT) item_iterator_t -#define ITER_TEMPLATE(NT) template class ITER_INST(NT) -ITER_TEMPLATE(node_type_t::LEAF); -ITER_TEMPLATE(node_type_t::INTERNAL); template template @@ -81,11 +78,11 @@ node_offset_t ITER_T::trim_at( return trim_size; } +#define ITER_TEMPLATE(NT) template class ITER_INST(NT) +ITER_TEMPLATE(node_type_t::LEAF); +ITER_TEMPLATE(node_type_t::INTERNAL); + #define APPEND_T ITER_T::Appender -template class ITER_INST(node_type_t::LEAF)::Appender; -template class ITER_INST(node_type_t::INTERNAL)::Appender; -template class ITER_INST(node_type_t::LEAF)::Appender; -template class ITER_INST(node_type_t::INTERNAL)::Appender; template template @@ -159,4 +156,10 @@ void APPEND_T::wrap_nxt(char* _p_append) { p_append = _p_append; } +#define APPEND_TEMPLATE(NT, KT) template class ITER_INST(NT)::Appender +APPEND_TEMPLATE(node_type_t::LEAF, KeyT::VIEW); +APPEND_TEMPLATE(node_type_t::INTERNAL, KeyT::VIEW); +APPEND_TEMPLATE(node_type_t::LEAF, KeyT::HOBJ); +APPEND_TEMPLATE(node_type_t::INTERNAL, KeyT::HOBJ); + } diff --git a/src/crimson/os/seastore/onode_manager/staged-fltree/stages/node_stage.cc b/src/crimson/os/seastore/onode_manager/staged-fltree/stages/node_stage.cc index 4b7d3170f11..d3b96048025 100644 --- a/src/crimson/os/seastore/onode_manager/staged-fltree/stages/node_stage.cc +++ b/src/crimson/os/seastore/onode_manager/staged-fltree/stages/node_stage.cc @@ -10,15 +10,6 @@ namespace crimson::os::seastore::onode { #define NODE_T node_extent_t #define NODE_INST(FT, NT) node_extent_t -#define NODE_TEMPLATE(FT, NT) template class NODE_INST(FT, NT) -NODE_TEMPLATE(node_fields_0_t, node_type_t::INTERNAL); -NODE_TEMPLATE(node_fields_1_t, node_type_t::INTERNAL); -NODE_TEMPLATE(node_fields_2_t, node_type_t::INTERNAL); -NODE_TEMPLATE(internal_fields_3_t, node_type_t::INTERNAL); -NODE_TEMPLATE(node_fields_0_t, node_type_t::LEAF); -NODE_TEMPLATE(node_fields_1_t, node_type_t::LEAF); -NODE_TEMPLATE(node_fields_2_t, node_type_t::LEAF); -NODE_TEMPLATE(leaf_fields_3_t, node_type_t::LEAF); template const char* NODE_T::p_left_bound() const { @@ -176,24 +167,17 @@ node_offset_t NODE_T::trim_at( return 0; } +#define NODE_TEMPLATE(FT, NT) template class NODE_INST(FT, NT) +NODE_TEMPLATE(node_fields_0_t, node_type_t::INTERNAL); +NODE_TEMPLATE(node_fields_1_t, node_type_t::INTERNAL); +NODE_TEMPLATE(node_fields_2_t, node_type_t::INTERNAL); +NODE_TEMPLATE(internal_fields_3_t, node_type_t::INTERNAL); +NODE_TEMPLATE(node_fields_0_t, node_type_t::LEAF); +NODE_TEMPLATE(node_fields_1_t, node_type_t::LEAF); +NODE_TEMPLATE(node_fields_2_t, node_type_t::LEAF); +NODE_TEMPLATE(leaf_fields_3_t, node_type_t::LEAF); + #define APPEND_T node_extent_t::Appender -#define APPEND_TEMPLATE(FT, NT, KT) template class node_extent_t::Appender -APPEND_TEMPLATE(node_fields_0_t, node_type_t::INTERNAL, KeyT::VIEW); -APPEND_TEMPLATE(node_fields_1_t, node_type_t::INTERNAL, KeyT::VIEW); -APPEND_TEMPLATE(node_fields_2_t, node_type_t::INTERNAL, KeyT::VIEW); -APPEND_TEMPLATE(internal_fields_3_t, node_type_t::INTERNAL, KeyT::VIEW); -APPEND_TEMPLATE(node_fields_0_t, node_type_t::LEAF, KeyT::VIEW); -APPEND_TEMPLATE(node_fields_1_t, node_type_t::LEAF, KeyT::VIEW); -APPEND_TEMPLATE(node_fields_2_t, node_type_t::LEAF, KeyT::VIEW); -APPEND_TEMPLATE(leaf_fields_3_t, node_type_t::LEAF, KeyT::VIEW); -APPEND_TEMPLATE(node_fields_0_t, node_type_t::INTERNAL, KeyT::HOBJ); -APPEND_TEMPLATE(node_fields_1_t, node_type_t::INTERNAL, KeyT::HOBJ); -APPEND_TEMPLATE(node_fields_2_t, node_type_t::INTERNAL, KeyT::HOBJ); -APPEND_TEMPLATE(internal_fields_3_t, node_type_t::INTERNAL, KeyT::HOBJ); -APPEND_TEMPLATE(node_fields_0_t, node_type_t::LEAF, KeyT::HOBJ); -APPEND_TEMPLATE(node_fields_1_t, node_type_t::LEAF, KeyT::HOBJ); -APPEND_TEMPLATE(node_fields_2_t, node_type_t::LEAF, KeyT::HOBJ); -APPEND_TEMPLATE(leaf_fields_3_t, node_type_t::LEAF, KeyT::HOBJ); template template @@ -313,4 +297,22 @@ char* APPEND_T::wrap() { return p_append_left; } +#define APPEND_TEMPLATE(FT, NT, KT) template class node_extent_t::Appender +APPEND_TEMPLATE(node_fields_0_t, node_type_t::INTERNAL, KeyT::VIEW); +APPEND_TEMPLATE(node_fields_1_t, node_type_t::INTERNAL, KeyT::VIEW); +APPEND_TEMPLATE(node_fields_2_t, node_type_t::INTERNAL, KeyT::VIEW); +APPEND_TEMPLATE(internal_fields_3_t, node_type_t::INTERNAL, KeyT::VIEW); +APPEND_TEMPLATE(node_fields_0_t, node_type_t::LEAF, KeyT::VIEW); +APPEND_TEMPLATE(node_fields_1_t, node_type_t::LEAF, KeyT::VIEW); +APPEND_TEMPLATE(node_fields_2_t, node_type_t::LEAF, KeyT::VIEW); +APPEND_TEMPLATE(leaf_fields_3_t, node_type_t::LEAF, KeyT::VIEW); +APPEND_TEMPLATE(node_fields_0_t, node_type_t::INTERNAL, KeyT::HOBJ); +APPEND_TEMPLATE(node_fields_1_t, node_type_t::INTERNAL, KeyT::HOBJ); +APPEND_TEMPLATE(node_fields_2_t, node_type_t::INTERNAL, KeyT::HOBJ); +APPEND_TEMPLATE(internal_fields_3_t, node_type_t::INTERNAL, KeyT::HOBJ); +APPEND_TEMPLATE(node_fields_0_t, node_type_t::LEAF, KeyT::HOBJ); +APPEND_TEMPLATE(node_fields_1_t, node_type_t::LEAF, KeyT::HOBJ); +APPEND_TEMPLATE(node_fields_2_t, node_type_t::LEAF, KeyT::HOBJ); +APPEND_TEMPLATE(leaf_fields_3_t, node_type_t::LEAF, KeyT::HOBJ); + } diff --git a/src/crimson/os/seastore/onode_manager/staged-fltree/stages/node_stage_layout.cc b/src/crimson/os/seastore/onode_manager/staged-fltree/stages/node_stage_layout.cc index 2809803eb55..8f6b73a6a9c 100644 --- a/src/crimson/os/seastore/onode_manager/staged-fltree/stages/node_stage_layout.cc +++ b/src/crimson/os/seastore/onode_manager/staged-fltree/stages/node_stage_layout.cc @@ -28,10 +28,6 @@ void node_header_t::update_is_level_tail( #define F013_T _node_fields_013_t #define F013_INST(ST) _node_fields_013_t -#define F013_TEMPLATE(ST) template struct F013_INST(ST) -F013_TEMPLATE(slot_0_t); -F013_TEMPLATE(slot_1_t); -F013_TEMPLATE(slot_3_t); template void F013_T::update_size_at( @@ -86,6 +82,11 @@ IA_TEMPLATE(slot_0_t, KeyT::HOBJ); IA_TEMPLATE(slot_1_t, KeyT::HOBJ); IA_TEMPLATE(slot_3_t, KeyT::HOBJ); +#define F013_TEMPLATE(ST) template struct F013_INST(ST) +F013_TEMPLATE(slot_0_t); +F013_TEMPLATE(slot_1_t); +F013_TEMPLATE(slot_3_t); + void node_fields_2_t::append_offset( NodeExtentMutable& mut, node_offset_t offset_to_right, char*& p_append) { mut.copy_in_absolute(p_append, offset_to_right); diff --git a/src/crimson/os/seastore/onode_manager/staged-fltree/stages/sub_items_stage.cc b/src/crimson/os/seastore/onode_manager/staged-fltree/stages/sub_items_stage.cc index bb3c64b97e3..577b8b7bfc9 100644 --- a/src/crimson/os/seastore/onode_manager/staged-fltree/stages/sub_items_stage.cc +++ b/src/crimson/os/seastore/onode_manager/staged-fltree/stages/sub_items_stage.cc @@ -38,9 +38,6 @@ node_offset_t internal_sub_items_t::trim_until( return ret; } -template class internal_sub_items_t::Appender; -template class internal_sub_items_t::Appender; - template void internal_sub_items_t::Appender::append( const internal_sub_items_t& src, size_t from, size_t items) { @@ -135,14 +132,14 @@ node_offset_t leaf_sub_items_t::trim_until( return ret; } +template class internal_sub_items_t::Appender; +template class internal_sub_items_t::Appender; + // helper type for the visitor template struct overloaded : Ts... { using Ts::operator()...; }; // explicit deduction guide template overloaded(Ts...) -> overloaded; -template class leaf_sub_items_t::Appender; -template class leaf_sub_items_t::Appender; - template char* leaf_sub_items_t::Appender::wrap() { auto p_cur = p_append; @@ -202,4 +199,7 @@ char* leaf_sub_items_t::Appender::wrap() { return p_cur; } +template class leaf_sub_items_t::Appender; +template class leaf_sub_items_t::Appender; + } -- 2.39.5