The Road to Clang-Format part 6

Whitespace: The Voyage Home

Signed-off-by: Zane Shelley <zshelle@us.ibm.com>
Change-Id: I94f8f7a5ef54e149991daeaf798eaf6a0c8ba59c
diff --git a/src/chip_data/hei_chip_data_stream.hpp b/src/chip_data/hei_chip_data_stream.hpp
old mode 100755
new mode 100644
diff --git a/src/hei_return_code.hpp b/src/hei_return_code.hpp
index 283bec6..4be0713 100644
--- a/src/hei_return_code.hpp
+++ b/src/hei_return_code.hpp
@@ -63,6 +63,8 @@
     uint32_t iv_rc; ///< return code value
 };
 
+// clang-format off
+
 /** Function returned successfully. */
 static constexpr ReturnCode RC_SUCCESS                 = ReturnCode();
 
@@ -80,4 +82,6 @@
  *  path failed and the returned data is undefined and should not be used. */
 static constexpr ReturnCode RC_REG_ACCESS_FAILURE      = ReturnCode(0x00000004);
 
+// clang-format on
+
 } // end namespace libhei
diff --git a/src/hei_types.hpp b/src/hei_types.hpp
index 698d811..df3f2ff 100644
--- a/src/hei_types.hpp
+++ b/src/hei_types.hpp
@@ -152,6 +152,8 @@
  */
 enum AttentionType_t : uint8_t
 {
+    // clang-format off
+
     /** System checkstop hardware attention. Unrecoverable, fatal error. */
     ATTN_TYPE_CHECKSTOP   = 1,
 
@@ -169,6 +171,8 @@
 
     /** Software or hardware event requiring action by the host firmware. */
     ATTN_TYPE_HOST_ATTN   = 5,
+
+    // clang-format on
 };
 
 } // end namespace libhei
diff --git a/src/isolator/hei_isolator.cpp b/src/isolator/hei_isolator.cpp
index a4c032d..759eb13 100644
--- a/src/isolator/hei_isolator.cpp
+++ b/src/isolator/hei_isolator.cpp
@@ -20,7 +20,7 @@
     HEI_INF("Isolator::initialize(%p,%lu,%d)", i_buffer, i_bufferSize,
             i_forceInit);
 
