1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-08 05:27:14 +09:00

Meta: Enforce newlines around namespaces

This has come up several times during code review, so let's just enforce
it using a new clang-format 20 option.
This commit is contained in:
Timothy Flynn 2025-05-13 07:06:33 -04:00 committed by Andrew Kaster
parent ca9f3673c5
commit 7280ed6312
Notes: github-actions[bot] 2025-05-14 08:06:48 +00:00
206 changed files with 448 additions and 0 deletions

View file

@ -19,6 +19,7 @@ RemoveSemicolon: true
RequiresClausePosition: WithFollowing RequiresClausePosition: WithFollowing
RequiresExpressionIndentation: OuterScope RequiresExpressionIndentation: OuterScope
SpaceAfterTemplateKeyword: false SpaceAfterTemplateKeyword: false
WrapNamespaceBodyWithEmptyLines: Always
--- ---
Language: ObjC Language: ObjC

View file

@ -15,6 +15,7 @@
namespace AK { namespace AK {
namespace Detail { namespace Detail {
// This type serves as the storage of 0-sized `AK::Array`s. While zero-length `T[0]` // This type serves as the storage of 0-sized `AK::Array`s. While zero-length `T[0]`
// is accepted as a GNU extension, it causes problems with UBSan in Clang 16. // is accepted as a GNU extension, it causes problems with UBSan in Clang 16.
template<typename T> template<typename T>
@ -22,6 +23,7 @@ struct EmptyArrayStorage {
T& operator[](size_t) const { VERIFY_NOT_REACHED(); } T& operator[](size_t) const { VERIFY_NOT_REACHED(); }
constexpr operator T*() const { return nullptr; } constexpr operator T*() const { return nullptr; }
}; };
} }
template<typename T, size_t Size> template<typename T, size_t Size>
@ -148,11 +150,13 @@ template<typename T, typename... Types>
Array(T, Types...) -> Array<T, sizeof...(Types) + 1>; Array(T, Types...) -> Array<T, sizeof...(Types) + 1>;
namespace Detail { namespace Detail {
template<typename T, size_t... Is> template<typename T, size_t... Is>
constexpr auto integer_sequence_generate_array([[maybe_unused]] T const offset, IntegerSequence<T, Is...>) -> Array<T, sizeof...(Is)> constexpr auto integer_sequence_generate_array([[maybe_unused]] T const offset, IntegerSequence<T, Is...>) -> Array<T, sizeof...(Is)>
{ {
return { { (offset + Is)... } }; return { { (offset + Is)... } };
} }
} }
template<typename T, T N> template<typename T, T N>
@ -163,11 +167,13 @@ constexpr auto iota_array(T const offset = {})
} }
namespace Detail { namespace Detail {
template<typename T, size_t N, size_t... Is> template<typename T, size_t N, size_t... Is>
constexpr auto to_array_impl(T (&&a)[N], IndexSequence<Is...>) -> Array<T, sizeof...(Is)> constexpr auto to_array_impl(T (&&a)[N], IndexSequence<Is...>) -> Array<T, sizeof...(Is)>
{ {
return { { a[Is]... } }; return { { a[Is]... } };
} }
} }
template<typename T, size_t N> template<typename T, size_t N>

View file

@ -455,6 +455,7 @@ public:
return __atomic_is_lock_free(sizeof(m_value), &m_value); return __atomic_is_lock_free(sizeof(m_value), &m_value);
} }
}; };
} }
#if USING_AK_GLOBALLY #if USING_AK_GLOBALLY

View file

@ -126,11 +126,13 @@ consteval auto count_fmt_params(char const (&fmt)[N])
} }
return result; return result;
} }
} }
#endif #endif
namespace AK::Format::Detail { namespace AK::Format::Detail {
template<typename... Args> template<typename... Args>
struct CheckedFormatString { struct CheckedFormatString {
template<size_t N> template<size_t N>
@ -206,6 +208,7 @@ private:
StringView m_string; StringView m_string;
}; };
} }
namespace AK { namespace AK {

View file

@ -170,6 +170,7 @@ concept CallableAs = Detail::IsCallableWithArguments<Func, R, Args...>;
#if !USING_AK_GLOBALLY #if !USING_AK_GLOBALLY
namespace AK { namespace AK {
#endif #endif
using AK::Concepts::Arithmetic; using AK::Concepts::Arithmetic;
using AK::Concepts::ArrayLike; using AK::Concepts::ArrayLike;
@ -195,5 +196,6 @@ using AK::Concepts::SpecializationOf;
using AK::Concepts::Unsigned; using AK::Concepts::Unsigned;
using AK::Concepts::VoidFunction; using AK::Concepts::VoidFunction;
#if !USING_AK_GLOBALLY #if !USING_AK_GLOBALLY
} }
#endif #endif

View file

@ -46,6 +46,7 @@ namespace AK {
*/ */
namespace DistinctNumericFeature { namespace DistinctNumericFeature {
enum Arithmetic { }; enum Arithmetic { };
enum CastToBool { }; enum CastToBool { };
enum CastToUnderlying { }; enum CastToUnderlying { };
@ -53,6 +54,7 @@ enum Comparison { };
enum Flags { }; enum Flags { };
enum Increment { }; enum Increment { };
enum Shift { }; enum Shift { };
}; };
template<typename T, typename X, typename... Opts> template<typename T, typename X, typename... Opts>
@ -304,6 +306,7 @@ struct Formatter<DistinctNumeric<T, X, Opts...>> : Formatter<T> {
return Formatter<T>::format(builder, value.value()); return Formatter<T>::format(builder, value.value());
} }
}; };
} }
#define AK_TYPEDEF_DISTINCT_NUMERIC_GENERAL(T, NAME, ...) \ #define AK_TYPEDEF_DISTINCT_NUMERIC_GENERAL(T, NAME, ...) \

View file

