AK: Add a AK::Formatter implementation for AK::SourceLocation

This commit is contained in:
Brian Gianforcaro 2021-04-24 20:01:26 -07:00 committed by Andreas Kling
parent b42bfa75d8
commit 357a13b404
Notes: sideshowbarker 2024-07-18 19:08:36 +09:00

View file

@ -7,6 +7,7 @@
#pragma once #pragma once
#include <AK/Format.h>
#include <AK/StringView.h> #include <AK/StringView.h>
#include <AK/Types.h> #include <AK/Types.h>
@ -38,4 +39,12 @@ private:
} }
template<>
struct AK::Formatter<AK::SourceLocation> : AK::Formatter<FormatString> {
void format(FormatBuilder& builder, AK::SourceLocation location)
{
return AK::Formatter<FormatString>::format(builder, "[{} @ {}:{}]", location.function_name(), location.file_name(), location.line_number());
}
};
using AK::SourceLocation; using AK::SourceLocation;