From: Hoa Nguyen Date: Thu, 20 Aug 2020 06:28:01 +0000 (-0700) Subject: base: Tag API methods and variables in bitunion.hh X-Git-Tag: v20.1.0.0~91 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1669477c5e097c520b69412b3dae2e169d0cf76e;p=gem5.git base: Tag API methods and variables in bitunion.hh Change-Id: I322645801e9832014f54d4ed633796b082b06c6b Signed-off-by: Hoa Nguyen Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/32958 Reviewed-by: Gabe Black Maintainer: Gabe Black Tested-by: kokoro --- diff --git a/src/base/bitunion.hh b/src/base/bitunion.hh index 7af053edb..bf183ae0e 100644 --- a/src/base/bitunion.hh +++ b/src/base/bitunion.hh @@ -121,6 +121,7 @@ class BitfieldType : public BitfieldTypeImpl BitfieldType(const BitfieldType &) = default; operator Type () const { return Impl::operator Type(); } + Type operator=(const Type val) { return Impl::operator=(val); } Type operator=(BitfieldType const & other) @@ -321,10 +322,14 @@ namespace BitfieldBackend union { \ type __storage; -//This closes off the class and union started by the above macro. It is -//followed by a typedef which makes "name" refer to a BitfieldOperator -//class inheriting from the class and union just defined, which completes -//building up the type for the user. +/** + * This closes off the class and union started by the above macro. It is + * followed by a typedef which makes "name" refer to a BitfieldOperator + * class inheriting from the class and union just defined, which completes + * building up the type for the user. + * + * @ingroup api_bitunion + */ #define EndBitUnion(name) \ }; \ }; \ @@ -343,11 +348,15 @@ namespace BitfieldBackend union { \ fieldType<__VA_ARGS__> __storage; -//This closes off the union created above and gives it a name. Unlike the top -//level BitUnion, we're interested in creating an object instead of a type. -//The operators are defined in the macro itself instead of a class for -//technical reasons. If someone determines a way to move them to one, please -//do so. +/** + * This closes off the union created above and gives it a name. Unlike the top + * level BitUnion, we're interested in creating an object instead of a type. + * The operators are defined in the macro itself instead of a class for + * technical reasons. If someone determines a way to move them to one, please + * do so. + * + * @ingroup api_bitunion + */ #define EndSubBitUnion(name) \ }; \ inline operator __StorageType () const \ @@ -357,20 +366,36 @@ namespace BitfieldBackend { return __storage = _storage;} \ } name; -//Regular bitfields -//These define macros for read/write regular bitfield based subbitfields. +/** + * Regular bitfields + * These define macros for read/write regular bitfield based subbitfields. + * + * @ingroup api_bitunion + */ #define SubBitUnion(name, first, last) \ __SubBitUnion(name, Bitfield, first, last) -//Regular bitfields -//These define macros for read/write regular bitfield based subbitfields. +/** + * Regular bitfields + * These define macros for read/write regular bitfield based subbitfields. + * + * @ingroup api_bitunion + */ #define SignedSubBitUnion(name, first, last) \ __SubBitUnion(name, SignedBitfield, first, last) -//Use this to define an arbitrary type overlayed with bitfields. +/** + * Use this to define an arbitrary type overlayed with bitfields. + * + * @ingroup api_bitunion + */ #define BitUnion(type, name) __BitUnion(type, name) -//Use this to define conveniently sized values overlayed with bitfields. +/** + * Use this to define conveniently sized values overlayed with bitfields. + * + * @ingroup api_bitunion + */ #define BitUnion64(name) __BitUnion(uint64_t, name) #define BitUnion32(name) __BitUnion(uint32_t, name) #define BitUnion16(name) __BitUnion(uint16_t, name) @@ -392,6 +417,9 @@ namespace BitfieldBackend //Also, BitUnionBaseType can be used on a BitUnion type directly. +/** + * @ingroup api_bitunion + */ template using BitUnionType = BitfieldBackend::BitUnionOperators; @@ -410,6 +438,9 @@ namespace BitfieldBackend }; } +/** + * @ingroup api_bitunion + */ template using BitUnionBaseType = typename BitfieldBackend::BitUnionBaseType::Type; @@ -460,8 +491,12 @@ namespace BitfieldBackend } } -//A default << operator which casts a bitunion to its underlying type and -//passes it to BitfieldBackend::bitfieldBackendPrinter. +/** + * A default << operator which casts a bitunion to its underlying type and + * passes it to BitfieldBackend::bitfieldBackendPrinter. + * + * @ingroup api_bitunion + */ template std::ostream & operator << (std::ostream &os, const BitUnionType &bu)