@ -11,6 +11,7 @@
namespace AK { namespace AK {
namespace Detail { namespace Detail {
template<typename Iterable> template<typename Iterable>
class Enumerator { class Enumerator {
using IteratorType = decltype(declval<Iterable>().begin()); using IteratorType = decltype(declval<Iterable>().begin());
@ -50,6 +51,7 @@ private:
IteratorType m_iterator; IteratorType m_iterator;
IteratorType const m_end; IteratorType const m_end;
}; };
} }
template<typename T> template<typename T>

View file

@ -14,10 +14,12 @@
namespace AK { namespace AK {
namespace Detail { namespace Detail {
template<size_t inline_capacity> template<size_t inline_capacity>
class ByteBuffer; class ByteBuffer;
class StringData; class StringData;
} }
enum class TrailingCodePointTransformation : u8; enum class TrailingCodePointTransformation : u8;

View file

@ -57,6 +57,7 @@ namespace AK {
#endif #endif
namespace Detail { namespace Detail {
#ifdef AK_HAS_OBJC_ARC #ifdef AK_HAS_OBJC_ARC
inline constexpr bool HaveObjcArc = true; inline constexpr bool HaveObjcArc = true;
#else #else
@ -65,6 +66,7 @@ inline constexpr bool HaveObjcArc = false;
// validated in TestFunction.mm // validated in TestFunction.mm
inline constexpr size_t block_layout_size = 32; inline constexpr size_t block_layout_size = 32;
} }
template<typename> template<typename>

View file

@ -13,6 +13,7 @@
#include <AK/Utf16View.h> #include <AK/Utf16View.h>
namespace AK { namespace AK {
// Consume a number of characters // Consume a number of characters
StringView GenericLexer::consume(size_t count) StringView GenericLexer::consume(size_t count)
{ {

View file

@ -70,6 +70,7 @@ template<typename T, typename... Ts>
{ {
return (... && (forward<T>(to_compare) >= forward<Ts>(valid_values))); return (... && (forward<T>(to_compare) >= forward<Ts>(valid_values)));
} }
} }
#if USING_AK_GLOBALLY #if USING_AK_GLOBALLY

View file

@ -793,6 +793,7 @@ private:
size_t m_size { 0 }; size_t m_size { 0 };
size_t m_capacity { 0 }; size_t m_capacity { 0 };
}; };
} }
#if USING_AK_GLOBALLY #if USING_AK_GLOBALLY

View file

@ -48,6 +48,7 @@ private:
HashTable<int> m_allocated_ids; HashTable<int> m_allocated_ids;
int m_minimum_value { 1 }; int m_minimum_value { 1 };
}; };
} }
#if USING_AK_GLOBALLY #if USING_AK_GLOBALLY

View file

@ -35,6 +35,7 @@ template<FloatingPoint T>
constexpr T L2_E = 1.442695040888963407359924681001892137L; constexpr T L2_E = 1.442695040888963407359924681001892137L;
namespace Details { namespace Details {
template<size_t> template<size_t>
constexpr size_t product_even(); constexpr size_t product_even();
template<> template<>
@ -48,6 +49,7 @@ template<>
constexpr size_t product_odd<1>() { return 1; } constexpr size_t product_odd<1>() { return 1; }
template<size_t value> template<size_t value>
constexpr size_t product_odd() { return value * product_odd<value - 2>(); } constexpr size_t product_odd() { return value * product_odd<value - 2>(); }
} }
template<FloatingPoint T> template<FloatingPoint T>
@ -103,6 +105,7 @@ constexpr T fabs(T x)
} }
namespace Rounding { namespace Rounding {
template<FloatingPoint T> template<FloatingPoint T>
constexpr T ceil(T num) constexpr T ceil(T num)
{ {
@ -385,6 +388,7 @@ using Rounding::round_to;
using Rounding::trunc; using Rounding::trunc;
namespace Division { namespace Division {
template<FloatingPoint T> template<FloatingPoint T>
constexpr T fmod(T x, T y) constexpr T fmod(T x, T y)
{ {
@ -462,6 +466,7 @@ constexpr T remainder(T x, T y)
return __builtin_remainderf(x, y); return __builtin_remainderf(x, y);
#endif #endif
} }
} }
using Division::fmod; using Division::fmod;
@ -1036,6 +1041,7 @@ constexpr I clamp_to(T value)
#undef CONSTEXPR_STATE #undef CONSTEXPR_STATE
#undef AARCH64_INSTRUCTION #undef AARCH64_INSTRUCTION
} }
#if USING_AK_GLOBALLY #if USING_AK_GLOBALLY

View file

@ -15,6 +15,7 @@
namespace AK { namespace AK {
namespace Detail { namespace Detail {
constexpr void const* bitap_bitwise(void const* haystack, size_t haystack_length, void const* needle, size_t needle_length) constexpr void const* bitap_bitwise(void const* haystack, size_t haystack_length, void const* needle, size_t needle_length)
{ {
VERIFY(needle_length < 32); VERIFY(needle_length < 32);
@ -40,6 +41,7 @@ constexpr void const* bitap_bitwise(void const* haystack, size_t haystack_length
return nullptr; return nullptr;
} }
} }
template<typename HaystackIterT> template<typename HaystackIterT>

View file

@ -53,6 +53,7 @@ struct Traits<NonnullRawPtr<T>> : public DefaultTraits<NonnullRawPtr<T>> {
}; };
namespace Detail { namespace Detail {
template<typename T> template<typename T>
inline constexpr bool IsHashCompatible<NonnullRawPtr<T>, T> = true; inline constexpr bool IsHashCompatible<NonnullRawPtr<T>, T> = true;

View file

@ -17,6 +17,7 @@
namespace AK { namespace AK {
namespace Detail { namespace Detail {
template<auto condition, typename T> template<auto condition, typename T>
struct ConditionallyResultType; struct ConditionallyResultType;
@ -29,6 +30,7 @@ template<typename T>
struct ConditionallyResultType<false, T> { struct ConditionallyResultType<false, T> {
using Type = T; using Type = T;
}; };
} }
template<auto condition, typename T> template<auto condition, typename T>

View file

@ -207,6 +207,7 @@ struct Formatter<OwnPtr<T>> : Formatter<T*> {
return Formatter<T*>::format(builder, value.ptr()); return Formatter<T*>::format(builder, value.ptr());
} }
}; };
} }
#if USING_AK_GLOBALLY #if USING_AK_GLOBALLY

View file

@ -81,6 +81,7 @@ static_assert(vector_length<i8x4> == 4);
static_assert(vector_length<f32x4> == 4); static_assert(vector_length<f32x4> == 4);
namespace Detail { namespace Detail {
template<typename T> template<typename T>
struct IndexVectorFor; struct IndexVectorFor;
@ -113,4 +114,5 @@ static_assert(IsSame<IndexVectorFor<u64x4>, u64x4>);
static_assert(IsSame<IndexVectorFor<f32x4>, u32x4>); static_assert(IsSame<IndexVectorFor<f32x4>, u32x4>);
static_assert(IsSame<IndexVectorFor<f64x4>, u64x4>); static_assert(IsSame<IndexVectorFor<f64x4>, u64x4>);
#endif #endif
} }

View file

@ -185,6 +185,7 @@ ALWAYS_INLINE static void store4_masked(VectorType v, UnderlyingType* a, Underly
// Shuffle // Shuffle
namespace Detail { namespace Detail {
template<SIMDVector T, SIMDVector Control, size_t... Idx> template<SIMDVector T, SIMDVector Control, size_t... Idx>
ALWAYS_INLINE static T shuffle_impl(T a, Control control, IndexSequence<Idx...>) ALWAYS_INLINE static T shuffle_impl(T a, Control control, IndexSequence<Idx...>)
{ {

View file

@ -12,6 +12,7 @@
#include <AK/StringBuilder.h> #include <AK/StringBuilder.h>
namespace AK { namespace AK {
template<bool = true> template<bool = true>
class ScopeLogger { class ScopeLogger {
public: public:

View file

@ -300,6 +300,7 @@ private:
Node* m_tail { nullptr }; Node* m_tail { nullptr };
TSizeCalculationPolicy m_size_policy {}; TSizeCalculationPolicy m_size_policy {};
}; };
} }
#if USING_AK_GLOBALLY #if USING_AK_GLOBALLY

View file

@ -660,6 +660,7 @@ using EquivalentFunctionType = typename EquivalentFunctionTypeImpl<Callable>::Ty
#if !USING_AK_GLOBALLY #if !USING_AK_GLOBALLY
namespace AK { namespace AK {
#endif #endif
using AK::Detail::AddConst; using AK::Detail::AddConst;
using AK::Detail::AddConstToReferencedType; using AK::Detail::AddConstToReferencedType;
@ -738,5 +739,6 @@ using AK::Detail::TrueType;
using AK::Detail::UnderlyingType; using AK::Detail::UnderlyingType;
using AK::Detail::Void; using AK::Detail::Void;
#if !USING_AK_GLOBALLY #if !USING_AK_GLOBALLY
} }
#endif #endif

View file

@ -35,13 +35,16 @@ void compiletime_fail(Args...);
using std::construct_at; using std::construct_at;
using std::forward; using std::forward;
using std::move; using std::move;
} }
namespace AK::Detail { namespace AK::Detail {
template<typename T> template<typename T>
struct _RawPtr { struct _RawPtr {
using Type = T*; using Type = T*;
}; };
} }
namespace AK { namespace AK {

View file

@ -48,4 +48,5 @@ ErrorOr<StringBase> StringBase::substring_from_byte_offset_with_shared_superstri
} }
return StringBase { TRY(Detail::StringData::create_substring(*m_impl.data, start, length)) }; return StringBase { TRY(Detail::StringData::create_substring(*m_impl.data, start, length)) };
} }
} }

View file

@ -264,4 +264,5 @@ inline bool StringBase::operator==(StringBase const& other) const
return m_impl.data == other.m_impl.data; return m_impl.data == other.m_impl.data;
return bytes() == other.bytes(); return bytes() == other.bytes();
} }
} }

