clang-format: re-format for clang-18
clang-format-18 isn't compatible with the clang-format-17 output, so we
need to reformat the code with the latest version. The way clang-18
handles lambda formatting also changed, so we have made changes to the
organization default style format to better handle lambda formatting.
See I5e08687e696dd240402a2780158664b7113def0e for updated style.
See Iea0776aaa7edd483fa395e23de25ebf5a6288f71 for clang-18 enablement.
Change-Id: I619fdc10331708d0d65b154a6f345ab769722e8a
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/.clang-format b/.clang-format
index d43e884..28e3328 100644
--- a/.clang-format
+++ b/.clang-format
@@ -87,7 +87,7 @@
IndentWrappedFunctionNames: true
InsertNewlineAtEOF: true
KeepEmptyLinesAtTheStartOfBlocks: false
-LambdaBodyIndentation: OuterScope
+LambdaBodyIndentation: Signature
LineEnding: LF
MacroBlockBegin: ''
MacroBlockEnd: ''
@@ -98,13 +98,14 @@
ObjCSpaceBeforeProtocolList: true
PackConstructorInitializers: BinPack
PenaltyBreakAssignment: 25
-PenaltyBreakBeforeFirstCallParameter: 19
+PenaltyBreakBeforeFirstCallParameter: 50
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
+PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
-PenaltyIndentedWhitespace: 0
+PenaltyIndentedWhitespace: 1
PointerAlignment: Left
QualifierAlignment: Left
ReferenceAlignment: Left
diff --git a/src/chip_data/hei_chip_data.cpp b/src/chip_data/hei_chip_data.cpp
index b37eb58..6a2508e 100644
--- a/src/chip_data/hei_chip_data.cpp
+++ b/src/chip_data/hei_chip_data.cpp
@@ -284,8 +284,8 @@
HEI_ASSERT(0 != numIsoRules || 0 == numChildNodes);
// Allocate memory for this isolation node.
- auto isoNode = std::make_shared<IsolationNode>(nodeId, nodeInst,
- regType);
+ auto isoNode =
+ std::make_shared<IsolationNode>(nodeId, nodeInst, regType);
// Add capture registers.
for (unsigned int j = 0; j < numCapRegs; j++)
@@ -340,8 +340,8 @@
Instance_t childInst;
io_stream >> bit >> childId >> childInst;
- auto ret = cMap.emplace(bit,
- IsolationNode::Key{childId, childInst});
+ auto ret =
+ cMap.emplace(bit, IsolationNode::Key{childId, childInst});
HEI_ASSERT(ret.second); // Should not have duplicate entries
}
diff --git a/src/hei_isolation_data.hpp b/src/hei_isolation_data.hpp
index e062e6d..2c30e0c 100644
--- a/src/hei_isolation_data.hpp
+++ b/src/hei_isolation_data.hpp
@@ -38,8 +38,7 @@
{
RegDumpEntry(RegisterId_t i_regId, Instance_t i_regInst,
std::shared_ptr<BitStringBuffer> i_data) :
- regId(i_regId),
- regInst(i_regInst), data(i_data)
+ regId(i_regId), regInst(i_regInst), data(i_data)
{}
RegisterId_t regId; ///< 3-byte register ID
diff --git a/src/hei_signature.hpp b/src/hei_signature.hpp
index 2e8ca41..1ce045d 100644
--- a/src/hei_signature.hpp
+++ b/src/hei_signature.hpp
@@ -35,8 +35,7 @@
*/
Signature(const Chip& i_chip, NodeId_t i_id, Instance_t i_instance,
BitPosition_t i_bit, AttentionType_t i_attnType) :
- iv_chip(i_chip),
- iv_id(i_id), iv_instance(i_instance), iv_bit(i_bit),
+ iv_chip(i_chip), iv_id(i_id), iv_instance(i_instance), iv_bit(i_bit),
iv_attnType(i_attnType)
{}
diff --git a/src/isolator/hei_isolation_node.cpp b/src/isolator/hei_isolation_node.cpp
index 099a955..9fe0ba5 100644
--- a/src/isolator/hei_isolation_node.cpp
+++ b/src/isolator/hei_isolation_node.cpp
@@ -51,8 +51,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)
{
// It is possible the child node is only intended for FFDC.
@@ -178,8 +178,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.
@@ -188,9 +188,8 @@
//------------------------------------------------------------------------------
-void IsolationNode::captureRegisters(const Chip& i_chip,
- IsolationData& io_isoData,
- BitPosition_t i_bit) const
+void IsolationNode::captureRegisters(
+ const Chip& i_chip, IsolationData& io_isoData, BitPosition_t i_bit) const
{
auto itr = iv_capRegs.find(i_bit);
if (iv_capRegs.end() != itr)
diff --git a/src/isolator/hei_isolation_node.hpp b/src/isolator/hei_isolation_node.hpp
index 5c5f8ed..1462093 100644
--- a/src/isolator/hei_isolation_node.hpp
+++ b/src/isolator/hei_isolation_node.hpp
@@ -53,8 +53,7 @@
*/
IsolationNode(NodeId_t i_id, Instance_t i_instance,
RegisterType_t i_regType) :
- iv_id(i_id),
- iv_instance(i_instance), iv_regType(i_regType)
+ iv_id(i_id), iv_instance(i_instance), iv_regType(i_regType)
{}
/** @brief Destructor. */
diff --git a/src/register/hei_hardware_register.hpp b/src/register/hei_hardware_register.hpp
index d75960c..bda6780 100644
--- a/src/register/hei_hardware_register.hpp
+++ b/src/register/hei_hardware_register.hpp
@@ -55,8 +55,7 @@
*/
HardwareRegister(RegisterId_t i_id, Instance_t i_instance,
RegisterAttributeFlags_t i_flags) :
- Register(),
- iv_id(i_id), iv_instance(i_instance), iv_flags(i_flags)
+ Register(), iv_id(i_id), iv_instance(i_instance), iv_flags(i_flags)
{}
private: // Instance variables
diff --git a/src/register/hei_scom_register.hpp b/src/register/hei_scom_register.hpp
index da0eee9..6eb5c6b 100644
--- a/src/register/hei_scom_register.hpp
+++ b/src/register/hei_scom_register.hpp
@@ -25,8 +25,7 @@
*/
ScomRegister(RegisterId_t i_id, Instance_t i_instance,
RegisterAttributeFlags_t i_flags, uint32_t i_address) :
- HardwareRegister(i_id, i_instance, i_flags),
- iv_address(i_address)
+ HardwareRegister(i_id, i_instance, i_flags), iv_address(i_address)
{}
/** @brief Destructor. */
@@ -90,8 +89,7 @@
*/
IdScomRegister(RegisterId_t i_id, Instance_t i_instance,
RegisterAttributeFlags_t i_flags, uint64_t i_address) :
- HardwareRegister(i_id, i_instance, i_flags),
- iv_address(i_address)
+ HardwareRegister(i_id, i_instance, i_flags), iv_address(i_address)
{}
/** @brief Destructor. */
diff --git a/src/util/hei_flyweight.hpp b/src/util/hei_flyweight.hpp
index 9ba9263..a81fe30 100644
--- a/src/util/hei_flyweight.hpp
+++ b/src/util/hei_flyweight.hpp
@@ -56,8 +56,8 @@
auto itr = std::lower_bound(
iv_index.begin(), iv_index.end(), newEntry,
[](const std::shared_ptr<T> a, const std::shared_ptr<T> b) {
- return *a < *b;
- });
+ return *a < *b;
+ });
// std::lower_bound() will return the first element that does not
// compare less than newEntry. So if an element is found, we must make
diff --git a/test/simulator/simulator.hpp b/test/simulator/simulator.hpp
index 58b279a..e3b6bef 100644
--- a/test/simulator/simulator.hpp
+++ b/test/simulator/simulator.hpp
@@ -126,8 +126,8 @@
void addSignature(const Signature& i_signature)
{
// First check if this entry already exists.
- auto itr = std::find(iv_expSigList.begin(), iv_expSigList.end(),
- i_signature);
+ auto itr =
+ std::find(iv_expSigList.begin(), iv_expSigList.end(), i_signature);
ASSERT_EQ(iv_expSigList.end(), itr);
// Add the new entry.