[libcxx-commits] [PATCH] D120634: [Libcxx] Add <source_location> header.

Nikolas Klauser via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sun Feb 27 11:42:50 PST 2022


philnik requested changes to this revision.
philnik added a comment.
This revision now requires changes to proceed.

Looks like you have to run `ninja libcxx-generate-files`.



================
Comment at: libcxx/include/source_location:40
+
+#if __cplusplus > 201703L && __has_builtin(__builtin_source_location)
+
----------------



================
Comment at: libcxx/include/source_location:43-44
+class source_location {
+  // Note: the name of the struct '__impl', and the names of its fields, are
+  // REQUIRED by __builtin_source_location, and cannot be changed.
+  struct __impl {
----------------



================
Comment at: libcxx/include/source_location:63-74
+  constexpr uint_least32_t line() const noexcept {
+    return __ptr_ ? __ptr_->_M_line : 0;
+  }
+  constexpr uint_least32_t column() const noexcept {
+    return __ptr_ ? __ptr_->_M_column : 0;
+  }
+  constexpr const char *file_name() const noexcept {
----------------



================
Comment at: libcxx/include/source_location:77
+
+#endif // __cplusplus > 201703L && __has_builtin(__builtin_source_location)
+
----------------



================
Comment at: libcxx/test/std/language.support/support.srcloc/general.pass.cpp:16-19
+// Only run tests when support is available; it's not yet universally available
+// in c++20 compilers. TODO: would it be better to exclude this test with some
+// more "UNSUPPORTED" annotations?
+#if defined(__cpp_lib_source_location)
----------------
This should be something along the lines of `// UNSUPPORTED: clang-13`, depending on when `__builtin_source_location was implemented`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D120634/new/

https://reviews.llvm.org/D120634



More information about the libcxx-commits mailing list