View file

@ -14,8 +14,10 @@
namespace AK { namespace AK {
namespace Detail { namespace Detail {
template<Concepts::AnyString T, Concepts::AnyString U> template<Concepts::AnyString T, Concepts::AnyString U>
inline constexpr bool IsHashCompatible<T, U> = true; inline constexpr bool IsHashCompatible<T, U> = true;
} }
enum class CaseSensitivity { enum class CaseSensitivity {

View file

@ -204,6 +204,7 @@ Duration Duration::from_half_sanitized(i64 seconds, i32 extra_seconds, u32 nanos
} }
namespace { namespace {
#if defined(AK_OS_WINDOWS) #if defined(AK_OS_WINDOWS)
# define CLOCK_REALTIME 0 # define CLOCK_REALTIME 0
# define CLOCK_MONOTONIC 1 # define CLOCK_MONOTONIC 1

View file

@ -83,6 +83,7 @@ constexpr int weeks_in_year(int year)
} }
namespace Detail { namespace Detail {
// Integer division rounding towards negative infinity. // Integer division rounding towards negative infinity.
// TODO: This feels like there should be an easier way to do this. // TODO: This feels like there should be an easier way to do this.
template<int divisor> template<int divisor>
@ -100,6 +101,7 @@ constexpr i64 mod_zeros_in_range(i64 begin, i64 end)
{ {
return floor_div_by<positive_mod>(end - 1) - floor_div_by<positive_mod>(begin - 1); return floor_div_by<positive_mod>(end - 1) - floor_div_by<positive_mod>(begin - 1);
} }
} }
constexpr i64 years_to_days_since_epoch(int year) constexpr i64 years_to_days_since_epoch(int year)

View file

@ -161,7 +161,9 @@ constexpr u64 PiB = KiB * KiB * KiB * KiB * KiB;
constexpr u64 EiB = KiB * KiB * KiB * KiB * KiB * KiB; constexpr u64 EiB = KiB * KiB * KiB * KiB * KiB * KiB;
namespace AK_REPLACED_STD_NAMESPACE { // NOLINT(cert-dcl58-cpp) nullptr_t must be in ::std:: for some analysis tools namespace AK_REPLACED_STD_NAMESPACE { // NOLINT(cert-dcl58-cpp) nullptr_t must be in ::std:: for some analysis tools
using nullptr_t = decltype(nullptr); using nullptr_t = decltype(nullptr);
} }
namespace AK { namespace AK {

View file

@ -21,6 +21,7 @@
namespace AK { namespace AK {
namespace Detail { namespace Detail {
// As noted near the declaration of StaticStorage, bit_size is more like a hint for a storage size. // As noted near the declaration of StaticStorage, bit_size is more like a hint for a storage size.
// The effective bit size is `sizeof(StaticStorage<...>) * 8`. It is a programmer's responsibility // The effective bit size is `sizeof(StaticStorage<...>) * 8`. It is a programmer's responsibility
// to ensure that the hinted bit_size is always greater than the actual integer size. // to ensure that the hinted bit_size is always greater than the actual integer size.
@ -497,6 +498,7 @@ bool operator==(BuiltInUFixedInt auto const& a, NotBuiltInUFixedInt auto const&
int operator<=>(BuiltInUFixedInt auto const& a, NotBuiltInUFixedInt auto const& b) { return -b.operator<=>(a); } int operator<=>(BuiltInUFixedInt auto const& a, NotBuiltInUFixedInt auto const& b) { return -b.operator<=>(a); }
bool operator==(IntegerWrapper const& a, NotBuiltInUFixedInt auto const& b) { return b.operator==(a); } bool operator==(IntegerWrapper const& a, NotBuiltInUFixedInt auto const& b) { return b.operator==(a); }
int operator<=>(IntegerWrapper const& a, NotBuiltInUFixedInt auto const& b) { return -b.operator<=>(a); } int operator<=>(IntegerWrapper const& a, NotBuiltInUFixedInt auto const& b) { return -b.operator<=>(a); }
} }
using Detail::UFixedBigInt; using Detail::UFixedBigInt;
@ -645,6 +647,7 @@ struct Formatter<T> : StandardFormatter {
return {}; return {};
} }
}; };
} }
// these sizes should suffice for most usecases // these sizes should suffice for most usecases

View file

@ -500,6 +500,7 @@ template<typename... Ts>
struct TypeList<Variant<Ts...>> : TypeList<Ts...> { }; struct TypeList<Variant<Ts...>> : TypeList<Ts...> { };
namespace Detail { namespace Detail {
template<typename T1, typename T2> template<typename T1, typename T2>
struct FlattenVariant; struct FlattenVariant;

View file

@ -39,6 +39,7 @@ struct CanBePlacedInsideVectorHelper<StorageType, false> {
template<typename U> 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)); };
}; };
} }
template<typename T, size_t inline_capacity> template<typename T, size_t inline_capacity>