-    Flyweight<ScomRegister>&   sfw = Flyweight<ScomRegister>::getSingleton();
+    Flyweight<ScomRegister>& sfw   = Flyweight<ScomRegister>::getSingleton();
     Flyweight<IdScomRegister>& ifw = Flyweight<IdScomRegister>::getSingleton();
 
     sfw.get(ScomRegister{CHIP_TYPE_INVALID, REG_ID_INVALID, REG_INST_DEFAULT,
diff --git a/src/isolator/hei_signature.hpp b/src/isolator/hei_signature.hpp
index fbacfc4..844aad6 100644
--- a/src/isolator/hei_signature.hpp
+++ b/src/isolator/hei_signature.hpp
@@ -41,12 +41,12 @@
     /** @brief Assignment operator. */
     Signature& operator=(const Signature&) = default;
 
-  private: // Instance variables.
-    Chip               iv_chip;     ///< Chip containing this register.
-    RegisterId_t       iv_id;       ///< Register ID.
+  private:
+    Chip iv_chip;                   ///< Chip containing this register.
+    RegisterId_t iv_id;             ///< Register ID.
     RegisterInstance_t iv_instance; ///< Instance of this register.
-    RegisterBit_t      iv_bit;      ///< Target bit within this register.
-    AttentionType_t    iv_attnType; ///< Attention type reported by this bit.
+    RegisterBit_t iv_bit;           ///< Target bit within this register.
+    AttentionType_t iv_attnType;    ///< Attention type reported by this bit.
 
   public: // Member functions
     /** @return The chip containing this register. */
diff --git a/src/register/hei_hardware_register.cpp b/src/register/hei_hardware_register.cpp
old mode 100755
new mode 100644
index 6b66eb9..7df5a3e
--- a/src/register/hei_hardware_register.cpp
+++ b/src/register/hei_hardware_register.cpp
@@ -33,8 +33,8 @@
     // will be created in the cache, if it does not exist, when the cache is
     // accessed below.
 
-    if ((REG_ACCESS_NONE != getAccessLevel()) &&
-        (REG_ACCESS_WO   != getAccessLevel()))
+    auto al = getAccessLevel();
+    if ((REG_ACCESS_NONE != al) && (REG_ACCESS_WO != al))
     {
         read(i_chip);
     }
@@ -55,8 +55,8 @@
     // will be created in the cache, if it does not exist, when the cache is
     // accessed below.
 
-    if ((REG_ACCESS_NONE != getAccessLevel()) &&
-        (REG_ACCESS_WO   != getAccessLevel()))
+    auto al = getAccessLevel();
+    if ((REG_ACCESS_NONE != al) && (REG_ACCESS_WO != al))
     {
         read(i_chip);
     }
@@ -78,8 +78,8 @@
     if (i_force || !queryCache(i_chip))
     {
         // This register must be readable.
-        HEI_ASSERT((REG_ACCESS_NONE != getAccessLevel()) &&
-                   (REG_ACCESS_WO   != getAccessLevel()));
+        auto al = getAccessLevel();
+        HEI_ASSERT((REG_ACCESS_NONE != al) && (REG_ACCESS_WO != al));
 
         // Get the buffer from the register cache.
         BitString& bs = accessCache(i_chip);
@@ -119,8 +119,8 @@
     verifyAccessorChip(i_chip);
 
     // This register must be writable.
-    HEI_ASSERT((REG_ACCESS_NONE != getAccessLevel()) &&
-               (REG_ACCESS_RO   != getAccessLevel()));
+    auto al = getAccessLevel();
+    HEI_ASSERT((REG_ACCESS_NONE != al) && (REG_ACCESS_RO != al));
 
     // An entry for this register must exist in the cache.
     HEI_ASSERT(queryCache(i_chip));
@@ -182,6 +182,7 @@
     if (!query(i_chip, i_hwReg))
     {
         BitString* bs = new BitStringBuffer{i_hwReg->getSize() * 8};
+
         iv_cache[i_chip][i_hwReg] = bs;
     }
 
diff --git a/src/register/hei_hardware_register.hpp b/src/register/hei_hardware_register.hpp
old mode 100755
new mode 100644
index 914e0f8..f79191d
--- a/src/register/hei_hardware_register.hpp
+++ b/src/register/hei_hardware_register.hpp
@@ -114,8 +114,8 @@
     {
         // Comparing register type, chip type, and address should be sufficient.
         return (getRegisterType() == i_r.getRegisterType()) &&
-               (getChipType()     == i_r.getChipType()    ) &&
-               (getAddress()      == i_r.getAddress()     );
+               (getChipType() == i_r.getChipType()) &&
+               (getAddress() == i_r.getAddress());
     }
 
     /** @brief Less than operator. */
diff --git a/src/register/hei_register.hpp b/src/register/hei_register.hpp
old mode 100755
new mode 100644
diff --git a/src/util/hei_bit_string.cpp b/src/util/hei_bit_string.cpp
old mode 100755
new mode 100644
index dc72a5b..b1780ca
--- a/src/util/hei_bit_string.cpp
+++ b/src/util/hei_bit_string.cpp
@@ -30,7 +30,7 @@
 
     // Get the relative address of this byte and the relative starting position
     // within the byte.
-    uint64_t relPos = 0;
+    uint64_t relPos  = 0;
     uint8_t* relAddr = getRelativePosition(relPos, i_pos);
 
     // Get the length of the target bit field within this byte and the length of
@@ -74,7 +74,7 @@
 
     // Get the relative address of this byte and the relative starting position
     // within the byte.
-    uint64_t relPos = 0;
+    uint64_t relPos  = 0;
     uint8_t* relAddr = getRelativePosition(relPos, i_pos);
 
     // Get the length of the target bit field within this byte and the length of
@@ -101,9 +101,11 @@
     // 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;
@@ -176,7 +178,7 @@
     // the data in the correct direction to prevent overlapping.
     uint64_t sRelOffset = 0, dRelOffset = 0;
     uint8_t* sRelAddr = i_sStr.getRelativePosition(sRelOffset, i_sPos);
-    uint8_t* dRelAddr =        getRelativePosition(dRelOffset, i_dPos);
+    uint8_t* dRelAddr = getRelativePosition(dRelOffset, i_dPos);
 
     // Copy the data.
     if ((dRelAddr == sRelAddr) && (dRelOffset == sRelOffset))
@@ -203,7 +205,7 @@
         // Start with the last chunk and work backwards.
         for (int32_t pos = lastPos; 0 <= pos; pos -= UINT64_BIT_LEN)
         {
-            uint64_t len = std::min(actLen - pos, UINT64_BIT_LEN);
+            uint64_t len   = std::min(actLen - pos, UINT64_BIT_LEN);
             uint64_t value = i_sStr.getFieldRight(i_sPos + pos, len);
             setFieldRight(i_dPos + pos, len, value);
         }
@@ -221,7 +223,7 @@
     {
         uint64_t len = std::min(actLen - pos, UINT64_BIT_LEN);
 
-        uint64_t dVal =        getFieldRight(pos, len);
+        uint64_t dVal = getFieldRight(pos, len);
         uint64_t sVal = i_mask.getFieldRight(pos, len);
 
         setFieldRight(pos, len, dVal & ~sVal);
@@ -311,7 +313,7 @@
     {
         uint64_t len = std::min(actLen - pos, UINT64_BIT_LEN);
 
-        uint64_t dVal =      getFieldRight(pos, len);
+        uint64_t dVal = getFieldRight(pos, len);
         uint64_t sVal = i_bs.getFieldRight(pos, len);
 
         bsb.setFieldRight(pos, len, dVal & sVal);
@@ -333,7 +335,7 @@
     {
         uint64_t len = std::min(actLen - pos, UINT64_BIT_LEN);
 
-        uint64_t dVal =      getFieldRight(pos, len);
+        uint64_t dVal = getFieldRight(pos, len);
         uint64_t sVal = i_bs.getFieldRight(pos, len);
 
         bsb.setFieldRight(pos, len, dVal | sVal);
@@ -381,7 +383,7 @@
 //------------------------------------------------------------------------------
 
 uint8_t* BitString::getRelativePosition(uint64_t& o_relPos,
-                                        uint64_t  i_absPos) const
+                                        uint64_t i_absPos) const
 {
     HEI_ASSERT(nullptr != getBufAddr()); // must to have a valid address
     HEI_ASSERT(i_absPos < getBitLen());  // must be a valid position
diff --git a/src/util/hei_bit_string.hpp b/src/util/hei_bit_string.hpp
old mode 100755
new mode 100644
index 80f13af..4b63906
--- a/src/util/hei_bit_string.hpp
+++ b/src/util/hei_bit_string.hpp
@@ -402,10 +402,10 @@
      */
     uint8_t* getRelativePosition(uint64_t& o_relPos, uint64_t i_absPos) const;
 
-  private: // instance variables
-    uint64_t iv_bitLen;  ///< The bit length of this buffer.
-    void*    iv_bufAddr; ///< The beginning address of this buffer.
-    uint64_t iv_offset;  ///< Start position offset
+  private:
+    uint64_t iv_bitLen; ///< The bit length of this buffer.
+    void* iv_bufAddr;   ///< The beginning address of this buffer.
+    uint64_t iv_offset; ///< Start position offset
 };
 
 //##############################################################################
diff --git a/test/bit_string_test.cpp b/test/bit_string_test.cpp
index e24a550..aaf5b90 100644
--- a/test/bit_string_test.cpp
+++ b/test/bit_string_test.cpp
@@ -5,7 +5,7 @@
 
 using namespace libhei;
 
-static constexpr uint32_t UINT8_BIT_LEN = (sizeof(uint8_t) * 8);
+static constexpr uint32_t UINT8_BIT_LEN  = (sizeof(uint8_t) * 8);
 static constexpr uint32_t UINT64_BIT_LEN = (sizeof(uint64_t) * 8);
 
 // setBit()
diff --git a/test/simulator/hei_sim_main.cpp b/test/simulator/hei_sim_main.cpp
index 58784d0..c2bb24e 100644
--- a/test/simulator/hei_sim_main.cpp
+++ b/test/simulator/hei_sim_main.cpp
@@ -4,7 +4,7 @@
 {
     using namespace libhei;
 
-    void* buffer = nullptr;
+    void* buffer     = nullptr;
     size_t sz_buffer = 0;
 
     initialize(buffer, sz_buffer);