5#ifndef INCLUDE_SOURCE_LOCATION_H_
6#define INCLUDE_SOURCE_LOCATION_H_
9#include <source_location>
14#define V8_SUPPORTS_SOURCE_LOCATION 1
19
20
21
25
26
27
30 return SourceLocation(loc);
33 static constexpr SourceLocation CurrentIfDebug(
34 const std::source_location& loc = std::source_location::current()) {
35 return SourceLocation(loc);
42
43
47
48
49
50
51
52 constexpr const char*
Function()
const {
return loc_.function_name(); }
55
56
57
58
59 constexpr const char*
FileName()
const {
return loc_.file_name(); }
62
63
64
65
69
70
71
72
74 if (loc_.line() == 0) {
77 return std::string(loc_.function_name()) +
"@" + loc_.file_name() +
":" +
78 std::to_string(loc_.line());
82 constexpr explicit SourceLocation(
const std::source_location& loc)
85 std::source_location loc_;
static constexpr SourceLocation CurrentIfDebug()
constexpr size_t Line() const
std::string ToString() const
constexpr SourceLocation()=default
static constexpr SourceLocation Current(const std::source_location &loc=std::source_location::current())
constexpr const char * FileName() const
constexpr const char * Function() const