Everywhere: Run clang-format
The following command was used to clang-format these files: clang-format-16 -i $(find . \ -not \( -path "./\.*" -prune \) \ -not \( -path "./Base/*" -prune \) \ -not \( -path "./Build/*" -prune \) \ -not \( -path "./Toolchain/*" -prune \) \ -not \( -path "./Ports/*" -prune \) \ -type f -name "*.cpp" -o -name "*.h")
This commit is contained in:
parent
388d455575
commit
aff81d318b
Notes:
sideshowbarker
2024-07-16 23:05:02 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/aff81d318b Pull-request: https://github.com/SerenityOS/serenity/pull/19876 Reviewed-by: https://github.com/ADKaster ✅ Reviewed-by: https://github.com/BertalanD
17 changed files with 49 additions and 54 deletions
AK
Kernel
Userland/Libraries
LibCore
LibCrypto
LibGUI
LibJS
LibLine
LibWasm
LibWeb/CSS/Parser
|
@ -40,14 +40,15 @@ namespace Detail {
|
|||
|
||||
template<typename T, typename Out, typename... Args>
|
||||
inline constexpr bool IsCallableWithArguments = requires(T t) {
|
||||
{
|
||||
t(declval<Args>()...)
|
||||
} -> ConvertibleTo<Out>;
|
||||
} || requires(T t) {
|
||||
{
|
||||
t(declval<Args>()...)
|
||||
} -> SameAs<Out>;
|
||||
};
|
||||
{
|
||||
t(declval<Args>()...)
|
||||
} -> ConvertibleTo<Out>;
|
||||
} || requires(T t) {
|
||||
{
|
||||
t(declval<Args>()...)
|
||||
} -> SameAs<Out>;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
using Detail::IsCallableWithArguments;
|
||||
|
|
|
@ -32,9 +32,9 @@ namespace AK {
|
|||
// Concept to detect types which look like timespec without requiring the type.
|
||||
template<typename T>
|
||||
concept TimeSpecType = requires(T t) {
|
||||
t.tv_sec;
|
||||
t.tv_nsec;
|
||||
};
|
||||
t.tv_sec;
|
||||
t.tv_nsec;
|
||||
};
|
||||
|
||||
constexpr bool is_leap_year(int year)
|
||||
{
|
||||
|
|
|
@ -220,8 +220,7 @@ struct Empty {
|
|||
};
|
||||
|
||||
template<typename T>
|
||||
concept NotLvalueReference = !
|
||||
IsLvalueReference<T>;
|
||||
concept NotLvalueReference = !IsLvalueReference<T>;
|
||||
|
||||
template<NotLvalueReference... Ts>
|
||||
struct Variant
|
||||
|
|
|
@ -31,13 +31,13 @@ struct CanBePlacedInsideVectorHelper;
|
|||
template<typename StorageType>
|
||||
struct CanBePlacedInsideVectorHelper<StorageType, true> {
|
||||
template<typename U>
|
||||
static constexpr bool value = requires(U && u) { StorageType { &u }; };
|
||||
static constexpr bool value = requires(U&& u) { StorageType { &u }; };
|
||||
};
|
||||
|
||||
template<typename StorageType>
|
||||
struct CanBePlacedInsideVectorHelper<StorageType, false> {
|
||||
template<typename U>
|
||||
static constexpr bool value = requires(U && u) { StorageType(forward<U>(u)); };
|
||||
static constexpr bool value = requires(U&& u) { StorageType(forward<U>(u)); };
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -31,8 +31,7 @@ enum class InterruptsState;
|
|||
|
||||
// FIXME This needs to go behind some sort of platform abstraction
|
||||
// it is used between Thread and Processor.
|
||||
struct [[gnu::aligned(16)]] FPUState
|
||||
{
|
||||
struct [[gnu::aligned(16)]] FPUState {
|
||||
u8 buffer[512];
|
||||
};
|
||||
|
||||
|
|
|
@ -45,8 +45,7 @@ extern "C" void thread_context_first_enter(void);
|
|||
extern "C" void exit_kernel_thread(void);
|
||||
extern "C" void do_assume_context(Thread* thread, u32 flags);
|
||||
|
||||
struct [[gnu::aligned(64), gnu::packed]] FPUState
|
||||
{
|
||||
struct [[gnu::aligned(64), gnu::packed]] FPUState {
|
||||
SIMD::LegacyRegion legacy_region;
|
||||
SIMD::Header xsave_header;
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ protected:
|
|||
{
|
||||
VERIFY(b.blocker_type() == Thread::Blocker::Type::Routing);
|
||||
auto& blocker = static_cast<ARPTableBlocker&>(b);
|
||||
auto maybe_mac_address = arp_table().with([&](auto const& table) -> auto{
|
||||
auto maybe_mac_address = arp_table().with([&](auto const& table) -> auto {
|
||||
return table.get(blocker.ip_address());
|
||||
});
|
||||
if (!maybe_mac_address.has_value())
|
||||
|
@ -95,7 +95,7 @@ bool ARPTableBlocker::setup_blocker()
|
|||
|
||||
void ARPTableBlocker::will_unblock_immediately_without_blocking(UnblockImmediatelyReason)
|
||||
{
|
||||
auto addr = arp_table().with([&](auto const& table) -> auto{
|
||||
auto addr = arp_table().with([&](auto const& table) -> auto {
|
||||
return table.get(ip_address());
|
||||
});
|
||||
|
||||
|
@ -297,11 +297,11 @@ RoutingDecision route_to(IPv4Address const& target, IPv4Address const& source, R
|
|||
if (adapter == NetworkingManagement::the().loopback_adapter())
|
||||
return { adapter, adapter->mac_address() };
|
||||
|
||||
if ((target_addr & IPv4Address { 240, 0, 0, 0 }.to_u32()) == IPv4Address { 224, 0, 0, 0 }.to_u32())
|
||||
if ((target_addr & (IPv4Address { 240, 0, 0, 0 }.to_u32())) == IPv4Address { 224, 0, 0, 0 }.to_u32())
|
||||
return { adapter, multicast_ethernet_address(target) };
|
||||
|
||||
{
|
||||
auto addr = arp_table().with([&](auto const& table) -> auto{
|
||||
auto addr = arp_table().with([&](auto const& table) -> auto {
|
||||
return table.get(next_hop_ip);
|
||||
});
|
||||
if (addr.has_value()) {
|
||||
|
|
|
@ -20,8 +20,8 @@ namespace Kernel {
|
|||
|
||||
namespace Syscall {
|
||||
|
||||
using Handler = auto(Process::*)(FlatPtr, FlatPtr, FlatPtr, FlatPtr) -> ErrorOr<FlatPtr>;
|
||||
using HandlerWithRegisterState = auto(Process::*)(RegisterState&) -> ErrorOr<FlatPtr>;
|
||||
using Handler = auto (Process::*)(FlatPtr, FlatPtr, FlatPtr, FlatPtr) -> ErrorOr<FlatPtr>;
|
||||
using HandlerWithRegisterState = auto (Process::*)(RegisterState&) -> ErrorOr<FlatPtr>;
|
||||
|
||||
struct HandlerMetadata {
|
||||
Handler handler;
|
||||
|
|
|
@ -771,7 +771,7 @@ void ArgsParser::autocomplete(FILE* file, StringView program_name, ReadonlySpan<
|
|||
|
||||
// Look for a long option
|
||||
auto option_pattern = argument.substring_view(2);
|
||||
auto it = m_options.find_if([&](auto& option) { return option.hide_mode != OptionHideMode::None && StringView { option.long_name, strlen(option.long_name) } == option_pattern; });
|
||||
auto it = m_options.find_if([&](auto& option) { return (option.hide_mode != OptionHideMode::None) && StringView { option.long_name, strlen(option.long_name) } == option_pattern; });
|
||||
if (it.is_end())
|
||||
continue;
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ void CRC32::update(ReadonlyBytes span)
|
|||
}
|
||||
};
|
||||
|
||||
// FIXME: On Intel, use _mm_crc32_u8 / _mm_crc32_u64 if available (SSE 4.2).
|
||||
// FIXME: On Intel, use _mm_crc32_u8 / _mm_crc32_u64 if available (SSE 4.2).
|
||||
|
||||
#else
|
||||
|
||||
|
|
|
@ -17,8 +17,8 @@ public:
|
|||
template<typename PRF>
|
||||
static ErrorOr<ByteBuffer> derive_key(ReadonlyBytes password, ReadonlyBytes salt, u32 iterations, u32 key_length_bytes)
|
||||
requires requires(PRF t) {
|
||||
t.digest_size();
|
||||
}
|
||||
t.digest_size();
|
||||
}
|
||||
{
|
||||
PRF prf(password);
|
||||
|
||||
|
|
|
@ -17,10 +17,10 @@ template<typename T, typename Container = Vector<T>, typename ColumnNameListType
|
|||
class ItemListModel : public Model {
|
||||
public:
|
||||
static constexpr auto IsTwoDimensional = requires(Container data) {
|
||||
requires !IsVoid<ColumnNameListType>;
|
||||
data.at(0).at(0);
|
||||
data.at(0).size();
|
||||
};
|
||||
requires !IsVoid<ColumnNameListType>;
|
||||
data.at(0).at(0);
|
||||
data.at(0).size();
|
||||
};
|
||||
|
||||
// Substitute 'void' for a dummy u8.
|
||||
using ColumnNamesT = Conditional<IsVoid<ColumnNameListType>, u8, ColumnNameListType>;
|
||||
|
|
|
@ -241,11 +241,11 @@ private:
|
|||
|
||||
template<typename Func, typename... Args>
|
||||
concept ThrowCompletionOrVoidFunction = requires(Func func, Args... args) {
|
||||
{
|
||||
func(args...)
|
||||
}
|
||||
-> SameAs<ThrowCompletionOr<void>>;
|
||||
};
|
||||
{
|
||||
func(args...)
|
||||
}
|
||||
-> SameAs<ThrowCompletionOr<void>>;
|
||||
};
|
||||
|
||||
template<typename... Args>
|
||||
class ThrowCompletionOrVoidCallback : public Function<ThrowCompletionOr<void>(Args...)> {
|
||||
|
|
|
@ -560,7 +560,7 @@ void Editor::initialize()
|
|||
m_configuration.set(Configuration::NonInteractive);
|
||||
} else {
|
||||
auto* term = getenv("TERM");
|
||||
if (term != NULL && StringView { term, strlen(term) }.starts_with("xterm"sv))
|
||||
if ((term != NULL) && StringView { term, strlen(term) }.starts_with("xterm"sv))
|
||||
m_configuration.set(Configuration::Full);
|
||||
else
|
||||
m_configuration.set(Configuration::NoEscapeSequences);
|
||||
|
|
|
@ -402,15 +402,16 @@ void Printer::print(Wasm::ImportSection::Import const& import)
|
|||
{
|
||||
TemporaryChange change { m_indent, m_indent + 1 };
|
||||
import.description().visit(
|
||||
[this](auto const& type) { print(type);
|
||||
},
|
||||
[this](auto const& type) {
|
||||
print(type);
|
||||
},
|
||||
[this](TypeIndex const& index) {
|
||||
print_indent();
|
||||
print("(type index {})\n", index.value());
|
||||
print_indent();
|
||||
print("(type index {})\n", index.value());
|
||||
});
|
||||
}
|
||||
print_indent();
|
||||
print(")\n");
|
||||
}
|
||||
print_indent();
|
||||
print(")\n");
|
||||
}
|
||||
|
||||
void Printer::print(Wasm::Instruction const& instruction)
|
||||
|
|
|
@ -930,11 +930,9 @@ struct InvocationOf<impl> {
|
|||
|
||||
return HostFunction(
|
||||
[&self, function_name](Configuration& configuration, Vector<Value>& arguments) -> Wasm::Result {
|
||||
Tuple args = [&]<typename... Ts, auto... Is>(IndexSequence<Is...>)
|
||||
{
|
||||
Tuple args = [&]<typename... Ts, auto... Is>(IndexSequence<Is...>) {
|
||||
return Tuple { ABI::deserialize(ABI::to_compatible_value<Ts>(arguments[Is]))... };
|
||||
}
|
||||
.template operator()<Args...>(MakeIndexSequence<sizeof...(Args)>());
|
||||
}.template operator()<Args...>(MakeIndexSequence<sizeof...(Args)>());
|
||||
|
||||
auto result = args.apply_as_args([&](auto&&... impl_args) { return (self.*impl)(configuration, impl_args...); });
|
||||
dbgln_if(WASI_DEBUG, "WASI: {}({}) = {}", function_name, arguments, result);
|
||||
|
@ -948,8 +946,7 @@ struct InvocationOf<impl> {
|
|||
if constexpr (!IsVoid<R>) {
|
||||
// Return values are passed as pointers, after the arguments
|
||||
if constexpr (requires { &R::serialize_into; }) {
|
||||
constexpr auto ResultCount = []<auto N>(void(R::*)(Array<Bytes, N>) const) { return N; }
|
||||
(&R::serialize_into);
|
||||
constexpr auto ResultCount = []<auto N>(void (R::*)(Array<Bytes, N>) const) { return N; }(&R::serialize_into);
|
||||
ABI::serialize(*value.result(), address_spans<ResultCount>(arguments.span().slice(sizeof...(Args)), configuration));
|
||||
} else {
|
||||
ABI::serialize(*value.result(), address_spans<1>(arguments.span().slice(sizeof...(Args)), configuration));
|
||||
|
|
|
@ -6246,8 +6246,7 @@ ErrorOr<RefPtr<StyleValue>> Parser::parse_filter_value_list_value(Vector<Compone
|
|||
} else if (filter_token == FilterToken::DropShadow) {
|
||||
if (!tokens.has_next_token())
|
||||
return {};
|
||||
auto next_token = [&]() -> auto&
|
||||
{
|
||||
auto next_token = [&]() -> auto& {
|
||||
auto& token = tokens.next_token();
|
||||
tokens.skip_whitespace();
|
||||
return token;
|
||||
|
|
Loading…
Add table
Reference in a new issue