View file

@ -63,7 +63,9 @@ void operator delete[](void* ptr, size_t) noexcept
// This is usually provided by libstdc++ in most cases, and the kernel has its own definition in // This is usually provided by libstdc++ in most cases, and the kernel has its own definition in
// Kernel/Heap/kmalloc.cpp. If neither of those apply, the following should suffice to not fail during linking. // Kernel/Heap/kmalloc.cpp. If neither of those apply, the following should suffice to not fail during linking.
namespace AK_REPLACED_STD_NAMESPACE { namespace AK_REPLACED_STD_NAMESPACE {
nothrow_t const nothrow; nothrow_t const nothrow;
} }
#endif #endif

View file

@ -94,6 +94,7 @@ private:
} }
namespace AK { namespace AK {
template<> template<>
struct Formatter<Core::DateTime> : StandardFormatter { struct Formatter<Core::DateTime> : StandardFormatter {
ErrorOr<void> format(FormatBuilder& builder, Core::DateTime const& value) ErrorOr<void> format(FormatBuilder& builder, Core::DateTime const& value)
@ -104,6 +105,7 @@ struct Formatter<Core::DateTime> : StandardFormatter {
value.hour(), value.minute(), value.second()); value.hour(), value.minute(), value.second());
} }
}; };
} }
namespace IPC { namespace IPC {

View file

@ -65,6 +65,7 @@ private:
} }
namespace AK { namespace AK {
template<> template<>
struct Formatter<Core::Directory> : Formatter<StringView> { struct Formatter<Core::Directory> : Formatter<StringView> {
ErrorOr<void> format(FormatBuilder& builder, Core::Directory const& directory) ErrorOr<void> format(FormatBuilder& builder, Core::Directory const& directory)

View file

@ -17,6 +17,7 @@
namespace Core { namespace Core {
namespace { namespace {
OwnPtr<Vector<EventLoop&>>& event_loop_stack_uninitialized() OwnPtr<Vector<EventLoop&>>& event_loop_stack_uninitialized()
{ {
thread_local OwnPtr<Vector<EventLoop&>> s_event_loop_stack = nullptr; thread_local OwnPtr<Vector<EventLoop&>> s_event_loop_stack = nullptr;
@ -29,6 +30,7 @@ Vector<EventLoop&>& event_loop_stack()
the_stack = make<Vector<EventLoop&>>(); the_stack = make<Vector<EventLoop&>>();
return *the_stack; return *the_stack;
} }
} }
EventLoop::EventLoop() EventLoop::EventLoop()

View file

@ -23,6 +23,7 @@
namespace Core { namespace Core {
namespace { namespace {
struct ThreadData; struct ThreadData;
class TimeoutSet; class TimeoutSet;
@ -299,6 +300,7 @@ struct ThreadData {
pid_t pid { 0 }; pid_t pid { 0 };
}; };
} }
EventLoopImplementationUnix::EventLoopImplementationUnix() EventLoopImplementationUnix::EventLoopImplementationUnix()

View file

@ -188,6 +188,7 @@ struct AK::Formatter<Core::EventReceiver> : AK::Formatter<FormatString> {
}; };
namespace Core { namespace Core {
template<typename T, typename Callback> template<typename T, typename Callback>
inline void EventReceiver::for_each_child_of_type(Callback callback) inline void EventReceiver::for_each_child_of_type(Callback callback)
requires IsBaseOf<EventReceiver, T> requires IsBaseOf<EventReceiver, T>

View file

@ -8,6 +8,7 @@
#include <LibCore/EventSwift.h> #include <LibCore/EventSwift.h>
namespace Core { namespace Core {
void deferred_invoke_block(EventLoop& event_loop, void (^invokee)(void)) void deferred_invoke_block(EventLoop& event_loop, void (^invokee)(void))
{ {
event_loop.deferred_invoke(invokee); event_loop.deferred_invoke(invokee);

View file

@ -13,6 +13,7 @@
#include <LibURL/URL.h> #include <LibURL/URL.h>
namespace Core { namespace Core {
// FIXME: Username/password support. // FIXME: Username/password support.
struct ProxyData { struct ProxyData {
enum Type { enum Type {
@ -45,6 +46,7 @@ struct ProxyData {
return proxy_data; return proxy_data;
} }
}; };
} }
namespace IPC { namespace IPC {

View file

@ -236,4 +236,5 @@ done_parsing:;
return UnixDateTime::from_unix_time_parts(year.value(), month.value(), day.value(), hour.value(), minute.value_or(0), seconds.value_or(0), milliseconds.value_or(0)); return UnixDateTime::from_unix_time_parts(year.value(), month.value(), day.value(), hour.value(), minute.value_or(0), seconds.value_or(0), milliseconds.value_or(0));
} }
} }

View file

@ -14,8 +14,10 @@
#include <LibCrypto/OpenSSL.h> #include <LibCrypto/OpenSSL.h>
namespace { namespace {
// Used by ASN1 macros // Used by ASN1 macros
static String s_error_string; static String s_error_string;
} }
namespace Crypto::Curves { namespace Crypto::Curves {

View file

@ -59,6 +59,7 @@ public:
protected: protected:
virtual ~HashFunction() = default; virtual ~HashFunction() = default;
}; };
} }
template<size_t DigestS> template<size_t DigestS>

View file

@ -22,6 +22,7 @@
#include <LibThreading/RWLockProtected.h> #include <LibThreading/RWLockProtected.h>
namespace DNS { namespace DNS {
class Resolver; class Resolver;
class LookupResult : public AtomicRefCounted<LookupResult> class LookupResult : public AtomicRefCounted<LookupResult>

View file

@ -179,6 +179,7 @@ struct Formatter<GC::Root<T>> : Formatter<T const*> {
}; };
namespace Detail { namespace Detail {
template<typename T> template<typename T>
inline constexpr bool IsHashCompatible<GC::Root<T>, T> = true; inline constexpr bool IsHashCompatible<GC::Root<T>, T> = true;

View file

@ -115,6 +115,7 @@ sk_sp<SkColorSpace>& ColorSpace::color_space()
} }
namespace IPC { namespace IPC {
template<> template<>
ErrorOr<void> encode(Encoder& encoder, Gfx::ColorSpace const& color_space) ErrorOr<void> encode(Encoder& encoder, Gfx::ColorSpace const& color_space)
{ {
@ -141,4 +142,5 @@ ErrorOr<Gfx::ColorSpace> decode(Decoder& decoder)
auto color_space = SkColorSpace::Deserialize(buffer.data(), buffer.size()); auto color_space = SkColorSpace::Deserialize(buffer.data(), buffer.size());
return Gfx::ColorSpace { make<::Gfx::Details::ColorSpaceImpl>(move(color_space)) }; return Gfx::ColorSpace { make<::Gfx::Details::ColorSpaceImpl>(move(color_space)) };
} }
} }

View file

@ -40,4 +40,5 @@ struct ColorFilter {
}; };
using Filter = Variant<BlurFilter, DropShadowFilter, HueRotateFilter, ColorFilter>; using Filter = Variant<BlurFilter, DropShadowFilter, HueRotateFilter, ColorFilter>;
} }

View file

@ -270,4 +270,5 @@ ErrorOr<Optional<ReadonlyBytes>> JPEGXLImageDecoderPlugin::icc_data()
{ {
return OptionalNone {}; return OptionalNone {};
} }
} }

View file

@ -29,7 +29,9 @@ class ExifMetadata;
// And it can be found at https://www.cipa.jp/e/std/std-sec.html // And it can be found at https://www.cipa.jp/e/std/std-sec.html
namespace TIFF { namespace TIFF {
class TIFFLoadingContext; class TIFFLoadingContext;
} }
class TIFFImageDecoderPlugin : public ImageDecoderPlugin { class TIFFImageDecoderPlugin : public ImageDecoderPlugin {

View file

@ -26,6 +26,7 @@ constexpr static Vector3<T> operator*(Matrix3x3<T> const& m, Vector3<T> const& v
typedef Matrix3x3<float> FloatMatrix3x3; typedef Matrix3x3<float> FloatMatrix3x3;
typedef Matrix3x3<double> DoubleMatrix3x3; typedef Matrix3x3<double> DoubleMatrix3x3;
} }
using Gfx::DoubleMatrix3x3; using Gfx::DoubleMatrix3x3;

View file

@ -86,6 +86,7 @@ Gfx::AffineTransform extract_2d_affine_transform(Matrix4x4<T> const& matrix)
typedef Matrix4x4<float> FloatMatrix4x4; typedef Matrix4x4<float> FloatMatrix4x4;
typedef Matrix4x4<double> DoubleMatrix4x4; typedef Matrix4x4<double> DoubleMatrix4x4;
} }
using Gfx::DoubleMatrix4x4; using Gfx::DoubleMatrix4x4;

View file

@ -134,4 +134,5 @@ constexpr SkSamplingOptions to_skia_sampling_options(Gfx::ScalingMode scaling_mo
SkPath to_skia_path(Path const& path); SkPath to_skia_path(Path const& path);
sk_sp<SkImageFilter> to_skia_image_filter(Gfx::Filter const& filter); sk_sp<SkImageFilter> to_skia_image_filter(Gfx::Filter const& filter);
sk_sp<SkBlender> to_skia_blender(Gfx::CompositingAndBlendingOperator compositing_and_blending_operator); sk_sp<SkBlender> to_skia_blender(Gfx::CompositingAndBlendingOperator compositing_and_blending_operator);
} }

View file

@ -1390,4 +1390,5 @@ Vector<ByteString> Parser::imported_files() const
{ {
return const_cast<Parser*>(this)->top_level_resolved_imports().keys(); return const_cast<Parser*>(this)->top_level_resolved_imports().keys();
} }
} }

View file

@ -12,7 +12,9 @@
#include <LibIPC/Forward.h> #include <LibIPC/Forward.h>
namespace AK { namespace AK {
class BufferStream; class BufferStream;
} }
namespace IPC { namespace IPC {

View file

@ -37,6 +37,7 @@ private:
} }
namespace AK { namespace AK {
template<> template<>
class Optional<JS::Bytecode::IdentifierTableIndex> : public OptionalBase<JS::Bytecode::IdentifierTableIndex> { class Optional<JS::Bytecode::IdentifierTableIndex> : public OptionalBase<JS::Bytecode::IdentifierTableIndex> {
template<typename U> template<typename U>

View file

@ -51,6 +51,7 @@ struct PropertyKeyAndEnumerableFlag {
} }
namespace AK { namespace AK {
template<> template<>
struct Traits<JS::PropertyKeyAndEnumerableFlag> : public DefaultTraits<JS::PropertyKeyAndEnumerableFlag> { struct Traits<JS::PropertyKeyAndEnumerableFlag> : public DefaultTraits<JS::PropertyKeyAndEnumerableFlag> {
static unsigned hash(JS::PropertyKeyAndEnumerableFlag const& entry) static unsigned hash(JS::PropertyKeyAndEnumerableFlag const& entry)
@ -63,6 +64,7 @@ struct Traits<JS::PropertyKeyAndEnumerableFlag> : public DefaultTraits<JS::Prope
return Traits<JS::PropertyKey>::equals(a.key, b.key); return Traits<JS::PropertyKey>::equals(a.key, b.key);
} }
}; };
} }
namespace JS::Bytecode { namespace JS::Bytecode {

View file

@ -27,7 +27,9 @@
#include <LibJS/Runtime/ValueTraits.h> #include <LibJS/Runtime/ValueTraits.h>
namespace JS { namespace JS {
class FunctionExpression; class FunctionExpression;
} }
namespace JS::Bytecode::Op { namespace JS::Bytecode::Op {

View file

@ -71,6 +71,7 @@ static_assert(sizeof(Operand) == 8);
} }
namespace AK { namespace AK {
template<> template<>
class Optional<JS::Bytecode::Operand> : public OptionalBase<JS::Bytecode::Operand> { class Optional<JS::Bytecode::Operand> : public OptionalBase<JS::Bytecode::Operand> {
template<typename U> template<typename U>

View file

@ -37,6 +37,7 @@ private:
} }
namespace AK { namespace AK {
template<> template<>
class Optional<JS::Bytecode::StringTableIndex> : public OptionalBase<JS::Bytecode::StringTableIndex> { class Optional<JS::Bytecode::StringTableIndex> : public OptionalBase<JS::Bytecode::StringTableIndex> {
template<typename U> template<typename U>

View file

@ -268,6 +268,7 @@ JS_ENUMERATE_TYPED_ARRAYS
#undef __JS_ENUMERATE #undef __JS_ENUMERATE
namespace Intl { namespace Intl {
#define __JS_ENUMERATE(ClassName, snake_name, ConstructorName, PrototypeName) \ #define __JS_ENUMERATE(ClassName, snake_name, ConstructorName, PrototypeName) \
class ClassName; \ class ClassName; \
class ConstructorName; \ class ConstructorName; \
@ -284,9 +285,11 @@ class Segments;
class SegmentsPrototype; class SegmentsPrototype;
struct ResolutionOptionDescriptor; struct ResolutionOptionDescriptor;
}; };
namespace Temporal { namespace Temporal {
#define __JS_ENUMERATE(ClassName, snake_name, ConstructorName, PrototypeName) \ #define __JS_ENUMERATE(ClassName, snake_name, ConstructorName, PrototypeName) \
class ClassName; \ class ClassName; \
class ConstructorName; \ class ConstructorName; \
@ -309,6 +312,7 @@ struct PartialDuration;
struct Time; struct Time;
struct TimeZone; struct TimeZone;
struct TimeZoneOffset; struct TimeZoneOffset;
}; };
template<typename T> template<typename T>
@ -316,6 +320,7 @@ requires(!IsLvalueReference<T>)
class ThrowCompletionOr; class ThrowCompletionOr;
namespace Bytecode { namespace Bytecode {
class BasicBlock; class BasicBlock;
enum class Builtin : u8; enum class Builtin : u8;
class Executable; class Executable;
@ -325,6 +330,7 @@ class Interpreter;
class Operand; class Operand;
class RegexTable; class RegexTable;
class Register; class Register;
} }
} }

View file

@ -342,4 +342,5 @@ private:
HashMap<size_t, TokenMemoization> m_token_memoizations; HashMap<size_t, TokenMemoization> m_token_memoizations;
Program::Type m_program_type; Program::Type m_program_type;
}; };
} }

View file

@ -1052,12 +1052,15 @@ ErrorOr<void> print_value(JS::PrintContext& print_context, JS::Value value, Hash
TRY(js_out(print_context, "\033[0m")); TRY(js_out(print_context, "\033[0m"));
return {}; return {};
} }
} }
namespace JS { namespace JS {
ErrorOr<void> print(JS::Value value, PrintContext& print_context) ErrorOr<void> print(JS::Value value, PrintContext& print_context)
{ {
HashTable<JS::Object*> seen_objects; HashTable<JS::Object*> seen_objects;
return print_value(print_context, value, seen_objects); return print_value(print_context, value, seen_objects);
} }
} }

View file

@ -12,6 +12,7 @@
#include <LibJS/Runtime/Value.h> #include <LibJS/Runtime/Value.h>
namespace JS { namespace JS {
struct PrintContext { struct PrintContext {
JS::VM& vm; JS::VM& vm;
Stream& stream; Stream& stream;
@ -19,4 +20,5 @@ struct PrintContext {
}; };
ErrorOr<void> print(JS::Value value, PrintContext&); ErrorOr<void> print(JS::Value value, PrintContext&);
} }

View file

@ -77,4 +77,5 @@ inline bool Object::fast_is<Error>() const { return is_error_object(); }
DECLARE_NATIVE_ERROR(ClassName, snake_name, PrototypeName, ConstructorName) DECLARE_NATIVE_ERROR(ClassName, snake_name, PrototypeName, ConstructorName)
JS_ENUMERATE_NATIVE_ERRORS JS_ENUMERATE_NATIVE_ERRORS
#undef __JS_ENUMERATE #undef __JS_ENUMERATE
} }

