From a3c0bc572a992abcddc892389bc2e487d79b294e Mon Sep 17 00:00:00 2001 From: Michael Lippautz Date: Mon, 8 Jun 2020 19:45:47 +0200 Subject: [PATCH] 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 Commit-Queue: Anton Bikineev Auto-Submit: Michael Lippautz Reviewed-by: Anton Bikineev Cr-Commit-Position: refs/heads/master@{#68236} --- include/cppgc/source-location.h | 36 +++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/include/cppgc/source-location.h b/include/cppgc/source-location.h index 8cc52d6a53..139c9d86c0 100644 --- a/include/cppgc/source-location.h +++ b/include/cppgc/source-location.h @@ -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: