[libc++] Divorce the std Lit feature from the -std=XXX compiler flag

After this patch, we can use `--param std=c++20` even if the compiler only
supports -std=c++2a. The test suite will handle that for us. The only Lit
feature that isn't fully baked will always be the "in development" one,
since we don't know exactly what year the standard will be ratified in.

This is another take on https://reviews.llvm.org/D99789.

Differential Revision: https://reviews.llvm.org/D100210

GitOrigin-RevId: 8508b1c133f6dea558fd62f73cf333bdec809026
diff --git a/cmake/caches/Generic-cxx20.cmake b/cmake/caches/Generic-cxx20.cmake
index 1a07a99..3c44fda 100644
--- a/cmake/caches/Generic-cxx20.cmake
+++ b/cmake/caches/Generic-cxx20.cmake
@@ -1,2 +1,2 @@
-set(LIBCXX_TEST_PARAMS "std=c++2a" CACHE STRING "")
+set(LIBCXX_TEST_PARAMS "std=c++20" CACHE STRING "")
 set(LIBCXXABI_TEST_PARAMS "${LIBCXX_TEST_PARAMS}" CACHE STRING "")
diff --git a/docs/TestingLibcxx.rst b/docs/TestingLibcxx.rst
index 50aeb3e..156249d 100644
--- a/docs/TestingLibcxx.rst
+++ b/docs/TestingLibcxx.rst
@@ -126,7 +126,7 @@
 
 .. option:: std=<standard version>
 
-  **Values**: c++03, c++11, c++14, c++17, c++2a, c++2b
+  **Values**: c++03, c++11, c++14, c++17, c++20, c++2b
 
   Change the standard version used when building the tests.
 
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array11.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array11.pass.cpp
index e1a545c..c6cacb4 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array11.pass.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array11.pass.cpp
@@ -11,7 +11,7 @@
 // Note that sized delete operator definitions below are simply ignored
 // when sized deallocation is not supported, e.g., prior to C++14.
 
-// UNSUPPORTED: c++14, c++17, c++2a
+// REQUIRES: c++03 || c++11
 // UNSUPPORTED: sanitizer-new-delete
 
 #include <new>
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete11.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete11.pass.cpp
index 69f8bce..3a904af 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete11.pass.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete11.pass.cpp
@@ -11,7 +11,7 @@
 // Note that sized delete operator definitions below are simply ignored
 // when sized deallocation is not supported, e.g., prior to C++14.
 
-// UNSUPPORTED: c++14, c++17, c++2a
+// REQUIRES: c++03 || c++11
 // UNSUPPORTED: sanitizer-new-delete
 
 #include <new>
diff --git a/test/std/strings/basic.string/string.contains/contains.char.pass.cpp b/test/std/strings/basic.string/string.contains/contains.char.pass.cpp
index 740af16..82c7268 100644
--- a/test/std/strings/basic.string/string.contains/contains.char.pass.cpp
+++ b/test/std/strings/basic.string/string.contains/contains.char.pass.cpp
@@ -5,7 +5,7 @@
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
-// UNSUPPORTED: c++03, c++11, c++14, c++17, c++2a
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
 
 // <string>
 
diff --git a/test/std/strings/basic.string/string.contains/contains.ptr.pass.cpp b/test/std/strings/basic.string/string.contains/contains.ptr.pass.cpp
index 8a5780b..ccd3925 100644
--- a/test/std/strings/basic.string/string.contains/contains.ptr.pass.cpp
+++ b/test/std/strings/basic.string/string.contains/contains.ptr.pass.cpp
@@ -5,7 +5,7 @@
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
-// UNSUPPORTED: c++03, c++11, c++14, c++17, c++2a
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
 
 // <string>
 
diff --git a/test/std/strings/basic.string/string.contains/contains.string_view.pass.cpp b/test/std/strings/basic.string/string.contains/contains.string_view.pass.cpp
index 88d9b42..bb40ade 100644
--- a/test/std/strings/basic.string/string.contains/contains.string_view.pass.cpp
+++ b/test/std/strings/basic.string/string.contains/contains.string_view.pass.cpp
@@ -5,7 +5,7 @@
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
-// UNSUPPORTED: c++03, c++11, c++14, c++17, c++2a
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
 
 // <string>
 
diff --git a/test/std/strings/string.view/string.view.template/contains.char.pass.cpp b/test/std/strings/string.view/string.view.template/contains.char.pass.cpp
index 658e10d..a9fbe10 100644
--- a/test/std/strings/string.view/string.view.template/contains.char.pass.cpp
+++ b/test/std/strings/string.view/string.view.template/contains.char.pass.cpp
@@ -5,7 +5,7 @@
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
-// UNSUPPORTED: c++03, c++11, c++14, c++17, c++2a
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
 
 // <string_view>
 