View file

@ -34,6 +34,7 @@ void PromiseCapability::visit_edges(Cell::Visitor& visitor)
} }
namespace { namespace {
struct ResolvingFunctions final : public Cell { struct ResolvingFunctions final : public Cell {
GC_CELL(ResolvingFunctions, Cell); GC_CELL(ResolvingFunctions, Cell);
GC_DECLARE_ALLOCATOR(ResolvingFunctions); GC_DECLARE_ALLOCATOR(ResolvingFunctions);
@ -49,6 +50,7 @@ struct ResolvingFunctions final : public Cell {
} }
}; };
GC_DEFINE_ALLOCATOR(ResolvingFunctions); GC_DEFINE_ALLOCATOR(ResolvingFunctions);
} }
// 27.2.1.5 NewPromiseCapability ( C ), https://tc39.es/ecma262/#sec-newpromisecapability // 27.2.1.5 NewPromiseCapability ( C ), https://tc39.es/ecma262/#sec-newpromisecapability

View file

@ -13,6 +13,7 @@
#include <LibJS/Runtime/Value.h> #include <LibJS/Runtime/Value.h>
namespace JS { namespace JS {
struct ValueTraits : public Traits<Value> { struct ValueTraits : public Traits<Value> {
static unsigned hash(Value value) static unsigned hash(Value value)
{ {

View file

@ -446,6 +446,7 @@ void Editor::enter_search()
} }
namespace { namespace {
Optional<u32> read_unicode_char() Optional<u32> read_unicode_char()
{ {
// FIXME: It would be ideal to somehow communicate that the line editor is // FIXME: It would be ideal to somehow communicate that the line editor is
@ -470,6 +471,7 @@ Optional<u32> read_unicode_char()
return {}; return {};
} }
} }
void Editor::search_character_forwards() void Editor::search_character_forwards()
@ -768,4 +770,5 @@ void Editor::edit_in_external_editor()
} }
} }
} }
} }

