[clang] [Clang] Set the FTM for trivial relocation (PR #142936)
Corentin Jabot via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 5 02:56:59 PDT 2025
https://github.com/cor3ntin created https://github.com/llvm/llvm-project/pull/142936
The language of side seems fairly stable.
Setting the feature test macro will ease implementation in standard libraries.
>From d035db665337550d41cee85bb962943fa6b6c097 Mon Sep 17 00:00:00 2001
From: Corentin Jabot <corentinjabot at gmail.com>
Date: Thu, 5 Jun 2025 11:54:32 +0200
Subject: [PATCH] [Clang] Set the FTM for trivial relocation
The language of side seems fairly stable.
Setting the feature test macro will ease implementation in
standard libraries.
---
clang/lib/Frontend/InitPreprocessor.cpp | 2 +-
clang/test/Lexer/cxx-features.cpp | 4 ++++
clang/www/cxx_status.html | 7 +------
3 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp
index 69a91eef6aedb..ef1a508a96c35 100644
--- a/clang/lib/Frontend/InitPreprocessor.cpp
+++ b/clang/lib/Frontend/InitPreprocessor.cpp
@@ -773,7 +773,7 @@ static void InitializeCPlusPlusFeatureTestMacros(const LangOptions &LangOpts,
Builder.defineMacro("__cpp_pack_indexing", "202311L");
Builder.defineMacro("__cpp_deleted_function", "202403L");
Builder.defineMacro("__cpp_variadic_friend", "202403L");
- // Builder.defineMacro("__cpp_trivial_relocatability", "202502L");
+ Builder.defineMacro("__cpp_trivial_relocatability", "202502L");
if (LangOpts.Char8)
Builder.defineMacro("__cpp_char8_t", "202207L");
diff --git a/clang/test/Lexer/cxx-features.cpp b/clang/test/Lexer/cxx-features.cpp
index 8c1867d5c7365..ced5bcaf0db16 100644
--- a/clang/test/Lexer/cxx-features.cpp
+++ b/clang/test/Lexer/cxx-features.cpp
@@ -49,6 +49,10 @@
#error "wrong value for __cpp_placeholder_variables"
#endif
+#if check(trivial_relocatability, 202502, 202502, 202502, 202502, 202502, 202502, 202502)
+#error "wrong value for __cpp_trivial_relocatability"
+#endif
+
// --- C++23 features ---
#if check(auto_cast, 0, 0, 0, 0, 0, 202110, 202110)
diff --git a/clang/www/cxx_status.html b/clang/www/cxx_status.html
index dff57689e84b9..cbcf462970b7f 100755
--- a/clang/www/cxx_status.html
+++ b/clang/www/cxx_status.html
@@ -280,12 +280,7 @@ <h2 id="cxx26">C++2c implementation status</h2>
<tr>
<td>Trivial Relocatability</pre></td>
<td><a href="https://wg21.link/P2786">P2786R13</a></td>
- <td class="partial" align="center">
- <details>
- <summary>Clang 21 (Partial)</summary>
- The feature test macro (<code>__cpp_trivial_relocatability</code>) has not yet been set.
- </details>
- </td>
+ <td class="unreleased" align="center">Clang 21</td>
</tr>
<tr>
<td><pre>#embed</pre></td>
More information about the cfe-commits
mailing list