The Road to Clang-Format part 5

Whitespace: With a Vengeance

Signed-off-by: Zane Shelley <zshelle@us.ibm.com>
Change-Id: I706a599c8c0dc159a0205c7c8cb2d3b7cbb7213f
diff --git a/src/chip_data/hei_chip_data_stream.hpp b/src/chip_data/hei_chip_data_stream.hpp
index 41cb94e..47b961b 100755
--- a/src/chip_data/hei_chip_data_stream.hpp
+++ b/src/chip_data/hei_chip_data_stream.hpp
@@ -35,7 +35,6 @@
 {
 
   private:
-
     /** iv_buffer points to the first address of the Chip Data File
         buffer.  **/
     const void* const iv_buffer;
@@ -47,7 +46,6 @@
     size_t iv_asyncOffset;
 
   public:
-
     /* Constructors */
 
     /**
@@ -83,7 +81,6 @@
     }
 
   private:
-
     /**
      *@brief Read does the copy from the buffer
      *@param o_buf       a pointer to the location to copy to
diff --git a/src/hei_chip.hpp b/src/hei_chip.hpp
index 2633eca..fbb7e6c 100644
--- a/src/hei_chip.hpp
+++ b/src/hei_chip.hpp
@@ -12,7 +12,6 @@
 class Chip
 {
   public: // Constructors, destructors, assignment, etc.
-
     Chip() = default;
 
     ~Chip() = default;
@@ -29,7 +28,6 @@
     Chip(void* i_chip, ChipType_t i_type) : iv_chip(i_chip), iv_type(i_type) {}
 
   public: // Accessors
-
     void* getChip() const
     {
         return iv_chip;
@@ -41,7 +39,6 @@
     }
 
   public: // Operators
-
     bool operator==(const Chip& r) const
     {
         return (iv_chip == r.iv_chip) && (iv_type == r.iv_type);
@@ -54,7 +51,6 @@
     }
 
   private:
-
     /**
      * The user application will provide pointers to user application objects
      * that represent chips targeted for analysis. The isolator does not know
diff --git a/src/hei_isolation_data.hpp b/src/hei_isolation_data.hpp
index 317329f..b9a3b75 100644
--- a/src/hei_isolation_data.hpp
+++ b/src/hei_isolation_data.hpp
@@ -15,7 +15,6 @@
 class IsolationData
 {
   public: // Constructors, destructor, assignment, etc.
-
     /** @brief Default constructor. */
     IsolationData() = default;
 
@@ -29,14 +28,12 @@
     IsolationData& operator=(const IsolationData&) = default;
 
   private: // Instance variables
-
     /** A list of all signatures found during isolation. */
     std::vector<Signature> iv_sigLists;
 
     // TODO: add register dump.
 
   public: // Member functions
-
     /**
      * @brief Adds a signature to the signature list.
      * @param i_signature The target signature.
diff --git a/src/hei_return_code.hpp b/src/hei_return_code.hpp
index 5ec9953..283bec6 100644
--- a/src/hei_return_code.hpp
+++ b/src/hei_return_code.hpp
@@ -8,7 +8,6 @@
 class ReturnCode
 {
   public:
-
     /**
      * @brief Constructor.
      * @param i_rc The error code value.
@@ -61,7 +60,6 @@
     }
 
   private:
-
     uint32_t iv_rc; ///< return code value
 };
 
diff --git a/src/isolator/hei_isolation_node.cpp b/src/isolator/hei_isolation_node.cpp
index 7d52344..8d67094 100644
--- a/src/isolator/hei_isolation_node.cpp
+++ b/src/isolator/hei_isolation_node.cpp
@@ -54,18 +54,18 @@
                 // io_isoData. If there are no other active attentions, the user
                 // application could use this signature to help determine, and
                 // circumvent, the isolation problem.
-                io_isoData.addSignature(Signature { i_chip, iv_hwReg.getId(),
-                                                    iv_hwReg.getInstance(),
-                                                    bit, i_attnType });
+                io_isoData.addSignature(Signature{i_chip, iv_hwReg.getId(),
+                                                  iv_hwReg.getInstance(), bit,
+                                                  i_attnType});
             }
         }
         else
         {
             // We have reached a leaf in the isolation tree. Add this bit's
             // signature to io_isoData.
-            io_isoData.addSignature(Signature { i_chip, iv_hwReg.getId(),
-                                                iv_hwReg.getInstance(),
-                                                bit, i_attnType });
+            io_isoData.addSignature(Signature{i_chip, iv_hwReg.getId(),
+                                              iv_hwReg.getInstance(), bit,
+                                              i_attnType});
         }
     }
 
@@ -105,7 +105,7 @@
 
 //------------------------------------------------------------------------------
 
-std::vector<const IsolationNode*> IsolationNode::cv_isolationStack {};
+std::vector<const IsolationNode*> IsolationNode::cv_isolationStack{};
 
 //------------------------------------------------------------------------------
 
diff --git a/src/isolator/hei_isolation_node.hpp b/src/isolator/hei_isolation_node.hpp
index a92e48e..86098fc 100644
--- a/src/isolator/hei_isolation_node.hpp
+++ b/src/isolator/hei_isolation_node.hpp
@@ -36,7 +36,6 @@
 class IsolationNode
 {
   public: // Constructors, destructor, assignment
-
     /**
      * @brief Constructor from components.
      * @param i_hwReg A reference to the HardwareRegister targeted for
@@ -49,7 +48,6 @@
     ~IsolationNode() = default;
 
   private:
-
     // This is needed to allow the flyweights to use the copy constructor, but
     // not allow it to be used in general.
     friend class Flyweight<IsolationNode>;
@@ -71,7 +69,6 @@
     IsolationNode& operator=(const IsolationNode&) = delete;
 
   private: // Instance variables
-
     /**
      * This is a reference to the HardwareRegister targeted for isolation by
      * this instance of the class. The reference is required to maintain
@@ -95,7 +92,6 @@
     std::map<RegisterBit_t, const IsolationNode*> iv_children;
 
   public: // Member functions
-
     /**
      * @brief  Finds all active attentions on this register. If an active bit is
      *         a leaf in the isolation tree, the bit's signature is added to the
@@ -143,7 +139,6 @@
     void addChild(RegisterBit_t i_bit, const IsolationNode* i_child);
 
   public: // Operators
-
     /** @brief Equals operator. */
     bool operator==(const IsolationNode& i_r) const
     {
@@ -159,7 +154,6 @@
     }
 
   private: // Isolation stack and supporting functions.
-
     /** When analyze() is called at the tree root, all recursive calls to
      *  analyze() will target the same chip and attention type. So we only need
      *  to keep track of the nodes that have been analyzed to avoid cyclic
diff --git a/src/isolator/hei_isolator.cpp b/src/isolator/hei_isolator.cpp
index d3cb5f2..a4c032d 100644
--- a/src/isolator/hei_isolator.cpp
+++ b/src/isolator/hei_isolator.cpp
@@ -23,17 +23,15 @@
     Flyweight<ScomRegister>&   sfw = Flyweight<ScomRegister>::getSingleton();
     Flyweight<IdScomRegister>& ifw = Flyweight<IdScomRegister>::getSingleton();
 
-    sfw.get(ScomRegister { CHIP_TYPE_INVALID, REG_ID_INVALID,
-                           REG_INST_DEFAULT, REG_ACCESS_RW, 0x01234567 });
-    sfw.get(ScomRegister { CHIP_TYPE_INVALID, REG_ID_INVALID,
-                           REG_INST_DEFAULT, REG_ACCESS_RW, 0x00112233 });
+    sfw.get(ScomRegister{CHIP_TYPE_INVALID, REG_ID_INVALID, REG_INST_DEFAULT,
+                         REG_ACCESS_RW, 0x01234567});
+    sfw.get(ScomRegister{CHIP_TYPE_INVALID, REG_ID_INVALID, REG_INST_DEFAULT,
+                         REG_ACCESS_RW, 0x00112233});
 
-    ifw.get(IdScomRegister { CHIP_TYPE_INVALID, REG_ID_INVALID,
-                             REG_INST_DEFAULT, REG_ACCESS_RW,
-                             0x0123456789abcdef });
-    ifw.get(IdScomRegister { CHIP_TYPE_INVALID, REG_ID_INVALID,
-                             REG_INST_DEFAULT, REG_ACCESS_RW,
-                             0x0011223344556677 });
+    ifw.get(IdScomRegister{CHIP_TYPE_INVALID, REG_ID_INVALID, REG_INST_DEFAULT,
+                           REG_ACCESS_RW, 0x0123456789abcdef});
+    ifw.get(IdScomRegister{CHIP_TYPE_INVALID, REG_ID_INVALID, REG_INST_DEFAULT,
+                           REG_ACCESS_RW, 0x0011223344556677});
     // END temporary code
 
     return rc;
diff --git a/src/isolator/hei_isolator.hpp b/src/isolator/hei_isolator.hpp
index e832514..d779b7b 100644
--- a/src/isolator/hei_isolator.hpp
+++ b/src/isolator/hei_isolator.hpp
@@ -29,7 +29,6 @@
 class Isolator
 {
   private: // This class cannot be instantiated. Use getSingleton() instead.
-
     /** @brief Default constructor. */
     Isolator() = default;
 
@@ -47,7 +46,6 @@
     Isolator& operator=(const Isolator&) = delete;
 
   public:
-
     /** @brief Provides access to a singleton instance of this object. */
     static Isolator& getSingleton()
     {
@@ -70,9 +68,6 @@
     /** @brief See API wrapper description in hei_main.hpp. */
     ReturnCode isolate(const std::vector<Chip>& i_chipList,
                        IsolationData& o_isoData) const;
-
-  private:
-
 }; // end class Isolator
 
 } // end namespace libhei