diff --git a/test/std/strings/string.view/string.view.template/contains.ptr.pass.cpp b/test/std/strings/string.view/string.view.template/contains.ptr.pass.cpp
index f22e77d..06f0f78 100644
--- a/test/std/strings/string.view/string.view.template/contains.ptr.pass.cpp
+++ b/test/std/strings/string.view/string.view.template/contains.ptr.pass.cpp
@@ -5,7 +5,7 @@
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
-// UNSUPPORTED: c++03, c++11, c++14, c++17, c++2a
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
 
 // <string_view>
 
diff --git a/test/std/strings/string.view/string.view.template/contains.string_view.pass.cpp b/test/std/strings/string.view/string.view.template/contains.string_view.pass.cpp
index 0b79768..068b9df 100644
--- a/test/std/strings/string.view/string.view.template/contains.string_view.pass.cpp
+++ b/test/std/strings/string.view/string.view.template/contains.string_view.pass.cpp
@@ -5,7 +5,7 @@
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
-// UNSUPPORTED: c++03, c++11, c++14, c++17, c++2a
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
 
 // <string_view>
 
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_scoped_enum.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_scoped_enum.pass.cpp
index ad50755..ca72af3 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_scoped_enum.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_scoped_enum.pass.cpp
@@ -6,7 +6,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-// UNSUPPORTED: c++03, c++11, c++14, c++17, c++2a
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
 
 // type_traits
 
diff --git a/test/std/utilities/utility/utility.underlying/to_underlying.pass.cpp b/test/std/utilities/utility/utility.underlying/to_underlying.pass.cpp
index 0b2bc19..337b86a 100644
--- a/test/std/utilities/utility/utility.underlying/to_underlying.pass.cpp
+++ b/test/std/utilities/utility/utility.underlying/to_underlying.pass.cpp
@@ -6,7 +6,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-// UNSUPPORTED: c++03, c++11, c++14, c++17, c++2a
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
 
 // [utility.underlying], to_underlying
 // template <class T>
diff --git a/test/std/utilities/utility/utility.underlying/to_underlying.verify.cpp b/test/std/utilities/utility/utility.underlying/to_underlying.verify.cpp
index 9064ba4..b1b2881 100644
--- a/test/std/utilities/utility/utility.underlying/to_underlying.verify.cpp
+++ b/test/std/utilities/utility/utility.underlying/to_underlying.verify.cpp
@@ -6,7 +6,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-// UNSUPPORTED: c++03, c++11, c++14, c++17, c++2a
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
 
 // [utility.underlying], to_underlying
 // template <class T>
diff --git a/utils/libcxx/test/params.py b/utils/libcxx/test/params.py
index 2ced9d0..c6b4797 100644
--- a/utils/libcxx/test/params.py
+++ b/utils/libcxx/test/params.py
@@ -8,7 +8,6 @@
 
 from libcxx.test.dsl import *
 
-_allStandards = ['c++03', 'c++11', 'c++14', 'c++17', 'c++2a', 'c++2b']
 _warningFlags = [
   '-Werror',
   '-Wall',
@@ -38,14 +37,28 @@
   '-Wno-unused-local-typedef',
 ]
 
+_allStandards = ['c++03', 'c++11', 'c++14', 'c++17', 'c++20', 'c++2b']
+def getStdFlag(cfg, std):
+  fallbacks = {
+    'c++11': 'c++0x',
+    'c++14': 'c++1y',
+    'c++17': 'c++1z',
+    'c++20': 'c++2a',
+  }
+  if hasCompileFlag(cfg, '-std='+std):
+    return '-std='+std
+  if std in fallbacks and hasCompileFlag(cfg, '-std='+fallbacks[std]):
+    return '-std='+fallbacks[std]
+  return None
+
 DEFAULT_PARAMETERS = [
   # Core parameters of the test suite
   Parameter(name='std', choices=_allStandards, type=str,
             help="The version of the standard to compile the test suite with.",
-            default=lambda cfg: next(s for s in reversed(_allStandards) if hasCompileFlag(cfg, '-std='+s)),
+            default=lambda cfg: next(s for s in reversed(_allStandards) if getStdFlag(cfg, s)),
             actions=lambda std: [
               AddFeature(std),
-              AddCompileFlag('-std={}'.format(std)),
+              AddCompileFlag(lambda cfg: getStdFlag(cfg, std)),
             ]),
 
   Parameter(name='enable_exceptions', choices=[True, False], type=bool, default=True,