diff --git a/.clang-format b/.clang-format index 74e568ad5..cde41090d 100644 --- a/.clang-format +++ b/.clang-format @@ -1,97 +1,122 @@ --- -Language: Cpp +Language: Cpp AccessModifierOffset: -4 AlignAfterOpenBracket: Align AlignConsecutiveAssignments: false +AlignConsecutiveBitFields: false AlignConsecutiveDeclarations: false +AlignConsecutiveMacros: false AlignEscapedNewlines: Left -AlignOperands: true +AlignOperands: true AlignTrailingComments: true +AllowAllArgumentsOnNextLine: true AllowAllParametersOfDeclarationOnNextLine: true -AllowShortBlocksOnASingleLine: false +AllowShortBlocksOnASingleLine: Never AllowShortCaseLabelsOnASingleLine: false +AllowShortEnumsOnASingleLine: true AllowShortFunctionsOnASingleLine: InlineOnly -AllowShortIfStatementsOnASingleLine: false +AllowShortIfStatementsOnASingleLine: Never +AllowShortLambdasOnASingleLine: All AllowShortLoopsOnASingleLine: false -AlwaysBreakAfterDefinitionReturnType: None AlwaysBreakAfterReturnType: None AlwaysBreakBeforeMultilineStrings: false -AlwaysBreakTemplateDeclarations: true +AlwaysBreakTemplateDeclarations: Yes BinPackArguments: true BinPackParameters: true +BitFieldColonSpacing: Both BraceWrapping: - AfterClass: false + AfterCaseLabel: false + AfterClass: false AfterControlStatement: false - AfterEnum: false - AfterFunction: false - AfterNamespace: false - AfterObjCDeclaration: false - AfterStruct: false - AfterUnion: false - AfterExternBlock: false - BeforeCatch: true - BeforeElse: true - IndentBraces: false - SplitEmptyFunction: true - SplitEmptyRecord: true - SplitEmptyNamespace: true + AfterEnum: false + AfterFunction: false + AfterNamespace: false + AfterObjCDeclaration: false + AfterStruct: false + AfterUnion: false + AfterExternBlock: false + BeforeCatch: true + BeforeElse: true + BeforeLambdaBody: false + BeforeWhile: false + IndentBraces: false + SplitEmptyFunction: true + SplitEmptyRecord: true + SplitEmptyNamespace: true +BreakAfterJavaFieldAnnotations: false BreakBeforeBinaryOperators: None BreakBeforeBraces: Custom -BreakBeforeInheritanceComma: false +#BreakBeforeConceptDeclarations: Always BreakBeforeTernaryOperators: true -BreakConstructorInitializersBeforeComma: false BreakConstructorInitializers: AfterColon -BreakAfterJavaFieldAnnotations: false BreakStringLiterals: true -ColumnLimit: 100 +ColumnLimit: 100 CompactNamespaces: false -ConstructorInitializerAllOnOneLineOrOnePerLine: false ConstructorInitializerIndentWidth: 4 ContinuationIndentWidth: 4 -Cpp11BracedListStyle: false +Cpp11BracedListStyle: true +DeriveLineEnding: false DerivePointerAlignment: false -DisableFormat: false -ExperimentalAutoDetectBinPacking: false +DisableFormat: false +EmptyLineAfterAccessModifier: Never +EmptyLineBeforeAccessModifier: LogicalBlock FixNamespaceComments: true -IncludeBlocks: Regroup +IncludeBlocks: Regroup IncludeCategories: - Regex: '^"slang/' Priority: 2 - Regex: '.*' Priority: 1 IncludeIsMainRegex: '$' +IndentAccessModifiers: false +IndentCaseBlocks: false IndentCaseLabels: true +IndentExternBlock: NoIndent +IndentGotoLabels: true IndentPPDirectives: AfterHash -IndentWidth: 4 +#IndentRequiresClause: true +IndentWidth: 4 IndentWrappedFunctionNames: false KeepEmptyLinesAtTheStartOfBlocks: true -MacroBlockBegin: '' -MacroBlockEnd: '' +LambdaBodyIndentation: Signature MaxEmptyLinesToKeep: 1 NamespaceIndentation: None -PenaltyBreakAssignment: 2 -PenaltyBreakBeforeFirstCallParameter: 19 +PackConstructorInitializers: BinPack +PenaltyBreakAssignment: 50 +PenaltyBreakBeforeFirstCallParameter: 50 PenaltyBreakComment: 300 PenaltyBreakFirstLessLess: 120 PenaltyBreakString: 1000 PenaltyExcessCharacter: 1000000 PenaltyReturnTypeOnItsOwnLine: 600 PointerAlignment: Left -ReflowComments: true -SortIncludes: true +QualifierAlignment: Leave +ReferenceAlignment: Left +ReflowComments: true +#RequiresClausePosition: WithPreceding +SortIncludes: CaseSensitive SortUsingDeclarations: true SpaceAfterCStyleCast: false +SpaceAfterLogicalNot: false SpaceAfterTemplateKeyword: false SpaceBeforeAssignmentOperators: true +SpaceBeforeCaseColon: false +SpaceBeforeCpp11BracedList: false +SpaceBeforeCtorInitializerColon: true +SpaceBeforeInheritanceColon: true SpaceBeforeParens: ControlStatements +SpaceBeforeRangeBasedForLoopColon: true +SpaceBeforeSquareBrackets: false +SpaceInEmptyBlock: false SpaceInEmptyParentheses: false SpacesBeforeTrailingComments: 1 -SpacesInAngles: false -SpacesInContainerLiterals: true +SpacesInAngles: Never SpacesInCStyleCastParentheses: false +SpacesInConditionalStatement: false +SpacesInContainerLiterals: false SpacesInParentheses: false SpacesInSquareBrackets: false -Standard: Cpp11 -TabWidth: 4 -UseTab: Never +Standard: Latest +TabWidth: 4 +UseTab: Never ... diff --git a/bindings/python/binding.cpp b/bindings/python/binding.cpp index 7ed704c53..07d547a38 100644 --- a/bindings/python/binding.cpp +++ b/bindings/python/binding.cpp @@ -305,8 +305,9 @@ void registerBinding(py::module_& m) { py::class_(m, "EmptyArgumentExpression"); py::class_(m, "TypeReferenceExpression") - .def_property_readonly( - "targetType", [](const TypeReferenceExpression& self) { return &self.targetType; }); + .def_property_readonly("targetType", [](const TypeReferenceExpression& self) { + return &self.targetType; + }); py::class_(m, "HierarchicalReferenceExpression") .def_readonly("symbol", &HierarchicalReferenceExpression::symbol); @@ -547,9 +548,10 @@ void registerBinding(py::module_& m) { .def_readonly("isFinal", &ImmediateAssertionStatement::isFinal); py::class_(m, "ConcurrentAssertionStatement") - .def_property_readonly( - "propertySpec", - [](const ConcurrentAssertionStatement& self) { return &self.propertySpec; }) + .def_property_readonly("propertySpec", + [](const ConcurrentAssertionStatement& self) { + return &self.propertySpec; + }) .def_readonly("ifTrue", &ConcurrentAssertionStatement::ifTrue) .def_readonly("ifFalse", &ConcurrentAssertionStatement::ifFalse) .def_readonly("assertionKind", &ConcurrentAssertionStatement::assertionKind); diff --git a/bindings/python/numeric.cpp b/bindings/python/numeric.cpp index 272e70619..b8c259da6 100644 --- a/bindings/python/numeric.cpp +++ b/bindings/python/numeric.cpp @@ -327,7 +327,7 @@ void registerNumeric(py::module_& m) { py::class_(m, "ConstantRange") .def(py::init<>()) .def(py::init([](int left, int right) { - return ConstantRange{ left, right }; + return ConstantRange{left, right}; })) .def_readwrite("left", &ConstantRange::left) .def_readwrite("right", &ConstantRange::right) diff --git a/bindings/python/pyslang.h b/bindings/python/pyslang.h index 53b7f2e42..df5cf74ff 100644 --- a/bindings/python/pyslang.h +++ b/bindings/python/pyslang.h @@ -49,19 +49,19 @@ std::tuple> loadSpanFromBuffer(handle src) { auto cleanup = ScopeGuard([&view] { PyBuffer_Release(&view); }); if (view.ndim == 1 && view.strides[0] == sizeof(T) && view.format[0] == format_descriptor::c) { - return { true, span(static_cast(view.buf), view.shape[0]) }; + return {true, span(static_cast(view.buf), view.shape[0])}; } } else { // Clear the buffer error (failure is reported in the return value). PyErr_Clear(); } - return { false, span() }; + return {false, span()}; } // If T is not a numeric type, the buffer interface cannot be used. template::value, bool>::type = true> constexpr std::tuple> loadSpanFromBuffer(handle src) { - return { false, span() }; + return {false, span()}; } template diff --git a/bindings/python/symbols.cpp b/bindings/python/symbols.cpp index f89b8c99f..99687a1ae 100644 --- a/bindings/python/symbols.cpp +++ b/bindings/python/symbols.cpp @@ -206,8 +206,9 @@ void registerSymbols(py::module_& m) { py::class_(m, "TypeParameterSymbol") .def_property_readonly("targetType", [](const TypeParameterSymbol& self) { return &self.targetType; }) - .def_property_readonly( - "typeAlias", [](const TypeParameterSymbol& self) { return &self.getTypeAlias(); }); + .def_property_readonly("typeAlias", [](const TypeParameterSymbol& self) { + return &self.getTypeAlias(); + }); py::class_(m, "DefParamSymbol") .def_property_readonly("target", @@ -386,9 +387,10 @@ void registerSymbols(py::module_& m) { .def_property_readonly("isChecker", &UnknownModuleSymbol::isChecker); py::class_(m, "PrimitiveInstanceSymbol") - .def_property_readonly( - "primitiveType", - [](const PrimitiveInstanceSymbol& self) { return &self.primitiveType; }) + .def_property_readonly("primitiveType", + [](const PrimitiveInstanceSymbol& self) { + return &self.primitiveType; + }) .def_property_readonly("portConnections", &PrimitiveInstanceSymbol::getPortConnections) .def_property_readonly("delay", &PrimitiveInstanceSymbol::getDelay); @@ -471,8 +473,9 @@ void registerSymbols(py::module_& m) { py::class_(m, "AssertionPortSymbol") .def_readonly("localVarDirection", &AssertionPortSymbol::localVarDirection) - .def_property_readonly( - "type", [](const AssertionPortSymbol& self) { return &self.declaredType.getType(); }); + .def_property_readonly("type", [](const AssertionPortSymbol& self) { + return &self.declaredType.getType(); + }); py::class_(m, "SequenceSymbol") .def_readonly("ports", &SequenceSymbol::ports); diff --git a/bindings/python/syntax.cpp b/bindings/python/syntax.cpp index 6d196f390..e52b0b5c1 100644 --- a/bindings/python/syntax.cpp +++ b/bindings/python/syntax.cpp @@ -151,10 +151,10 @@ void registerSyntax(py::module_& m) { py::class_>(m, "SyntaxTree") .def_readonly("isLibrary", &SyntaxTree::isLibrary) .def_static("fromFile", py::overload_cast(&SyntaxTree::fromFile)) - .def_static( - "fromFile", - py::overload_cast(&SyntaxTree::fromFile), - "path"_a, "sourceManager"_a, "options"_a = Bag()) + .def_static("fromFile", + py::overload_cast( + &SyntaxTree::fromFile), + "path"_a, "sourceManager"_a, "options"_a = Bag()) .def_static("fromFiles", py::overload_cast>(&SyntaxTree::fromFiles)) .def_static("fromFiles", py::overload_cast, SourceManager&, const Bag&>( diff --git a/bindings/python/util.cpp b/bindings/python/util.cpp index 3f32641ae..d5faaaff3 100644 --- a/bindings/python/util.cpp +++ b/bindings/python/util.cpp @@ -123,10 +123,10 @@ void registerUtil(py::module_& m) { .def("assignText", py::overload_cast(&SourceManager::assignText), "text"_a, "includedFrom"_a = SourceLocation()) - .def( - "assignText", - py::overload_cast(&SourceManager::assignText), - "path"_a, "text"_a, "includedFrom"_a = SourceLocation()) + .def("assignText", + py::overload_cast( + &SourceManager::assignText), + "path"_a, "text"_a, "includedFrom"_a = SourceLocation()) .def("readSource", &SourceManager::readSource) .def("readHeader", &SourceManager::readHeader) .def("isCached", &SourceManager::isCached) @@ -239,9 +239,10 @@ void registerUtil(py::module_& m) { .def_static("reportAll", &DiagnosticEngine::reportAll); py::class_(m, "ReportedDiagnostic") - .def_property_readonly( - "originalDiagnostic", - [](const ReportedDiagnostic& self) { return self.originalDiagnostic; }) + .def_property_readonly("originalDiagnostic", + [](const ReportedDiagnostic& self) { + return self.originalDiagnostic; + }) .def_readonly("expansionLocs", &ReportedDiagnostic::expansionLocs) .def_readonly("ranges", &ReportedDiagnostic::ranges) .def_readonly("location", &ReportedDiagnostic::location) diff --git a/include/slang/binding/EvalContext.h b/include/slang/binding/EvalContext.h index f89812bdf..e2d6cf998 100644 --- a/include/slang/binding/EvalContext.h +++ b/include/slang/binding/EvalContext.h @@ -123,8 +123,8 @@ class EvalContext { /// object that when destructed will restore the previous caching mode. /// Otherwise does nothing. [[nodiscard]] auto disableCaching() { - auto guard = - ScopeGuard([this, saved = flags.has(EvalFlags::CacheResults), pushed = !inFunction()] { + auto guard = ScopeGuard( + [this, saved = flags.has(EvalFlags::CacheResults), pushed = !inFunction()] { if (pushed) popFrame(); diff --git a/include/slang/binding/LValue.h b/include/slang/binding/LValue.h index f4941daf0..3e81d231b 100644 --- a/include/slang/binding/LValue.h +++ b/include/slang/binding/LValue.h @@ -25,7 +25,7 @@ class LValue { LValue(LValue&& other) = default; explicit LValue(Concat&& concat) : value(std::move(concat)) {} - explicit LValue(ConstantValue& base) : value(Path{ base }) {} + explicit LValue(ConstantValue& base) : value(Path{base}) {} bool bad() const { return std::holds_alternative(value); } explicit operator bool() const { return !bad(); } diff --git a/include/slang/compilation/Compilation.h b/include/slang/compilation/Compilation.h index d279a6fb9..3229fad0a 100644 --- a/include/slang/compilation/Compilation.h +++ b/include/slang/compilation/Compilation.h @@ -467,7 +467,7 @@ class Compilation : public BumpAllocator { // A table to look up scalar types based on combinations of the three flags: signed, fourstate, // reg. Two of the entries are not valid and will be nullptr (!fourstate & reg). - Type* scalarTypeTable[8]{ nullptr }; + Type* scalarTypeTable[8]{nullptr}; // Instances of all the built-in types. Type* bitType; diff --git a/include/slang/mir/Instr.h b/include/slang/mir/Instr.h index 3f6d301f5..13db655e1 100644 --- a/include/slang/mir/Instr.h +++ b/include/slang/mir/Instr.h @@ -87,9 +87,9 @@ class Instr { InstrKind kind; Instr(InstrKind kind, const Type& type, MIRValue op) noexcept : - type(type), kind(kind), immOps{ op, MIRValue{} } {} + type(type), kind(kind), immOps{op, MIRValue{}} {} Instr(InstrKind kind, const Type& type, MIRValue op0, MIRValue op1) noexcept : - type(type), kind(kind), immOps{ op0, op1 } {} + type(type), kind(kind), immOps{op0, op1} {} Instr(SysCallKind sysCall, const Type& returnType, span args) noexcept : type(returnType), kind(InstrKind::syscall), sysCallKind(sysCall), varOps(args) {} diff --git a/include/slang/numeric/ConstantValue.h b/include/slang/numeric/ConstantValue.h index 658be0544..cf9d410a7 100644 --- a/include/slang/numeric/ConstantValue.h +++ b/include/slang/numeric/ConstantValue.h @@ -302,7 +302,7 @@ struct ConstantRange { bool isLittleEndian() const { return left >= right; } /// Reverses the bit ordering of the range. - [[nodiscard]] ConstantRange reverse() const { return { right, left }; } + [[nodiscard]] ConstantRange reverse() const { return {right, left}; } /// Selects a subrange of this range, correctly handling both forms of /// bit endianness. This will assert that the given subrange is not wider. diff --git a/include/slang/numeric/MathUtils.h b/include/slang/numeric/MathUtils.h index 3385ff4ba..bc82b0d4b 100644 --- a/include/slang/numeric/MathUtils.h +++ b/include/slang/numeric/MathUtils.h @@ -75,8 +75,8 @@ inline uint32_t countPopulation64(uint64_t value) { inline std::optional checkedAddS32(int32_t a, int32_t b) { #if defined(_MSC_VER) int64_t p = int64_t(a) + int64_t(b); - bool fits = - p >= std::numeric_limits::min() && p <= std::numeric_limits::max(); + bool fits = p >= std::numeric_limits::min() && + p <= std::numeric_limits::max(); return fits ? std::make_optional(int32_t(p)) : std::nullopt; #else int32_t result; @@ -89,8 +89,8 @@ inline std::optional checkedAddS32(int32_t a, int32_t b) { inline std::optional checkedSubS32(int32_t a, int32_t b) { #if defined(_MSC_VER) int64_t p = int64_t(a) - int64_t(b); - bool fits = - p >= std::numeric_limits::min() && p <= std::numeric_limits::max(); + bool fits = p >= std::numeric_limits::min() && + p <= std::numeric_limits::max(); return fits ? std::make_optional(int32_t(p)) : std::nullopt; #else int32_t result; diff --git a/include/slang/parsing/NumberParser.h b/include/slang/parsing/NumberParser.h index b5c12b0a4..51167d72e 100644 --- a/include/slang/parsing/NumberParser.h +++ b/include/slang/parsing/NumberParser.h @@ -26,10 +26,10 @@ class NumberParser { Token value; bool isSimple = true; - static IntResult simple(Token value) { return { Token(), Token(), value, true }; } + static IntResult simple(Token value) { return {Token(), Token(), value, true}; } static IntResult vector(Token size, Token base, Token value) { - return { size, base, value, false }; + return {size, base, value, false}; } }; diff --git a/include/slang/symbols/ClassSymbols.h b/include/slang/symbols/ClassSymbols.h index 3df7e5f8f..69b99628d 100644 --- a/include/slang/symbols/ClassSymbols.h +++ b/include/slang/symbols/ClassSymbols.h @@ -128,7 +128,7 @@ class GenericClassDefSymbol : public Symbol { GenericClassDefSymbol(string_view name, SourceLocation loc, function_ref specializeFunc) : Symbol(SymbolKind::GenericClassDef, name, loc), - specializeFunc{ specializeFunc } {} + specializeFunc{specializeFunc} {} /// Gets the default specialization for the class, or nullptr if the generic /// class has no default specialization (because some parameters are not defaulted). @@ -233,7 +233,7 @@ class GenericClassDefSymbol : public Symbol { /// Gets an iterator to the specializations created for the generic class. iterator_range specializations() const { - return { iterator(specMap.begin()), iterator(specMap.end()) }; + return {iterator(specMap.begin()), iterator(specMap.end())}; } }; @@ -281,7 +281,7 @@ class ConstraintBlockSymbol : public Symbol, public Scope { void addThisVar(const Type& type); mutable const Constraint* constraint = nullptr; - mutable SymbolIndex outOfBlockIndex{ 0 }; + mutable SymbolIndex outOfBlockIndex{0}; }; } // namespace slang diff --git a/include/slang/symbols/Scope.h b/include/slang/symbols/Scope.h index f311ee5ae..3c780cd3a 100644 --- a/include/slang/symbols/Scope.h +++ b/include/slang/symbols/Scope.h @@ -191,14 +191,14 @@ class Scope { /// Gets an iterator to the members contained in the scope. iterator_range members() const { ensureElaborated(); - return { firstMember, nullptr }; + return {firstMember, nullptr}; } /// Gets an iterator to all of the members of the given type contained in the scope. template iterator_range> membersOfType() const { ensureElaborated(); - return { firstMember, nullptr }; + return {firstMember, nullptr}; } /// Gets a pointer to the first member in the scope. Note that this does not @@ -319,11 +319,11 @@ class Scope { // If this scope has any deferred member symbols they'll be temporarily // stored in a sideband list in the compilation object until we expand them. - mutable DeferredMemberIndex deferredMemberIndex{ 0 }; + mutable DeferredMemberIndex deferredMemberIndex{0}; // If this scope has any wildcard import directives we'll keep track of them // in a sideband list in the compilation object. - ImportDataIndex importDataIndex{ 0 }; + ImportDataIndex importDataIndex{0}; }; } // namespace slang diff --git a/include/slang/symbols/SubroutineSymbols.h b/include/slang/symbols/SubroutineSymbols.h index 0e3bd6f86..b63092e0d 100644 --- a/include/slang/symbols/SubroutineSymbols.h +++ b/include/slang/symbols/SubroutineSymbols.h @@ -82,7 +82,7 @@ class SubroutineSymbol : public Symbol, public Scope { SubroutineKind subroutineKind; Visibility visibility = Visibility::Public; bitmask flags = MethodFlags::None; - SymbolIndex outOfBlockIndex{ 0 }; + SymbolIndex outOfBlockIndex{0}; const VariableSymbol* returnValVar = nullptr; const VariableSymbol* thisVar = nullptr; diff --git a/include/slang/symbols/Symbol.h b/include/slang/symbols/Symbol.h index 6151da484..4b92687f2 100644 --- a/include/slang/symbols/Symbol.h +++ b/include/slang/symbols/Symbol.h @@ -239,7 +239,7 @@ class Symbol { // determine ordering during lookups) will be set here. mutable const Scope* parentScope = nullptr; mutable const Symbol* nextInScope = nullptr; - mutable SymbolIndex indexInScope{ 0 }; + mutable SymbolIndex indexInScope{0}; const SyntaxNode* originatingSyntax = nullptr; }; diff --git a/include/slang/syntax/SyntaxVisitor.h b/include/slang/syntax/SyntaxVisitor.h index d5aa9c9a7..15c5ccace 100644 --- a/include/slang/syntax/SyntaxVisitor.h +++ b/include/slang/syntax/SyntaxVisitor.h @@ -135,8 +135,8 @@ class SyntaxRewriter : public SyntaxVisitor { /// Register a removal for the given syntax node from the tree. void remove(const SyntaxNode& oldNode) { - if (auto [_, ok] = commits.removeOrReplace.emplace( - &oldNode, detail::RemoveChange{ &oldNode, nullptr }); + if (auto [_, ok] = commits.removeOrReplace.emplace(&oldNode, + detail::RemoveChange{&oldNode, nullptr}); !ok) { throw std::logic_error("Node only permit one remove/replace operation"); } @@ -145,7 +145,7 @@ class SyntaxRewriter : public SyntaxVisitor { /// Replace the given @a oldNode with @a newNode in the rewritten tree. void replace(const SyntaxNode& oldNode, SyntaxNode& newNode) { if (auto [_, ok] = commits.removeOrReplace.emplace( - &oldNode, detail::ReplaceChange{ &oldNode, &newNode }); + &oldNode, detail::ReplaceChange{&oldNode, &newNode}); !ok) { throw std::logic_error("Node only permit one remove/replace operation"); } @@ -153,22 +153,22 @@ class SyntaxRewriter : public SyntaxVisitor { /// Insert @a newNode before @a oldNode in the rewritten tree. void insertBefore(const SyntaxNode& oldNode, SyntaxNode& newNode) { - commits.insertBefore[&oldNode].push_back({ &oldNode, &newNode }); + commits.insertBefore[&oldNode].push_back({&oldNode, &newNode}); } /// Insert @a newNode after @a oldNode in the rewritten tree. void insertAfter(const SyntaxNode& oldNode, SyntaxNode& newNode) { - commits.insertAfter[&oldNode].push_back({ &oldNode, &newNode }); + commits.insertAfter[&oldNode].push_back({&oldNode, &newNode}); } /// Insert @a newNode at the front of @a list in the rewritten tree. void insertAtFront(const SyntaxListBase& list, SyntaxNode& newNode, Token separator = {}) { - commits.listInsertAtFront[&list].push_back({ &list, &newNode, separator }); + commits.listInsertAtFront[&list].push_back({&list, &newNode, separator}); } /// Insert @a newNode at the back of @a list in the rewritten tree. void insertAtBack(const SyntaxListBase& list, SyntaxNode& newNode, Token separator = {}) { - commits.listInsertAtBack[&list].push_back({ &list, &newNode, separator }); + commits.listInsertAtBack[&list].push_back({&list, &newNode, separator}); } Token makeToken(TokenKind kind, string_view text) { diff --git a/include/slang/text/CharInfo.h b/include/slang/text/CharInfo.h index 96c111cd6..72626dd35 100644 --- a/include/slang/text/CharInfo.h +++ b/include/slang/text/CharInfo.h @@ -138,8 +138,8 @@ constexpr char getHexForDigit(uint32_t num, bool lowerCase = false) { /// Gets the length of the UTF-8 sequence starting with the given first character. /// Returns 0 if the given character is invalid for a UTF-8 sequence. constexpr int utf8Len(unsigned char first) { - constexpr const char lengths[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 3, 3, 4, 0 }; + constexpr const char lengths[] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 3, 3, 4, 0}; return lengths[first >> 3]; } @@ -162,10 +162,10 @@ constexpr int utf8Len(unsigned char first) { /// error, but it will always advance at least one byte. /// constexpr const char* utf8Decode(const char* b, uint32_t* c, int* e) { - constexpr const int masks[] = { 0x00, 0x7f, 0x1f, 0x0f, 0x07 }; - constexpr const uint32_t mins[] = { 4194304, 0, 128, 2048, 65536 }; - constexpr const int shiftc[] = { 0, 18, 12, 6, 0 }; - constexpr const int shifte[] = { 0, 6, 4, 2, 0 }; + constexpr const int masks[] = {0x00, 0x7f, 0x1f, 0x0f, 0x07}; + constexpr const uint32_t mins[] = {4194304, 0, 128, 2048, 65536}; + constexpr const int shiftc[] = {0, 18, 12, 6, 0}; + constexpr const int shifte[] = {0, 6, 4, 2, 0}; using uc = unsigned char; int len = utf8Len(uc(*b)); diff --git a/include/slang/text/SourceLocation.h b/include/slang/text/SourceLocation.h index 6a8e9576f..a88721928 100644 --- a/include/slang/text/SourceLocation.h +++ b/include/slang/text/SourceLocation.h @@ -172,8 +172,8 @@ class SourceLocation { uint64_t charOffset : 36; }; -inline constexpr const SourceLocation SourceLocation::NoLocation{ BufferID((1u << 28) - 1, ""), - (1ull << 36) - 1 }; +inline constexpr const SourceLocation SourceLocation::NoLocation{BufferID((1u << 28) - 1, ""), + (1ull << 36) - 1}; #ifndef DEBUG static_assert(sizeof(SourceLocation) == 8); diff --git a/include/slang/util/Enum.h b/include/slang/util/Enum.h index efcfc6a7d..dd349fdc9 100644 --- a/include/slang/util/Enum.h +++ b/include/slang/util/Enum.h @@ -19,7 +19,7 @@ #define ENUM_SIZED(name, underlying, elements) \ enum class name : underlying { elements(UTIL_ENUM_ELEMENT) }; \ inline string_view toString(name e) { \ - static const char* strings[] = { elements(UTIL_ENUM_STRING) }; \ + static const char* strings[] = {elements(UTIL_ENUM_STRING)}; \ return strings[static_cast>(e)]; \ } \ inline std::ostream& operator<<(std::ostream& os, name e) { \ @@ -27,7 +27,7 @@ } \ class name##_traits { \ enum e { elements(UTIL_ENUM_ELEMENT) }; \ - static constexpr auto vals = { elements(UTIL_ENUM_ELEMENT) }; \ + static constexpr auto vals = {elements(UTIL_ENUM_ELEMENT)}; \ static constexpr auto getValues() { \ std::array result{}; \ size_t i = 0; \ @@ -44,19 +44,19 @@ #define BITMASK_DETAIL_DEFINE_OPS(value_type) \ inline constexpr slang::bitmask operator&(value_type l, value_type r) noexcept { \ - return slang::bitmask{ l } & r; \ + return slang::bitmask{l} & r; \ } \ inline constexpr slang::bitmask operator|(value_type l, value_type r) noexcept { \ - return slang::bitmask{ l } | r; \ + return slang::bitmask{l} | r; \ } \ inline constexpr slang::bitmask operator^(value_type l, value_type r) noexcept { \ - return slang::bitmask{ l } ^ r; \ + return slang::bitmask{l} ^ r; \ } \ inline constexpr slang::bitmask operator~(value_type op) noexcept { \ - return ~slang::bitmask{ op }; \ + return ~slang::bitmask{op}; \ } \ inline constexpr slang::bitmask::underlying_type bits(value_type op) noexcept { \ - return slang::bitmask{ op }.bits(); \ + return slang::bitmask{op}.bits(); \ } #define BITMASK_DETAIL_DEFINE_MAX_ELEMENT(value_type, max_element) \ @@ -88,8 +88,8 @@ using underlying_type_t = typename underlying_type::type; template struct mask_from_max_element { - static constexpr underlying_type_t max_element_value_ = - static_cast>(MaxElement); + static constexpr underlying_type_t max_element_value_ = static_cast>( + MaxElement); static_assert(max_element_value_ >= 0, "Max element is negative"); @@ -101,8 +101,9 @@ struct mask_from_max_element { // `((value - 1) << 1) + 1` is used rather that simpler `(value << 1) - 1` // because latter overflows in case if `value` is the highest bit of the underlying type. - static constexpr underlying_type_t value = - max_element_value_ ? ((max_element_value_ - 1) << 1) + 1 : 0; + static constexpr underlying_type_t value = max_element_value_ + ? ((max_element_value_ - 1) << 1) + 1 + : 0; }; template @@ -126,7 +127,7 @@ class bitmask { static constexpr underlying_type mask_value = get_enum_mask(static_cast(0)); constexpr bitmask() noexcept = default; - constexpr bitmask(T value) noexcept : m_bits{ static_cast(value) } {} + constexpr bitmask(T value) noexcept : m_bits{static_cast(value)} {} /// Returns true iff (*this & r) != 0. constexpr bool has(const bitmask& r) const noexcept { return (*this & r) != 0; } @@ -138,19 +139,19 @@ class bitmask { constexpr explicit operator bool() const noexcept { return bits() ? true : false; } constexpr bitmask operator~() const noexcept { - return bitmask{ std::true_type{}, ~m_bits & mask_value }; + return bitmask{std::true_type{}, ~m_bits & mask_value}; } constexpr bitmask operator&(const bitmask& r) const noexcept { - return bitmask{ std::true_type{}, m_bits & r.m_bits }; + return bitmask{std::true_type{}, m_bits & r.m_bits}; } constexpr bitmask operator|(const bitmask& r) const noexcept { - return bitmask{ std::true_type{}, m_bits | r.m_bits }; + return bitmask{std::true_type{}, m_bits | r.m_bits}; } constexpr bitmask operator^(const bitmask& r) const noexcept { - return bitmask{ std::true_type{}, m_bits ^ r.m_bits }; + return bitmask{std::true_type{}, m_bits ^ r.m_bits}; } bitmask& operator|=(const bitmask& r) noexcept { diff --git a/source/binding/AssertionExpr.cpp b/source/binding/AssertionExpr.cpp index e571b4732..64d73b337 100644 --- a/source/binding/AssertionExpr.cpp +++ b/source/binding/AssertionExpr.cpp @@ -93,12 +93,12 @@ const AssertionExpr& AssertionExpr::bind(const SequenceExprSyntax& syntax, ctx); break; case SyntaxKind::ClockingSequenceExpr: - result = - &ClockingAssertionExpr::fromSyntax(syntax.as(), ctx); + result = &ClockingAssertionExpr::fromSyntax(syntax.as(), + ctx); break; case SyntaxKind::SignalEventExpression: - result = - &ClockingAssertionExpr::fromSyntax(syntax.as(), ctx); + result = &ClockingAssertionExpr::fromSyntax(syntax.as(), + ctx); break; default: THROW_UNREACHABLE; @@ -154,8 +154,8 @@ const AssertionExpr& AssertionExpr::bind(const PropertyExprSyntax& syntax, return bind(*ppe.expr, context); } case SyntaxKind::ClockingPropertyExpr: - result = - &ClockingAssertionExpr::fromSyntax(syntax.as(), ctx); + result = &ClockingAssertionExpr::fromSyntax(syntax.as(), + ctx); break; case SyntaxKind::StrongWeakPropertyExpr: result = &StrongWeakAssertionExpr::fromSyntax(syntax.as(), @@ -165,8 +165,8 @@ const AssertionExpr& AssertionExpr::bind(const PropertyExprSyntax& syntax, result = &UnaryAssertionExpr::fromSyntax(syntax.as(), ctx); break; case SyntaxKind::UnarySelectPropertyExpr: - result = - &UnaryAssertionExpr::fromSyntax(syntax.as(), ctx); + result = &UnaryAssertionExpr::fromSyntax(syntax.as(), + ctx); break; case SyntaxKind::AcceptOnPropertyExpr: result = &AbortAssertionExpr::fromSyntax(syntax.as(), ctx); @@ -349,8 +349,8 @@ struct SampledValueExprVisitor { void visitInvalid(const AssertionExpr&) {} static inline const flat_hash_set FutureGlobalNames = { - "$future_gclk"sv, "$rising_gclk"sv, "$falling_gclk"sv, "$steady_gclk"sv, "$changing_gclk"sv - }; + "$future_gclk"sv, "$rising_gclk"sv, "$falling_gclk"sv, "$steady_gclk"sv, + "$changing_gclk"sv}; }; void AssertionExpr::checkSampledValueExpr(const Expression& expr, const BindContext& context, @@ -561,8 +561,8 @@ AssertionExpr& SequenceConcatExpr::fromSyntax(const DelayedSequenceExprSyntax& s seq.requireSequence(context); ok &= !seq.bad(); - SequenceRange delay{ 0, 0 }; - elems.append(Element{ delay, &seq }); + SequenceRange delay{0, 0}; + elems.append(Element{delay, &seq}); } for (auto es : syntax.elements) { @@ -586,7 +586,7 @@ AssertionExpr& SequenceConcatExpr::fromSyntax(const DelayedSequenceExprSyntax& s delay.min = 1; } - elems.append(Element{ delay, &seq }); + elems.append(Element{delay, &seq}); } auto& comp = context.getCompilation(); @@ -684,9 +684,10 @@ static span bindMatchItems(const SequenceMatchListSynta break; } case ExpressionKind::Call: { - AssertionExpr::checkAssertionCall( - expr.as(), context, diag::SubroutineMatchOutArg, - diag::SubroutineMatchAutoRefArg, std::nullopt, expr.sourceRange); + AssertionExpr::checkAssertionCall(expr.as(), context, + diag::SubroutineMatchOutArg, + diag::SubroutineMatchAutoRefArg, std::nullopt, + expr.sourceRange); break; } case ExpressionKind::Invalid: @@ -793,8 +794,8 @@ AssertionExpr& UnaryAssertionExpr::fromSyntax(const UnarySelectPropertyExprSynta optional range; if (syntax.selector) { - bool allowUnbounded = - op == UnaryAssertionOperator::Always || op == UnaryAssertionOperator::SEventually; + bool allowUnbounded = op == UnaryAssertionOperator::Always || + op == UnaryAssertionOperator::SEventually; range = SequenceRange::fromSyntax(*syntax.selector, context, allowUnbounded); } @@ -1138,14 +1139,14 @@ AssertionExpr& CaseAssertionExpr::fromSyntax(const CasePropertyExprSyntax& synta for (auto es : sci.expressions) exprs.append(&bindExpr(*es, context)); - items.append(ItemGroup{ exprs.copy(comp), &body }); + items.append(ItemGroup{exprs.copy(comp), &body}); } else { // The parser already errored for duplicate defaults, // so just ignore if it happens here. if (!defCase) { - defCase = - &AssertionExpr::bind(*item->as().expr, context); + defCase = &AssertionExpr::bind(*item->as().expr, + context); } } } diff --git a/source/binding/AssignmentExpressions.cpp b/source/binding/AssignmentExpressions.cpp index aee55e40a..a63a0d947 100644 --- a/source/binding/AssignmentExpressions.cpp +++ b/source/binding/AssignmentExpressions.cpp @@ -84,7 +84,7 @@ Expression* Expression::tryConnectPortArray(const BindContext& context, const Ty else { diag << name; if (instance.location) - diag << SourceRange{ instance.location, instance.location + name.length() }; + diag << SourceRange{instance.location, instance.location + name.length()}; } return &badExpr(comp, &expr); @@ -209,7 +209,7 @@ Expression* Expression::tryConnectPortArray(const BindContext& context, const Ty int32_t width = int32_t(portWidth); offset *= width; - ConstantRange range{ offset + width - 1, offset }; + ConstantRange range{offset + width - 1, offset}; return &RangeSelectExpression::fromConstant(comp, *result, range, context); } @@ -305,10 +305,10 @@ Expression& Expression::convertAssignment(const BindContext& context, const Type else if (expr.kind == ExpressionKind::OpenRange) { // Convert each side of the range and return that as a new range. auto& ore = expr.as(); - auto& left = - convertAssignment(context, type, ore.left(), location, lhsExpr, assignFlags); - auto& right = - convertAssignment(context, type, ore.right(), location, lhsExpr, assignFlags); + auto& left = convertAssignment(context, type, ore.left(), location, lhsExpr, + assignFlags); + auto& right = convertAssignment(context, type, ore.right(), location, lhsExpr, + assignFlags); result = comp.emplace(*expr.type, left, right, expr.sourceRange); result->syntax = expr.syntax; @@ -466,8 +466,9 @@ Expression& AssignmentExpression::fromComponents( Expression& lhs, Expression& rhs, SourceLocation assignLoc, const TimingControl* timingControl, SourceRange sourceRange, const BindContext& context) { - auto result = compilation.emplace( - op, flags.has(AssignFlags::NonBlocking), *lhs.type, lhs, rhs, timingControl, sourceRange); + auto result = compilation.emplace(op, flags.has(AssignFlags::NonBlocking), + *lhs.type, lhs, rhs, timingControl, + sourceRange); if (lhs.bad() || rhs.bad()) return badExpr(compilation, result); @@ -492,8 +493,8 @@ Expression& AssignmentExpression::fromComponents( assignLoc, sourceRange, context); } - result->right_ = - &convertAssignment(context, *lhs.type, *result->right_, assignLoc, &result->left_, &flags); + result->right_ = &convertAssignment(context, *lhs.type, *result->right_, assignLoc, + &result->left_, &flags); if (result->right_->bad()) return badExpr(compilation, result); @@ -568,8 +569,8 @@ Expression& ConversionExpression::fromSyntax(Compilation& compilation, const CastExpressionSyntax& syntax, const BindContext& context) { auto& targetExpr = bind(*syntax.left, context, BindFlags::AllowDataType); - auto& operand = - selfDetermined(compilation, *syntax.right, context, BindFlags::StreamingAllowed); + auto& operand = selfDetermined(compilation, *syntax.right, context, + BindFlags::StreamingAllowed); const auto* type = &compilation.getErrorType(); auto result = [&](ConversionKind cast = ConversionKind::Explicit) { @@ -634,8 +635,9 @@ Expression& ConversionExpression::fromSyntax(Compilation& compilation, const SignedCastExpressionSyntax& syntax, const BindContext& context) { auto& operand = selfDetermined(compilation, *syntax.inner, context); - auto result = compilation.emplace( - compilation.getErrorType(), ConversionKind::Explicit, operand, syntax.sourceRange()); + auto result = compilation.emplace(compilation.getErrorType(), + ConversionKind::Explicit, operand, + syntax.sourceRange()); if (operand.bad()) return badExpr(compilation, result); @@ -977,9 +979,9 @@ Expression& NewClassExpression::fromSyntax(Compilation& compilation, Expression* constructorCall = nullptr; if (auto constructor = classType->find("new")) { Lookup::ensureVisible(*constructor, context, range); - constructorCall = - &CallExpression::fromArgs(compilation, &constructor->as(), nullptr, - syntax.argList, range, context); + constructorCall = &CallExpression::fromArgs(compilation, + &constructor->as(), nullptr, + syntax.argList, range, context); } else if (syntax.argList && !syntax.argList->parameters.empty()) { auto& diag = context.addDiag(diag::TooManyArguments, syntax.argList->sourceRange()); @@ -1253,8 +1255,8 @@ Expression& SimpleAssignmentPatternExpression::forStruct( bad |= expr.bad(); } - auto result = - comp.emplace(type, elems.copy(comp), sourceRange); + auto result = comp.emplace(type, elems.copy(comp), + sourceRange); if (bad) return badExpr(comp, result); @@ -1305,8 +1307,8 @@ Expression& SimpleAssignmentPatternExpression::forDynamicArray( const Type& type, const Type& elementType, SourceRange sourceRange) { bool bad = false; - auto elems = - bindExpressionList(type, elementType, 1, 0, syntax.items, context, sourceRange, bad); + auto elems = bindExpressionList(type, elementType, 1, 0, syntax.items, context, sourceRange, + bad); auto result = comp.emplace(type, elems, sourceRange); if (bad) @@ -1377,8 +1379,8 @@ static const Expression* matchElementValue( if (type.isError() || field.name.empty()) return nullptr; - auto elemExpr = - matchElementValue(context, type, &field, sourceRange, typeSetters, defaultSetter); + auto elemExpr = matchElementValue(context, type, &field, sourceRange, typeSetters, + defaultSetter); if (!elemExpr) return nullptr; @@ -1471,16 +1473,16 @@ Expression& StructuredAssignmentPatternExpression::forStruct( continue; } - memberSetters.emplace(MemberSetter{ member, &expr }); + memberSetters.emplace(MemberSetter{member, &expr}); } else { auto found = Lookup::unqualified(*context.scope, name, LookupFlags::Type); if (found && found->isType()) { - auto& expr = - bindRValue(found->as(), *item->expr, nameToken.location(), context); + auto& expr = bindRValue(found->as(), *item->expr, nameToken.location(), + context); bad |= expr.bad(); - typeSetters.emplace(TypeSetter{ &found->as(), &expr }); + typeSetters.emplace(TypeSetter{&found->as(), &expr}); } else { auto& diag = context.addDiag(diag::UnknownMember, item->key->sourceRange()); @@ -1496,7 +1498,7 @@ Expression& StructuredAssignmentPatternExpression::forStruct( auto& expr = bindRValue(typeKey, *item->expr, item->expr->getFirstToken().location(), context); - typeSetters.emplace(TypeSetter{ &typeKey, &expr }); + typeSetters.emplace(TypeSetter{&typeKey, &expr}); bad |= expr.bad(); } else { @@ -1524,8 +1526,8 @@ Expression& StructuredAssignmentPatternExpression::forStruct( continue; } - auto expr = - matchElementValue(context, fieldType, &field, sourceRange, typeSetters, defaultSetter); + auto expr = matchElementValue(context, fieldType, &field, sourceRange, typeSetters, + defaultSetter); if (!expr) { bad = true; continue; @@ -1566,7 +1568,7 @@ static optional bindArrayIndexSetter( return std::nullopt; } - indexSetters.append({ &keyExpr, &expr }); + indexSetters.append({&keyExpr, &expr}); return *index; } @@ -1604,7 +1606,7 @@ Expression& StructuredAssignmentPatternExpression::forFixedArray( auto& expr = bindRValue(typeKey, *item->expr, item->expr->getFirstToken().location(), context); - typeSetters.emplace(TypeSetter{ &typeKey, &expr }); + typeSetters.emplace(TypeSetter{&typeKey, &expr}); bad |= expr.bad(); } else { @@ -1781,7 +1783,7 @@ Expression& StructuredAssignmentPatternExpression::forAssociativeArray( item->expr->getFirstToken().location(), context); bad |= expr.bad() || indexExpr->bad(); - indexSetters.append(IndexSetter{ indexExpr, &expr }); + indexSetters.append(IndexSetter{indexExpr, &expr}); } } @@ -1876,8 +1878,9 @@ Expression& ReplicatedAssignmentPatternExpression::forStruct( } } - auto result = comp.emplace( - type, countExpr, elems.copy(comp), sourceRange); + auto result = comp.emplace(type, countExpr, + elems.copy(comp), + sourceRange); if (bad) return badExpr(comp, result); @@ -1897,8 +1900,8 @@ Expression& ReplicatedAssignmentPatternExpression::forFixedArray( auto elems = bindExpressionList(type, elementType, count, numElements, syntax.items, context, sourceRange, bad); - auto result = - comp.emplace(type, countExpr, elems, sourceRange); + auto result = comp.emplace(type, countExpr, elems, + sourceRange); if (bad) return badExpr(comp, result); @@ -1915,11 +1918,11 @@ Expression& ReplicatedAssignmentPatternExpression::forDynamicArray( return badExpr(comp, nullptr); bool bad = false; - auto elems = - bindExpressionList(type, elementType, count, 0, syntax.items, context, sourceRange, bad); + auto elems = bindExpressionList(type, elementType, count, 0, syntax.items, context, sourceRange, + bad); - auto result = - comp.emplace(type, countExpr, elems, sourceRange); + auto result = comp.emplace(type, countExpr, elems, + sourceRange); if (bad) return badExpr(comp, result); diff --git a/source/binding/BindContext.cpp b/source/binding/BindContext.cpp index 76f328b58..13d344169 100644 --- a/source/binding/BindContext.cpp +++ b/source/binding/BindContext.cpp @@ -326,8 +326,8 @@ optional BindContext::evalPackedDimension(const ElementSelectSynt optional BindContext::evalUnpackedDimension( const VariableDimensionSyntax& syntax) const { - EvaluatedDimension result = - evalDimension(syntax, /* requireRange */ true, /* isPacked */ false); + EvaluatedDimension result = evalDimension(syntax, /* requireRange */ true, + /* isPacked */ false); if (!result.isRange()) return std::nullopt; @@ -432,7 +432,7 @@ void BindContext::evalRangeDimension(const SelectorSyntax& syntax, bool isPacked return; result.kind = DimensionKind::AbbreviatedRange; - result.range = { 0, *value - 1 }; + result.range = {0, *value - 1}; } break; } @@ -444,7 +444,7 @@ void BindContext::evalRangeDimension(const SelectorSyntax& syntax, bool isPacked return; result.kind = DimensionKind::Range; - result.range = { *left, *right }; + result.range = {*left, *right}; break; } default: diff --git a/source/binding/Bitstream.cpp b/source/binding/Bitstream.cpp index 992a85b89..3ddf24209 100644 --- a/source/binding/Bitstream.cpp +++ b/source/binding/Bitstream.cpp @@ -39,16 +39,16 @@ enum class BitstreamSizeMode { Source, DestEmpty, DestFill }; static std::pair dynamicBitstreamSize(const Type& type, BitstreamSizeMode mode) { size_t fixedSize = type.getBitWidth(); if (fixedSize > 0) - return { 0, fixedSize }; + return {0, fixedSize}; if (type.isString()) - return { mode == BitstreamSizeMode::DestEmpty ? 0 : CHAR_BIT, 0 }; + return {mode == BitstreamSizeMode::DestEmpty ? 0 : CHAR_BIT, 0}; // TODO: check for overflow size_t multiplier = 0; if (type.isUnpackedArray()) { - auto [multiplierElem, fixedSizeElem] = - dynamicBitstreamSize(*type.getArrayElementType(), mode); + auto [multiplierElem, fixedSizeElem] = dynamicBitstreamSize(*type.getArrayElementType(), + mode); const auto& ct = type.getCanonicalType(); if (ct.kind == SymbolKind::FixedSizeUnpackedArrayType) { @@ -90,13 +90,13 @@ static std::pair dynamicBitstreamSize(const Type& type, Bitstrea } } - return { multiplier, fixedSize }; + return {multiplier, fixedSize}; } static std::pair dynamicBitstreamSize( const StreamingConcatenationExpression& concat, BitstreamSizeMode mode) { if (concat.isFixedSize()) - return { 0, concat.bitstreamWidth() }; + return {0, concat.bitstreamWidth()}; size_t multiplier = 0, fixedSize = 0; for (auto& stream : concat.streams()) { @@ -104,8 +104,8 @@ static std::pair dynamicBitstreamSize( size_t multiplierStream = 0, fixedSizeStream = 0; if (stream.withExpr) { - auto [multiplierElem, fixedSizeElem] = - dynamicBitstreamSize(*operand.type->getArrayElementType(), mode); + auto [multiplierElem, + fixedSizeElem] = dynamicBitstreamSize(*operand.type->getArrayElementType(), mode); ASSERT(!multiplierElem); if (stream.constantWithWidth) { auto rw = *stream.constantWithWidth; @@ -130,7 +130,7 @@ static std::pair dynamicBitstreamSize( fixedSize += fixedSizeStream; } - return { multiplier, fixedSize }; + return {multiplier, fixedSize}; } template bool Bitstream::dynamicSizesMatch(const Type&, const Type&); @@ -140,10 +140,10 @@ template bool Bitstream::dynamicSizesMatch(const Type&, const StreamingConcatena template bool Bitstream::dynamicSizesMatch(const T1& destination, const T2& source) { - auto [sourceMultiplier, sourceFixedSize] = - dynamicBitstreamSize(source, BitstreamSizeMode::Source); - auto [destEmptyMultiplier, destEmptyFixedSize] = - dynamicBitstreamSize(destination, BitstreamSizeMode::DestEmpty); + auto [sourceMultiplier, sourceFixedSize] = dynamicBitstreamSize(source, + BitstreamSizeMode::Source); + auto [destEmptyMultiplier, + destEmptyFixedSize] = dynamicBitstreamSize(destination, BitstreamSizeMode::DestEmpty); if (destEmptyFixedSize >= sourceFixedSize) { auto diff = destEmptyFixedSize - sourceFixedSize; @@ -160,8 +160,8 @@ bool Bitstream::dynamicSizesMatch(const T1& destination, const T2& source) { return true; } - auto [destFillMultiplier, destFillFixedSize] = - dynamicBitstreamSize(destination, BitstreamSizeMode::DestFill); + auto [destFillMultiplier, + destFillFixedSize] = dynamicBitstreamSize(destination, BitstreamSizeMode::DestFill); /* Follow IEEE standard to check dynamic-sized types at compile-time. // runtime error @@ -199,8 +199,8 @@ static size_t bitstreamCastRemainingSize(const T& destination, size_t srcSize) { } // Check for the source size being too small to fill destination fixed size. - auto [destEmptyMultiplier, destEmptyFixedSize] = - dynamicBitstreamSize(destination, BitstreamSizeMode::DestEmpty); + auto [destEmptyMultiplier, + destEmptyFixedSize] = dynamicBitstreamSize(destination, BitstreamSizeMode::DestEmpty); if (destEmptyFixedSize > srcSize) return srcSize + 1; // cannot fit @@ -208,8 +208,8 @@ static size_t bitstreamCastRemainingSize(const T& destination, size_t srcSize) { return 0; // Calculate remaining size to dynamically fill. - auto [destFillMultiplier, destFillFixedSize] = - dynamicBitstreamSize(destination, BitstreamSizeMode::DestFill); + auto [destFillMultiplier, + destFillFixedSize] = dynamicBitstreamSize(destination, BitstreamSizeMode::DestFill); if (srcSize < destFillFixedSize || (srcSize - destFillFixedSize) % destFillMultiplier != 0) { if (destEmptyMultiplier > 0 && (srcSize - destEmptyFixedSize) % destEmptyMultiplier == 0) return 0; // only for "with" range @@ -737,9 +737,9 @@ static bool unpackConcatenation(const StreamingConcatenationExpression& lhs, Pac ASSERT(with.left <= with.right); auto oldValue = lvalue.load(); if (oldValue.size() <= static_cast(with.right)) { - auto newValue = - Bitstream::resizeToRange(std::move(oldValue), { 0, with.right }, - elemType->getDefaultValue(), true); + auto newValue = Bitstream::resizeToRange(std::move(oldValue), + {0, with.right}, + elemType->getDefaultValue(), true); lvalue.store(newValue); } } @@ -786,8 +786,8 @@ ConstantValue Bitstream::evaluateTarget(const StreamingConcatenationExpression& if (!lhs.isFixedSize()) { dynamicSize = srcSize - targetWidth; - auto [firstDynamicElemSize, notUsed] = - dynamicBitstreamSize(lhs, BitstreamSizeMode::DestFill); + auto [firstDynamicElemSize, + notUsed] = dynamicBitstreamSize(lhs, BitstreamSizeMode::DestFill); if (firstDynamicElemSize) dynamicSize -= dynamicSize % firstDynamicElemSize; // do not exceed srcSize } diff --git a/source/binding/CallExpression.cpp b/source/binding/CallExpression.cpp index 6abca909f..36e0b260d 100644 --- a/source/binding/CallExpression.cpp +++ b/source/binding/CallExpression.cpp @@ -45,8 +45,9 @@ Expression& CallExpression::fromSyntaxImpl(Compilation& compilation, const Expre const ArrayOrRandomizeMethodExpressionSyntax* withClause, const BindContext& context) { if (left.kind == SyntaxKind::MemberAccessExpression) { - return MemberAccessExpression::fromSyntax( - compilation, left.as(), invocation, withClause, context); + return MemberAccessExpression::fromSyntax(compilation, + left.as(), + invocation, withClause, context); } if (!NameSyntax::isKind(left.kind)) { @@ -432,8 +433,8 @@ static const Expression* bindIteratorExpr(Compilation& compilation, // Create the iterator variable and set it up with a bind context so that it // can be found by the iteration expression. - auto it = - compilation.emplace(*context.scope, iteratorName, iteratorLoc, arrayType); + auto it = compilation.emplace(*context.scope, iteratorName, iteratorLoc, + arrayType); iterVar = it; BindContext iterCtx = context; @@ -449,7 +450,7 @@ Expression& CallExpression::createSystemCall( const ArrayOrRandomizeMethodExpressionSyntax* withClause, SourceRange range, const BindContext& context, const Scope* randomizeScope) { - SystemCallInfo callInfo{ &subroutine, context.scope, {} }; + SystemCallInfo callInfo{&subroutine, context.scope, {}}; SmallVectorSized buffer; if (firstArg) buffer.append(firstArg); @@ -474,7 +475,7 @@ Expression& CallExpression::createSystemCall( if (!iterOrThis || iterOrThis->bad()) return badExpr(compilation, iterOrThis); - callInfo.extraInfo = IteratorCallInfo{ iterOrThis, iterVar }; + callInfo.extraInfo = IteratorCallInfo{iterOrThis, iterVar}; } } else { @@ -601,8 +602,9 @@ Expression& CallExpression::createSystemCall( } const Type& type = subroutine.checkArguments(context, buffer, range, iterOrThis); - auto expr = compilation.emplace( - callInfo, type, nullptr, buffer.copy(compilation), context.getLocation(), range); + auto expr = compilation.emplace(callInfo, type, nullptr, + buffer.copy(compilation), context.getLocation(), + range); if (type.isError()) return badExpr(compilation, expr); @@ -730,8 +732,8 @@ std::pair CallExpression::SystemCallInfo: const { auto itInfo = std::get_if(&extraInfo); if (!itInfo) - return { nullptr, nullptr }; - return { itInfo->iterExpr, itInfo->iterVar }; + return {nullptr, nullptr}; + return {itInfo->iterExpr, itInfo->iterVar}; } string_view CallExpression::getSubroutineName() const { diff --git a/source/binding/Constraints.cpp b/source/binding/Constraints.cpp index ac21fec51..843c9f0ba 100644 --- a/source/binding/Constraints.cpp +++ b/source/binding/Constraints.cpp @@ -24,27 +24,27 @@ const Constraint& Constraint::bind(const ConstraintItemSyntax& syntax, const Bin result = &ConstraintList::fromSyntax(syntax.as(), ctx); break; case SyntaxKind::ExpressionConstraint: - result = - &ExpressionConstraint::fromSyntax(syntax.as(), ctx); + result = &ExpressionConstraint::fromSyntax(syntax.as(), + ctx); break; case SyntaxKind::ImplicationConstraint: - result = - &ImplicationConstraint::fromSyntax(syntax.as(), ctx); + result = &ImplicationConstraint::fromSyntax(syntax.as(), + ctx); break; case SyntaxKind::ConditionalConstraint: - result = - &ConditionalConstraint::fromSyntax(syntax.as(), ctx); + result = &ConditionalConstraint::fromSyntax(syntax.as(), + ctx); break; case SyntaxKind::UniquenessConstraint: - result = - &UniquenessConstraint::fromSyntax(syntax.as(), ctx); + result = &UniquenessConstraint::fromSyntax(syntax.as(), + ctx); break; case SyntaxKind::DisableConstraint: result = &DisableSoftConstraint::fromSyntax(syntax.as(), ctx); break; case SyntaxKind::SolveBeforeConstraint: - result = - &SolveBeforeConstraint::fromSyntax(syntax.as(), ctx); + result = &SolveBeforeConstraint::fromSyntax(syntax.as(), + ctx); break; case SyntaxKind::LoopConstraint: result = &ForeachConstraint::fromSyntax(syntax.as(), ctx); @@ -366,8 +366,8 @@ Constraint& UniquenessConstraint::fromSyntax(const UniquenessConstraintSyntax& s else if (!commonType->isEquivalent(*symType)) { // All variables used in a uniqueness constraint must have equivalent types. if (!bad && !commonType->isError() && !symType->isError()) { - auto& diag = - context.addDiag(diag::InequivalentUniquenessTypes, expr.sourceRange); + auto& diag = context.addDiag(diag::InequivalentUniquenessTypes, + expr.sourceRange); diag << sym->name << *symType << *commonType; bad = true; } diff --git a/source/binding/Expression.cpp b/source/binding/Expression.cpp index 9ef8add32..8e5424abc 100644 --- a/source/binding/Expression.cpp +++ b/source/binding/Expression.cpp @@ -157,12 +157,14 @@ struct Expression::PropagationVisitor { Expression* result = &expr; if (needConversion) { if (assignmentLoc) { - result = &ConversionExpression::makeImplicit( - context, newType, ConversionKind::Implicit, expr, assignmentLoc); + result = &ConversionExpression::makeImplicit(context, newType, + ConversionKind::Implicit, expr, + assignmentLoc); } else { - result = &ConversionExpression::makeImplicit( - context, newType, ConversionKind::Propagated, expr, expr.sourceRange.start()); + result = &ConversionExpression::makeImplicit(context, newType, + ConversionKind::Propagated, expr, + expr.sourceRange.start()); } } @@ -187,7 +189,7 @@ const Expression& Expression::bindLValue(const ExpressionSyntax& lhs, const Type // Create a placeholder expression that will carry the type of the rhs. // Nothing will ever actually look at this expression, it's there only // to fill the space in the created AssignmentExpression. - SourceRange rhsRange{ location, location }; + SourceRange rhsRange{location, location}; auto rhsExpr = comp.emplace(rhs, rhsRange); if (rhsExpr->bad()) return badExpr(comp, nullptr); @@ -196,8 +198,8 @@ const Expression& Expression::bindLValue(const ExpressionSyntax& lhs, const Type Expression* lhsExpr; if (lhs.kind == SyntaxKind::StreamingConcatenationExpression && !isInout && (!instance || instance->arrayPath.empty())) { - lhsExpr = - &selfDetermined(comp, lhs, context, BindFlags::StreamingAllowed | BindFlags::LValue); + lhsExpr = &selfDetermined(comp, lhs, context, + BindFlags::StreamingAllowed | BindFlags::LValue); } else { lhsExpr = &create(comp, lhs, context, BindFlags::LValue, rhsExpr->type); @@ -214,9 +216,10 @@ const Expression& Expression::bindLValue(const ExpressionSyntax& lhs, const Type } SourceRange lhsRange = lhs.sourceRange(); - return AssignmentExpression::fromComponents( - comp, std::nullopt, assignFlags, *lhsExpr, *rhsExpr, lhsRange.start(), - /* timingControl */ nullptr, lhsRange, context.resetFlags(BindFlags::OutputArg)); + return AssignmentExpression::fromComponents(comp, std::nullopt, assignFlags, *lhsExpr, *rhsExpr, + lhsRange.start(), + /* timingControl */ nullptr, lhsRange, + context.resetFlags(BindFlags::OutputArg)); } const Expression& Expression::bindRValue(const Type& lhs, const ExpressionSyntax& rhs, @@ -647,13 +650,15 @@ Expression& Expression::create(Compilation& compilation, const ExpressionSyntax& case SyntaxKind::UnaryLogicalNotExpression: case SyntaxKind::UnaryPreincrementExpression: case SyntaxKind::UnaryPredecrementExpression: - result = &UnaryExpression::fromSyntax( - compilation, syntax.as(), context); + result = &UnaryExpression::fromSyntax(compilation, + syntax.as(), + context); break; case SyntaxKind::PostincrementExpression: case SyntaxKind::PostdecrementExpression: - result = &UnaryExpression::fromSyntax( - compilation, syntax.as(), context); + result = &UnaryExpression::fromSyntax(compilation, + syntax.as(), + context); break; case SyntaxKind::AddExpression: case SyntaxKind::SubtractExpression: @@ -700,12 +705,14 @@ Expression& Expression::create(Compilation& compilation, const ExpressionSyntax& case SyntaxKind::ArithmeticLeftShiftAssignmentExpression: case SyntaxKind::ArithmeticRightShiftAssignmentExpression: case SyntaxKind::NonblockingAssignmentExpression: - result = &AssignmentExpression::fromSyntax( - compilation, syntax.as(), context); + result = &AssignmentExpression::fromSyntax(compilation, + syntax.as(), + context); break; case SyntaxKind::InvocationExpression: - result = &CallExpression::fromSyntax( - compilation, syntax.as(), nullptr, context); + result = &CallExpression::fromSyntax(compilation, + syntax.as(), nullptr, + context); // The syntax node might have already been assigned after creating the // call expression, for cases like let decls that get expanded in place. @@ -714,24 +721,27 @@ Expression& Expression::create(Compilation& compilation, const ExpressionSyntax& return *result; break; case SyntaxKind::ConditionalExpression: - result = &ConditionalExpression::fromSyntax( - compilation, syntax.as(), context, assignmentTarget); + result = &ConditionalExpression::fromSyntax(compilation, + syntax.as(), + context, assignmentTarget); break; case SyntaxKind::InsideExpression: result = &InsideExpression::fromSyntax(compilation, syntax.as(), context); break; case SyntaxKind::MemberAccessExpression: - result = &MemberAccessExpression::fromSyntax( - compilation, syntax.as(), nullptr, nullptr, context); + result = &MemberAccessExpression::fromSyntax(compilation, + syntax.as(), + nullptr, nullptr, context); break; case SyntaxKind::ConcatenationExpression: result = &ConcatenationExpression::fromSyntax( compilation, syntax.as(), context, assignmentTarget); break; case SyntaxKind::EmptyQueueExpression: - result = &ConcatenationExpression::fromEmpty( - compilation, syntax.as(), context, assignmentTarget); + result = &ConcatenationExpression::fromEmpty(compilation, + syntax.as(), + context, assignmentTarget); break; case SyntaxKind::MultipleConcatenationExpression: result = &ReplicationExpression::fromSyntax( @@ -751,17 +761,19 @@ Expression& Expression::create(Compilation& compilation, const ExpressionSyntax& syntax.as(), context); break; case SyntaxKind::SignedCastExpression: - result = &ConversionExpression::fromSyntax( - compilation, syntax.as(), context); + result = &ConversionExpression::fromSyntax(compilation, + syntax.as(), + context); break; case SyntaxKind::AssignmentPatternExpression: - result = - &bindAssignmentPattern(compilation, syntax.as(), - context, assignmentTarget); + result = &bindAssignmentPattern(compilation, + syntax.as(), context, + assignmentTarget); break; case SyntaxKind::OpenRangeExpression: - result = &OpenRangeExpression::fromSyntax( - compilation, syntax.as(), context); + result = &OpenRangeExpression::fromSyntax(compilation, + syntax.as(), + context); break; case SyntaxKind::ExpressionOrDist: result = &DistExpression::fromSyntax(compilation, syntax.as(), @@ -774,16 +786,19 @@ Expression& Expression::create(Compilation& compilation, const ExpressionSyntax& result = &badExpr(compilation, nullptr); break; case SyntaxKind::NewArrayExpression: - result = &NewArrayExpression::fromSyntax( - compilation, syntax.as(), context, assignmentTarget); + result = &NewArrayExpression::fromSyntax(compilation, + syntax.as(), context, + assignmentTarget); break; case SyntaxKind::NewClassExpression: - result = &NewClassExpression::fromSyntax( - compilation, syntax.as(), context, assignmentTarget); + result = &NewClassExpression::fromSyntax(compilation, + syntax.as(), context, + assignmentTarget); break; case SyntaxKind::CopyClassExpression: - result = &CopyClassExpression::fromSyntax( - compilation, syntax.as(), context); + result = &CopyClassExpression::fromSyntax(compilation, + syntax.as(), + context); break; case SyntaxKind::DefaultPatternKeyExpression: // This should not be reachable from any valid expression binding. @@ -791,16 +806,18 @@ Expression& Expression::create(Compilation& compilation, const ExpressionSyntax& result = &badExpr(compilation, nullptr); break; case SyntaxKind::MinTypMaxExpression: - result = &MinTypMaxExpression::fromSyntax( - compilation, syntax.as(), context, assignmentTarget); + result = &MinTypMaxExpression::fromSyntax(compilation, + syntax.as(), + context, assignmentTarget); break; case SyntaxKind::ArrayOrRandomizeMethodExpression: result = &CallExpression::fromSyntax( compilation, syntax.as(), context); break; case SyntaxKind::TaggedUnionExpression: - result = &TaggedUnionExpression::fromSyntax( - compilation, syntax.as(), context, assignmentTarget); + result = &TaggedUnionExpression::fromSyntax(compilation, + syntax.as(), + context, assignmentTarget); break; default: if (NameSyntax::isKind(syntax.kind)) { @@ -877,7 +894,7 @@ Expression& Expression::bindName(Compilation& compilation, const NameSyntax& syn ASSERT(result.selectors.empty()); SourceRange callRange = invocation ? invocation->sourceRange() : syntax.sourceRange(); - CallExpression::SystemCallInfo callInfo{ result.systemSubroutine, context.scope, {} }; + CallExpression::SystemCallInfo callInfo{result.systemSubroutine, context.scope, {}}; return CallExpression::fromLookup(compilation, callInfo, nullptr, invocation, withClause, callRange, context); } @@ -1046,17 +1063,19 @@ Expression& Expression::bindSelector(Compilation& compilation, Expression& value } // The full source range of the expression includes the value and the selector syntax. - SourceRange fullRange = { value.sourceRange.start(), syntax.sourceRange().end() }; + SourceRange fullRange = {value.sourceRange.start(), syntax.sourceRange().end()}; switch (selector->kind) { case SyntaxKind::BitSelect: - return ElementSelectExpression::fromSyntax( - compilation, value, *selector->as().expr, fullRange, context); + return ElementSelectExpression::fromSyntax(compilation, value, + *selector->as().expr, + fullRange, context); case SyntaxKind::SimpleRangeSelect: case SyntaxKind::AscendingRangeSelect: case SyntaxKind::DescendingRangeSelect: - return RangeSelectExpression::fromSyntax( - compilation, value, selector->as(), fullRange, context); + return RangeSelectExpression::fromSyntax(compilation, value, + selector->as(), fullRange, + context); default: THROW_UNREACHABLE; } diff --git a/source/binding/FormatHelpers.cpp b/source/binding/FormatHelpers.cpp index adb2e3dc6..cd77d86cb 100644 --- a/source/binding/FormatHelpers.cpp +++ b/source/binding/FormatHelpers.cpp @@ -108,7 +108,7 @@ static bool checkFormatString(const BindContext& context, const StringLiteral& a SourceLocation loc = arg.sourceRange.start() + 1; auto getRange = [&](size_t offset, size_t len) { SourceLocation sl = loc + offset; - return SourceRange{ sl, sl + len }; + return SourceRange{sl, sl + len}; }; bool ok = true; @@ -218,10 +218,10 @@ optional FmtHelpers::formatArgs(string_view formatString, SourceLoc auto getRange = [&](size_t offset, size_t len) { // If this is not a string literal, we can't meaningfully get an offset. if (!isStringLiteral) - return SourceRange{ loc, loc }; + return SourceRange{loc, loc}; SourceLocation sl = loc + offset; - return SourceRange{ sl, sl + len }; + return SourceRange{sl, sl + len}; }; std::string result; @@ -372,9 +372,9 @@ static void lowerFormatArg(mir::Procedure& proc, const Expression& arg, char, mir::MIRValue argVal = proc.emitExpr(arg); const Type& type = arg.type->getCanonicalType(); if (type.isIntegral()) { - auto args = { argVal, proc.emitInt(8, uint64_t(defaultBase), false), - proc.emitInt(32, options.width.value_or(0), false), - proc.emitInt(1, options.width.has_value(), false) }; + auto args = {argVal, proc.emitInt(8, uint64_t(defaultBase), false), + proc.emitInt(32, options.width.value_or(0), false), + proc.emitInt(1, options.width.has_value(), false)}; proc.emitCall(mir::SysCallKind::printInt, args); return; } diff --git a/source/binding/LValue.cpp b/source/binding/LValue.cpp index 01b56c6bd..16b8a380f 100644 --- a/source/binding/LValue.cpp +++ b/source/binding/LValue.cpp @@ -75,8 +75,8 @@ ConstantValue LValue::load() const { } } else if constexpr (std::is_same_v) { - result = - result.getSlice(arg.range.upper(), arg.range.lower(), arg.defaultValue); + result = result.getSlice(arg.range.upper(), arg.range.lower(), + arg.defaultValue); } else if constexpr (std::is_same_v) { auto& map = *result.map(); @@ -235,7 +235,7 @@ ConstantValue* LValue::resolveInternal(optional& range) { if (arg.index < 0 || size_t(arg.index) >= target->str().size()) target = nullptr; else - range = ConstantRange{ arg.index, arg.index }; + range = ConstantRange{arg.index, arg.index}; } else { auto elems = target->elements(); @@ -250,8 +250,8 @@ ConstantValue* LValue::resolveInternal(optional& range) { } else if constexpr (std::is_same_v) { auto& map = *target->map(); - auto [it, inserted] = - map.try_emplace(std::move(arg.index), std::move(arg.defaultValue)); + auto [it, inserted] = map.try_emplace(std::move(arg.index), + std::move(arg.defaultValue)); target = &it->second; } @@ -270,7 +270,7 @@ void LValue::addBitSlice(ConstantRange range) { return; auto& elems = std::get(value).elements; - elems.emplace(BitSlice{ range }); + elems.emplace(BitSlice{range}); } void LValue::addIndex(int32_t index, ConstantValue&& defaultValue) { @@ -278,7 +278,7 @@ void LValue::addIndex(int32_t index, ConstantValue&& defaultValue) { return; auto& elems = std::get(value).elements; - elems.emplace(ElementIndex{ index, std::move(defaultValue), false }); + elems.emplace(ElementIndex{index, std::move(defaultValue), false}); } void LValue::addIndexOutOfBounds(ConstantValue&& defaultValue) { @@ -286,7 +286,7 @@ void LValue::addIndexOutOfBounds(ConstantValue&& defaultValue) { return; auto& elems = std::get(value).elements; - elems.emplace(ElementIndex{ 0, std::move(defaultValue), true }); + elems.emplace(ElementIndex{0, std::move(defaultValue), true}); } void LValue::addArraySlice(ConstantRange range, ConstantValue&& defaultValue) { @@ -294,7 +294,7 @@ void LValue::addArraySlice(ConstantRange range, ConstantValue&& defaultValue) { return; auto& elems = std::get(value).elements; - elems.emplace(ArraySlice{ range, std::move(defaultValue) }); + elems.emplace(ArraySlice{range, std::move(defaultValue)}); } void LValue::addArrayLookup(ConstantValue&& index, ConstantValue&& defaultValue) { @@ -302,7 +302,7 @@ void LValue::addArrayLookup(ConstantValue&& index, ConstantValue&& defaultValue) return; auto& elems = std::get(value).elements; - elems.emplace(ArrayLookup{ std::move(index), std::move(defaultValue) }); + elems.emplace(ArrayLookup{std::move(index), std::move(defaultValue)}); } } // namespace slang diff --git a/source/binding/LiteralExpressions.cpp b/source/binding/LiteralExpressions.cpp index fc0ed208e..cdfca805b 100644 --- a/source/binding/LiteralExpressions.cpp +++ b/source/binding/LiteralExpressions.cpp @@ -23,8 +23,8 @@ IntegerLiteral::IntegerLiteral(BumpAllocator& alloc, const Type& type, const SVI if (value.isSingleWord()) valueStorage.val = *value.getRawPtr(); else { - valueStorage.pVal = - (uint64_t*)alloc.allocate(sizeof(uint64_t) * value.getNumWords(), alignof(uint64_t)); + valueStorage.pVal = (uint64_t*)alloc.allocate(sizeof(uint64_t) * value.getNumWords(), + alignof(uint64_t)); memcpy(valueStorage.pVal, value.getRawPtr(), sizeof(uint64_t) * value.getNumWords()); } } diff --git a/source/binding/Lookup.cpp b/source/binding/Lookup.cpp index d8b484888..71ccdde8b 100644 --- a/source/binding/Lookup.cpp +++ b/source/binding/Lookup.cpp @@ -33,8 +33,8 @@ namespace slang { -const LookupLocation LookupLocation::max{ nullptr, UINT_MAX }; -const LookupLocation LookupLocation::min{ nullptr, 0 }; +const LookupLocation LookupLocation::max{nullptr, UINT_MAX}; +const LookupLocation LookupLocation::min{nullptr, 0}; LookupLocation LookupLocation::before(const Symbol& symbol) { return LookupLocation(symbol.getParentScope(), (uint32_t)symbol.getIndex()); @@ -203,7 +203,7 @@ const NameSyntax* splitScopedName(const ScopedNameSyntax& syntax, // left-recursive name tree, so that's all we'll bother to handle. const ScopedNameSyntax* scoped = &syntax; while (true) { - nameParts.append({ *scoped->right, scoped->separator.location(), scoped->right->kind }); + nameParts.append({*scoped->right, scoped->separator.location(), scoped->right->kind}); if (scoped->separator.kind == TokenKind::Dot) colonParts = 0; else @@ -290,7 +290,7 @@ bool lookupDownward(span nameParts, NameComponents name, for (; it != nameParts.rend(); it++) { auto& memberName = it->name; result.selectors.append(LookupResult::MemberSelector{ - memberName.text, it->dotLocation, memberName.range }); + memberName.text, it->dotLocation, memberName.range}); result.selectors.appendRange(memberName.selectors); @@ -665,7 +665,7 @@ bool resolveColonNames(SmallVectorSized& nameParts, int colonPar Token last = name.selectors.back()->getLastToken(); result.addDiag(*context.scope, diag::InvalidScopeIndexExpression, - { first.location(), last.location() }); + {first.location(), last.location()}); return false; } @@ -853,8 +853,8 @@ void Lookup::name(const NameSyntax& syntax, const BindContext& context, bitmask< // If this is a system name, look up directly in the compilation. Token nameToken = syntax.as().systemIdentifier; result.found = nullptr; - result.systemSubroutine = - scope.getCompilation().getSystemSubroutine(nameToken.valueText()); + result.systemSubroutine = scope.getCompilation().getSystemSubroutine( + nameToken.valueText()); if (!result.systemSubroutine) { result.addDiag(scope, diag::UnknownSystemName, nameToken.range()) @@ -976,8 +976,8 @@ static const Symbol* selectSingleChild(const Symbol& symbol, const BitSelectSynt return nullptr; if (!array.range.containsPoint(*index)) { - auto& diag = - result.addDiag(*context.scope, diag::ScopeIndexOutOfRange, syntax.sourceRange()); + auto& diag = result.addDiag(*context.scope, diag::ScopeIndexOutOfRange, + syntax.sourceRange()); diag << *index; diag.addNote(diag::NoteDeclarationHere, symbol.location); return nullptr; @@ -995,8 +995,8 @@ static const Symbol* selectSingleChild(const Symbol& symbol, const BitSelectSynt return entry; } - auto& diag = - result.addDiag(*context.scope, diag::ScopeIndexOutOfRange, syntax.sourceRange()); + auto& diag = result.addDiag(*context.scope, diag::ScopeIndexOutOfRange, + syntax.sourceRange()); diag << *index; diag.addNote(diag::NoteDeclarationHere, symbol.location); return nullptr; @@ -1017,7 +1017,7 @@ static const Symbol* selectChildRange(const InstanceArraySymbol& array, ConstantRange selRange; if (syntax.kind == SyntaxKind::SimpleRangeSelect) { - selRange = { *left, *right }; + selRange = {*left, *right}; if (selRange.isLittleEndian() != array.range.isLittleEndian() && selRange.width() > 1) { auto& diag = result.addDiag(*context.scope, diag::InstanceArrayEndianMismatch, syntax.sourceRange()); @@ -1032,9 +1032,9 @@ static const Symbol* selectChildRange(const InstanceArraySymbol& array, return nullptr; } - auto range = - ConstantRange::getIndexedRange(*left, *right, array.range.isLittleEndian(), - syntax.kind == SyntaxKind::AscendingRangeSelect); + auto range = ConstantRange::getIndexedRange(*left, *right, array.range.isLittleEndian(), + syntax.kind == + SyntaxKind::AscendingRangeSelect); if (!range) { result.addDiag(*context.scope, diag::RangeWidthOverflow, syntax.sourceRange()); return nullptr; @@ -1044,8 +1044,8 @@ static const Symbol* selectChildRange(const InstanceArraySymbol& array, } if (!array.range.containsPoint(selRange.left) || !array.range.containsPoint(selRange.right)) { - auto& diag = - result.addDiag(*context.scope, diag::BadInstanceArrayRange, syntax.sourceRange()); + auto& diag = result.addDiag(*context.scope, diag::BadInstanceArrayRange, + syntax.sourceRange()); diag << selRange.left << selRange.right; diag << array.range.left << array.range.right; return nullptr; @@ -1058,7 +1058,7 @@ static const Symbol* selectChildRange(const InstanceArraySymbol& array, auto elems = array.elements.subspan(size_t(begin), size_t(end - begin) + 1); - ConstantRange newRange{ int32_t(selRange.width()) - 1, 0 }; + ConstantRange newRange{int32_t(selRange.width()) - 1, 0}; if (!selRange.isLittleEndian()) newRange = newRange.reverse(); @@ -1076,8 +1076,8 @@ const Symbol* Lookup::selectChild(const Symbol& initialSymbol, symbol->kind != SymbolKind::GenerateBlockArray) { // I think it's safe to assume that the symbol name here will not be empty // because if it was, it'd be an instance array or generate array. - auto& diag = - result.addDiag(*context.scope, diag::ScopeNotIndexable, syntax->sourceRange()); + auto& diag = result.addDiag(*context.scope, diag::ScopeNotIndexable, + syntax->sourceRange()); diag << symbol->name; diag.addNote(diag::NoteDeclarationHere, symbol->location); return nullptr; @@ -1105,9 +1105,9 @@ const Symbol* Lookup::selectChild(const Symbol& initialSymbol, if (symbol->kind != SymbolKind::InstanceArray) return selectorError(); - symbol = - selectChildRange(symbol->as(), - syntax->selector->as(), context, result); + symbol = selectChildRange(symbol->as(), + syntax->selector->as(), context, + result); if (!symbol) return nullptr; break; @@ -1225,9 +1225,9 @@ std::pair Lookup::getContainingClass(const Scope& scope) } if (parent->kind == SymbolKind::ClassType) - return { &parent->as(), inStatic }; + return {&parent->as(), inStatic}; - return { nullptr, inStatic }; + return {nullptr, inStatic}; } Visibility Lookup::getVisibility(const Symbol& symbol) { @@ -1600,7 +1600,7 @@ void Lookup::unqualifiedImpl(const Scope& scope, string_view name, LookupLocatio const Symbol* imported = package->findForImport(name); if (imported && importDedup.emplace(imported).second) - imports.emplace(Import{ imported, import }); + imports.emplace(Import{imported, import}); } if (!imports.empty()) { @@ -1941,8 +1941,8 @@ void Lookup::reportUndeclared(const Scope& initialScope, string_view name, Sourc if (member.name.empty() || !isViable(member)) continue; - int dist = - editDistance(member.name, name, /* allowReplacements */ true, bestDistance); + int dist = editDistance(member.name, name, /* allowReplacements */ true, + bestDistance); if (dist < bestDistance) { closestSym = &member; bestDistance = dist; diff --git a/source/binding/MiscExpressions.cpp b/source/binding/MiscExpressions.cpp index dba5afb74..cbde1f14d 100644 --- a/source/binding/MiscExpressions.cpp +++ b/source/binding/MiscExpressions.cpp @@ -371,8 +371,8 @@ bool NamedValueExpression::checkConstant(EvalContext& context) const { scope = scope->asSymbol().getParentScope(); if (scope != subroutine) { - auto& diag = - context.addDiag(diag::ConstEvalFunctionIdentifiersMustBeLocal, sourceRange); + auto& diag = context.addDiag(diag::ConstEvalFunctionIdentifiersMustBeLocal, + sourceRange); diag.addNote(diag::NoteDeclarationHere, symbol.location); return false; } @@ -526,7 +526,7 @@ static std::tuple decomposeP } } - return { seqExpr, regExpr }; + return {seqExpr, regExpr}; } static bool checkAssertionArg(const PropertyExprSyntax& propExpr, const AssertionPortSymbol& formal, @@ -664,8 +664,8 @@ static const AssertionExpr& bindAssertionBody(const Symbol& symbol, const Syntax result.requireSequence(context); if (outputLocalVarArgLoc && result.admitsEmpty()) { - auto& diag = - context.addDiag(diag::LocalVarOutputEmptyMatch, sds.seqExpr->sourceRange()); + auto& diag = context.addDiag(diag::LocalVarOutputEmptyMatch, + sds.seqExpr->sourceRange()); diag << symbol.name; diag.addNote(diag::NoteDeclarationHere, outputLocalVarArgLoc); } @@ -746,8 +746,9 @@ Expression& AssertionInstanceExpression::fromLookup(const Symbol& symbol, // the recursion. if (currInst->isRecursive) { auto& body = *comp.emplace(nullptr); - return *comp.emplace( - *type, symbol, body, /* isRecursiveProperty */ true, range); + return *comp.emplace(*type, symbol, body, + /* isRecursiveProperty */ true, + range); } instance.isRecursive = true; } @@ -849,7 +850,7 @@ Expression& AssertionInstanceExpression::fromLookup(const Symbol& symbol, if (!checkAssertionArg(*expr, *formal, *argCtx, arg, instance.isRecursive)) bad = true; else - actualArgs.append({ formal, arg }); + actualArgs.append({formal, arg}); if (!outputLocalVarArgLoc && (formal->localVarDirection == ArgumentDirection::InOut || formal->localVarDirection == ArgumentDirection::Out)) { @@ -989,7 +990,7 @@ Expression& AssertionInstanceExpression::makeDefault(const Symbol& symbol) { auto& body = bindAssertionBody(symbol, *bodySyntax, bodyContext, outputLocalVarArgLoc, instance, localVars); - SourceRange range{ symbol.location, symbol.location + 1 }; + SourceRange range{symbol.location, symbol.location + 1}; auto result = comp.emplace(*type, symbol, body, /* isRecursiveProperty */ false, range); result->localVars = localVars.copy(comp); @@ -1085,8 +1086,9 @@ Expression& AssertionInstanceExpression::bindPort(const Symbol& symbol, SourceRa auto& result = AssertionExpr::bind(*propExpr, argCtx); auto& resultType = seqExpr ? comp.getType(SyntaxKind::SequenceType) : comp.getType(SyntaxKind::PropertyType); - return *comp.emplace( - resultType, formal, result, /* isRecursiveProperty */ false, range); + return *comp.emplace(resultType, formal, result, + /* isRecursiveProperty */ false, + range); } case SymbolKind::SequenceType: case SymbolKind::PropertyType: { @@ -1095,8 +1097,9 @@ Expression& AssertionInstanceExpression::bindPort(const Symbol& symbol, SourceRa ? comp.getType(SyntaxKind::SequenceType) : comp.getType(SyntaxKind::PropertyType); - return *comp.emplace( - resultType, formal, result, /* isRecursiveProperty */ false, range); + return *comp.emplace(resultType, formal, result, + /* isRecursiveProperty */ false, + range); } case SymbolKind::EventType: // If an event expression is allowed here, bind and return. Otherwise issue @@ -1207,8 +1210,8 @@ Expression& CopyClassExpression::fromSyntax(Compilation& compilation, const CopyClassExpressionSyntax& syntax, const BindContext& context) { auto& source = selfDetermined(compilation, *syntax.expr, context); - auto result = - compilation.emplace(*source.type, source, syntax.sourceRange()); + auto result = compilation.emplace(*source.type, source, + syntax.sourceRange()); if (source.bad()) return badExpr(compilation, result); @@ -1244,12 +1247,12 @@ Expression& DistExpression::fromSyntax(Compilation& comp, const ExpressionOrDist SmallVectorSized items; size_t index = 1; for (auto item : syntax.distribution->items) { - DistItem di{ *bound[index++], {} }; + DistItem di{*bound[index++], {}}; if (item->weight) { auto weightKind = item->weight->op.kind == TokenKind::ColonSlash ? DistWeight::PerRange : DistWeight::PerValue; auto& weightExpr = Expression::bind(*item->weight->expr, context); - di.weight.emplace(DistWeight{ weightKind, weightExpr }); + di.weight.emplace(DistWeight{weightKind, weightExpr}); if (!context.requireIntegral(weightExpr)) bad = true; diff --git a/source/binding/OperatorExpressions.cpp b/source/binding/OperatorExpressions.cpp index 9581fd472..c00917e74 100644 --- a/source/binding/OperatorExpressions.cpp +++ b/source/binding/OperatorExpressions.cpp @@ -321,8 +321,8 @@ Expression& UnaryExpression::fromSyntax(Compilation& compilation, case SyntaxKind::UnaryLogicalNotExpression: // Supported for both integral and real types. Result is a single bit. good = type->isNumeric(); - result->type = - type->isFourState() ? &compilation.getLogicType() : &compilation.getBitType(); + result->type = type->isFourState() ? &compilation.getLogicType() + : &compilation.getBitType(); selfDetermined(context, result->operand_); break; case SyntaxKind::UnaryBitwiseNotExpression: @@ -338,8 +338,8 @@ Expression& UnaryExpression::fromSyntax(Compilation& compilation, case SyntaxKind::UnaryBitwiseXnorExpression: // Supported for integral only. Result type is always a single bit. good = type->isIntegral(); - result->type = - type->isFourState() ? &compilation.getLogicType() : &compilation.getBitType(); + result->type = type->isFourState() ? &compilation.getLogicType() + : &compilation.getBitType(); selfDetermined(context, result->operand_); break; case SyntaxKind::UnaryPreincrementExpression: @@ -728,8 +728,8 @@ Expression& BinaryExpression::fromComponents(Expression& lhs, Expression& rhs, B } else { good = bothIntegral; - result->type = - lt->isFourState() ? &compilation.getLogicType() : &compilation.getBitType(); + result->type = lt->isFourState() ? &compilation.getLogicType() + : &compilation.getBitType(); } // Result type is fixed but the two operands affect each other as they would @@ -964,7 +964,7 @@ Expression& ConditionalExpression::fromSyntax(Compilation& comp, isTrue = false; } - conditions.append({ &cond, pattern }); + conditions.append({&cond, pattern}); } // If the predicate is known at compile time, we can tell which branch will be unevaluated. @@ -1399,9 +1399,10 @@ Expression& ConcatenationExpression::fromSyntax(Compilation& compilation, } if (errored) { - return badExpr(compilation, compilation.emplace( - compilation.getErrorType(), span(), - syntax.sourceRange())); + return badExpr(compilation, + compilation.emplace(compilation.getErrorType(), + span(), + syntax.sourceRange())); } const Type* type; @@ -1435,8 +1436,9 @@ Expression& ConcatenationExpression::fromEmpty(Compilation& compilation, return badExpr(compilation, nullptr); } - return *compilation.emplace( - *assignmentTarget, span{}, syntax.sourceRange()); + return *compilation.emplace(*assignmentTarget, + span{}, + syntax.sourceRange()); } ConstantValue ConcatenationExpression::evalImpl(EvalContext& context) const { @@ -1617,8 +1619,9 @@ Expression& ReplicationExpression::fromSyntax(Compilation& compilation, if (!width) return badExpr(compilation, result); - result->type = &compilation.getType( - *width, right->type->isFourState() ? IntegralFlags::FourState : IntegralFlags::TwoState); + result->type = &compilation.getType(*width, right->type->isFourState() + ? IntegralFlags::FourState + : IntegralFlags::TwoState); return *result; } @@ -1723,8 +1726,8 @@ Expression& StreamingConcatenationExpression::fromSyntax( assignmentTarget); } else { - arg = - &selfDetermined(comp, *argSyntax->expression, context, BindFlags::StreamingAllowed); + arg = &selfDetermined(comp, *argSyntax->expression, context, + BindFlags::StreamingAllowed); } if (arg->bad()) @@ -1771,13 +1774,14 @@ Expression& StreamingConcatenationExpression::fromSyntax( } } - buffer.append({ arg, withExpr, constantWithWidth }); + buffer.append({arg, withExpr, constantWithWidth}); } // Streaming concatenation has no explicit type. Use void to prevent problems when // its type is passed to context-determined expressions. - return *comp.emplace( - comp.getVoidType(), sliceSize, buffer.ccopy(comp), syntax.sourceRange()); + return *comp.emplace(comp.getVoidType(), sliceSize, + buffer.ccopy(comp), + syntax.sourceRange()); } ConstantValue StreamingConcatenationExpression::evalImpl(EvalContext& context) const { @@ -1878,8 +1882,8 @@ Expression& OpenRangeExpression::fromSyntax(Compilation& comp, Expression& left = create(comp, *syntax.left, context, flags); Expression& right = create(comp, *syntax.right, context, flags); - auto result = - comp.emplace(comp.getVoidType(), left, right, syntax.sourceRange()); + auto result = comp.emplace(comp.getVoidType(), left, right, + syntax.sourceRange()); if (left.bad() || right.bad()) return badExpr(comp, result); diff --git a/source/binding/Patterns.cpp b/source/binding/Patterns.cpp index 715efe8d8..be7120fe0 100644 --- a/source/binding/Patterns.cpp +++ b/source/binding/Patterns.cpp @@ -306,7 +306,7 @@ Pattern& StructurePattern::fromSyntax(const StructurePatternSyntax& syntax, cons auto& pattern = bind(patternSyntax, it->getType(), varMap, context); bad |= pattern.bad(); - patterns.append({ &(*it), &pattern }); + patterns.append({&(*it), &pattern}); it++; } @@ -335,7 +335,7 @@ Pattern& StructurePattern::fromSyntax(const StructurePatternSyntax& syntax, cons auto& pattern = bind(*nspms.pattern, field.getType(), varMap, context); bad |= pattern.bad(); - patterns.append({ &field, &pattern }); + patterns.append({&field, &pattern}); } } diff --git a/source/binding/SelectExpressions.cpp b/source/binding/SelectExpressions.cpp index 107764435..457247e6b 100644 --- a/source/binding/SelectExpressions.cpp +++ b/source/binding/SelectExpressions.cpp @@ -159,8 +159,8 @@ Expression& ElementSelectExpression::fromSyntax(Compilation& compilation, Expres return badExpr(compilation, nullptr); } - auto result = - compilation.emplace(resultType, value, *selector, fullRange); + auto result = compilation.emplace(resultType, value, *selector, + fullRange); if (selector->bad() || result->bad()) return badExpr(compilation, result); @@ -350,14 +350,14 @@ optional ElementSelectExpression::evalIndex(EvalContext& context, // Unpacked arrays are stored reversed in memory, so reverse the range here. range = range.reverse(); int32_t i = range.translateIndex(*index); - return ConstantRange{ i, i }; + return ConstantRange{i, i}; } // For packed arrays, we're selecting bit ranges, not necessarily single bits, // so multiply out by the width of each element. int32_t width = (int32_t)type->getBitWidth(); int32_t i = range.translateIndex(*index) * width; - return ConstantRange{ i + width - 1, i }; + return ConstantRange{i + width - 1, i}; } if (val) { @@ -378,7 +378,7 @@ optional ElementSelectExpression::evalIndex(EvalContext& context, return std::nullopt; } - return ConstantRange{ *index, *index }; + return ConstantRange{*index, *index}; } bool ElementSelectExpression::requireLValueImpl(const BindContext& context, SourceLocation location, @@ -429,8 +429,9 @@ Expression& RangeSelectExpression::fromSyntax(Compilation& compilation, Expressi auto& left = bind(*syntax.left, context, extraFlags); auto& right = bind(*syntax.right, context, extraFlags); - auto result = compilation.emplace( - selectionKind, compilation.getErrorType(), value, left, right, fullRange); + auto result = compilation.emplace(selectionKind, + compilation.getErrorType(), value, + left, right, fullRange); if (value.bad() || left.bad() || right.bad()) return badExpr(compilation, result); @@ -477,7 +478,7 @@ Expression& RangeSelectExpression::fromSyntax(Compilation& compilation, Expressi return badExpr(compilation, result); // If the array type has a fixed range, validate that the range we're selecting is allowed. - SourceRange errorRange{ left.sourceRange.start(), right.sourceRange.end() }; + SourceRange errorRange{left.sourceRange.start(), right.sourceRange.end()}; if (valueType.hasFixedRange()) { ConstantRange selectionRange; ConstantRange valueRange = valueType.getFixedRange(); @@ -498,7 +499,7 @@ Expression& RangeSelectExpression::fromSyntax(Compilation& compilation, Expressi if (!lv) return badExpr(compilation, result); - selectionRange = { *lv, *rv }; + selectionRange = {*lv, *rv}; if (selectionRange.isLittleEndian() != valueRange.isLittleEndian() && selectionRange.width() > 1) { auto& diag = context.addDiag(diag::SelectEndianMismatch, errorRange); @@ -539,9 +540,9 @@ Expression& RangeSelectExpression::fromSyntax(Compilation& compilation, Expressi // Otherwise, the resulting range will start with the fixed lower bound of the type. int32_t l = selectionKind == RangeSelectionKind::IndexedUp ? valueRange.lower() : valueRange.upper(); - auto range = - ConstantRange::getIndexedRange(l, *rv, valueRange.isLittleEndian(), - selectionKind == RangeSelectionKind::IndexedUp); + auto range = ConstantRange::getIndexedRange(l, *rv, valueRange.isLittleEndian(), + selectionKind == + RangeSelectionKind::IndexedUp); if (!range) { context.addDiag(diag::RangeWidthOverflow, errorRange); return badExpr(compilation, result); @@ -560,8 +561,8 @@ Expression& RangeSelectExpression::fromSyntax(Compilation& compilation, Expressi // At this point, all expressions are good, ranges have been validated and // we know the final width of the selection, so pick the result type and we're done. if (valueType.isUnpackedArray()) { - result->type = - compilation.emplace(elementType, selectionRange); + result->type = compilation.emplace(elementType, + selectionRange); } else { result->type = compilation.emplace(elementType, selectionRange); @@ -577,7 +578,7 @@ Expression& RangeSelectExpression::fromSyntax(Compilation& compilation, Expressi if (!lv) return badExpr(compilation, result); - selectionRange = { *lv, *rv }; + selectionRange = {*lv, *rv}; if (selectionRange.isLittleEndian() && selectionRange.width() > 1) { auto& diag = context.addDiag(diag::SelectEndianDynamic, errorRange); diag << selectionRange.left << selectionRange.right; @@ -614,8 +615,8 @@ Expression& RangeSelectExpression::fromConstant(Compilation& compilation, Expres return badExpr(compilation, result); const Type& valueType = *value.type; - const Type& elementType = - getIndexedType(compilation, context, valueType, value.sourceRange, value.sourceRange, true); + const Type& elementType = getIndexedType(compilation, context, valueType, value.sourceRange, + value.sourceRange, true); if (elementType.isError()) return badExpr(compilation, result); @@ -705,7 +706,7 @@ optional RangeSelectExpression::evalRange(EvalContext& context, ConstantRange result; if (selectionKind == RangeSelectionKind::Simple) { - result = { *li, *ri }; + result = {*li, *ri}; } else { bool isLittleEndian = false; @@ -818,7 +819,7 @@ Expression& MemberAccessExpression::fromSelector( return badExpr(compilation, &expr); // The source range of the entire member access starts from the value being selected. - SourceRange range{ expr.sourceRange.start(), selector.nameRange.end() }; + SourceRange range{expr.sourceRange.start(), selector.nameRange.end()}; // Special cases for built-in iterator methods that don't cleanly fit the general // mold of looking up members via the type of the expression. @@ -1225,11 +1226,11 @@ LValue MemberAccessExpression::evalLValueImpl(EvalContext& context) const { } int32_t width = (int32_t)type->getBitWidth(); - lval.addBitSlice({ width - 1, 0 }); + lval.addBitSlice({width - 1, 0}); } else { int32_t width = (int32_t)type->getBitWidth(); - lval.addBitSlice({ width + io - 1, io }); + lval.addBitSlice({width + io - 1, io}); } return lval; @@ -1239,18 +1240,18 @@ ConstantRange MemberAccessExpression::getSelectRange() const { int32_t io = (int32_t)offset; auto& valueType = value().type->getCanonicalType(); if (valueType.isUnpackedStruct()) { - return { io, io }; + return {io, io}; } else if (valueType.isUnpackedUnion()) { - return { 0, 0 }; + return {0, 0}; } else if (valueType.isPackedUnion()) { int32_t width = (int32_t)type->getBitWidth(); - return { width - 1, 0 }; + return {width - 1, 0}; } else { int32_t width = (int32_t)type->getBitWidth(); - return { width + io - 1, io }; + return {width + io - 1, io}; } } diff --git a/source/binding/Statements.cpp b/source/binding/Statements.cpp index b4818362f..879dc13fc 100644 --- a/source/binding/Statements.cpp +++ b/source/binding/Statements.cpp @@ -137,12 +137,13 @@ const Statement& Statement::bind(const StatementSyntax& syntax, const BindContex break; } case SyntaxKind::DisableStatement: - result = - &DisableStatement::fromSyntax(comp, syntax.as(), context); + result = &DisableStatement::fromSyntax(comp, syntax.as(), + context); break; case SyntaxKind::ConditionalStatement: - result = &ConditionalStatement::fromSyntax( - comp, syntax.as(), context, stmtCtx); + result = &ConditionalStatement::fromSyntax(comp, + syntax.as(), + context, stmtCtx); break; case SyntaxKind::CaseStatement: result = &CaseStatement::fromSyntax(comp, syntax.as(), context, @@ -169,8 +170,9 @@ const Statement& Statement::bind(const StatementSyntax& syntax, const BindContex if (auto block = stmtCtx.tryGetBlock(context, syntax)) return *block; - result = &ForeachLoopStatement::fromSyntax( - comp, syntax.as(), context, stmtCtx); + result = &ForeachLoopStatement::fromSyntax(comp, + syntax.as(), + context, stmtCtx); break; case SyntaxKind::DoWhileStatement: result = &DoWhileLoopStatement::fromSyntax(comp, syntax.as(), @@ -185,8 +187,9 @@ const Statement& Statement::bind(const StatementSyntax& syntax, const BindContex context, stmtCtx); break; case SyntaxKind::VoidCastedCallStatement: - result = &ExpressionStatement::fromSyntax( - comp, syntax.as(), context); + result = &ExpressionStatement::fromSyntax(comp, + syntax.as(), + context); break; case SyntaxKind::SequentialBlockStatement: case SyntaxKind::ParallelBlockStatement: @@ -210,8 +213,8 @@ const Statement& Statement::bind(const StatementSyntax& syntax, const BindContex comp, syntax.as(), context, stmtCtx); break; case SyntaxKind::DisableForkStatement: - result = - &DisableForkStatement::fromSyntax(comp, syntax.as()); + result = &DisableForkStatement::fromSyntax(comp, + syntax.as()); break; case SyntaxKind::WaitStatement: result = &WaitStatement::fromSyntax(comp, syntax.as(), context, @@ -226,8 +229,9 @@ const Statement& Statement::bind(const StatementSyntax& syntax, const BindContex break; case SyntaxKind::BlockingEventTriggerStatement: case SyntaxKind::NonblockingEventTriggerStatement: - result = &EventTriggerStatement::fromSyntax( - comp, syntax.as(), context, stmtCtx); + result = &EventTriggerStatement::fromSyntax(comp, + syntax.as(), + context, stmtCtx); break; case SyntaxKind::ProceduralAssignStatement: case SyntaxKind::ProceduralForceStatement: @@ -257,8 +261,9 @@ const Statement& Statement::bind(const StatementSyntax& syntax, const BindContex if (auto block = stmtCtx.tryGetBlock(context, syntax)) return *block; - result = &RandSequenceStatement::fromSyntax( - comp, syntax.as(), context); + result = &RandSequenceStatement::fromSyntax(comp, + syntax.as(), + context); break; case SyntaxKind::CheckerInstanceStatement: context.addDiag(diag::NotYetSupported, syntax.sourceRange()); @@ -294,8 +299,8 @@ const Statement& Statement::bindBlock(const StatementBlockSymbol& block, const S if (syntax.kind == SyntaxKind::SequentialBlockStatement || syntax.kind == SyntaxKind::ParallelBlockStatement) { auto& bss = syntax.as(); - auto& bs = - BlockStatement::fromSyntax(comp, bss, context, stmtCtx, /* addInitializers */ true); + auto& bs = BlockStatement::fromSyntax(comp, bss, context, stmtCtx, + /* addInitializers */ true); if (bs.bad()) return bs; @@ -378,7 +383,7 @@ void Statement::bindScopeInitializers(const BindContext& context, // source range here, since we don't have the real one. auto& var = member.as(); if (!var.flags.has(VariableFlags::CompilerGenerated)) { - SourceRange range{ var.location, var.location + var.name.length() }; + SourceRange range{var.location, var.location + var.name.length()}; results.append(comp.emplace(var, range)); } } @@ -632,9 +637,9 @@ void StatementList::serializeTo(ASTSerializer& serializer) const { } Statement& StatementList::makeEmpty(Compilation& compilation) { - return *compilation.emplace( - span(), - SourceRange(SourceLocation::NoLocation, SourceLocation::NoLocation)); + return *compilation.emplace(span(), + SourceRange(SourceLocation::NoLocation, + SourceLocation::NoLocation)); } Statement& BlockStatement::fromSyntax(Compilation& comp, const BlockStatementSyntax& syntax, @@ -673,8 +678,8 @@ Statement& BlockStatement::fromSyntax(Compilation& comp, const BlockStatementSyn for (auto item : syntax.items) { if (StatementSyntax::isKind(item->kind)) { - auto& stmt = - Statement::bind(item->as(), context, stmtCtx, /* inList */ true); + auto& stmt = Statement::bind(item->as(), context, stmtCtx, + /* inList */ true); buffer.append(&stmt); anyBad |= stmt.bad(); } @@ -915,7 +920,7 @@ Statement& ConditionalStatement::fromSyntax(Compilation& comp, isTrue = false; } - conditions.append({ &cond, pattern }); + conditions.append({&cond, pattern}); } // If the condition is constant, we know which branch will be taken. @@ -1015,7 +1020,7 @@ static std::tuple getConditionAndChe THROW_UNREACHABLE; } - return { condition, check }; + return {condition, check}; } Statement& CaseStatement::fromSyntax(Compilation& compilation, const CaseStatementSyntax& syntax, @@ -1062,9 +1067,9 @@ Statement& CaseStatement::fromSyntax(Compilation& compilation, const CaseStateme bool allowTypeRefs = !isInside && keyword == TokenKind::CaseKeyword; bool allowOpenRange = !wildcard; - bad |= - !Expression::bindMembershipExpressions(context, keyword, wildcard, isInside, allowTypeRefs, - allowOpenRange, *syntax.expr, expressions, bound); + bad |= !Expression::bindMembershipExpressions(context, keyword, wildcard, isInside, + allowTypeRefs, allowOpenRange, *syntax.expr, + expressions, bound); auto [condition, check] = getConditionAndCheck(syntax); @@ -1094,7 +1099,7 @@ Statement& CaseStatement::fromSyntax(Compilation& compilation, const CaseStateme group.append(*boundIt++); } - items.append({ group.copy(compilation), *stmtIt++ }); + items.append({group.copy(compilation), *stmtIt++}); group.clear(); break; } @@ -1103,8 +1108,9 @@ Statement& CaseStatement::fromSyntax(Compilation& compilation, const CaseStateme } } - auto result = compilation.emplace( - condition, check, *expr, items.copy(compilation), defStmt, syntax.sourceRange()); + auto result = compilation.emplace(condition, check, *expr, + items.copy(compilation), defStmt, + syntax.sourceRange()); if (bad) return badStmt(compilation, result); @@ -1268,7 +1274,7 @@ Statement& PatternCaseStatement::fromSyntax(Compilation& compilation, bad = true; } - items.append({ &pattern, filter, &stmt }); + items.append({&pattern, filter, &stmt}); break; } case SyntaxKind::DefaultCaseItem: @@ -1287,8 +1293,9 @@ Statement& PatternCaseStatement::fromSyntax(Compilation& compilation, } auto [condition, check] = getConditionAndCheck(syntax); - auto result = compilation.emplace( - condition, check, expr, items.copy(compilation), defStmt, syntax.sourceRange()); + auto result = compilation.emplace(condition, check, expr, + items.copy(compilation), defStmt, + syntax.sourceRange()); if (bad) return badStmt(compilation, result); @@ -1652,8 +1659,8 @@ Statement& RepeatLoopStatement::fromSyntax(Compilation& compilation, } auto& bodyStmt = Statement::bind(*syntax.statement, context, stmtCtx); - auto result = - compilation.emplace(countExpr, bodyStmt, syntax.sourceRange()); + auto result = compilation.emplace(countExpr, bodyStmt, + syntax.sourceRange()); if (bad || bodyStmt.bad()) return badStmt(compilation, result); @@ -1728,7 +1735,7 @@ const Expression* ForeachLoopStatement::buildLoopDims(const ForeachLoopListSynta } if (type->hasFixedRange()) - dims.append({ type->getFixedRange() }); + dims.append({type->getFixedRange()}); else dims.emplace(); @@ -1773,8 +1780,8 @@ const Expression* ForeachLoopStatement::buildLoopDims(const ForeachLoopListSynta // Build the iterator variable and hook it up to our new context's // linked list of iterators. - auto it = - comp.emplace(name, idName.identifier.location(), currType, *indexType); + auto it = comp.emplace(name, idName.identifier.location(), currType, + *indexType); it->nextTemp = std::exchange(context.firstTempVar, it); dims.back().loopVar = it; } @@ -1799,7 +1806,7 @@ Statement& ForeachLoopStatement::fromSyntax(Compilation& compilation, for (auto loopVar : syntax.loopList->loopVariables) { if (type->hasFixedRange()) - dims.append({ type->getFixedRange() }); + dims.append({type->getFixedRange()}); else dims.emplace(); @@ -1908,7 +1915,7 @@ ER ForeachLoopStatement::evalRecursive(EvalContext& context, const ConstantValue isLittleEndian = range.isLittleEndian(); } else { - range = { 0, int32_t(elements.size()) - 1 }; + range = {0, int32_t(elements.size()) - 1}; isLittleEndian = false; } @@ -2009,8 +2016,8 @@ Statement& DoWhileLoopStatement::fromSyntax(Compilation& compilation, bad = true; auto& bodyStmt = Statement::bind(*syntax.statement, context, stmtCtx); - auto result = - compilation.emplace(condExpr, bodyStmt, syntax.sourceRange()); + auto result = compilation.emplace(condExpr, bodyStmt, + syntax.sourceRange()); if (bad || bodyStmt.bad()) return badStmt(compilation, result); @@ -2245,8 +2252,8 @@ Statement& ImmediateAssertionStatement::fromSyntax(Compilation& compilation, if (isDeferred) isFinal = syntax.delay->finalKeyword.valid(); - bool isCover = - assertKind == AssertionKind::CoverProperty || assertKind == AssertionKind::CoverSequence; + bool isCover = assertKind == AssertionKind::CoverProperty || + assertKind == AssertionKind::CoverSequence; if (isCover && ifFalse) { context.addDiag(diag::CoverStmtNoFail, syntax.action->elseClause->sourceRange()); bad = true; @@ -2259,8 +2266,9 @@ Statement& ImmediateAssertionStatement::fromSyntax(Compilation& compilation, checkDeferredAssertAction(*ifFalse, context); } - auto result = compilation.emplace( - assertKind, cond, ifTrue, ifFalse, isDeferred, isFinal, syntax.sourceRange()); + auto result = compilation.emplace(assertKind, cond, ifTrue, + ifFalse, isDeferred, isFinal, + syntax.sourceRange()); if (bad || (ifTrue && ifTrue->bad()) || (ifFalse && ifFalse->bad())) return badStmt(compilation, result); @@ -2334,8 +2342,8 @@ Statement& ConcurrentAssertionStatement::fromSyntax( stmtCtx); } - const bool isCover = - assertKind == AssertionKind::CoverProperty || assertKind == AssertionKind::CoverSequence; + const bool isCover = assertKind == AssertionKind::CoverProperty || + assertKind == AssertionKind::CoverSequence; if (isCover && ifFalse) { ctx.addDiag(diag::CoverStmtNoFail, syntax.action->elseClause->sourceRange()); bad = true; @@ -2572,8 +2580,8 @@ Statement& ProceduralAssignStatement::fromSyntax(Compilation& compilation, bindFlags |= BindFlags::ProceduralAssign; auto& assign = Expression::bind(*syntax.expr, context, bindFlags); - auto result = - compilation.emplace(assign, isForce, syntax.sourceRange()); + auto result = compilation.emplace(assign, isForce, + syntax.sourceRange()); if (assign.bad()) return badStmt(compilation, result); @@ -2614,8 +2622,8 @@ Statement& ProceduralDeassignStatement::fromSyntax(Compilation& compilation, auto& lvalue = Expression::bind(*syntax.variable, ctx); bool isRelease = syntax.keyword.kind == TokenKind::ReleaseKeyword; - auto result = - compilation.emplace(lvalue, isRelease, syntax.sourceRange()); + auto result = compilation.emplace(lvalue, isRelease, + syntax.sourceRange()); if (lvalue.bad()) return badStmt(compilation, result); @@ -2656,15 +2664,15 @@ Statement& RandCaseStatement::fromSyntax(Compilation& compilation, for (auto item : syntax.items) { auto& expr = Expression::bind(*item->expr, context); auto& stmt = Statement::bind(*item->statement, context, stmtCtx); - items.append({ &expr, &stmt }); + items.append({&expr, &stmt}); if (stmt.bad() || !context.requireIntegral(expr)) { bad = true; } } - auto result = - compilation.emplace(items.copy(compilation), syntax.sourceRange()); + auto result = compilation.emplace(items.copy(compilation), + syntax.sourceRange()); if (bad) return badStmt(compilation, result); @@ -2701,7 +2709,7 @@ Statement& RandSequenceStatement::fromSyntax(Compilation& compilation, auto prodRange = context.scope->membersOfType(); if (prodRange.begin() != prodRange.end()) { firstProd = &*prodRange.begin(); - firstProdRange = { syntax.randsequence.location(), syntax.closeParen.range().end() }; + firstProdRange = {syntax.randsequence.location(), syntax.closeParen.range().end()}; } } diff --git a/source/binding/TimingControl.cpp b/source/binding/TimingControl.cpp index 5b2b27dac..ebc4beb50 100644 --- a/source/binding/TimingControl.cpp +++ b/source/binding/TimingControl.cpp @@ -31,20 +31,22 @@ TimingControl& TimingControl::bind(const TimingControlSyntax& syntax, const Bind result = &Delay3Control::fromSyntax(comp, syntax.as(), context); break; case SyntaxKind::EventControl: - result = - &SignalEventControl::fromSyntax(comp, syntax.as(), context); + result = &SignalEventControl::fromSyntax(comp, syntax.as(), + context); break; case SyntaxKind::EventControlWithExpression: result = &EventListControl::fromSyntax( comp, *syntax.as().expr, context); break; case SyntaxKind::ImplicitEventControl: - result = &ImplicitEventControl::fromSyntax( - comp, syntax.as(), context); + result = &ImplicitEventControl::fromSyntax(comp, + syntax.as(), + context); break; case SyntaxKind::RepeatedEventControl: - result = &RepeatedEventControl::fromSyntax( - comp, syntax.as(), context); + result = &RepeatedEventControl::fromSyntax(comp, + syntax.as(), + context); break; case SyntaxKind::OneStepDelay: result = comp.emplace(syntax.sourceRange()); @@ -76,12 +78,13 @@ TimingControl& TimingControl::bind(const PropertyExprSyntax& syntax, const BindC case SyntaxKind::SimplePropertyExpr: return bind(*syntax.as().expr, context); case SyntaxKind::ParenthesizedPropertyExpr: - result = &EventListControl::fromSyntax( - comp, syntax.as(), context); + result = &EventListControl::fromSyntax(comp, + syntax.as(), + context); break; case SyntaxKind::OrPropertyExpr: - result = - &EventListControl::fromSyntax(comp, syntax.as(), context); + result = &EventListControl::fromSyntax(comp, syntax.as(), + context); break; case SyntaxKind::IffPropertyExpr: result = &SignalEventControl::fromSyntax(comp, syntax.as(), @@ -105,12 +108,13 @@ TimingControl& TimingControl::bind(const SequenceExprSyntax& syntax, const BindC context); break; case SyntaxKind::ParenthesizedSequenceExpr: - result = &EventListControl::fromSyntax( - comp, syntax.as(), context); + result = &EventListControl::fromSyntax(comp, + syntax.as(), + context); break; case SyntaxKind::OrSequenceExpr: - result = - &EventListControl::fromSyntax(comp, syntax.as(), context); + result = &EventListControl::fromSyntax(comp, syntax.as(), + context); break; case SyntaxKind::SignalEventExpression: result = &SignalEventControl::fromSyntax(comp, syntax.as(), @@ -214,7 +218,7 @@ TimingControl& Delay3Control::fromParams(Compilation& compilation, return badCtrl(compilation, nullptr); } - const Expression* delays[3] = { nullptr }; + const Expression* delays[3] = {nullptr}; for (size_t i = 0; i < items.size(); i++) { if (items[i]->kind != SyntaxKind::OrderedParamAssignment) { context.addDiag(diag::ExpectedNetDelay, items[i]->sourceRange()); @@ -412,8 +416,8 @@ TimingControl& EventListControl::fromSyntax(Compilation& compilation, const Synt if (events.size() == 1) return *events[0]; - auto result = - compilation.emplace(events.ccopy(compilation), syntax.sourceRange()); + auto result = compilation.emplace(events.ccopy(compilation), + syntax.sourceRange()); for (auto ev : events) { if (ev->bad()) return badCtrl(compilation, result); @@ -509,7 +513,7 @@ TimingControl& BlockEventListControl::fromSyntax(const BlockEventExpressionSynta return false; } - events.append({ nullptr, evSyntax.keyword.kind == TokenKind::BeginKeyword }); + events.append({nullptr, evSyntax.keyword.kind == TokenKind::BeginKeyword}); return true; }; diff --git a/source/codegen/CGBuilder.h b/source/codegen/CGBuilder.h index 64f4e26f5..7dec8f077 100644 --- a/source/codegen/CGBuilder.h +++ b/source/codegen/CGBuilder.h @@ -77,7 +77,7 @@ class CGBuilder : public llvm::IRBuildergetType()->getScalarType()->getPointerElementType(); - return Address(CreateInBoundsGEP(ptrType, ptr, { getSize(0), getSize(index) }, ""), align); + return Address(CreateInBoundsGEP(ptrType, ptr, {getSize(0), getSize(index)}, ""), align); } private: diff --git a/source/codegen/CGSysCall.cpp b/source/codegen/CGSysCall.cpp index b05e767f6..5c7d77256 100644 --- a/source/codegen/CGSysCall.cpp +++ b/source/codegen/CGSysCall.cpp @@ -16,7 +16,7 @@ using namespace mir; // Simple wrapper to make getting function types more compact. template llvm::FunctionType* getFuncType(TRet&& ret, TParam&&... params) { - return llvm::FunctionType::get(std::forward(ret), { std::forward(params)... }, + return llvm::FunctionType::get(std::forward(ret), {std::forward(params)...}, /* isVarArg */ false); } diff --git a/source/codegen/CodeGenFunction.cpp b/source/codegen/CodeGenFunction.cpp index be5801a82..2363c4584 100644 --- a/source/codegen/CodeGenFunction.cpp +++ b/source/codegen/CodeGenFunction.cpp @@ -23,8 +23,8 @@ CodeGenFunction::CodeGenFunction(CodeGenerator& codegen, const Procedure& proc) // Create the function object itself. auto funcType = llvm::FunctionType::get(types.Void, /* isVarArg */ false); - generatedFunc = - llvm::Function::Create(funcType, llvm::Function::PrivateLinkage, "", codegen.getModule()); + generatedFunc = llvm::Function::Create(funcType, llvm::Function::PrivateLinkage, "", + codegen.getModule()); // Create the entry point basic block. auto bb = llvm::BasicBlock::Create(ctx, "entry", generatedFunc); @@ -39,14 +39,14 @@ CodeGenFunction::CodeGenFunction(CodeGenerator& codegen, const Procedure& proc) for (auto local : proc.getLocals()) { auto& astType = local->getType(); auto alignedType = types.convertType(astType); - locals.append({ createTempAlloca(alignedType), &astType, alignedType.type }); + locals.append({createTempAlloca(alignedType), &astType, alignedType.type}); } // Emit all instructions. instrValues.reserve(proc.getInstructions().size()); builder.SetInsertPoint(bb); for (auto& instr : proc.getInstructions()) { - instrValues.append({ emit(instr), &instr.type }); + instrValues.append({emit(instr), &instr.type}); } // All done! @@ -158,15 +158,15 @@ const Type& CodeGenFunction::getTypeOf(MIRValue val) const { } Address CodeGenFunction::createTempAlloca(AlignedType type) { - auto inst = - new llvm::AllocaInst(type.type, codegen.getModule().getDataLayout().getAllocaAddrSpace(), - nullptr, type.alignment, "", allocaInsertionPoint); + auto inst = new llvm::AllocaInst(type.type, + codegen.getModule().getDataLayout().getAllocaAddrSpace(), + nullptr, type.alignment, "", allocaInsertionPoint); return Address(inst, type.alignment); } Address CodeGenFunction::boxInt(llvm::Value* value, const Type& type) { // TODO: put alignment behind an ABI - auto addr = createTempAlloca({ types.BoxedInt, llvm::Align::Constant<8>() }); + auto addr = createTempAlloca({types.BoxedInt, llvm::Align::Constant<8>()}); // TODO: fix int types bitwidth_t bits = type.getBitWidth(); diff --git a/source/codegen/CodeGenTypes.cpp b/source/codegen/CodeGenTypes.cpp index 8ca1e06cb..49187f545 100644 --- a/source/codegen/CodeGenTypes.cpp +++ b/source/codegen/CodeGenTypes.cpp @@ -58,7 +58,7 @@ AlignedType CodeGenTypes::convertType(const Type& type) { lt = llvm::Type::getIntNTy(codegen.getContext(), bits); // TODO: alignment - AlignedType result{ lt, llvm::Align::Constant<8>() }; + AlignedType result{lt, llvm::Align::Constant<8>()}; typeMap.emplace(&type, result); return result; } diff --git a/source/codegen/CodeGenerator.cpp b/source/codegen/CodeGenerator.cpp index 628d57f89..bbd594fbe 100644 --- a/source/codegen/CodeGenerator.cpp +++ b/source/codegen/CodeGenerator.cpp @@ -30,7 +30,7 @@ GeneratedCode::~GeneratedCode() = default; std::pair, std::unique_ptr> GeneratedCode:: release() { - return { std::move(context), std::move(module) }; + return {std::move(context), std::move(module)}; } std::string GeneratedCode::toString() const { diff --git a/source/compilation/Compilation.cpp b/source/compilation/Compilation.cpp index 5edc7a250..a08aa4d05 100644 --- a/source/compilation/Compilation.cpp +++ b/source/compilation/Compilation.cpp @@ -115,8 +115,8 @@ Compilation::Compilation(const Bag& options) : MAKE_NETTYPE(UWire); MAKE_NETTYPE(Interconnect); - knownNetTypes[TokenKind::Unknown] = - std::make_unique(NetType::Unknown, "", *logicType); + knownNetTypes[TokenKind::Unknown] = std::make_unique(NetType::Unknown, "", + *logicType); wireNetType = knownNetTypes[TokenKind::WireKeyword].get(); #undef MAKE_NETTYPE @@ -132,8 +132,8 @@ Compilation::Compilation(const Bag& options) : registerScalar(signedLogicType); registerScalar(signedRegType); - defaultTimeScale.base = { TimeUnit::Nanoseconds, TimeScaleMagnitude::One }; - defaultTimeScale.precision = { TimeUnit::Nanoseconds, TimeScaleMagnitude::One }; + defaultTimeScale.base = {TimeUnit::Nanoseconds, TimeScaleMagnitude::One}; + defaultTimeScale.precision = {TimeUnit::Nanoseconds, TimeScaleMagnitude::One}; root = std::make_unique(*this); @@ -452,9 +452,9 @@ static void reportRedefinition(const Scope& scope, const T& newSym, const U& old void Compilation::createDefinition(const Scope& scope, LookupLocation location, const ModuleDeclarationSyntax& syntax) { auto& metadata = definitionMetadata[&syntax]; - auto def = - std::make_unique(scope, location, syntax, *metadata.defaultNetType, - metadata.unconnectedDrive, metadata.timeScale, metadata.tree); + auto def = std::make_unique(scope, location, syntax, *metadata.defaultNetType, + metadata.unconnectedDrive, metadata.timeScale, + metadata.tree); // Record that the given scope contains this definition. If the scope is a compilation unit, add // it to the root scope instead so that lookups from other compilation units will find it. @@ -485,8 +485,8 @@ const PackageSymbol* Compilation::getPackage(string_view lookupName) const { const PackageSymbol& Compilation::createPackage(const Scope& scope, const ModuleDeclarationSyntax& syntax) { auto& metadata = definitionMetadata[&syntax]; - auto& package = - PackageSymbol::fromSyntax(scope, syntax, *metadata.defaultNetType, metadata.timeScale); + auto& package = PackageSymbol::fromSyntax(scope, syntax, *metadata.defaultNetType, + metadata.timeScale); auto [it, inserted] = packageMap.emplace(package.name, &package); if (!inserted && !package.name.empty()) { @@ -659,13 +659,13 @@ void Compilation::addOutOfBlockDecl(const Scope& scope, const ScopedNameSyntax& std::tuple Compilation::findOutOfBlockDecl( const Scope& scope, string_view className, string_view declName) const { - auto it = outOfBlockDecls.find({ className, declName, &scope }); + auto it = outOfBlockDecls.find({className, declName, &scope}); if (it != outOfBlockDecls.end()) { auto& [syntax, name, index, used] = it->second; - return { syntax, index, &used }; + return {syntax, index, &used}; } - return { nullptr, SymbolIndex(), nullptr }; + return {nullptr, SymbolIndex(), nullptr}; } void Compilation::addExternInterfaceMethod(const SubroutineSymbol& method) { @@ -857,8 +857,9 @@ const Diagnostics& Compilation::getSemanticDiagnostics() { if (!used) { auto& [className, declName, scope] = key; auto classRange = name->left->sourceRange(); - auto sym = Lookup::unqualifiedAt( - *scope, className, LookupLocation(scope, uint32_t(index)), classRange); + auto sym = Lookup::unqualifiedAt(*scope, className, + LookupLocation(scope, uint32_t(index)), + classRange); if (sym && !declName.empty() && !className.empty()) { if (sym->kind == SymbolKind::ClassType || @@ -1020,7 +1021,7 @@ Diagnostic& Compilation::addDiag(Diagnostic diag) { } // Coalesce diagnostics that are at the same source location and have the same code. - if (auto it = diagMap.find({ diag.code, diag.location }); it != diagMap.end()) { + if (auto it = diagMap.find({diag.code, diag.location}); it != diagMap.end()) { auto& diagList = it->second; diagList.emplace_back(std::move(diag)); return diagList.back(); @@ -1072,8 +1073,8 @@ const Type& Compilation::getType(bitwidth_t width, bitmask flags) if (it != vectorTypeCache.end()) return *it->second; - auto type = - emplace(getScalarType(flags), ConstantRange{ int32_t(width - 1), 0 }); + auto type = emplace(getScalarType(flags), + ConstantRange{int32_t(width - 1), 0}); vectorTypeCache.emplace_hint(it, key, type); return *type; } @@ -1116,7 +1117,7 @@ void Compilation::trackImport(Scope::ImportDataIndex& index, const WildcardImpor if (index != Scope::ImportDataIndex::Invalid) importData[index].push_back(&import); else - index = importData.add({ &import }); + index = importData.add({&import}); } span Compilation::queryImports(Scope::ImportDataIndex index) { @@ -1229,8 +1230,8 @@ void Compilation::checkDPIMethods(span dpiImports scope->addDiag(diag::DPISpecDisallowed, syntax->specString.range()); auto name = syntax->name.valueText(); - auto symbol = - Lookup::unqualifiedAt(*scope, name, LookupLocation::max, syntax->name.range()); + auto symbol = Lookup::unqualifiedAt(*scope, name, LookupLocation::max, + syntax->name.range()); if (!symbol) continue; @@ -1247,8 +1248,8 @@ void Compilation::checkDPIMethods(span dpiImports syntax->functionOrTask.kind == TokenKind::TaskKeyword) || (sub.subroutineKind == SubroutineKind::Task && syntax->functionOrTask.kind == TokenKind::FunctionKeyword)) { - auto& diag = - scope->addDiag(diag::DPIExportKindMismatch, syntax->functionOrTask.range()); + auto& diag = scope->addDiag(diag::DPIExportKindMismatch, + syntax->functionOrTask.range()); diag.addNote(diag::NoteDeclarationHere, symbol->location); continue; } @@ -1302,8 +1303,8 @@ void Compilation::checkDPIMethods(span dpiImports auto [it, inserted] = nameMap.emplace(cId, &sub); if (!inserted) { if (!checkSignaturesMatch(sub, *it->second)) { - auto& diag = - scope->addDiag(diag::DPISignatureMismatch, syntax->name.range()); + auto& diag = scope->addDiag(diag::DPISignatureMismatch, + syntax->name.range()); diag << cId; diag.addNote(diag::NotePreviousDefinition, it->second->location); } @@ -1358,8 +1359,8 @@ void Compilation::checkModportExports( } if (!found) { - auto& diag = - port->getParentScope()->addDiag(diag::MissingExportImpl, port->location); + auto& diag = port->getParentScope()->addDiag(diag::MissingExportImpl, + port->location); diag << method.name << def->name; diag.addNote(diag::NoteDeclarationHere, method.location); } @@ -1410,15 +1411,15 @@ void Compilation::resolveDefParams(size_t) { else { std::string path; target->getHierarchicalPath(path); - overrides.append({ std::move(path), target->getSyntax(), defparam->getValue() }); + overrides.append({std::move(path), target->getSyntax(), defparam->getValue()}); } } }; auto checkProblem = [&](const DefParamVisitor& visitor) { if (visitor.hierarchyProblem) { - auto& diag = - root->addDiag(diag::MaxInstanceDepthExceeded, visitor.hierarchyProblem->location); + auto& diag = root->addDiag(diag::MaxInstanceDepthExceeded, + visitor.hierarchyProblem->location); diag << visitor.hierarchyProblem->getDefinition().getKindString(); diag << options.maxInstanceDepth; return true; diff --git a/source/compilation/Definition.cpp b/source/compilation/Definition.cpp index 248bd860d..aaff425f8 100644 --- a/source/compilation/Definition.cpp +++ b/source/compilation/Definition.cpp @@ -104,8 +104,8 @@ Definition::Definition(const Scope& scope, LookupLocation lookupLocation, defaultLifetime = SemanticFacts::getVariableLifetime(header.lifetime).value_or(VariableLifetime::Static); attributes = AttributeSymbol::fromSyntax(syntax.attributes, scope, lookupLocation); - hasNonAnsiPorts = - syntax.header->ports && syntax.header->ports->kind == SyntaxKind::NonAnsiPortList; + hasNonAnsiPorts = syntax.header->ports && + syntax.header->ports->kind == SyntaxKind::NonAnsiPortList; // Find all port parameters. bool hasPortParams = header.parameters != nullptr; @@ -131,8 +131,8 @@ Definition::Definition(const Scope& scope, LookupLocation lookupLocation, } else if (member->kind == SyntaxKind::ParameterDeclarationStatement) { auto declaration = member->as().parameter; - bool isLocal = - hasPortParams || declaration->keyword.kind == TokenKind::LocalParamKeyword; + bool isLocal = hasPortParams || + declaration->keyword.kind == TokenKind::LocalParamKeyword; ParameterBuilder::createDecls(scope, *declaration, isLocal, /* isPort */ false, parameters); diff --git a/source/compilation/ElabVisitors.h b/source/compilation/ElabVisitors.h index 831d8573a..92bca06bf 100644 --- a/source/compilation/ElabVisitors.h +++ b/source/compilation/ElabVisitors.h @@ -88,7 +88,7 @@ struct DiagnosticVisitor : public ASTVisitor { conn = conn->as().body.find(symbol.modport); if (conn && conn->kind == SymbolKind::Modport) - modportsWithExports.append({ &symbol, &conn->as() }); + modportsWithExports.append({&symbol, &conn->as()}); } } } @@ -258,8 +258,8 @@ struct DiagnosticVisitor : public ASTVisitor { // check the depth and bail out after a certain configurable point. auto guard = ScopeGuard([this, &symbol] { activeInstanceBodies.erase(&symbol.body); }); if (activeInstanceBodies.size() > compilation.getOptions().maxInstanceDepth) { - auto& diag = - symbol.getParentScope()->addDiag(diag::MaxInstanceDepthExceeded, symbol.location); + auto& diag = symbol.getParentScope()->addDiag(diag::MaxInstanceDepthExceeded, + symbol.location); diag << symbol.getDefinition().getKindString(); diag << compilation.getOptions().maxInstanceDepth; hierarchyProblem = true; diff --git a/source/compilation/builtins/ArrayMethods.cpp b/source/compilation/builtins/ArrayMethods.cpp index 291f15cab..698a1f47e 100644 --- a/source/compilation/builtins/ArrayMethods.cpp +++ b/source/compilation/builtins/ArrayMethods.cpp @@ -946,8 +946,8 @@ void registerArrayMethods(Compilation& c) { #define REGISTER(kind, name, ...) \ c.addSystemMethod(kind, std::make_unique(__VA_ARGS__)) - for (auto kind : { SymbolKind::FixedSizeUnpackedArrayType, SymbolKind::DynamicArrayType, - SymbolKind::AssociativeArrayType, SymbolKind::QueueType }) { + for (auto kind : {SymbolKind::FixedSizeUnpackedArrayType, SymbolKind::DynamicArrayType, + SymbolKind::AssociativeArrayType, SymbolKind::QueueType}) { REGISTER(kind, ArrayReduction, "or", [](auto& l, auto& r) { l |= r; }); REGISTER(kind, ArrayReduction, "and", [](auto& l, auto& r) { l &= r; }); REGISTER(kind, ArrayReduction, "xor", [](auto& l, auto& r) { l ^= r; }); @@ -968,13 +968,13 @@ void registerArrayMethods(Compilation& c) { REGISTER(kind, ArrayUnique, "unique_index", true); } - for (auto kind : { SymbolKind::DynamicArrayType, SymbolKind::AssociativeArrayType, - SymbolKind::QueueType }) { + for (auto kind : + {SymbolKind::DynamicArrayType, SymbolKind::AssociativeArrayType, SymbolKind::QueueType}) { REGISTER(kind, ArraySize, c, "size"); } - for (auto kind : { SymbolKind::FixedSizeUnpackedArrayType, SymbolKind::DynamicArrayType, - SymbolKind::QueueType }) { + for (auto kind : {SymbolKind::FixedSizeUnpackedArrayType, SymbolKind::DynamicArrayType, + SymbolKind::QueueType}) { REGISTER(kind, ArraySort, "sort", false); REGISTER(kind, ArraySort, "rsort", true); REGISTER(kind, ArrayReverse, ); diff --git a/source/compilation/builtins/ConversionFuncs.cpp b/source/compilation/builtins/ConversionFuncs.cpp index 2d3179bb7..4f1597363 100644 --- a/source/compilation/builtins/ConversionFuncs.cpp +++ b/source/compilation/builtins/ConversionFuncs.cpp @@ -49,7 +49,7 @@ class SignedConversionFunction : public SystemSubroutine { class RtoIFunction : public SimpleSystemSubroutine { public: explicit RtoIFunction(Compilation& comp) : - SimpleSystemSubroutine("$rtoi", SubroutineKind::Function, 1, { &comp.getRealType() }, + SimpleSystemSubroutine("$rtoi", SubroutineKind::Function, 1, {&comp.getRealType()}, comp.getIntegerType(), false) {} ConstantValue eval(EvalContext& context, const Args& args, SourceRange, @@ -91,7 +91,7 @@ class ItoRFunction : public SystemSubroutine { class RealToBitsFunction : public SimpleSystemSubroutine { public: explicit RealToBitsFunction(Compilation& comp) : - SimpleSystemSubroutine("$realtobits", SubroutineKind::Function, 1, { &comp.getRealType() }, + SimpleSystemSubroutine("$realtobits", SubroutineKind::Function, 1, {&comp.getRealType()}, comp.getType(64, IntegralFlags::Unsigned), false) {} ConstantValue eval(EvalContext& context, const Args& args, SourceRange, @@ -108,7 +108,7 @@ class BitsToRealFunction : public SimpleSystemSubroutine { public: explicit BitsToRealFunction(Compilation& comp) : SimpleSystemSubroutine("$bitstoreal", SubroutineKind::Function, 1, - { &comp.getType(64, IntegralFlags::Unsigned) }, comp.getRealType(), + {&comp.getType(64, IntegralFlags::Unsigned)}, comp.getRealType(), false) {} ConstantValue eval(EvalContext& context, const Args& args, SourceRange, @@ -126,7 +126,7 @@ class ShortRealToBitsFunction : public SimpleSystemSubroutine { public: explicit ShortRealToBitsFunction(Compilation& comp) : SimpleSystemSubroutine("$shortrealtobits", SubroutineKind::Function, 1, - { &comp.getShortRealType() }, + {&comp.getShortRealType()}, comp.getType(32, IntegralFlags::Unsigned), false) {} ConstantValue eval(EvalContext& context, const Args& args, SourceRange, @@ -143,7 +143,7 @@ class BitsToShortRealFunction : public SimpleSystemSubroutine { public: explicit BitsToShortRealFunction(Compilation& comp) : SimpleSystemSubroutine("$bitstoshortreal", SubroutineKind::Function, 1, - { &comp.getType(32, IntegralFlags::Unsigned) }, + {&comp.getType(32, IntegralFlags::Unsigned)}, comp.getShortRealType(), false) {} ConstantValue eval(EvalContext& context, const Args& args, SourceRange, diff --git a/source/compilation/builtins/CoverageFuncs.cpp b/source/compilation/builtins/CoverageFuncs.cpp index 622647bfb..714d65cb7 100644 --- a/source/compilation/builtins/CoverageFuncs.cpp +++ b/source/compilation/builtins/CoverageFuncs.cpp @@ -32,8 +32,9 @@ class CoverageNameOrHierFunc : public SystemSubroutine { return SystemSubroutine::bindArgument(argIndex, context, syntax, args); if (argIndex == nameOrHierIndex && NameSyntax::isKind(syntax.kind)) { - return HierarchicalReferenceExpression::fromSyntax( - context.getCompilation(), syntax.as(), context, LookupFlags::AllowRoot); + return HierarchicalReferenceExpression::fromSyntax(context.getCompilation(), + syntax.as(), context, + LookupFlags::AllowRoot); } return Expression::bindArgument(*argTypes[argIndex], ArgumentDirection::In, syntax, @@ -84,21 +85,21 @@ class CoverageNameOrHierFunc : public SystemSubroutine { void registerCoverageFuncs(Compilation& c) { #define REGISTER(name, ...) c.addSystemSubroutine(std::make_unique(__VA_ARGS__)) REGISTER(CoverageNameOrHierFunc, "$coverage_control", c.getIntType(), 3, 4, - std::vector{ &c.getIntType(), &c.getIntType(), &c.getIntType(), &c.getStringType() }); + std::vector{&c.getIntType(), &c.getIntType(), &c.getIntType(), &c.getStringType()}); REGISTER(CoverageNameOrHierFunc, "$coverage_get_max", c.getIntType(), 2, 3, - std::vector{ &c.getIntType(), &c.getIntType(), &c.getStringType() }); + std::vector{&c.getIntType(), &c.getIntType(), &c.getStringType()}); REGISTER(CoverageNameOrHierFunc, "$coverage_get", c.getIntType(), 2, 3, - std::vector{ &c.getIntType(), &c.getIntType(), &c.getStringType() }); + std::vector{&c.getIntType(), &c.getIntType(), &c.getStringType()}); REGISTER(NonConstantFunction, "$coverage_merge", c.getIntType(), 2, - std::vector{ &c.getIntType(), &c.getStringType() }); + std::vector{&c.getIntType(), &c.getStringType()}); REGISTER(NonConstantFunction, "$coverage_save", c.getIntType(), 2, - std::vector{ &c.getIntType(), &c.getStringType() }); + std::vector{&c.getIntType(), &c.getStringType()}); REGISTER(NonConstantFunction, "$get_coverage", c.getRealType()); REGISTER(NonConstantFunction, "$set_coverage_db_name", c.getVoidType(), 1, - std::vector{ &c.getStringType() }); + std::vector{&c.getStringType()}); REGISTER(NonConstantFunction, "$load_coverage_db", c.getVoidType(), 1, - std::vector{ &c.getStringType() }); + std::vector{&c.getStringType()}); #undef REGISTER } diff --git a/source/compilation/builtins/GateTypes.cpp b/source/compilation/builtins/GateTypes.cpp index 08a4e9699..5d424270b 100644 --- a/source/compilation/builtins/GateTypes.cpp +++ b/source/compilation/builtins/GateTypes.cpp @@ -32,35 +32,35 @@ static void gate(Compilation& c, string_view name, #define inout PrimitivePortDirection::InOut void registerGateTypes(Compilation& c) { - gate(c, "cmos", { out, in, in, in }); - gate(c, "rcmos", { out, in, in, in }); - gate(c, "bufif0", { out, in, in }); - gate(c, "bufif1", { out, in, in }); - gate(c, "notif0", { out, in, in }); - gate(c, "notif1", { out, in, in }); - gate(c, "nmos", { out, in, in }); - gate(c, "pmos", { out, in, in }); - gate(c, "rnmos", { out, in, in }); - gate(c, "rpmos", { out, in, in }); - gate(c, "tranif0", { inout, inout, in }); - gate(c, "tranif1", { inout, inout, in }); - gate(c, "rtranif0", { inout, inout, in }); - gate(c, "rtranif1", { inout, inout, in }); - gate(c, "tran", { inout, inout }); - gate(c, "rtran", { inout, inout }); - gate(c, "pullup", { out }); - gate(c, "pulldown", { out }); + gate(c, "cmos", {out, in, in, in}); + gate(c, "rcmos", {out, in, in, in}); + gate(c, "bufif0", {out, in, in}); + gate(c, "bufif1", {out, in, in}); + gate(c, "notif0", {out, in, in}); + gate(c, "notif1", {out, in, in}); + gate(c, "nmos", {out, in, in}); + gate(c, "pmos", {out, in, in}); + gate(c, "rnmos", {out, in, in}); + gate(c, "rpmos", {out, in, in}); + gate(c, "tranif0", {inout, inout, in}); + gate(c, "tranif1", {inout, inout, in}); + gate(c, "rtranif0", {inout, inout, in}); + gate(c, "rtranif1", {inout, inout, in}); + gate(c, "tran", {inout, inout}); + gate(c, "rtran", {inout, inout}); + gate(c, "pullup", {out}); + gate(c, "pulldown", {out}); // These are special in that they support an arbitrary number of // either inputs or outputs. - gate(c, "and", { out, in }, PrimitiveSymbol::NInput); - gate(c, "or", { out, in }, PrimitiveSymbol::NInput); - gate(c, "nand", { out, in }, PrimitiveSymbol::NInput); - gate(c, "nor", { out, in }, PrimitiveSymbol::NInput); - gate(c, "xor", { out, in }, PrimitiveSymbol::NInput); - gate(c, "xnor", { out, in }, PrimitiveSymbol::NInput); - gate(c, "buf", { out, in }, PrimitiveSymbol::NOutput); - gate(c, "not", { out, in }, PrimitiveSymbol::NOutput); + gate(c, "and", {out, in}, PrimitiveSymbol::NInput); + gate(c, "or", {out, in}, PrimitiveSymbol::NInput); + gate(c, "nand", {out, in}, PrimitiveSymbol::NInput); + gate(c, "nor", {out, in}, PrimitiveSymbol::NInput); + gate(c, "xor", {out, in}, PrimitiveSymbol::NInput); + gate(c, "xnor", {out, in}, PrimitiveSymbol::NInput); + gate(c, "buf", {out, in}, PrimitiveSymbol::NOutput); + gate(c, "not", {out, in}, PrimitiveSymbol::NOutput); } } // namespace slang::Builtins diff --git a/source/compilation/builtins/MathFuncs.cpp b/source/compilation/builtins/MathFuncs.cpp index 05a863b72..14b113809 100644 --- a/source/compilation/builtins/MathFuncs.cpp +++ b/source/compilation/builtins/MathFuncs.cpp @@ -190,7 +190,7 @@ template class RealMath1Function : public SimpleSystemSubroutine { public: RealMath1Function(Compilation& comp, const std::string& name) : - SimpleSystemSubroutine(name, SubroutineKind::Function, 1, { &comp.getRealType() }, + SimpleSystemSubroutine(name, SubroutineKind::Function, 1, {&comp.getRealType()}, comp.getRealType(), false) {} ConstantValue eval(EvalContext& context, const Args& args, SourceRange, @@ -209,7 +209,7 @@ class RealMath2Function : public SimpleSystemSubroutine { public: RealMath2Function(Compilation& comp, const std::string& name) : SimpleSystemSubroutine(name, SubroutineKind::Function, 2, - { &comp.getRealType(), &comp.getRealType() }, comp.getRealType(), + {&comp.getRealType(), &comp.getRealType()}, comp.getRealType(), false) {} ConstantValue eval(EvalContext& context, const Args& args, SourceRange, diff --git a/source/compilation/builtins/NonConstFuncs.cpp b/source/compilation/builtins/NonConstFuncs.cpp index c201457e6..b5f2ed7e7 100644 --- a/source/compilation/builtins/NonConstFuncs.cpp +++ b/source/compilation/builtins/NonConstFuncs.cpp @@ -318,8 +318,9 @@ class PastFunc : public SystemSubroutine { return comp.getErrorType(); for (size_t i = 0; i < args.size() && i < 3; i++) { - AssertionExpr::checkSampledValueExpr( - *args[i], context, false, diag::SampledValueLocalVar, diag::SampledValueMatched); + AssertionExpr::checkSampledValueExpr(*args[i], context, false, + diag::SampledValueLocalVar, + diag::SampledValueMatched); } // TODO: check rules for inferring clocking @@ -397,26 +398,26 @@ void registerNonConstFuncs(Compilation& c) { auto& intType = c.getIntType(); auto& uintType = c.getUnsignedIntType(); - std::vector intArg = { &intType }; + std::vector intArg = {&intType}; REGISTER("$time", c.getType(SyntaxKind::TimeType)); REGISTER("$stime", c.getUnsignedIntType()); REGISTER("$realtime", c.getType(SyntaxKind::RealTimeType)); REGISTER("$random", intType, 0, intArg); REGISTER("$urandom", uintType, 0, intArg); - REGISTER("$urandom_range", uintType, 1, std::vector{ &uintType, &uintType }); + REGISTER("$urandom_range", uintType, 1, std::vector{&uintType, &uintType}); - REGISTER("$fopen", intType, 1, std::vector{ &c.getStringType(), &c.getStringType() }); + REGISTER("$fopen", intType, 1, std::vector{&c.getStringType(), &c.getStringType()}); REGISTER("$fclose", c.getVoidType(), 1, intArg); REGISTER("$fgetc", intType, 1, intArg); - REGISTER("$ungetc", intType, 2, std::vector{ &intType, &intType }); + REGISTER("$ungetc", intType, 2, std::vector{&intType, &intType}); REGISTER("$ftell", intType, 1, intArg); - REGISTER("$fseek", intType, 3, std::vector{ &intType, &intType, &intType }); + REGISTER("$fseek", intType, 3, std::vector{&intType, &intType, &intType}); REGISTER("$rewind", intType, 1, intArg); REGISTER("$fflush", c.getVoidType(), 0, intArg); REGISTER("$feof", intType, 1, intArg); - REGISTER("$test$plusargs", intType, 1, std::vector{ &c.getStringType() }); + REGISTER("$test$plusargs", intType, 1, std::vector{&c.getStringType()}); #undef REGISTER diff --git a/source/compilation/builtins/QueryFuncs.cpp b/source/compilation/builtins/QueryFuncs.cpp index 683da25ca..8454577c5 100644 --- a/source/compilation/builtins/QueryFuncs.cpp +++ b/source/compilation/builtins/QueryFuncs.cpp @@ -208,7 +208,7 @@ class ArrayQueryFunction : public SystemSubroutine { DimResult() : hardFail(true) {} DimResult(ConstantRange range) : range(range) {} - DimResult(size_t dynamicSize) : range{ 0, int32_t(dynamicSize) - 1 }, isDynamic(true) {} + DimResult(size_t dynamicSize) : range{0, int32_t(dynamicSize) - 1}, isDynamic(true) {} DimResult(AssociativeArray&& map, const Type* indexType) : map(std::move(map)), indexType(indexType) {} diff --git a/source/compilation/builtins/StdPackage.cpp b/source/compilation/builtins/StdPackage.cpp index 3c3daddc0..d83f879c4 100644 --- a/source/compilation/builtins/StdPackage.cpp +++ b/source/compilation/builtins/StdPackage.cpp @@ -26,7 +26,7 @@ static const Symbol& createProcessClass(Compilation& c) { stateEnum->systemId = INT32_MAX - 2048; uint64_t index = 0; - for (auto name : { "FINISHED", "RUNNING", "WAITING", "SUSPENDED", "KILLED" }) { + for (auto name : {"FINISHED", "RUNNING", "WAITING", "SUSPENDED", "KILLED"}) { auto ev = c.emplace(name, NL); ev->setType(*stateEnum); stateEnum->addMember(*ev); diff --git a/source/compilation/builtins/StringMethods.cpp b/source/compilation/builtins/StringMethods.cpp index 447d3166e..6ba434a90 100644 --- a/source/compilation/builtins/StringMethods.cpp +++ b/source/compilation/builtins/StringMethods.cpp @@ -30,8 +30,8 @@ class StringPutcMethod : public SimpleSystemSubroutine { public: explicit StringPutcMethod(Compilation& comp) : SimpleSystemSubroutine("putc", SubroutineKind::Function, 2, - { &comp.getIntType(), &comp.getByteType() }, comp.getVoidType(), - true, /* isFirstArgLValue */ true) {} + {&comp.getIntType(), &comp.getByteType()}, comp.getVoidType(), true, + /* isFirstArgLValue */ true) {} ConstantValue eval(EvalContext& context, const Args& args, SourceRange, const CallExpression::SystemCallInfo&) const final { @@ -57,7 +57,7 @@ class StringPutcMethod : public SimpleSystemSubroutine { class StringGetcMethod : public SimpleSystemSubroutine { public: explicit StringGetcMethod(Compilation& comp) : - SimpleSystemSubroutine("getc", SubroutineKind::Function, 1, { &comp.getIntType() }, + SimpleSystemSubroutine("getc", SubroutineKind::Function, 1, {&comp.getIntType()}, comp.getByteType(), true) {} ConstantValue eval(EvalContext& context, const Args& args, SourceRange, @@ -103,7 +103,7 @@ class StringUpperLowerMethod : public SimpleSystemSubroutine { class StringCompareMethod : public SimpleSystemSubroutine { public: StringCompareMethod(Compilation& comp, const std::string& name, bool ignoreCase) : - SimpleSystemSubroutine(name, SubroutineKind::Function, 1, { &comp.getStringType() }, + SimpleSystemSubroutine(name, SubroutineKind::Function, 1, {&comp.getStringType()}, comp.getIntType(), true), ignoreCase(ignoreCase) {} @@ -146,7 +146,7 @@ class StringSubstrMethod : public SimpleSystemSubroutine { public: explicit StringSubstrMethod(Compilation& comp) : SimpleSystemSubroutine("substr", SubroutineKind::Function, 2, - { &comp.getIntType(), &comp.getIntType() }, comp.getStringType(), + {&comp.getIntType(), &comp.getIntType()}, comp.getStringType(), true) {} ConstantValue eval(EvalContext& context, const Args& args, SourceRange, @@ -214,7 +214,7 @@ class StringAtoRealMethod : public SimpleSystemSubroutine { class StringItoAMethod : public SimpleSystemSubroutine { public: StringItoAMethod(Compilation& comp, const std::string& name, LiteralBase base) : - SimpleSystemSubroutine(name, SubroutineKind::Function, 1, { &comp.getIntegerType() }, + SimpleSystemSubroutine(name, SubroutineKind::Function, 1, {&comp.getIntegerType()}, comp.getVoidType(), true, /* isFirstArgLValue */ true), base(base) {} @@ -236,7 +236,7 @@ class StringItoAMethod : public SimpleSystemSubroutine { class StringRealtoAMethod : public SimpleSystemSubroutine { public: explicit StringRealtoAMethod(Compilation& comp) : - SimpleSystemSubroutine("realtoa", SubroutineKind::Function, 1, { &comp.getRealType() }, + SimpleSystemSubroutine("realtoa", SubroutineKind::Function, 1, {&comp.getRealType()}, comp.getVoidType(), true, /* isFirstArgLValue */ true) {} ConstantValue eval(EvalContext& context, const Args& args, SourceRange, diff --git a/source/compilation/builtins/SystemTasks.cpp b/source/compilation/builtins/SystemTasks.cpp index 0749f0e3e..be4682be7 100644 --- a/source/compilation/builtins/SystemTasks.cpp +++ b/source/compilation/builtins/SystemTasks.cpp @@ -381,8 +381,8 @@ class DumpVarsTask : public SystemTaskBase { return *comp.emplace(nullptr, comp.getErrorType()); } - auto& ref = - HierarchicalReferenceExpression::fromSyntax(comp, syntax.as(), context); + auto& ref = HierarchicalReferenceExpression::fromSyntax(comp, syntax.as(), + context); if (ref.kind == ExpressionKind::HierarchicalReference) { auto& sym = *ref.as().symbol; @@ -602,8 +602,8 @@ class SdfAnnotateTask : public SystemTaskBase { return *comp.emplace(nullptr, comp.getErrorType()); } - auto& ref = - HierarchicalReferenceExpression::fromSyntax(comp, syntax.as(), context); + auto& ref = HierarchicalReferenceExpression::fromSyntax(comp, syntax.as(), + context); if (ref.kind == ExpressionKind::HierarchicalReference) { auto& sym = *ref.as().symbol; @@ -760,13 +760,13 @@ void registerSystemTasks(Compilation& c) { c.addSystemSubroutine(std::make_unique("$writememb", false)); c.addSystemSubroutine(std::make_unique("$writememh", false)); c.addSystemSubroutine(std::make_unique("$system", *int_t, 0, - std::vector{ string_t })); + std::vector{string_t})); c.addSystemSubroutine(std::make_unique()); c.addSystemSubroutine(std::make_unique()); #define TASK(name, required, ...) \ c.addSystemSubroutine(std::make_unique( \ - name, c.getVoidType(), required, std::vector{ __VA_ARGS__ })) + name, c.getVoidType(), required, std::vector{__VA_ARGS__})) TASK("$exit", 0, ); @@ -814,9 +814,9 @@ void registerSystemTasks(Compilation& c) { #undef TASK #define PLA_TASK(name) c.addSystemSubroutine(std::make_unique(name)) - for (auto& fmt : { "$array", "$plane" }) { - for (auto& gate : { "$and", "$or", "$nand", "$nor" }) { - for (auto& type : { "$async", "$sync" }) { + for (auto& fmt : {"$array", "$plane"}) { + for (auto& gate : {"$and", "$or", "$nand", "$nor"}) { + for (auto& type : {"$async", "$sync"}) { std::string name(type); name.append(gate); name.append(fmt); diff --git a/source/diagnostics/DiagnosticEngine.cpp b/source/diagnostics/DiagnosticEngine.cpp index 39622ae1a..94740474b 100644 --- a/source/diagnostics/DiagnosticEngine.cpp +++ b/source/diagnostics/DiagnosticEngine.cpp @@ -504,8 +504,8 @@ void DiagnosticEngine::setMappingsFromPragmasImpl(BufferID buffer, noteDiag(code, directive); } else { - auto& diag = - diags.add(diag::UnknownWarningOption, SourceLocation(buffer, directive.offset)); + auto& diag = diags.add(diag::UnknownWarningOption, + SourceLocation(buffer, directive.offset)); diag << name; } } @@ -545,9 +545,10 @@ optional DiagnosticEngine::findMappedSeverity(DiagCode code, return std::nullopt; const std::vector& mappings = byBuffer->second; - auto byOffset = std::lower_bound( - mappings.begin(), mappings.end(), fileLoc.offset(), - [](const DiagnosticMapping& mapping, size_t off) { return mapping.offset < off; }); + auto byOffset = std::lower_bound(mappings.begin(), mappings.end(), fileLoc.offset(), + [](const DiagnosticMapping& mapping, size_t off) { + return mapping.offset < off; + }); if (byOffset == mappings.begin()) return std::nullopt; diff --git a/source/diagnostics/TextDiagnosticClient.cpp b/source/diagnostics/TextDiagnosticClient.cpp index 244027834..71a1da200 100644 --- a/source/diagnostics/TextDiagnosticClient.cpp +++ b/source/diagnostics/TextDiagnosticClient.cpp @@ -201,7 +201,7 @@ struct SourceSnippet { size_t columnWidth; buffer.clear(); if (!printableTextForNextChar(sourceLine, i, tabStop, buffer, columnWidth)) - invalidRanges.append({ snippetLine.size(), buffer.size() }); + invalidRanges.append({snippetLine.size(), buffer.size()}); snippetLine.append(buffer.data(), buffer.size()); column += columnWidth; diff --git a/source/driver/Driver.cpp b/source/driver/Driver.cpp index da56133fc..c995ad56d 100644 --- a/source/driver/Driver.cpp +++ b/source/driver/Driver.cpp @@ -569,8 +569,8 @@ bool Driver::parseAllSources() { } if (buffer) { - auto tree = - SyntaxTree::fromBuffer(buffer, sourceManager, optionBag, inheritedMacros); + auto tree = SyntaxTree::fromBuffer(buffer, sourceManager, optionBag, + inheritedMacros); tree->isLibrary = true; syntaxTrees.emplace_back(tree); diff --git a/source/mir/Procedure.cpp b/source/mir/Procedure.cpp index 69db4ca83..10903e9ad 100644 --- a/source/mir/Procedure.cpp +++ b/source/mir/Procedure.cpp @@ -269,7 +269,7 @@ void Procedure::emitCall(SysCallKind sysCall, span args) { } void Procedure::emitCall(SysCallKind sysCall, MIRValue arg0) { - emitCall(sysCall, { &arg0, 1 }); + emitCall(sysCall, {&arg0, 1}); } MIRValue Procedure::emitInstr(InstrKind kind, const Type& type, MIRValue op0) { @@ -333,7 +333,7 @@ span Procedure::copyValues(span values) { auto data = (MIRValue*)builder.allocate(bytes, alignof(MIRValue)); memcpy(data, values.data(), bytes); - return { data, values.size() }; + return {data, values.size()}; } } // namespace slang::mir diff --git a/source/numeric/ConstantValue.cpp b/source/numeric/ConstantValue.cpp index 75b5e227f..dc14359ba 100644 --- a/source/numeric/ConstantValue.cpp +++ b/source/numeric/ConstantValue.cpp @@ -195,7 +195,7 @@ ConstantValue ConstantValue::getSlice(int32_t upper, int32_t lower, if (isUnpacked()) { span elems = elements(); - std::vector result{ size_t(upper - lower + 1) }; + std::vector result{size_t(upper - lower + 1)}; ConstantValue* dest = result.data(); for (int32_t i = lower; i <= upper; i++) { diff --git a/source/numeric/SVInt.cpp b/source/numeric/SVInt.cpp index 7eaca58af..3985c2323 100644 --- a/source/numeric/SVInt.cpp +++ b/source/numeric/SVInt.cpp @@ -18,8 +18,8 @@ static const double log2_10 = log2(10.0); namespace slang { -const logic_t logic_t::x{ logic_t::X_VALUE }; -const logic_t logic_t::z{ logic_t::Z_VALUE }; +const logic_t logic_t::x{logic_t::X_VALUE}; +const logic_t logic_t::z{logic_t::Z_VALUE}; const SVInt SVInt::Zero = 0u; const SVInt SVInt::One = 1u; @@ -2093,8 +2093,8 @@ void SVInt::buildDivideResult(SVInt* result, uint32_t* value, bitwidth_t bitWidt else { *result = SVInt(bitWidth, 0, signFlag); for (uint32_t i = 0; i < numWords; i++) - result->pVal[i] = - uint64_t(value[i * 2]) | (uint64_t(value[i * 2 + 1]) << (BITS_PER_WORD / 2)); + result->pVal[i] = uint64_t(value[i * 2]) | + (uint64_t(value[i * 2 + 1]) << (BITS_PER_WORD / 2)); } } diff --git a/source/numeric/Time.cpp b/source/numeric/Time.cpp index 168497053..91074f1b1 100644 --- a/source/numeric/Time.cpp +++ b/source/numeric/Time.cpp @@ -15,10 +15,8 @@ namespace slang { const static StringTable strToUnit = { - { "s", TimeUnit::Seconds }, { "ms", TimeUnit::Milliseconds }, - { "us", TimeUnit::Microseconds }, { "ns", TimeUnit::Nanoseconds }, - { "ps", TimeUnit::Picoseconds }, { "fs", TimeUnit::Femtoseconds } -}; + {"s", TimeUnit::Seconds}, {"ms", TimeUnit::Milliseconds}, {"us", TimeUnit::Microseconds}, + {"ns", TimeUnit::Nanoseconds}, {"ps", TimeUnit::Picoseconds}, {"fs", TimeUnit::Femtoseconds}}; bool suffixToTimeUnit(string_view timeSuffix, TimeUnit& unit) { return strToUnit.lookup(timeSuffix, unit); @@ -99,8 +97,8 @@ std::ostream& operator<<(std::ostream& os, const TimeScaleValue& tv) { double TimeScale::apply(double value, TimeUnit unit) const { // First scale the value by the difference between our base and the provided unit. // TimeUnits are from 0-5, so we need 11 entries. - static constexpr double scales[] = { 1e15, 1e12, 1e9, 1e6, 1e3, 1e0, - 1e-3, 1e-6, 1e-9, 1e-12, 1e-15 }; + static constexpr double scales[] = {1e15, 1e12, 1e9, 1e6, 1e3, 1e0, + 1e-3, 1e-6, 1e-9, 1e-12, 1e-15}; int diff = int(unit) - int(base.unit); double scale = scales[diff + int(TimeUnit::Femtoseconds)] / int(base.magnitude); value *= scale; diff --git a/source/parsing/Lexer.cpp b/source/parsing/Lexer.cpp index 9bb7e6f1b..9b08e69e0 100644 --- a/source/parsing/Lexer.cpp +++ b/source/parsing/Lexer.cpp @@ -74,12 +74,11 @@ Token Lexer::concatenateTokens(BumpAllocator& alloc, Token left, Token right) { leftText.copy(mem, leftText.length()); rightText.copy(mem + leftText.length(), rightText.length()); mem[newLength - 1] = '\0'; - string_view combined{ mem, newLength }; + string_view combined{mem, newLength}; Diagnostics unused; Lexer lexer{ - BufferID::getPlaceholder(), combined, combined.data(), alloc, unused, LexerOptions{} - }; + BufferID::getPlaceholder(), combined, combined.data(), alloc, unused, LexerOptions{}}; auto token = lexer.lex(); if (token.kind == TokenKind::Unknown || token.rawText().empty()) @@ -132,7 +131,7 @@ Token Lexer::stringify(BumpAllocator& alloc, SourceLocation location, span buffer; - parseList( - buffer, TokenKind::CloseParenthesis, TokenKind::Comma, closeParen, RequireItems::False, - diag::ExpectedAnsiPort, [this] { return &parseAnsiPort(); }); + parseList(buffer, TokenKind::CloseParenthesis, + TokenKind::Comma, closeParen, + RequireItems::False, diag::ExpectedAnsiPort, + [this] { return &parseAnsiPort(); }); return factory.ansiPortList(openParen, buffer.copy(alloc), closeParen); } @@ -96,8 +97,8 @@ ModuleHeaderSyntax& Parser::parseModuleHeader() { auto openParen = consume(); if (peek(TokenKind::DotStar)) { auto dotStar = consume(); - ports = - &factory.wildcardPortList(openParen, dotStar, expect(TokenKind::CloseParenthesis)); + ports = &factory.wildcardPortList(openParen, dotStar, + expect(TokenKind::CloseParenthesis)); } else if (isNonAnsiPort()) { Token closeParen; @@ -468,8 +469,8 @@ StructUnionTypeSyntax& Parser::parseStructUnion(SyntaxKind syntaxKind) { auto dims = parseDimensionList(); if (!packed) { if (!dims.empty()) { - SourceRange range{ dims.front()->getFirstToken().location(), - dims.back()->getLastToken().range().end() }; + SourceRange range{dims.front()->getFirstToken().location(), + dims.back()->getLastToken().range().end()}; addDiag(diag::PackedDimsOnUnpacked, range); } @@ -896,11 +897,12 @@ template span Parser::parseDeclarators(TokenKind endKind, Token& end, bool allowMinTypMax, bool requireInitializers) { SmallVectorSized buffer; - parseList( - buffer, endKind, TokenKind::Comma, end, RequireItems::True, diag::ExpectedDeclarator, - [this, allowMinTypMax, requireInitializers] { - return &parseDeclarator(allowMinTypMax, requireInitializers); - }); + parseList(buffer, endKind, TokenKind::Comma, end, + RequireItems::True, diag::ExpectedDeclarator, + [this, allowMinTypMax, requireInitializers] { + return &parseDeclarator(allowMinTypMax, + requireInitializers); + }); return buffer.copy(alloc); } @@ -983,9 +985,10 @@ ParameterDeclarationBaseSyntax& Parser::parseParameterDecl(Token keyword, Token* SmallVectorSized decls; if (semi) { - parseList( - decls, TokenKind::Semicolon, TokenKind::Comma, *semi, RequireItems::True, - diag::ExpectedParameterPort, [this] { return &parseTypeAssignment(); }); + parseList(decls, TokenKind::Semicolon, + TokenKind::Comma, *semi, RequireItems::True, + diag::ExpectedParameterPort, + [this] { return &parseTypeAssignment(); }); } else { while (true) { diff --git a/source/parsing/ParserBase.cpp b/source/parsing/ParserBase.cpp index d919a8a84..4a506e4f6 100644 --- a/source/parsing/ParserBase.cpp +++ b/source/parsing/ParserBase.cpp @@ -20,7 +20,7 @@ ParserBase::ParserBase(Preprocessor& preprocessor) : void ParserBase::prependSkippedTokens(Token& token) { SmallVectorSized buffer; - buffer.append(Trivia{ TriviaKind::SkippedTokens, skippedTokens.copy(alloc) }); + buffer.append(Trivia{TriviaKind::SkippedTokens, skippedTokens.copy(alloc)}); buffer.appendRange(token.trivia()); token = token.withTrivia(alloc, buffer.copy(alloc)); diff --git a/source/parsing/Parser_expressions.cpp b/source/parsing/Parser_expressions.cpp index 31a5a51d2..47644d535 100644 --- a/source/parsing/Parser_expressions.cpp +++ b/source/parsing/Parser_expressions.cpp @@ -286,8 +286,8 @@ ExpressionSyntax& Parser::parsePrimaryExpression(bitmask opti } ExpressionSyntax& Parser::parseIntegerExpression(bool disallowVector) { - auto result = - disallowVector ? numberParser.parseSimpleInt(*this) : numberParser.parseInteger(*this); + auto result = disallowVector ? numberParser.parseSimpleInt(*this) + : numberParser.parseInteger(*this); if (result.isSimple) return factory.literalExpression(SyntaxKind::IntegerLiteralExpression, result.value); @@ -398,8 +398,8 @@ AssignmentPatternExpressionSyntax& Parser::parseAssignmentPatternExpression(Data // This is an empty pattern -- we'll just warn and continue on. addDiag(diag::EmptyAssignmentPattern, openBrace.location()); - auto pattern = - &factory.simpleAssignmentPattern(openBrace, span{}, consume()); + auto pattern = &factory.simpleAssignmentPattern(openBrace, span{}, + consume()); return factory.assignmentPatternExpression(type, *pattern); } else { @@ -425,8 +425,8 @@ AssignmentPatternExpressionSyntax& Parser::parseAssignmentPatternExpression(Data closeBrace = expect(TokenKind::CloseBrace); } - pattern = - &factory.structuredAssignmentPattern(openBrace, buffer.copy(alloc), closeBrace); + pattern = &factory.structuredAssignmentPattern(openBrace, buffer.copy(alloc), + closeBrace); break; case TokenKind::OpenBrace: { auto innerOpenBrace = consume(); @@ -574,8 +574,8 @@ ExpressionSyntax& Parser::parsePostfixExpression(ExpressionSyntax& lhs, *expr, attributes, op); } case TokenKind::OpenParenthesis: - expr = - &factory.invocationExpression(*expr, attributes, &parseArgumentList()); + expr = &factory.invocationExpression(*expr, attributes, + &parseArgumentList()); break; default: // otherwise, this has to be a function call without any arguments @@ -810,9 +810,9 @@ ParamAssignmentSyntax& Parser::parseParamValue() { auto dot = consume(); auto name = expect(TokenKind::Identifier); - auto [innerOpenParen, innerCloseParen, expr] = - parseGroupOrSkip(TokenKind::OpenParenthesis, TokenKind::CloseParenthesis, - [this]() { return &parseMinTypMaxExpression(); }); + auto [innerOpenParen, innerCloseParen, + expr] = parseGroupOrSkip(TokenKind::OpenParenthesis, TokenKind::CloseParenthesis, + [this]() { return &parseMinTypMaxExpression(); }); return factory.namedParamAssignment(dot, name, innerOpenParen, expr, innerCloseParen); } @@ -843,9 +843,9 @@ ArgumentSyntax& Parser::parseArgument() { auto dot = consume(); auto name = expect(TokenKind::Identifier); - auto [innerOpenParen, innerCloseParen, expr] = - parseGroupOrSkip(TokenKind::OpenParenthesis, TokenKind::CloseParenthesis, - [this]() { return &parsePropertyExpr(0); }); + auto [innerOpenParen, innerCloseParen, + expr] = parseGroupOrSkip(TokenKind::OpenParenthesis, TokenKind::CloseParenthesis, + [this]() { return &parsePropertyExpr(0); }); return factory.namedArgument(dot, name, innerOpenParen, expr, innerCloseParen); } @@ -978,8 +978,8 @@ EventExpressionSyntax& Parser::parseEventExpression() { if (expr.kind == SyntaxKind::SignalEventExpression) { auto& see = expr.as(); if (!see.edge && !see.iffClause) { - ExpressionSyntax* newExpr = - &factory.parenthesizedExpression(openParen, *see.expr, closeParen); + ExpressionSyntax* newExpr = &factory.parenthesizedExpression(openParen, *see.expr, + closeParen); newExpr = &parsePostfixExpression(*newExpr, ExpressionOptions::None); newExpr = &parseBinaryExpression(newExpr, ExpressionOptions::None, 0); @@ -1279,9 +1279,10 @@ SequenceMatchListSyntax* Parser::parseSequenceMatchList(Token& closeParen) { Token comma; span list; - parseList( - TokenKind::Comma, TokenKind::CloseParenthesis, TokenKind::Comma, comma, list, closeParen, - RequireItems::True, diag::ExpectedExpression, [this] { return &parsePropertyExpr(0); }); + parseList(TokenKind::Comma, TokenKind::CloseParenthesis, + TokenKind::Comma, comma, list, closeParen, + RequireItems::True, diag::ExpectedExpression, + [this] { return &parsePropertyExpr(0); }); return &factory.sequenceMatchList(comma, list); } @@ -1665,11 +1666,12 @@ PropertyExprSyntax& Parser::parsePropertyExpr(int precedence) { left->kind == SyntaxKind::SimplePropertyExpr && right.kind == SyntaxKind::SimplePropertyExpr) { - auto& seqExpr = factory.binarySequenceExpr( - opKind == SyntaxKind::AndPropertyExpr ? SyntaxKind::AndSequenceExpr - : SyntaxKind::OrSequenceExpr, - *left->as().expr, opToken, - *right.as().expr); + auto& seqExpr = factory.binarySequenceExpr(opKind == SyntaxKind::AndPropertyExpr + ? SyntaxKind::AndSequenceExpr + : SyntaxKind::OrSequenceExpr, + *left->as().expr, + opToken, + *right.as().expr); left = &factory.simplePropertyExpr(seqExpr); } diff --git a/source/parsing/Parser_members.cpp b/source/parsing/Parser_members.cpp index 0c69b57bb..929fad5cd 100644 --- a/source/parsing/Parser_members.cpp +++ b/source/parsing/Parser_members.cpp @@ -53,8 +53,7 @@ ModuleDeclarationSyntax& Parser::parseModule(AttrList attributes, SyntaxKind par } SyntaxKind declKind = getModuleDeclarationKind(header.moduleKeyword.kind); - ParserMetadata::Node node{ pp.getDefaultNetType(), pp.getUnconnectedDrive(), - pp.getTimeScale() }; + ParserMetadata::Node node{pp.getDefaultNetType(), pp.getUnconnectedDrive(), pp.getTimeScale()}; auto savedDefinitionKind = currentDefinitionKind; currentDefinitionKind = declKind; @@ -71,8 +70,8 @@ ModuleDeclarationSyntax& Parser::parseModule(AttrList attributes, SyntaxKind par auto endName = parseNamedBlockClause(); checkBlockNames(header.name, endName); - auto& result = - factory.moduleDeclaration(declKind, attributes, header, members, endmodule, endName); + auto& result = factory.moduleDeclaration(declKind, attributes, header, members, endmodule, + endName); meta.nodeMap[&result] = node; return result; @@ -117,9 +116,9 @@ MemberSyntax* Parser::parseMember(SyntaxKind parentKind, bool& anyLocalModules) case TokenKind::BeginKeyword: errorIfAttributes(attributes); if (!attributes.empty()) { - return &factory.emptyMember( - attributes, nullptr, - Token::createMissing(alloc, TokenKind::Semicolon, token.location())); + return &factory.emptyMember(attributes, nullptr, + Token::createMissing(alloc, TokenKind::Semicolon, + token.location())); } // It's definitely not legal to have a generate block here on its own @@ -360,9 +359,9 @@ MemberSyntax* Parser::parseMember(SyntaxKind parentKind, bool& anyLocalModules) // if we got attributes but don't know what comes next, we have some kind of nonsense if (!attributes.empty()) { - return &factory.emptyMember( - attributes, nullptr, - Token::createMissing(alloc, TokenKind::Semicolon, token.location())); + return &factory.emptyMember(attributes, nullptr, + Token::createMissing(alloc, TokenKind::Semicolon, + token.location())); } // Otherwise, we got nothing and should just return null so that our @@ -433,10 +432,10 @@ MemberSyntax& Parser::parseModportSubroutinePortList(AttrList attributes) { SmallVectorSized buffer; while (true) { if (peek(TokenKind::FunctionKeyword) || peek(TokenKind::TaskKeyword)) { - auto& proto = - parseFunctionPrototype(SyntaxKind::Unknown, FunctionOptions::AllowEmptyArgNames | - FunctionOptions::AllowTasks | - FunctionOptions::IsPrototype); + auto& proto = parseFunctionPrototype(SyntaxKind::Unknown, + FunctionOptions::AllowEmptyArgNames | + FunctionOptions::AllowTasks | + FunctionOptions::IsPrototype); buffer.append(&factory.modportSubroutinePort(proto)); } else { @@ -672,9 +671,10 @@ FunctionDeclarationSyntax& Parser::parseFunctionDeclaration(AttrList attributes, SyntaxKind parentKind) { Token end; bool isConstructor; - auto& prototype = parseFunctionPrototype( - parentKind, FunctionOptions::AllowImplicitReturn | FunctionOptions::AllowTasks, - &isConstructor); + auto& prototype = parseFunctionPrototype(parentKind, + FunctionOptions::AllowImplicitReturn | + FunctionOptions::AllowTasks, + &isConstructor); auto semi = expect(TokenKind::Semicolon); auto items = parseBlockItems(endKind, end, isConstructor); @@ -874,9 +874,10 @@ ImplementsClauseSyntax* Parser::parseImplementsClause(TokenKind keywordKind, Tok auto implements = consume(); SmallVectorSized buffer; - parseList( - buffer, TokenKind::Semicolon, TokenKind::Comma, semi, RequireItems::True, - diag::ExpectedInterfaceClassName, [this] { return &parseName(); }); + parseList(buffer, TokenKind::Semicolon, + TokenKind::Comma, semi, RequireItems::True, + diag::ExpectedInterfaceClassName, + [this] { return &parseName(); }); return &factory.implementsClause(implements, buffer.copy(alloc)); } @@ -1172,9 +1173,9 @@ MemberSyntax* Parser::parseClassMember(bool isIfaceClass) { // Pure or extern functions don't have bodies. if (isPureOrExtern) { - auto& proto = - parseFunctionPrototype(SyntaxKind::ClassDeclaration, - FunctionOptions::AllowTasks | FunctionOptions::IsPrototype); + auto& proto = parseFunctionPrototype(SyntaxKind::ClassDeclaration, + FunctionOptions::AllowTasks | + FunctionOptions::IsPrototype); checkProto(proto, false); return &factory.classMethodPrototype(attributes, qualifiers, proto, @@ -1185,8 +1186,8 @@ MemberSyntax* Parser::parseClassMember(bool isIfaceClass) { : SyntaxKind::FunctionDeclaration; auto endKind = kind == TokenKind::TaskKeyword ? TokenKind::EndTaskKeyword : TokenKind::EndFunctionKeyword; - auto& funcDecl = - parseFunctionDeclaration({}, declKind, endKind, SyntaxKind::ClassDeclaration); + auto& funcDecl = parseFunctionDeclaration({}, declKind, endKind, + SyntaxKind::ClassDeclaration); checkProto(*funcDecl.prototype, true); // If this is a scoped name, it should be an out-of-block definition for @@ -1208,9 +1209,9 @@ MemberSyntax* Parser::parseClassMember(bool isIfaceClass) { // Qualifiers aren't allowed past this point, so return an empty member to hold them. if (!qualifiers.empty()) { addDiag(diag::UnexpectedQualifiers, qualifiers[0].location()); - return &factory.emptyMember( - attributes, qualifiers, - Token::createMissing(alloc, TokenKind::Semicolon, peek().location())); + return &factory.emptyMember(attributes, qualifiers, + Token::createMissing(alloc, TokenKind::Semicolon, + peek().location())); } switch (kind) { @@ -1239,9 +1240,9 @@ MemberSyntax* Parser::parseClassMember(bool isIfaceClass) { // If we got attributes but don't know what comes next, we have some kind of nonsense. if (!attributes.empty()) { - return &factory.emptyMember( - attributes, qualifiers, - Token::createMissing(alloc, TokenKind::Semicolon, peek().location())); + return &factory.emptyMember(attributes, qualifiers, + Token::createMissing(alloc, TokenKind::Semicolon, + peek().location())); } // Otherwise, we got nothing and should just return null so that our caller will skip and try @@ -1356,9 +1357,9 @@ MemberSyntax* Parser::parseCoverageMember() { // if we got attributes but don't know what comes next, we have some kind of nonsense if (!attributes.empty()) { - return &factory.emptyMember( - attributes, nullptr, - Token::createMissing(alloc, TokenKind::Semicolon, peek().location())); + return &factory.emptyMember(attributes, nullptr, + Token::createMissing(alloc, TokenKind::Semicolon, + peek().location())); } // otherwise, we got nothing and should just return null so that our caller will skip and try @@ -1684,8 +1685,8 @@ BinsSelectExpressionSyntax& Parser::parseBinsSelectPrimary() { auto& expr = parseExpression(); auto closeParen = expect(TokenKind::CloseParenthesis); auto matches = parseMatches(); - result = - &factory.binSelectWithFilterExpr(*result, with, openParen, expr, closeParen, matches); + result = &factory.binSelectWithFilterExpr(*result, with, openParen, expr, closeParen, + matches); } return *result; @@ -1888,8 +1889,8 @@ ConstraintItemSyntax* Parser::parseConstraintItem(bool allowBlock, bool isTopLev ElseConstraintClauseSyntax* elseClause = nullptr; if (peek(TokenKind::ElseKeyword)) { auto elseKeyword = consume(); - elseClause = - &factory.elseConstraintClause(elseKeyword, *parseConstraintItem(true, false)); + elseClause = &factory.elseConstraintClause(elseKeyword, + *parseConstraintItem(true, false)); } return &factory.conditionalConstraint(ifKeyword, openParen, condition, closeParen, constraints, elseClause); @@ -2044,8 +2045,8 @@ DPIImportSyntax& Parser::parseDPIImport(AttrList attributes) { equals = expect(TokenKind::Equals); } - bitmask options = - FunctionOptions::AllowEmptyArgNames | FunctionOptions::IsPrototype; + bitmask options = FunctionOptions::AllowEmptyArgNames | + FunctionOptions::IsPrototype; if (property.kind != TokenKind::PureKeyword) options |= FunctionOptions::AllowTasks; @@ -2380,9 +2381,10 @@ HierarchyInstantiationSyntax& Parser::parseHierarchyInstantiation(AttrList attri Token semi; SmallVectorSized items; - parseList( - items, TokenKind::Semicolon, TokenKind::Comma, semi, RequireItems::True, - diag::ExpectedHierarchicalInstantiation, [this] { return &parseHierarchicalInstance(); }); + parseList(items, TokenKind::Semicolon, TokenKind::Comma, semi, + RequireItems::True, + diag::ExpectedHierarchicalInstantiation, + [this] { return &parseHierarchicalInstance(); }); return factory.hierarchyInstantiation(attributes, type, parameters, items.copy(alloc), semi); } @@ -2466,9 +2468,10 @@ PrimitiveInstantiationSyntax& Parser::parsePrimitiveInstantiation(AttrList attri Token semi; SmallVectorSized items; - parseList( - items, TokenKind::Semicolon, TokenKind::Comma, semi, RequireItems::True, - diag::ExpectedHierarchicalInstantiation, [this] { return &parseHierarchicalInstance(); }); + parseList(items, TokenKind::Semicolon, TokenKind::Comma, semi, + RequireItems::True, + diag::ExpectedHierarchicalInstantiation, + [this] { return &parseHierarchicalInstance(); }); return factory.primitiveInstantiation(attributes, type, strength, delay, items.copy(alloc), semi); @@ -2480,9 +2483,10 @@ CheckerInstantiationSyntax& Parser::parseCheckerInstantiation(AttrList attribute Token semi; SmallVectorSized items; - parseList( - items, TokenKind::Semicolon, TokenKind::Comma, semi, RequireItems::True, - diag::ExpectedHierarchicalInstantiation, [this] { return &parseHierarchicalInstance(); }); + parseList(items, TokenKind::Semicolon, TokenKind::Comma, semi, + RequireItems::True, + diag::ExpectedHierarchicalInstantiation, + [this] { return &parseHierarchicalInstance(); }); return factory.checkerInstantiation(attributes, type, parameters, items.copy(alloc), semi); } @@ -2578,9 +2582,10 @@ UdpPortListSyntax& Parser::parseUdpPortList() { else if (peek(TokenKind::OutputKeyword) || peek(TokenKind::InputKeyword)) { Token closeParen; SmallVectorSized ports; - parseList( - ports, TokenKind::CloseParenthesis, TokenKind::Comma, closeParen, RequireItems::True, - diag::ExpectedUdpPort, [this] { return &parseUdpPortDecl(); }); + parseList(ports, TokenKind::CloseParenthesis, + TokenKind::Comma, closeParen, + RequireItems::True, diag::ExpectedUdpPort, + [this] { return &parseUdpPortDecl(); }); return factory.ansiUdpPortList(openParen, ports.copy(alloc), closeParen, expect(TokenKind::Semicolon)); @@ -2716,9 +2721,10 @@ SpecparamDeclarationSyntax& Parser::parseSpecparam(AttrList attr) { Token semi; SmallVectorSized buffer; - parseList( - buffer, TokenKind::Semicolon, TokenKind::Comma, semi, RequireItems::True, - diag::ExpectedDeclarator, [this] { return &parseSpecparamDeclarator(); }); + parseList(buffer, TokenKind::Semicolon, TokenKind::Comma, + semi, RequireItems::True, + diag::ExpectedDeclarator, + [this] { return &parseSpecparamDeclarator(); }); return factory.specparamDeclaration(attr, keyword, type, buffer.copy(alloc), semi); } @@ -2806,8 +2812,8 @@ PathDeclarationSyntax& Parser::parsePathDeclaration() { } auto closeParen = expect(TokenKind::CloseParenthesis); - auto& desc = - factory.pathDescription(openParen, edge, inputs, polarity, op, *suffix, closeParen); + auto& desc = factory.pathDescription(openParen, edge, inputs, polarity, op, *suffix, + closeParen); auto equals = expect(TokenKind::Equals); @@ -2856,7 +2862,7 @@ EdgeDescriptorSyntax& Parser::parseEdgeDescriptor() { SourceRange range = t1.range(); if (t2) - range = { t1.range().start(), t2.range().end() }; + range = {t1.range().start(), t2.range().end()}; if (t1Raw.length() + t2Raw.length() != 2) { addDiag(diag::InvalidEdgeDescriptor, range); diff --git a/source/parsing/Parser_statements.cpp b/source/parsing/Parser_statements.cpp index a52b7d412..4c92c663b 100644 --- a/source/parsing/Parser_statements.cpp +++ b/source/parsing/Parser_statements.cpp @@ -178,8 +178,8 @@ ConditionalStatementSyntax& Parser::parseConditionalStatement(NamedLabelSyntax* auto openParen = expect(TokenKind::OpenParenthesis); Token closeParen; - auto& predicate = - parseConditionalPredicate(parseExpression(), TokenKind::CloseParenthesis, closeParen); + auto& predicate = parseConditionalPredicate(parseExpression(), TokenKind::CloseParenthesis, + closeParen); auto& statement = parseStatement(); auto elseClause = parseElseClause(); @@ -342,9 +342,9 @@ SyntaxNode& Parser::parseForInitializer() { auto varKeyword = consumeIf(TokenKind::VarKeyword); auto& type = parseDataType(); - return factory.forVariableDeclaration( - varKeyword, &type, - parseDeclarator(/* allowMinTypMax */ false, /* requireInitializers */ true)); + return factory.forVariableDeclaration(varKeyword, &type, + parseDeclarator(/* allowMinTypMax */ false, + /* requireInitializers */ true)); } return factory.forVariableDeclaration(Token(), nullptr, parseDeclarator()); @@ -529,8 +529,8 @@ StatementSyntax& Parser::parseAssertionStatement(NamedLabelSyntax* label, AttrLi auto openParen = expect(TokenKind::OpenParenthesis); auto& expr = parseExpression(); - auto& parenExpr = - factory.parenthesizedExpression(openParen, expr, expect(TokenKind::CloseParenthesis)); + auto& parenExpr = factory.parenthesizedExpression(openParen, expr, + expect(TokenKind::CloseParenthesis)); auto& actionBlock = parseActionBlock(); return factory.immediateAssertionStatement(assertionKind, label, attributes, keyword, deferred, parenExpr, actionBlock); @@ -578,8 +578,9 @@ ConcurrentAssertionStatementSyntax& Parser::parseConcurrentAssertion(NamedLabelS auto closeParen = expect(TokenKind::CloseParenthesis); auto& action = parseActionBlock(); - return factory.concurrentAssertionStatement( - kind, label, attributes, keyword, propertyOrSequence, openParen, spec, closeParen, action); + return factory.concurrentAssertionStatement(kind, label, attributes, keyword, + propertyOrSequence, openParen, spec, closeParen, + action); } PropertySpecSyntax& Parser::parsePropertySpec() { @@ -593,8 +594,8 @@ PropertySpecSyntax& Parser::parsePropertySpec() { auto iff = expect(TokenKind::IffKeyword); auto openParen = expect(TokenKind::OpenParenthesis); auto& expr = parseExpressionOrDist(); - disable = - &factory.disableIff(keyword, iff, openParen, expr, expect(TokenKind::CloseParenthesis)); + disable = &factory.disableIff(keyword, iff, openParen, expr, + expect(TokenKind::CloseParenthesis)); } return factory.propertySpec(timing, disable, parsePropertyExpr(0)); @@ -731,9 +732,10 @@ WaitOrderStatementSyntax& Parser::parseWaitOrderStatement(NamedLabelSyntax* labe SmallVectorSized buffer; Token closeParen; - parseList( - buffer, TokenKind::CloseParenthesis, TokenKind::Comma, closeParen, RequireItems::True, - diag::ExpectedIdentifier, [this] { return &parseName(); }); + parseList(buffer, TokenKind::CloseParenthesis, + TokenKind::Comma, closeParen, + RequireItems::True, diag::ExpectedIdentifier, + [this] { return &parseName(); }); return factory.waitOrderStatement(label, attributes, keyword, openParen, buffer.copy(alloc), closeParen, parseActionBlock()); @@ -926,7 +928,7 @@ RsRuleSyntax& Parser::parseRsRule() { if (randJoin && prods.size() < 2) { SourceRange range = randJoin->sourceRange(); if (!prods.empty()) - range = SourceRange{ range.start(), prods.back()->getLastToken().range().end() }; + range = SourceRange{range.start(), prods.back()->getLastToken().range().end()}; addDiag(diag::RandJoinNotEnough, range); } diff --git a/source/parsing/Preprocessor.cpp b/source/parsing/Preprocessor.cpp index 9da506ecc..2ebe125af 100644 --- a/source/parsing/Preprocessor.cpp +++ b/source/parsing/Preprocessor.cpp @@ -703,12 +703,14 @@ Trivia Preprocessor::parseBranchDirective(Token directive, Token condition, bool SyntaxNode* syntax; if (condition) { - syntax = alloc.emplace( - directive.directiveKind(), directive, condition, scratchTokenBuffer.copy(alloc)); + syntax = alloc.emplace(directive.directiveKind(), + directive, condition, + scratchTokenBuffer.copy(alloc)); } else { - syntax = alloc.emplace( - directive.directiveKind(), directive, scratchTokenBuffer.copy(alloc)); + syntax = alloc.emplace(directive.directiveKind(), + directive, + scratchTokenBuffer.copy(alloc)); } return Trivia(TriviaKind::Directive, syntax); } @@ -781,12 +783,12 @@ Trivia Preprocessor::handleTimeScaleDirective(Token directive) { diag << unitToken.range(); } else { - activeTimeScale = { unit, precision }; + activeTimeScale = {unit, precision}; } } - auto timeScale = - alloc.emplace(directive, unitToken, slash, precisionToken); + auto timeScale = alloc.emplace(directive, unitToken, slash, + precisionToken); return Trivia(TriviaKind::Directive, timeScale); } @@ -907,7 +909,7 @@ Trivia Preprocessor::handleEndKeywordsDirective(Token directive) { std::pair Preprocessor::handlePragmaDirective(Token directive) { if (peek().kind != TokenKind::Identifier || !peek().isOnSameLine()) { addDiag(diag::ExpectedPragmaName, directive.location()); - return { createSimpleDirective(directive), Trivia() }; + return {createSimpleDirective(directive), Trivia()}; } SmallVectorSized args; @@ -947,7 +949,7 @@ std::pair Preprocessor::handlePragmaDirective(Token directive) { if (!skipped.empty()) skippedTrivia = Trivia(TriviaKind::SkippedTokens, skipped.copy(alloc)); - return { Trivia(TriviaKind::Directive, result), skippedTrivia }; + return {Trivia(TriviaKind::Directive, result), skippedTrivia}; } Trivia Preprocessor::handleUnconnectedDriveDirective(Token directive) { diff --git a/source/parsing/Preprocessor_macros.cpp b/source/parsing/Preprocessor_macros.cpp index ee34324d7..a9a3d68ac 100644 --- a/source/parsing/Preprocessor_macros.cpp +++ b/source/parsing/Preprocessor_macros.cpp @@ -45,8 +45,8 @@ void Preprocessor::createBuiltInMacro(string_view name, int value, string_view v SVInt(32, uint64_t(value), true))); MacroDef def; - def.syntax = - alloc.emplace(directive, nameTok, nullptr, body.copy(alloc)); + def.syntax = alloc.emplace(directive, nameTok, nullptr, + body.copy(alloc)); def.builtIn = true; macros[name] = def; @@ -78,7 +78,7 @@ MacroActualArgumentListSyntax* Preprocessor::handleTopLevelMacro(Token directive // Expand out the macro SmallVectorSized buffer; - MacroExpansion expansion{ sourceManager, alloc, buffer, directive, true }; + MacroExpansion expansion{sourceManager, alloc, buffer, directive, true}; if (!expandMacro(macro, expansion, actualArgs)) return actualArgs; @@ -166,8 +166,8 @@ bool Preprocessor::applyMacroOps(span tokens, SmallVector& d if (stringifyBuffer.empty() || tokens[i + 1].kind == TokenKind::MacroQuote) addDiag(diag::IgnoredMacroPaste, token.location()); else { - newToken = - Lexer::concatenateTokens(alloc, stringifyBuffer.back(), tokens[i + 1]); + newToken = Lexer::concatenateTokens(alloc, stringifyBuffer.back(), + tokens[i + 1]); if (newToken) { stringifyBuffer.pop(); ++i; @@ -319,8 +319,8 @@ bool Preprocessor::expandMacro(MacroDef macro, MacroExpansion& expansion, if (!directive->formalArguments) { // each macro expansion gets its own location entry SourceLocation start = body[0].location(); - SourceLocation expansionLoc = - sourceManager.createExpansionLoc(start, expansion.getRange(), macroName); + SourceLocation expansionLoc = sourceManager.createExpansionLoc(start, expansion.getRange(), + macroName); // simple macro; just take body tokens for (auto token : body) @@ -374,8 +374,8 @@ bool Preprocessor::expandMacro(MacroDef macro, MacroExpansion& expansion, endOfArgs.location() + endOfArgs.rawText().length()); SourceLocation start = body[0].location(); - SourceLocation expansionLoc = - sourceManager.createExpansionLoc(start, expansionRange, macroName); + SourceLocation expansionLoc = sourceManager.createExpansionLoc(start, expansionRange, + macroName); auto append = [&](Token token) { expansion.append(token, expansionLoc, start, expansionRange); @@ -540,7 +540,7 @@ bool Preprocessor::expandMacro(MacroDef macro, MacroExpansion& expansion, } SourceRange Preprocessor::MacroExpansion::getRange() const { - return { usageSite.location(), usageSite.location() + usageSite.rawText().length() }; + return {usageSite.location(), usageSite.location() + usageSite.rawText().length()}; } SourceLocation Preprocessor::MacroExpansion::adjustLoc(Token token, SourceLocation& macroLoc, @@ -629,7 +629,7 @@ bool Preprocessor::expandReplacementList( } expansionBuffer.clear(); - MacroExpansion expansion{ sourceManager, alloc, expansionBuffer, token, false }; + MacroExpansion expansion{sourceManager, alloc, expansionBuffer, token, false}; if (!expandMacro(macro, expansion, actualArgs)) return false; diff --git a/source/parsing/Preprocessor_pragmas.cpp b/source/parsing/Preprocessor_pragmas.cpp index ef9fef459..26d4291d9 100644 --- a/source/parsing/Preprocessor_pragmas.cpp +++ b/source/parsing/Preprocessor_pragmas.cpp @@ -20,10 +20,10 @@ std::pair Preprocessor::parsePragmaExpression() { auto equals = consume(); auto [expr, succeeded] = parsePragmaValue(); auto result = alloc.emplace(name, equals, *expr); - return { result, succeeded }; + return {result, succeeded}; } - return { alloc.emplace(name), true }; + return {alloc.emplace(name), true}; } return parsePragmaValue(); @@ -41,28 +41,28 @@ std::pair Preprocessor::parsePragmaValue() { expr = alloc.emplace(result.value); } else { - expr = - alloc.emplace(result.size, result.base, result.value); + expr = alloc.emplace(result.size, result.base, + result.value); } - return { expr, true }; + return {expr, true}; } if (token.kind == TokenKind::RealLiteral) { auto result = numberParser.parseReal(*this); - return { alloc.emplace(result), true }; + return {alloc.emplace(result), true}; } if (token.kind == TokenKind::Identifier || token.kind == TokenKind::StringLiteral || LexerFacts::isKeyword(token.kind)) { - return { alloc.emplace(consume()), true }; + return {alloc.emplace(consume()), true}; } if (token.kind != TokenKind::OpenParenthesis) { addDiag(diag::ExpectedPragmaExpression, token.location()); auto expected = Token::createMissing(alloc, TokenKind::Identifier, token.location()); - return { alloc.emplace(expected), false }; + return {alloc.emplace(expected), false}; } SmallVectorSized values; @@ -114,8 +114,8 @@ std::pair Preprocessor::parsePragmaValue() { lastToken, Token()); } - return { alloc.emplace(openParen, values.copy(alloc), closeParen), - ok }; + return {alloc.emplace(openParen, values.copy(alloc), closeParen), + ok}; } std::pair Preprocessor::checkNextPragmaToken() { @@ -124,9 +124,9 @@ std::pair Preprocessor::checkNextPragmaToken() { addDiag(diag::ExpectedPragmaExpression, loc); auto expected = Token::createMissing(alloc, TokenKind::Identifier, loc); - return { alloc.emplace(expected), false }; + return {alloc.emplace(expected), false}; } - return { nullptr, true }; + return {nullptr, true}; } void Preprocessor::handleExponentSplit(Token token, size_t offset) { diff --git a/source/parsing/Token.cpp b/source/parsing/Token.cpp index 3f1de490c..d254708fe 100644 --- a/source/parsing/Token.cpp +++ b/source/parsing/Token.cpp @@ -76,15 +76,15 @@ void NumericTokenFlags::setOutOfRange(bool value) { raw |= uint8_t(value) << 6; } -Trivia::Trivia() : rawText{ "", 0 }, kind(TriviaKind::Unknown) { +Trivia::Trivia() : rawText{"", 0}, kind(TriviaKind::Unknown) { } Trivia::Trivia(TriviaKind kind, string_view rawText) : - rawText{ rawText.data(), (uint32_t)rawText.size() }, kind(kind) { + rawText{rawText.data(), (uint32_t)rawText.size()}, kind(kind) { } Trivia::Trivia(TriviaKind kind, span tokens) : - tokens{ tokens.data(), (uint32_t)tokens.size() }, kind(kind) { + tokens{tokens.data(), (uint32_t)tokens.size()}, kind(kind) { } Trivia::Trivia(TriviaKind kind, SyntaxNode* syntax) : syntaxNode(syntax), kind(kind) { @@ -140,14 +140,14 @@ string_view Trivia::getRawText() const { default: if (hasFullLocation) return fullLocation->text; - return { rawText.ptr, rawText.len }; + return {rawText.ptr, rawText.len}; } } span Trivia::getSkippedTokens() const { if (kind != TriviaKind::SkippedTokens) return {}; - return { tokens.ptr, tokens.len }; + return {tokens.ptr, tokens.len}; } Token::Token() : @@ -189,8 +189,8 @@ Token::Token(BumpAllocator& alloc, TokenKind kind, span trivia, st if (value.isSingleWord()) storage.val = *value.getRawPtr(); else { - storage.pVal = - (uint64_t*)alloc.allocate(sizeof(uint64_t) * value.getNumWords(), alignof(uint64_t)); + storage.pVal = (uint64_t*)alloc.allocate(sizeof(uint64_t) * value.getNumWords(), + alignof(uint64_t)); memcpy(storage.pVal, value.getRawPtr(), sizeof(uint64_t) * value.getNumWords()); } @@ -281,10 +281,10 @@ span Token::trivia() const { if (triviaCountSmall == MaxTriviaSmallCount + 1) { size_t size; memcpy(&size, ptr + sizeof(trivia), sizeof(size_t)); - return { trivia, size }; + return {trivia, size}; } - return { trivia, triviaCountSmall }; + return {trivia, triviaCountSmall}; } std::string Token::toString() const { diff --git a/source/symbols/BlockSymbols.cpp b/source/symbols/BlockSymbols.cpp index 2cac0d212..9689c54c2 100644 --- a/source/symbols/BlockSymbols.cpp +++ b/source/symbols/BlockSymbols.cpp @@ -53,10 +53,10 @@ static std::pair getLabel(const StatementSyntax& sy SourceLocation defaultLoc) { if (syntax.label) { auto token = syntax.label->name; - return { token.valueText(), token.location() }; + return {token.valueText(), token.location()}; } - return { ""sv, defaultLoc }; + return {""sv, defaultLoc}; } static StatementBlockSymbol* createBlock( @@ -101,8 +101,8 @@ StatementBlockSymbol& StatementBlockSymbol::fromSyntax(const Scope& scope, std::tie(name, loc) = getLabel(syntax, syntax.begin.location()); } - auto result = - createBlock(scope, syntax, name, loc, SemanticFacts::getStatementBlockKind(syntax)); + auto result = createBlock(scope, syntax, name, loc, + SemanticFacts::getStatementBlockKind(syntax)); result->blocks = Statement::createAndAddBlockItems(*result, syntax.items); return *result; @@ -118,15 +118,15 @@ StatementBlockSymbol& StatementBlockSymbol::fromSyntax(const Scope& scope, auto& comp = scope.getCompilation(); const VariableSymbol* lastVar = nullptr; for (auto init : syntax.initializers) { - auto& var = - VariableSymbol::fromSyntax(comp, init->as(), lastVar); + auto& var = VariableSymbol::fromSyntax(comp, init->as(), + lastVar); lastVar = &var; result->addMember(var); } - result->blocks = - Statement::createAndAddBlockItems(*result, *syntax.statement, /* labelHandled */ false); + result->blocks = Statement::createAndAddBlockItems(*result, *syntax.statement, + /* labelHandled */ false); return *result; } @@ -134,8 +134,8 @@ StatementBlockSymbol& StatementBlockSymbol::fromSyntax(const Scope& scope, const ForeachLoopStatementSyntax& syntax) { auto [name, loc] = getLabel(syntax, syntax.keyword.location()); auto result = createBlock(scope, syntax, name, loc); - result->blocks = - Statement::createAndAddBlockItems(*result, *syntax.statement, /* labelHandled */ false); + result->blocks = Statement::createAndAddBlockItems(*result, *syntax.statement, + /* labelHandled */ false); // This block needs elaboration to collect iteration variables. result->setNeedElaboration(); @@ -576,8 +576,8 @@ GenerateBlockArraySymbol& GenerateBlockArraySymbol::fromSyntax(Compilation& comp uint32_t constructIndex) { string_view name = getGenerateBlockName(*syntax.block); SourceLocation loc = syntax.block->getFirstToken().location(); - auto result = - compilation.emplace(compilation, name, loc, constructIndex); + auto result = compilation.emplace(compilation, name, loc, + constructIndex); result->setSyntax(syntax); result->setAttributes(*context.scope, syntax.attributes); @@ -611,8 +611,8 @@ GenerateBlockArraySymbol& GenerateBlockArraySymbol::fromSyntax(Compilation& comp auto createBlock = [&](ConstantValue value, bool isInstantiated) { // Spec: each generate block gets their own scope, with an implicit // localparam of the same name as the genvar. - auto block = - compilation.emplace(compilation, "", loc, 1u, isInstantiated); + auto block = compilation.emplace(compilation, "", loc, 1u, + isInstantiated); auto implicitParam = compilation.emplace( genvar.valueText(), genvar.location(), true /* isLocal */, false /* isPort */); @@ -637,8 +637,9 @@ GenerateBlockArraySymbol& GenerateBlockArraySymbol::fromSyntax(Compilation& comp return *result; // Fabricate a local variable that will serve as the loop iteration variable. - auto& iterScope = *compilation.emplace( - compilation, "", loc, StatementBlockKind::Sequential, VariableLifetime::Automatic); + auto& iterScope = *compilation.emplace(compilation, "", loc, + StatementBlockKind::Sequential, + VariableLifetime::Automatic); auto& local = *compilation.emplace(genvar.valueText(), genvar.location(), VariableLifetime::Automatic); local.setType(compilation.getIntegerType()); @@ -650,8 +651,8 @@ GenerateBlockArraySymbol& GenerateBlockArraySymbol::fromSyntax(Compilation& comp // Bind the stop and iteration expressions so we can reuse them on each iteration. BindContext iterContext(iterScope, LookupLocation::max); auto& stopExpr = Expression::bind(*syntax.stopExpr, iterContext); - auto& iterExpr = - Expression::bind(*syntax.iterationExpr, iterContext, BindFlags::AssignmentAllowed); + auto& iterExpr = Expression::bind(*syntax.iterationExpr, iterContext, + BindFlags::AssignmentAllowed); if (stopExpr.bad() || iterExpr.bad()) return *result; diff --git a/source/symbols/ClassSymbols.cpp b/source/symbols/ClassSymbols.cpp index d64b36e20..0240efc00 100644 --- a/source/symbols/ClassSymbols.cpp +++ b/source/symbols/ClassSymbols.cpp @@ -90,8 +90,9 @@ void ClassPropertySymbol::fromSyntax(const Scope& scope, } for (auto declarator : dataSyntax.declarators) { - auto var = comp.emplace( - declarator->name.valueText(), declarator->name.location(), lifetime, visibility); + auto var = comp.emplace(declarator->name.valueText(), + declarator->name.location(), lifetime, + visibility); var->randMode = randMode; var->setDeclaredType(*dataSyntax.type); var->setFromDeclarator(*declarator); @@ -183,10 +184,10 @@ void ClassType::populate(const Scope& scope, const ClassDeclarationSyntax& synta }; auto& scopeNameMap = getUnelaboratedNameMap(); - auto makeFunc = [&](string_view funcName, const Type& returnType, bool allowOverride, - bitmask extraFlags = MethodFlags::None, - SubroutineKind subroutineKind = - SubroutineKind::Function) -> optional { + auto makeFunc = + [&](string_view funcName, const Type& returnType, bool allowOverride, + bitmask extraFlags = MethodFlags::None, + SubroutineKind subroutineKind = SubroutineKind::Function) -> optional { if (auto it = scopeNameMap.find(funcName); it != scopeNameMap.end()) { auto existing = it->second; if (allowOverride) { @@ -224,13 +225,13 @@ void ClassType::populate(const Scope& scope, const ClassDeclarationSyntax& synta if (srandom) srandom->addArg("seed", int_t); - auto rand_mode = - makeFunc("rand_mode", void_t, false, MethodFlags::None, SubroutineKind::Function); + auto rand_mode = makeFunc("rand_mode", void_t, false, MethodFlags::None, + SubroutineKind::Function); if (rand_mode) rand_mode->addArg("on_ff", comp.getBitType()); - auto constraint_mode = - makeFunc("constraint_mode", void_t, false, MethodFlags::None, SubroutineKind::Function); + auto constraint_mode = makeFunc("constraint_mode", void_t, false, MethodFlags::None, + SubroutineKind::Function); if (constraint_mode) constraint_mode->addArg("on_ff", comp.getBitType()); @@ -327,8 +328,8 @@ void ClassType::handleExtends(const ExtendsClauseSyntax& extendsClause, const Bi auto& sub = toWrap->as(); if (sub.flags & MethodFlags::Pure) { if (!pureVirtualError) { - auto& diag = - context.addDiag(diag::InheritFromAbstract, extendsClause.sourceRange()); + auto& diag = context.addDiag(diag::InheritFromAbstract, + extendsClause.sourceRange()); diag << name; diag << baseType->name; diag << sub.name; @@ -399,9 +400,10 @@ void ClassType::handleExtends(const ExtendsClauseSyntax& extendsClause, const Bi if (auto baseSub = proto.getOverride()) { if (auto protoSub = proto.getSubroutine()) { - SubroutineSymbol::checkVirtualMethodMatch( - *context.scope, baseSub->as(), *protoSub, - /* allowDerivedReturn */ true); + SubroutineSymbol::checkVirtualMethodMatch(*context.scope, + baseSub->as(), + *protoSub, + /* allowDerivedReturn */ true); } } } @@ -417,8 +419,8 @@ void ClassType::handleExtends(const ExtendsClauseSyntax& extendsClause, const Bi if (baseConstraint.isPure && baseConstraint.isStatic != member.as().isStatic) { - auto& diag = - context.addDiag(diag::MismatchStaticConstraint, member.location); + auto& diag = context.addDiag(diag::MismatchStaticConstraint, + member.location); diag.addNote(diag::NoteDeclarationHere, found->location); } } @@ -519,8 +521,8 @@ const Expression* ClassType::getBaseConstructorCall() const { if (baseConstructor && !callExpr) { for (auto arg : baseConstructor->as().getArguments()) { if (!arg->getInitializer()) { - auto& diag = - context.addDiag(diag::BaseConstructorNotCalled, extendsClause.sourceRange()); + auto& diag = context.addDiag(diag::BaseConstructorNotCalled, + extendsClause.sourceRange()); diag << name << baseClass->name; diag.addNote(diag::NoteDeclarationHere, baseConstructor->location); return nullptr; @@ -605,8 +607,8 @@ void ClassType::handleImplements(const ImplementsClauseSyntax& implementsClause, auto parent = existing.getParentScope(); ASSERT(parent); - auto& diag = - context.addDiag(diag::IfaceNameConflict, nameSyntax->sourceRange()); + auto& diag = context.addDiag(diag::IfaceNameConflict, + nameSyntax->sourceRange()); diag << member.name << iface->name << parent->asSymbol().name; diag.addNote(diag::NoteDeclarationHere, toWrap->location); diag.addNote(diag::NoteDeclarationHere, existing.location); @@ -672,8 +674,8 @@ void ClassType::handleImplements(const ImplementsClauseSyntax& implementsClause, auto impl = find(method.name); if (!impl || impl->kind != SymbolKind::Subroutine) { - auto& diag = - context.addDiag(diag::IfaceMethodNoImpl, nameSyntax->sourceRange()); + auto& diag = context.addDiag(diag::IfaceMethodNoImpl, + nameSyntax->sourceRange()); diag << name << method.name << iface->name; continue; } @@ -681,8 +683,8 @@ void ClassType::handleImplements(const ImplementsClauseSyntax& implementsClause, // The method must be virtual in order to be a valid implementation. auto& implSub = impl->as(); if (!implSub.isVirtual()) { - auto& diag = - context.addDiag(diag::IfaceMethodNotVirtual, nameSyntax->sourceRange()); + auto& diag = context.addDiag(diag::IfaceMethodNotVirtual, + nameSyntax->sourceRange()); diag << name << method.name << iface->name; diag.addNote(diag::NoteDeclarationHere, impl->location); continue; @@ -786,7 +788,7 @@ const Type* GenericClassDefSymbol::getSpecializationImpl( if (syntax) paramBuilder.setAssignments(*syntax); - SourceRange instRange = { instanceLoc, instanceLoc + 1 }; + SourceRange instRange = {instanceLoc, instanceLoc + 1}; SmallVectorSized paramValues; SmallVectorSized typeParams; @@ -931,8 +933,8 @@ ConstraintBlockSymbol* ConstraintBlockSymbol::fromSyntax( scope.addDiag(diag::ConstraintNotInClass, syntax.sourceRange()); auto nameToken = syntax.name->getLastToken(); - auto result = - comp.emplace(comp, nameToken.valueText(), nameToken.location()); + auto result = comp.emplace(comp, nameToken.valueText(), + nameToken.location()); result->setSyntax(syntax); result->setAttributes(scope, syntax.attributes); @@ -958,8 +960,8 @@ ConstraintBlockSymbol& ConstraintBlockSymbol::fromSyntax(const Scope& scope, const ConstraintPrototypeSyntax& syntax) { auto& comp = scope.getCompilation(); auto nameToken = syntax.name->getLastToken(); - auto result = - comp.emplace(comp, nameToken.valueText(), nameToken.location()); + auto result = comp.emplace(comp, nameToken.valueText(), + nameToken.location()); result->setSyntax(syntax); result->setAttributes(scope, syntax.attributes); result->isExtern = true; @@ -1045,8 +1047,8 @@ const Constraint& ConstraintBlockSymbol::getConstraints() const { } if (declStatic != isStatic) { - auto& diag = - outerScope.addDiag(diag::MismatchStaticConstraint, cds.getFirstToken().location()); + auto& diag = outerScope.addDiag(diag::MismatchStaticConstraint, + cds.getFirstToken().location()); diag.addNote(diag::NoteDeclarationHere, location); } diff --git a/source/symbols/CompilationUnitSymbols.cpp b/source/symbols/CompilationUnitSymbols.cpp index 9cb3fb4d7..916384e48 100644 --- a/source/symbols/CompilationUnitSymbols.cpp +++ b/source/symbols/CompilationUnitSymbols.cpp @@ -21,8 +21,8 @@ CompilationUnitSymbol::CompilationUnitSymbol(Compilation& compilation) : // All compilation units import the std package automatically. auto& stdPkg = compilation.getStdPackage(); - auto import = - compilation.emplace(stdPkg.name, SourceLocation::NoLocation); + auto import = compilation.emplace(stdPkg.name, + SourceLocation::NoLocation); import->setPackage(stdPkg); addWildcardImport(*import); } diff --git a/source/symbols/CoverSymbols.cpp b/source/symbols/CoverSymbols.cpp index 626b6f461..5a22e0e22 100644 --- a/source/symbols/CoverSymbols.cpp +++ b/source/symbols/CoverSymbols.cpp @@ -256,9 +256,10 @@ const Symbol& CovergroupType::fromSyntax(const Scope& scope, body->options = options.get(); if (inClass) { - auto var = - comp.emplace(syntax.name.valueText(), syntax.name.location(), - VariableLifetime::Automatic, Visibility::Public); + auto var = comp.emplace(syntax.name.valueText(), + syntax.name.location(), + VariableLifetime::Automatic, + Visibility::Public); var->setType(*result); var->flags |= VariableFlags::Const; return *var; @@ -287,8 +288,8 @@ const TimingControl* CovergroupType::getCoverageEvent() const { return *event; } else if (evSyntax->kind == SyntaxKind::EventControlWithExpression) { - event = - &TimingControl::bind(evSyntax->as(), context); + event = &TimingControl::bind(evSyntax->as(), + context); return *event; } } @@ -492,8 +493,8 @@ void CoverageBinSymbol::resolve() const { auto& binsSyntax = syntax->as(); if (binsSyntax.iff) { - iffExpr = - &Expression::bind(*binsSyntax.iff->expr, context, BindFlags::AllowCoverageSampleFormal); + iffExpr = &Expression::bind(*binsSyntax.iff->expr, context, + BindFlags::AllowCoverageSampleFormal); context.requireBooleanConvertible(*iffExpr); } @@ -562,8 +563,8 @@ void CoverageBinSymbol::resolve() const { if (!t.isArray() || t.isAssociativeArray() || !type.isAssignmentCompatible(*t.getArrayElementType())) { - auto& diag = - context.addDiag(diag::CoverageSetType, setCoverageExpr->sourceRange); + auto& diag = context.addDiag(diag::CoverageSetType, + setCoverageExpr->sourceRange); diag << t << coverpoint.name << type; } } @@ -913,12 +914,12 @@ const BinsSelectExpr& BinsSelectExpr::bind(const BinsSelectExpressionSyntax& syn syntax.as(), context); break; case SyntaxKind::UnaryBinsSelectExpr: - result = - &UnaryBinsSelectExpr::fromSyntax(syntax.as(), context); + result = &UnaryBinsSelectExpr::fromSyntax(syntax.as(), + context); break; case SyntaxKind::BinaryBinsSelectExpr: - result = - &BinaryBinsSelectExpr::fromSyntax(syntax.as(), context); + result = &BinaryBinsSelectExpr::fromSyntax(syntax.as(), + context); break; case SyntaxKind::SimpleBinsSelectExpr: result = &SetExprBinsSelectExpr::fromSyntax(syntax.as(), diff --git a/source/symbols/InstanceSymbols.cpp b/source/symbols/InstanceSymbols.cpp index 7a1e94459..536622fa5 100644 --- a/source/symbols/InstanceSymbols.cpp +++ b/source/symbols/InstanceSymbols.cpp @@ -95,9 +95,10 @@ class InstanceBuilder { ASSERT(syntax.decl); auto nameToken = syntax.decl->name; auto createEmpty = [&]() { - return compilation.emplace( - compilation, nameToken.valueText(), nameToken.location(), - span{}, ConstantRange()); + return compilation.emplace(compilation, nameToken.valueText(), + nameToken.location(), + span{}, + ConstantRange()); }; auto& dimSyntax = **it; @@ -233,9 +234,9 @@ InstanceSymbol& InstanceSymbol::createVirtual( paramBuilder.setAssignments(*paramAssignments); auto& comp = context.getCompilation(); - auto& result = - *comp.emplace(comp, definition.name, loc, definition, paramBuilder, - /* isUninstantiated */ false); + auto& result = *comp.emplace(comp, definition.name, loc, definition, + paramBuilder, + /* isUninstantiated */ false); // Set the parent pointer so that traversing upwards still works to find // the instantiation scope. This "virtual" instance never actually gets @@ -577,8 +578,9 @@ void InstanceSymbol::resolvePortConnections() const { if (!syntax) return; - PortConnection::makeConnections( - *this, portList, syntax->as().connections, *connections); + PortConnection::makeConnections(*this, portList, + syntax->as().connections, + *connections); } void InstanceSymbol::serializeTo(ASTSerializer& serializer) const { @@ -944,9 +946,10 @@ Symbol* recursePrimArray(Compilation& compilation, const PrimitiveSymbol& primit ASSERT(instance.decl); auto nameToken = instance.decl->name; auto createEmpty = [&]() { - return compilation.emplace( - compilation, nameToken.valueText(), nameToken.location(), span{}, - ConstantRange()); + return compilation.emplace(compilation, nameToken.valueText(), + nameToken.location(), + span{}, + ConstantRange()); }; auto& dimSyntax = **it; @@ -969,8 +972,8 @@ Symbol* recursePrimArray(Compilation& compilation, const PrimitiveSymbol& primit SmallVectorSized elements; for (int32_t i = range.lower(); i <= range.upper(); i++) { path.append(i); - auto symbol = - recursePrimArray(compilation, primitive, instance, context, it, end, attributes, path); + auto symbol = recursePrimArray(compilation, primitive, instance, context, it, end, + attributes, path); path.pop(); symbol->name = ""; @@ -1051,8 +1054,8 @@ void PrimitiveInstanceSymbol::fromSyntax(const PrimitiveInstantiationSyntax& syn while (currScope && currScope->asSymbol().kind != SymbolKind::InstanceBody) currScope = currScope->asSymbol().getParentScope(); - bool isUninstantiated = - currScope && currScope->asSymbol().as().isUninstantiated; + bool isUninstantiated = currScope && + currScope->asSymbol().as().isUninstantiated; if (!isUninstantiated) context.addDiag(diag::UnknownPrimitive, syntax.type.range()) << name; @@ -1079,8 +1082,8 @@ span PrimitiveInstanceSymbol::getPortConnections() cons auto& his = syntax->as(); for (auto port : his.connections) { if (port->kind == SyntaxKind::OrderedPortConnection) { - auto expr = - context.requireSimpleExpr(*port->as().expr); + auto expr = context.requireSimpleExpr( + *port->as().expr); if (!expr) { ports.emplace(); return *ports; @@ -1125,8 +1128,8 @@ span PrimitiveInstanceSymbol::getPortConnections() cons } else { if (conns.size() != primitiveType.ports.size()) { - auto& diag = - context.addDiag(diag::PrimitivePortCountWrong, his.openParen.location()); + auto& diag = context.addDiag(diag::PrimitivePortCountWrong, + his.openParen.location()); diag << primitiveType.name; diag << conns.size() << primitiveType.ports.size(); ports.emplace(); diff --git a/source/symbols/MemberSymbols.cpp b/source/symbols/MemberSymbols.cpp index 3d0564202..c35df80cd 100644 --- a/source/symbols/MemberSymbols.cpp +++ b/source/symbols/MemberSymbols.cpp @@ -157,9 +157,9 @@ ModportPortSymbol& ModportPortSymbol::fromSyntax(const BindContext& context, auto name = syntax.name; auto result = comp.emplace(name.valueText(), name.location(), direction); result->setSyntax(syntax); - result->internalSymbol = - Lookup::unqualifiedAt(*context.scope, name.valueText(), context.getLocation(), name.range(), - LookupFlags::NoParentScope); + result->internalSymbol = Lookup::unqualifiedAt(*context.scope, name.valueText(), + context.getLocation(), name.range(), + LookupFlags::NoParentScope); if (result->internalSymbol) { if (result->internalSymbol->kind == SymbolKind::Subroutine) { @@ -192,7 +192,7 @@ ModportPortSymbol& ModportPortSymbol::fromSyntax(const BindContext& context, auto loc = result->location; auto& expr = ValueExpressionBase::fromSymbol(checkCtx, *result->internalSymbol, false, - { loc, loc + result->name.length() }); + {loc, loc + result->name.length()}); switch (direction) { case ArgumentDirection::In: @@ -306,8 +306,8 @@ void ModportSymbol::fromSyntax(const BindContext& context, const ModportDeclarat SmallVector& results) { auto& comp = context.getCompilation(); for (auto item : syntax.items) { - auto modport = - comp.emplace(comp, item->name.valueText(), item->name.location()); + auto modport = comp.emplace(comp, item->name.valueText(), + item->name.location()); modport->setSyntax(*item); modport->setAttributes(*context.scope, syntax.attributes); results.append(modport); @@ -436,8 +436,8 @@ const Expression& ContinuousAssignSymbol::getAssignment() const { ASSERT(scope && syntax); BindContext context(*scope, LookupLocation::after(*this), BindFlags::NonProcedural); - assign = - &Expression::bind(syntax->as(), context, BindFlags::AssignmentAllowed); + assign = &Expression::bind(syntax->as(), context, + BindFlags::AssignmentAllowed); return *assign; } @@ -771,8 +771,9 @@ PrimitiveSymbol& PrimitiveSymbol::fromSyntax(const Scope& scope, auto& inputDecl = decl->as(); for (auto nameSyntax : inputDecl.names) { auto name = nameSyntax->identifier; - auto port = comp.emplace( - comp, name.valueText(), name.location(), PrimitivePortDirection::In); + auto port = comp.emplace(comp, name.valueText(), + name.location(), + PrimitivePortDirection::In); port->setSyntax(*nameSyntax); port->setAttributes(scope, decl->attributes); @@ -817,8 +818,8 @@ PrimitiveSymbol& PrimitiveSymbol::fromSyntax(const Scope& scope, // end once we've handled all of the regular declarations. if (outputDecl.reg && !outputDecl.keyword) { if (regSpecifier) { - auto& diag = - scope.addDiag(diag::PrimitiveRegDup, outputDecl.reg.range()); + auto& diag = scope.addDiag(diag::PrimitiveRegDup, + outputDecl.reg.range()); diag.addNote(diag::NotePreviousDefinition, regSpecifier->reg.location()); } @@ -1019,8 +1020,8 @@ void AssertionPortSymbol::buildPorts(Scope& scope, const AssertionItemPortListSy optional lastLocalDir; for (auto item : syntax.ports) { - auto port = - comp.emplace(item->name.valueText(), item->name.location()); + auto port = comp.emplace(item->name.valueText(), + item->name.location()); port->setSyntax(*item); port->setAttributes(scope, item->attributes); @@ -1111,8 +1112,8 @@ SequenceSymbol::SequenceSymbol(Compilation& compilation, string_view name, Sourc SequenceSymbol& SequenceSymbol::fromSyntax(const Scope& scope, const SequenceDeclarationSyntax& syntax) { auto& comp = scope.getCompilation(); - auto result = - comp.emplace(comp, syntax.name.valueText(), syntax.name.location()); + auto result = comp.emplace(comp, syntax.name.valueText(), + syntax.name.location()); result->setSyntax(syntax); SmallVectorSized ports; @@ -1134,8 +1135,8 @@ PropertySymbol::PropertySymbol(Compilation& compilation, string_view name, Sourc PropertySymbol& PropertySymbol::fromSyntax(const Scope& scope, const PropertyDeclarationSyntax& syntax) { auto& comp = scope.getCompilation(); - auto result = - comp.emplace(comp, syntax.name.valueText(), syntax.name.location()); + auto result = comp.emplace(comp, syntax.name.valueText(), + syntax.name.location()); result->setSyntax(syntax); SmallVectorSized ports; @@ -1203,8 +1204,8 @@ ClockingBlockSymbol& ClockingBlockSymbol::fromSyntax(const Scope& scope, auto& dir = *item->as().direction; if (dir.inputSkew) { if (inputSkew) { - auto& diag = - scope.addDiag(diag::MultipleDefaultInputSkew, dir.inputSkew->sourceRange()); + auto& diag = scope.addDiag(diag::MultipleDefaultInputSkew, + dir.inputSkew->sourceRange()); diag.addNote(diag::NotePreviousDefinition, inputSkew->getFirstToken().location()); } @@ -1243,8 +1244,9 @@ const TimingControl& ClockingBlockSymbol::getEvent() const { ASSERT(scope && syntax); BindContext context(*scope, LookupLocation::before(*this)); - event = &EventListControl::fromSyntax( - getCompilation(), *syntax->as().event, context); + event = &EventListControl::fromSyntax(getCompilation(), + *syntax->as().event, + context); } return *event; } @@ -1433,7 +1435,7 @@ const RandSeqProductionSymbol::CaseProd& RandSeqProductionSymbol::createCaseProd for (size_t i = 0; i < sci.expressions.size(); i++) group.append(*boundIt++); - items.append({ group.copy(comp), *prodIt++ }); + items.append({group.copy(comp), *prodIt++}); group.clear(); break; } @@ -1528,15 +1530,15 @@ RandSeqProductionSymbol::Rule RandSeqProductionSymbol::createRule( block.getStatement(context, stmtCtx); } - return { ruleBlock, prods.copy(comp), weightExpr, randJoinExpr, codeBlock, isRandJoin }; + return {ruleBlock, prods.copy(comp), weightExpr, randJoinExpr, codeBlock, isRandJoin}; } void RandSeqProductionSymbol::createRuleVariables(const RsRuleSyntax& syntax, const Scope& scope, SmallVector& results) { SmallMap prodMap; auto countProd = [&](const RsProdItemSyntax& item) { - auto symbol = - Lookup::unqualified(scope, item.name.valueText(), LookupFlags::AllowDeclaredAfter); + auto symbol = Lookup::unqualified(scope, item.name.valueText(), + LookupFlags::AllowDeclaredAfter); if (symbol && symbol->kind == SymbolKind::RandSeqProduction) { auto& prod = symbol->as(); auto& type = prod.getReturnType(); @@ -1594,9 +1596,9 @@ void RandSeqProductionSymbol::createRuleVariables(const RsRuleSyntax& syntax, co var->setType(symbol->getReturnType()); } else { - ConstantRange range{ 1, int32_t(count) }; + ConstantRange range{1, int32_t(count)}; var->setType( - FixedSizeUnpackedArrayType::fromDims(comp, symbol->getReturnType(), { &range, 1 })); + FixedSizeUnpackedArrayType::fromDims(comp, symbol->getReturnType(), {&range, 1})); } results.append(var); diff --git a/source/symbols/ParameterSymbols.cpp b/source/symbols/ParameterSymbols.cpp index da84268fb..c0250a4ec 100644 --- a/source/symbols/ParameterSymbols.cpp +++ b/source/symbols/ParameterSymbols.cpp @@ -276,8 +276,8 @@ void DefParamSymbol::resolve() const { if (typeSyntax && typeSyntax->kind == SyntaxKind::ImplicitType) { BindContext typeContext(*param.getParentScope(), LookupLocation::before(param)); - initializer = - &Expression::bindImplicitParam(*typeSyntax, expr, equalsLoc, context, typeContext); + initializer = &Expression::bindImplicitParam(*typeSyntax, expr, equalsLoc, context, + typeContext); } else { initializer = &Expression::bindRValue(declType->getType(), expr, equalsLoc, context); diff --git a/source/symbols/PortSymbols.cpp b/source/symbols/PortSymbols.cpp index f900482a7..310ed8da8 100644 --- a/source/symbols/PortSymbols.cpp +++ b/source/symbols/PortSymbols.cpp @@ -67,7 +67,7 @@ std::tuple getInterfacePortInfo( } } - return { def, modport }; + return {def, modport}; } // This checks factors other than types when making a port connection @@ -271,8 +271,8 @@ class AnsiPortListBuilder { symbol = comp.emplace(port->name, port->location, *netType); } else { - symbol = - comp.emplace(port->name, port->location, VariableLifetime::Static); + symbol = comp.emplace(port->name, port->location, + VariableLifetime::Static); } if (type) { @@ -358,8 +358,8 @@ class NonAnsiPortListBuilder { auto& port = syntax->as(); for (auto decl : port.declarators) { if (auto name = decl->name; !name.isMissing()) { - auto [it, inserted] = - portInfos.emplace(name.valueText(), PortInfo{ *decl, port.attributes }); + auto [it, inserted] = portInfos.emplace(name.valueText(), + PortInfo{*decl, port.attributes}); if (inserted) { handleIODecl(*port.header, it->second, insertionPoint); @@ -383,8 +383,8 @@ class NonAnsiPortListBuilder { for (auto decl : data.declarators) { if (auto name = decl->name; !name.isMissing()) { - auto [it, inserted] = - portInfos.emplace(name.valueText(), PortInfo{ *decl, data.attributes }); + auto [it, inserted] = portInfos.emplace(name.valueText(), + PortInfo{*decl, data.attributes}); if (inserted) { auto& info = it->second; @@ -443,8 +443,8 @@ class NonAnsiPortListBuilder { } Symbol* createPort(const EmptyNonAnsiPortSyntax& syntax) { - auto port = - comp.emplace("", syntax.placeholder.location(), /* isAnsiPort */ false); + auto port = comp.emplace("", syntax.placeholder.location(), + /* isAnsiPort */ false); port->direction = ArgumentDirection::In; port->setSyntax(syntax); port->isNullPort = true; @@ -502,15 +502,15 @@ class NonAnsiPortListBuilder { auto typeName = SyntaxFacts::getSimpleTypeName(*varHeader.dataType); auto result = Lookup::unqualified(scope, typeName, LookupFlags::Type); if (result && result->kind == SymbolKind::NetType) { - auto net = - comp.emplace(name, declLoc, result->as()); + auto net = comp.emplace(name, declLoc, + result->as()); setInternalSymbol(*net, decl, nullptr, info, insertionPoint); break; } } - auto variable = - comp.emplace(name, declLoc, VariableLifetime::Static); + auto variable = comp.emplace(name, declLoc, + VariableLifetime::Static); setInternalSymbol(*variable, decl, varHeader.dataType, info, insertionPoint); } else if (auto symbol = scope.find(name); @@ -524,8 +524,8 @@ class NonAnsiPortListBuilder { // If the I/O declaration is located prior to the symbol, we should update // its index so that lookups in between will resolve correctly. - uint32_t ioIndex = - insertionPoint ? uint32_t(insertionPoint->getIndex()) + 1 : 1; + uint32_t ioIndex = insertionPoint ? uint32_t(insertionPoint->getIndex()) + 1 + : 1; if (uint32_t(symbol->getIndex()) > ioIndex) { val.getDeclaredType()->setOverrideIndex(symbol->getIndex()); val.setIndex(SymbolIndex(ioIndex)); @@ -536,8 +536,8 @@ class NonAnsiPortListBuilder { } else { // No symbol and no data type defaults to a basic net. - auto net = - comp.emplace(name, declLoc, getDefaultNetType(scope, declLoc)); + auto net = comp.emplace(name, declLoc, + getDefaultNetType(scope, declLoc)); setInternalSymbol(*net, decl, varHeader.dataType, info, insertionPoint); } @@ -552,8 +552,8 @@ class NonAnsiPortListBuilder { info.direction = SemanticFacts::getDirection(netHeader.direction.kind); // Create a new symbol to represent this port internally to the instance. - auto net = - comp.emplace(name, declLoc, comp.getNetType(netHeader.netType.kind)); + auto net = comp.emplace(name, declLoc, + comp.getNetType(netHeader.netType.kind)); setInternalSymbol(*net, decl, netHeader.dataType, info, insertionPoint); break; } @@ -770,12 +770,12 @@ class PortConnectionBuilder { else if (conn->kind == SyntaxKind::WildcardPortConnection) { if (!std::exchange(hasWildcard, true)) { wildcardRange = conn->sourceRange(); - wildcardAttrs = - AttributeSymbol::fromSyntax(conn->attributes, scope, lookupLocation); + wildcardAttrs = AttributeSymbol::fromSyntax(conn->attributes, scope, + lookupLocation); } else { - auto& diag = - scope.addDiag(diag::DuplicateWildcardPortConnection, conn->sourceRange()); + auto& diag = scope.addDiag(diag::DuplicateWildcardPortConnection, + conn->sourceRange()); diag.addNote(diag::NotePreviousUsage, wildcardRange); } } @@ -785,8 +785,8 @@ class PortConnectionBuilder { if (!name.empty()) { auto pair = namedConns.emplace(name, std::make_pair(&npc, false)); if (!pair.second) { - auto& diag = - scope.addDiag(diag::DuplicatePortConnection, npc.name.location()); + auto& diag = scope.addDiag(diag::DuplicatePortConnection, + npc.name.location()); diag << name; diag.addNote(diag::NotePreviousUsage, pair.first->second.first->name.location()); @@ -812,8 +812,8 @@ class PortConnectionBuilder { if (port.direction == ArgumentDirection::Ref) { if (port.name.empty()) { if (!unnamedRefError) { - auto& diag = - scope.addDiag(diag::RefPortUnnamedUnconnected, instance.location); + auto& diag = scope.addDiag(diag::RefPortUnnamedUnconnected, + instance.location); diag.addNote(diag::NoteDeclarationHere, port.location); unnamedRefError = true; } @@ -972,8 +972,8 @@ class PortConnectionBuilder { // We marked all the connections that we used, so anything left over is a connection // for a non-existent port. if (!pair.second.second) { - auto& diag = - scope.addDiag(diag::PortDoesNotExist, pair.second.first->name.location()); + auto& diag = scope.addDiag(diag::PortDoesNotExist, + pair.second.first->name.location()); diag << pair.second.first->name.valueText(); diag << instance.body.getDefinition().name; } @@ -1336,7 +1336,7 @@ const Type& PortSymbol::getType() const { BindContext context(*scope, LookupLocation::before(*this), bindFlags); auto& valExpr = ValueExpressionBase::fromSymbol(context, *internalSymbol, false, - { location, location + name.length() }); + {location, location + name.length()}); if (syntax->kind == SyntaxKind::PortReference) { auto& prs = syntax->as(); @@ -1420,8 +1420,8 @@ const Expression* PortSymbol::getInitializer() const { ll = LookupLocation::after(*internalSymbol); BindContext context(*scope, ll, BindFlags::NonProcedural | BindFlags::StaticInitializer); - initializer = - &Expression::bindRValue(getType(), *initializerSyntax, initializerLoc, context); + initializer = &Expression::bindRValue(getType(), *initializerSyntax, initializerLoc, + context); context.eval(*initializer); } @@ -1441,7 +1441,7 @@ static void getNetRanges(const Expression& expr, SmallVector().operands()) @@ -1465,7 +1465,7 @@ void PortSymbol::getNetTypes(SmallVector& ranges) const { } else if (internalSymbol && internalSymbol->kind == SymbolKind::Net) { auto& nt = internalSymbol->as().netType; - ranges.append({ &nt, getType().getBitWidth() }); + ranges.append({&nt, getType().getBitWidth()}); } } @@ -1510,7 +1510,7 @@ void PortSymbol::fromSyntax( switch (syntax.kind) { case SyntaxKind::AnsiPortList: { - AnsiPortListBuilder builder{ scope, implicitMembers }; + AnsiPortListBuilder builder{scope, implicitMembers}; for (auto port : syntax.as().ports) { switch (port->kind) { case SyntaxKind::ImplicitAnsiPort: @@ -1531,7 +1531,7 @@ void PortSymbol::fromSyntax( break; } case SyntaxKind::NonAnsiPortList: { - NonAnsiPortListBuilder builder{ scope, portDeclarations, implicitMembers }; + NonAnsiPortListBuilder builder{scope, portDeclarations, implicitMembers}; for (auto port : syntax.as().ports) { switch (port->kind) { case SyntaxKind::ImplicitNonAnsiPort: @@ -1726,11 +1726,11 @@ const Symbol* PortConnection::getIfaceInstance() const { static std::pair getDirAndType(const Symbol& port) { if (port.kind == SymbolKind::Port) { auto& ps = port.as(); - return { ps.direction, &ps.getType() }; + return {ps.direction, &ps.getType()}; } else { auto& mp = port.as(); - return { mp.direction, &mp.getType() }; + return {mp.direction, &mp.getType()}; } } @@ -1777,8 +1777,8 @@ const Expression* PortConnection::getExpression() const { } } else if (!e->bad() && !type->isError()) { - auto& diag = - context.addDiag(diag::ImplicitNamedPortTypeMismatch, implicitNameRange); + auto& diag = context.addDiag(diag::ImplicitNamedPortTypeMismatch, + implicitNameRange); diag << port.name; diag << *type; diag << *e->type; diff --git a/source/symbols/Scope.cpp b/source/symbols/Scope.cpp index a7be4f0c3..0844112cf 100644 --- a/source/symbols/Scope.cpp +++ b/source/symbols/Scope.cpp @@ -260,8 +260,9 @@ void Scope::addMembers(const SyntaxNode& syntax) { break; case SyntaxKind::FunctionDeclaration: case SyntaxKind::TaskDeclaration: { - auto subroutine = SubroutineSymbol::fromSyntax( - compilation, syntax.as(), *this, /* outOfBlock */ false); + auto subroutine = SubroutineSymbol::fromSyntax(compilation, + syntax.as(), + *this, /* outOfBlock */ false); if (subroutine) addMember(*subroutine); break; @@ -293,8 +294,9 @@ void Scope::addMembers(const SyntaxNode& syntax) { } case SyntaxKind::ParameterDeclarationStatement: { SmallVectorSized params; - ParameterSymbolBase::fromLocalSyntax( - *this, syntax.as(), params); + ParameterSymbolBase::fromLocalSyntax(*this, + syntax.as(), + params); for (auto param : params) addMember(*param); break; @@ -306,8 +308,9 @@ void Scope::addMembers(const SyntaxNode& syntax) { case SyntaxKind::InitialBlock: case SyntaxKind::FinalBlock: { span additional; - auto& block = ProceduralBlockSymbol::fromSyntax( - *this, syntax.as(), additional); + auto& block = ProceduralBlockSymbol::fromSyntax(*this, + syntax.as(), + additional); for (auto b : additional) addMember(*b); @@ -592,7 +595,7 @@ void Scope::insertMember(const Symbol* member, const Symbol* at, bool isElaborat ASSERT(!member->nextInScope); if (!at) { - member->indexInScope = SymbolIndex{ 1 }; + member->indexInScope = SymbolIndex{1}; member->nextInScope = std::exchange(firstMember, member); } else { @@ -1313,8 +1316,8 @@ void Scope::addWildcardImport(const PackageImportItemSyntax& item, } } - auto import = - compilation.emplace(item.package.valueText(), item.item.location()); + auto import = compilation.emplace(item.package.valueText(), + item.item.location()); import->setSyntax(item); import->setAttributes(*this, attributes); diff --git a/source/symbols/SubroutineSymbols.cpp b/source/symbols/SubroutineSymbols.cpp index 62a9b1a1d..64a8cb38a 100644 --- a/source/symbols/SubroutineSymbols.cpp +++ b/source/symbols/SubroutineSymbols.cpp @@ -78,8 +78,8 @@ SubroutineSymbol* SubroutineSymbol::fromSyntax(Compilation& compilation, // We should create the method like normal but not add it to // the parent name map (because it can only be looked up via // the interface instance). - auto result = - SubroutineSymbol::fromSyntax(compilation, syntax, parent, /* outOfBlock */ true); + auto result = SubroutineSymbol::fromSyntax(compilation, syntax, parent, + /* outOfBlock */ true); ASSERT(result); result->setParent(parent, SymbolIndex(index)); @@ -115,8 +115,9 @@ SubroutineSymbol* SubroutineSymbol::fromSyntax(Compilation& compilation, auto subroutineKind = syntax.kind == SyntaxKind::TaskDeclaration ? SubroutineKind::Task : SubroutineKind::Function; - auto result = compilation.emplace( - compilation, nameToken.valueText(), nameToken.location(), *lifetime, subroutineKind); + auto result = compilation.emplace(compilation, nameToken.valueText(), + nameToken.location(), *lifetime, + subroutineKind); result->setSyntax(syntax); result->setAttributes(parent, syntax.attributes); @@ -227,9 +228,10 @@ SubroutineSymbol& SubroutineSymbol::fromSyntax(Compilation& compilation, auto subroutineKind = proto.keyword.kind == TokenKind::TaskKeyword ? SubroutineKind::Task : SubroutineKind::Function; - auto result = compilation.emplace( - compilation, nameToken.valueText(), nameToken.location(), VariableLifetime::Automatic, - subroutineKind); + auto result = compilation.emplace(compilation, nameToken.valueText(), + nameToken.location(), + VariableLifetime::Automatic, + subroutineKind); result->setSyntax(syntax); result->setAttributes(parent, syntax.attributes); result->flags = MethodFlags::DPIImport; @@ -442,9 +444,10 @@ SubroutineSymbol& SubroutineSymbol::createFromPrototype(Compilation& compilation const Scope& parent) { // Create a stub subroutine symbol that exists only to allow the normal expression // machinery to call it (checking argument types, return values, etc). - auto result = compilation.emplace( - compilation, prototype.name, prototype.location, VariableLifetime::Automatic, - prototype.subroutineKind); + auto result = compilation.emplace(compilation, prototype.name, + prototype.location, + VariableLifetime::Automatic, + prototype.subroutineKind); result->setParent(parent, SymbolIndex(INT32_MAX)); result->declaredReturnType.setLink(prototype.declaredReturnType); @@ -579,8 +582,9 @@ void SubroutineSymbol::buildArguments(Scope& scope, const FunctionPortListSyntax } auto declarator = portSyntax->declarator; - auto arg = comp.emplace( - declarator->name.valueText(), declarator->name.location(), direction, defaultLifetime); + auto arg = comp.emplace(declarator->name.valueText(), + declarator->name.location(), direction, + defaultLifetime); if (portSyntax->constKeyword) { ASSERT(direction == ArgumentDirection::Ref); @@ -823,8 +827,9 @@ MethodPrototypeSymbol& MethodPrototypeSymbol::fromSyntax(const Scope& scope, if (nameToken.valueText() == "new") flags |= MethodFlags::Constructor; - auto result = comp.emplace( - comp, nameToken.valueText(), nameToken.location(), subroutineKind, visibility, flags); + auto result = comp.emplace(comp, nameToken.valueText(), + nameToken.location(), subroutineKind, + visibility, flags); result->setSyntax(syntax); result->setAttributes(scope, syntax.attributes); @@ -859,8 +864,9 @@ MethodPrototypeSymbol& MethodPrototypeSymbol::createForModport(const Scope& scop auto& comp = scope.getCompilation(); auto flags = isExport ? MethodFlags::ModportExport : MethodFlags::ModportImport; auto name = nameToken.valueText(); - auto result = comp.emplace( - comp, name, nameToken.location(), SubroutineKind::Function, Visibility::Public, flags); + auto result = comp.emplace(comp, name, nameToken.location(), + SubroutineKind::Function, Visibility::Public, + flags); result->setSyntax(syntax); // Find the target method we're importing or exporting from the parent interface. @@ -895,8 +901,8 @@ MethodPrototypeSymbol& MethodPrototypeSymbol::fromSyntax(const Scope& scope, bool isExport) { auto& comp = scope.getCompilation(); auto& proto = *syntax.prototype; - auto& result = - createForModport(scope, syntax, syntax.prototype->name->getLastToken(), isExport); + auto& result = createForModport(scope, syntax, syntax.prototype->name->getLastToken(), + isExport); auto target = result.subroutine.value(); if (!target) @@ -944,9 +950,10 @@ MethodPrototypeSymbol& MethodPrototypeSymbol::createExternIfaceMethod(const Scop auto subroutineKind = proto.keyword.kind == TokenKind::TaskKeyword ? SubroutineKind::Task : SubroutineKind::Function; - auto result = comp.emplace( - comp, nameToken.valueText(), nameToken.location(), subroutineKind, Visibility::Public, - MethodFlags::InterfaceExtern); + auto result = comp.emplace(comp, nameToken.valueText(), + nameToken.location(), subroutineKind, + Visibility::Public, + MethodFlags::InterfaceExtern); result->setSyntax(syntax); @@ -1023,8 +1030,8 @@ const SubroutineSymbol* MethodPrototypeSymbol::getSubroutine() const { if (flags.has(MethodFlags::Pure)) { // A pure method should not have a body defined. if (syntax) { - auto& diag = - outerScope.addDiag(diag::BodyForPure, syntax->prototype->name->sourceRange()); + auto& diag = outerScope.addDiag(diag::BodyForPure, + syntax->prototype->name->sourceRange()); diag.addNote(diag::NoteDeclarationHere, location); } else { @@ -1048,8 +1055,8 @@ const SubroutineSymbol* MethodPrototypeSymbol::getSubroutine() const { diag.addNote(diag::NoteDeclarationHere, parentSym.location); } - subroutine = - &SubroutineSymbol::createOutOfBlock(comp, *syntax, *this, nearScope, outerScope, index); + subroutine = &SubroutineSymbol::createOutOfBlock(comp, *syntax, *this, nearScope, outerScope, + index); return *subroutine; } diff --git a/source/symbols/SymbolBuilders.cpp b/source/symbols/SymbolBuilders.cpp index df33d0760..e2614618d 100644 --- a/source/symbols/SymbolBuilders.cpp +++ b/source/symbols/SymbolBuilders.cpp @@ -42,8 +42,8 @@ MethodBuilder::~MethodBuilder() { FormalArgumentSymbol& MethodBuilder::addArg(string_view name, const Type& type, ArgumentDirection direction, optional defaultValue) { - auto arg = - compilation.emplace(name, NL, direction, VariableLifetime::Automatic); + auto arg = compilation.emplace(name, NL, direction, + VariableLifetime::Automatic); arg->setType(type); symbol.addMember(*arg); args.append(arg); @@ -92,8 +92,9 @@ MethodBuilder ClassBuilder::addMethod(string_view name, const Type& retType, Sub } StructBuilder::StructBuilder(const Scope& scope, LookupLocation lookupLocation) : - compilation(scope.getCompilation()), type(*compilation.emplace( - compilation, NL, BindContext(scope, lookupLocation))) { + compilation(scope.getCompilation()), + type(*compilation.emplace(compilation, NL, + BindContext(scope, lookupLocation))) { } void StructBuilder::addField(string_view name, const Type& fieldType, diff --git a/source/symbols/ValueSymbol.cpp b/source/symbols/ValueSymbol.cpp index 0236a0912..02eaaa9d2 100644 --- a/source/symbols/ValueSymbol.cpp +++ b/source/symbols/ValueSymbol.cpp @@ -63,15 +63,15 @@ ValueSymbol::Driver& ValueSymbol::Driver::create(EvalContext& evalContext, Drive expr = &expr->as().operand(); break; case ExpressionKind::ElementSelect: - path.append({ expr }); + path.append({expr}); expr = &expr->as().value(); break; case ExpressionKind::RangeSelect: - path.append({ expr }); + path.append({expr}); expr = &expr->as().value(); break; case ExpressionKind::MemberAccess: - path.append({ expr }); + path.append({expr}); expr = &expr->as().value(); break; default: @@ -86,8 +86,8 @@ ValueSymbol::Driver& ValueSymbol::Driver::create(EvalContext& evalContext, Drive auto& comp = evalContext.compilation; auto mem = comp.allocate(allocSize, alignof(Driver)); - auto result = - new (mem) Driver(kind, containingSymbol, flags, (uint32_t)path.size(), hasOriginalRange); + auto result = new (mem) + Driver(kind, containingSymbol, flags, (uint32_t)path.size(), hasOriginalRange); result->sourceRange = longestStaticPrefix.sourceRange; auto prefixMem = reinterpret_cast(mem + sizeof(Driver)); @@ -155,7 +155,7 @@ bool ValueSymbol::Driver::isInInitialBlock() const { } span ValueSymbol::Driver::getPrefix() const { - return { reinterpret_cast(this + 1), numPrefixEntries }; + return {reinterpret_cast(this + 1), numPrefixEntries}; } SourceRange ValueSymbol::Driver::getOriginalRange() const { @@ -193,8 +193,8 @@ static bool handleOverlap(const Scope& scope, string_view name, const ValueSymbo // First check for more specialized cases here: // 1. If this is a non-uwire net for an input or output port // 2. If this is a variable for an input port - const bool isUnidirectionNetPort = - isNet && (curr.isUnidirectionalPort() || driver.isUnidirectionalPort()); + const bool isUnidirectionNetPort = isNet && (curr.isUnidirectionalPort() || + driver.isUnidirectionalPort()); if ((isUnidirectionNetPort && !isUWire && !isSingleDriverUDNT) || (!isNet && (curr.isInputPort() || driver.isInputPort()))) { @@ -219,8 +219,8 @@ static bool handleOverlap(const Scope& scope, string_view name, const ValueSymbo auto& diag = scope.addDiag(code, assignRange); diag << name; - auto note = - code == diag::OutputPortCoercion ? diag::NoteDrivenHere : diag::NoteDeclarationHere; + auto note = code == diag::OutputPortCoercion ? diag::NoteDrivenHere + : diag::NoteDeclarationHere; diag.addNote(note, portRange); // For variable ports this is an error, for nets it's a warning. @@ -358,7 +358,7 @@ void ValueSymbol::addDriverImpl(const Scope& scope, const Driver& driver) const // initializer expression that should count as a driver as well. auto create = [&](DriverKind driverKind) { return &Driver::create(comp, driverKind, {}, scope.asSymbol(), AssignFlags::None, - { location, location + name.length() }, {}); + {location, location + name.length()}, {}); }; switch (kind) { @@ -394,8 +394,8 @@ void ValueSymbol::addDriverImpl(const Scope& scope, const Driver& driver) const if (isNet) { netType = &as().netType; isUWire = netType->netKind == NetType::UWire; - isSingleDriverUDNT = - netType->netKind == NetType::UserDefined && netType->getResolutionFunction() == nullptr; + isSingleDriverUDNT = netType->netKind == NetType::UserDefined && + netType->getResolutionFunction() == nullptr; } const bool checkOverlap = (VariableSymbol::isKind(kind) && diff --git a/source/symbols/VariableSymbols.cpp b/source/symbols/VariableSymbols.cpp index 6569940c9..12d15eddd 100644 --- a/source/symbols/VariableSymbols.cpp +++ b/source/symbols/VariableSymbols.cpp @@ -172,8 +172,9 @@ void FormalArgumentSymbol::fromSyntax(const Scope& scope, const PortDeclarationS } for (auto declarator : syntax.declarators) { - auto arg = comp.emplace( - declarator->name.valueText(), declarator->name.location(), direction, lifetime); + auto arg = comp.emplace(declarator->name.valueText(), + declarator->name.location(), direction, + lifetime); arg->setDeclaredType(*header.dataType); arg->setFromDeclarator(*declarator); arg->setAttributes(scope, syntax.attributes); @@ -449,8 +450,7 @@ void ClockVarSymbol::fromSyntax(const Scope& scope, const ClockingItemSyntax& sy if (dir != ArgumentDirection::In) { auto& valExpr = ValueExpressionBase::fromSymbol( - context, *sym, false, - { arg->location, arg->location + arg->name.length() }); + context, *sym, false, {arg->location, arg->location + arg->name.length()}); sym->as().addDriver(DriverKind::Continuous, valExpr, scope.asSymbol(), AssignFlags::ClockVar); diff --git a/source/text/CharInfo.cpp b/source/text/CharInfo.cpp index eaa09a231..70bf469d2 100644 --- a/source/text/CharInfo.cpp +++ b/source/text/CharInfo.cpp @@ -36,182 +36,181 @@ struct UnicodeCharSet { bool isPrintableUnicode(uint32_t c) { // https://unicode.org/Public/14.0.0/ucdxml/ static const UnicodeCharRange PrintableRanges[] = { - { 0x0020, 0x007E }, { 0x00A0, 0x00AC }, { 0x00AE, 0x0377 }, { 0x037A, 0x037F }, - { 0x0384, 0x038A }, { 0x038C, 0x038C }, { 0x038E, 0x03A1 }, { 0x03A3, 0x052F }, - { 0x0531, 0x0556 }, { 0x0559, 0x058A }, { 0x058D, 0x058F }, { 0x0591, 0x05C7 }, - { 0x05D0, 0x05EA }, { 0x05EF, 0x05F4 }, { 0x0606, 0x061B }, { 0x061D, 0x06DC }, - { 0x06DE, 0x070D }, { 0x0710, 0x074A }, { 0x074D, 0x07B1 }, { 0x07C0, 0x07FA }, - { 0x07FD, 0x082D }, { 0x0830, 0x083E }, { 0x0840, 0x085B }, { 0x085E, 0x085E }, - { 0x0860, 0x086A }, { 0x0870, 0x088E }, { 0x0898, 0x08E1 }, { 0x08E3, 0x0983 }, - { 0x0985, 0x098C }, { 0x098F, 0x0990 }, { 0x0993, 0x09A8 }, { 0x09AA, 0x09B0 }, - { 0x09B2, 0x09B2 }, { 0x09B6, 0x09B9 }, { 0x09BC, 0x09C4 }, { 0x09C7, 0x09C8 }, - { 0x09CB, 0x09CE }, { 0x09D7, 0x09D7 }, { 0x09DC, 0x09DD }, { 0x09DF, 0x09E3 }, - { 0x09E6, 0x09FE }, { 0x0A01, 0x0A03 }, { 0x0A05, 0x0A0A }, { 0x0A0F, 0x0A10 }, - { 0x0A13, 0x0A28 }, { 0x0A2A, 0x0A30 }, { 0x0A32, 0x0A33 }, { 0x0A35, 0x0A36 }, - { 0x0A38, 0x0A39 }, { 0x0A3C, 0x0A3C }, { 0x0A3E, 0x0A42 }, { 0x0A47, 0x0A48 }, - { 0x0A4B, 0x0A4D }, { 0x0A51, 0x0A51 }, { 0x0A59, 0x0A5C }, { 0x0A5E, 0x0A5E }, - { 0x0A66, 0x0A76 }, { 0x0A81, 0x0A83 }, { 0x0A85, 0x0A8D }, { 0x0A8F, 0x0A91 }, - { 0x0A93, 0x0AA8 }, { 0x0AAA, 0x0AB0 }, { 0x0AB2, 0x0AB3 }, { 0x0AB5, 0x0AB9 }, - { 0x0ABC, 0x0AC5 }, { 0x0AC7, 0x0AC9 }, { 0x0ACB, 0x0ACD }, { 0x0AD0, 0x0AD0 }, - { 0x0AE0, 0x0AE3 }, { 0x0AE6, 0x0AF1 }, { 0x0AF9, 0x0AFF }, { 0x0B01, 0x0B03 }, - { 0x0B05, 0x0B0C }, { 0x0B0F, 0x0B10 }, { 0x0B13, 0x0B28 }, { 0x0B2A, 0x0B30 }, - { 0x0B32, 0x0B33 }, { 0x0B35, 0x0B39 }, { 0x0B3C, 0x0B44 }, { 0x0B47, 0x0B48 }, - { 0x0B4B, 0x0B4D }, { 0x0B55, 0x0B57 }, { 0x0B5C, 0x0B5D }, { 0x0B5F, 0x0B63 }, - { 0x0B66, 0x0B77 }, { 0x0B82, 0x0B83 }, { 0x0B85, 0x0B8A }, { 0x0B8E, 0x0B90 }, - { 0x0B92, 0x0B95 }, { 0x0B99, 0x0B9A }, { 0x0B9C, 0x0B9C }, { 0x0B9E, 0x0B9F }, - { 0x0BA3, 0x0BA4 }, { 0x0BA8, 0x0BAA }, { 0x0BAE, 0x0BB9 }, { 0x0BBE, 0x0BC2 }, - { 0x0BC6, 0x0BC8 }, { 0x0BCA, 0x0BCD }, { 0x0BD0, 0x0BD0 }, { 0x0BD7, 0x0BD7 }, - { 0x0BE6, 0x0BFA }, { 0x0C00, 0x0C0C }, { 0x0C0E, 0x0C10 }, { 0x0C12, 0x0C28 }, - { 0x0C2A, 0x0C39 }, { 0x0C3C, 0x0C44 }, { 0x0C46, 0x0C48 }, { 0x0C4A, 0x0C4D }, - { 0x0C55, 0x0C56 }, { 0x0C58, 0x0C5A }, { 0x0C5D, 0x0C5D }, { 0x0C60, 0x0C63 }, - { 0x0C66, 0x0C6F }, { 0x0C77, 0x0C8C }, { 0x0C8E, 0x0C90 }, { 0x0C92, 0x0CA8 }, - { 0x0CAA, 0x0CB3 }, { 0x0CB5, 0x0CB9 }, { 0x0CBC, 0x0CC4 }, { 0x0CC6, 0x0CC8 }, - { 0x0CCA, 0x0CCD }, { 0x0CD5, 0x0CD6 }, { 0x0CDD, 0x0CDE }, { 0x0CE0, 0x0CE3 }, - { 0x0CE6, 0x0CEF }, { 0x0CF1, 0x0CF2 }, { 0x0D00, 0x0D0C }, { 0x0D0E, 0x0D10 }, - { 0x0D12, 0x0D44 }, { 0x0D46, 0x0D48 }, { 0x0D4A, 0x0D4F }, { 0x0D54, 0x0D63 }, - { 0x0D66, 0x0D7F }, { 0x0D81, 0x0D83 }, { 0x0D85, 0x0D96 }, { 0x0D9A, 0x0DB1 }, - { 0x0DB3, 0x0DBB }, { 0x0DBD, 0x0DBD }, { 0x0DC0, 0x0DC6 }, { 0x0DCA, 0x0DCA }, - { 0x0DCF, 0x0DD4 }, { 0x0DD6, 0x0DD6 }, { 0x0DD8, 0x0DDF }, { 0x0DE6, 0x0DEF }, - { 0x0DF2, 0x0DF4 }, { 0x0E01, 0x0E3A }, { 0x0E3F, 0x0E5B }, { 0x0E81, 0x0E82 }, - { 0x0E84, 0x0E84 }, { 0x0E86, 0x0E8A }, { 0x0E8C, 0x0EA3 }, { 0x0EA5, 0x0EA5 }, - { 0x0EA7, 0x0EBD }, { 0x0EC0, 0x0EC4 }, { 0x0EC6, 0x0EC6 }, { 0x0EC8, 0x0ECD }, - { 0x0ED0, 0x0ED9 }, { 0x0EDC, 0x0EDF }, { 0x0F00, 0x0F47 }, { 0x0F49, 0x0F6C }, - { 0x0F71, 0x0F97 }, { 0x0F99, 0x0FBC }, { 0x0FBE, 0x0FCC }, { 0x0FCE, 0x0FDA }, - { 0x1000, 0x10C5 }, { 0x10C7, 0x10C7 }, { 0x10CD, 0x10CD }, { 0x10D0, 0x1248 }, - { 0x124A, 0x124D }, { 0x1250, 0x1256 }, { 0x1258, 0x1258 }, { 0x125A, 0x125D }, - { 0x1260, 0x1288 }, { 0x128A, 0x128D }, { 0x1290, 0x12B0 }, { 0x12B2, 0x12B5 }, - { 0x12B8, 0x12BE }, { 0x12C0, 0x12C0 }, { 0x12C2, 0x12C5 }, { 0x12C8, 0x12D6 }, - { 0x12D8, 0x1310 }, { 0x1312, 0x1315 }, { 0x1318, 0x135A }, { 0x135D, 0x137C }, - { 0x1380, 0x1399 }, { 0x13A0, 0x13F5 }, { 0x13F8, 0x13FD }, { 0x1400, 0x169C }, - { 0x16A0, 0x16F8 }, { 0x1700, 0x1715 }, { 0x171F, 0x1736 }, { 0x1740, 0x1753 }, - { 0x1760, 0x176C }, { 0x176E, 0x1770 }, { 0x1772, 0x1773 }, { 0x1780, 0x17DD }, - { 0x17E0, 0x17E9 }, { 0x17F0, 0x17F9 }, { 0x1800, 0x180D }, { 0x180F, 0x1819 }, - { 0x1820, 0x1878 }, { 0x1880, 0x18AA }, { 0x18B0, 0x18F5 }, { 0x1900, 0x191E }, - { 0x1920, 0x192B }, { 0x1930, 0x193B }, { 0x1940, 0x1940 }, { 0x1944, 0x196D }, - { 0x1970, 0x1974 }, { 0x1980, 0x19AB }, { 0x19B0, 0x19C9 }, { 0x19D0, 0x19DA }, - { 0x19DE, 0x1A1B }, { 0x1A1E, 0x1A5E }, { 0x1A60, 0x1A7C }, { 0x1A7F, 0x1A89 }, - { 0x1A90, 0x1A99 }, { 0x1AA0, 0x1AAD }, { 0x1AB0, 0x1ACE }, { 0x1B00, 0x1B4C }, - { 0x1B50, 0x1B7E }, { 0x1B80, 0x1BF3 }, { 0x1BFC, 0x1C37 }, { 0x1C3B, 0x1C49 }, - { 0x1C4D, 0x1C88 }, { 0x1C90, 0x1CBA }, { 0x1CBD, 0x1CC7 }, { 0x1CD0, 0x1CFA }, - { 0x1D00, 0x1F15 }, { 0x1F18, 0x1F1D }, { 0x1F20, 0x1F45 }, { 0x1F48, 0x1F4D }, - { 0x1F50, 0x1F57 }, { 0x1F59, 0x1F59 }, { 0x1F5B, 0x1F5B }, { 0x1F5D, 0x1F5D }, - { 0x1F5F, 0x1F7D }, { 0x1F80, 0x1FB4 }, { 0x1FB6, 0x1FC4 }, { 0x1FC6, 0x1FD3 }, - { 0x1FD6, 0x1FDB }, { 0x1FDD, 0x1FEF }, { 0x1FF2, 0x1FF4 }, { 0x1FF6, 0x1FFE }, - { 0x2000, 0x200A }, { 0x2010, 0x2027 }, { 0x202F, 0x205F }, { 0x2070, 0x2071 }, - { 0x2074, 0x208E }, { 0x2090, 0x209C }, { 0x20A0, 0x20C0 }, { 0x20D0, 0x20F0 }, - { 0x2100, 0x218B }, { 0x2190, 0x2426 }, { 0x2440, 0x244A }, { 0x2460, 0x2B73 }, - { 0x2B76, 0x2B95 }, { 0x2B97, 0x2CF3 }, { 0x2CF9, 0x2D25 }, { 0x2D27, 0x2D27 }, - { 0x2D2D, 0x2D2D }, { 0x2D30, 0x2D67 }, { 0x2D6F, 0x2D70 }, { 0x2D7F, 0x2D96 }, - { 0x2DA0, 0x2DA6 }, { 0x2DA8, 0x2DAE }, { 0x2DB0, 0x2DB6 }, { 0x2DB8, 0x2DBE }, - { 0x2DC0, 0x2DC6 }, { 0x2DC8, 0x2DCE }, { 0x2DD0, 0x2DD6 }, { 0x2DD8, 0x2DDE }, - { 0x2DE0, 0x2E5D }, { 0x2E80, 0x2E99 }, { 0x2E9B, 0x2EF3 }, { 0x2F00, 0x2FD5 }, - { 0x2FF0, 0x2FFB }, { 0x3000, 0x303F }, { 0x3041, 0x3096 }, { 0x3099, 0x30FF }, - { 0x3105, 0x312F }, { 0x3131, 0x318E }, { 0x3190, 0x31E3 }, { 0x31F0, 0x321E }, - { 0x3220, 0xA48C }, { 0xA490, 0xA4C6 }, { 0xA4D0, 0xA62B }, { 0xA640, 0xA6F7 }, - { 0xA700, 0xA7CA }, { 0xA7D0, 0xA7D1 }, { 0xA7D3, 0xA7D3 }, { 0xA7D5, 0xA7D9 }, - { 0xA7F2, 0xA82C }, { 0xA830, 0xA839 }, { 0xA840, 0xA877 }, { 0xA880, 0xA8C5 }, - { 0xA8CE, 0xA8D9 }, { 0xA8E0, 0xA953 }, { 0xA95F, 0xA97C }, { 0xA980, 0xA9CD }, - { 0xA9CF, 0xA9D9 }, { 0xA9DE, 0xA9FE }, { 0xAA00, 0xAA36 }, { 0xAA40, 0xAA4D }, - { 0xAA50, 0xAA59 }, { 0xAA5C, 0xAAC2 }, { 0xAADB, 0xAAF6 }, { 0xAB01, 0xAB06 }, - { 0xAB09, 0xAB0E }, { 0xAB11, 0xAB16 }, { 0xAB20, 0xAB26 }, { 0xAB28, 0xAB2E }, - { 0xAB30, 0xAB6B }, { 0xAB70, 0xABED }, { 0xABF0, 0xABF9 }, { 0xAC00, 0xD7A3 }, - { 0xD7B0, 0xD7C6 }, { 0xD7CB, 0xD7FB }, { 0xF900, 0xFA6D }, { 0xFA70, 0xFAD9 }, - { 0xFB00, 0xFB06 }, { 0xFB13, 0xFB17 }, { 0xFB1D, 0xFB36 }, { 0xFB38, 0xFB3C }, - { 0xFB3E, 0xFB3E }, { 0xFB40, 0xFB41 }, { 0xFB43, 0xFB44 }, { 0xFB46, 0xFBC2 }, - { 0xFBD3, 0xFD8F }, { 0xFD92, 0xFDC7 }, { 0xFDCF, 0xFDCF }, { 0xFDF0, 0xFE19 }, - { 0xFE20, 0xFE52 }, { 0xFE54, 0xFE66 }, { 0xFE68, 0xFE6B }, { 0xFE70, 0xFE74 }, - { 0xFE76, 0xFEFC }, { 0xFF01, 0xFFBE }, { 0xFFC2, 0xFFC7 }, { 0xFFCA, 0xFFCF }, - { 0xFFD2, 0xFFD7 }, { 0xFFDA, 0xFFDC }, { 0xFFE0, 0xFFE6 }, { 0xFFE8, 0xFFEE }, - { 0xFFFC, 0xFFFD }, { 0x10000, 0x1000B }, { 0x1000D, 0x10026 }, { 0x10028, 0x1003A }, - { 0x1003C, 0x1003D }, { 0x1003F, 0x1004D }, { 0x10050, 0x1005D }, { 0x10080, 0x100FA }, - { 0x10100, 0x10102 }, { 0x10107, 0x10133 }, { 0x10137, 0x1018E }, { 0x10190, 0x1019C }, - { 0x101A0, 0x101A0 }, { 0x101D0, 0x101FD }, { 0x10280, 0x1029C }, { 0x102A0, 0x102D0 }, - { 0x102E0, 0x102FB }, { 0x10300, 0x10323 }, { 0x1032D, 0x1034A }, { 0x10350, 0x1037A }, - { 0x10380, 0x1039D }, { 0x1039F, 0x103C3 }, { 0x103C8, 0x103D5 }, { 0x10400, 0x1049D }, - { 0x104A0, 0x104A9 }, { 0x104B0, 0x104D3 }, { 0x104D8, 0x104FB }, { 0x10500, 0x10527 }, - { 0x10530, 0x10563 }, { 0x1056F, 0x1057A }, { 0x1057C, 0x1058A }, { 0x1058C, 0x10592 }, - { 0x10594, 0x10595 }, { 0x10597, 0x105A1 }, { 0x105A3, 0x105B1 }, { 0x105B3, 0x105B9 }, - { 0x105BB, 0x105BC }, { 0x10600, 0x10736 }, { 0x10740, 0x10755 }, { 0x10760, 0x10767 }, - { 0x10780, 0x10785 }, { 0x10787, 0x107B0 }, { 0x107B2, 0x107BA }, { 0x10800, 0x10805 }, - { 0x10808, 0x10808 }, { 0x1080A, 0x10835 }, { 0x10837, 0x10838 }, { 0x1083C, 0x1083C }, - { 0x1083F, 0x10855 }, { 0x10857, 0x1089E }, { 0x108A7, 0x108AF }, { 0x108E0, 0x108F2 }, - { 0x108F4, 0x108F5 }, { 0x108FB, 0x1091B }, { 0x1091F, 0x10939 }, { 0x1093F, 0x1093F }, - { 0x10980, 0x109B7 }, { 0x109BC, 0x109CF }, { 0x109D2, 0x10A03 }, { 0x10A05, 0x10A06 }, - { 0x10A0C, 0x10A13 }, { 0x10A15, 0x10A17 }, { 0x10A19, 0x10A35 }, { 0x10A38, 0x10A3A }, - { 0x10A3F, 0x10A48 }, { 0x10A50, 0x10A58 }, { 0x10A60, 0x10A9F }, { 0x10AC0, 0x10AE6 }, - { 0x10AEB, 0x10AF6 }, { 0x10B00, 0x10B35 }, { 0x10B39, 0x10B55 }, { 0x10B58, 0x10B72 }, - { 0x10B78, 0x10B91 }, { 0x10B99, 0x10B9C }, { 0x10BA9, 0x10BAF }, { 0x10C00, 0x10C48 }, - { 0x10C80, 0x10CB2 }, { 0x10CC0, 0x10CF2 }, { 0x10CFA, 0x10D27 }, { 0x10D30, 0x10D39 }, - { 0x10E60, 0x10E7E }, { 0x10E80, 0x10EA9 }, { 0x10EAB, 0x10EAD }, { 0x10EB0, 0x10EB1 }, - { 0x10F00, 0x10F27 }, { 0x10F30, 0x10F59 }, { 0x10F70, 0x10F89 }, { 0x10FB0, 0x10FCB }, - { 0x10FE0, 0x10FF6 }, { 0x11000, 0x1104D }, { 0x11052, 0x11075 }, { 0x1107F, 0x110BC }, - { 0x110BE, 0x110C2 }, { 0x110D0, 0x110E8 }, { 0x110F0, 0x110F9 }, { 0x11100, 0x11134 }, - { 0x11136, 0x11147 }, { 0x11150, 0x11176 }, { 0x11180, 0x111DF }, { 0x111E1, 0x111F4 }, - { 0x11200, 0x11211 }, { 0x11213, 0x1123E }, { 0x11280, 0x11286 }, { 0x11288, 0x11288 }, - { 0x1128A, 0x1128D }, { 0x1128F, 0x1129D }, { 0x1129F, 0x112A9 }, { 0x112B0, 0x112EA }, - { 0x112F0, 0x112F9 }, { 0x11300, 0x11303 }, { 0x11305, 0x1130C }, { 0x1130F, 0x11310 }, - { 0x11313, 0x11328 }, { 0x1132A, 0x11330 }, { 0x11332, 0x11333 }, { 0x11335, 0x11339 }, - { 0x1133B, 0x11344 }, { 0x11347, 0x11348 }, { 0x1134B, 0x1134D }, { 0x11350, 0x11350 }, - { 0x11357, 0x11357 }, { 0x1135D, 0x11363 }, { 0x11366, 0x1136C }, { 0x11370, 0x11374 }, - { 0x11400, 0x1145B }, { 0x1145D, 0x11461 }, { 0x11480, 0x114C7 }, { 0x114D0, 0x114D9 }, - { 0x11580, 0x115B5 }, { 0x115B8, 0x115DD }, { 0x11600, 0x11644 }, { 0x11650, 0x11659 }, - { 0x11660, 0x1166C }, { 0x11680, 0x116B9 }, { 0x116C0, 0x116C9 }, { 0x11700, 0x1171A }, - { 0x1171D, 0x1172B }, { 0x11730, 0x11746 }, { 0x11800, 0x1183B }, { 0x118A0, 0x118F2 }, - { 0x118FF, 0x11906 }, { 0x11909, 0x11909 }, { 0x1190C, 0x11913 }, { 0x11915, 0x11916 }, - { 0x11918, 0x11935 }, { 0x11937, 0x11938 }, { 0x1193B, 0x11946 }, { 0x11950, 0x11959 }, - { 0x119A0, 0x119A7 }, { 0x119AA, 0x119D7 }, { 0x119DA, 0x119E4 }, { 0x11A00, 0x11A47 }, - { 0x11A50, 0x11AA2 }, { 0x11AB0, 0x11AF8 }, { 0x11C00, 0x11C08 }, { 0x11C0A, 0x11C36 }, - { 0x11C38, 0x11C45 }, { 0x11C50, 0x11C6C }, { 0x11C70, 0x11C8F }, { 0x11C92, 0x11CA7 }, - { 0x11CA9, 0x11CB6 }, { 0x11D00, 0x11D06 }, { 0x11D08, 0x11D09 }, { 0x11D0B, 0x11D36 }, - { 0x11D3A, 0x11D3A }, { 0x11D3C, 0x11D3D }, { 0x11D3F, 0x11D47 }, { 0x11D50, 0x11D59 }, - { 0x11D60, 0x11D65 }, { 0x11D67, 0x11D68 }, { 0x11D6A, 0x11D8E }, { 0x11D90, 0x11D91 }, - { 0x11D93, 0x11D98 }, { 0x11DA0, 0x11DA9 }, { 0x11EE0, 0x11EF8 }, { 0x11FB0, 0x11FB0 }, - { 0x11FC0, 0x11FF1 }, { 0x11FFF, 0x12399 }, { 0x12400, 0x1246E }, { 0x12470, 0x12474 }, - { 0x12480, 0x12543 }, { 0x12F90, 0x12FF2 }, { 0x13000, 0x1342E }, { 0x14400, 0x14646 }, - { 0x16800, 0x16A38 }, { 0x16A40, 0x16A5E }, { 0x16A60, 0x16A69 }, { 0x16A6E, 0x16ABE }, - { 0x16AC0, 0x16AC9 }, { 0x16AD0, 0x16AED }, { 0x16AF0, 0x16AF5 }, { 0x16B00, 0x16B45 }, - { 0x16B50, 0x16B59 }, { 0x16B5B, 0x16B61 }, { 0x16B63, 0x16B77 }, { 0x16B7D, 0x16B8F }, - { 0x16E40, 0x16E9A }, { 0x16F00, 0x16F4A }, { 0x16F4F, 0x16F87 }, { 0x16F8F, 0x16F9F }, - { 0x16FE0, 0x16FE4 }, { 0x16FF0, 0x16FF1 }, { 0x17000, 0x187F7 }, { 0x18800, 0x18CD5 }, - { 0x18D00, 0x18D08 }, { 0x1AFF0, 0x1AFF3 }, { 0x1AFF5, 0x1AFFB }, { 0x1AFFD, 0x1AFFE }, - { 0x1B000, 0x1B122 }, { 0x1B150, 0x1B152 }, { 0x1B164, 0x1B167 }, { 0x1B170, 0x1B2FB }, - { 0x1BC00, 0x1BC6A }, { 0x1BC70, 0x1BC7C }, { 0x1BC80, 0x1BC88 }, { 0x1BC90, 0x1BC99 }, - { 0x1BC9C, 0x1BC9F }, { 0x1CF00, 0x1CF2D }, { 0x1CF30, 0x1CF46 }, { 0x1CF50, 0x1CFC3 }, - { 0x1D000, 0x1D0F5 }, { 0x1D100, 0x1D126 }, { 0x1D129, 0x1D172 }, { 0x1D17B, 0x1D1EA }, - { 0x1D200, 0x1D245 }, { 0x1D2E0, 0x1D2F3 }, { 0x1D300, 0x1D356 }, { 0x1D360, 0x1D378 }, - { 0x1D400, 0x1D454 }, { 0x1D456, 0x1D49C }, { 0x1D49E, 0x1D49F }, { 0x1D4A2, 0x1D4A2 }, - { 0x1D4A5, 0x1D4A6 }, { 0x1D4A9, 0x1D4AC }, { 0x1D4AE, 0x1D4B9 }, { 0x1D4BB, 0x1D4BB }, - { 0x1D4BD, 0x1D4C3 }, { 0x1D4C5, 0x1D505 }, { 0x1D507, 0x1D50A }, { 0x1D50D, 0x1D514 }, - { 0x1D516, 0x1D51C }, { 0x1D51E, 0x1D539 }, { 0x1D53B, 0x1D53E }, { 0x1D540, 0x1D544 }, - { 0x1D546, 0x1D546 }, { 0x1D54A, 0x1D550 }, { 0x1D552, 0x1D6A5 }, { 0x1D6A8, 0x1D7CB }, - { 0x1D7CE, 0x1DA8B }, { 0x1DA9B, 0x1DA9F }, { 0x1DAA1, 0x1DAAF }, { 0x1DF00, 0x1DF1E }, - { 0x1E000, 0x1E006 }, { 0x1E008, 0x1E018 }, { 0x1E01B, 0x1E021 }, { 0x1E023, 0x1E024 }, - { 0x1E026, 0x1E02A }, { 0x1E100, 0x1E12C }, { 0x1E130, 0x1E13D }, { 0x1E140, 0x1E149 }, - { 0x1E14E, 0x1E14F }, { 0x1E290, 0x1E2AE }, { 0x1E2C0, 0x1E2F9 }, { 0x1E2FF, 0x1E2FF }, - { 0x1E7E0, 0x1E7E6 }, { 0x1E7E8, 0x1E7EB }, { 0x1E7ED, 0x1E7EE }, { 0x1E7F0, 0x1E7FE }, - { 0x1E800, 0x1E8C4 }, { 0x1E8C7, 0x1E8D6 }, { 0x1E900, 0x1E94B }, { 0x1E950, 0x1E959 }, - { 0x1E95E, 0x1E95F }, { 0x1EC71, 0x1ECB4 }, { 0x1ED01, 0x1ED3D }, { 0x1EE00, 0x1EE03 }, - { 0x1EE05, 0x1EE1F }, { 0x1EE21, 0x1EE22 }, { 0x1EE24, 0x1EE24 }, { 0x1EE27, 0x1EE27 }, - { 0x1EE29, 0x1EE32 }, { 0x1EE34, 0x1EE37 }, { 0x1EE39, 0x1EE39 }, { 0x1EE3B, 0x1EE3B }, - { 0x1EE42, 0x1EE42 }, { 0x1EE47, 0x1EE47 }, { 0x1EE49, 0x1EE49 }, { 0x1EE4B, 0x1EE4B }, - { 0x1EE4D, 0x1EE4F }, { 0x1EE51, 0x1EE52 }, { 0x1EE54, 0x1EE54 }, { 0x1EE57, 0x1EE57 }, - { 0x1EE59, 0x1EE59 }, { 0x1EE5B, 0x1EE5B }, { 0x1EE5D, 0x1EE5D }, { 0x1EE5F, 0x1EE5F }, - { 0x1EE61, 0x1EE62 }, { 0x1EE64, 0x1EE64 }, { 0x1EE67, 0x1EE6A }, { 0x1EE6C, 0x1EE72 }, - { 0x1EE74, 0x1EE77 }, { 0x1EE79, 0x1EE7C }, { 0x1EE7E, 0x1EE7E }, { 0x1EE80, 0x1EE89 }, - { 0x1EE8B, 0x1EE9B }, { 0x1EEA1, 0x1EEA3 }, { 0x1EEA5, 0x1EEA9 }, { 0x1EEAB, 0x1EEBB }, - { 0x1EEF0, 0x1EEF1 }, { 0x1F000, 0x1F02B }, { 0x1F030, 0x1F093 }, { 0x1F0A0, 0x1F0AE }, - { 0x1F0B1, 0x1F0BF }, { 0x1F0C1, 0x1F0CF }, { 0x1F0D1, 0x1F0F5 }, { 0x1F100, 0x1F1AD }, - { 0x1F1E6, 0x1F202 }, { 0x1F210, 0x1F23B }, { 0x1F240, 0x1F248 }, { 0x1F250, 0x1F251 }, - { 0x1F260, 0x1F265 }, { 0x1F300, 0x1F6D7 }, { 0x1F6DD, 0x1F6EC }, { 0x1F6F0, 0x1F6FC }, - { 0x1F700, 0x1F773 }, { 0x1F780, 0x1F7D8 }, { 0x1F7E0, 0x1F7EB }, { 0x1F7F0, 0x1F7F0 }, - { 0x1F800, 0x1F80B }, { 0x1F810, 0x1F847 }, { 0x1F850, 0x1F859 }, { 0x1F860, 0x1F887 }, - { 0x1F890, 0x1F8AD }, { 0x1F8B0, 0x1F8B1 }, { 0x1F900, 0x1FA53 }, { 0x1FA60, 0x1FA6D }, - { 0x1FA70, 0x1FA74 }, { 0x1FA78, 0x1FA7C }, { 0x1FA80, 0x1FA86 }, { 0x1FA90, 0x1FAAC }, - { 0x1FAB0, 0x1FABA }, { 0x1FAC0, 0x1FAC5 }, { 0x1FAD0, 0x1FAD9 }, { 0x1FAE0, 0x1FAE7 }, - { 0x1FAF0, 0x1FAF6 }, { 0x1FB00, 0x1FB92 }, { 0x1FB94, 0x1FBCA }, { 0x1FBF0, 0x1FBF9 }, - { 0x20000, 0x2A6DF }, { 0x2A700, 0x2B738 }, { 0x2B740, 0x2B81D }, { 0x2B820, 0x2CEA1 }, - { 0x2CEB0, 0x2EBE0 }, { 0x2F800, 0x2FA1D }, { 0x30000, 0x3134A }, { 0xE0100, 0xE01EF } - }; + {0x0020, 0x007E}, {0x00A0, 0x00AC}, {0x00AE, 0x0377}, {0x037A, 0x037F}, + {0x0384, 0x038A}, {0x038C, 0x038C}, {0x038E, 0x03A1}, {0x03A3, 0x052F}, + {0x0531, 0x0556}, {0x0559, 0x058A}, {0x058D, 0x058F}, {0x0591, 0x05C7}, + {0x05D0, 0x05EA}, {0x05EF, 0x05F4}, {0x0606, 0x061B}, {0x061D, 0x06DC}, + {0x06DE, 0x070D}, {0x0710, 0x074A}, {0x074D, 0x07B1}, {0x07C0, 0x07FA}, + {0x07FD, 0x082D}, {0x0830, 0x083E}, {0x0840, 0x085B}, {0x085E, 0x085E}, + {0x0860, 0x086A}, {0x0870, 0x088E}, {0x0898, 0x08E1}, {0x08E3, 0x0983}, + {0x0985, 0x098C}, {0x098F, 0x0990}, {0x0993, 0x09A8}, {0x09AA, 0x09B0}, + {0x09B2, 0x09B2}, {0x09B6, 0x09B9}, {0x09BC, 0x09C4}, {0x09C7, 0x09C8}, + {0x09CB, 0x09CE}, {0x09D7, 0x09D7}, {0x09DC, 0x09DD}, {0x09DF, 0x09E3}, + {0x09E6, 0x09FE}, {0x0A01, 0x0A03}, {0x0A05, 0x0A0A}, {0x0A0F, 0x0A10}, + {0x0A13, 0x0A28}, {0x0A2A, 0x0A30}, {0x0A32, 0x0A33}, {0x0A35, 0x0A36}, + {0x0A38, 0x0A39}, {0x0A3C, 0x0A3C}, {0x0A3E, 0x0A42}, {0x0A47, 0x0A48}, + {0x0A4B, 0x0A4D}, {0x0A51, 0x0A51}, {0x0A59, 0x0A5C}, {0x0A5E, 0x0A5E}, + {0x0A66, 0x0A76}, {0x0A81, 0x0A83}, {0x0A85, 0x0A8D}, {0x0A8F, 0x0A91}, + {0x0A93, 0x0AA8}, {0x0AAA, 0x0AB0}, {0x0AB2, 0x0AB3}, {0x0AB5, 0x0AB9}, + {0x0ABC, 0x0AC5}, {0x0AC7, 0x0AC9}, {0x0ACB, 0x0ACD}, {0x0AD0, 0x0AD0}, + {0x0AE0, 0x0AE3}, {0x0AE6, 0x0AF1}, {0x0AF9, 0x0AFF}, {0x0B01, 0x0B03}, + {0x0B05, 0x0B0C}, {0x0B0F, 0x0B10}, {0x0B13, 0x0B28}, {0x0B2A, 0x0B30}, + {0x0B32, 0x0B33}, {0x0B35, 0x0B39}, {0x0B3C, 0x0B44}, {0x0B47, 0x0B48}, + {0x0B4B, 0x0B4D}, {0x0B55, 0x0B57}, {0x0B5C, 0x0B5D}, {0x0B5F, 0x0B63}, + {0x0B66, 0x0B77}, {0x0B82, 0x0B83}, {0x0B85, 0x0B8A}, {0x0B8E, 0x0B90}, + {0x0B92, 0x0B95}, {0x0B99, 0x0B9A}, {0x0B9C, 0x0B9C}, {0x0B9E, 0x0B9F}, + {0x0BA3, 0x0BA4}, {0x0BA8, 0x0BAA}, {0x0BAE, 0x0BB9}, {0x0BBE, 0x0BC2}, + {0x0BC6, 0x0BC8}, {0x0BCA, 0x0BCD}, {0x0BD0, 0x0BD0}, {0x0BD7, 0x0BD7}, + {0x0BE6, 0x0BFA}, {0x0C00, 0x0C0C}, {0x0C0E, 0x0C10}, {0x0C12, 0x0C28}, + {0x0C2A, 0x0C39}, {0x0C3C, 0x0C44}, {0x0C46, 0x0C48}, {0x0C4A, 0x0C4D}, + {0x0C55, 0x0C56}, {0x0C58, 0x0C5A}, {0x0C5D, 0x0C5D}, {0x0C60, 0x0C63}, + {0x0C66, 0x0C6F}, {0x0C77, 0x0C8C}, {0x0C8E, 0x0C90}, {0x0C92, 0x0CA8}, + {0x0CAA, 0x0CB3}, {0x0CB5, 0x0CB9}, {0x0CBC, 0x0CC4}, {0x0CC6, 0x0CC8}, + {0x0CCA, 0x0CCD}, {0x0CD5, 0x0CD6}, {0x0CDD, 0x0CDE}, {0x0CE0, 0x0CE3}, + {0x0CE6, 0x0CEF}, {0x0CF1, 0x0CF2}, {0x0D00, 0x0D0C}, {0x0D0E, 0x0D10}, + {0x0D12, 0x0D44}, {0x0D46, 0x0D48}, {0x0D4A, 0x0D4F}, {0x0D54, 0x0D63}, + {0x0D66, 0x0D7F}, {0x0D81, 0x0D83}, {0x0D85, 0x0D96}, {0x0D9A, 0x0DB1}, + {0x0DB3, 0x0DBB}, {0x0DBD, 0x0DBD}, {0x0DC0, 0x0DC6}, {0x0DCA, 0x0DCA}, + {0x0DCF, 0x0DD4}, {0x0DD6, 0x0DD6}, {0x0DD8, 0x0DDF}, {0x0DE6, 0x0DEF}, + {0x0DF2, 0x0DF4}, {0x0E01, 0x0E3A}, {0x0E3F, 0x0E5B}, {0x0E81, 0x0E82}, + {0x0E84, 0x0E84}, {0x0E86, 0x0E8A}, {0x0E8C, 0x0EA3}, {0x0EA5, 0x0EA5}, + {0x0EA7, 0x0EBD}, {0x0EC0, 0x0EC4}, {0x0EC6, 0x0EC6}, {0x0EC8, 0x0ECD}, + {0x0ED0, 0x0ED9}, {0x0EDC, 0x0EDF}, {0x0F00, 0x0F47}, {0x0F49, 0x0F6C}, + {0x0F71, 0x0F97}, {0x0F99, 0x0FBC}, {0x0FBE, 0x0FCC}, {0x0FCE, 0x0FDA}, + {0x1000, 0x10C5}, {0x10C7, 0x10C7}, {0x10CD, 0x10CD}, {0x10D0, 0x1248}, + {0x124A, 0x124D}, {0x1250, 0x1256}, {0x1258, 0x1258}, {0x125A, 0x125D}, + {0x1260, 0x1288}, {0x128A, 0x128D}, {0x1290, 0x12B0}, {0x12B2, 0x12B5}, + {0x12B8, 0x12BE}, {0x12C0, 0x12C0}, {0x12C2, 0x12C5}, {0x12C8, 0x12D6}, + {0x12D8, 0x1310}, {0x1312, 0x1315}, {0x1318, 0x135A}, {0x135D, 0x137C}, + {0x1380, 0x1399}, {0x13A0, 0x13F5}, {0x13F8, 0x13FD}, {0x1400, 0x169C}, + {0x16A0, 0x16F8}, {0x1700, 0x1715}, {0x171F, 0x1736}, {0x1740, 0x1753}, + {0x1760, 0x176C}, {0x176E, 0x1770}, {0x1772, 0x1773}, {0x1780, 0x17DD}, + {0x17E0, 0x17E9}, {0x17F0, 0x17F9}, {0x1800, 0x180D}, {0x180F, 0x1819}, + {0x1820, 0x1878}, {0x1880, 0x18AA}, {0x18B0, 0x18F5}, {0x1900, 0x191E}, + {0x1920, 0x192B}, {0x1930, 0x193B}, {0x1940, 0x1940}, {0x1944, 0x196D}, + {0x1970, 0x1974}, {0x1980, 0x19AB}, {0x19B0, 0x19C9}, {0x19D0, 0x19DA}, + {0x19DE, 0x1A1B}, {0x1A1E, 0x1A5E}, {0x1A60, 0x1A7C}, {0x1A7F, 0x1A89}, + {0x1A90, 0x1A99}, {0x1AA0, 0x1AAD}, {0x1AB0, 0x1ACE}, {0x1B00, 0x1B4C}, + {0x1B50, 0x1B7E}, {0x1B80, 0x1BF3}, {0x1BFC, 0x1C37}, {0x1C3B, 0x1C49}, + {0x1C4D, 0x1C88}, {0x1C90, 0x1CBA}, {0x1CBD, 0x1CC7}, {0x1CD0, 0x1CFA}, + {0x1D00, 0x1F15}, {0x1F18, 0x1F1D}, {0x1F20, 0x1F45}, {0x1F48, 0x1F4D}, + {0x1F50, 0x1F57}, {0x1F59, 0x1F59}, {0x1F5B, 0x1F5B}, {0x1F5D, 0x1F5D}, + {0x1F5F, 0x1F7D}, {0x1F80, 0x1FB4}, {0x1FB6, 0x1FC4}, {0x1FC6, 0x1FD3}, + {0x1FD6, 0x1FDB}, {0x1FDD, 0x1FEF}, {0x1FF2, 0x1FF4}, {0x1FF6, 0x1FFE}, + {0x2000, 0x200A}, {0x2010, 0x2027}, {0x202F, 0x205F}, {0x2070, 0x2071}, + {0x2074, 0x208E}, {0x2090, 0x209C}, {0x20A0, 0x20C0}, {0x20D0, 0x20F0}, + {0x2100, 0x218B}, {0x2190, 0x2426}, {0x2440, 0x244A}, {0x2460, 0x2B73}, + {0x2B76, 0x2B95}, {0x2B97, 0x2CF3}, {0x2CF9, 0x2D25}, {0x2D27, 0x2D27}, + {0x2D2D, 0x2D2D}, {0x2D30, 0x2D67}, {0x2D6F, 0x2D70}, {0x2D7F, 0x2D96}, + {0x2DA0, 0x2DA6}, {0x2DA8, 0x2DAE}, {0x2DB0, 0x2DB6}, {0x2DB8, 0x2DBE}, + {0x2DC0, 0x2DC6}, {0x2DC8, 0x2DCE}, {0x2DD0, 0x2DD6}, {0x2DD8, 0x2DDE}, + {0x2DE0, 0x2E5D}, {0x2E80, 0x2E99}, {0x2E9B, 0x2EF3}, {0x2F00, 0x2FD5}, + {0x2FF0, 0x2FFB}, {0x3000, 0x303F}, {0x3041, 0x3096}, {0x3099, 0x30FF}, + {0x3105, 0x312F}, {0x3131, 0x318E}, {0x3190, 0x31E3}, {0x31F0, 0x321E}, + {0x3220, 0xA48C}, {0xA490, 0xA4C6}, {0xA4D0, 0xA62B}, {0xA640, 0xA6F7}, + {0xA700, 0xA7CA}, {0xA7D0, 0xA7D1}, {0xA7D3, 0xA7D3}, {0xA7D5, 0xA7D9}, + {0xA7F2, 0xA82C}, {0xA830, 0xA839}, {0xA840, 0xA877}, {0xA880, 0xA8C5}, + {0xA8CE, 0xA8D9}, {0xA8E0, 0xA953}, {0xA95F, 0xA97C}, {0xA980, 0xA9CD}, + {0xA9CF, 0xA9D9}, {0xA9DE, 0xA9FE}, {0xAA00, 0xAA36}, {0xAA40, 0xAA4D}, + {0xAA50, 0xAA59}, {0xAA5C, 0xAAC2}, {0xAADB, 0xAAF6}, {0xAB01, 0xAB06}, + {0xAB09, 0xAB0E}, {0xAB11, 0xAB16}, {0xAB20, 0xAB26}, {0xAB28, 0xAB2E}, + {0xAB30, 0xAB6B}, {0xAB70, 0xABED}, {0xABF0, 0xABF9}, {0xAC00, 0xD7A3}, + {0xD7B0, 0xD7C6}, {0xD7CB, 0xD7FB}, {0xF900, 0xFA6D}, {0xFA70, 0xFAD9}, + {0xFB00, 0xFB06}, {0xFB13, 0xFB17}, {0xFB1D, 0xFB36}, {0xFB38, 0xFB3C}, + {0xFB3E, 0xFB3E}, {0xFB40, 0xFB41}, {0xFB43, 0xFB44}, {0xFB46, 0xFBC2}, + {0xFBD3, 0xFD8F}, {0xFD92, 0xFDC7}, {0xFDCF, 0xFDCF}, {0xFDF0, 0xFE19}, + {0xFE20, 0xFE52}, {0xFE54, 0xFE66}, {0xFE68, 0xFE6B}, {0xFE70, 0xFE74}, + {0xFE76, 0xFEFC}, {0xFF01, 0xFFBE}, {0xFFC2, 0xFFC7}, {0xFFCA, 0xFFCF}, + {0xFFD2, 0xFFD7}, {0xFFDA, 0xFFDC}, {0xFFE0, 0xFFE6}, {0xFFE8, 0xFFEE}, + {0xFFFC, 0xFFFD}, {0x10000, 0x1000B}, {0x1000D, 0x10026}, {0x10028, 0x1003A}, + {0x1003C, 0x1003D}, {0x1003F, 0x1004D}, {0x10050, 0x1005D}, {0x10080, 0x100FA}, + {0x10100, 0x10102}, {0x10107, 0x10133}, {0x10137, 0x1018E}, {0x10190, 0x1019C}, + {0x101A0, 0x101A0}, {0x101D0, 0x101FD}, {0x10280, 0x1029C}, {0x102A0, 0x102D0}, + {0x102E0, 0x102FB}, {0x10300, 0x10323}, {0x1032D, 0x1034A}, {0x10350, 0x1037A}, + {0x10380, 0x1039D}, {0x1039F, 0x103C3}, {0x103C8, 0x103D5}, {0x10400, 0x1049D}, + {0x104A0, 0x104A9}, {0x104B0, 0x104D3}, {0x104D8, 0x104FB}, {0x10500, 0x10527}, + {0x10530, 0x10563}, {0x1056F, 0x1057A}, {0x1057C, 0x1058A}, {0x1058C, 0x10592}, + {0x10594, 0x10595}, {0x10597, 0x105A1}, {0x105A3, 0x105B1}, {0x105B3, 0x105B9}, + {0x105BB, 0x105BC}, {0x10600, 0x10736}, {0x10740, 0x10755}, {0x10760, 0x10767}, + {0x10780, 0x10785}, {0x10787, 0x107B0}, {0x107B2, 0x107BA}, {0x10800, 0x10805}, + {0x10808, 0x10808}, {0x1080A, 0x10835}, {0x10837, 0x10838}, {0x1083C, 0x1083C}, + {0x1083F, 0x10855}, {0x10857, 0x1089E}, {0x108A7, 0x108AF}, {0x108E0, 0x108F2}, + {0x108F4, 0x108F5}, {0x108FB, 0x1091B}, {0x1091F, 0x10939}, {0x1093F, 0x1093F}, + {0x10980, 0x109B7}, {0x109BC, 0x109CF}, {0x109D2, 0x10A03}, {0x10A05, 0x10A06}, + {0x10A0C, 0x10A13}, {0x10A15, 0x10A17}, {0x10A19, 0x10A35}, {0x10A38, 0x10A3A}, + {0x10A3F, 0x10A48}, {0x10A50, 0x10A58}, {0x10A60, 0x10A9F}, {0x10AC0, 0x10AE6}, + {0x10AEB, 0x10AF6}, {0x10B00, 0x10B35}, {0x10B39, 0x10B55}, {0x10B58, 0x10B72}, + {0x10B78, 0x10B91}, {0x10B99, 0x10B9C}, {0x10BA9, 0x10BAF}, {0x10C00, 0x10C48}, + {0x10C80, 0x10CB2}, {0x10CC0, 0x10CF2}, {0x10CFA, 0x10D27}, {0x10D30, 0x10D39}, + {0x10E60, 0x10E7E}, {0x10E80, 0x10EA9}, {0x10EAB, 0x10EAD}, {0x10EB0, 0x10EB1}, + {0x10F00, 0x10F27}, {0x10F30, 0x10F59}, {0x10F70, 0x10F89}, {0x10FB0, 0x10FCB}, + {0x10FE0, 0x10FF6}, {0x11000, 0x1104D}, {0x11052, 0x11075}, {0x1107F, 0x110BC}, + {0x110BE, 0x110C2}, {0x110D0, 0x110E8}, {0x110F0, 0x110F9}, {0x11100, 0x11134}, + {0x11136, 0x11147}, {0x11150, 0x11176}, {0x11180, 0x111DF}, {0x111E1, 0x111F4}, + {0x11200, 0x11211}, {0x11213, 0x1123E}, {0x11280, 0x11286}, {0x11288, 0x11288}, + {0x1128A, 0x1128D}, {0x1128F, 0x1129D}, {0x1129F, 0x112A9}, {0x112B0, 0x112EA}, + {0x112F0, 0x112F9}, {0x11300, 0x11303}, {0x11305, 0x1130C}, {0x1130F, 0x11310}, + {0x11313, 0x11328}, {0x1132A, 0x11330}, {0x11332, 0x11333}, {0x11335, 0x11339}, + {0x1133B, 0x11344}, {0x11347, 0x11348}, {0x1134B, 0x1134D}, {0x11350, 0x11350}, + {0x11357, 0x11357}, {0x1135D, 0x11363}, {0x11366, 0x1136C}, {0x11370, 0x11374}, + {0x11400, 0x1145B}, {0x1145D, 0x11461}, {0x11480, 0x114C7}, {0x114D0, 0x114D9}, + {0x11580, 0x115B5}, {0x115B8, 0x115DD}, {0x11600, 0x11644}, {0x11650, 0x11659}, + {0x11660, 0x1166C}, {0x11680, 0x116B9}, {0x116C0, 0x116C9}, {0x11700, 0x1171A}, + {0x1171D, 0x1172B}, {0x11730, 0x11746}, {0x11800, 0x1183B}, {0x118A0, 0x118F2}, + {0x118FF, 0x11906}, {0x11909, 0x11909}, {0x1190C, 0x11913}, {0x11915, 0x11916}, + {0x11918, 0x11935}, {0x11937, 0x11938}, {0x1193B, 0x11946}, {0x11950, 0x11959}, + {0x119A0, 0x119A7}, {0x119AA, 0x119D7}, {0x119DA, 0x119E4}, {0x11A00, 0x11A47}, + {0x11A50, 0x11AA2}, {0x11AB0, 0x11AF8}, {0x11C00, 0x11C08}, {0x11C0A, 0x11C36}, + {0x11C38, 0x11C45}, {0x11C50, 0x11C6C}, {0x11C70, 0x11C8F}, {0x11C92, 0x11CA7}, + {0x11CA9, 0x11CB6}, {0x11D00, 0x11D06}, {0x11D08, 0x11D09}, {0x11D0B, 0x11D36}, + {0x11D3A, 0x11D3A}, {0x11D3C, 0x11D3D}, {0x11D3F, 0x11D47}, {0x11D50, 0x11D59}, + {0x11D60, 0x11D65}, {0x11D67, 0x11D68}, {0x11D6A, 0x11D8E}, {0x11D90, 0x11D91}, + {0x11D93, 0x11D98}, {0x11DA0, 0x11DA9}, {0x11EE0, 0x11EF8}, {0x11FB0, 0x11FB0}, + {0x11FC0, 0x11FF1}, {0x11FFF, 0x12399}, {0x12400, 0x1246E}, {0x12470, 0x12474}, + {0x12480, 0x12543}, {0x12F90, 0x12FF2}, {0x13000, 0x1342E}, {0x14400, 0x14646}, + {0x16800, 0x16A38}, {0x16A40, 0x16A5E}, {0x16A60, 0x16A69}, {0x16A6E, 0x16ABE}, + {0x16AC0, 0x16AC9}, {0x16AD0, 0x16AED}, {0x16AF0, 0x16AF5}, {0x16B00, 0x16B45}, + {0x16B50, 0x16B59}, {0x16B5B, 0x16B61}, {0x16B63, 0x16B77}, {0x16B7D, 0x16B8F}, + {0x16E40, 0x16E9A}, {0x16F00, 0x16F4A}, {0x16F4F, 0x16F87}, {0x16F8F, 0x16F9F}, + {0x16FE0, 0x16FE4}, {0x16FF0, 0x16FF1}, {0x17000, 0x187F7}, {0x18800, 0x18CD5}, + {0x18D00, 0x18D08}, {0x1AFF0, 0x1AFF3}, {0x1AFF5, 0x1AFFB}, {0x1AFFD, 0x1AFFE}, + {0x1B000, 0x1B122}, {0x1B150, 0x1B152}, {0x1B164, 0x1B167}, {0x1B170, 0x1B2FB}, + {0x1BC00, 0x1BC6A}, {0x1BC70, 0x1BC7C}, {0x1BC80, 0x1BC88}, {0x1BC90, 0x1BC99}, + {0x1BC9C, 0x1BC9F}, {0x1CF00, 0x1CF2D}, {0x1CF30, 0x1CF46}, {0x1CF50, 0x1CFC3}, + {0x1D000, 0x1D0F5}, {0x1D100, 0x1D126}, {0x1D129, 0x1D172}, {0x1D17B, 0x1D1EA}, + {0x1D200, 0x1D245}, {0x1D2E0, 0x1D2F3}, {0x1D300, 0x1D356}, {0x1D360, 0x1D378}, + {0x1D400, 0x1D454}, {0x1D456, 0x1D49C}, {0x1D49E, 0x1D49F}, {0x1D4A2, 0x1D4A2}, + {0x1D4A5, 0x1D4A6}, {0x1D4A9, 0x1D4AC}, {0x1D4AE, 0x1D4B9}, {0x1D4BB, 0x1D4BB}, + {0x1D4BD, 0x1D4C3}, {0x1D4C5, 0x1D505}, {0x1D507, 0x1D50A}, {0x1D50D, 0x1D514}, + {0x1D516, 0x1D51C}, {0x1D51E, 0x1D539}, {0x1D53B, 0x1D53E}, {0x1D540, 0x1D544}, + {0x1D546, 0x1D546}, {0x1D54A, 0x1D550}, {0x1D552, 0x1D6A5}, {0x1D6A8, 0x1D7CB}, + {0x1D7CE, 0x1DA8B}, {0x1DA9B, 0x1DA9F}, {0x1DAA1, 0x1DAAF}, {0x1DF00, 0x1DF1E}, + {0x1E000, 0x1E006}, {0x1E008, 0x1E018}, {0x1E01B, 0x1E021}, {0x1E023, 0x1E024}, + {0x1E026, 0x1E02A}, {0x1E100, 0x1E12C}, {0x1E130, 0x1E13D}, {0x1E140, 0x1E149}, + {0x1E14E, 0x1E14F}, {0x1E290, 0x1E2AE}, {0x1E2C0, 0x1E2F9}, {0x1E2FF, 0x1E2FF}, + {0x1E7E0, 0x1E7E6}, {0x1E7E8, 0x1E7EB}, {0x1E7ED, 0x1E7EE}, {0x1E7F0, 0x1E7FE}, + {0x1E800, 0x1E8C4}, {0x1E8C7, 0x1E8D6}, {0x1E900, 0x1E94B}, {0x1E950, 0x1E959}, + {0x1E95E, 0x1E95F}, {0x1EC71, 0x1ECB4}, {0x1ED01, 0x1ED3D}, {0x1EE00, 0x1EE03}, + {0x1EE05, 0x1EE1F}, {0x1EE21, 0x1EE22}, {0x1EE24, 0x1EE24}, {0x1EE27, 0x1EE27}, + {0x1EE29, 0x1EE32}, {0x1EE34, 0x1EE37}, {0x1EE39, 0x1EE39}, {0x1EE3B, 0x1EE3B}, + {0x1EE42, 0x1EE42}, {0x1EE47, 0x1EE47}, {0x1EE49, 0x1EE49}, {0x1EE4B, 0x1EE4B}, + {0x1EE4D, 0x1EE4F}, {0x1EE51, 0x1EE52}, {0x1EE54, 0x1EE54}, {0x1EE57, 0x1EE57}, + {0x1EE59, 0x1EE59}, {0x1EE5B, 0x1EE5B}, {0x1EE5D, 0x1EE5D}, {0x1EE5F, 0x1EE5F}, + {0x1EE61, 0x1EE62}, {0x1EE64, 0x1EE64}, {0x1EE67, 0x1EE6A}, {0x1EE6C, 0x1EE72}, + {0x1EE74, 0x1EE77}, {0x1EE79, 0x1EE7C}, {0x1EE7E, 0x1EE7E}, {0x1EE80, 0x1EE89}, + {0x1EE8B, 0x1EE9B}, {0x1EEA1, 0x1EEA3}, {0x1EEA5, 0x1EEA9}, {0x1EEAB, 0x1EEBB}, + {0x1EEF0, 0x1EEF1}, {0x1F000, 0x1F02B}, {0x1F030, 0x1F093}, {0x1F0A0, 0x1F0AE}, + {0x1F0B1, 0x1F0BF}, {0x1F0C1, 0x1F0CF}, {0x1F0D1, 0x1F0F5}, {0x1F100, 0x1F1AD}, + {0x1F1E6, 0x1F202}, {0x1F210, 0x1F23B}, {0x1F240, 0x1F248}, {0x1F250, 0x1F251}, + {0x1F260, 0x1F265}, {0x1F300, 0x1F6D7}, {0x1F6DD, 0x1F6EC}, {0x1F6F0, 0x1F6FC}, + {0x1F700, 0x1F773}, {0x1F780, 0x1F7D8}, {0x1F7E0, 0x1F7EB}, {0x1F7F0, 0x1F7F0}, + {0x1F800, 0x1F80B}, {0x1F810, 0x1F847}, {0x1F850, 0x1F859}, {0x1F860, 0x1F887}, + {0x1F890, 0x1F8AD}, {0x1F8B0, 0x1F8B1}, {0x1F900, 0x1FA53}, {0x1FA60, 0x1FA6D}, + {0x1FA70, 0x1FA74}, {0x1FA78, 0x1FA7C}, {0x1FA80, 0x1FA86}, {0x1FA90, 0x1FAAC}, + {0x1FAB0, 0x1FABA}, {0x1FAC0, 0x1FAC5}, {0x1FAD0, 0x1FAD9}, {0x1FAE0, 0x1FAE7}, + {0x1FAF0, 0x1FAF6}, {0x1FB00, 0x1FB92}, {0x1FB94, 0x1FBCA}, {0x1FBF0, 0x1FBF9}, + {0x20000, 0x2A6DF}, {0x2A700, 0x2B738}, {0x2B740, 0x2B81D}, {0x2B820, 0x2CEA1}, + {0x2CEB0, 0x2EBE0}, {0x2F800, 0x2FA1D}, {0x30000, 0x3134A}, {0xE0100, 0xE01EF}}; static const UnicodeCharSet Printables(PrintableRanges); @@ -227,61 +226,61 @@ int charWidthUnicode(uint32_t c) { // defined in "3.6 Combination" of // http://www.unicode.org/versions/Unicode6.2.0/UnicodeStandard-6.2.pdf static const UnicodeCharRange CombiningCharacterRanges[] = { - { 0x0300, 0x036F }, { 0x0483, 0x0489 }, { 0x0591, 0x05BD }, { 0x05BF, 0x05BF }, - { 0x05C1, 0x05C2 }, { 0x05C4, 0x05C5 }, { 0x05C7, 0x05C7 }, { 0x0610, 0x061A }, - { 0x064B, 0x065F }, { 0x0670, 0x0670 }, { 0x06D6, 0x06DC }, { 0x06DF, 0x06E4 }, - { 0x06E7, 0x06E8 }, { 0x06EA, 0x06ED }, { 0x0711, 0x0711 }, { 0x0730, 0x074A }, - { 0x07A6, 0x07B0 }, { 0x07EB, 0x07F3 }, { 0x0816, 0x0819 }, { 0x081B, 0x0823 }, - { 0x0825, 0x0827 }, { 0x0829, 0x082D }, { 0x0859, 0x085B }, { 0x08E4, 0x08FE }, - { 0x0900, 0x0902 }, { 0x093A, 0x093A }, { 0x093C, 0x093C }, { 0x0941, 0x0948 }, - { 0x094D, 0x094D }, { 0x0951, 0x0957 }, { 0x0962, 0x0963 }, { 0x0981, 0x0981 }, - { 0x09BC, 0x09BC }, { 0x09C1, 0x09C4 }, { 0x09CD, 0x09CD }, { 0x09E2, 0x09E3 }, - { 0x0A01, 0x0A02 }, { 0x0A3C, 0x0A3C }, { 0x0A41, 0x0A42 }, { 0x0A47, 0x0A48 }, - { 0x0A4B, 0x0A4D }, { 0x0A51, 0x0A51 }, { 0x0A70, 0x0A71 }, { 0x0A75, 0x0A75 }, - { 0x0A81, 0x0A82 }, { 0x0ABC, 0x0ABC }, { 0x0AC1, 0x0AC5 }, { 0x0AC7, 0x0AC8 }, - { 0x0ACD, 0x0ACD }, { 0x0AE2, 0x0AE3 }, { 0x0B01, 0x0B01 }, { 0x0B3C, 0x0B3C }, - { 0x0B3F, 0x0B3F }, { 0x0B41, 0x0B44 }, { 0x0B4D, 0x0B4D }, { 0x0B56, 0x0B56 }, - { 0x0B62, 0x0B63 }, { 0x0B82, 0x0B82 }, { 0x0BC0, 0x0BC0 }, { 0x0BCD, 0x0BCD }, - { 0x0C3E, 0x0C40 }, { 0x0C46, 0x0C48 }, { 0x0C4A, 0x0C4D }, { 0x0C55, 0x0C56 }, - { 0x0C62, 0x0C63 }, { 0x0CBC, 0x0CBC }, { 0x0CBF, 0x0CBF }, { 0x0CC6, 0x0CC6 }, - { 0x0CCC, 0x0CCD }, { 0x0CE2, 0x0CE3 }, { 0x0D41, 0x0D44 }, { 0x0D4D, 0x0D4D }, - { 0x0D62, 0x0D63 }, { 0x0DCA, 0x0DCA }, { 0x0DD2, 0x0DD4 }, { 0x0DD6, 0x0DD6 }, - { 0x0E31, 0x0E31 }, { 0x0E34, 0x0E3A }, { 0x0E47, 0x0E4E }, { 0x0EB1, 0x0EB1 }, - { 0x0EB4, 0x0EB9 }, { 0x0EBB, 0x0EBC }, { 0x0EC8, 0x0ECD }, { 0x0F18, 0x0F19 }, - { 0x0F35, 0x0F35 }, { 0x0F37, 0x0F37 }, { 0x0F39, 0x0F39 }, { 0x0F71, 0x0F7E }, - { 0x0F80, 0x0F84 }, { 0x0F86, 0x0F87 }, { 0x0F8D, 0x0F97 }, { 0x0F99, 0x0FBC }, - { 0x0FC6, 0x0FC6 }, { 0x102D, 0x1030 }, { 0x1032, 0x1037 }, { 0x1039, 0x103A }, - { 0x103D, 0x103E }, { 0x1058, 0x1059 }, { 0x105E, 0x1060 }, { 0x1071, 0x1074 }, - { 0x1082, 0x1082 }, { 0x1085, 0x1086 }, { 0x108D, 0x108D }, { 0x109D, 0x109D }, - { 0x135D, 0x135F }, { 0x1712, 0x1714 }, { 0x1732, 0x1734 }, { 0x1752, 0x1753 }, - { 0x1772, 0x1773 }, { 0x17B4, 0x17B5 }, { 0x17B7, 0x17BD }, { 0x17C6, 0x17C6 }, - { 0x17C9, 0x17D3 }, { 0x17DD, 0x17DD }, { 0x180B, 0x180D }, { 0x18A9, 0x18A9 }, - { 0x1920, 0x1922 }, { 0x1927, 0x1928 }, { 0x1932, 0x1932 }, { 0x1939, 0x193B }, - { 0x1A17, 0x1A18 }, { 0x1A56, 0x1A56 }, { 0x1A58, 0x1A5E }, { 0x1A60, 0x1A60 }, - { 0x1A62, 0x1A62 }, { 0x1A65, 0x1A6C }, { 0x1A73, 0x1A7C }, { 0x1A7F, 0x1A7F }, - { 0x1B00, 0x1B03 }, { 0x1B34, 0x1B34 }, { 0x1B36, 0x1B3A }, { 0x1B3C, 0x1B3C }, - { 0x1B42, 0x1B42 }, { 0x1B6B, 0x1B73 }, { 0x1B80, 0x1B81 }, { 0x1BA2, 0x1BA5 }, - { 0x1BA8, 0x1BA9 }, { 0x1BAB, 0x1BAB }, { 0x1BE6, 0x1BE6 }, { 0x1BE8, 0x1BE9 }, - { 0x1BED, 0x1BED }, { 0x1BEF, 0x1BF1 }, { 0x1C2C, 0x1C33 }, { 0x1C36, 0x1C37 }, - { 0x1CD0, 0x1CD2 }, { 0x1CD4, 0x1CE0 }, { 0x1CE2, 0x1CE8 }, { 0x1CED, 0x1CED }, - { 0x1CF4, 0x1CF4 }, { 0x1DC0, 0x1DE6 }, { 0x1DFC, 0x1DFF }, { 0x20D0, 0x20F0 }, - { 0x2CEF, 0x2CF1 }, { 0x2D7F, 0x2D7F }, { 0x2DE0, 0x2DFF }, { 0x302A, 0x302D }, - { 0x3099, 0x309A }, { 0xA66F, 0xA672 }, { 0xA674, 0xA67D }, { 0xA69F, 0xA69F }, - { 0xA6F0, 0xA6F1 }, { 0xA802, 0xA802 }, { 0xA806, 0xA806 }, { 0xA80B, 0xA80B }, - { 0xA825, 0xA826 }, { 0xA8C4, 0xA8C4 }, { 0xA8E0, 0xA8F1 }, { 0xA926, 0xA92D }, - { 0xA947, 0xA951 }, { 0xA980, 0xA982 }, { 0xA9B3, 0xA9B3 }, { 0xA9B6, 0xA9B9 }, - { 0xA9BC, 0xA9BC }, { 0xAA29, 0xAA2E }, { 0xAA31, 0xAA32 }, { 0xAA35, 0xAA36 }, - { 0xAA43, 0xAA43 }, { 0xAA4C, 0xAA4C }, { 0xAAB0, 0xAAB0 }, { 0xAAB2, 0xAAB4 }, - { 0xAAB7, 0xAAB8 }, { 0xAABE, 0xAABF }, { 0xAAC1, 0xAAC1 }, { 0xAAEC, 0xAAED }, - { 0xAAF6, 0xAAF6 }, { 0xABE5, 0xABE5 }, { 0xABE8, 0xABE8 }, { 0xABED, 0xABED }, - { 0xFB1E, 0xFB1E }, { 0xFE00, 0xFE0F }, { 0xFE20, 0xFE26 }, { 0x101FD, 0x101FD }, - { 0x10A01, 0x10A03 }, { 0x10A05, 0x10A06 }, { 0x10A0C, 0x10A0F }, { 0x10A38, 0x10A3A }, - { 0x10A3F, 0x10A3F }, { 0x11001, 0x11001 }, { 0x11038, 0x11046 }, { 0x11080, 0x11081 }, - { 0x110B3, 0x110B6 }, { 0x110B9, 0x110BA }, { 0x11100, 0x11102 }, { 0x11127, 0x1112B }, - { 0x1112D, 0x11134 }, { 0x11180, 0x11181 }, { 0x111B6, 0x111BE }, { 0x116AB, 0x116AB }, - { 0x116AD, 0x116AD }, { 0x116B0, 0x116B5 }, { 0x116B7, 0x116B7 }, { 0x16F8F, 0x16F92 }, - { 0x1D167, 0x1D169 }, { 0x1D17B, 0x1D182 }, { 0x1D185, 0x1D18B }, { 0x1D1AA, 0x1D1AD }, - { 0x1D242, 0x1D244 }, { 0xE0100, 0xE01EF }, + {0x0300, 0x036F}, {0x0483, 0x0489}, {0x0591, 0x05BD}, {0x05BF, 0x05BF}, + {0x05C1, 0x05C2}, {0x05C4, 0x05C5}, {0x05C7, 0x05C7}, {0x0610, 0x061A}, + {0x064B, 0x065F}, {0x0670, 0x0670}, {0x06D6, 0x06DC}, {0x06DF, 0x06E4}, + {0x06E7, 0x06E8}, {0x06EA, 0x06ED}, {0x0711, 0x0711}, {0x0730, 0x074A}, + {0x07A6, 0x07B0}, {0x07EB, 0x07F3}, {0x0816, 0x0819}, {0x081B, 0x0823}, + {0x0825, 0x0827}, {0x0829, 0x082D}, {0x0859, 0x085B}, {0x08E4, 0x08FE}, + {0x0900, 0x0902}, {0x093A, 0x093A}, {0x093C, 0x093C}, {0x0941, 0x0948}, + {0x094D, 0x094D}, {0x0951, 0x0957}, {0x0962, 0x0963}, {0x0981, 0x0981}, + {0x09BC, 0x09BC}, {0x09C1, 0x09C4}, {0x09CD, 0x09CD}, {0x09E2, 0x09E3}, + {0x0A01, 0x0A02}, {0x0A3C, 0x0A3C}, {0x0A41, 0x0A42}, {0x0A47, 0x0A48}, + {0x0A4B, 0x0A4D}, {0x0A51, 0x0A51}, {0x0A70, 0x0A71}, {0x0A75, 0x0A75}, + {0x0A81, 0x0A82}, {0x0ABC, 0x0ABC}, {0x0AC1, 0x0AC5}, {0x0AC7, 0x0AC8}, + {0x0ACD, 0x0ACD}, {0x0AE2, 0x0AE3}, {0x0B01, 0x0B01}, {0x0B3C, 0x0B3C}, + {0x0B3F, 0x0B3F}, {0x0B41, 0x0B44}, {0x0B4D, 0x0B4D}, {0x0B56, 0x0B56}, + {0x0B62, 0x0B63}, {0x0B82, 0x0B82}, {0x0BC0, 0x0BC0}, {0x0BCD, 0x0BCD}, + {0x0C3E, 0x0C40}, {0x0C46, 0x0C48}, {0x0C4A, 0x0C4D}, {0x0C55, 0x0C56}, + {0x0C62, 0x0C63}, {0x0CBC, 0x0CBC}, {0x0CBF, 0x0CBF}, {0x0CC6, 0x0CC6}, + {0x0CCC, 0x0CCD}, {0x0CE2, 0x0CE3}, {0x0D41, 0x0D44}, {0x0D4D, 0x0D4D}, + {0x0D62, 0x0D63}, {0x0DCA, 0x0DCA}, {0x0DD2, 0x0DD4}, {0x0DD6, 0x0DD6}, + {0x0E31, 0x0E31}, {0x0E34, 0x0E3A}, {0x0E47, 0x0E4E}, {0x0EB1, 0x0EB1}, + {0x0EB4, 0x0EB9}, {0x0EBB, 0x0EBC}, {0x0EC8, 0x0ECD}, {0x0F18, 0x0F19}, + {0x0F35, 0x0F35}, {0x0F37, 0x0F37}, {0x0F39, 0x0F39}, {0x0F71, 0x0F7E}, + {0x0F80, 0x0F84}, {0x0F86, 0x0F87}, {0x0F8D, 0x0F97}, {0x0F99, 0x0FBC}, + {0x0FC6, 0x0FC6}, {0x102D, 0x1030}, {0x1032, 0x1037}, {0x1039, 0x103A}, + {0x103D, 0x103E}, {0x1058, 0x1059}, {0x105E, 0x1060}, {0x1071, 0x1074}, + {0x1082, 0x1082}, {0x1085, 0x1086}, {0x108D, 0x108D}, {0x109D, 0x109D}, + {0x135D, 0x135F}, {0x1712, 0x1714}, {0x1732, 0x1734}, {0x1752, 0x1753}, + {0x1772, 0x1773}, {0x17B4, 0x17B5}, {0x17B7, 0x17BD}, {0x17C6, 0x17C6}, + {0x17C9, 0x17D3}, {0x17DD, 0x17DD}, {0x180B, 0x180D}, {0x18A9, 0x18A9}, + {0x1920, 0x1922}, {0x1927, 0x1928}, {0x1932, 0x1932}, {0x1939, 0x193B}, + {0x1A17, 0x1A18}, {0x1A56, 0x1A56}, {0x1A58, 0x1A5E}, {0x1A60, 0x1A60}, + {0x1A62, 0x1A62}, {0x1A65, 0x1A6C}, {0x1A73, 0x1A7C}, {0x1A7F, 0x1A7F}, + {0x1B00, 0x1B03}, {0x1B34, 0x1B34}, {0x1B36, 0x1B3A}, {0x1B3C, 0x1B3C}, + {0x1B42, 0x1B42}, {0x1B6B, 0x1B73}, {0x1B80, 0x1B81}, {0x1BA2, 0x1BA5}, + {0x1BA8, 0x1BA9}, {0x1BAB, 0x1BAB}, {0x1BE6, 0x1BE6}, {0x1BE8, 0x1BE9}, + {0x1BED, 0x1BED}, {0x1BEF, 0x1BF1}, {0x1C2C, 0x1C33}, {0x1C36, 0x1C37}, + {0x1CD0, 0x1CD2}, {0x1CD4, 0x1CE0}, {0x1CE2, 0x1CE8}, {0x1CED, 0x1CED}, + {0x1CF4, 0x1CF4}, {0x1DC0, 0x1DE6}, {0x1DFC, 0x1DFF}, {0x20D0, 0x20F0}, + {0x2CEF, 0x2CF1}, {0x2D7F, 0x2D7F}, {0x2DE0, 0x2DFF}, {0x302A, 0x302D}, + {0x3099, 0x309A}, {0xA66F, 0xA672}, {0xA674, 0xA67D}, {0xA69F, 0xA69F}, + {0xA6F0, 0xA6F1}, {0xA802, 0xA802}, {0xA806, 0xA806}, {0xA80B, 0xA80B}, + {0xA825, 0xA826}, {0xA8C4, 0xA8C4}, {0xA8E0, 0xA8F1}, {0xA926, 0xA92D}, + {0xA947, 0xA951}, {0xA980, 0xA982}, {0xA9B3, 0xA9B3}, {0xA9B6, 0xA9B9}, + {0xA9BC, 0xA9BC}, {0xAA29, 0xAA2E}, {0xAA31, 0xAA32}, {0xAA35, 0xAA36}, + {0xAA43, 0xAA43}, {0xAA4C, 0xAA4C}, {0xAAB0, 0xAAB0}, {0xAAB2, 0xAAB4}, + {0xAAB7, 0xAAB8}, {0xAABE, 0xAABF}, {0xAAC1, 0xAAC1}, {0xAAEC, 0xAAED}, + {0xAAF6, 0xAAF6}, {0xABE5, 0xABE5}, {0xABE8, 0xABE8}, {0xABED, 0xABED}, + {0xFB1E, 0xFB1E}, {0xFE00, 0xFE0F}, {0xFE20, 0xFE26}, {0x101FD, 0x101FD}, + {0x10A01, 0x10A03}, {0x10A05, 0x10A06}, {0x10A0C, 0x10A0F}, {0x10A38, 0x10A3A}, + {0x10A3F, 0x10A3F}, {0x11001, 0x11001}, {0x11038, 0x11046}, {0x11080, 0x11081}, + {0x110B3, 0x110B6}, {0x110B9, 0x110BA}, {0x11100, 0x11102}, {0x11127, 0x1112B}, + {0x1112D, 0x11134}, {0x11180, 0x11181}, {0x111B6, 0x111BE}, {0x116AB, 0x116AB}, + {0x116AD, 0x116AD}, {0x116B0, 0x116B5}, {0x116B7, 0x116B7}, {0x16F8F, 0x16F92}, + {0x1D167, 0x1D169}, {0x1D17B, 0x1D182}, {0x1D185, 0x1D18B}, {0x1D1AA, 0x1D1AD}, + {0x1D242, 0x1D244}, {0xE0100, 0xE01EF}, }; static const UnicodeCharSet CombiningCharacters(CombiningCharacterRanges); @@ -290,31 +289,30 @@ int charWidthUnicode(uint32_t c) { static const UnicodeCharRange DoubleWidthCharacterRanges[] = { // Hangul Jamo - { 0x1100, 0x11FF }, + {0x1100, 0x11FF}, // Deprecated fullwidth angle brackets - { 0x2329, 0x232A }, + {0x2329, 0x232A}, // CJK Misc, CJK Unified Ideographs, Yijing Hexagrams, Yi // excluding U+303F (IDEOGRAPHIC HALF FILL SPACE) - { 0x2E80, 0x303E }, - { 0x3040, 0xA4CF }, + {0x2E80, 0x303E}, + {0x3040, 0xA4CF}, // Hangul - { 0xAC00, 0xD7A3 }, - { 0xD7B0, 0xD7C6 }, - { 0xD7CB, 0xD7FB }, + {0xAC00, 0xD7A3}, + {0xD7B0, 0xD7C6}, + {0xD7CB, 0xD7FB}, // CJK Unified Ideographs - { 0xF900, 0xFAFF }, + {0xF900, 0xFAFF}, // Vertical forms - { 0xFE10, 0xFE19 }, + {0xFE10, 0xFE19}, // CJK Compatibility Forms + Small Form Variants - { 0xFE30, 0xFE6F }, + {0xFE30, 0xFE6F}, // Fullwidth forms - { 0xFF01, 0xFF60 }, - { 0xFFE0, 0xFFE6 }, + {0xFF01, 0xFF60}, + {0xFFE0, 0xFFE6}, // CJK Unified Ideographs - { 0x20000, 0x2A6DF }, - { 0x2A700, 0x2B81F }, - { 0x2F800, 0x2FA1F } - }; + {0x20000, 0x2A6DF}, + {0x2A700, 0x2B81F}, + {0x2F800, 0x2FA1F}}; static const UnicodeCharSet DoubleWidthCharacters(DoubleWidthCharacterRanges); if (DoubleWidthCharacters.contains(c)) diff --git a/source/text/SourceManager.cpp b/source/text/SourceManager.cpp index f990b38c7..38b4d155a 100644 --- a/source/text/SourceManager.cpp +++ b/source/text/SourceManager.cpp @@ -412,10 +412,11 @@ void SourceManager::addDiagnosticDirective(SourceLocation location, string_view // Keep the list in sorted order. Typically new additions should be at the end, // in which case we'll hit the condition above, but just in case we will do the // full search and insert here. - vec.emplace( - std::upper_bound(vec.begin(), vec.end(), offset, - [](size_t offset, auto& diag) { return offset < diag.offset; }), - name, offset, severity); + vec.emplace(std::upper_bound(vec.begin(), vec.end(), offset, + [](size_t offset, auto& diag) { + return offset < diag.offset; + }), + name, offset, severity); } } @@ -459,8 +460,8 @@ SourceBuffer SourceManager::createBufferEntry(FileData* fd, SourceLocation inclu std::unique_lock&) { ASSERT(fd); bufferEntries.emplace_back(FileInfo(fd, includedFrom)); - return SourceBuffer{ string_view(fd->mem.data(), fd->mem.size()), - BufferID((uint32_t)(bufferEntries.size() - 1), fd->name) }; + return SourceBuffer{string_view(fd->mem.data(), fd->mem.size()), + BufferID((uint32_t)(bufferEntries.size() - 1), fd->name)}; } bool SourceManager::isCached(const fs::path& path) const { diff --git a/source/types/AllTypes.cpp b/source/types/AllTypes.cpp index 430f0a788..b4d924b84 100644 --- a/source/types/AllTypes.cpp +++ b/source/types/AllTypes.cpp @@ -138,7 +138,7 @@ ConstantRange IntegralType::getBitVectorRange() const { if (kind == SymbolKind::PackedArrayType) return as().range; - return { int32_t(bitWidth - 1), 0 }; + return {int32_t(bitWidth - 1), 0}; } bool IntegralType::isDeclaredReg() const { @@ -313,8 +313,8 @@ const Type& EnumType::fromSyntax(Compilation& compilation, const EnumTypeSyntax& SourceRange previousRange; bool first = true; - auto resultType = - compilation.emplace(compilation, syntax.keyword.location(), *base, context); + auto resultType = compilation.emplace(compilation, syntax.keyword.location(), *base, + context); resultType->setSyntax(syntax); // Enum values must be unique; this set and lambda are used to check that. @@ -648,8 +648,8 @@ const Type& FixedSizeUnpackedArrayType::fromDims(Compilation& compilation, const const Type* result = &elementType; size_t count = dimensions.size(); for (size_t i = 0; i < count; i++) { - result = - compilation.emplace(*result, dimensions[count - i - 1]); + result = compilation.emplace(*result, + dimensions[count - i - 1]); } return *result; @@ -704,8 +704,8 @@ const Type& PackedStructType::fromSyntax(Compilation& comp, const StructUnionTyp const bool isSigned = syntax.signing.kind == TokenKind::SignedKeyword; bool issuedError = false; - auto structType = - comp.emplace(comp, isSigned, syntax.keyword.location(), parentContext); + auto structType = comp.emplace(comp, isSigned, syntax.keyword.location(), + parentContext); structType->setSyntax(syntax); BindContext context(*structType, LookupLocation::max, parentContext.flags); @@ -725,8 +725,8 @@ const Type& PackedStructType::fromSyntax(Compilation& comp, const StructUnionTyp } for (auto decl : member->declarators) { - auto field = - comp.emplace(decl->name.valueText(), decl->name.location(), 0u); + auto field = comp.emplace(decl->name.valueText(), decl->name.location(), + 0u); field->setType(type); field->setSyntax(*decl); field->setAttributes(*context.scope, member->attributes); @@ -958,8 +958,8 @@ const Type& UnpackedUnionType::fromSyntax(const BindContext& context, auto& comp = context.getCompilation(); bool isTagged = syntax.tagged.valid(); - auto result = - comp.emplace(comp, isTagged, syntax.keyword.location(), context); + auto result = comp.emplace(comp, isTagged, syntax.keyword.location(), + context); uint32_t fieldIndex = 0; for (auto member : syntax.members) { @@ -1077,8 +1077,9 @@ ForwardingTypedefSymbol& ForwardingTypedefSymbol::fromSyntax( const Scope& scope, const ForwardInterfaceClassTypedefDeclarationSyntax& syntax) { auto& comp = scope.getCompilation(); - auto result = comp.emplace( - syntax.name.valueText(), syntax.name.location(), ForwardTypedefCategory::InterfaceClass); + auto result = comp.emplace(syntax.name.valueText(), + syntax.name.location(), + ForwardTypedefCategory::InterfaceClass); result->setSyntax(syntax); result->setAttributes(scope, syntax.attributes); return *result; diff --git a/source/types/DeclaredType.cpp b/source/types/DeclaredType.cpp index b5b9950ac..6a70c9c51 100644 --- a/source/types/DeclaredType.cpp +++ b/source/types/DeclaredType.cpp @@ -101,9 +101,9 @@ void DeclaredType::resolveType(const BindContext& typeContext, if (flags.has(DeclaredTypeFlags::AllowUnboundedLiteral)) extraFlags = BindFlags::AllowUnboundedLiteral; - initializer = - &Expression::bindImplicitParam(*syntax, *initializerSyntax, initializerLocation, - initializerContext, typeContext, extraFlags); + initializer = &Expression::bindImplicitParam(*syntax, *initializerSyntax, + initializerLocation, initializerContext, + typeContext, extraFlags); type = initializer->type; } } @@ -208,9 +208,10 @@ void DeclaredType::checkType(const BindContext& context) const { if (auto var = parent.as().getMergedVariable()) { ASSERT(!hasLink); ASSERT(typeOrLink.typeSyntax); - mergePortTypes( - context, *var, typeOrLink.typeSyntax->as(), parent.location, - dimensions ? *dimensions : span{}); + mergePortTypes(context, *var, typeOrLink.typeSyntax->as(), + parent.location, + dimensions ? *dimensions + : span{}); } break; case uint32_t(DeclaredTypeFlags::Rand): { @@ -304,8 +305,8 @@ void DeclaredType::mergePortTypes( if (!sourceType->isIntegral()) { if (sourceSymbol.kind == SymbolKind::Net && sourceSymbol.as().netType.netKind == NetType::Interconnect) { - auto& diag = - context.addDiag(diag::InterconnectTypeSyntax, implicit.signing.range()); + auto& diag = context.addDiag(diag::InterconnectTypeSyntax, + implicit.signing.range()); diag.addNote(diag::NoteDeclarationHere, sourceSymbol.location); } else { diff --git a/source/util/CommandLine.cpp b/source/util/CommandLine.cpp index ee817d76b..21f6a6ac7 100644 --- a/source/util/CommandLine.cpp +++ b/source/util/CommandLine.cpp @@ -156,7 +156,7 @@ void CommandLine::setPositional(OptionCallback cb, string_view valueName, bool i } bool CommandLine::parse(int argc, const char* const argv[]) { - SmallVectorSized args{ size_t(argc) }; + SmallVectorSized args{size_t(argc)}; for (int i = 0; i < argc; i++) args.append(argv[i]); @@ -166,8 +166,8 @@ bool CommandLine::parse(int argc, const char* const argv[]) { #if defined(_MSC_VER) bool CommandLine::parse(int argc, const wchar_t* const argv[]) { - SmallVectorSized storage{ size_t(argc) }; - SmallVectorSized args{ size_t(argc) }; + SmallVectorSized storage{size_t(argc)}; + SmallVectorSized args{size_t(argc)}; for (int i = 0; i < argc; i++) { storage.append(narrow(argv[i])); args.append(storage.back()); @@ -412,8 +412,8 @@ bool CommandLine::parse(span args, ParseOptions options) { if (arg[0] == '+') { size_t plusIndex = arg.substr(1).find_first_of('+'); if (plusIndex != string_view::npos) { - ignoreArg = - arg.substr(0, plusIndex + 1); // +1 because we started from arg.substr(1) + ignoreArg = arg.substr(0, plusIndex + + 1); // +1 because we started from arg.substr(1) } } diff --git a/tests/simtests/Test.h b/tests/simtests/Test.h index f281ef94a..f11f6b348 100644 --- a/tests/simtests/Test.h +++ b/tests/simtests/Test.h @@ -19,8 +19,8 @@ inline void compile(Compilation& compilation, const std::string& text) { auto& diags = compilation.getAllDiagnostics(); if (!diags.empty()) { - std::string report = - DiagnosticEngine::reportAll(SyntaxTree::getDefaultSourceManager(), diags); + std::string report = DiagnosticEngine::reportAll(SyntaxTree::getDefaultSourceManager(), + diags); FAIL_CHECK(report); } } diff --git a/tests/unittests/DiagnosticTests.cpp b/tests/unittests/DiagnosticTests.cpp index 6af63153b..b8722fa66 100644 --- a/tests/unittests/DiagnosticTests.cpp +++ b/tests/unittests/DiagnosticTests.cpp @@ -467,8 +467,7 @@ TEST_CASE("DiagnosticEngine stuff") { TEST_CASE("DiagnosticEngine::setWarningOptions") { auto options = std::vector{ "everything"s, "none"s, "error"s, "error=case-gen-dup"s, "no-error=empty-member"s, - "empty-stmt"s, "no-extra"s, "asdf"s - }; + "empty-stmt"s, "no-extra"s, "asdf"s}; DiagnosticEngine engine(getSourceManager()); engine.setDefaultWarnings(); diff --git a/tests/unittests/DriverTests.cpp b/tests/unittests/DriverTests.cpp index 03998d881..87bbe139d 100644 --- a/tests/unittests/DriverTests.cpp +++ b/tests/unittests/DriverTests.cpp @@ -16,7 +16,7 @@ TEST_CASE("Driver basic") { driver.addStandardArgs(); auto filePath = findTestDir() + "test.sv"; - const char* argv[] = { "testfoo", filePath.c_str() }; + const char* argv[] = {"testfoo", filePath.c_str()}; CHECK(driver.parseCommandLine(2, argv)); CHECK(driver.processOptions()); } @@ -27,7 +27,7 @@ TEST_CASE("Driver invalid command line arg") { Driver driver; driver.addStandardArgs(); - const char* argv[] = { "testfoo", "--foo=bar" }; + const char* argv[] = {"testfoo", "--foo=bar"}; CHECK(!driver.parseCommandLine(2, argv)); CHECK(stderrContains("unknown command line arg")); } @@ -38,7 +38,7 @@ TEST_CASE("Driver invalid compat") { Driver driver; driver.addStandardArgs(); - const char* argv[] = { "testfoo", "--compat=baz" }; + const char* argv[] = {"testfoo", "--compat=baz"}; CHECK(driver.parseCommandLine(2, argv)); CHECK(!driver.processOptions()); CHECK(stderrContains("invalid value for compat option")); @@ -50,7 +50,7 @@ TEST_CASE("Driver invalid timing") { Driver driver; driver.addStandardArgs(); - const char* argv[] = { "testfoo", "-TFoo" }; + const char* argv[] = {"testfoo", "-TFoo"}; CHECK(driver.parseCommandLine(2, argv)); CHECK(!driver.processOptions()); CHECK(stderrContains("invalid value for timing option")); @@ -62,7 +62,7 @@ TEST_CASE("Driver invalid include dirs") { Driver driver; driver.addStandardArgs(); - const char* argv[] = { "testfoo", "-Ifoo/bar/baz/", "--isystem=foo/bar/baz/" }; + const char* argv[] = {"testfoo", "-Ifoo/bar/baz/", "--isystem=foo/bar/baz/"}; CHECK(driver.parseCommandLine(3, argv)); CHECK(!driver.processOptions()); CHECK(stderrContains("does not exist")); @@ -75,7 +75,7 @@ TEST_CASE("Driver missing single-unit for inherit macros") { Driver driver; driver.addStandardArgs(); - const char* argv[] = { "testfoo", "--libraries-inherit-macros" }; + const char* argv[] = {"testfoo", "--libraries-inherit-macros"}; CHECK(driver.parseCommandLine(2, argv)); CHECK(!driver.processOptions()); CHECK(stderrContains("--single-unit must be set")); @@ -87,7 +87,7 @@ TEST_CASE("Driver invalid source file") { Driver driver; driver.addStandardArgs(); - const char* argv[] = { "testfoo", "blah.sv" }; + const char* argv[] = {"testfoo", "blah.sv"}; CHECK(!driver.parseCommandLine(2, argv)); CHECK(!driver.processOptions()); CHECK(stderrContains("no such file")); @@ -100,7 +100,7 @@ TEST_CASE("Driver file preprocess") { driver.addStandardArgs(); auto filePath = findTestDir() + "test.sv"; - const char* argv[] = { "testfoo", filePath.c_str() }; + const char* argv[] = {"testfoo", filePath.c_str()}; CHECK(driver.parseCommandLine(2, argv)); CHECK(driver.processOptions()); CHECK(driver.runPreprocessor(true, false)); @@ -125,7 +125,7 @@ TEST_CASE("Driver file preprocess with error") { driver.addStandardArgs(); auto filePath = findTestDir() + "test2.sv"; - const char* argv[] = { "testfoo", filePath.c_str() }; + const char* argv[] = {"testfoo", filePath.c_str()}; CHECK(driver.parseCommandLine(2, argv)); CHECK(driver.processOptions()); CHECK(!driver.runPreprocessor(true, false)); @@ -139,7 +139,7 @@ TEST_CASE("Driver report macros") { driver.addStandardArgs(); auto filePath = findTestDir() + "test.sv"; - const char* argv[] = { "testfoo", filePath.c_str() }; + const char* argv[] = {"testfoo", filePath.c_str()}; CHECK(driver.parseCommandLine(2, argv)); CHECK(driver.processOptions()); driver.reportMacros(); @@ -204,7 +204,7 @@ TEST_CASE("Driver invalid library module file") { Driver driver; driver.addStandardArgs(); - const char* argv[] = { "testfoo", "-vblah.sv" }; + const char* argv[] = {"testfoo", "-vblah.sv"}; CHECK(driver.parseCommandLine(2, argv)); CHECK(driver.processOptions()); CHECK(!driver.parseAllSources()); @@ -246,7 +246,7 @@ TEST_CASE("Driver full compilation with defines and param overrides") { } TEST_CASE("Driver setting a bunch of compilation options") { - for (auto timing : { "min", "typ", "max" }) { + for (auto timing : {"min", "typ", "max"}) { auto guard = OS::captureOutput(); Driver driver; @@ -306,7 +306,7 @@ TEST_CASE("Driver command files") { } TEST_CASE("Driver command file errors") { - for (auto type : { "f", "F" }) { + for (auto type : {"f", "F"}) { auto guard = OS::captureOutput(); Driver driver; @@ -382,8 +382,7 @@ TEST_CASE("Driver flag --exclude-ext (multiple use)") { auto filePath3 = findTestDir() + "test.e"; const char* argv[] = { "testfoo", "--exclude-ext", "vhd", "--exclude-ext", "e", filePath1.c_str(), - filePath2.c_str(), filePath3.c_str() - }; + filePath2.c_str(), filePath3.c_str()}; CHECK(driver.parseCommandLine(sizeof(argv) / sizeof(argv[0]), argv)); CHECK(driver.processOptions()); } diff --git a/tests/unittests/EvalTests.cpp b/tests/unittests/EvalTests.cpp index b674e500e..edf9abd1a 100644 --- a/tests/unittests/EvalTests.cpp +++ b/tests/unittests/EvalTests.cpp @@ -1600,7 +1600,7 @@ TEST_CASE("Array query functions") { EVAL("$low(arr, k)", SVInt::createFillX(32, true)); EVAL("$increment(arr, 3)", 1); - for (auto& func : { "$left", "$right", "$low", "$high", "$increment", "$size" }) { + for (auto& func : {"$left", "$right", "$low", "$high", "$increment", "$size"}) { EVAL(func + "(arr, j)"s, SVInt::createFillX(32, true)); } diff --git a/tests/unittests/ExpressionTests.cpp b/tests/unittests/ExpressionTests.cpp index 3e31a4fee..ddc5c34aa 100644 --- a/tests/unittests/ExpressionTests.cpp +++ b/tests/unittests/ExpressionTests.cpp @@ -44,14 +44,14 @@ TEST_CASE("Evaluate assignment expression") { auto& scope = compilation.createScriptScope(); auto varToken = syntax->root().getFirstToken(); - VariableSymbol local{ varToken.valueText(), varToken.location(), VariableLifetime::Automatic }; + VariableSymbol local{varToken.valueText(), varToken.location(), VariableLifetime::Automatic}; local.setType(compilation.getIntType()); // Bind the expression tree to the symbol scope.addMember(local); - auto& bound = - Expression::bind(syntax->root().as(), - BindContext(scope, LookupLocation::max), BindFlags::AssignmentAllowed); + auto& bound = Expression::bind(syntax->root().as(), + BindContext(scope, LookupLocation::max), + BindFlags::AssignmentAllowed); REQUIRE(syntax->diagnostics().empty()); // Initialize `i` to 1. @@ -79,14 +79,14 @@ TEST_CASE("Check type propagation") { auto& scope = compilation.createScriptScope(); auto varToken = syntax->root().getFirstToken(); - VariableSymbol local{ varToken.valueText(), varToken.location(), VariableLifetime::Automatic }; + VariableSymbol local{varToken.valueText(), varToken.location(), VariableLifetime::Automatic}; local.setType(compilation.getType(20, IntegralFlags::Unsigned)); // Bind the expression tree to the symbol scope.addMember(local); - auto& bound = - Expression::bind(syntax->root().as(), - BindContext(scope, LookupLocation::max), BindFlags::AssignmentAllowed); + auto& bound = Expression::bind(syntax->root().as(), + BindContext(scope, LookupLocation::max), + BindFlags::AssignmentAllowed); REQUIRE(syntax->diagnostics().empty()); @@ -108,14 +108,14 @@ TEST_CASE("Check type propagation 2") { // Fabricate a symbol for the `i` variable auto varToken = syntax->root().getFirstToken(); - VariableSymbol local{ varToken.valueText(), varToken.location(), VariableLifetime::Automatic }; + VariableSymbol local{varToken.valueText(), varToken.location(), VariableLifetime::Automatic}; local.setType(compilation.getType(20, IntegralFlags::Unsigned)); // Bind the expression tree to the symbol scope.addMember(local); - auto& bound = - Expression::bind(syntax->root().as(), - BindContext(scope, LookupLocation::max), BindFlags::AssignmentAllowed); + auto& bound = Expression::bind(syntax->root().as(), + BindContext(scope, LookupLocation::max), + BindFlags::AssignmentAllowed); REQUIRE(syntax->diagnostics().empty()); CHECK(bound.type->getBitWidth() == 20); @@ -143,14 +143,14 @@ TEST_CASE("Check type propagation real") { // Fabricate a symbol for the `i` variable auto varToken = syntax->root().getFirstToken(); - VariableSymbol local{ varToken.valueText(), varToken.location(), VariableLifetime::Automatic }; + VariableSymbol local{varToken.valueText(), varToken.location(), VariableLifetime::Automatic}; local.setType(compilation.getType(20, IntegralFlags::Unsigned)); // Bind the expression tree to the symbol scope.addMember(local); - auto& bound = - Expression::bind(syntax->root().as(), - BindContext(scope, LookupLocation::max), BindFlags::AssignmentAllowed); + auto& bound = Expression::bind(syntax->root().as(), + BindContext(scope, LookupLocation::max), + BindFlags::AssignmentAllowed); REQUIRE(syntax->diagnostics().empty()); CHECK(bound.type->getBitWidth() == 20); @@ -1372,15 +1372,15 @@ auto testBitstream(const std::string& text, DiagCode code = DiagCode()) { TEST_CASE("$bits on non-fixed-size array") { std::string intBits = "int b = $bits(a);"; std::string paramBits = "localparam b = $bits(a);"; - std::string types[] = { "string a;", - "logic[1:0] a[];", - "bit a[$];", - "byte a[int];", - "struct { string a; int b; } a;", - "string a[1:0];", - "bit a[1:0][];", - "bit a[1:0][$];", - "bit a[1:0][int];" }; + std::string types[] = {"string a;", + "logic[1:0] a[];", + "bit a[$];", + "byte a[int];", + "struct { string a; int b; } a;", + "string a[1:0];", + "bit a[1:0][];", + "bit a[1:0][$];", + "bit a[1:0][int];"}; std::string typeDef = "typedef "; for (const auto& type : types) { @@ -1410,8 +1410,7 @@ dest_t b = dest_t'(a); R"( typedef struct { bit a[int]; int b; } asso; asso x = asso'(64'b0); -)" - }; +)"}; for (const auto& code : illegal) CHECK(testBitstream(code, diag::BadConversion) == 1); @@ -1439,8 +1438,7 @@ typedef byte channel_type[$]; Packet genPkt; channel_type channel = channel_type'(genPkt); Packet p = Packet'( channel[0 : 1] ); -)" - }; +)"}; for (const auto& code : legal) CHECK(testBitstream(code) == 0); @@ -1460,8 +1458,7 @@ localparam c d = c'(str); localparam string str = "hello"; typedef struct { shortint a[]; byte b[1:0]; } c; localparam c d = c'(str); -)" - }; +)"}; for (const auto& code : eval) CHECK(testBitstream(code, diag::ConstEvalBitstreamCastSize) == 1); @@ -1475,39 +1472,39 @@ TEST_CASE("Streaming operators") { std::string sv; DiagCode msg; } illegal[] = { - { "int a; int b = {>>{a}} + 2;", diag::BadStreamContext }, - { "shortint a,b; int c = {{>>{a}}, b};", diag::BadStreamContext }, - { "int a,b; always_comb {>>{a}} += b;", diag::BadStreamContext }, - { "int a; int b = {<< string {a}};", diag::BadStreamSlice }, - { "typedef bit t[]; int a; int b = {<> 4 {a}};", diag::IgnoredSlice }, - { "int a; real b; assign {<< 2 {a}} = b;", diag::BadStreamSourceType }, - { "int a; shortint b; assign {<< 2 {a}} = b;", diag::BadStreamSize }, - { "int a; shortint b; assign b = {<< 4 {a}};", diag::BadStreamSize }, - { "int a; shortint b; assign {>>{b}} = {<< 4 {a}};", diag::BadStreamSize }, - { "int a; real b = real'({<< 4 {a}});", diag::BadStreamCast }, - { "int a; shortint b = shortint'({<< 4 {a}});", diag::BadStreamCast }, - { "typedef struct {byte a[$]; bit b;} dest_t; int a; dest_t b = dest_t'({<<{a}});", - diag::BadStreamCast }, - { "typedef struct {byte a[$]; bit b;} dest_t;int a;dest_t b;assign {>>{b}}={<<{a}};", - diag::BadStreamSize }, - - { "localparam string s=\"AB\"; localparam byte j= {<<2{s}};", diag::BadStreamSize }, - { "localparam string s=\"AB\"; localparam int j= byte'({<<{s}}) - 5;", - diag::ConstEvalBitstreamCastSize }, - { "localparam string s=\"AB\"; localparam int j= int'({<<{s}}) - 5;", - diag::ConstEvalBitstreamCastSize }, - - { "int a,b,c; assign {>>{a,b,c}}=23'b1;", diag::BadStreamSize }, - { "int a,b,c; int j={>>{a,b,c}};", diag::BadStreamSize }, - { "int a,b,c; assign {>>{a+b}}=c;", diag::ExpressionNotAssignable }, - - { R"( + {"int a; int b = {>>{a}} + 2;", diag::BadStreamContext}, + {"shortint a,b; int c = {{>>{a}}, b};", diag::BadStreamContext}, + {"int a,b; always_comb {>>{a}} += b;", diag::BadStreamContext}, + {"int a; int b = {<< string {a}};", diag::BadStreamSlice}, + {"typedef bit t[]; int a; int b = {<> 4 {a}};", diag::IgnoredSlice}, + {"int a; real b; assign {<< 2 {a}} = b;", diag::BadStreamSourceType}, + {"int a; shortint b; assign {<< 2 {a}} = b;", diag::BadStreamSize}, + {"int a; shortint b; assign b = {<< 4 {a}};", diag::BadStreamSize}, + {"int a; shortint b; assign {>>{b}} = {<< 4 {a}};", diag::BadStreamSize}, + {"int a; real b = real'({<< 4 {a}});", diag::BadStreamCast}, + {"int a; shortint b = shortint'({<< 4 {a}});", diag::BadStreamCast}, + {"typedef struct {byte a[$]; bit b;} dest_t; int a; dest_t b = dest_t'({<<{a}});", + diag::BadStreamCast}, + {"typedef struct {byte a[$]; bit b;} dest_t;int a;dest_t b;assign {>>{b}}={<<{a}};", + diag::BadStreamSize}, + + {"localparam string s=\"AB\"; localparam byte j= {<<2{s}};", diag::BadStreamSize}, + {"localparam string s=\"AB\"; localparam int j= byte'({<<{s}}) - 5;", + diag::ConstEvalBitstreamCastSize}, + {"localparam string s=\"AB\"; localparam int j= int'({<<{s}}) - 5;", + diag::ConstEvalBitstreamCastSize}, + + {"int a,b,c; assign {>>{a,b,c}}=23'b1;", diag::BadStreamSize}, + {"int a,b,c; int j={>>{a,b,c}};", diag::BadStreamSize}, + {"int a,b,c; assign {>>{a+b}}=c;", diag::ExpressionNotAssignable}, + + {R"( function int foo(byte bar[]); int a; {>>{a}} = bar; @@ -1515,8 +1512,8 @@ function int foo(byte bar[]); endfunction localparam t=foo("AB"); )", - diag::BadStreamSize }, - { R"( + diag::BadStreamSize}, + {R"( function int foo(byte bar[]); int a; {>>{a}} = {<<{bar}}; @@ -1524,38 +1521,38 @@ return a; endfunction localparam t=foo("ABCDE"); )", - diag::BadStreamSize }, + diag::BadStreamSize}, - { R"( + {R"( bit [0:2] c [2:0]; sub u({>>{c}}); endmodule module sub(output byte b); )", - diag::BadStreamSize }, + diag::BadStreamSize}, - { R"( + {R"( sub u({>>{2}}); endmodule module sub(input bit[3:0] a[0:3]); )", - diag::BadStreamSize }, + diag::BadStreamSize}, - { R"( + {R"( bit [0:1] c [1:0]; sub u({>>{c}}); endmodule module sub(inout logic[7:0] b); )", - diag::BadStreamContext }, + diag::BadStreamContext}, - { R"( + {R"( byte c [3:0]; sub u[3:0] ({>>{c}}); endmodule module sub(input byte b); )", - diag::BadStreamContext }, + diag::BadStreamContext}, }; for (const auto& test : illegal) { @@ -1580,8 +1577,7 @@ module sub(input byte b); sub u({<<3{shortint'(100)}}, {>>{c}}); endmodule module sub(input bit[3:0] a[0:3], output byte b); -)" - }; +)"}; for (const auto& test : legal) CHECK(testBitstream(test) == 0); @@ -1592,19 +1588,18 @@ TEST_CASE("Stream expression with") { std::string sv; DiagCode msg; } illegal[] = { - { "byte b[4]; int a = {<<3{b with[]}};", diag::ExpectedExpression }, - { "int a; byte b[4] = {<<3{a with [2]}};", diag::BadStreamWithType }, - { "byte b[4]; int a = {<<3{b with[0.5]}};", diag::ExprMustBeIntegral }, - { "byte b[4]; int a = {<<3{b with[{65{1'b1}}]}};", diag::IndexOOB }, - { "byte b[4]; int a = {<<3{b with[4]}};", diag::IndexOOB }, - { "byte b[4]; int a = {<<3{b with[2-:-1]}};", diag::ValueMustBePositive }, - { "byte b[4]; logic [39:0] a = {<<3{b with[2+:5]}};", diag::RangeOOB }, - { "byte b[3:0]; int a = {<<3{b with[2+:3]}};", diag::RangeOOB }, - { "byte b[0:3]; int a = {<<3{b with[2:5]}};", diag::RangeOOB }, - { "byte b[]; int a = {<<3{b with[3:2]}};", diag::SelectEndianDynamic }, - { "byte b[], c[4]; always {>>{b, {<<3{c with[b[0]:b[1]]}}}} = 9;", - diag::BadStreamWithOrder }, - { "int a[],b[],c[];bit d;always {>>{b}}={<<{a with [2+:3],c,d}};", diag::BadStreamSize }, + {"byte b[4]; int a = {<<3{b with[]}};", diag::ExpectedExpression}, + {"int a; byte b[4] = {<<3{a with [2]}};", diag::BadStreamWithType}, + {"byte b[4]; int a = {<<3{b with[0.5]}};", diag::ExprMustBeIntegral}, + {"byte b[4]; int a = {<<3{b with[{65{1'b1}}]}};", diag::IndexOOB}, + {"byte b[4]; int a = {<<3{b with[4]}};", diag::IndexOOB}, + {"byte b[4]; int a = {<<3{b with[2-:-1]}};", diag::ValueMustBePositive}, + {"byte b[4]; logic [39:0] a = {<<3{b with[2+:5]}};", diag::RangeOOB}, + {"byte b[3:0]; int a = {<<3{b with[2+:3]}};", diag::RangeOOB}, + {"byte b[0:3]; int a = {<<3{b with[2:5]}};", diag::RangeOOB}, + {"byte b[]; int a = {<<3{b with[3:2]}};", diag::SelectEndianDynamic}, + {"byte b[], c[4]; always {>>{b, {<<3{c with[b[0]:b[1]]}}}} = 9;", diag::BadStreamWithOrder}, + {"int a[],b[],c[];bit d;always {>>{b}}={<<{a with [2+:3],c,d}};", diag::BadStreamSize}, }; for (const auto& test : illegal) { @@ -1625,8 +1620,7 @@ initial begin pkt = {<< 8 {i_header, i_len, i_data, i_crc}}; {<< 8 {o_header, o_len, o_data with [0 +: o_len], o_crc}} = pkt; end -)" - }; +)"}; for (const auto& test : legal) CHECK(testBitstream(test) == 0); diff --git a/tests/unittests/StatementTests.cpp b/tests/unittests/StatementTests.cpp index b9bb0f917..de1ccc64c 100644 --- a/tests/unittests/StatementTests.cpp +++ b/tests/unittests/StatementTests.cpp @@ -577,7 +577,7 @@ endmodule NO_COMPILATION_ERRORS; auto& foo = compilation.getRoot().lookupName("m.asdf.foo"); - CHECK(foo.getType().getFixedRange() == ConstantRange{ 4, 2 }); + CHECK(foo.getType().getFixedRange() == ConstantRange{4, 2}); } TEST_CASE("If statement -- unevaluated branches -- valid") { diff --git a/tests/unittests/TypeTests.cpp b/tests/unittests/TypeTests.cpp index 631612ab6..501fbdc22 100644 --- a/tests/unittests/TypeTests.cpp +++ b/tests/unittests/TypeTests.cpp @@ -179,8 +179,8 @@ endmodule CHECK(instance.find("BAR")); // Try to look up after the parameter but before the function; should fail. - CHECK(!instance.lookupName( - "SDF", LookupLocation::before(instance.memberAt(0)))); + CHECK(!instance.lookupName("SDF", LookupLocation::before( + instance.memberAt(0)))); const auto& foshizzle = instance.memberAt(5); CHECK(instance.lookupName("SDF", LookupLocation::after(foshizzle))); @@ -440,7 +440,7 @@ endmodule const auto& fType = instance.find("f").getType(); CHECK(fType.isPackedArray()); - CHECK(fType.as().range == ConstantRange{ 0, 3 }); + CHECK(fType.as().range == ConstantRange{0, 3}); NO_COMPILATION_ERRORS; } @@ -457,14 +457,14 @@ endmodule const auto& fType = instance.find("f").getType(); CHECK(fType.isUnpackedArray()); - CHECK(fType.as().range == ConstantRange{ 0, 2 }); + CHECK(fType.as().range == ConstantRange{0, 2}); const auto& gType = instance.find("g").getType(); CHECK(!gType.isUnpackedArray()); const auto& hType = instance.find("h").getType(); CHECK(hType.isUnpackedArray()); - CHECK(hType.as().range == ConstantRange{ 0, 1 }); + CHECK(hType.as().range == ConstantRange{0, 1}); NO_COMPILATION_ERRORS; } @@ -933,7 +933,7 @@ endmodule NO_COMPILATION_ERRORS; auto& m = compilation.getRoot().lookupName("m").body; - for (auto& name : { "s"s, "u"s, "e"s }) { + for (auto& name : {"s"s, "u"s, "e"s}) { auto& type = m.find(name).getType(); REQUIRE(type.isPackedArray()); CHECK(type.as().range.upper() == 4); diff --git a/tests/unittests/UtilTests.cpp b/tests/unittests/UtilTests.cpp index 12e910b73..a0c74e55a 100644 --- a/tests/unittests/UtilTests.cpp +++ b/tests/unittests/UtilTests.cpp @@ -120,7 +120,7 @@ TEST_CASE("Test CommandLine -- nonspan") { CommandLine cmdLine; cmdLine.add("-a", a, "SDF"); - std::array args = { "prog", "-a" }; + std::array args = {"prog", "-a"}; CHECK(cmdLine.parse((int)args.size(), args.data())); CHECK(a == true); @@ -145,12 +145,12 @@ TEST_CASE("Test CommandLine -- vectors") { CHECK(cmdLine.parse("prog -a 1 --longa 99 -f fff --longf=ffff -e 4.1 " "-d 5 -d 5 -d 5 --longc 8 -c 9 -b -42 -b -43"sv)); - CHECK(groupa == std::vector{ 1, 99 }); - CHECK(groupb == std::vector{ -42ll, -43ll }); - CHECK(groupc == std::vector{ 8u, 9u }); - CHECK(groupd == std::vector{ 5ull, 5ull, 5ull }); - CHECK(groupe == std::vector{ 4.1 }); - CHECK(groupf == std::vector{ "fff"s, "ffff"s }); + CHECK(groupa == std::vector{1, 99}); + CHECK(groupb == std::vector{-42ll, -43ll}); + CHECK(groupc == std::vector{8u, 9u}); + CHECK(groupd == std::vector{5ull, 5ull, 5ull}); + CHECK(groupe == std::vector{4.1}); + CHECK(groupf == std::vector{"fff"s, "ffff"s}); } TEST_CASE("Test CommandLine -- splitting") { @@ -162,7 +162,7 @@ TEST_CASE("Test CommandLine -- splitting") { auto args = R"(prog -a \ -a \-a asdf '--longa=bar baz bif \' -a "f foo \" biz \\" -a 1)"sv; CHECK(cmdLine.parse(args)); - CHECK(stuff == std::vector{ " -a"s, "asdf"s, "bar baz bif \\"s, "f foo \" biz \\"s, "1"s }); + CHECK(stuff == std::vector{" -a"s, "asdf"s, "bar baz bif \\"s, "f foo \" biz \\"s, "1"s}); } TEST_CASE("Test CommandLine -- comments") { @@ -183,7 +183,7 @@ foo#comment!! CHECK(cmdLine.parse(args, options)); CHECK(stuff == - std::vector{ "foo"s, "foo/bar//not_comment"s, "foo/bar/*/not_comment/*"s, "value"s }); + std::vector{"foo"s, "foo/bar//not_comment"s, "foo/bar/*/not_comment/*"s, "value"s}); } TEST_CASE("Test CommandLine -- env vars") { @@ -208,7 +208,7 @@ asdf/$FOO_456/bar "$(BAR#)" ${UNK} ${BAZ} ${ CHECK(cmdLine.parse(args, options)); CHECK(stuff == - std::vector{ "$&"s, "asdf/abc"s, "123/bar"s, "some string"s, "987654"s, "${"s, "$"s }); + std::vector{"$&"s, "asdf/abc"s, "123/bar"s, "some string"s, "987654"s, "${"s, "$"s}); } TEST_CASE("Test CommandLine -- programmer errors") { diff --git a/tests/unittests/VisitorTests.cpp b/tests/unittests/VisitorTests.cpp index 20a7a4a6b..58ba26071 100644 --- a/tests/unittests/VisitorTests.cpp +++ b/tests/unittests/VisitorTests.cpp @@ -135,14 +135,14 @@ TEST_CASE("Advance rewriting") { if (!portList) return; - auto& argA = - factory.functionPort(nullptr, {}, {}, {}, nullptr, - factory.declarator(makeId("argA"), nullptr, nullptr)); + auto& argA = factory.functionPort(nullptr, {}, {}, {}, nullptr, + factory.declarator(makeId("argA"), nullptr, + nullptr)); insertAtFront(portList->ports, argA, makeComma()); - auto& argZ = - factory.functionPort(nullptr, {}, {}, {}, nullptr, - factory.declarator(makeId("argZ"), nullptr, nullptr)); + auto& argZ = factory.functionPort(nullptr, {}, {}, {}, nullptr, + factory.declarator(makeId("argZ"), nullptr, + nullptr)); insertAtBack(portList->ports, argZ, makeComma()); } }; @@ -205,14 +205,14 @@ endmodule if (!portList) return; - auto& argA = - factory.functionPort(nullptr, {}, {}, {}, nullptr, - factory.declarator(makeId("argA"), nullptr, nullptr)); + auto& argA = factory.functionPort(nullptr, {}, {}, {}, nullptr, + factory.declarator(makeId("argA"), nullptr, + nullptr)); insertAtFront(portList->ports, argA, makeComma()); - auto& argZ = - factory.functionPort(nullptr, {}, {}, {}, nullptr, - factory.declarator(makeId("argZ"), nullptr, nullptr)); + auto& argZ = factory.functionPort(nullptr, {}, {}, {}, nullptr, + factory.declarator(makeId("argZ"), nullptr, + nullptr)); insertAtBack(portList->ports, argZ, makeComma()); } }; @@ -270,14 +270,14 @@ endmodule if (!portList) return; - auto& argA = - factory.functionPort(nullptr, {}, {}, {}, nullptr, - factory.declarator(makeId("argA"), nullptr, nullptr)); + auto& argA = factory.functionPort(nullptr, {}, {}, {}, nullptr, + factory.declarator(makeId("argA"), nullptr, + nullptr)); insertAtFront(portList->ports, argA, makeComma()); - auto& argZ = - factory.functionPort(nullptr, {}, {}, {}, nullptr, - factory.declarator(makeId("argZ"), nullptr, nullptr)); + auto& argZ = factory.functionPort(nullptr, {}, {}, {}, nullptr, + factory.declarator(makeId("argZ"), nullptr, + nullptr)); insertAtBack(portList->ports, argZ, makeComma()); } }; diff --git a/tools/driver/driver.cpp b/tools/driver/driver.cpp index 4b4f3b727..70fbe5bad 100644 --- a/tools/driver/driver.cpp +++ b/tools/driver/driver.cpp @@ -209,7 +209,7 @@ void writeToFile(string_view fileName, string_view contents) { writeToFile(std::cout, "stdout", contents); } else { - std::ofstream file{ std::string(fileName) }; + std::ofstream file{std::string(fileName)}; writeToFile(file, fileName, contents); } }