View file

@ -194,4 +194,5 @@ private:
bool m_is_empty { true }; bool m_is_empty { true };
}; };
} }

View file

@ -11,6 +11,7 @@
#include <AK/Math.h> #include <AK/Math.h>
namespace Audio { namespace Audio {
using AK::Exponentials::exp; using AK::Exponentials::exp;
using AK::Exponentials::log; using AK::Exponentials::log;
// Constants for logarithmic volume. See Sample::linear_to_log // Constants for logarithmic volume. See Sample::linear_to_log

View file

@ -33,6 +33,7 @@ enum class CodecID : u32 {
} }
namespace AK { namespace AK {
template<> template<>
struct Formatter<Media::CodecID> : Formatter<StringView> { struct Formatter<Media::CodecID> : Formatter<StringView> {
ErrorOr<void> format(FormatBuilder& builder, Media::CodecID value) ErrorOr<void> format(FormatBuilder& builder, Media::CodecID value)
@ -82,4 +83,5 @@ struct Formatter<Media::CodecID> : Formatter<StringView> {
return builder.put_string(codec); return builder.put_string(codec);
} }
}; };
} }

View file

@ -10,6 +10,7 @@
#include <LibRegex/Export.h> #include <LibRegex/Export.h>
namespace regex { namespace regex {
struct CompareTypeAndValuePair; struct CompareTypeAndValuePair;
enum class Error : u8; enum class Error : u8;
@ -32,6 +33,7 @@ class OpCode_SaveNamedLeftCaptureGroup;
class OpCode_SaveRightNamedCaptureGroup; class OpCode_SaveRightNamedCaptureGroup;
class OpCode_Compare; class OpCode_Compare;
class RegexStringView; class RegexStringView;
} }
using regex::ECMA262Parser; using regex::ECMA262Parser;

