[clang] [clang] Document the return value of __builtin_COLUMN (PR #118360)

via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 2 10:41:32 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: None (GeorgeKA)

<details>
<summary>Changes</summary>

PR for issue #<!-- -->78657

Updated clang/docs/LanguageExtensions.rst to detail the return value of __builtin_COLUMN for this implementation.

--

Fyi, this is my first contribution, so please bear with me.

There already appears to be a unit test for __builtin_COLUMN in clang/test/SemaCXX/source_location.cpp.

---
Full diff: https://github.com/llvm/llvm-project/pull/118360.diff


1 Files Affected:

- (modified) clang/docs/LanguageExtensions.rst (+5-1) 


``````````diff
diff --git a/clang/docs/LanguageExtensions.rst b/clang/docs/LanguageExtensions.rst
index 3c9078bcdf8118..00466fd2e7f020 100644
--- a/clang/docs/LanguageExtensions.rst
+++ b/clang/docs/LanguageExtensions.rst
@@ -4514,9 +4514,13 @@ default member initializer, the invocation point is the location of the
 constructor or aggregate initialization used to create the object. Otherwise
 the invocation point is the same as the location of the builtin.
 
-When the invocation point of ``__builtin_FUNCTION`` is not a function scope the
+When the invocation point of ``__builtin_FUNCTION`` is not a function scope, the
 empty string is returned.
 
+The builtin ``__builtin_COLUMN`` returns the offset from the start of the line,
+beginning from column 1. `This may differ from other implementations.
+<https://en.cppreference.com/w/cpp/utility/source_location/column>`_
+
 The builtin ``__builtin_source_location`` returns a pointer to constant static
 data of type ``std::source_location::__impl``. This type must have already been
 defined, and must contain exactly four fields: ``const char *_M_file_name``,

``````````

</details>


https://github.com/llvm/llvm-project/pull/118360


More information about the cfe-commits mailing list