diff --git a/src/isolator/hei_signature.hpp b/src/isolator/hei_signature.hpp
index 23b3f7c..fbacfc4 100644
--- a/src/isolator/hei_signature.hpp
+++ b/src/isolator/hei_signature.hpp
@@ -16,7 +16,6 @@
 class Signature
 {
   public: // Constructors, destructor, assignment, etc.
-
     /**
      * @brief Constructor from components.
      * @param i_chip     The chip containing this register.
@@ -43,7 +42,6 @@
     Signature& operator=(const Signature&) = default;
 
   private: // Instance variables.
-
     Chip               iv_chip;     ///< Chip containing this register.
     RegisterId_t       iv_id;       ///< Register ID.
     RegisterInstance_t iv_instance; ///< Instance of this register.
@@ -51,7 +49,6 @@
     AttentionType_t    iv_attnType; ///< Attention type reported by this bit.
 
   public: // Member functions
-
     /** @return The chip containing this register. */
     const Chip& getChip() const
     {
diff --git a/src/register/hei_hardware_register.cpp b/src/register/hei_hardware_register.cpp
index 35883d2..6b66eb9 100755
--- a/src/register/hei_hardware_register.cpp
+++ b/src/register/hei_hardware_register.cpp
@@ -149,7 +149,7 @@
 
 //------------------------------------------------------------------------------
 
-HardwareRegister::Cache HardwareRegister::cv_cache {};
+HardwareRegister::Cache HardwareRegister::cv_cache{};
 
 //------------------------------------------------------------------------------
 
@@ -176,12 +176,12 @@
 //------------------------------------------------------------------------------
 
 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))
     {
-        BitString* bs = new BitStringBuffer { i_hwReg->getSize() * 8 };
+        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
index 6d2efe5..914e0f8 100755
--- a/src/register/hei_hardware_register.hpp
+++ b/src/register/hei_hardware_register.hpp
@@ -37,12 +37,10 @@
 class HardwareRegister : public Register
 {
   public:
-
     /** @brief Pure virtual destructor. */
     virtual ~HardwareRegister() = 0;
 
   protected:
-
     /**
      * @brief Constructor from components.
      * @param i_chipType    Type of chip associated with this register.
@@ -59,7 +57,6 @@
     {}
 
   private: // Instance variables
-
     /** The type of chip associated with register. */
     const ChipType_t iv_chipType;
 
@@ -76,7 +73,6 @@
     const RegisterAccessLevel_t iv_accessLevel;
 
   public: // Accessor functions
-
     /** @return The type of chip associated with this register. */
     ChipType_t getChipType() const
     {
@@ -113,7 +109,6 @@
     virtual size_t getSize() const = 0;
 
   public: // Operators
-
     /** @brief Equals operator. */
     bool operator==(const HardwareRegister& i_r) const
     {
@@ -147,7 +142,6 @@
     }
 
   public:
-
     /** Function overloaded from parent Register class. */
     const BitString* getBitString(const Chip& i_chip) const;
 
@@ -185,7 +179,6 @@
 #endif // __HEI_READ_ONLY
 
   protected:
-
     /**
      * @brief  Provides access to this register's BitString.
      *
@@ -198,7 +191,6 @@
     BitString& accessBitString(const Chip& i_chip);
 
   private: // Hardware accessor management functions.
-
     /** @brief Asserts this register belongs on the target accessor chip. */
     void verifyAccessorChip(const Chip& i_chip) const
     {
@@ -206,7 +198,6 @@
     }
 
   private: // Register cache class variable
-
     /**
      * @brief Caches the contents of registers read from hardware.
      *
@@ -217,7 +208,6 @@
     class Cache
     {
       public:
-
         /** @brief Default constructor. */
         Cache() = default;
 
@@ -259,7 +249,6 @@
         void flush(const Chip& i_chip, const HardwareRegister* i_hwReg);
 
       private:
-
         /**
          * @brief Stores a BitStringBuffer for each HardwareRegister per Chip.
          *
@@ -282,7 +271,6 @@
     static Cache cv_cache;
 
   public: // Register cache management functions.
-
     /** @brief Flushes the entire register cache. */
     static void flushAll()
     {
@@ -299,7 +287,6 @@
     }
 
   private: // Register cache management functions.
-
     /**
      * @param  i_chip  The target chip in which this register belongs.
      * @return True if an entry for this register exist in this cache.
diff --git a/src/register/hei_register.hpp b/src/register/hei_register.hpp
index 4b5c5fe..5246a5a 100755
--- a/src/register/hei_register.hpp
+++ b/src/register/hei_register.hpp
@@ -28,7 +28,6 @@
 class Register
 {
   public:
-
     /** @brief Pure virtual destructor. */
     virtual ~Register() = 0;
 
diff --git a/src/register/hei_scom_register.hpp b/src/register/hei_scom_register.hpp
index 9e04b0a..3723a58 100644
--- a/src/register/hei_scom_register.hpp
+++ b/src/register/hei_scom_register.hpp
@@ -16,7 +16,6 @@
 class ScomRegister : public HardwareRegister
 {
   public: // Constructor, destructors, assignment, etc.
-
     /**
      * @brief Constructor from components.
      * @param i_chipType    Type of chip associated with this register.
@@ -36,7 +35,6 @@
     ~ScomRegister() = default;
 
   private:
-
     // This is needed to allow the flyweights to use the copy constructor, but
     // not allow it to be used in general.
     friend class Flyweight<ScomRegister>;
@@ -58,7 +56,6 @@
     ScomRegister& operator=(const ScomRegister&) = delete;
 
   public: // Accessor functions
-
     /** Function overloaded from parent HardwareRegister class. */
     RegisterType_t getRegisterType() const
     {
@@ -78,7 +75,6 @@
     }
 
   private: // Instance variables
-
     /** This register's address. */
     const uint32_t iv_address;
 
@@ -101,7 +97,6 @@
 class IdScomRegister : public HardwareRegister
 {
   public: // Constructor, destructors, assignment, etc.
-
     /**
      * @brief Constructor from components.
      * @param i_chipType    Type of chip associated with this register.
@@ -121,7 +116,6 @@
     ~IdScomRegister() = default;
 
   private:
-
     // This is needed to allow the flyweights to use the copy constructor, but
     // not allow it to be used in general.
     friend class Flyweight<IdScomRegister>;
@@ -143,7 +137,6 @@
     IdScomRegister& operator=(const IdScomRegister&) = delete;
 
   public: // Accessor functions
-
     /** Function overloaded from parent HardwareRegister class. */
     RegisterType_t getRegisterType() const
     {
@@ -163,7 +156,6 @@
     }
 
   private: // Instance variables
-
     /** This register's address. */
     const uint64_t iv_address;
 
diff --git a/src/util/hei_bit_string.cpp b/src/util/hei_bit_string.cpp
index 39a585c..dc72a5b 100755
--- a/src/util/hei_bit_string.cpp
+++ b/src/util/hei_bit_string.cpp
@@ -136,7 +136,7 @@
     // could be used in the constructor of BitStringBuffer, which could causes
     // an infinite loop.
     uint8_t a[sizeof(i_pattern)] = {};
-    BitString bs { sizeof(i_pattern) * 8, a };
+    BitString bs{sizeof(i_pattern) * 8, a};
     bs.setFieldRight(0, i_pLen, i_pattern);
 
     // Iterate the range in chunks the size of i_pLen.
@@ -351,7 +351,7 @@
     if (i_shift < getBitLen())
     {
         // bso overlays bsb, containing the shifted offset.
-        BitString bso (bsb.getBitLen() - i_shift, bsb.getBufAddr(), i_shift);
+        BitString bso(bsb.getBitLen() - i_shift, bsb.getBufAddr(), i_shift);
 
         // Copy this into bso.
         bso.setString(*this);
@@ -369,8 +369,7 @@
     if (i_shift < getBitLen())
     {
         // bso overlays *this, containing the shifted offset.
-        BitString bso (this->getBitLen() - i_shift, this->getBufAddr(),
-                        i_shift);
+        BitString bso(this->getBitLen() - i_shift, this->getBufAddr(), i_shift);
 
         // Copy bso into bsb.
         bsb.setString(bso);
@@ -406,7 +405,7 @@
 
 BitStringBuffer::~BitStringBuffer()
 {
-    delete [] (uint8_t*)getBufAddr();
+    delete[](uint8_t*) getBufAddr();
 }
 
 //------------------------------------------------------------------------------
@@ -439,7 +438,7 @@
 {
     // The initBuffer() function will deallocate the buffer as well, however we
     // also need to deallocate the buffer here before we set the length.
-    delete [] (uint8_t*)getBufAddr();
+    delete[](uint8_t*) getBufAddr();
     setBufAddr(nullptr);
 
     setBitLen(i_bs.getBitLen());
@@ -460,7 +459,7 @@
     {
         // The initBuffer() function will deallocate the buffer as well, however
         // we also need to deallocate the buffer here before we set the length.
-        delete [] (uint8_t*)getBufAddr();
+        delete[](uint8_t*) getBufAddr();
         setBufAddr(nullptr);
 
         setBitLen(i_bsb.getBitLen());
@@ -479,10 +478,10 @@
 void BitStringBuffer::initBuffer()
 {
     // Deallocate the current buffer.
-    delete [] (uint8_t*)getBufAddr();
+    delete[](uint8_t*) getBufAddr();
 
     // create new buffer, initialized to 0's
-    setBufAddr(new uint8_t[ getMinBytes(getBitLen()) ]());
+    setBufAddr(new uint8_t[getMinBytes(getBitLen())]());
 }
 
 } // end namespace libhei
diff --git a/src/util/hei_bit_string.hpp b/src/util/hei_bit_string.hpp
index 6229441..80f13af 100755
--- a/src/util/hei_bit_string.hpp
+++ b/src/util/hei_bit_string.hpp
@@ -59,12 +59,10 @@
 class BitString
 {
   private: // constants
-
     static const uint64_t UINT64_BIT_LEN;
     static const uint64_t UINT8_BIT_LEN;
 
   public: // functions
-
     /**
      * @brief Constructor
      * @param i_bitLen  The number of bits in the bit string.
@@ -375,7 +373,6 @@
     BitString(const BitStringBuffer& i_bsb) = delete;
 
   protected: // functions
-
     /**
      * @param i_newBufAddr The starting address of the new bit string buffer.
      * @pre   Before calling this function, make sure you deallocate the old
@@ -393,7 +390,6 @@
     }
 
   private: // functions
-
     /**
      * @brief  Given a bit position within the bit string, this function returns
      *         the address that contains the bit position and the bit position
@@ -407,7 +403,6 @@
     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
@@ -425,7 +420,6 @@
 class BitStringBuffer : public BitString
 {
   public: // functions
-
     /**
      * @brief Constructor
      * @param i_bitLen Number of bits in the string.
@@ -448,7 +442,6 @@
     BitStringBuffer& operator=(const BitStringBuffer& i_bsb);
 
   private: // functions
-
     /** @brief Deallocates the old buffer, if needed, and initializes the new
      *         buffer. */
     void initBuffer();
diff --git a/src/util/hei_flyweight.hpp b/src/util/hei_flyweight.hpp
index 4aeb952..437dcad 100644
--- a/src/util/hei_flyweight.hpp
+++ b/src/util/hei_flyweight.hpp
@@ -13,7 +13,6 @@
 class Flyweight
 {
   private: // This class cannot be instantiated. Use getSingleton() instead.
-
     /** @brief Default constructor. */
     Flyweight() = default;
 
@@ -30,7 +29,6 @@
     Flyweight& operator=(const Flyweight&) = delete;
 
   public:
-
     /** @brief Provides access to a singleton instance of this object. */
     static Flyweight& getSingleton()
     {
@@ -58,7 +56,7 @@
         if (iv_index.end() == itr || !(i_entry == *(*itr)))
         {
             // Create a new entry and store the pointer in the sorted index.
-            itr = iv_index.insert(itr, new T { i_entry });
+            itr = iv_index.insert(itr, new T{i_entry});
         }
 
         // Return a reference to this entry in the factory.
@@ -95,7 +93,6 @@
     }
 
   private:
-
     /**
      * Each new T is allocated on the memory heap and a pointer to each of those
      * objects is stored in this vector. The vector will not contain duplicates
diff --git a/test/flyweight_test.cpp b/test/flyweight_test.cpp
index 472358d..139d7c1 100644
--- a/test/flyweight_test.cpp
+++ b/test/flyweight_test.cpp
@@ -22,7 +22,7 @@
 
     bool operator<(const Foo& i_r) const
     {
-        return iv_i <  i_r.iv_i;
+        return iv_i < i_r.iv_i;
     }
 
   private:
@@ -31,7 +31,7 @@
 
 Foo& addFoo(int i)
 {
-    return Flyweight<Foo>::getSingleton().get(Foo { i });
+    return Flyweight<Foo>::getSingleton().get(Foo{i});
 }
 
 TEST(FlyweightTest, TestSet1)
diff --git a/test/hei_user_defines.hpp b/test/hei_user_defines.hpp
index 2ba5b8b..c84981b 100644
--- a/test/hei_user_defines.hpp
+++ b/test/hei_user_defines.hpp
@@ -9,16 +9,16 @@
 #include <assert.h>
 #include <stdio.h>
 
-#define HEI_INF(...) \
-    { \
-      printf("I> " __VA_ARGS__); \
-      printf("\n"); \
+#define HEI_INF(...)                                                           \
+    {                                                                          \
+        printf("I> " __VA_ARGS__);                                             \
+        printf("\n");                                                          \
     }
 
-#define HEI_ERR(...) \
-    { \
-      printf("E> " __VA_ARGS__); \
-      printf("\n"); \
+#define HEI_ERR(...)                                                           \
+    {                                                                          \
+        printf("E> " __VA_ARGS__);                                             \
+        printf("\n");                                                          \
     }
 
 #define HEI_ASSERT(expression) assert(expression);