View file

@ -81,6 +81,7 @@ inline StringView get_error_string(Error error)
} }
return "Undefined error."sv; return "Undefined error."sv;
} }
} }
using regex::get_error_string; using regex::get_error_string;

View file

@ -603,6 +603,7 @@ template class Regex<PosixExtendedParser>;
template class Matcher<ECMA262Parser>; template class Matcher<ECMA262Parser>;
template class Regex<ECMA262Parser>; template class Regex<ECMA262Parser>;
} }
template<typename Parser> template<typename Parser>

View file

@ -294,6 +294,7 @@ bool has_match(Vector<RegexStringView> const& views, Regex<Parser>& pattern, Opt
{ {
return pattern.has_match(views, regex_options); return pattern.has_match(views, regex_options);
} }
} }
using regex::has_match; using regex::has_match;

View file

@ -1813,4 +1813,5 @@ void Optimizer::append_character_class(ByteCode& target, Vector<CompareTypeAndVa
template void Regex<PosixBasicParser>::run_optimization_passes(); template void Regex<PosixBasicParser>::run_optimization_passes();
template void Regex<PosixExtendedParser>::run_optimization_passes(); template void Regex<PosixExtendedParser>::run_optimization_passes();
template void Regex<ECMA262Parser>::run_optimization_passes(); template void Regex<ECMA262Parser>::run_optimization_passes();
} }

View file

@ -2812,4 +2812,5 @@ size_t ECMA262Parser::ensure_total_number_of_capturing_parenthesis()
m_total_number_of_capturing_parenthesis = count; m_total_number_of_capturing_parenthesis = count;
return count; return count;
} }
} }

View file

@ -82,4 +82,5 @@ void WebSocket::did_request_certificates(Badge<RequestClient>)
dbgln("WebSocket: set_certificate failed"); dbgln("WebSocket: set_certificate failed");
} }
} }
} }

View file

@ -109,6 +109,7 @@ private:
// Helper to hide implementation of TestSuite from users // Helper to hide implementation of TestSuite from users
void add_test_case_to_suite(NonnullRefPtr<TestCase> const& test_case); void add_test_case_to_suite(NonnullRefPtr<TestCase> const& test_case);
void set_suite_setup_function(Function<void()> setup); void set_suite_setup_function(Function<void()> setup);
} }
#define TEST_SETUP \ #define TEST_SETUP \

View file

@ -19,6 +19,7 @@ namespace TextCodec {
static constexpr u32 replacement_code_point = 0xfffd; static constexpr u32 replacement_code_point = 0xfffd;
namespace { namespace {
Latin1Decoder s_latin1_decoder; Latin1Decoder s_latin1_decoder;
UTF8Decoder s_utf8_decoder; UTF8Decoder s_utf8_decoder;
UTF16BEDecoder s_utf16be_decoder; UTF16BEDecoder s_utf16be_decoder;

View file

@ -14,6 +14,7 @@
namespace TextCodec { namespace TextCodec {
namespace { namespace {
UTF8Encoder s_utf8_encoder; UTF8Encoder s_utf8_encoder;
GB18030Encoder s_gb18030_encoder; GB18030Encoder s_gb18030_encoder;
GB18030Encoder s_gbk_encoder(GB18030Encoder::IsGBK::Yes); GB18030Encoder s_gbk_encoder(GB18030Encoder::IsGBK::Yes);

View file

@ -7,6 +7,7 @@
#pragma once #pragma once
namespace URL { namespace URL {
class Host; class Host;
class Origin; class Origin;
class Parser; class Parser;
@ -14,4 +15,5 @@ class Site;
class URL; class URL;
struct BlobURLEntry; struct BlobURLEntry;
} }

View file

@ -583,4 +583,5 @@ void AbstractMachine::visit_external_resources(HostVisitOps const& host)
for (auto interpreter_ptr : m_active_interpreters) for (auto interpreter_ptr : m_active_interpreters)
interpreter_ptr->visit_external_resources(host); interpreter_ptr->visit_external_resources(host);
} }
} }

View file

@ -1669,4 +1669,5 @@ void DebuggerBytecodeInterpreter::interpret_instruction(Configuration& configura
} }
} }
} }
} }

