Commit a3c0bc57 authored by Michael Lippautz's avatar Michael Lippautz Committed by Commit Bot

cppgc: Adds docs to SourceLocation

Bug: chromium:1056170
Change-Id: I89d0fbe6b73bf1b8765bb532fff58b1960fed09a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2235537
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Anton Bikineev <bikineev@chromium.org>
Auto-Submit: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: 's avatarAnton Bikineev <bikineev@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68236}
parent c9d7b236
......@@ -23,10 +23,16 @@
namespace cppgc {
// Encapsulates source location information. Mimics C++20's
// std::source_location.
/**
* Encapsulates source location information. Mimics C++20's
* std::source_location.
*/
class V8_EXPORT SourceLocation final {
public:
/**
* Construct source location information corresponding to the location of the
* call site.
*/
#if CPPGC_SUPPORTS_SOURCE_LOCATION
static constexpr SourceLocation Current(
const char* function = __builtin_FUNCTION(),
......@@ -37,12 +43,38 @@ class V8_EXPORT SourceLocation final {
static constexpr SourceLocation Current() { return SourceLocation(); }
#endif // CPPGC_SUPPORTS_SOURCE_LOCATION
/**
* Constructs unspecified source location information.
*/
constexpr SourceLocation() = default;
/**
* Returns the name of the function associated with the position represented
* by this object, if any.
*
* \returns the function name as cstring.
*/
constexpr const char* Function() const { return function_; }
/**
* Returns the name of the current source file represented by this object.
*
* \returns the file name as cstring.
*/
constexpr const char* FileName() const { return file_; }
/**
* Returns the line number represented by this object.
*
* \returns the line number.
*/
constexpr size_t Line() const { return line_; }
/**
* Returns a human-readable string representing this object.
*
* \returns a human-readable string representing source location information.
*/
std::string ToString() const;
private:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment