From 52d6532b110226f9b1896b42a32f4a400beaeaac Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 4 Nov 2022 14:16:35 +0000 Subject: [PATCH] style: pre-commit fixes --- include/slang/numeric/ConstantValue.h | 5 +++-- include/slang/numeric/SVInt.h | 11 ++++++----- source/ast/types/TypePrinter.cpp | 15 ++++++++++----- source/numeric/ConstantValue.cpp | 21 ++++++++++++++------- 4 files changed, 33 insertions(+), 19 deletions(-) diff --git a/include/slang/numeric/ConstantValue.h b/include/slang/numeric/ConstantValue.h index 448c18822..47e3df057 100644 --- a/include/slang/numeric/ConstantValue.h +++ b/include/slang/numeric/ConstantValue.h @@ -147,8 +147,9 @@ class SLANG_EXPORT ConstantValue { Variant& getVariant() { return value; } const Variant& getVariant() const { return value; } - std::string toString(bitwidth_t abbreviateThresholdBits = SVInt::DefaultStringAbbreviationThresholdBits, - bool exactUnknowns = false, bool useAssignmentPatterns = false) const; + std::string toString( + bitwidth_t abbreviateThresholdBits = SVInt::DefaultStringAbbreviationThresholdBits, + bool exactUnknowns = false, bool useAssignmentPatterns = false) const; size_t hash() const; [[nodiscard]] bool empty() const; diff --git a/include/slang/numeric/SVInt.h b/include/slang/numeric/SVInt.h index 2a860dcb2..c9e004933 100644 --- a/include/slang/numeric/SVInt.h +++ b/include/slang/numeric/SVInt.h @@ -296,14 +296,15 @@ class SLANG_EXPORT SVInt : SVIntStorage { static SVInt createFillZ(bitwidth_t bitWidth, bool isSigned); [[nodiscard]] size_t hash() const; - void writeTo(SmallVectorBase& buffer, LiteralBase base, bitwidth_t - abbreviateThresholdBits = DefaultStringAbbreviationThresholdBits) const; + void writeTo(SmallVectorBase& buffer, LiteralBase base, + bitwidth_t abbreviateThresholdBits = DefaultStringAbbreviationThresholdBits) const; void writeTo(SmallVectorBase& buffer, LiteralBase base, bool includeBase, bitwidth_t abbreviateThresholdBits = MAX_BITS) const; - std::string toString(bitwidth_t abbreviateThresholdBits = - DefaultStringAbbreviationThresholdBits, bool exactUnknowns = false) const; + std::string toString( + bitwidth_t abbreviateThresholdBits = DefaultStringAbbreviationThresholdBits, + bool exactUnknowns = false) const; std::string toString(LiteralBase base, bitwidth_t abbreviateThresholdBits = - DefaultStringAbbreviationThresholdBits) const; + DefaultStringAbbreviationThresholdBits) const; std::string toString(LiteralBase base, bool includeBase, bitwidth_t abbreviateThresholdBits = MAX_BITS) const; diff --git a/source/ast/types/TypePrinter.cpp b/source/ast/types/TypePrinter.cpp index 4f5fae30d..308c50c45 100644 --- a/source/ast/types/TypePrinter.cpp +++ b/source/ast/types/TypePrinter.cpp @@ -105,7 +105,8 @@ void TypePrinter::visit(const EnumType& type, string_view overrideName) { } buffer->append("}"); - if (options.skipScopedTypeNames); + if (options.skipScopedTypeNames) + ; else if (!overrideName.empty()) buffer->append(overrideName); else { @@ -147,7 +148,8 @@ void TypePrinter::visit(const PackedStructType& type, string_view overrideName) appendMembers(type); - if (options.skipScopedTypeNames); + if (options.skipScopedTypeNames) + ; else if (!overrideName.empty()) buffer->append(overrideName); else { @@ -173,7 +175,8 @@ void TypePrinter::visit(const PackedUnionType& type, string_view overrideName) { appendMembers(type); - if (options.skipScopedTypeNames); + if (options.skipScopedTypeNames) + ; else if (!overrideName.empty()) buffer->append(overrideName); else { @@ -248,7 +251,8 @@ void TypePrinter::visit(const UnpackedStructType& type, string_view overrideName buffer->append("struct"); appendMembers(type); - if (options.skipScopedTypeNames); + if (options.skipScopedTypeNames) + ; else if (!overrideName.empty()) buffer->append(overrideName); else { @@ -271,7 +275,8 @@ void TypePrinter::visit(const UnpackedUnionType& type, string_view overrideName) buffer->append("union"); appendMembers(type); - if (options.skipScopedTypeNames); + if (options.skipScopedTypeNames) + ; else if (!overrideName.empty()) buffer->append(overrideName); else { diff --git a/source/numeric/ConstantValue.cpp b/source/numeric/ConstantValue.cpp index 085d76e23..8011c04f7 100644 --- a/source/numeric/ConstantValue.cpp +++ b/source/numeric/ConstantValue.cpp @@ -40,7 +40,8 @@ std::string ConstantValue::toString(bitwidth_t abbreviateThresholdBits, bool exa FormatBuffer buffer; buffer.append(useAssignmentPatterns ? "'{"sv : "["sv); for (auto& element : arg) { - buffer.append(element.toString(abbreviateThresholdBits, exactUnknowns, useAssignmentPatterns)); + buffer.append(element.toString(abbreviateThresholdBits, exactUnknowns, + useAssignmentPatterns)); buffer.append(","); } @@ -55,12 +56,16 @@ std::string ConstantValue::toString(bitwidth_t abbreviateThresholdBits, bool exa FormatBuffer buffer; buffer.append(useAssignmentPatterns ? "'{"sv : "["sv); for (auto& [key, val] : *arg) - buffer.format("{}:{},", key.toString(abbreviateThresholdBits, exactUnknowns, useAssignmentPatterns), - val.toString(abbreviateThresholdBits, exactUnknowns, useAssignmentPatterns)); + buffer.format("{}:{},", + key.toString(abbreviateThresholdBits, exactUnknowns, + useAssignmentPatterns), + val.toString(abbreviateThresholdBits, exactUnknowns, + useAssignmentPatterns)); if (arg->defaultValue) - buffer.format("default:{}", arg->defaultValue.toString(abbreviateThresholdBits, - exactUnknowns, useAssignmentPatterns)); + buffer.format("default:{}", + arg->defaultValue.toString(abbreviateThresholdBits, exactUnknowns, + useAssignmentPatterns)); else if (!arg->empty()) buffer.pop_back(); @@ -71,7 +76,8 @@ std::string ConstantValue::toString(bitwidth_t abbreviateThresholdBits, bool exa FormatBuffer buffer; buffer.append(useAssignmentPatterns ? "'{"sv : "["sv); for (auto& element : *arg) { - buffer.append(element.toString(abbreviateThresholdBits, exactUnknowns, useAssignmentPatterns)); + buffer.append(element.toString(abbreviateThresholdBits, exactUnknowns, + useAssignmentPatterns)); buffer.append(","); } @@ -85,7 +91,8 @@ std::string ConstantValue::toString(bitwidth_t abbreviateThresholdBits, bool exa return "(unset)"s; return fmt::format("({}) {}", *arg->activeMember, - arg->value.toString(abbreviateThresholdBits, exactUnknowns, useAssignmentPatterns)); + arg->value.toString(abbreviateThresholdBits, exactUnknowns, + useAssignmentPatterns)); } else { static_assert(always_false::value, "Missing case");