[libunwind] [mlir] [llvm] [compiler-rt] [clang-tools-extra] [lldb] [libcxx] [libc] [clang] [lld] [flang] Reland: [libc++][format] P2637R3: Member visit (std::basic_format_arg) #76449 (PR #79032)

2024-01-25 Thread Hristo Hristov via cfe-commits

https://github.com/H-G-Hristov updated 
https://github.com/llvm/llvm-project/pull/79032

>From e03452fda84a5284420bba1913299b68caabb6cd Mon Sep 17 00:00:00 2001
From: Zingam 
Date: Mon, 22 Jan 2024 20:35:00 +0200
Subject: [PATCH 1/6] Revert "Revert "[libc++][format] P2637R3: Member `visit`
 (`std::basic_format_arg`) (#76449)""

This reverts commit 02f95b77515fe18ed1076b94cbb850ea0cf3c77e.
---
 libcxx/docs/ReleaseNotes/18.rst   |   1 +
 libcxx/docs/Status/Cxx2cPapers.csv|   2 +-
 libcxx/docs/Status/FormatIssues.csv   |   2 +-
 libcxx/include/__config   |   6 +
 libcxx/include/__format/format_arg.h  | 109 +-
 libcxx/include/__format/format_context.h  |  33 +-
 libcxx/include/format |   2 +-
 .../format.arg/visit.pass.cpp | 333 
 .../format.arg/visit.return_type.pass.cpp | 369 ++
 .../visit_format_arg.deprecated.verify.cpp|  38 ++
 .../format.arg/visit_format_arg.pass.cpp  |   6 +-
 .../format.arguments/format.args/get.pass.cpp |  48 ++-
 libcxx/test/support/test_basic_format_arg.h   |  20 +-
 libcxx/test/support/test_macros.h |   5 +
 .../generate_feature_test_macro_components.py |   1 +
 15 files changed, 927 insertions(+), 48 deletions(-)
 create mode 100644 
libcxx/test/std/utilities/format/format.arguments/format.arg/visit.pass.cpp
 create mode 100644 
libcxx/test/std/utilities/format/format.arguments/format.arg/visit.return_type.pass.cpp
 create mode 100644 
libcxx/test/std/utilities/format/format.arguments/format.arg/visit_format_arg.deprecated.verify.cpp

diff --git a/libcxx/docs/ReleaseNotes/18.rst b/libcxx/docs/ReleaseNotes/18.rst
index fd882bafe19a517..237a63022d55ff5 100644
--- a/libcxx/docs/ReleaseNotes/18.rst
+++ b/libcxx/docs/ReleaseNotes/18.rst
@@ -79,6 +79,7 @@ Implemented Papers
 - P1759R6 - Native handles and file streams
 - P2868R3 - Remove Deprecated ``std::allocator`` Typedef From C++26
 - P2517R1 - Add a conditional ``noexcept`` specification to ``std::apply``
+- P2637R3 - Member ``visit``
 - P2447R6 - ``span`` over initializer list
 
 
diff --git a/libcxx/docs/Status/Cxx2cPapers.csv 
b/libcxx/docs/Status/Cxx2cPapers.csv
index f80b1f6b663f045..c45aa3c510072e4 100644
--- a/libcxx/docs/Status/Cxx2cPapers.csv
+++ b/libcxx/docs/Status/Cxx2cPapers.csv
@@ -17,7 +17,7 @@
 "`P0792R14 `__","LWG","``function_ref``: a 
type-erased callable reference","Varna June 2023","","",""
 "`P2874R2 `__","LWG","Mandating Annex D Require No 
More","Varna June 2023","","",""
 "`P2757R3 `__","LWG","Type-checking format 
args","Varna June 2023","","","|format|"
-"`P2637R3 `__","LWG","Member ``visit``","Varna June 
2023","|Partial|","18.0",""
+"`P2637R3 `__","LWG","Member ``visit``","Varna June 
2023","|Complete|","18.0",""
 "`P2641R4 `__","CWG, LWG","Checking if a ``union`` 
alternative is active","Varna June 2023","","",""
 "`P1759R6 `__","LWG","Native handles and file 
streams","Varna June 2023","|Complete|","18.0",""
 "`P2697R1 `__","LWG","Interfacing ``bitset`` with 
``string_view``","Varna June 2023","|Complete|","18.0",""
diff --git a/libcxx/docs/Status/FormatIssues.csv 
b/libcxx/docs/Status/FormatIssues.csv
index 513988d08036ca6..6e58e752191ea5d 100644
--- a/libcxx/docs/Status/FormatIssues.csv
+++ b/libcxx/docs/Status/FormatIssues.csv
@@ -16,7 +16,7 @@ Number,Name,Standard,Assignee,Status,First released version
 "`P2693R1 `__","Formatting ``thread::id`` and 
``stacktrace``","C++23","Mark de Wever","|In Progress|"
 "`P2510R3 `__","Formatting pointers","C++26","Mark 
de Wever","|Complete|",17.0
 "`P2757R3 `__","Type-checking format 
args","C++26","","",
-"`P2637R3 `__","Member ``visit``","C++26","","",
+"`P2637R3 `__","Member ``visit``","C++26","Hristo 
Hristov","|Complete|",18.0
 "`P2905R2 `__","Runtime format strings","C++26 
DR","Mark de Wever","|Complete|",18.0
 "`P2918R2 `__","Runtime format strings 
II","C++26","Mark de Wever","|Complete|",18.0
 "`P2909R4 `__","Fix formatting of code units as 
integers (Dude, where’s my ``char``?)","C++26 DR","Mark de 
Wever","|Complete|",18.0
diff --git a/libcxx/include/__config b/libcxx/include/__config
index 9a64cdb489119d9..00489d971c296c2 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -995,6 +995,12 @@ typedef __char32_t char32_t;
 #define _LIBCPP_DEPRECATED_IN_CXX23
 #  endif
 
+#  if _LIBCPP_STD_VER >= 26
+#define _LIBCPP_DEPRECATED_IN_CXX26 _LIBCPP_DEPRECATED
+#  else
+#define _LIBCPP_DEPRECATED_IN_CXX26
+#  endif
+
 #  if 

[libunwind] [mlir] [llvm] [compiler-rt] [clang-tools-extra] [lldb] [libcxx] [libc] [clang] [lld] [flang] Reland: [libc++][format] P2637R3: Member visit (std::basic_format_arg) #76449 (PR #79032)

2024-01-25 Thread Hristo Hristov via cfe-commits

https://github.com/H-G-Hristov updated 
https://github.com/llvm/llvm-project/pull/79032

>From e03452fda84a5284420bba1913299b68caabb6cd Mon Sep 17 00:00:00 2001
From: Zingam 
Date: Mon, 22 Jan 2024 20:35:00 +0200
Subject: [PATCH 1/6] Revert "Revert "[libc++][format] P2637R3: Member `visit`
 (`std::basic_format_arg`) (#76449)""

This reverts commit 02f95b77515fe18ed1076b94cbb850ea0cf3c77e.
---
 libcxx/docs/ReleaseNotes/18.rst   |   1 +
 libcxx/docs/Status/Cxx2cPapers.csv|   2 +-
 libcxx/docs/Status/FormatIssues.csv   |   2 +-
 libcxx/include/__config   |   6 +
 libcxx/include/__format/format_arg.h  | 109 +-
 libcxx/include/__format/format_context.h  |  33 +-
 libcxx/include/format |   2 +-
 .../format.arg/visit.pass.cpp | 333 
 .../format.arg/visit.return_type.pass.cpp | 369 ++
 .../visit_format_arg.deprecated.verify.cpp|  38 ++
 .../format.arg/visit_format_arg.pass.cpp  |   6 +-
 .../format.arguments/format.args/get.pass.cpp |  48 ++-
 libcxx/test/support/test_basic_format_arg.h   |  20 +-
 libcxx/test/support/test_macros.h |   5 +
 .../generate_feature_test_macro_components.py |   1 +
 15 files changed, 927 insertions(+), 48 deletions(-)
 create mode 100644 
libcxx/test/std/utilities/format/format.arguments/format.arg/visit.pass.cpp
 create mode 100644 
libcxx/test/std/utilities/format/format.arguments/format.arg/visit.return_type.pass.cpp
 create mode 100644 
libcxx/test/std/utilities/format/format.arguments/format.arg/visit_format_arg.deprecated.verify.cpp

diff --git a/libcxx/docs/ReleaseNotes/18.rst b/libcxx/docs/ReleaseNotes/18.rst
index fd882bafe19a51..237a63022d55ff 100644
--- a/libcxx/docs/ReleaseNotes/18.rst
+++ b/libcxx/docs/ReleaseNotes/18.rst
@@ -79,6 +79,7 @@ Implemented Papers
 - P1759R6 - Native handles and file streams
 - P2868R3 - Remove Deprecated ``std::allocator`` Typedef From C++26
 - P2517R1 - Add a conditional ``noexcept`` specification to ``std::apply``
+- P2637R3 - Member ``visit``
 - P2447R6 - ``span`` over initializer list
 
 
diff --git a/libcxx/docs/Status/Cxx2cPapers.csv 
b/libcxx/docs/Status/Cxx2cPapers.csv
index f80b1f6b663f04..c45aa3c510072e 100644
--- a/libcxx/docs/Status/Cxx2cPapers.csv
+++ b/libcxx/docs/Status/Cxx2cPapers.csv
@@ -17,7 +17,7 @@
 "`P0792R14 `__","LWG","``function_ref``: a 
type-erased callable reference","Varna June 2023","","",""
 "`P2874R2 `__","LWG","Mandating Annex D Require No 
More","Varna June 2023","","",""
 "`P2757R3 `__","LWG","Type-checking format 
args","Varna June 2023","","","|format|"
-"`P2637R3 `__","LWG","Member ``visit``","Varna June 
2023","|Partial|","18.0",""
+"`P2637R3 `__","LWG","Member ``visit``","Varna June 
2023","|Complete|","18.0",""
 "`P2641R4 `__","CWG, LWG","Checking if a ``union`` 
alternative is active","Varna June 2023","","",""
 "`P1759R6 `__","LWG","Native handles and file 
streams","Varna June 2023","|Complete|","18.0",""
 "`P2697R1 `__","LWG","Interfacing ``bitset`` with 
``string_view``","Varna June 2023","|Complete|","18.0",""
diff --git a/libcxx/docs/Status/FormatIssues.csv 
b/libcxx/docs/Status/FormatIssues.csv
index 513988d08036ca..6e58e752191ea5 100644
--- a/libcxx/docs/Status/FormatIssues.csv
+++ b/libcxx/docs/Status/FormatIssues.csv
@@ -16,7 +16,7 @@ Number,Name,Standard,Assignee,Status,First released version
 "`P2693R1 `__","Formatting ``thread::id`` and 
``stacktrace``","C++23","Mark de Wever","|In Progress|"
 "`P2510R3 `__","Formatting pointers","C++26","Mark 
de Wever","|Complete|",17.0
 "`P2757R3 `__","Type-checking format 
args","C++26","","",
-"`P2637R3 `__","Member ``visit``","C++26","","",
+"`P2637R3 `__","Member ``visit``","C++26","Hristo 
Hristov","|Complete|",18.0
 "`P2905R2 `__","Runtime format strings","C++26 
DR","Mark de Wever","|Complete|",18.0
 "`P2918R2 `__","Runtime format strings 
II","C++26","Mark de Wever","|Complete|",18.0
 "`P2909R4 `__","Fix formatting of code units as 
integers (Dude, where’s my ``char``?)","C++26 DR","Mark de 
Wever","|Complete|",18.0
diff --git a/libcxx/include/__config b/libcxx/include/__config
index 9a64cdb489119d..00489d971c296c 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -995,6 +995,12 @@ typedef __char32_t char32_t;
 #define _LIBCPP_DEPRECATED_IN_CXX23
 #  endif
 
+#  if _LIBCPP_STD_VER >= 26
+#define _LIBCPP_DEPRECATED_IN_CXX26 _LIBCPP_DEPRECATED
+#  else
+#define _LIBCPP_DEPRECATED_IN_CXX26
+#  endif
+
 #  if