The Road to Clang-Format part 4

The Return of the Endline

Signed-off-by: Zane Shelley <zshelle@us.ibm.com>
Change-Id: I5c0e8a8639ae9433c9a5f5eed444c07763e5bc3f
diff --git a/src/chip_data/hei_chip_data.hpp b/src/chip_data/hei_chip_data.hpp
index 685ed12..26cfb75 100644
--- a/src/chip_data/hei_chip_data.hpp
+++ b/src/chip_data/hei_chip_data.hpp
@@ -3,6 +3,4 @@
 #include <hei_includes.hpp>
 
 namespace libhei
-{
-
-} // end namespace libhei
+{} // end namespace libhei
diff --git a/src/chip_data/hei_chip_data_stream.hpp b/src/chip_data/hei_chip_data_stream.hpp
index e675420..41cb94e 100755
--- a/src/chip_data/hei_chip_data_stream.hpp
+++ b/src/chip_data/hei_chip_data_stream.hpp
@@ -111,8 +111,8 @@
  *   @param             o_right: A pointer to where the data is stored
  *   @return            *this:   A pointer to "this" object
  **/
-template <> inline
-ChipDataStream& ChipDataStream::operator>>(uint16_t& o_right)
+template <>
+inline ChipDataStream& ChipDataStream::operator>>(uint16_t& o_right)
 {
     read(&o_right, sizeof(o_right));
     be16toh(o_right);
@@ -123,8 +123,8 @@
  *  @param             o_right: A pointer to where the data is stored
  *  @return            *this:   A pointer to "this" object
  **/
-template <> inline
-ChipDataStream& ChipDataStream::operator>>(int16_t& o_right)
+template <>
+inline ChipDataStream& ChipDataStream::operator>>(int16_t& o_right)
 {
     read(&o_right, sizeof(o_right));
     be16toh(o_right);
@@ -135,8 +135,8 @@
  *  @param             o_right: A pointer to where the data is stored
  *  @return            *this:   A pointer to "this" object
  **/
-template <> inline
-ChipDataStream& ChipDataStream::operator>>(uint32_t& o_right)
+template <>
+inline ChipDataStream& ChipDataStream::operator>>(uint32_t& o_right)
 {
     read(&o_right, sizeof(o_right));
     be32toh(o_right);
@@ -147,8 +147,8 @@
  *  @param             o_right: A pointer to where the data is stored
  *  @return            *this:   A pointer to "this" object
  **/
-template <> inline
-ChipDataStream& ChipDataStream::operator>>(int32_t& o_right)
+template <>
+inline ChipDataStream& ChipDataStream::operator>>(int32_t& o_right)
 {
     read(&o_right, sizeof(o_right));
     be32toh(o_right);
@@ -159,8 +159,8 @@
  *  @param             o_right: A pointer to where the data is stored
  *  @return            *this:   A pointer to "this" object
  **/
-template <> inline
-ChipDataStream& ChipDataStream::operator>>(uint64_t& o_right)
+template <>
+inline ChipDataStream& ChipDataStream::operator>>(uint64_t& o_right)
 {
     read(&o_right, sizeof(o_right));
     be64toh(o_right);
@@ -171,8 +171,8 @@
  *  @param             o_right: A pointer to where the data is stored
  *  @return            *this:   A pointer to "this" object
  **/
-template <> inline
-ChipDataStream& ChipDataStream::operator>>(int64_t& o_right)
+template <>
+inline ChipDataStream& ChipDataStream::operator>>(int64_t& o_right)
 {
     read(&o_right, sizeof(o_right));
     be64toh(o_right);
diff --git a/src/hei_chip.hpp b/src/hei_chip.hpp
index 83ef663..2633eca 100644
--- a/src/hei_chip.hpp
+++ b/src/hei_chip.hpp
@@ -26,22 +26,25 @@
      * @param i_chip See description for iv_chip.
      * @param i_type See description for iv_type.
      */
-    Chip(void* i_chip, ChipType_t i_type) :
-        iv_chip(i_chip), iv_type(i_type)
-    {}
+    Chip(void* i_chip, ChipType_t i_type) : iv_chip(i_chip), iv_type(i_type) {}
 
   public: // Accessors
 
-    void* getChip() const { return iv_chip; }
+    void* getChip() const
+    {
+        return iv_chip;
+    }
 
-    ChipType_t getType() const { return iv_type; }
+    ChipType_t getType() const
+    {
+        return iv_type;
+    }
 
   public: // Operators
 
     bool operator==(const Chip& r) const
     {
-        return (iv_chip == r.iv_chip) &&
-               (iv_type == r.iv_type);
+        return (iv_chip == r.iv_chip) && (iv_type == r.iv_type);
     }
 
     bool operator<(const Chip& r) const
diff --git a/src/hei_return_code.hpp b/src/hei_return_code.hpp
index 0475bc7..5ec9953 100644
--- a/src/hei_return_code.hpp
+++ b/src/hei_return_code.hpp
@@ -13,9 +13,7 @@
      * @brief Constructor.
      * @param i_rc The error code value.
      */
-    explicit constexpr ReturnCode(uint32_t i_rc = 0) :
-        iv_rc(i_rc)
-    {}
+    explicit constexpr ReturnCode(uint32_t i_rc = 0) : iv_rc(i_rc) {}
 
     /** @brief Default copy constructor. */
     ReturnCode(const ReturnCode&) = default;
@@ -27,10 +25,16 @@
     ~ReturnCode() = default;
 
     /** @brief Integral type conversion function. */
-    operator uint32_t() const { return iv_rc; }
+    operator uint32_t() const
+    {
+        return iv_rc;
+    }
 
     /** @brief Integral type conversion function. */
-    operator uint64_t() const { return iv_rc; }
+    operator uint64_t() const
+    {
+        return iv_rc;
+    }
 
     /** @brief Equals operator. */
     bool operator==(const ReturnCode& rhs) const
@@ -51,7 +55,10 @@
      * some compilers will throw warnings when passing this object into
      * functions with variadic arguments, like printf().
      */
-    uint32_t get() const { return iv_rc; }
+    uint32_t get() const
+    {
+        return iv_rc;
+    }
 
   private:
 
diff --git a/src/isolator/hei_isolation_node.cpp b/src/isolator/hei_isolation_node.cpp
index 398960f..7d52344 100644
--- a/src/isolator/hei_isolation_node.cpp
+++ b/src/isolator/hei_isolation_node.cpp
@@ -27,7 +27,8 @@
     for (RegisterBit_t bit = 0; bit < bs->getBitLen(); bit++)
     {
         // Continue to the next bit if not active.
-        if (!bs->isBitSet(bit)) continue;
+        if (!bs->isBitSet(bit))
+            continue;
 
         // At least one active bit was found.
         o_activeAttn = true;
@@ -39,8 +40,8 @@
         {
             // This bit was driven from an attention from another register.
             // Continue down the isolation tree to look for more attentions.
-            bool attnFound = child_itr->second->analyze(i_chip, i_attnType,
-                                                        io_isoData);
+            bool attnFound =
+                child_itr->second->analyze(i_chip, i_attnType, io_isoData);
             if (!attnFound)
             {
                 // Something went wrong. There should have been an active
@@ -111,8 +112,8 @@
 void IsolationNode::pushIsolationStack() const
 {
     // Ensure this node does not already exist in cv_isolationStack.
-    auto itr = std::find(cv_isolationStack.begin(),
-                         cv_isolationStack.end(), this);
+    auto itr =
+        std::find(cv_isolationStack.begin(), cv_isolationStack.end(), this);
     HEI_ASSERT(cv_isolationStack.end() == itr);
 
     // Push to node to the stack.
diff --git a/src/isolator/hei_isolation_node.hpp b/src/isolator/hei_isolation_node.hpp
index 68e2389..a92e48e 100644
--- a/src/isolator/hei_isolation_node.hpp
+++ b/src/isolator/hei_isolation_node.hpp
@@ -42,8 +42,7 @@
      * @param i_hwReg A reference to the HardwareRegister targeted for
      *                isolation.
      */
-    explicit IsolationNode(const HardwareRegister& i_hwReg) :
-        iv_hwReg(i_hwReg)
+    explicit IsolationNode(const HardwareRegister& i_hwReg) : iv_hwReg(i_hwReg)
     {}
 
     /** @brief Destructor. */
@@ -182,8 +181,10 @@
     void pushIsolationStack() const;
 
     /** @brief Pops the top node off of cv_isolationStack. */
-    void popIsolationStack() const { cv_isolationStack.pop_back(); }
-
+    void popIsolationStack() const
+    {
+        cv_isolationStack.pop_back();
+    }
 };
 
 } // end namespace libhei
diff --git a/src/isolator/hei_signature.hpp b/src/isolator/hei_signature.hpp
index 79d4ed3..23b3f7c 100644
--- a/src/isolator/hei_signature.hpp
+++ b/src/isolator/hei_signature.hpp
@@ -28,8 +28,9 @@
     Signature(const Chip& i_chip, RegisterId_t i_id,
               RegisterInstance_t i_instance, RegisterBit_t i_bit,
               AttentionType_t i_attnType) :
-        iv_chip(i_chip), iv_id(i_id), iv_instance(i_instance),
-        iv_bit(i_bit), iv_attnType(i_attnType)
+        iv_chip(i_chip),
+        iv_id(i_id), iv_instance(i_instance), iv_bit(i_bit),
+        iv_attnType(i_attnType)
     {}
 
     /** @brief Destructor. */
@@ -52,19 +53,34 @@
   public: // Member functions
 
     /** @return The chip containing this register. */
-    const Chip& getChip() const { return iv_chip; }
+    const Chip& getChip() const
+    {
+        return iv_chip;
+    }
 
     /** @return The register ID. */
-    RegisterId_t getId() const { return iv_id; }
+    RegisterId_t getId() const
+    {
+        return iv_id;
+    }
 
     /** @return The instance of this register. */
-    RegisterInstance_t getInstance() const { return iv_instance; }
+    RegisterInstance_t getInstance() const
+    {
+        return iv_instance;
+    }
 
     /** @return The target bit within this register. */
-    RegisterBit_t getBit() const { return iv_bit; }
+    RegisterBit_t getBit() const
+    {
+        return iv_bit;
+    }
 
     /** @return The attention type reported by this bit. */
-    AttentionType_t getAttnType() const { return iv_attnType; }
+    AttentionType_t getAttnType() const
+    {
+        return iv_attnType;
+    }
 };
 
 } // end namespace libhei
diff --git a/src/register/hei_hardware_register.cpp b/src/register/hei_hardware_register.cpp
index 2337e4e..35883d2 100755
--- a/src/register/hei_hardware_register.cpp
+++ b/src/register/hei_hardware_register.cpp
@@ -132,8 +132,8 @@
     size_t sz_buffer = BitString::getMinBytes(bs.getBitLen());
 
     // Write to this register to hardware.
-    rc = registerWrite(i_chip.getChip(), bs.getBufAddr(),
-                       sz_buffer, getRegisterType(), getAddress());
+    rc = registerWrite(i_chip.getChip(), bs.getBufAddr(), sz_buffer,
+                       getRegisterType(), getAddress());
 
     if (RC_SUCCESS == rc)
     {
@@ -176,7 +176,7 @@
 //------------------------------------------------------------------------------
 
 BitString& HardwareRegister::Cache::access(const Chip& i_chip,
-                                            const HardwareRegister * i_hwReg)
+                                           const HardwareRegister * i_hwReg)
 {
     // If the entry does not exist, create a new entry.
     if (!query(i_chip, i_hwReg))
diff --git a/src/register/hei_hardware_register.hpp b/src/register/hei_hardware_register.hpp
index 059a9cf..6d2efe5 100755
--- a/src/register/hei_hardware_register.hpp
+++ b/src/register/hei_hardware_register.hpp
@@ -53,8 +53,9 @@
     HardwareRegister(ChipType_t i_chipType, RegisterId_t i_id,
                      RegisterInstance_t i_instance,
                      RegisterAccessLevel_t i_accessLevel) :
-        Register(), iv_chipType(i_chipType), iv_id(i_id),
-        iv_instance(i_instance), iv_accessLevel(i_accessLevel)
+        Register(),
+        iv_chipType(i_chipType), iv_id(i_id), iv_instance(i_instance),
+        iv_accessLevel(i_accessLevel)
     {}
 
   private: // Instance variables
@@ -77,16 +78,28 @@
   public: // Accessor functions
 
     /** @return The type of chip associated with this register. */
-    ChipType_t getChipType() const { return iv_chipType; }
+    ChipType_t getChipType() const
+    {
+        return iv_chipType;
+    }
 
     /* @return The unique ID for this register. */
-    RegisterId_t getId() const { return iv_id; }
+    RegisterId_t getId() const
+    {
+        return iv_id;
+    }
 
     /* @return The instance of this register. */
-    RegisterInstance_t getInstance() const { return iv_instance; }
+    RegisterInstance_t getInstance() const
+    {
+        return iv_instance;
+    }
 
     /** @return The hardware access level of this register. */
-    RegisterAccessLevel_t getAccessLevel() const { return iv_accessLevel; }
+    RegisterAccessLevel_t getAccessLevel() const
+    {
+        return iv_accessLevel;
+    }
 
     // NOTE: The following are determined by child classes.
 
@@ -223,8 +236,7 @@
          * @param  i_hwReg The target register.
          * @return True if the entry exists, false otherwise.
          */
-        bool query(const Chip& i_chip,
-                   const HardwareRegister* i_hwReg) const;
+        bool query(const Chip& i_chip, const HardwareRegister* i_hwReg) const;
 
         /**
          * @brief  Returns the data buffer for the given chip and register.
@@ -234,8 +246,7 @@
          * @note   If an entry does not exist in the cache, an entry will be
          *         created and the BitString will be initialized to 0.
          */
-        BitString& access(const Chip& i_chip,
-                           const HardwareRegister* i_hwReg);
+        BitString& access(const Chip& i_chip, const HardwareRegister* i_hwReg);
 
         /** @brief Flushes entire contents from cache. */
         void flush();
@@ -273,7 +284,10 @@
   public: // Register cache management functions.
 
     /** @brief Flushes the entire register cache. */
-    static void flushAll() { cv_cache.flush(); }
+    static void flushAll()
+    {
+        cv_cache.flush();
+    }
 
     /**
      * @brief Flushes this register from the cache.
diff --git a/src/register/hei_scom_register.hpp b/src/register/hei_scom_register.hpp
index d056475..9e04b0a 100644
--- a/src/register/hei_scom_register.hpp
+++ b/src/register/hei_scom_register.hpp
@@ -60,7 +60,10 @@
   public: // Accessor functions
 
     /** Function overloaded from parent HardwareRegister class. */
-    RegisterType_t getRegisterType() const { return REG_TYPE_SCOM; }
+    RegisterType_t getRegisterType() const
+    {
+        return REG_TYPE_SCOM;
+    }
 
     /** Function overloaded from parent HardwareRegister class. */
     RegisterAddress_t getAddress() const
@@ -69,7 +72,10 @@
     }
 
     /** Function overloaded from parent HardwareRegister class. */
-    size_t getSize() const { return 8; }
+    size_t getSize() const
+    {
+        return 8;
+    }
 
   private: // Instance variables
 
@@ -139,7 +145,10 @@
   public: // Accessor functions
 
     /** Function overloaded from parent HardwareRegister class. */
-    RegisterType_t getRegisterType() const { return REG_TYPE_ID_SCOM; }
+    RegisterType_t getRegisterType() const
+    {
+        return REG_TYPE_ID_SCOM;
+    }
 
     /** Function overloaded from parent HardwareRegister class. */
     RegisterAddress_t getAddress() const
@@ -148,7 +157,10 @@
     }
 
     /** Function overloaded from parent HardwareRegister class. */
-    size_t getSize() const { return 8; } // See note in class documentation.
+    size_t getSize() const
+    {
+        return 8; // See note in class documentation.
+    }
 
   private: // Instance variables
 
diff --git a/src/util/hei_bit_string.cpp b/src/util/hei_bit_string.cpp
index b863829..39a585c 100755
--- a/src/util/hei_bit_string.cpp
+++ b/src/util/hei_bit_string.cpp
@@ -101,8 +101,12 @@
     // Get the bit fields on either side of the target bit field.
     uint64_t bf_l_shift = UINT8_BIT_LEN - bf_l_len;
     uint64_t bf_r_shift = UINT8_BIT_LEN - bf_r_len;
-    uint8_t bf_l = *relAddr; bf_l >>= bf_l_shift; bf_l <<= bf_l_shift;
-    uint8_t bf_r = *relAddr; bf_r <<= bf_r_shift; bf_r >>= bf_r_shift;
+    uint8_t bf_l = *relAddr;
+    bf_l >>= bf_l_shift;
+    bf_l <<= bf_l_shift;
+    uint8_t bf_r = *relAddr;
+    bf_r <<= bf_r_shift;
+    bf_r >>= bf_r_shift;
 
     // Combine all three parts of the byte and write it out to memory.
     *relAddr = bf_l | bf | bf_r;
@@ -269,7 +273,8 @@
 
     for (uint64_t i = i_pos; i < endPos; i++)
     {
-        if (isBitSet(i)) count++;
+        if (isBitSet(i))
+            count++;
     }
 
     return count;
@@ -410,7 +415,10 @@
     BitString(i_bs.getBitLen(), nullptr)
 {
     initBuffer();
-    if (!i_bs.isZero()) setString(i_bs);
+    if (!i_bs.isZero())
+    {
+        setString(i_bs);
+    }
 }
 
 //------------------------------------------------------------------------------
@@ -419,7 +427,10 @@
     BitString(i_bsb.getBitLen(), nullptr)
 {
     initBuffer();
-    if (!i_bsb.isZero()) setString(i_bsb);
+    if (!i_bsb.isZero())
+    {
+        setString(i_bsb);
+    }
 }
 
 //------------------------------------------------------------------------------
@@ -433,7 +444,10 @@
 
     setBitLen(i_bs.getBitLen());
     initBuffer();
-    if (!i_bs.isZero()) setString(i_bs);
+    if (!i_bs.isZero())
+    {
+        setString(i_bs);
+    }
 
     return *this;
 }
@@ -451,7 +465,10 @@
 
         setBitLen(i_bsb.getBitLen());
         initBuffer();
-        if (!i_bsb.isZero()) setString(i_bsb);
+        if (!i_bsb.isZero())
+        {
+            setString(i_bsb);
+        }
     }
 
     return *this;
diff --git a/src/util/hei_bit_string.hpp b/src/util/hei_bit_string.hpp
index a227ffc..6229441 100755
--- a/src/util/hei_bit_string.hpp
+++ b/src/util/hei_bit_string.hpp
@@ -84,11 +84,17 @@
     virtual ~BitString() {}
 
     /** @return The number of bits in the bit string buffer. */
-    uint64_t getBitLen() const { return iv_bitLen; }
+    uint64_t getBitLen() const
+    {
+        return iv_bitLen;
+    }
 
     /** @return The address of the bit string buffer. Note that this may
      *          return nullptr. */
-    void* getBufAddr() const { return iv_bufAddr; }
+    void* getBufAddr() const
+    {
+        return iv_bufAddr;
+    }
 
     /**
      * @param i_bitLen The number of bits for a bit string.
@@ -175,20 +181,32 @@
      * @param i_pos The target position.
      * @pre   i_pos < getBitLen().
      */
-    void setBit(uint64_t i_pos) { setFieldRight(i_pos, 1, 1); }
+    void setBit(uint64_t i_pos)
+    {
+        setFieldRight(i_pos, 1, 1);
+    }
 
     /** @brief Sets the entire bit string to 1's. */
-    void setAll() { setPattern(UINT64_MAX); }
+    void setAll()
+    {
+        setPattern(UINT64_MAX);
+    }
 
     /**
      * @brief Sets the target position to 0.
      * @param i_pos The target position.
      * @pre   i_pos < getBitLen().
      */
-    void clearBit(uint64_t i_pos) { setFieldRight(i_pos, 1, 0); }
+    void clearBit(uint64_t i_pos)
+    {
+        setFieldRight(i_pos, 1, 0);
+    }
 
     /** @brief Sets the entire bit string to 0's. */
-    void clearAll() { setPattern(0); }
+    void clearAll()
+    {
+        setPattern(0);
+    }
 
     /**
      * @brief Sets a range within the string based on the pattern and length
@@ -306,10 +324,16 @@
     uint64_t getSetCount(uint64_t i_pos, uint64_t i_len) const;
 
     /** @return The number of bits that are set(1) in this string. */
-    uint64_t getSetCount() const { return getSetCount(0, getBitLen()); }
+    uint64_t getSetCount() const
+    {
+        return getSetCount(0, getBitLen());
+    }
 
     /** @brief Comparison operator. */
-    bool operator==(const BitString& i_str) const { return isEqual(i_str); }
+    bool operator==(const BitString& i_str) const
+    {
+        return isEqual(i_str);
+    }
 
     /** @brief Bitwise NOT operator. */
     BitStringBuffer operator~() const;
@@ -357,10 +381,16 @@
      * @pre   Before calling this function, make sure you deallocate the old
      *        buffer to avoid memory leaks.
      */
-    void setBufAddr(void* i_newBufAddr) { iv_bufAddr = i_newBufAddr; }
+    void setBufAddr(void* i_newBufAddr)
+    {
+        iv_bufAddr = i_newBufAddr;
+    }
 
     /** @param i_newBitLen The new bit length of this bit string buffer. */
-    void setBitLen(uint64_t i_newBitLen) { iv_bitLen = i_newBitLen; }
+    void setBitLen(uint64_t i_newBitLen)
+    {
+        iv_bitLen = i_newBitLen;
+    }
 
   private: // functions
 
@@ -374,8 +404,7 @@
      * @pre    nullptr != getBufAddr()
      * @pre    i_absPos < getBitLen()
      */
-    uint8_t* getRelativePosition(uint64_t& o_relPos,
-                                 uint64_t  i_absPos) const;
+    uint8_t* getRelativePosition(uint64_t& o_relPos, uint64_t i_absPos) const;
 
   private: // instance variables
 
diff --git a/src/util/hei_flyweight.hpp b/src/util/hei_flyweight.hpp
index d6ce023..4aeb952 100644
--- a/src/util/hei_flyweight.hpp
+++ b/src/util/hei_flyweight.hpp
@@ -18,7 +18,10 @@
     Flyweight() = default;
 
     /** @brief Destructor. */
-    ~Flyweight() { clear(); }
+    ~Flyweight()
+    {
+        clear();
+    }
 
     /** @brief Default copy constructor. */
     Flyweight(const Flyweight&) = delete;
@@ -69,7 +72,10 @@
      */
     void clear()
     {
-        for (auto i : iv_index) { delete i; }
+        for (auto i : iv_index)
+        {
+            delete i;
+        }
         iv_index.clear();
     }
 
@@ -83,7 +89,10 @@
      * initialization. Afterwards, the extra capacity is not needed. So this
      * function will shrink the capacity to the size of the vector.
      */
-    void compact() { iv_index.shrink_to_fit(); }
+    void compact()
+    {
+        iv_index.shrink_to_fit();
+    }
 
   private:
 
diff --git a/test/flyweight_test.cpp b/test/flyweight_test.cpp
index 5d018c6..472358d 100644
--- a/test/flyweight_test.cpp
+++ b/test/flyweight_test.cpp
@@ -9,9 +9,22 @@
   public:
     Foo() = default;
     explicit Foo(int i) : iv_i(i) {}
-    int get() const { return iv_i; }
-    bool operator==(const Foo& i_r) const { return iv_i == i_r.iv_i; }
-    bool operator<(const Foo& i_r) const { return iv_i <  i_r.iv_i; }
+
+    int get() const
+    {
+        return iv_i;
+    }
+
+    bool operator==(const Foo& i_r) const
+    {
+        return iv_i == i_r.iv_i;
+    }
+
+    bool operator<(const Foo& i_r) const
+    {
+        return iv_i <  i_r.iv_i;
+    }
+
   private:
     int iv_i = 0;
 };