From: Philippe Proulx Date: Fri, 3 Nov 2023 15:56:49 +0000 (-0400) Subject: cpp-common/bt2: remove useless friend classes to access libObjPtr() X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=75aa724c9d3d00bb7e711662f730260948cab98f cpp-common/bt2: remove useless friend classes to access libObjPtr() Mr. Deslauriers made bt2::BorrowedObj::libObjPtr() public in 341a67c45 ("cpp-common: Expose BorrowedObj::libObjPtr() as public method"). Therefore, all those friend classes aren't needed anymore. Signed-off-by: Philippe Proulx Change-Id: Ie37bfa78e4cd29dd8e08af135ff6a0e597ebd0ae Reviewed-on: https://review.lttng.org/c/babeltrace/+/11230 Reviewed-by: Simon Marchi --- diff --git a/src/cpp-common/bt2/borrowed-object.hpp b/src/cpp-common/bt2/borrowed-object.hpp index 24f026ec..0e8c70de 100644 --- a/src/cpp-common/bt2/borrowed-object.hpp +++ b/src/cpp-common/bt2/borrowed-object.hpp @@ -23,8 +23,8 @@ namespace bt2 { * `LibObjT` is the direct libbabeltrace2 object type, for example * `bt_stream_class` or `const bt_value`. * - * Methods of a derived class can call libObjPtr() to access the - * libbabeltrace2 object pointer. + * The user of a borrowed object, including methods of a derived class, + * can call libObjPtr() to access the libbabeltrace2 object pointer. */ template class BorrowedObject diff --git a/src/cpp-common/bt2/field-class.hpp b/src/cpp-common/bt2/field-class.hpp index 6682e5b5..ae2c52a3 100644 --- a/src/cpp-common/bt2/field-class.hpp +++ b/src/cpp-common/bt2/field-class.hpp @@ -163,29 +163,6 @@ enum class FieldClassType template class CommonFieldClass : public BorrowedObject { - /* Allow appendMember() to call `fc.libObjPtr()` */ - friend class CommonStructureFieldClass; - - /* Allow appendOption() to call `fc.libObjPtr()` */ - friend class CommonVariantWithoutSelectorFieldClass; - - friend class CommonVariantWithIntegerSelectorFieldClass< - bt_field_class, - ConstVariantWithIntegerSelectorFieldClassOption< - const bt_field_class_variant_with_selector_field_integer_unsigned_option>>; - - friend class CommonVariantWithIntegerSelectorFieldClass< - bt_field_class, - ConstVariantWithIntegerSelectorFieldClassOption< - const bt_field_class_variant_with_selector_field_integer_signed_option>>; - - /* Allow *FieldClass() to call `fc.libObjPtr()` */ - friend class CommonEventClass; - friend class CommonStreamClass; - - /* Allow create*FieldClass() to call `fc.libObjPtr()` */ - friend class CommonTraceClass; - private: using typename BorrowedObject::_ThisBorrowedObject; diff --git a/src/cpp-common/bt2/integer-range-set.hpp b/src/cpp-common/bt2/integer-range-set.hpp index 974aa600..f7ef1aaf 100644 --- a/src/cpp-common/bt2/integer-range-set.hpp +++ b/src/cpp-common/bt2/integer-range-set.hpp @@ -131,38 +131,9 @@ struct CommonIntegerRangeSetSpec final } /* namespace internal */ -template -class ConstVariantWithIntegerSelectorFieldClassOption; - -template -class CommonVariantWithIntegerSelectorFieldClass; - -template -class CommonTraceClass; - template class CommonIntegerRangeSet final : public BorrowedObject { - /* Allow operator==() to call `other.libObjPtr()` */ - friend class CommonIntegerRangeSet; - friend class CommonIntegerRangeSet; - friend class CommonIntegerRangeSet; - friend class CommonIntegerRangeSet; - - /* Allow appendOption() to call `ranges.libObjPtr()` */ - friend class CommonVariantWithIntegerSelectorFieldClass< - bt_field_class, - ConstVariantWithIntegerSelectorFieldClassOption< - const bt_field_class_variant_with_selector_field_integer_unsigned_option>>; - - friend class CommonVariantWithIntegerSelectorFieldClass< - bt_field_class, - ConstVariantWithIntegerSelectorFieldClassOption< - const bt_field_class_variant_with_selector_field_integer_signed_option>>; - - /* Allow create*FieldClass() to call `ranges.libObjPtr()` */ - friend class CommonTraceClass; - private: using typename BorrowedObject::_ThisBorrowedObject; using typename BorrowedObject::_LibObjPtr; diff --git a/src/cpp-common/bt2/trace-ir.hpp b/src/cpp-common/bt2/trace-ir.hpp index 1026600e..efdf0ba0 100644 --- a/src/cpp-common/bt2/trace-ir.hpp +++ b/src/cpp-common/bt2/trace-ir.hpp @@ -633,9 +633,6 @@ struct CommonTraceSpec final template class CommonTrace final : public BorrowedObject { - /* Allow instantiate() to call `trace.libObjPtr()` */ - friend class CommonStreamClass; - private: using typename BorrowedObject::_ThisBorrowedObject; using typename BorrowedObject::_LibObjPtr; diff --git a/src/cpp-common/bt2/value.hpp b/src/cpp-common/bt2/value.hpp index 7c4e4a99..1051cedf 100644 --- a/src/cpp-common/bt2/value.hpp +++ b/src/cpp-common/bt2/value.hpp @@ -81,45 +81,9 @@ enum class ValueType MAP = BT_VALUE_TYPE_MAP, }; -template -class CommonClockClass; - -template -class CommonFieldClass; - -template -class CommonTraceClass; - -template -class CommonStreamClass; - -template -class CommonEventClass; - -template -class CommonStream; - template class CommonValue : public BorrowedObject { - /* Allow append() to call `val.libObjPtr()` */ - friend class CommonArrayValue; - - /* Allow insert() to call `val.libObjPtr()` */ - friend class CommonMapValue; - - /* Allow userAttributes() to call `val.libObjPtr()` */ - friend class CommonClockClass; - friend class CommonFieldClass; - friend class CommonTraceClass; - friend class CommonStreamClass; - friend class CommonEventClass; - friend class CommonStream; - - /* Allow operator==() to call `other.libObjPtr()` */ - friend class CommonValue; - friend class CommonValue; - private: using typename BorrowedObject::_ThisBorrowedObject;