5#ifndef INCLUDE_SOURCE_LOCATION_H_
6#define INCLUDE_SOURCE_LOCATION_H_
13#if defined(__has_builtin)
14#define V8_SUPPORTS_SOURCE_LOCATION \
15 (__has_builtin(__builtin_FUNCTION) && __has_builtin(__builtin_FILE) && \
16 __has_builtin(__builtin_LINE))
17#elif defined(V8_CC_GNU) && __GNUC__ >= 7
18#define V8_SUPPORTS_SOURCE_LOCATION 1
19#elif defined(V8_CC_INTEL) && __ICC >= 1800
20#define V8_SUPPORTS_SOURCE_LOCATION 1
22#define V8_SUPPORTS_SOURCE_LOCATION 0
37#if V8_SUPPORTS_SOURCE_LOCATION
39 const char* function = __builtin_FUNCTION(),
40 const char* file = __builtin_FILE(),
size_t line = __builtin_LINE()) {
58 constexpr const char*
Function()
const {
return function_; }
65 constexpr const char*
FileName()
const {
return file_; }
72 constexpr size_t Line()
const {
return line_; }
83 return std::string(function_) +
"@" + file_ +
":" + std::to_string(line_);
87 constexpr SourceLocation(
const char* function,
const char* file,
size_t line)
88 : function_(function), file_(file), line_(line) {}
90 const char* function_ =
nullptr;
91 const char* file_ =
nullptr;
Definition: v8-source-location.h:31
std::string ToString() const
Definition: v8-source-location.h:79
constexpr size_t Line() const
Definition: v8-source-location.h:72
constexpr SourceLocation()=default
constexpr const char * FileName() const
Definition: v8-source-location.h:65
static constexpr SourceLocation Current()
Definition: v8-source-location.h:44
constexpr const char * Function() const
Definition: v8-source-location.h:58
Definition: libplatform.h:15
#define V8_EXPORT
Definition: v8config.h:793