Skip to content

Commit

Permalink
style: pre-commit fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] committed Oct 16, 2023
1 parent 893a740 commit 26a3001
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
13 changes: 7 additions & 6 deletions include/slang/util/Iterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -339,26 +339,27 @@ class iterator_facade {

/// @brief Random access operator, requires <code>Derived::advance()</code>
template<typename T = self_type, detail::advance_type_arg<T> D>
[[nodiscard]] constexpr decltype(auto) operator[](D off) const noexcept(
detail::has_nothrow_advance<self_type, D>&& detail::has_nothrow_dereference<self_type>) {
[[nodiscard]] constexpr decltype(auto) operator[](D off) const
noexcept(detail::has_nothrow_advance<self_type, D> &&
detail::has_nothrow_dereference<self_type>) {
return (self() + off).dereference();
}

/// @brief Distance between two iterators or iterator and sentinel pair,
/// requires <code>Derived::distance_to()</code>
template<detail::has_distance_to<self_type> T>
[[nodiscard]] friend constexpr decltype(auto) operator-(
const T& left,
const self_type& right) noexcept(detail::has_nothrow_distance_to<T, self_type>) {
const T & left,
const self_type & right) noexcept(detail::has_nothrow_distance_to<T, self_type>) {
return right.distance_to(left);
}

/// @brief Distance between an iterator and a sentinel,
/// requires <code>Derived::distance_to()</code>
template<detail::has_distance_to<self_type> Sentinel>
[[nodiscard]] friend constexpr decltype(auto) operator-(
const self_type& left,
const Sentinel& right) noexcept(detail::has_nothrow_distance_to<Sentinel, self_type>) {
const self_type & left,
const Sentinel & right) noexcept(detail::has_nothrow_distance_to<Sentinel, self_type>) {
return -(right - left);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/unittests/Test.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning( \
disable : 4459) // annoying warning about global "alloc" being shadowed by locals
disable : 4459) // annoying warning about global "alloc" being shadowed by locals
#endif

#include <catch2/catch_test_macros.hpp>
Expand Down
6 changes: 3 additions & 3 deletions tests/unittests/ast/PortTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ module mh22(ref wire x); endmodule
auto def = compilation.getRoot().find(moduleName); \
REQUIRE(def); \
auto& body = def->as<InstanceSymbol>().body; \
auto& port = body.findPort(name)->as<PortSymbol>(); \
auto& port = body.findPort(name) -> as<PortSymbol>(); \
CHECK(port.direction == ArgumentDirection::dir); \
CHECK(port.getType().toString() == (type)); \
if (nt) { \
Expand Down Expand Up @@ -125,7 +125,7 @@ module m6(I.bar bar); endmodule
auto def = compilation.getDefinition(moduleName, compilation.getRoot()); \
REQUIRE(def); \
auto& inst = InstanceSymbol::createDefault(compilation, *def, nullptr); \
auto& port = inst.body.findPort(name)->as<PortSymbol>(); \
auto& port = inst.body.findPort(name) -> as<PortSymbol>(); \
CHECK(port.direction == ArgumentDirection::dir); \
CHECK(port.getType().toString() == (type)); \
if (nt) { \
Expand All @@ -139,7 +139,7 @@ module m6(I.bar bar); endmodule
auto def = compilation.getDefinition(moduleName, compilation.getRoot()); \
REQUIRE(def); \
auto& inst = InstanceSymbol::createDefault(compilation, *def, nullptr); \
auto& port = inst.body.findPort(portName)->as<InterfacePortSymbol>(); \
auto& port = inst.body.findPort(portName) -> as<InterfacePortSymbol>(); \
REQUIRE(port.interfaceDef); \
CHECK(port.interfaceDef->name == (ifaceName)); \
if (*(modportName)) { \
Expand Down

0 comments on commit 26a3001

Please sign in to comment.