View file

@ -3752,4 +3752,5 @@ ByteString Validator::Errors::find_instruction_name(SourceLocation const& locati
return instruction_name(OpCode { *opcode }); return instruction_name(OpCode { *opcode });
} }
} }

View file

@ -14,7 +14,9 @@ struct ValidationError;
struct Interpreter; struct Interpreter;
namespace Wasi { namespace Wasi {
struct Implementation; struct Implementation;
} }
} }

View file

@ -1378,4 +1378,5 @@ ByteString parse_error_to_byte_string(ParseError error)
} }
return "Unknown error"; return "Unknown error";
} }
} }

View file

@ -700,6 +700,7 @@ void Printer::print(Wasm::Reference const& value)
[](Wasm::Reference::Null const&) { return ByteString("null"); }, [](Wasm::Reference::Null const&) { return ByteString("null"); },
[](auto const& ref) { return ByteString::number(ref.address.value()); })); [](auto const& ref) { return ByteString::number(ref.address.value()); }));
} }
} }
HashMap<Wasm::OpCode, ByteString> Wasm::Names::instruction_names { HashMap<Wasm::OpCode, ByteString> Wasm::Names::instruction_names {

View file

@ -1051,4 +1051,5 @@ private:
ValidationStatus m_validation_status { ValidationStatus::Unchecked }; ValidationStatus m_validation_status { ValidationStatus::Unchecked };
Optional<ByteString> m_validation_error; Optional<ByteString> m_validation_error;
}; };
} }

View file

@ -1221,9 +1221,11 @@ FDFlags fd_flags_of(struct stat const&)
FDFlags::Bits result {}; FDFlags::Bits result {};
return FDFlags { result }; return FDFlags { result };
} }
} }
namespace AK { namespace AK {
template<> template<>
struct Formatter<Wasm::Wasi::Errno> : AK::Formatter<FormatString> { struct Formatter<Wasm::Wasi::Errno> : AK::Formatter<FormatString> {
ErrorOr<void> format(FormatBuilder& builder, Wasm::Wasi::Errno const& value) ErrorOr<void> format(FormatBuilder& builder, Wasm::Wasi::Errno const& value)
@ -1291,4 +1293,5 @@ struct Formatter<Wasm::Wasi::SockRecvResult> : AK::Formatter<FormatString> {
return Formatter<FormatString>::format(builder, "size={}"sv, value.size); return Formatter<FormatString>::format(builder, "size={}"sv, value.size);
} }
}; };
} }

View file

@ -98,10 +98,12 @@ using FileSize = LittleEndian<u64>;
using Timestamp = LittleEndian<u64>; using Timestamp = LittleEndian<u64>;
namespace Detail { namespace Detail {
template<typename> template<typename>
struct __Pointer_tag; struct __Pointer_tag;
template<typename> template<typename>
struct __ConstPointer_tag; struct __ConstPointer_tag;
} }
// NOTE: Might need to be updated if WASI ever supports memory64. // NOTE: Might need to be updated if WASI ever supports memory64.

View file

@ -12,7 +12,9 @@
#include <LibWeb/Animations/KeyframeEffect.h> #include <LibWeb/Animations/KeyframeEffect.h>
namespace Web::CSS { namespace Web::CSS {
class CSSTransition; class CSSTransition;
} }
namespace Web::Animations { namespace Web::Animations {

View file

@ -10,6 +10,7 @@
#include <LibWeb/DOM/Element.h> #include <LibWeb/DOM/Element.h>
namespace Web::CSS { namespace Web::CSS {
GC_DEFINE_ALLOCATOR(CascadedProperties); GC_DEFINE_ALLOCATOR(CascadedProperties);
CascadedProperties::CascadedProperties() = default; CascadedProperties::CascadedProperties() = default;

View file

@ -70,4 +70,5 @@ constexpr bool is_greater_than_maximum_allowed_code_point(u32 code_point)
// The greatest code point defined by Unicode: U+10FFFF. // The greatest code point defined by Unicode: U+10FFFF.
return code_point > 0x10FFFF; return code_point > 0x10FFFF;
} }
} }

View file

@ -10,6 +10,7 @@
#include <LibWeb/Forward.h> #include <LibWeb/Forward.h>
namespace Web::CSS { namespace Web::CSS {
class Frequency { class Frequency {
public: public:
enum class Type { enum class Type {

View file

@ -37,4 +37,5 @@ private:
String m_media; String m_media;
bool m_matches; bool m_matches;
}; };
} }

View file

@ -90,6 +90,7 @@ private:
double m_value { 0 }; double m_value { 0 };
Type m_type; Type m_type;
}; };
} }
template<> template<>

View file

@ -47,6 +47,7 @@ public:
private: private:
Variant<Token, Function, SimpleBlock> m_value; Variant<Token, Function, SimpleBlock> m_value;
}; };
} }
template<> template<>

View file

@ -41,6 +41,7 @@ namespace Web::CSS::Parser {
class PropertyDependencyNode; class PropertyDependencyNode;
namespace CalcParsing { namespace CalcParsing {
struct Operator { struct Operator {
char delim; char delim;
}; };
@ -61,6 +62,7 @@ struct InvertNode {
struct NegateNode { struct NegateNode {
Node child; Node child;
}; };
} }
enum class ParsingMode { enum class ParsingMode {

View file

@ -106,4 +106,5 @@ private:
Token::Position m_position; Token::Position m_position;
Token::Position m_prev_position; Token::Position m_prev_position;
}; };
} }

Some files were not shown because too many files have changed in this diff Show more