Update prebuilt Clang to r365631c1 from Android.

The version we had was segfaulting.

Bug: 132420445
Change-Id: Icb45a6fe0b4e2166f7895e669df1157cec9fb4e0
diff --git a/linux-x64/clang/AndroidVersion.txt b/linux-x64/clang/AndroidVersion.txt
index 8627386..35e0855 100644
--- a/linux-x64/clang/AndroidVersion.txt
+++ b/linux-x64/clang/AndroidVersion.txt
@@ -1,2 +1,2 @@
-9.0.3
-based on r353983c
+9.0.8
+based on r365631c1
diff --git a/linux-x64/clang/METADATA b/linux-x64/clang/METADATA
index f937c74..0ece934 100644
--- a/linux-x64/clang/METADATA
+++ b/linux-x64/clang/METADATA
@@ -8,9 +8,9 @@
   }
   url {
     type: GIT
-    value: "https://android.googlesource.com/platform/prebuilts/clang/host/linux-x86/+/master/clang-r353983c/"
+    value: "https://android.googlesource.com/platform/prebuilts/clang/host/linux-x86/+/master/clang-r365631c1/"
   }
-  version: "9.0.3"
-  last_upgrade_date { year: 2019 month: 10 day: 22 }
+  version: "9.0.8"
+  last_upgrade_date { year: 2020 month: 04 day: 07 }
   license_type: NOTICE
 }
diff --git a/linux-x64/clang/README.md b/linux-x64/clang/README.md
index 62bc573..a92a059 100644
--- a/linux-x64/clang/README.md
+++ b/linux-x64/clang/README.md
@@ -1,2 +1,2 @@
-This is the `clang-r353983c` directory from
+This is the `clang-r365631c1` directory from
 https://android.googlesource.com/platform/prebuilts/clang/host/linux-x86/
diff --git a/linux-x64/clang/bin/clang-9 b/linux-x64/clang/bin/clang-9
index 3051fa5..0c45da5 100755
--- a/linux-x64/clang/bin/clang-9
+++ b/linux-x64/clang/bin/clang-9
Binary files differ
diff --git a/linux-x64/clang/bin/clang-check b/linux-x64/clang/bin/clang-check
index c239976..9d587b5 100755
--- a/linux-x64/clang/bin/clang-check
+++ b/linux-x64/clang/bin/clang-check
Binary files differ
diff --git a/linux-x64/clang/bin/clang-cl b/linux-x64/clang/bin/clang-cl
new file mode 120000
index 0000000..060d289
--- /dev/null
+++ b/linux-x64/clang/bin/clang-cl
@@ -0,0 +1 @@
+clang
\ No newline at end of file
diff --git a/linux-x64/clang/bin/clang-format b/linux-x64/clang/bin/clang-format
index 2064aa9..2e42c93 100755
--- a/linux-x64/clang/bin/clang-format
+++ b/linux-x64/clang/bin/clang-format
Binary files differ
diff --git a/linux-x64/clang/bin/clang-tidy.real b/linux-x64/clang/bin/clang-tidy.real
index 5d685db..4845cd1 100755
--- a/linux-x64/clang/bin/clang-tidy.real
+++ b/linux-x64/clang/bin/clang-tidy.real
Binary files differ
diff --git a/linux-x64/clang/bin/dsymutil b/linux-x64/clang/bin/dsymutil
index f4a2b58..fdddf16 100755
--- a/linux-x64/clang/bin/dsymutil
+++ b/linux-x64/clang/bin/dsymutil
Binary files differ
diff --git a/linux-x64/clang/bin/git-clang-format b/linux-x64/clang/bin/git-clang-format
index 2696d09..ef7f22d 100755
--- a/linux-x64/clang/bin/git-clang-format
+++ b/linux-x64/clang/bin/git-clang-format
@@ -8,19 +8,19 @@
 #
 #===------------------------------------------------------------------------===#
 
-r"""                                                                             
-clang-format git integration                                                     
-============================                                                     
-                                                                                 
-This file provides a clang-format integration for git. Put it somewhere in your  
-path and ensure that it is executable. Then, "git clang-format" will invoke      
-clang-format on the changes in current files or a specific commit.               
-                                                                                 
-For further details, run:                                                        
-git clang-format -h                                                              
-                                                                                 
-Requires Python 2.7 or Python 3                                                  
-"""               
+r"""
+clang-format git integration
+============================
+
+This file provides a clang-format integration for git. Put it somewhere in your
+path and ensure that it is executable. Then, "git clang-format" will invoke
+clang-format on the changes in current files or a specific commit.
+
+For further details, run:
+git clang-format -h
+
+Requires Python 2.7 or Python 3
+"""
 
 from __future__ import absolute_import, division, print_function
 import argparse
@@ -77,7 +77,7 @@
       'c', 'h',  # C
       'm',  # ObjC
       'mm',  # ObjC++
-      'cc', 'cp', 'cpp', 'c++', 'cxx', 'hpp',  # C++
+      'cc', 'cp', 'cpp', 'c++', 'cxx', 'hpp', 'hxx',  # C++
       'cu',  # CUDA
       # Other languages that clang-format supports
       'proto', 'protodevel',  # Protocol Buffers
diff --git a/linux-x64/clang/bin/lld b/linux-x64/clang/bin/lld
index 471628c..802778d 100755
--- a/linux-x64/clang/bin/lld
+++ b/linux-x64/clang/bin/lld
Binary files differ
diff --git a/linux-x64/clang/bin/lldb b/linux-x64/clang/bin/lldb
new file mode 100755
index 0000000..8d4888d
--- /dev/null
+++ b/linux-x64/clang/bin/lldb
Binary files differ
diff --git a/linux-x64/clang/bin/lldb-argdumper b/linux-x64/clang/bin/lldb-argdumper
new file mode 100755
index 0000000..6be5366
--- /dev/null
+++ b/linux-x64/clang/bin/lldb-argdumper
Binary files differ
diff --git a/linux-x64/clang/bin/llvm-addr2line b/linux-x64/clang/bin/llvm-addr2line
new file mode 120000
index 0000000..51f8041
--- /dev/null
+++ b/linux-x64/clang/bin/llvm-addr2line
@@ -0,0 +1 @@
+llvm-symbolizer
\ No newline at end of file
diff --git a/linux-x64/clang/bin/llvm-ar b/linux-x64/clang/bin/llvm-ar
index ac10e0a..8af3d6a 100755
--- a/linux-x64/clang/bin/llvm-ar
+++ b/linux-x64/clang/bin/llvm-ar
Binary files differ
diff --git a/linux-x64/clang/bin/llvm-as b/linux-x64/clang/bin/llvm-as
index 6d2f4a4..3fbcf26 100755
--- a/linux-x64/clang/bin/llvm-as
+++ b/linux-x64/clang/bin/llvm-as
Binary files differ
diff --git a/linux-x64/clang/bin/llvm-cfi-verify b/linux-x64/clang/bin/llvm-cfi-verify
index 211ffcc..656006f 100755
--- a/linux-x64/clang/bin/llvm-cfi-verify
+++ b/linux-x64/clang/bin/llvm-cfi-verify
Binary files differ
diff --git a/linux-x64/clang/bin/llvm-config b/linux-x64/clang/bin/llvm-config
index c991475..eaa11ad 100755
--- a/linux-x64/clang/bin/llvm-config
+++ b/linux-x64/clang/bin/llvm-config
Binary files differ
diff --git a/linux-x64/clang/bin/llvm-cov b/linux-x64/clang/bin/llvm-cov
index 5d669a8..5b4774c 100755
--- a/linux-x64/clang/bin/llvm-cov
+++ b/linux-x64/clang/bin/llvm-cov
Binary files differ
diff --git a/linux-x64/clang/bin/llvm-dis b/linux-x64/clang/bin/llvm-dis
index e59ad4f..9fb8b23 100755
--- a/linux-x64/clang/bin/llvm-dis
+++ b/linux-x64/clang/bin/llvm-dis
Binary files differ
diff --git a/linux-x64/clang/bin/llvm-lib b/linux-x64/clang/bin/llvm-lib
new file mode 120000
index 0000000..3b94d1a
--- /dev/null
+++ b/linux-x64/clang/bin/llvm-lib
@@ -0,0 +1 @@
+llvm-ar
\ No newline at end of file
diff --git a/linux-x64/clang/bin/llvm-link b/linux-x64/clang/bin/llvm-link
index ea8c24e..a2f4315 100755
--- a/linux-x64/clang/bin/llvm-link
+++ b/linux-x64/clang/bin/llvm-link
Binary files differ
diff --git a/linux-x64/clang/bin/llvm-modextract b/linux-x64/clang/bin/llvm-modextract
index 16f8272..183b3d8 100755
--- a/linux-x64/clang/bin/llvm-modextract
+++ b/linux-x64/clang/bin/llvm-modextract
Binary files differ
diff --git a/linux-x64/clang/bin/llvm-nm b/linux-x64/clang/bin/llvm-nm
index 8a0caf1..acb9eb1 100755
--- a/linux-x64/clang/bin/llvm-nm
+++ b/linux-x64/clang/bin/llvm-nm
Binary files differ
diff --git a/linux-x64/clang/bin/llvm-objcopy b/linux-x64/clang/bin/llvm-objcopy
index c1ad8e9..7f8e818 100755
--- a/linux-x64/clang/bin/llvm-objcopy
+++ b/linux-x64/clang/bin/llvm-objcopy
Binary files differ
diff --git a/linux-x64/clang/bin/llvm-objdump b/linux-x64/clang/bin/llvm-objdump
index 9122f2f..e606975 100755
--- a/linux-x64/clang/bin/llvm-objdump
+++ b/linux-x64/clang/bin/llvm-objdump
Binary files differ
diff --git a/linux-x64/clang/bin/llvm-profdata b/linux-x64/clang/bin/llvm-profdata
index b8ac3ae..8a17796 100755
--- a/linux-x64/clang/bin/llvm-profdata
+++ b/linux-x64/clang/bin/llvm-profdata
Binary files differ
diff --git a/linux-x64/clang/bin/llvm-ranlib b/linux-x64/clang/bin/llvm-ranlib
new file mode 120000
index 0000000..3b94d1a
--- /dev/null
+++ b/linux-x64/clang/bin/llvm-ranlib
@@ -0,0 +1 @@
+llvm-ar
\ No newline at end of file
diff --git a/linux-x64/clang/bin/llvm-readelf b/linux-x64/clang/bin/llvm-readelf
new file mode 120000
index 0000000..a39a921
--- /dev/null
+++ b/linux-x64/clang/bin/llvm-readelf
@@ -0,0 +1 @@
+llvm-readobj
\ No newline at end of file
diff --git a/linux-x64/clang/bin/llvm-readobj b/linux-x64/clang/bin/llvm-readobj
index ea47277..c2f23c6 100755
--- a/linux-x64/clang/bin/llvm-readobj
+++ b/linux-x64/clang/bin/llvm-readobj
Binary files differ
diff --git a/linux-x64/clang/bin/llvm-size b/linux-x64/clang/bin/llvm-size
new file mode 100755
index 0000000..5a94fe0
--- /dev/null
+++ b/linux-x64/clang/bin/llvm-size
Binary files differ
diff --git a/linux-x64/clang/bin/llvm-strings b/linux-x64/clang/bin/llvm-strings
new file mode 100755
index 0000000..22ba580
--- /dev/null
+++ b/linux-x64/clang/bin/llvm-strings
Binary files differ
diff --git a/linux-x64/clang/bin/llvm-symbolizer b/linux-x64/clang/bin/llvm-symbolizer
index 7eea9d2..5518f3e 100755
--- a/linux-x64/clang/bin/llvm-symbolizer
+++ b/linux-x64/clang/bin/llvm-symbolizer
Binary files differ
diff --git a/linux-x64/clang/bin/sancov b/linux-x64/clang/bin/sancov
index ff57770..69af2f9 100755
--- a/linux-x64/clang/bin/sancov
+++ b/linux-x64/clang/bin/sancov
Binary files differ
diff --git a/linux-x64/clang/bin/sanstats b/linux-x64/clang/bin/sanstats
index 4a4e9f1..bfc01cd 100755
--- a/linux-x64/clang/bin/sanstats
+++ b/linux-x64/clang/bin/sanstats
Binary files differ
diff --git a/linux-x64/clang/bin/scan-build b/linux-x64/clang/bin/scan-build
index ed68b3b..903e19a 100755
--- a/linux-x64/clang/bin/scan-build
+++ b/linux-x64/clang/bin/scan-build
@@ -1460,6 +1460,16 @@
 }
 
 ##----------------------------------------------------------------------------##
+# FindXcrun - searches for the 'xcrun' executable. Returns "" if not found.
+##----------------------------------------------------------------------------##
+
+sub FindXcrun {
+  my $xcrun = `which xcrun`;
+  chomp $xcrun;
+  return $xcrun;
+}
+
+##----------------------------------------------------------------------------##
 # FindClang - searches for 'clang' executable.
 ##----------------------------------------------------------------------------##
 
@@ -1468,6 +1478,16 @@
     $Clang = Cwd::realpath("$RealBin/bin/clang") if (-f "$RealBin/bin/clang");
     if (!defined $Clang || ! -x $Clang) {
       $Clang = Cwd::realpath("$RealBin/clang") if (-f "$RealBin/clang");
+      if (!defined $Clang || ! -x $Clang) {
+        # When an Xcode toolchain is present, look for a clang in the sibling bin
+        # of the parent of the bin directory. So if scan-build is at
+        # $TOOLCHAIN/usr/local/bin/scan-build look for clang at
+        # $TOOLCHAIN/usr/bin/clang.
+        my $has_xcode_toolchain = FindXcrun() ne "";
+        if ($has_xcode_toolchain && -f "$RealBin/../../bin/clang") {
+          $Clang = Cwd::realpath("$RealBin/../../bin/clang");
+        }
+      }
     }
     if (!defined $Clang || ! -x $Clang) {
       return "error: Cannot find an executable 'clang' relative to" .
@@ -1477,8 +1497,7 @@
   }
   else {
     if ($Options{AnalyzerDiscoveryMethod} =~ /^[Xx]code$/) {
-      my $xcrun = `which xcrun`;
-      chomp $xcrun;
+      my $xcrun = FindXcrun();
       if ($xcrun eq "") {
         return "Cannot find 'xcrun' to find 'clang' for analysis.\n";
       }
diff --git a/linux-x64/clang/include/c++/v1/__config b/linux-x64/clang/include/c++/v1/__config
index 3ca6615..1ecced9 100644
--- a/linux-x64/clang/include/c++/v1/__config
+++ b/linux-x64/clang/include/c++/v1/__config
@@ -38,6 +38,10 @@
 #  define _LIBCPP_ABI_VERSION 1
 #endif
 
+#ifndef __STDC_HOSTED__
+#  define _LIBCPP_FREESTANDING
+#endif
+
 #ifndef _LIBCPP_STD_VER
 #  if  __cplusplus <= 201103L
 #    define _LIBCPP_STD_VER 11
@@ -92,10 +96,12 @@
 // Enable optimized version of __do_get_(un)signed which avoids redundant copies.
 #  define _LIBCPP_ABI_OPTIMIZED_LOCALE_NUM_GET
 // Use the smallest possible integer type to represent the index of the variant.
-// Previously libc++ used "unsigned int" exclusivly.
+// Previously libc++ used "unsigned int" exclusively.
 #  define _LIBCPP_ABI_VARIANT_INDEX_TYPE_OPTIMIZATION
 // Unstable attempt to provide a more optimized std::function
 #  define _LIBCPP_ABI_OPTIMIZED_FUNCTION
+// All the regex constants must be distinct and nonzero.
+#  define _LIBCPP_ABI_REGEX_CONSTANTS_NONZERO
 #elif _LIBCPP_ABI_VERSION == 1
 #  if !defined(_LIBCPP_OBJECT_FORMAT_COFF)
 // Enable compiling copies of now inline methods into the dylib to support
@@ -181,6 +187,10 @@
 #define _LIBCPP_CLANG_VER 0
 #endif
 
+#if defined(_LIBCPP_COMPILER_GCC) && __cplusplus < 201103L
+#error "libc++ does not support using GCC with C++03. Please enable C++11"
+#endif
+
 // FIXME: ABI detection should be done via compiler builtin macros. This
 // is just a placeholder until Clang implements such macros. For now assume
 // that Windows compilers pretending to be MSVC++ target the Microsoft ABI,
@@ -200,6 +210,10 @@
 #  endif
 #endif
 
+#if defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_NO_VCRUNTIME)
+# define _LIBCPP_ABI_VCRUNTIME
+#endif
+
 // Need to detect which libc we're using if we're on Linux.
 #if defined(__linux__)
 #  include <features.h>
@@ -256,7 +270,7 @@
 #  define _LIBCPP_WIN32API
 #  define _LIBCPP_LITTLE_ENDIAN
 #  define _LIBCPP_SHORT_WCHAR   1
-// Both MinGW and native MSVC provide a "MSVC"-like enviroment
+// Both MinGW and native MSVC provide a "MSVC"-like environment
 #  define _LIBCPP_MSVCRT_LIKE
 // If mingw not explicitly detected, assume using MS C runtime only if
 // a MS compatibility version is specified.
@@ -297,7 +311,7 @@
    // random data even when using sandboxing mechanisms such as chroots,
    // Capsicum, etc.
 #  define _LIBCPP_USING_ARC4_RANDOM
-#elif defined(__Fuchsia__)
+#elif defined(__Fuchsia__) || defined(__wasi__)
 #  define _LIBCPP_USING_GETENTROPY
 #elif defined(__native_client__)
    // NaCl's sandbox (which PNaCl also runs in) doesn't allow filesystem access,
@@ -331,7 +345,7 @@
 #  if defined(__FreeBSD__)
 #    define _LIBCPP_HAS_QUICK_EXIT
 #    define _LIBCPP_HAS_C11_FEATURES
-#  elif defined(__Fuchsia__)
+#  elif defined(__Fuchsia__) || defined(__wasi__)
 #    define _LIBCPP_HAS_QUICK_EXIT
 #    define _LIBCPP_HAS_TIMESPEC_GET
 #    define _LIBCPP_HAS_C11_FEATURES
@@ -399,10 +413,6 @@
 #define _LIBCPP_HAS_NO_STRONG_ENUMS
 #endif
 
-#if !(__has_feature(cxx_decltype))
-#define _LIBCPP_HAS_NO_DECLTYPE
-#endif
-
 #if __has_feature(cxx_attributes)
 #  define _LIBCPP_NORETURN [[noreturn]]
 #else
@@ -433,18 +443,6 @@
 #define _LIBCPP_HAS_NO_VARIADICS
 #endif
 
-#if !(__has_feature(cxx_generalized_initializers))
-#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
-#endif
-
-#if __has_feature(is_base_of)
-#define _LIBCPP_HAS_IS_BASE_OF
-#endif
-
-#if __has_feature(is_final)
-#define _LIBCPP_HAS_IS_FINAL
-#endif
-
 // Objective-C++ features (opt-in)
 #if __has_feature(objc_arc)
 #define _LIBCPP_HAS_OBJC_ARC
@@ -454,10 +452,6 @@
 #define _LIBCPP_HAS_OBJC_ARC_WEAK
 #endif
 
-#if !(__has_feature(cxx_constexpr))
-#define _LIBCPP_HAS_NO_CONSTEXPR
-#endif
-
 #if !(__has_feature(cxx_relaxed_constexpr))
 #define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
 #endif
@@ -470,14 +464,6 @@
 #define _LIBCPP_HAS_NO_NOEXCEPT
 #endif
 
-#if __has_feature(underlying_type)
-#define _LIBCPP_UNDERLYING_TYPE(T) __underlying_type(T)
-#endif
-
-#if __has_feature(is_literal)
-#define _LIBCPP_IS_LITERAL(T) __is_literal(T)
-#endif
-
 #if !defined(_LIBCPP_HAS_NO_ASAN) && !__has_feature(address_sanitizer)
 #define _LIBCPP_HAS_NO_ASAN
 #endif
@@ -509,69 +495,20 @@
 
 #define _LIBCPP_NORETURN __attribute__((noreturn))
 
-#if _GNUC_VER >= 407
-#define _LIBCPP_UNDERLYING_TYPE(T) __underlying_type(T)
-#define _LIBCPP_IS_LITERAL(T) __is_literal_type(T)
-#define _LIBCPP_HAS_IS_FINAL
-#endif
-
-#if defined(__GNUC__) && _GNUC_VER >= 403
-#define _LIBCPP_HAS_IS_BASE_OF
-#endif
-
 #if !__EXCEPTIONS && !defined(_LIBCPP_NO_EXCEPTIONS)
 #define _LIBCPP_NO_EXCEPTIONS
 #endif
 
-// constexpr was added to GCC in 4.6.
-#if _GNUC_VER < 406
-#  define _LIBCPP_HAS_NO_CONSTEXPR
-// Can only use constexpr in c++11 mode.
-#elif !defined(__GXX_EXPERIMENTAL_CXX0X__) && __cplusplus < 201103L
-#  define _LIBCPP_HAS_NO_CONSTEXPR
-#endif
-
 // Determine if GCC supports relaxed constexpr
 #if !defined(__cpp_constexpr) || __cpp_constexpr < 201304L
 #define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
 #endif
 
-// GCC 5 will support variable templates
+// GCC 5 supports variable templates
 #if !defined(__cpp_variable_templates) || __cpp_variable_templates < 201304L
 #define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
 #endif
 
-#ifndef __GXX_EXPERIMENTAL_CXX0X__
-
-#define _LIBCPP_HAS_NO_DECLTYPE
-#define _LIBCPP_HAS_NO_NULLPTR
-#define _LIBCPP_HAS_NO_UNICODE_CHARS
-#define _LIBCPP_HAS_NO_VARIADICS
-#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#define _LIBCPP_HAS_NO_STRONG_ENUMS
-#define _LIBCPP_HAS_NO_NOEXCEPT
-
-#else  // __GXX_EXPERIMENTAL_CXX0X__
-
-#if _GNUC_VER < 403
-#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#endif
-
-
-#if _GNUC_VER < 404
-#define _LIBCPP_HAS_NO_DECLTYPE
-#define _LIBCPP_HAS_NO_UNICODE_CHARS
-#define _LIBCPP_HAS_NO_VARIADICS
-#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
-#endif  // _GNUC_VER < 404
-
-#if _GNUC_VER < 406
-#define _LIBCPP_HAS_NO_NOEXCEPT
-#define _LIBCPP_HAS_NO_NULLPTR
-#endif
-
-#endif  // __GXX_EXPERIMENTAL_CXX0X__
-
 #if !defined(_LIBCPP_HAS_NO_ASAN) && !defined(__SANITIZE_ADDRESS__)
 #define _LIBCPP_HAS_NO_ASAN
 #endif
@@ -596,16 +533,12 @@
 #error "MSVC versions prior to Visual Studio 2015 are not supported"
 #endif
 
-#define _LIBCPP_HAS_IS_BASE_OF
-#define _LIBCPP_HAS_NO_CONSTEXPR
 #define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
 #define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
-#define _LIBCPP_HAS_NO_NOEXCEPT
 #define __alignof__ __alignof
 #define _LIBCPP_NORETURN __declspec(noreturn)
 #define _ALIGNAS(x) __declspec(align(x))
 #define _ALIGNAS_TYPE(x) alignas(x)
-#define _LIBCPP_HAS_NO_VARIADICS
 
 #define _LIBCPP_WEAK
 
@@ -622,12 +555,7 @@
 #define _ATTRIBUTE(x) __attribute__((x))
 #define _LIBCPP_NORETURN __attribute__((noreturn))
 
-#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
-#define _LIBCPP_HAS_NO_NOEXCEPT
-#define _LIBCPP_HAS_NO_NULLPTR
 #define _LIBCPP_HAS_NO_UNICODE_CHARS
-#define _LIBCPP_HAS_IS_BASE_OF
-#define _LIBCPP_HAS_IS_FINAL
 #define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
 
 #if defined(_AIX)
@@ -658,8 +586,13 @@
 #  define _LIBCPP_EXPORTED_FROM_ABI
 #elif defined(_LIBCPP_BUILDING_LIBRARY)
 #  define _LIBCPP_DLL_VIS __declspec(dllexport)
-#  define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
-#  define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS _LIBCPP_DLL_VIS
+#  if defined(__MINGW32__)
+#    define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS _LIBCPP_DLL_VIS
+#    define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS
+#  else
+#    define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
+#    define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS _LIBCPP_DLL_VIS
+#  endif
 #  define _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_DLL_VIS
 #  define _LIBCPP_EXPORTED_FROM_ABI __declspec(dllexport)
 #else
@@ -776,7 +709,7 @@
 #else
    // Try to approximate the effect of exclude_from_explicit_instantiation
    // (which is that entities are not assumed to be provided by explicit
-   // template instantitations in the dylib) by always inlining those entities.
+   // template instantiations in the dylib) by always inlining those entities.
 #  define _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION _LIBCPP_ALWAYS_INLINE
 #endif
 
@@ -788,6 +721,16 @@
 #  endif
 #endif
 
+#ifndef _LIBCPP_HAS_MERGED_TYPEINFO_NAMES_DEFAULT
+# ifdef _LIBCPP_OBJECT_FORMAT_COFF // Windows binaries can't merge typeinfos.
+# define _LIBCPP_HAS_MERGED_TYPEINFO_NAMES_DEFAULT 0
+#else
+// TODO: This isn't strictly correct on ELF platforms due to llvm.org/PR37398
+// And we should consider defaulting to OFF.
+# define _LIBCPP_HAS_MERGED_TYPEINFO_NAMES_DEFAULT 1
+#endif
+#endif
+
 #ifndef _LIBCPP_HIDE_FROM_ABI
 #  if _LIBCPP_HIDE_FROM_ABI_PER_TU
 #    define _LIBCPP_HIDE_FROM_ABI _LIBCPP_HIDDEN _LIBCPP_INTERNAL_LINKAGE
@@ -842,22 +785,6 @@
 #  define _NOEXCEPT_(x)
 #endif
 
-#if defined(_LIBCPP_DEBUG_USE_EXCEPTIONS)
-#  if !defined(_LIBCPP_DEBUG)
-#    error cannot use _LIBCPP_DEBUG_USE_EXCEPTIONS unless _LIBCPP_DEBUG is defined
-#  endif
-#  ifdef _LIBCPP_HAS_NO_NOEXCEPT
-#    define _NOEXCEPT_DEBUG
-#    define _NOEXCEPT_DEBUG_(x)
-#  else
-#    define _NOEXCEPT_DEBUG noexcept(false)
-#    define _NOEXCEPT_DEBUG_(x) noexcept(false)
-#  endif
-#else
-#  define _NOEXCEPT_DEBUG _NOEXCEPT
-#  define _NOEXCEPT_DEBUG_(x) _NOEXCEPT_(x)
-#endif
-
 #ifdef _LIBCPP_HAS_NO_UNICODE_CHARS
 typedef unsigned short char16_t;
 typedef unsigned int   char32_t;
@@ -868,30 +795,11 @@
 #endif
 
 #ifdef _LIBCPP_CXX03_LANG
-#  if __has_extension(c_static_assert)
-#    define static_assert(__b, __m) _Static_assert(__b, __m)
-#  else
-extern "C++" {
-template <bool> struct __static_assert_test;
-template <> struct __static_assert_test<true> {};
-template <unsigned> struct __static_assert_check {};
-}
-#    define static_assert(__b, __m) \
-       typedef __static_assert_check<sizeof(__static_assert_test<(__b)>)> \
-       _LIBCPP_CONCAT(__t, __LINE__)
-#  endif // __has_extension(c_static_assert)
+# define static_assert(...) _Static_assert(__VA_ARGS__)
+# define decltype(...) __decltype(__VA_ARGS__)
 #endif  // _LIBCPP_CXX03_LANG
 
-#ifdef _LIBCPP_HAS_NO_DECLTYPE
-// GCC 4.6 provides __decltype in all standard modes.
-#  if __has_keyword(__decltype) || _LIBCPP_CLANG_VER >= 304 || _GNUC_VER >= 406
-#    define decltype(__x) __decltype(__x)
-#  else
-#    define decltype(__x) __typeof__(__x)
-#  endif
-#endif
-
-#ifdef _LIBCPP_HAS_NO_CONSTEXPR
+#ifdef _LIBCPP_CXX03_LANG
 #  define _LIBCPP_CONSTEXPR
 #else
 #  define _LIBCPP_CONSTEXPR constexpr
@@ -910,9 +818,9 @@
 #endif
 
 #ifdef __GNUC__
-#  define _NOALIAS __attribute__((__malloc__))
+#  define _LIBCPP_NOALIAS __attribute__((__malloc__))
 #else
-#  define _NOALIAS
+#  define _LIBCPP_NOALIAS
 #endif
 
 #if __has_feature(cxx_explicit_conversions) || defined(__IBMCPP__) || \
@@ -965,10 +873,6 @@
 #define _LIBCPP_EXTERN_TEMPLATE2(...) extern template __VA_ARGS__;
 #endif
 
-#if defined(__APPLE__) && defined(__LP64__) && !defined(__x86_64__)
-#define _LIBCPP_NONUNIQUE_RTTI_BIT (1ULL << 63)
-#endif
-
 #if defined(__APPLE__) || defined(__FreeBSD__) || defined(_LIBCPP_MSVCRT_LIKE) || \
     defined(__sun__) || defined(__NetBSD__) || defined(__CloudABI__)
 #define _LIBCPP_LOCALE__L_EXTENSIONS 1
@@ -985,16 +889,12 @@
 #define _DECLARE_C99_LDBL_MATH 1
 #endif
 
-#if defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_NO_VCRUNTIME)
-#  define _LIBCPP_DEFER_NEW_TO_VCRUNTIME
-#endif
-
 // If we are getting operator new from the MSVC CRT, then allocation overloads
 // for align_val_t were added in 19.12, aka VS 2017 version 15.3.
 #if defined(_LIBCPP_MSVCRT) && defined(_MSC_VER) && _MSC_VER < 1912
 #  define _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION
-#elif defined(_LIBCPP_DEFER_NEW_TO_VCRUNTIME) && !defined(__cpp_aligned_new)
-   // We're defering to Microsoft's STL to provide aligned new et al. We don't
+#elif defined(_LIBCPP_ABI_VCRUNTIME) && !defined(__cpp_aligned_new)
+   // We're deferring to Microsoft's STL to provide aligned new et al. We don't
    // have it unless the language feature test macro is defined.
 #  define _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION
 #endif
@@ -1025,8 +925,10 @@
 #endif
 
 // Deprecation macros.
-// Deprecations warnings are only enabled when _LIBCPP_ENABLE_DEPRECATION_WARNINGS is defined.
-#if defined(_LIBCPP_ENABLE_DEPRECATION_WARNINGS)
+//
+// Deprecations warnings are always enabled, except when users explicitly opt-out
+// by defining _LIBCPP_DISABLE_DEPRECATION_WARNINGS.
+#if !defined(_LIBCPP_DISABLE_DEPRECATION_WARNINGS)
 #  if __has_attribute(deprecated)
 #    define _LIBCPP_DEPRECATED __attribute__ ((deprecated))
 #  elif _LIBCPP_STD_VER > 11
@@ -1128,6 +1030,12 @@
 #endif
 #endif
 
+#if __has_attribute(no_destroy)
+#  define _LIBCPP_NO_DESTROY __attribute__((__no_destroy__))
+#else
+#  define _LIBCPP_NO_DESTROY
+#endif
+
 #ifndef _LIBCPP_HAS_NO_ASAN
 _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
   const void *, const void *, const void *, const void *);
@@ -1158,6 +1066,7 @@
     !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
 #  if defined(__FreeBSD__) || \
       defined(__Fuchsia__) || \
+      defined(__wasi__) || \
       defined(__NetBSD__) || \
       defined(__linux__) || \
       defined(__GNU__) || \
@@ -1188,6 +1097,23 @@
        _LIBCPP_HAS_NO_THREADS is defined.
 #endif
 
+// The Apple, glibc, and Bionic implementation of pthreads implements
+// pthread_mutex_destroy as nop for regular mutexes. Additionally, Win32
+// mutexes have no destroy mechanism.
+// TODO(EricWF): Enable this optimization on Apple and Bionic platforms after
+// speaking to their respective stakeholders.
+#if (defined(_LIBCPP_HAS_THREAD_API_PTHREAD) && defined(__GLIBC__)) \
+  || defined(_LIBCPP_HAS_THREAD_API_WIN32)
+# define _LIBCPP_HAS_TRIVIAL_MUTEX_DESTRUCTION
+#endif
+
+// Destroying a condvar is a nop on Windows.
+// TODO(EricWF): This is potentially true for some pthread implementations
+// as well.
+#if defined(_LIBCPP_HAS_THREAD_API_WIN32)
+# define _LIBCPP_HAS_TRIVIAL_CONDVAR_DESTRUCTION
+#endif
+
 // Systems that use capability-based security (FreeBSD with Capsicum,
 // Nuxi CloudABI) may only provide local filesystem access (using *at()).
 // Functions like open(), rename(), unlink() and stat() should not be
@@ -1204,7 +1130,7 @@
 #endif
 
 #if defined(__BIONIC__) || defined(__CloudABI__) ||                            \
-    defined(__Fuchsia__) || defined(_LIBCPP_HAS_MUSL_LIBC)
+    defined(__Fuchsia__) || defined(__wasi__) || defined(_LIBCPP_HAS_MUSL_LIBC)
 #define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE
 #endif
 
@@ -1216,13 +1142,22 @@
 
 #if __has_feature(cxx_atomic) || __has_extension(c_atomic) || __has_keyword(_Atomic)
 #  define _LIBCPP_HAS_C_ATOMIC_IMP
-#elif _GNUC_VER > 407
+#elif defined(_LIBCPP_COMPILER_GCC)
 #  define _LIBCPP_HAS_GCC_ATOMIC_IMP
 #endif
 
-#if (!defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_GCC_ATOMIC_IMP)) \
+#if (!defined(_LIBCPP_HAS_C_ATOMIC_IMP) && \
+     !defined(_LIBCPP_HAS_GCC_ATOMIC_IMP) && \
+     !defined(_LIBCPP_HAS_EXTERNAL_ATOMIC_IMP)) \
      || defined(_LIBCPP_HAS_NO_THREADS)
-#define _LIBCPP_HAS_NO_ATOMIC_HEADER
+#  define _LIBCPP_HAS_NO_ATOMIC_HEADER
+#else
+#  ifndef _LIBCPP_ATOMIC_FLAG_TYPE
+#    define _LIBCPP_ATOMIC_FLAG_TYPE bool
+#  endif
+#  ifdef _LIBCPP_FREESTANDING
+#    define _LIBCPP_ATOMIC_ONLY_USE_BUILTINS
+#  endif
 #endif
 
 #ifndef _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
@@ -1250,6 +1185,10 @@
 #define _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF
 #endif
 
+#if !__has_builtin(__builtin_is_constant_evaluated) && _GNUC_VER < 900
+#define _LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED
+#endif
+
 #if !defined(_LIBCPP_HAS_NO_OFF_T_FUNCTIONS)
 #  if defined(_LIBCPP_MSVCRT) || defined(_NEWLIB_VERSION)
 #    define _LIBCPP_HAS_NO_OFF_T_FUNCTIONS
@@ -1277,6 +1216,21 @@
 #  define _LIBCPP_FALLTHROUGH() ((void)0)
 #endif
 
+#if __has_attribute(__nodebug__)
+#define _LIBCPP_NODEBUG __attribute__((__nodebug__))
+#else
+#define _LIBCPP_NODEBUG
+#endif
+
+#ifndef _LIBCPP_NODEBUG_TYPE
+#if __has_attribute(__nodebug__) && \
+    (defined(_LIBCPP_COMPILER_CLANG) && _LIBCPP_CLANG_VER >= 900)
+#define _LIBCPP_NODEBUG_TYPE __attribute__((nodebug))
+#else
+#define _LIBCPP_NODEBUG_TYPE
+#endif
+#endif // !defined(_LIBCPP_NODEBUG_TYPE)
+
 #if defined(_LIBCPP_ABI_MICROSOFT) && \
     (defined(_LIBCPP_COMPILER_MSVC) || __has_declspec_attribute(empty_bases))
 #  define _LIBCPP_DECLSPEC_EMPTY_BASES __declspec(empty_bases)
@@ -1312,7 +1266,8 @@
 #if !defined(_LIBCPP_BUILDING_LIBRARY) &&                                      \
     !defined(_LIBCPP_DISABLE_AVAILABILITY) &&                                  \
     __has_feature(attribute_availability_with_strict) &&                       \
-    __has_feature(attribute_availability_in_templates)
+    __has_feature(attribute_availability_in_templates) &&                      \
+    __has_extension(pragma_clang_attribute_external_declaration)
 #  ifdef __APPLE__
 #    define _LIBCPP_USE_AVAILABILITY_APPLE
 #  endif
@@ -1355,6 +1310,21 @@
 #  define _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR                               \
      __attribute__((availability(macosx,strict,introduced=10.9)))              \
      __attribute__((availability(ios,strict,introduced=7.0)))
+#  define _LIBCPP_AVAILABILITY_FILESYSTEM                                      \
+     __attribute__((availability(macosx,strict,introduced=10.15)))             \
+     __attribute__((availability(ios,strict,introduced=13.0)))                 \
+     __attribute__((availability(tvos,strict,introduced=13.0)))                \
+     __attribute__((availability(watchos,strict,introduced=6.0)))
+#  define _LIBCPP_AVAILABILITY_FILESYSTEM_PUSH                                 \
+     _Pragma("clang attribute push(__attribute__((availability(macosx,strict,introduced=10.15))), apply_to=any(function,record))") \
+     _Pragma("clang attribute push(__attribute__((availability(ios,strict,introduced=13.0))), apply_to=any(function,record))")     \
+     _Pragma("clang attribute push(__attribute__((availability(tvos,strict,introduced=13.0))), apply_to=any(function,record))")    \
+     _Pragma("clang attribute push(__attribute__((availability(watchos,strict,introduced=6.0))), apply_to=any(function,record))")
+#  define _LIBCPP_AVAILABILITY_FILESYSTEM_POP                                  \
+     _Pragma("clang attribute pop")                                            \
+     _Pragma("clang attribute pop")                                            \
+     _Pragma("clang attribute pop")                                            \
+     _Pragma("clang attribute pop")
 #else
 #  define _LIBCPP_AVAILABILITY_SHARED_MUTEX
 #  define _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS
@@ -1366,6 +1336,9 @@
 #  define _LIBCPP_AVAILABILITY_TYPEINFO_VTABLE
 #  define _LIBCPP_AVAILABILITY_LOCALE_CATEGORY
 #  define _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR
+#  define _LIBCPP_AVAILABILITY_FILESYSTEM
+#  define _LIBCPP_AVAILABILITY_FILESYSTEM_PUSH
+#  define _LIBCPP_AVAILABILITY_FILESYSTEM_POP
 #endif
 
 // Define availability that depends on _LIBCPP_NO_EXCEPTIONS.
diff --git a/linux-x64/clang/include/c++/v1/__cxxabi_config.h b/linux-x64/clang/include/c++/v1/__cxxabi_config.h
index c5e6e89..1e0edca 100644
--- a/linux-x64/clang/include/c++/v1/__cxxabi_config.h
+++ b/linux-x64/clang/include/c++/v1/__cxxabi_config.h
@@ -61,6 +61,8 @@
 
 #if defined(__clang__)
 #define _LIBCXXABI_COMPILER_CLANG
+#elif defined(__GNUC__)
+#define _LIBCXXABI_COMPILER_GCC
 #endif
 
 #if __has_attribute(__no_sanitize__) && defined(_LIBCXXABI_COMPILER_CLANG)
@@ -69,4 +71,8 @@
 #define _LIBCXXABI_NO_CFI
 #endif
 
+#if defined(__arm__)
+#  define _LIBCXXABI_GUARD_ABI_ARM
+#endif
+
 #endif // ____CXXABI_CONFIG_H
diff --git a/linux-x64/clang/include/c++/v1/__debug b/linux-x64/clang/include/c++/v1/__debug
index 6ccb72c..524c5ff 100644
--- a/linux-x64/clang/include/c++/v1/__debug
+++ b/linux-x64/clang/include/c++/v1/__debug
@@ -11,6 +11,7 @@
 #define _LIBCPP_DEBUG_H
 
 #include <__config>
+#include <iosfwd>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header
@@ -24,7 +25,6 @@
 #   include <cstdlib>
 #   include <cstdio>
 #   include <cstddef>
-#   include <exception>
 #endif
 
 #if _LIBCPP_DEBUG_LEVEL >= 1 && !defined(_LIBCPP_ASSERT)
@@ -49,10 +49,6 @@
 #define _LIBCPP_DEBUG_MODE(...) ((void)0)
 #endif
 
-#if _LIBCPP_DEBUG_LEVEL < 1
-class _LIBCPP_EXCEPTION_ABI __libcpp_debug_exception;
-#endif
-
 _LIBCPP_BEGIN_NAMESPACE_STD
 
 struct _LIBCPP_TEMPLATE_VIS __libcpp_debug_info {
@@ -62,6 +58,9 @@
   _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
   __libcpp_debug_info(const char* __f, int __l, const char* __p, const char* __m)
     : __file_(__f), __line_(__l), __pred_(__p), __msg_(__m) {}
+
+  _LIBCPP_FUNC_VIS std::string what() const;
+
   const char* __file_;
   int __line_;
   const char* __pred_;
@@ -79,38 +78,11 @@
 _LIBCPP_NORETURN _LIBCPP_FUNC_VIS
 void __libcpp_abort_debug_function(__libcpp_debug_info const&);
 
-/// __libcpp_throw_debug_function - A debug handler that throws
-///   an instance of __libcpp_debug_exception when called.
- _LIBCPP_NORETURN _LIBCPP_FUNC_VIS
-void __libcpp_throw_debug_function(__libcpp_debug_info const&);
-
 /// __libcpp_set_debug_function - Set the debug handler to the specified
 ///    function.
 _LIBCPP_FUNC_VIS
 bool __libcpp_set_debug_function(__libcpp_debug_function_type __func);
 
-// Setup the throwing debug handler during dynamic initialization.
-#if _LIBCPP_DEBUG_LEVEL >= 1 && defined(_LIBCPP_DEBUG_USE_EXCEPTIONS)
-# if defined(_LIBCPP_NO_EXCEPTIONS)
-#   error _LIBCPP_DEBUG_USE_EXCEPTIONS cannot be used when exceptions are disabled.
-# endif
-static bool __init_dummy = __libcpp_set_debug_function(__libcpp_throw_debug_function);
-#endif
-
-#if _LIBCPP_DEBUG_LEVEL >= 1 || defined(_LIBCPP_BUILDING_LIBRARY)
-class _LIBCPP_EXCEPTION_ABI __libcpp_debug_exception : public exception {
-public:
-  __libcpp_debug_exception() _NOEXCEPT;
-  explicit __libcpp_debug_exception(__libcpp_debug_info const& __i);
-  __libcpp_debug_exception(__libcpp_debug_exception const&);
-  ~__libcpp_debug_exception() _NOEXCEPT;
-  const char* what() const _NOEXCEPT;
-private:
-  struct __libcpp_debug_exception_imp;
-  __libcpp_debug_exception_imp *__imp_;
-};
-#endif
-
 #if _LIBCPP_DEBUG_LEVEL >= 2 || defined(_LIBCPP_BUILDING_LIBRARY)
 
 struct _LIBCPP_TYPE_VIS __c_node;
@@ -250,16 +222,22 @@
     __db_c_const_iterator __c_end() const;
     __db_i_const_iterator __i_end() const;
 
+    typedef __c_node*(_InsertConstruct)(void*, void*, __c_node*);
+
+    template <class _Cont>
+    _LIBCPP_INLINE_VISIBILITY static __c_node* __create_C_node(void *__mem, void *__c, __c_node *__next) {
+        return ::new(__mem) _C_node<_Cont>(__c, __next);
+    }
+
     template <class _Cont>
     _LIBCPP_INLINE_VISIBILITY
     void __insert_c(_Cont* __c)
     {
-        __c_node* __n = __insert_c(static_cast<void*>(__c));
-        ::new(__n) _C_node<_Cont>(__n->__c_, __n->__next_);
+        __insert_c(static_cast<void*>(__c), &__create_C_node<_Cont>);
     }
 
     void __insert_i(void* __i);
-    __c_node* __insert_c(void* __c);
+    void __insert_c(void* __c, _InsertConstruct* __fn);
     void __erase_c(void* __c);
 
     void __insert_ic(void* __i, const void* __c);
diff --git a/linux-x64/clang/include/c++/v1/__functional_base b/linux-x64/clang/include/c++/v1/__functional_base
index 8da8324..9587d7a 100644
--- a/linux-x64/clang/include/c++/v1/__functional_base
+++ b/linux-x64/clang/include/c++/v1/__functional_base
@@ -125,7 +125,7 @@
     : public __maybe_derive_from_unary_function<_Tp>,
       public __maybe_derive_from_binary_function<_Tp>
 {
-    typedef typename _Tp::result_type result_type;
+    typedef _LIBCPP_NODEBUG_TYPE typename _Tp::result_type result_type;
 };
 
 template <class _Tp>
@@ -146,19 +146,19 @@
 template <class _Rp>
 struct __weak_result_type<_Rp ()>
 {
-    typedef _Rp result_type;
+    typedef _LIBCPP_NODEBUG_TYPE  _Rp result_type;
 };
 
 template <class _Rp>
 struct __weak_result_type<_Rp (&)()>
 {
-    typedef _Rp result_type;
+    typedef _LIBCPP_NODEBUG_TYPE  _Rp result_type;
 };
 
 template <class _Rp>
 struct __weak_result_type<_Rp (*)()>
 {
-    typedef _Rp result_type;
+    typedef _LIBCPP_NODEBUG_TYPE  _Rp result_type;
 };
 
 // 1 argument case
@@ -610,7 +610,7 @@
 template <class _Tp, class _Alloc, class ..._Args>
 struct __uses_alloc_ctor_imp
 {
-    typedef typename __uncvref<_Alloc>::type _RawAlloc;
+    typedef _LIBCPP_NODEBUG_TYPE typename __uncvref<_Alloc>::type _RawAlloc;
     static const bool __ua = uses_allocator<_Tp, _RawAlloc>::value;
     static const bool __ic =
         is_constructible<_Tp, allocator_arg_t, _Alloc, _Args...>::value;
diff --git a/linux-x64/clang/include/c++/v1/__hash_table b/linux-x64/clang/include/c++/v1/__hash_table
index 4409d6d..e02d347 100644
--- a/linux-x64/clang/include/c++/v1/__hash_table
+++ b/linux-x64/clang/include/c++/v1/__hash_table
@@ -875,9 +875,9 @@
 template <class _Key, class _Hash, class _Equal>
 #ifndef _LIBCPP_CXX03_LANG
     _LIBCPP_DIAGNOSE_WARNING(!__invokable<_Equal const&, _Key const&, _Key const&>::value,
-    "the specified comparator type does not provide a const call operator")
+    "the specified comparator type does not provide a viable const call operator")
     _LIBCPP_DIAGNOSE_WARNING(!__invokable<_Hash const&, _Key const&>::value,
-    "the specified hash functor does not provide a const call operator")
+    "the specified hash functor does not provide a viable const call operator")
 #endif
 typename __enforce_unordered_container_requirements<_Key, _Hash, _Equal>::type
 __diagnose_unordered_container_requirements(int);
@@ -1260,7 +1260,7 @@
 
     void swap(__hash_table& __u)
 #if _LIBCPP_STD_VER <= 11
-        _NOEXCEPT_DEBUG_(
+        _NOEXCEPT_(
             __is_nothrow_swappable<hasher>::value && __is_nothrow_swappable<key_equal>::value
             && (!allocator_traits<__pointer_allocator>::propagate_on_container_swap::value
                   || __is_nothrow_swappable<__pointer_allocator>::value)
@@ -1268,7 +1268,7 @@
                   || __is_nothrow_swappable<__node_allocator>::value)
             );
 #else
-     _NOEXCEPT_DEBUG_(__is_nothrow_swappable<hasher>::value && __is_nothrow_swappable<key_equal>::value);
+     _NOEXCEPT_(__is_nothrow_swappable<hasher>::value && __is_nothrow_swappable<key_equal>::value);
 #endif
 
     _LIBCPP_INLINE_VISIBILITY
@@ -2248,7 +2248,7 @@
         return _InsertReturnType{end(), false, _NodeHandle()};
     pair<iterator, bool> __result = __node_insert_unique(__nh.__ptr_);
     if (__result.second)
-        __nh.__release();
+        __nh.__release_ptr();
     return _InsertReturnType{__result.first, __result.second, _VSTD::move(__nh)};
 }
 
@@ -2263,7 +2263,7 @@
         return end();
     pair<iterator, bool> __result = __node_insert_unique(__nh.__ptr_);
     if (__result.second)
-        __nh.__release();
+        __nh.__release_ptr();
     return __result.first;
 }
 
@@ -2327,7 +2327,7 @@
     if (__nh.empty())
         return end();
     iterator __result = __node_insert_multi(__nh.__ptr_);
-    __nh.__release();
+    __nh.__release_ptr();
     return __result;
 }
 
@@ -2341,7 +2341,7 @@
     if (__nh.empty())
         return end();
     iterator __result = __node_insert_multi(__hint, __nh.__ptr_);
-    __nh.__release();
+    __nh.__release_ptr();
     return __result;
 }
 
@@ -2807,7 +2807,7 @@
 void
 __hash_table<_Tp, _Hash, _Equal, _Alloc>::swap(__hash_table& __u)
 #if _LIBCPP_STD_VER <= 11
-    _NOEXCEPT_DEBUG_(
+    _NOEXCEPT_(
         __is_nothrow_swappable<hasher>::value && __is_nothrow_swappable<key_equal>::value
         && (!allocator_traits<__pointer_allocator>::propagate_on_container_swap::value
               || __is_nothrow_swappable<__pointer_allocator>::value)
@@ -2815,7 +2815,7 @@
               || __is_nothrow_swappable<__node_allocator>::value)
             )
 #else
-  _NOEXCEPT_DEBUG_(__is_nothrow_swappable<hasher>::value && __is_nothrow_swappable<key_equal>::value)
+  _NOEXCEPT_(__is_nothrow_swappable<hasher>::value && __is_nothrow_swappable<key_equal>::value)
 #endif
 {
     _LIBCPP_ASSERT(__node_traits::propagate_on_container_swap::value ||
diff --git a/linux-x64/clang/include/c++/v1/__locale b/linux-x64/clang/include/c++/v1/__locale
index d1d66f9..d382e4d 100644
--- a/linux-x64/clang/include/c++/v1/__locale
+++ b/linux-x64/clang/include/c++/v1/__locale
@@ -19,6 +19,7 @@
 #include <cctype>
 #include <locale.h>
 #if defined(_LIBCPP_MSVCRT_LIKE)
+# include <cstring>
 # include <support/win32/locale_win32.h>
 #elif defined(_AIX)
 # include <support/ibm/xlocale.h>
@@ -34,6 +35,9 @@
 # include <xlocale.h>
 #elif defined(__Fuchsia__)
 # include <support/fuchsia/xlocale.h>
+#elif defined(__wasi__)
+// WASI libc uses musl's locales support.
+# include <support/musl/xlocale.h>
 #elif defined(_LIBCPP_HAS_MUSL_LIBC)
 # include <support/musl/xlocale.h>
 #endif
@@ -63,28 +67,41 @@
 #elif defined(_LIBCPP_MSVCRT_LIKE)
 struct __libcpp_locale_guard {
     __libcpp_locale_guard(locale_t __l) :
-        __status(_configthreadlocale(_ENABLE_PER_THREAD_LOCALE)),
-        __locale_collate(setlocale(LC_COLLATE, __l.__get_locale())),
-        __locale_ctype(setlocale(LC_CTYPE, __l.__get_locale())),
-        __locale_monetary(setlocale(LC_MONETARY, __l.__get_locale())),
-        __locale_numeric(setlocale(LC_NUMERIC, __l.__get_locale())),
-        __locale_time(setlocale(LC_TIME, __l.__get_locale()))
-        // LC_MESSAGES is not supported on Windows.
-    {}
+        __status(_configthreadlocale(_ENABLE_PER_THREAD_LOCALE)) {
+      // Setting the locale can be expensive even when the locale given is
+      // already the current locale, so do an explicit check to see if the
+      // current locale is already the one we want.
+      const char* __lc = __setlocale(nullptr);
+      // If every category is the same, the locale string will simply be the
+      // locale name, otherwise it will be a semicolon-separated string listing
+      // each category.  In the second case, we know at least one category won't
+      // be what we want, so we only have to check the first case.
+      if (strcmp(__l.__get_locale(), __lc) != 0) {
+        __locale_all = _strdup(__lc);
+        if (__locale_all == nullptr)
+          __throw_bad_alloc();
+        __setlocale(__l.__get_locale());
+      }
+    }
     ~__libcpp_locale_guard() {
-        setlocale(LC_COLLATE, __locale_collate);
-        setlocale(LC_CTYPE, __locale_ctype);
-        setlocale(LC_MONETARY, __locale_monetary);
-        setlocale(LC_NUMERIC, __locale_numeric);
-        setlocale(LC_TIME, __locale_time);
-        _configthreadlocale(__status);
+      // The CRT documentation doesn't explicitly say, but setlocale() does the
+      // right thing when given a semicolon-separated list of locale settings
+      // for the different categories in the same format as returned by
+      // setlocale(LC_ALL, nullptr).
+      if (__locale_all != nullptr) {
+        __setlocale(__locale_all);
+        free(__locale_all);
+      }
+      _configthreadlocale(__status);
+    }
+    static const char* __setlocale(const char* __locale) {
+      const char* __new_locale = setlocale(LC_ALL, __locale);
+      if (__new_locale == nullptr)
+        __throw_bad_alloc();
+      return __new_locale;
     }
     int __status;
-    char* __locale_collate;
-    char* __locale_ctype;
-    char* __locale_monetary;
-    char* __locale_numeric;
-    char* __locale_time;
+    char* __locale_all = nullptr;
 };
 #endif
 
@@ -254,7 +271,10 @@
         return do_compare(__lo1, __hi1, __lo2, __hi2);
     }
 
+    // FIXME(EricWF): The _LIBCPP_ALWAYS_INLINE is needed on Windows to work
+    // around a dllimport bug that expects an external instantiation.
     _LIBCPP_INLINE_VISIBILITY
+    _LIBCPP_ALWAYS_INLINE
     string_type transform(const char_type* __lo, const char_type* __hi) const
     {
         return do_transform(__lo, __hi);
@@ -388,6 +408,11 @@
     static const mask punct  = _ISpunct;
     static const mask xdigit = _ISxdigit;
     static const mask blank  = _ISblank;
+#if defined(__mips__)
+    static const mask __regex_word = static_cast<char_class_type>(_ISbit(15));
+#else
+    static const mask __regex_word = 0x80;
+#endif
 #elif defined(_LIBCPP_MSVCRT_LIKE)
     typedef unsigned short mask;
     static const mask space  = _SPACE;
@@ -400,6 +425,7 @@
     static const mask punct  = _PUNCT;
     static const mask xdigit = _HEX;
     static const mask blank  = _BLANK;
+    static const mask __regex_word = 0x80;
 # define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_PRINT
 #elif defined(__APPLE__) || defined(__FreeBSD__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)
 # ifdef __APPLE__
@@ -421,8 +447,12 @@
 
 # if defined(__NetBSD__)
     static const mask blank  = _CTYPE_BL;
+    // NetBSD defines classes up to 0x2000
+    // see sys/ctype_bits.h, _CTYPE_Q
+    static const mask __regex_word = 0x8000;
 # else
     static const mask blank  = _CTYPE_B;
+    static const mask __regex_word = 0x80;
 # endif
 #elif defined(__sun__) || defined(_AIX)
     typedef unsigned int mask;
@@ -436,6 +466,7 @@
     static const mask punct  = _ISPUNCT;
     static const mask xdigit = _ISXDIGIT;
     static const mask blank  = _ISBLANK;
+    static const mask __regex_word = 0x80;
 #elif defined(_NEWLIB_VERSION)
     // Same type as Newlib's _ctype_ array in newlib/libc/include/ctype.h.
     typedef char mask;
@@ -449,6 +480,7 @@
     static const mask punct  = _P;
     static const mask xdigit = _X | _N;
     static const mask blank  = _B;
+    static const mask __regex_word = 0x80;
 # define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_PRINT
 # define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_ALPHA
 # define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_XDIGIT
@@ -464,6 +496,7 @@
     static const mask punct  = 1<<7;
     static const mask xdigit = 1<<8;
     static const mask blank  = 1<<9;
+    static const mask __regex_word = 1<<10;
 #endif
     static const mask alnum  = alpha | digit;
     static const mask graph  = alnum | punct;
@@ -1229,8 +1262,6 @@
 _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char16_t, char, mbstate_t>)
 _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char32_t, char, mbstate_t>)
 
-_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void __throw_runtime_error(const char*);
-
 template <size_t _Np>
 struct __narrow_to_utf8
 {
diff --git a/linux-x64/clang/include/c++/v1/__mutex_base b/linux-x64/clang/include/c++/v1/__mutex_base
index 008be95..f828bea 100644
--- a/linux-x64/clang/include/c++/v1/__mutex_base
+++ b/linux-x64/clang/include/c++/v1/__mutex_base
@@ -36,28 +36,24 @@
 #  endif
 #endif  // _LIBCPP_THREAD_SAFETY_ANNOTATION
 
+
 class _LIBCPP_TYPE_VIS _LIBCPP_THREAD_SAFETY_ANNOTATION(capability("mutex")) mutex
 {
-#ifndef _LIBCPP_CXX03_LANG
     __libcpp_mutex_t __m_ = _LIBCPP_MUTEX_INITIALIZER;
-#else
-    __libcpp_mutex_t __m_;
-#endif
 
 public:
     _LIBCPP_INLINE_VISIBILITY
-#ifndef _LIBCPP_CXX03_LANG
-    constexpr mutex() = default;
+    _LIBCPP_CONSTEXPR mutex() = default;
+
+    mutex(const mutex&) = delete;
+    mutex& operator=(const mutex&) = delete;
+
+#if defined(_LIBCPP_HAS_TRIVIAL_MUTEX_DESTRUCTION)
+    ~mutex() = default;
 #else
-    mutex() _NOEXCEPT {__m_ = (__libcpp_mutex_t)_LIBCPP_MUTEX_INITIALIZER;}
+    ~mutex() _NOEXCEPT;
 #endif
-    ~mutex();
 
-private:
-    mutex(const mutex&);// = delete;
-    mutex& operator=(const mutex&);// = delete;
-
-public:
     void lock() _LIBCPP_THREAD_SAFETY_ANNOTATION(acquire_capability());
     bool try_lock() _NOEXCEPT _LIBCPP_THREAD_SAFETY_ANNOTATION(try_acquire_capability(true));
     void unlock() _NOEXCEPT _LIBCPP_THREAD_SAFETY_ANNOTATION(release_capability());
@@ -286,26 +282,20 @@
 
 class _LIBCPP_TYPE_VIS condition_variable
 {
-#ifndef _LIBCPP_CXX03_LANG
     __libcpp_condvar_t __cv_ = _LIBCPP_CONDVAR_INITIALIZER;
-#else
-    __libcpp_condvar_t __cv_;
-#endif
-
 public:
     _LIBCPP_INLINE_VISIBILITY
-#ifndef _LIBCPP_CXX03_LANG
-    constexpr condition_variable() _NOEXCEPT = default;
+    _LIBCPP_CONSTEXPR condition_variable() _NOEXCEPT = default;
+
+#ifdef _LIBCPP_HAS_TRIVIAL_CONDVAR_DESTRUCTION
+    ~condition_variable() = default;
 #else
-    condition_variable() _NOEXCEPT {__cv_ = (__libcpp_condvar_t)_LIBCPP_CONDVAR_INITIALIZER;}
-#endif
     ~condition_variable();
+#endif
 
-private:
-    condition_variable(const condition_variable&); // = delete;
-    condition_variable& operator=(const condition_variable&); // = delete;
+    condition_variable(const condition_variable&) = delete;
+    condition_variable& operator=(const condition_variable&) = delete;
 
-public:
     void notify_one() _NOEXCEPT;
     void notify_all() _NOEXCEPT;
 
diff --git a/linux-x64/clang/include/c++/v1/__node_handle b/linux-x64/clang/include/c++/v1/__node_handle
index 7f3bd9d..be1fe17 100644
--- a/linux-x64/clang/include/c++/v1/__node_handle
+++ b/linux-x64/clang/include/c++/v1/__node_handle
@@ -56,7 +56,7 @@
     optional<allocator_type> __alloc_;
 
     _LIBCPP_INLINE_VISIBILITY
-    void __release()
+    void __release_ptr()
     {
         __ptr_ = nullptr;
         __alloc_ = _VSTD::nullopt;
@@ -193,8 +193,7 @@
     __basic_node_handle< _NodeType, _Alloc, __map_node_handle_specifics>;
 
 template <class _Iterator, class _NodeType>
-_LIBCPP_TEMPLATE_VIS
-struct __insert_return_type
+struct _LIBCPP_TEMPLATE_VIS __insert_return_type
 {
     _Iterator position;
     bool inserted;
diff --git a/linux-x64/clang/include/c++/v1/__threading_support b/linux-x64/clang/include/c++/v1/__threading_support
index baa1222..589fe20 100644
--- a/linux-x64/clang/include/c++/v1/__threading_support
+++ b/linux-x64/clang/include/c++/v1/__threading_support
@@ -22,6 +22,8 @@
 # include <__external_threading>
 #elif !defined(_LIBCPP_HAS_NO_THREADS)
 
+typedef ::timespec __libcpp_timespec_t;
+
 #if defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
 # include <pthread.h>
 # include <sched.h>
@@ -148,7 +150,7 @@
 
 _LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS
 int __libcpp_condvar_timedwait(__libcpp_condvar_t *__cv, __libcpp_mutex_t *__m,
-                               timespec *__ts);
+                               __libcpp_timespec_t *__ts);
 
 _LIBCPP_THREAD_ABI_VISIBILITY
 int __libcpp_condvar_destroy(__libcpp_condvar_t* __cv);
@@ -156,7 +158,7 @@
 // Execute once
 _LIBCPP_THREAD_ABI_VISIBILITY
 int __libcpp_execute_once(__libcpp_exec_once_flag *flag,
-                          void (*init_routine)(void));
+                          void (*init_routine)());
 
 // Thread id
 _LIBCPP_THREAD_ABI_VISIBILITY
@@ -287,7 +289,7 @@
 }
 
 int __libcpp_condvar_timedwait(__libcpp_condvar_t *__cv, __libcpp_mutex_t *__m,
-                               timespec *__ts)
+                               __libcpp_timespec_t *__ts)
 {
   return pthread_cond_timedwait(__cv, __m, __ts);
 }
@@ -299,7 +301,7 @@
 
 // Execute once
 int __libcpp_execute_once(__libcpp_exec_once_flag *flag,
-                          void (*init_routine)(void)) {
+                          void (*init_routine)()) {
   return pthread_once(flag, init_routine);
 }
 
@@ -356,7 +358,7 @@
 {
    using namespace chrono;
    seconds __s = duration_cast<seconds>(__ns);
-   timespec __ts;
+   __libcpp_timespec_t __ts;
    typedef decltype(__ts.tv_sec) ts_sec;
    _LIBCPP_CONSTEXPR ts_sec __ts_sec_max = numeric_limits<ts_sec>::max();
 
diff --git a/linux-x64/clang/include/c++/v1/__tree b/linux-x64/clang/include/c++/v1/__tree
index 9f0931e..4473ac3 100644
--- a/linux-x64/clang/include/c++/v1/__tree
+++ b/linux-x64/clang/include/c++/v1/__tree
@@ -971,7 +971,7 @@
 template<class _Tp, class _Compare>
 #ifndef _LIBCPP_CXX03_LANG
     _LIBCPP_DIAGNOSE_WARNING(!std::__invokable<_Compare const&, _Tp const&, _Tp const&>::value,
-        "the specified comparator type does not provide a const call operator")
+        "the specified comparator type does not provide a viable const call operator")
 #endif
 int __diagnose_non_const_comparator();
 
@@ -2414,7 +2414,7 @@
 
     __insert_node_at(__parent, __child,
                      static_cast<__node_base_pointer>(__ptr));
-    __nh.__release();
+    __nh.__release_ptr();
     return _InsertReturnType{iterator(__ptr), true, _NodeHandle()};
 }
 
@@ -2439,7 +2439,7 @@
         __insert_node_at(__parent, __child,
                          static_cast<__node_base_pointer>(__ptr));
         __r = __ptr;
-        __nh.__release();
+        __nh.__release_ptr();
     }
     return iterator(__r);
 }
@@ -2504,7 +2504,7 @@
     __node_base_pointer& __child = __find_leaf_high(
         __parent, _NodeTypes::__get_key(__ptr->__value_));
     __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__ptr));
-    __nh.__release();
+    __nh.__release_ptr();
     return iterator(__ptr);
 }
 
@@ -2523,7 +2523,7 @@
     __node_base_pointer& __child = __find_leaf(__hint, __parent,
                                                _NodeTypes::__get_key(__ptr->__value_));
     __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__ptr));
-    __nh.__release();
+    __nh.__release_ptr();
     return iterator(__ptr);
 }
 
diff --git a/linux-x64/clang/include/c++/v1/__tuple b/linux-x64/clang/include/c++/v1/__tuple
index 89134b5..196f3c2 100644
--- a/linux-x64/clang/include/c++/v1/__tuple
+++ b/linux-x64/clang/include/c++/v1/__tuple
@@ -53,27 +53,24 @@
 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS tuple_size<const volatile _Tp> : public tuple_size<_Tp> {};
 #endif
 
-template <size_t _Ip, class _Tp> class _LIBCPP_TEMPLATE_VIS tuple_element;
+template <size_t _Ip, class _Tp> struct _LIBCPP_TEMPLATE_VIS tuple_element;
 
 template <size_t _Ip, class _Tp>
-class _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, const _Tp>
+struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, const _Tp>
 {
-public:
-    typedef typename add_const<typename tuple_element<_Ip, _Tp>::type>::type type;
+    typedef _LIBCPP_NODEBUG_TYPE typename add_const<typename tuple_element<_Ip, _Tp>::type>::type type;
 };
 
 template <size_t _Ip, class _Tp>
-class _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, volatile _Tp>
+struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, volatile _Tp>
 {
-public:
-    typedef typename add_volatile<typename tuple_element<_Ip, _Tp>::type>::type type;
+    typedef _LIBCPP_NODEBUG_TYPE typename add_volatile<typename tuple_element<_Ip, _Tp>::type>::type type;
 };
 
 template <size_t _Ip, class _Tp>
-class _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, const volatile _Tp>
+struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, const volatile _Tp>
 {
-public:
-    typedef typename add_cv<typename tuple_element<_Ip, _Tp>::type>::type type;
+    typedef _LIBCPP_NODEBUG_TYPE typename add_cv<typename tuple_element<_Ip, _Tp>::type>::type type;
 };
 
 template <class _Tp> struct __tuple_like : false_type {};
@@ -102,7 +99,7 @@
 
 template<typename _Tp, size_t ..._Extra> struct __repeat;
 template<typename _Tp, _Tp ..._Np, size_t ..._Extra> struct __repeat<__integer_sequence<_Tp, _Np...>, _Extra...> {
-  typedef __integer_sequence<_Tp,
+  typedef _LIBCPP_NODEBUG_TYPE __integer_sequence<_Tp,
                            _Np...,
                            sizeof...(_Np) + _Np...,
                            2 * sizeof...(_Np) + _Np...,
@@ -256,7 +253,7 @@
 namespace __indexer_detail {
 
 template <size_t _Idx, class _Tp>
-struct __indexed { using type = _Tp; };
+struct __indexed { using type _LIBCPP_NODEBUG_TYPE = _Tp; };
 
 template <class _Types, class _Indexes> struct __indexer;
 
@@ -271,7 +268,7 @@
 } // namespace __indexer_detail
 
 template <size_t _Idx, class ..._Types>
-using __type_pack_element = typename decltype(
+using __type_pack_element _LIBCPP_NODEBUG_TYPE = typename decltype(
     __indexer_detail::__at_index<_Idx>(
         __indexer_detail::__indexer<
             __tuple_types<_Types...>,
@@ -281,11 +278,10 @@
 #endif
 
 template <size_t _Ip, class ..._Types>
-class _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, __tuple_types<_Types...>>
+struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, __tuple_types<_Types...>>
 {
-public:
     static_assert(_Ip < sizeof...(_Types), "tuple_element index out of range");
-    typedef __type_pack_element<_Ip, _Types...> type;
+    typedef _LIBCPP_NODEBUG_TYPE __type_pack_element<_Ip, _Types...> type;
 };
 
 
@@ -305,34 +301,34 @@
 };
 template <>
 struct __apply_cv_mf<false, true, false> {
-  template <class _Tp> using __apply = const _Tp;
+  template <class _Tp> using __apply _LIBCPP_NODEBUG_TYPE  = const _Tp;
 };
 template <>
 struct __apply_cv_mf<false, false, true> {
-  template <class _Tp> using __apply = volatile _Tp;
+  template <class _Tp> using __apply _LIBCPP_NODEBUG_TYPE  = volatile _Tp;
 };
 template <>
 struct __apply_cv_mf<false, true, true> {
-  template <class _Tp> using __apply = const volatile _Tp;
+  template <class _Tp> using __apply _LIBCPP_NODEBUG_TYPE  = const volatile _Tp;
 };
 template <>
 struct __apply_cv_mf<true, false, false> {
-  template <class _Tp> using __apply = _Tp&;
+  template <class _Tp> using __apply _LIBCPP_NODEBUG_TYPE  = _Tp&;
 };
 template <>
 struct __apply_cv_mf<true, true, false> {
-  template <class _Tp> using __apply = const _Tp&;
+  template <class _Tp> using __apply _LIBCPP_NODEBUG_TYPE  = const _Tp&;
 };
 template <>
 struct __apply_cv_mf<true, false, true> {
-  template <class _Tp> using __apply = volatile _Tp&;
+  template <class _Tp> using __apply _LIBCPP_NODEBUG_TYPE  = volatile _Tp&;
 };
 template <>
 struct __apply_cv_mf<true, true, true> {
-  template <class _Tp> using __apply = const volatile _Tp&;
+  template <class _Tp> using __apply _LIBCPP_NODEBUG_TYPE = const volatile _Tp&;
 };
 template <class _Tp, class _RawTp = typename remove_reference<_Tp>::type>
-using __apply_cv_t = __apply_cv_mf<
+using __apply_cv_t _LIBCPP_NODEBUG_TYPE  = __apply_cv_mf<
     is_lvalue_reference<_Tp>::value,
     is_const<_RawTp>::value,
     is_volatile<_RawTp>::value>;
@@ -351,7 +347,7 @@
 struct __make_tuple_types_flat<_Tuple<_Types...>, __tuple_indices<_Idx...>> {
   // Specialization for pair, tuple, and __tuple_types
   template <class _Tp, class _ApplyFn = __apply_cv_t<_Tp>>
-  using __apply_quals = __tuple_types<
+  using __apply_quals _LIBCPP_NODEBUG_TYPE = __tuple_types<
       typename _ApplyFn::template __apply<__type_pack_element<_Idx, _Types...>>...
     >;
 };
@@ -379,19 +375,19 @@
 
 template <class ..._Types, size_t _Ep>
 struct __make_tuple_types<tuple<_Types...>, _Ep, 0, true> {
-  typedef __tuple_types<_Types...> type;
+  typedef _LIBCPP_NODEBUG_TYPE __tuple_types<_Types...> type;
 };
 
 template <class ..._Types, size_t _Ep>
 struct __make_tuple_types<__tuple_types<_Types...>, _Ep, 0, true> {
-  typedef __tuple_types<_Types...> type;
+  typedef _LIBCPP_NODEBUG_TYPE __tuple_types<_Types...> type;
 };
 
 template <bool ..._Preds>
 struct __all_dummy;
 
 template <bool ..._Pred>
-using __all = is_same<__all_dummy<_Pred...>, __all_dummy<((void)_Pred, true)...>>;
+using __all = _IsSame<__all_dummy<_Pred...>, __all_dummy<((void)_Pred, true)...>>;
 
 struct __tuple_sfinae_base {
   template <template <class, class...> class _Trait,
@@ -456,15 +452,14 @@
 
 
 template <size_t _Ip, class ..._Tp>
-class _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, tuple<_Tp...> >
+struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, tuple<_Tp...> >
 {
-public:
-    typedef typename tuple_element<_Ip, __tuple_types<_Tp...> >::type type;
+    typedef _LIBCPP_NODEBUG_TYPE typename tuple_element<_Ip, __tuple_types<_Tp...> >::type type;
 };
 
 #if _LIBCPP_STD_VER > 11
 template <size_t _Ip, class ..._Tp>
-using tuple_element_t = typename tuple_element <_Ip, _Tp...>::type;
+using tuple_element_t _LIBCPP_NODEBUG_TYPE  = typename tuple_element <_Ip, _Tp...>::type;
 #endif
 
 template <bool _IsTuple, class _SizeTrait, size_t _Expected>
@@ -476,7 +471,7 @@
 
 template <class _Tuple, size_t _ExpectedSize,
           class _RawTuple = typename __uncvref<_Tuple>::type>
-using __tuple_like_with_size = __tuple_like_with_size_imp<
+using __tuple_like_with_size _LIBCPP_NODEBUG_TYPE = __tuple_like_with_size_imp<
                                    __tuple_like<_RawTuple>::value,
                                    tuple_size<_RawTuple>, _ExpectedSize
                               >;
diff --git a/linux-x64/clang/include/c++/v1/algorithm b/linux-x64/clang/include/c++/v1/algorithm
index 7da753a..d17666a 100644
--- a/linux-x64/clang/include/c++/v1/algorithm
+++ b/linux-x64/clang/include/c++/v1/algorithm
@@ -780,11 +780,23 @@
 template <class _Compare>
 struct __debug_less
 {
-    _Compare __comp_;
+    _Compare &__comp_;
+    _LIBCPP_CONSTEXPR_AFTER_CXX17
     __debug_less(_Compare& __c) : __comp_(__c) {}
 
     template <class _Tp, class _Up>
-    bool operator()(const _Tp& __x, const _Up& __y)
+    _LIBCPP_CONSTEXPR_AFTER_CXX17
+    bool operator()(const _Tp& __x,  const _Up& __y)
+    {
+        bool __r = __comp_(__x, __y);
+        if (__r)
+            __do_compare_assert(0, __y, __x);
+        return __r;
+    }
+
+    template <class _Tp, class _Up>
+    _LIBCPP_CONSTEXPR_AFTER_CXX17
+    bool operator()(_Tp& __x,  _Up& __y)
     {
         bool __r = __comp_(__x, __y);
         if (__r)
@@ -793,25 +805,39 @@
     }
 
     template <class _LHS, class _RHS>
+    _LIBCPP_CONSTEXPR_AFTER_CXX17
     inline _LIBCPP_INLINE_VISIBILITY
     decltype((void)_VSTD::declval<_Compare&>()(
-        _VSTD::declval<_LHS const&>(), _VSTD::declval<_RHS const&>()))
-    __do_compare_assert(int, _LHS const& __l, _RHS const& __r) {
+        _VSTD::declval<_LHS &>(), _VSTD::declval<_RHS &>()))
+    __do_compare_assert(int, _LHS & __l, _RHS & __r) {
         _LIBCPP_ASSERT(!__comp_(__l, __r),
             "Comparator does not induce a strict weak ordering");
     }
 
     template <class _LHS, class _RHS>
+    _LIBCPP_CONSTEXPR_AFTER_CXX17
     inline _LIBCPP_INLINE_VISIBILITY
-    void __do_compare_assert(long, _LHS const&, _RHS const&) {}
+    void __do_compare_assert(long, _LHS &, _RHS &) {}
 };
 
-#endif  // _LIBCPP_DEBUG
+#endif // _LIBCPP_DEBUG
+
+template <class _Comp>
+struct __comp_ref_type {
+  // Pass the comparator by lvalue reference. Or in debug mode, using a
+  // debugging wrapper that stores a reference.
+#ifndef _LIBCPP_DEBUG
+  typedef typename add_lvalue_reference<_Comp>::type type;
+#else
+  typedef __debug_less<_Comp> type;
+#endif
+};
 
 // all_of
 
 template <class _InputIterator, class _Predicate>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+_LIBCPP_NODISCARD_EXT inline
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
 bool
 all_of(_InputIterator __first, _InputIterator __last, _Predicate __pred)
 {
@@ -824,7 +850,8 @@
 // any_of
 
 template <class _InputIterator, class _Predicate>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+_LIBCPP_NODISCARD_EXT inline
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
 bool
 any_of(_InputIterator __first, _InputIterator __last, _Predicate __pred)
 {
@@ -837,7 +864,8 @@
 // none_of
 
 template <class _InputIterator, class _Predicate>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+_LIBCPP_NODISCARD_EXT inline
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
 bool
 none_of(_InputIterator __first, _InputIterator __last, _Predicate __pred)
 {
@@ -882,7 +910,8 @@
 // find
 
 template <class _InputIterator, class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+_LIBCPP_NODISCARD_EXT inline
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
 _InputIterator
 find(_InputIterator __first, _InputIterator __last, const _Tp& __value_)
 {
@@ -895,7 +924,8 @@
 // find_if
 
 template <class _InputIterator, class _Predicate>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+_LIBCPP_NODISCARD_EXT inline
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
 _InputIterator
 find_if(_InputIterator __first, _InputIterator __last, _Predicate __pred)
 {
@@ -908,7 +938,8 @@
 // find_if_not
 
 template<class _InputIterator, class _Predicate>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+_LIBCPP_NODISCARD_EXT inline
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
 _InputIterator
 find_if_not(_InputIterator __first, _InputIterator __last, _Predicate __pred)
 {
@@ -1043,7 +1074,8 @@
 }
 
 template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+_LIBCPP_NODISCARD_EXT inline
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
 _ForwardIterator1
 find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
          _ForwardIterator2 __first2, _ForwardIterator2 __last2, _BinaryPredicate __pred)
@@ -1055,7 +1087,8 @@
 }
 
 template <class _ForwardIterator1, class _ForwardIterator2>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+_LIBCPP_NODISCARD_EXT inline
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
 _ForwardIterator1
 find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
          _ForwardIterator2 __first2, _ForwardIterator2 __last2)
@@ -1081,7 +1114,8 @@
 
 
 template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
-inline _LIBCPP_INLINE_VISIBILITY  _LIBCPP_CONSTEXPR_AFTER_CXX17
+_LIBCPP_NODISCARD_EXT inline
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
 _ForwardIterator1
 find_first_of(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
               _ForwardIterator2 __first2, _ForwardIterator2 __last2, _BinaryPredicate __pred)
@@ -1090,7 +1124,8 @@
 }
 
 template <class _ForwardIterator1, class _ForwardIterator2>
-inline _LIBCPP_INLINE_VISIBILITY  _LIBCPP_CONSTEXPR_AFTER_CXX17
+_LIBCPP_NODISCARD_EXT inline
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
 _ForwardIterator1
 find_first_of(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
               _ForwardIterator2 __first2, _ForwardIterator2 __last2)
@@ -1103,7 +1138,8 @@
 // adjacent_find
 
 template <class _ForwardIterator, class _BinaryPredicate>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+_LIBCPP_NODISCARD_EXT inline
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
 _ForwardIterator
 adjacent_find(_ForwardIterator __first, _ForwardIterator __last, _BinaryPredicate __pred)
 {
@@ -1121,7 +1157,8 @@
 }
 
 template <class _ForwardIterator>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+_LIBCPP_NODISCARD_EXT inline
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
 _ForwardIterator
 adjacent_find(_ForwardIterator __first, _ForwardIterator __last)
 {
@@ -1132,7 +1169,8 @@
 // count
 
 template <class _InputIterator, class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+_LIBCPP_NODISCARD_EXT inline
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
 typename iterator_traits<_InputIterator>::difference_type
 count(_InputIterator __first, _InputIterator __last, const _Tp& __value_)
 {
@@ -1146,7 +1184,8 @@
 // count_if
 
 template <class _InputIterator, class _Predicate>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+_LIBCPP_NODISCARD_EXT inline
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
 typename iterator_traits<_InputIterator>::difference_type
 count_if(_InputIterator __first, _InputIterator __last, _Predicate __pred)
 {
@@ -1160,7 +1199,8 @@
 // mismatch
 
 template <class _InputIterator1, class _InputIterator2, class _BinaryPredicate>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+_LIBCPP_NODISCARD_EXT inline
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
 pair<_InputIterator1, _InputIterator2>
 mismatch(_InputIterator1 __first1, _InputIterator1 __last1,
          _InputIterator2 __first2, _BinaryPredicate __pred)
@@ -1172,7 +1212,8 @@
 }
 
 template <class _InputIterator1, class _InputIterator2>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+_LIBCPP_NODISCARD_EXT inline
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
 pair<_InputIterator1, _InputIterator2>
 mismatch(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2)
 {
@@ -1183,7 +1224,8 @@
 
 #if _LIBCPP_STD_VER > 11
 template <class _InputIterator1, class _InputIterator2, class _BinaryPredicate>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+_LIBCPP_NODISCARD_EXT inline
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
 pair<_InputIterator1, _InputIterator2>
 mismatch(_InputIterator1 __first1, _InputIterator1 __last1,
          _InputIterator2 __first2, _InputIterator2 __last2,
@@ -1196,7 +1238,8 @@
 }
 
 template <class _InputIterator1, class _InputIterator2>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+_LIBCPP_NODISCARD_EXT inline
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
 pair<_InputIterator1, _InputIterator2>
 mismatch(_InputIterator1 __first1, _InputIterator1 __last1,
          _InputIterator2 __first2, _InputIterator2 __last2)
@@ -1210,7 +1253,8 @@
 // equal
 
 template <class _InputIterator1, class _InputIterator2, class _BinaryPredicate>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+_LIBCPP_NODISCARD_EXT inline
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
 bool
 equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _BinaryPredicate __pred)
 {
@@ -1221,7 +1265,8 @@
 }
 
 template <class _InputIterator1, class _InputIterator2>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+_LIBCPP_NODISCARD_EXT inline
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
 bool
 equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2)
 {
@@ -1259,7 +1304,8 @@
 }
 
 template <class _InputIterator1, class _InputIterator2, class _BinaryPredicate>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+_LIBCPP_NODISCARD_EXT inline
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
 bool
 equal(_InputIterator1 __first1, _InputIterator1 __last1,
       _InputIterator2 __first2, _InputIterator2 __last2, _BinaryPredicate __pred )
@@ -1271,7 +1317,8 @@
 }
 
 template <class _InputIterator1, class _InputIterator2>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+_LIBCPP_NODISCARD_EXT inline
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
 bool
 equal(_InputIterator1 __first1, _InputIterator1 __last1,
       _InputIterator2 __first2, _InputIterator2 __last2)
@@ -1287,7 +1334,7 @@
 // is_permutation
 
 template<class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
-_LIBCPP_CONSTEXPR_AFTER_CXX17 bool
+_LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_AFTER_CXX17 bool
 is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
                _ForwardIterator2 __first2, _BinaryPredicate __pred)
 {
@@ -1334,7 +1381,8 @@
 }
 
 template<class _ForwardIterator1, class _ForwardIterator2>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+_LIBCPP_NODISCARD_EXT inline
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
 bool
 is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
                _ForwardIterator2 __first2)
@@ -1413,7 +1461,8 @@
 }
 
 template<class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+_LIBCPP_NODISCARD_EXT inline
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
 bool
 is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
                _ForwardIterator2 __first2, _ForwardIterator2 __last2,
@@ -1426,7 +1475,8 @@
 }
 
 template<class _ForwardIterator1, class _ForwardIterator2>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+_LIBCPP_NODISCARD_EXT inline
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
 bool
 is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
                _ForwardIterator2 __first2, _ForwardIterator2 __last2)
@@ -1444,7 +1494,8 @@
 // __search is in <functional>
 
 template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+_LIBCPP_NODISCARD_EXT inline
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
 _ForwardIterator1
 search(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
        _ForwardIterator2 __first2, _ForwardIterator2 __last2, _BinaryPredicate __pred)
@@ -1457,7 +1508,8 @@
 }
 
 template <class _ForwardIterator1, class _ForwardIterator2>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+_LIBCPP_NODISCARD_EXT inline
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
 _ForwardIterator1
 search(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
        _ForwardIterator2 __first2, _ForwardIterator2 __last2)
@@ -1470,7 +1522,7 @@
 
 #if _LIBCPP_STD_VER > 14
 template <class _ForwardIterator, class _Searcher>
-_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+_LIBCPP_NODISCARD_EXT _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
 _ForwardIterator search(_ForwardIterator __f, _ForwardIterator __l, const _Searcher &__s)
 { return __s(__f, __l).first; }
 #endif
@@ -1555,7 +1607,8 @@
 }
 
 template <class _ForwardIterator, class _Size, class _Tp, class _BinaryPredicate>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+_LIBCPP_NODISCARD_EXT inline
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
 _ForwardIterator
 search_n(_ForwardIterator __first, _ForwardIterator __last,
          _Size __count, const _Tp& __value_, _BinaryPredicate __pred)
@@ -1566,7 +1619,8 @@
 }
 
 template <class _ForwardIterator, class _Size, class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+_LIBCPP_NODISCARD_EXT inline
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
 _ForwardIterator
 search_n(_ForwardIterator __first, _ForwardIterator __last, _Size __count, const _Tp& __value_)
 {
@@ -1995,7 +2049,7 @@
 // generate_n
 
 template <class _OutputIterator, class _Size, class _Generator>
-inline _LIBCPP_INLINE_VISIBILITY  _LIBCPP_CONSTEXPR_AFTER_CXX17
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
 _OutputIterator
 generate_n(_OutputIterator __first, _Size __orig_n, _Generator __gen)
 {
@@ -2009,7 +2063,7 @@
 // remove
 
 template <class _ForwardIterator, class _Tp>
-_LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator
+_LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator
 remove(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_)
 {
     __first = _VSTD::find(__first, __last, __value_);
@@ -2031,7 +2085,7 @@
 // remove_if
 
 template <class _ForwardIterator, class _Predicate>
-_LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator
+_LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator
 remove_if(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred)
 {
     __first = _VSTD::find_if<_ForwardIterator, typename add_lvalue_reference<_Predicate>::type>
@@ -2090,7 +2144,7 @@
 // unique
 
 template <class _ForwardIterator, class _BinaryPredicate>
-_LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator
+_LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator
 unique(_ForwardIterator __first, _ForwardIterator __last, _BinaryPredicate __pred)
 {
     __first = _VSTD::adjacent_find<_ForwardIterator, typename add_lvalue_reference<_BinaryPredicate>::type>
@@ -2109,7 +2163,8 @@
 }
 
 template <class _ForwardIterator>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+_LIBCPP_NODISCARD_EXT inline
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
 _ForwardIterator
 unique(_ForwardIterator __first, _ForwardIterator __last)
 {
@@ -2432,7 +2487,8 @@
 // min_element
 
 template <class _ForwardIterator, class _Compare>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+_LIBCPP_NODISCARD_EXT inline
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
 _ForwardIterator
 min_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
 {
@@ -2449,7 +2505,8 @@
 }
 
 template <class _ForwardIterator>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+_LIBCPP_NODISCARD_EXT inline
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
 _ForwardIterator
 min_element(_ForwardIterator __first, _ForwardIterator __last)
 {
@@ -2460,7 +2517,8 @@
 // min
 
 template <class _Tp, class _Compare>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+_LIBCPP_NODISCARD_EXT inline
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
 const _Tp&
 min(const _Tp& __a, const _Tp& __b, _Compare __comp)
 {
@@ -2468,7 +2526,8 @@
 }
 
 template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+_LIBCPP_NODISCARD_EXT inline
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
 const _Tp&
 min(const _Tp& __a, const _Tp& __b)
 {
@@ -2478,7 +2537,8 @@
 #ifndef _LIBCPP_CXX03_LANG
 
 template<class _Tp, class _Compare>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+_LIBCPP_NODISCARD_EXT inline
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
 _Tp
 min(initializer_list<_Tp> __t, _Compare __comp)
 {
@@ -2486,7 +2546,8 @@
 }
 
 template<class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+_LIBCPP_NODISCARD_EXT inline
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
 _Tp
 min(initializer_list<_Tp> __t)
 {
@@ -2498,7 +2559,8 @@
 // max_element
 
 template <class _ForwardIterator, class _Compare>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+_LIBCPP_NODISCARD_EXT inline
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
 _ForwardIterator
 max_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
 {
@@ -2516,7 +2578,8 @@
 
 
 template <class _ForwardIterator>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+_LIBCPP_NODISCARD_EXT inline
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
 _ForwardIterator
 max_element(_ForwardIterator __first, _ForwardIterator __last)
 {
@@ -2527,7 +2590,8 @@
 // max
 
 template <class _Tp, class _Compare>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+_LIBCPP_NODISCARD_EXT inline
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
 const _Tp&
 max(const _Tp& __a, const _Tp& __b, _Compare __comp)
 {
@@ -2535,7 +2599,8 @@
 }
 
 template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+_LIBCPP_NODISCARD_EXT inline
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
 const _Tp&
 max(const _Tp& __a, const _Tp& __b)
 {
@@ -2545,7 +2610,8 @@
 #ifndef _LIBCPP_CXX03_LANG
 
 template<class _Tp, class _Compare>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+_LIBCPP_NODISCARD_EXT inline
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
 _Tp
 max(initializer_list<_Tp> __t, _Compare __comp)
 {
@@ -2553,7 +2619,8 @@
 }
 
 template<class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+_LIBCPP_NODISCARD_EXT inline
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
 _Tp
 max(initializer_list<_Tp> __t)
 {
@@ -2565,7 +2632,8 @@
 #if _LIBCPP_STD_VER > 14
 // clamp
 template<class _Tp, class _Compare>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+_LIBCPP_NODISCARD_EXT inline
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
 const _Tp&
 clamp(const _Tp& __v, const _Tp& __lo, const _Tp& __hi, _Compare __comp)
 {
@@ -2575,7 +2643,8 @@
 }
 
 template<class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+_LIBCPP_NODISCARD_EXT inline
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
 const _Tp&
 clamp(const _Tp& __v, const _Tp& __lo, const _Tp& __hi)
 {
@@ -2586,7 +2655,7 @@
 // minmax_element
 
 template <class _ForwardIterator, class _Compare>
-_LIBCPP_CONSTEXPR_AFTER_CXX11
+_LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_AFTER_CXX11
 std::pair<_ForwardIterator, _ForwardIterator>
 minmax_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
 {
@@ -2636,7 +2705,8 @@
 }
 
 template <class _ForwardIterator>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+_LIBCPP_NODISCARD_EXT inline
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
 std::pair<_ForwardIterator, _ForwardIterator>
 minmax_element(_ForwardIterator __first, _ForwardIterator __last)
 {
@@ -2647,7 +2717,8 @@
 // minmax
 
 template<class _Tp, class _Compare>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+_LIBCPP_NODISCARD_EXT inline
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
 pair<const _Tp&, const _Tp&>
 minmax(const _Tp& __a, const _Tp& __b, _Compare __comp)
 {
@@ -2656,7 +2727,8 @@
 }
 
 template<class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+_LIBCPP_NODISCARD_EXT inline
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
 pair<const _Tp&, const _Tp&>
 minmax(const _Tp& __a, const _Tp& __b)
 {
@@ -2666,7 +2738,8 @@
 #ifndef _LIBCPP_CXX03_LANG
 
 template<class _Tp, class _Compare>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+_LIBCPP_NODISCARD_EXT inline
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
 pair<_Tp, _Tp>
 minmax(initializer_list<_Tp> __t, _Compare __comp)
 {
@@ -2703,7 +2776,8 @@
 }
 
 template<class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+_LIBCPP_NODISCARD_EXT inline
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
 pair<_Tp, _Tp>
 minmax(initializer_list<_Tp> __t)
 {
@@ -3107,11 +3181,7 @@
 
 template<class _RandomAccessIterator, class _UniformRandomNumberGenerator>
     void shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last,
-#ifndef _LIBCPP_CXX03_LANG
                  _UniformRandomNumberGenerator&& __g)
-#else
-                 _UniformRandomNumberGenerator& __g)
-#endif
 {
     typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
     typedef uniform_int_distribution<ptrdiff_t> _Dp;
@@ -3130,7 +3200,7 @@
 }
 
 template <class _InputIterator, class _Predicate>
-_LIBCPP_CONSTEXPR_AFTER_CXX17 bool
+_LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_AFTER_CXX17 bool
 is_partitioned(_InputIterator __first, _InputIterator __last, _Predicate __pred)
 {
     for (; __first != __last; ++__first)
@@ -3538,7 +3608,7 @@
 // is_sorted_until
 
 template <class _ForwardIterator, class _Compare>
-_LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator
+_LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator
 is_sorted_until(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
 {
     if (__first != __last)
@@ -3555,7 +3625,8 @@
 }
 
 template<class _ForwardIterator>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+_LIBCPP_NODISCARD_EXT inline
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
 _ForwardIterator
 is_sorted_until(_ForwardIterator __first, _ForwardIterator __last)
 {
@@ -3565,7 +3636,8 @@
 // is_sorted
 
 template <class _ForwardIterator, class _Compare>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+_LIBCPP_NODISCARD_EXT inline
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
 bool
 is_sorted(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
 {
@@ -3573,7 +3645,8 @@
 }
 
 template<class _ForwardIterator>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+_LIBCPP_NODISCARD_EXT inline
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
 bool
 is_sorted(_ForwardIterator __first, _ForwardIterator __last)
 {
@@ -4020,14 +4093,8 @@
 void
 sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
 {
-#ifdef _LIBCPP_DEBUG
-    typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
-    __debug_less<_Compare> __c(__comp);
-    __sort<_Comp_ref>(__first, __last, __c);
-#else  // _LIBCPP_DEBUG
-    typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
-    __sort<_Comp_ref>(__first, __last, __comp);
-#endif  // _LIBCPP_DEBUG
+    typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
+    _VSTD::__sort<_Comp_ref>(__first, __last, _Comp_ref(__comp));
 }
 
 template <class _RandomAccessIterator>
@@ -4122,7 +4189,8 @@
 }
 
 template <class _ForwardIterator, class _Tp, class _Compare>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+_LIBCPP_NODISCARD_EXT inline
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
 _ForwardIterator
 lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp)
 {
@@ -4131,7 +4199,8 @@
 }
 
 template <class _ForwardIterator, class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+_LIBCPP_NODISCARD_EXT inline
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
 _ForwardIterator
 lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_)
 {
@@ -4164,7 +4233,8 @@
 }
 
 template <class _ForwardIterator, class _Tp, class _Compare>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+_LIBCPP_NODISCARD_EXT inline
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
 _ForwardIterator
 upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp)
 {
@@ -4173,7 +4243,8 @@
 }
 
 template <class _ForwardIterator, class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+_LIBCPP_NODISCARD_EXT inline
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
 _ForwardIterator
 upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_)
 {
@@ -4218,22 +4289,18 @@
 }
 
 template <class _ForwardIterator, class _Tp, class _Compare>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+_LIBCPP_NODISCARD_EXT inline
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
 pair<_ForwardIterator, _ForwardIterator>
 equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp)
 {
-#ifdef _LIBCPP_DEBUG
-    typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
-    __debug_less<_Compare> __c(__comp);
-    return __equal_range<_Comp_ref>(__first, __last, __value_, __c);
-#else  // _LIBCPP_DEBUG
-    typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
+    typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
     return __equal_range<_Comp_ref>(__first, __last, __value_, __comp);
-#endif  // _LIBCPP_DEBUG
 }
 
 template <class _ForwardIterator, class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+_LIBCPP_NODISCARD_EXT inline
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
 pair<_ForwardIterator, _ForwardIterator>
 equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_)
 {
@@ -4253,22 +4320,18 @@
 }
 
 template <class _ForwardIterator, class _Tp, class _Compare>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+_LIBCPP_NODISCARD_EXT inline
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
 bool
 binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp)
 {
-#ifdef _LIBCPP_DEBUG
-    typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
-    __debug_less<_Compare> __c(__comp);
-    return __binary_search<_Comp_ref>(__first, __last, __value_, __c);
-#else  // _LIBCPP_DEBUG
-    typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
+    typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
     return __binary_search<_Comp_ref>(__first, __last, __value_, __comp);
-#endif  // _LIBCPP_DEBUG
 }
 
 template <class _ForwardIterator, class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+_LIBCPP_NODISCARD_EXT inline
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
 bool
 binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_)
 {
@@ -4307,14 +4370,8 @@
 merge(_InputIterator1 __first1, _InputIterator1 __last1,
       _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp)
 {
-#ifdef _LIBCPP_DEBUG
-    typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
-    __debug_less<_Compare> __c(__comp);
-    return _VSTD::__merge<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __c);
-#else  // _LIBCPP_DEBUG
-    typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
+    typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
     return _VSTD::__merge<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp);
-#endif  // _LIBCPP_DEBUG
 }
 
 template <class _InputIterator1, class _InputIterator2, class _OutputIterator>
@@ -4489,17 +4546,9 @@
     difference_type __buf_size = _VSTD::min(__len1, __len2);
     pair<value_type*, ptrdiff_t> __buf = _VSTD::get_temporary_buffer<value_type>(__buf_size);
     unique_ptr<value_type, __return_temporary_buffer> __h(__buf.first);
-
-#ifdef _LIBCPP_DEBUG
-    typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
-    __debug_less<_Compare> __c(__comp);
-    return _VSTD::__inplace_merge<_Comp_ref>(__first, __middle, __last, __c, __len1, __len2,
-                                            __buf.first, __buf.second);
-#else  // _LIBCPP_DEBUG
-    typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
+    typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
     return _VSTD::__inplace_merge<_Comp_ref>(__first, __middle, __last, __comp, __len1, __len2,
                                             __buf.first, __buf.second);
-#endif  // _LIBCPP_DEBUG
 }
 
 template <class _BidirectionalIterator>
@@ -4701,14 +4750,8 @@
         __buf = _VSTD::get_temporary_buffer<value_type>(__len);
         __h.reset(__buf.first);
     }
-#ifdef _LIBCPP_DEBUG
-    typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
-    __debug_less<_Compare> __c(__comp);
-    __stable_sort<_Comp_ref>(__first, __last, __c, __len, __buf.first, __buf.second);
-#else  // _LIBCPP_DEBUG
-    typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
+    typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
     __stable_sort<_Comp_ref>(__first, __last, __comp, __len, __buf.first, __buf.second);
-#endif  // _LIBCPP_DEBUG
 }
 
 template <class _RandomAccessIterator>
@@ -4722,7 +4765,7 @@
 // is_heap_until
 
 template <class _RandomAccessIterator, class _Compare>
-_LIBCPP_CONSTEXPR_AFTER_CXX17 _RandomAccessIterator
+_LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_AFTER_CXX17 _RandomAccessIterator
 is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
 {
     typedef typename _VSTD::iterator_traits<_RandomAccessIterator>::difference_type difference_type;
@@ -4749,7 +4792,8 @@
 }
 
 template<class _RandomAccessIterator>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+_LIBCPP_NODISCARD_EXT inline
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
 _RandomAccessIterator
 is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last)
 {
@@ -4759,7 +4803,8 @@
 // is_heap
 
 template <class _RandomAccessIterator, class _Compare>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+_LIBCPP_NODISCARD_EXT inline
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
 bool
 is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
 {
@@ -4767,7 +4812,8 @@
 }
 
 template<class _RandomAccessIterator>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+_LIBCPP_NODISCARD_EXT inline
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
 bool
 is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)
 {
@@ -4808,14 +4854,8 @@
 void
 push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
 {
-#ifdef _LIBCPP_DEBUG
-    typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
-    __debug_less<_Compare> __c(__comp);
-    __sift_up<_Comp_ref>(__first, __last, __c, __last - __first);
-#else  // _LIBCPP_DEBUG
-    typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
+    typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
     __sift_up<_Comp_ref>(__first, __last, __comp, __last - __first);
-#endif  // _LIBCPP_DEBUG
 }
 
 template <class _RandomAccessIterator>
@@ -4901,14 +4941,8 @@
 void
 pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
 {
-#ifdef _LIBCPP_DEBUG
-    typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
-    __debug_less<_Compare> __c(__comp);
-    __pop_heap<_Comp_ref>(__first, __last, __c, __last - __first);
-#else  // _LIBCPP_DEBUG
-    typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
+    typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
     __pop_heap<_Comp_ref>(__first, __last, __comp, __last - __first);
-#endif  // _LIBCPP_DEBUG
 }
 
 template <class _RandomAccessIterator>
@@ -4942,14 +4976,8 @@
 void
 make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
 {
-#ifdef _LIBCPP_DEBUG
-    typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
-    __debug_less<_Compare> __c(__comp);
-    __make_heap<_Comp_ref>(__first, __last, __c);
-#else  // _LIBCPP_DEBUG
-    typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
+    typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
     __make_heap<_Comp_ref>(__first, __last, __comp);
-#endif  // _LIBCPP_DEBUG
 }
 
 template <class _RandomAccessIterator>
@@ -4976,14 +5004,8 @@
 void
 sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
 {
-#ifdef _LIBCPP_DEBUG
-    typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
-    __debug_less<_Compare> __c(__comp);
-    __sort_heap<_Comp_ref>(__first, __last, __c);
-#else  // _LIBCPP_DEBUG
-    typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
+    typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
     __sort_heap<_Comp_ref>(__first, __last, __comp);
-#endif  // _LIBCPP_DEBUG
 }
 
 template <class _RandomAccessIterator>
@@ -5020,14 +5042,8 @@
 partial_sort(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last,
              _Compare __comp)
 {
-#ifdef _LIBCPP_DEBUG
-    typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
-    __debug_less<_Compare> __c(__comp);
-    __partial_sort<_Comp_ref>(__first, __middle, __last, __c);
-#else  // _LIBCPP_DEBUG
-    typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
+    typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
     __partial_sort<_Comp_ref>(__first, __middle, __last, __comp);
-#endif  // _LIBCPP_DEBUG
 }
 
 template <class _RandomAccessIterator>
@@ -5070,14 +5086,8 @@
 partial_sort_copy(_InputIterator __first, _InputIterator __last,
                   _RandomAccessIterator __result_first, _RandomAccessIterator __result_last, _Compare __comp)
 {
-#ifdef _LIBCPP_DEBUG
-    typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
-    __debug_less<_Compare> __c(__comp);
-    return __partial_sort_copy<_Comp_ref>(__first, __last, __result_first, __result_last, __c);
-#else  // _LIBCPP_DEBUG
-    typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
+    typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
     return __partial_sort_copy<_Comp_ref>(__first, __last, __result_first, __result_last, __comp);
-#endif  // _LIBCPP_DEBUG
 }
 
 template <class _InputIterator, class _RandomAccessIterator>
@@ -5284,14 +5294,8 @@
 void
 nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, _RandomAccessIterator __last, _Compare __comp)
 {
-#ifdef _LIBCPP_DEBUG
-    typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
-    __debug_less<_Compare> __c(__comp);
-    __nth_element<_Comp_ref>(__first, __nth, __last, __c);
-#else  // _LIBCPP_DEBUG
-    typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
+    typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
     __nth_element<_Comp_ref>(__first, __nth, __last, __comp);
-#endif  // _LIBCPP_DEBUG
 }
 
 template <class _RandomAccessIterator>
@@ -5320,23 +5324,19 @@
 }
 
 template <class _InputIterator1, class _InputIterator2, class _Compare>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+_LIBCPP_NODISCARD_EXT inline
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
 bool
 includes(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2,
          _Compare __comp)
 {
-#ifdef _LIBCPP_DEBUG
-    typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
-    __debug_less<_Compare> __c(__comp);
-    return __includes<_Comp_ref>(__first1, __last1, __first2, __last2, __c);
-#else  // _LIBCPP_DEBUG
-    typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
+    typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
     return __includes<_Comp_ref>(__first1, __last1, __first2, __last2, __comp);
-#endif  // _LIBCPP_DEBUG
 }
 
 template <class _InputIterator1, class _InputIterator2>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+_LIBCPP_NODISCARD_EXT inline
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
 bool
 includes(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2)
 {
@@ -5378,14 +5378,8 @@
 set_union(_InputIterator1 __first1, _InputIterator1 __last1,
           _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp)
 {
-#ifdef _LIBCPP_DEBUG
-    typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
-    __debug_less<_Compare> __c(__comp);
-    return __set_union<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __c);
-#else  // _LIBCPP_DEBUG
-    typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
+    typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
     return __set_union<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp);
-#endif  // _LIBCPP_DEBUG
 }
 
 template <class _InputIterator1, class _InputIterator2, class _OutputIterator>
@@ -5430,14 +5424,8 @@
 set_intersection(_InputIterator1 __first1, _InputIterator1 __last1,
                  _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp)
 {
-#ifdef _LIBCPP_DEBUG
-    typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
-    __debug_less<_Compare> __c(__comp);
-    return __set_intersection<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __c);
-#else  // _LIBCPP_DEBUG
-    typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
+    typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
     return __set_intersection<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp);
-#endif  // _LIBCPP_DEBUG
 }
 
 template <class _InputIterator1, class _InputIterator2, class _OutputIterator>
@@ -5484,14 +5472,8 @@
 set_difference(_InputIterator1 __first1, _InputIterator1 __last1,
                _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp)
 {
-#ifdef _LIBCPP_DEBUG
-    typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
-    __debug_less<_Compare> __c(__comp);
-    return __set_difference<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __c);
-#else  // _LIBCPP_DEBUG
-    typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
+    typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
     return __set_difference<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp);
-#endif  // _LIBCPP_DEBUG
 }
 
 template <class _InputIterator1, class _InputIterator2, class _OutputIterator>
@@ -5543,14 +5525,8 @@
 set_symmetric_difference(_InputIterator1 __first1, _InputIterator1 __last1,
                          _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp)
 {
-#ifdef _LIBCPP_DEBUG
-    typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
-    __debug_less<_Compare> __c(__comp);
-    return __set_symmetric_difference<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __c);
-#else  // _LIBCPP_DEBUG
-    typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
+    typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
     return __set_symmetric_difference<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp);
-#endif  // _LIBCPP_DEBUG
 }
 
 template <class _InputIterator1, class _InputIterator2, class _OutputIterator>
@@ -5582,23 +5558,19 @@
 }
 
 template <class _InputIterator1, class _InputIterator2, class _Compare>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+_LIBCPP_NODISCARD_EXT inline
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
 bool
 lexicographical_compare(_InputIterator1 __first1, _InputIterator1 __last1,
                         _InputIterator2 __first2, _InputIterator2 __last2, _Compare __comp)
 {
-#ifdef _LIBCPP_DEBUG
-    typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
-    __debug_less<_Compare> __c(__comp);
-    return __lexicographical_compare<_Comp_ref>(__first1, __last1, __first2, __last2, __c);
-#else  // _LIBCPP_DEBUG
-    typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
+    typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
     return __lexicographical_compare<_Comp_ref>(__first1, __last1, __first2, __last2, __comp);
-#endif  // _LIBCPP_DEBUG
 }
 
 template <class _InputIterator1, class _InputIterator2>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+_LIBCPP_NODISCARD_EXT inline
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
 bool
 lexicographical_compare(_InputIterator1 __first1, _InputIterator1 __last1,
                         _InputIterator2 __first2, _InputIterator2 __last2)
@@ -5642,14 +5614,8 @@
 bool
 next_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last, _Compare __comp)
 {
-#ifdef _LIBCPP_DEBUG
-    typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
-    __debug_less<_Compare> __c(__comp);
-    return __next_permutation<_Comp_ref>(__first, __last, __c);
-#else  // _LIBCPP_DEBUG
-    typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
+    typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
     return __next_permutation<_Comp_ref>(__first, __last, __comp);
-#endif  // _LIBCPP_DEBUG
 }
 
 template <class _BidirectionalIterator>
@@ -5695,14 +5661,8 @@
 bool
 prev_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last, _Compare __comp)
 {
-#ifdef _LIBCPP_DEBUG
-    typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
-    __debug_less<_Compare> __c(__comp);
-    return __prev_permutation<_Comp_ref>(__first, __last, __c);
-#else  // _LIBCPP_DEBUG
-    typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
+    typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
     return __prev_permutation<_Comp_ref>(__first, __last, __comp);
-#endif  // _LIBCPP_DEBUG
 }
 
 template <class _BidirectionalIterator>
diff --git a/linux-x64/clang/include/c++/v1/any b/linux-x64/clang/include/c++/v1/any
index f3518c3..36b07c9 100644
--- a/linux-x64/clang/include/c++/v1/any
+++ b/linux-x64/clang/include/c++/v1/any
@@ -507,7 +507,7 @@
 template <class _ValueType, class ..._Args, class _Tp, class>
 any::any(in_place_type_t<_ValueType>, _Args&&... __args) {
   __any_imp::_Handler<_Tp>::__create(*this, _VSTD::forward<_Args>(__args)...);
-};
+}
 
 template <class _ValueType, class _Up, class ..._Args, class _Tp, class>
 any::any(in_place_type_t<_ValueType>, initializer_list<_Up> __il, _Args&&... __args) {
diff --git a/linux-x64/clang/include/c++/v1/array b/linux-x64/clang/include/c++/v1/array
index 05c4b65..88e9d57 100644
--- a/linux-x64/clang/include/c++/v1/array
+++ b/linux-x64/clang/include/c++/v1/array
@@ -91,7 +91,7 @@
   void swap(array<T,N>& x, array<T,N>& y) noexcept(noexcept(x.swap(y))); // C++17
 
 template <class T> struct tuple_size;
-template <size_t I, class T> class tuple_element;
+template <size_t I, class T> struct tuple_element;
 template <class T, size_t N> struct tuple_size<array<T, N>>;
 template <size_t I, class T, size_t N> struct tuple_element<I, array<T, N>>;
 template <size_t I, class T, size_t N> T& get(array<T, N>&) noexcept; // constexpr in C++14
@@ -190,17 +190,17 @@
 
     // element access:
     _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
-    reference operator[](size_type __n)             {return __elems_[__n];}
+    reference operator[](size_type __n)             _NOEXCEPT {return __elems_[__n];}
     _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
-    const_reference operator[](size_type __n) const {return __elems_[__n];}
+    const_reference operator[](size_type __n) const _NOEXCEPT {return __elems_[__n];}
 
     _LIBCPP_CONSTEXPR_AFTER_CXX14       reference at(size_type __n);
     _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference at(size_type __n) const;
 
-    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 reference front()             {return __elems_[0];}
-    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference front() const {return __elems_[0];}
-    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 reference back()              {return __elems_[_Size - 1];}
-    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference back() const  {return __elems_[_Size - 1];}
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 reference front()             _NOEXCEPT {return __elems_[0];}
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference front() const _NOEXCEPT {return __elems_[0];}
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 reference back()              _NOEXCEPT {return __elems_[_Size - 1];}
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference back() const  _NOEXCEPT {return __elems_[_Size - 1];}
 
     _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
     value_type* data() _NOEXCEPT {return __elems_;}
@@ -303,13 +303,13 @@
 
     // element access:
     _LIBCPP_INLINE_VISIBILITY
-    reference operator[](size_type) {
+    reference operator[](size_type) _NOEXCEPT {
       _LIBCPP_ASSERT(false, "cannot call array<T, 0>::operator[] on a zero-sized array");
       _LIBCPP_UNREACHABLE();
     }
 
     _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
-    const_reference operator[](size_type) const {
+    const_reference operator[](size_type) const _NOEXCEPT {
       _LIBCPP_ASSERT(false, "cannot call array<T, 0>::operator[] on a zero-sized array");
       _LIBCPP_UNREACHABLE();
     }
@@ -327,25 +327,25 @@
     }
 
     _LIBCPP_INLINE_VISIBILITY
-    reference front() {
+    reference front() _NOEXCEPT {
       _LIBCPP_ASSERT(false, "cannot call array<T, 0>::front() on a zero-sized array");
       _LIBCPP_UNREACHABLE();
     }
 
     _LIBCPP_INLINE_VISIBILITY
-    const_reference front() const {
+    const_reference front() const _NOEXCEPT {
       _LIBCPP_ASSERT(false, "cannot call array<T, 0>::front() on a zero-sized array");
       _LIBCPP_UNREACHABLE();
     }
 
     _LIBCPP_INLINE_VISIBILITY
-    reference back() {
+    reference back() _NOEXCEPT {
       _LIBCPP_ASSERT(false, "cannot call array<T, 0>::back() on a zero-sized array");
       _LIBCPP_UNREACHABLE();
     }
 
     _LIBCPP_INLINE_VISIBILITY
-    const_reference back() const {
+    const_reference back() const _NOEXCEPT {
       _LIBCPP_ASSERT(false, "cannot call array<T, 0>::back() on a zero-sized array");
       _LIBCPP_UNREACHABLE();
     }
@@ -433,10 +433,9 @@
     : public integral_constant<size_t, _Size> {};
 
 template <size_t _Ip, class _Tp, size_t _Size>
-class _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, array<_Tp, _Size> >
+struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, array<_Tp, _Size> >
 {
     static_assert(_Ip < _Size, "Index out of bounds in std::tuple_element<> (std::array)");
-public:
     typedef _Tp type;
 };
 
diff --git a/linux-x64/clang/include/c++/v1/atomic b/linux-x64/clang/include/c++/v1/atomic
index 60057f1..afb431e 100644
--- a/linux-x64/clang/include/c++/v1/atomic
+++ b/linux-x64/clang/include/c++/v1/atomic
@@ -20,17 +20,24 @@
 
 #define __cpp_lib_atomic_is_always_lock_free // as specified by SG10
 
-// order and consistency
+ // order and consistency
 
-typedef enum memory_order
-{
-    memory_order_relaxed,
-    memory_order_consume,  // load-consume
-    memory_order_acquire,  // load-acquire
-    memory_order_release,  // store-release
-    memory_order_acq_rel,  // store-release load-acquire
-    memory_order_seq_cst   // store-release load-acquire
-} memory_order;
+ enum memory_order: unspecified // enum class in C++20
+ {
+    relaxed,
+    consume, // load-consume
+    acquire, // load-acquire
+    release, // store-release
+    acq_rel, // store-release load-acquire
+    seq_cst // store-release load-acquire
+ };
+
+ inline constexpr auto memory_order_relaxed = memory_order::relaxed;
+ inline constexpr auto memory_order_consume = memory_order::consume;
+ inline constexpr auto memory_order_acquire = memory_order::acquire;
+ inline constexpr auto memory_order_release = memory_order::release;
+ inline constexpr auto memory_order_acq_rel = memory_order::acq_rel;
+ inline constexpr auto memory_order_seq_cst = memory_order::seq_cst;
 
 template <class T> T kill_dependency(T y) noexcept;
 
@@ -550,13 +557,13 @@
 #endif
 
 #ifdef _LIBCPP_HAS_NO_THREADS
-#error <atomic> is not supported on this single threaded system
+# error <atomic> is not supported on this single threaded system
 #endif
-#if !defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_GCC_ATOMIC_IMP)
-#error <atomic> is not implemented
+#ifdef _LIBCPP_HAS_NO_ATOMIC_HEADER
+# error <atomic> is not implemented
 #endif
 #ifdef kill_dependency
-#error C++ standard library is incompatible with <stdatomic.h>
+# error C++ standard library is incompatible with <stdatomic.h>
 #endif
 
 #define _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m) \
@@ -577,49 +584,94 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
-typedef enum memory_order
-{
-    memory_order_relaxed, memory_order_consume, memory_order_acquire,
-    memory_order_release, memory_order_acq_rel, memory_order_seq_cst
+// Figure out what the underlying type for `memory_order` would be if it were
+// declared as an unscoped enum (accounting for -fshort-enums). Use this result
+// to pin the underlying type in C++20.
+enum __legacy_memory_order {
+    __mo_relaxed,
+    __mo_consume,
+    __mo_acquire,
+    __mo_release,
+    __mo_acq_rel,
+    __mo_seq_cst
+};
+
+typedef underlying_type<__legacy_memory_order>::type __memory_order_underlying_t;
+
+#if _LIBCPP_STD_VER > 17
+
+enum class memory_order : __memory_order_underlying_t {
+  relaxed = __mo_relaxed,
+  consume = __mo_consume,
+  acquire = __mo_acquire,
+  release = __mo_release,
+  acq_rel = __mo_acq_rel,
+  seq_cst = __mo_seq_cst
+};
+
+inline constexpr auto memory_order_relaxed = memory_order::relaxed;
+inline constexpr auto memory_order_consume = memory_order::consume;
+inline constexpr auto memory_order_acquire = memory_order::acquire;
+inline constexpr auto memory_order_release = memory_order::release;
+inline constexpr auto memory_order_acq_rel = memory_order::acq_rel;
+inline constexpr auto memory_order_seq_cst = memory_order::seq_cst;
+
+#else
+
+typedef enum memory_order {
+  memory_order_relaxed = __mo_relaxed,
+  memory_order_consume = __mo_consume,
+  memory_order_acquire = __mo_acquire,
+  memory_order_release = __mo_release,
+  memory_order_acq_rel = __mo_acq_rel,
+  memory_order_seq_cst = __mo_seq_cst,
 } memory_order;
 
-#if defined(_LIBCPP_HAS_GCC_ATOMIC_IMP)
-namespace __gcc_atomic {
-template <typename _Tp>
-struct __gcc_atomic_t {
+#endif // _LIBCPP_STD_VER > 17
 
-#if _GNUC_VER >= 501
-    static_assert(is_trivially_copyable<_Tp>::value,
-      "std::atomic<Tp> requires that 'Tp' be a trivially copyable type");
+static_assert((is_same<underlying_type<memory_order>::type, __memory_order_underlying_t>::value),
+  "unexpected underlying type for std::memory_order");
+
+#if defined(_LIBCPP_HAS_GCC_ATOMIC_IMP) || \
+	defined(_LIBCPP_ATOMIC_ONLY_USE_BUILTINS)
+
+// [atomics.types.generic]p1 guarantees _Tp is trivially copyable. Because
+// the default operator= in an object is not volatile, a byte-by-byte copy
+// is required.
+template <typename _Tp, typename _Tv> _LIBCPP_INLINE_VISIBILITY
+typename enable_if<is_assignable<_Tp&, _Tv>::value>::type
+__cxx_atomic_assign_volatile(_Tp& __a_value, _Tv const& __val) {
+  __a_value = __val;
+}
+template <typename _Tp, typename _Tv> _LIBCPP_INLINE_VISIBILITY
+typename enable_if<is_assignable<_Tp&, _Tv>::value>::type
+__cxx_atomic_assign_volatile(_Tp volatile& __a_value, _Tv volatile const& __val) {
+  volatile char* __to = reinterpret_cast<volatile char*>(&__a_value);
+  volatile char* __end = __to + sizeof(_Tp);
+  volatile const char* __from = reinterpret_cast<volatile const char*>(&__val);
+  while (__to != __end)
+    *__to++ = *__from++;
+}
+
 #endif
 
+#if defined(_LIBCPP_HAS_GCC_ATOMIC_IMP)
+
+template <typename _Tp>
+struct __cxx_atomic_base_impl {
+
   _LIBCPP_INLINE_VISIBILITY
 #ifndef _LIBCPP_CXX03_LANG
-    __gcc_atomic_t() _NOEXCEPT = default;
+    __cxx_atomic_base_impl() _NOEXCEPT = default;
 #else
-    __gcc_atomic_t() _NOEXCEPT : __a_value() {}
+    __cxx_atomic_base_impl() _NOEXCEPT : __a_value() {}
 #endif // _LIBCPP_CXX03_LANG
-  _LIBCPP_CONSTEXPR explicit __gcc_atomic_t(_Tp value) _NOEXCEPT
+  _LIBCPP_CONSTEXPR explicit __cxx_atomic_base_impl(_Tp value) _NOEXCEPT
     : __a_value(value) {}
   _Tp __a_value;
 };
-#define _Atomic(x) __gcc_atomic::__gcc_atomic_t<x>
 
-template <typename _Tp> _Tp __create();
-
-template <typename _Tp, typename _Td>
-typename enable_if<sizeof(_Tp()->__a_value = __create<_Td>()), char>::type
-    __test_atomic_assignable(int);
-template <typename _Tp, typename _Up>
-__two __test_atomic_assignable(...);
-
-template <typename _Tp, typename _Td>
-struct __can_assign {
-  static const bool value =
-      sizeof(__test_atomic_assignable<_Tp, _Td>(1)) == sizeof(char);
-};
-
-static inline _LIBCPP_CONSTEXPR int __to_gcc_order(memory_order __order) {
+_LIBCPP_INLINE_VISIBILITY inline _LIBCPP_CONSTEXPR int __to_gcc_order(memory_order __order) {
   // Avoid switch statement to make this a constexpr.
   return __order == memory_order_relaxed ? __ATOMIC_RELAXED:
          (__order == memory_order_acquire ? __ATOMIC_ACQUIRE:
@@ -629,7 +681,7 @@
               __ATOMIC_CONSUME))));
 }
 
-static inline _LIBCPP_CONSTEXPR int __to_gcc_failure_order(memory_order __order) {
+_LIBCPP_INLINE_VISIBILITY inline _LIBCPP_CONSTEXPR int __to_gcc_failure_order(memory_order __order) {
   // Avoid switch statement to make this a constexpr.
   return __order == memory_order_relaxed ? __ATOMIC_RELAXED:
          (__order == memory_order_acquire ? __ATOMIC_ACQUIRE:
@@ -639,133 +691,125 @@
               __ATOMIC_CONSUME))));
 }
 
-} // namespace __gcc_atomic
+template <typename _Tp>
+_LIBCPP_INLINE_VISIBILITY
+void __cxx_atomic_init(volatile __cxx_atomic_base_impl<_Tp>* __a,  _Tp __val) {
+  __cxx_atomic_assign_volatile(__a->__a_value, __val);
+}
 
 template <typename _Tp>
-static inline
-typename enable_if<
-    __gcc_atomic::__can_assign<volatile _Atomic(_Tp)*, _Tp>::value>::type
-__c11_atomic_init(volatile _Atomic(_Tp)* __a,  _Tp __val) {
+_LIBCPP_INLINE_VISIBILITY
+void __cxx_atomic_init(__cxx_atomic_base_impl<_Tp>* __a,  _Tp __val) {
   __a->__a_value = __val;
 }
 
-template <typename _Tp>
-static inline
-typename enable_if<
-    !__gcc_atomic::__can_assign<volatile _Atomic(_Tp)*, _Tp>::value &&
-     __gcc_atomic::__can_assign<         _Atomic(_Tp)*, _Tp>::value>::type
-__c11_atomic_init(volatile _Atomic(_Tp)* __a,  _Tp __val) {
-  // [atomics.types.generic]p1 guarantees _Tp is trivially copyable. Because
-  // the default operator= in an object is not volatile, a byte-by-byte copy
-  // is required.
-  volatile char* to = reinterpret_cast<volatile char*>(&__a->__a_value);
-  volatile char* end = to + sizeof(_Tp);
-  char* from = reinterpret_cast<char*>(&__val);
-  while (to != end) {
-    *to++ = *from++;
-  }
+_LIBCPP_INLINE_VISIBILITY inline
+void __cxx_atomic_thread_fence(memory_order __order) {
+  __atomic_thread_fence(__to_gcc_order(__order));
+}
+
+_LIBCPP_INLINE_VISIBILITY inline
+void __cxx_atomic_signal_fence(memory_order __order) {
+  __atomic_signal_fence(__to_gcc_order(__order));
 }
 
 template <typename _Tp>
-static inline void __c11_atomic_init(_Atomic(_Tp)* __a,  _Tp __val) {
-  __a->__a_value = __val;
-}
-
-static inline void __c11_atomic_thread_fence(memory_order __order) {
-  __atomic_thread_fence(__gcc_atomic::__to_gcc_order(__order));
-}
-
-static inline void __c11_atomic_signal_fence(memory_order __order) {
-  __atomic_signal_fence(__gcc_atomic::__to_gcc_order(__order));
-}
-
-template <typename _Tp>
-static inline void __c11_atomic_store(volatile _Atomic(_Tp)* __a,  _Tp __val,
-                                      memory_order __order) {
-  return __atomic_store(&__a->__a_value, &__val,
-                        __gcc_atomic::__to_gcc_order(__order));
-}
-
-template <typename _Tp>
-static inline void __c11_atomic_store(_Atomic(_Tp)* __a,  _Tp __val,
-                                      memory_order __order) {
+_LIBCPP_INLINE_VISIBILITY
+void __cxx_atomic_store(volatile __cxx_atomic_base_impl<_Tp>* __a,  _Tp __val,
+                        memory_order __order) {
   __atomic_store(&__a->__a_value, &__val,
-                 __gcc_atomic::__to_gcc_order(__order));
+                 __to_gcc_order(__order));
 }
 
 template <typename _Tp>
-static inline _Tp __c11_atomic_load(const volatile _Atomic(_Tp)* __a,
-                                    memory_order __order) {
+_LIBCPP_INLINE_VISIBILITY
+void __cxx_atomic_store(__cxx_atomic_base_impl<_Tp>* __a,  _Tp __val,
+                        memory_order __order) {
+  __atomic_store(&__a->__a_value, &__val,
+                 __to_gcc_order(__order));
+}
+
+template <typename _Tp>
+_LIBCPP_INLINE_VISIBILITY
+_Tp __cxx_atomic_load(const volatile __cxx_atomic_base_impl<_Tp>* __a,
+                      memory_order __order) {
   _Tp __ret;
   __atomic_load(&__a->__a_value, &__ret,
-                __gcc_atomic::__to_gcc_order(__order));
+                __to_gcc_order(__order));
   return __ret;
 }
 
 template <typename _Tp>
-static inline _Tp __c11_atomic_load(const _Atomic(_Tp)* __a, memory_order __order) {
+_LIBCPP_INLINE_VISIBILITY
+_Tp __cxx_atomic_load(const __cxx_atomic_base_impl<_Tp>* __a, memory_order __order) {
   _Tp __ret;
   __atomic_load(&__a->__a_value, &__ret,
-                __gcc_atomic::__to_gcc_order(__order));
+                __to_gcc_order(__order));
   return __ret;
 }
 
 template <typename _Tp>
-static inline _Tp __c11_atomic_exchange(volatile _Atomic(_Tp)* __a,
-                                        _Tp __value, memory_order __order) {
+_LIBCPP_INLINE_VISIBILITY
+_Tp __cxx_atomic_exchange(volatile __cxx_atomic_base_impl<_Tp>* __a,
+                          _Tp __value, memory_order __order) {
   _Tp __ret;
   __atomic_exchange(&__a->__a_value, &__value, &__ret,
-                    __gcc_atomic::__to_gcc_order(__order));
+                    __to_gcc_order(__order));
   return __ret;
 }
 
 template <typename _Tp>
-static inline _Tp __c11_atomic_exchange(_Atomic(_Tp)* __a, _Tp __value,
-                                        memory_order __order) {
+_LIBCPP_INLINE_VISIBILITY
+_Tp __cxx_atomic_exchange(__cxx_atomic_base_impl<_Tp>* __a, _Tp __value,
+                          memory_order __order) {
   _Tp __ret;
   __atomic_exchange(&__a->__a_value, &__value, &__ret,
-                    __gcc_atomic::__to_gcc_order(__order));
+                    __to_gcc_order(__order));
   return __ret;
 }
 
 template <typename _Tp>
-static inline bool __c11_atomic_compare_exchange_strong(
-    volatile _Atomic(_Tp)* __a, _Tp* __expected, _Tp __value,
+_LIBCPP_INLINE_VISIBILITY
+bool __cxx_atomic_compare_exchange_strong(
+    volatile __cxx_atomic_base_impl<_Tp>* __a, _Tp* __expected, _Tp __value,
     memory_order __success, memory_order __failure) {
   return __atomic_compare_exchange(&__a->__a_value, __expected, &__value,
                                    false,
-                                   __gcc_atomic::__to_gcc_order(__success),
-                                   __gcc_atomic::__to_gcc_failure_order(__failure));
+                                   __to_gcc_order(__success),
+                                   __to_gcc_failure_order(__failure));
 }
 
 template <typename _Tp>
-static inline bool __c11_atomic_compare_exchange_strong(
-    _Atomic(_Tp)* __a, _Tp* __expected, _Tp __value, memory_order __success,
+_LIBCPP_INLINE_VISIBILITY
+bool __cxx_atomic_compare_exchange_strong(
+    __cxx_atomic_base_impl<_Tp>* __a, _Tp* __expected, _Tp __value, memory_order __success,
     memory_order __failure) {
   return __atomic_compare_exchange(&__a->__a_value, __expected, &__value,
                                    false,
-                                   __gcc_atomic::__to_gcc_order(__success),
-                                   __gcc_atomic::__to_gcc_failure_order(__failure));
+                                   __to_gcc_order(__success),
+                                   __to_gcc_failure_order(__failure));
 }
 
 template <typename _Tp>
-static inline bool __c11_atomic_compare_exchange_weak(
-    volatile _Atomic(_Tp)* __a, _Tp* __expected, _Tp __value,
+_LIBCPP_INLINE_VISIBILITY
+bool __cxx_atomic_compare_exchange_weak(
+    volatile __cxx_atomic_base_impl<_Tp>* __a, _Tp* __expected, _Tp __value,
     memory_order __success, memory_order __failure) {
   return __atomic_compare_exchange(&__a->__a_value, __expected, &__value,
                                    true,
-                                   __gcc_atomic::__to_gcc_order(__success),
-                                   __gcc_atomic::__to_gcc_failure_order(__failure));
+                                   __to_gcc_order(__success),
+                                   __to_gcc_failure_order(__failure));
 }
 
 template <typename _Tp>
-static inline bool __c11_atomic_compare_exchange_weak(
-    _Atomic(_Tp)* __a, _Tp* __expected, _Tp __value, memory_order __success,
+_LIBCPP_INLINE_VISIBILITY
+bool __cxx_atomic_compare_exchange_weak(
+    __cxx_atomic_base_impl<_Tp>* __a, _Tp* __expected, _Tp __value, memory_order __success,
     memory_order __failure) {
   return __atomic_compare_exchange(&__a->__a_value, __expected, &__value,
                                    true,
-                                   __gcc_atomic::__to_gcc_order(__success),
-                                   __gcc_atomic::__to_gcc_failure_order(__failure));
+                                   __to_gcc_order(__success),
+                                   __to_gcc_failure_order(__failure));
 }
 
 template <typename _Tp>
@@ -782,80 +826,264 @@
 struct __skip_amt<_Tp[n]> { };
 
 template <typename _Tp, typename _Td>
-static inline _Tp __c11_atomic_fetch_add(volatile _Atomic(_Tp)* __a,
-                                         _Td __delta, memory_order __order) {
+_LIBCPP_INLINE_VISIBILITY
+_Tp __cxx_atomic_fetch_add(volatile __cxx_atomic_base_impl<_Tp>* __a,
+                           _Td __delta, memory_order __order) {
   return __atomic_fetch_add(&__a->__a_value, __delta * __skip_amt<_Tp>::value,
-                            __gcc_atomic::__to_gcc_order(__order));
+                            __to_gcc_order(__order));
 }
 
 template <typename _Tp, typename _Td>
-static inline _Tp __c11_atomic_fetch_add(_Atomic(_Tp)* __a, _Td __delta,
-                                         memory_order __order) {
+_LIBCPP_INLINE_VISIBILITY
+_Tp __cxx_atomic_fetch_add(__cxx_atomic_base_impl<_Tp>* __a, _Td __delta,
+                           memory_order __order) {
   return __atomic_fetch_add(&__a->__a_value, __delta * __skip_amt<_Tp>::value,
-                            __gcc_atomic::__to_gcc_order(__order));
+                            __to_gcc_order(__order));
 }
 
 template <typename _Tp, typename _Td>
-static inline _Tp __c11_atomic_fetch_sub(volatile _Atomic(_Tp)* __a,
-                                         _Td __delta, memory_order __order) {
+_LIBCPP_INLINE_VISIBILITY
+_Tp __cxx_atomic_fetch_sub(volatile __cxx_atomic_base_impl<_Tp>* __a,
+                           _Td __delta, memory_order __order) {
   return __atomic_fetch_sub(&__a->__a_value, __delta * __skip_amt<_Tp>::value,
-                            __gcc_atomic::__to_gcc_order(__order));
+                            __to_gcc_order(__order));
 }
 
 template <typename _Tp, typename _Td>
-static inline _Tp __c11_atomic_fetch_sub(_Atomic(_Tp)* __a, _Td __delta,
-                                         memory_order __order) {
+_LIBCPP_INLINE_VISIBILITY
+_Tp __cxx_atomic_fetch_sub(__cxx_atomic_base_impl<_Tp>* __a, _Td __delta,
+                           memory_order __order) {
   return __atomic_fetch_sub(&__a->__a_value, __delta * __skip_amt<_Tp>::value,
-                            __gcc_atomic::__to_gcc_order(__order));
+                            __to_gcc_order(__order));
 }
 
 template <typename _Tp>
-static inline _Tp __c11_atomic_fetch_and(volatile _Atomic(_Tp)* __a,
-                                         _Tp __pattern, memory_order __order) {
+_LIBCPP_INLINE_VISIBILITY
+_Tp __cxx_atomic_fetch_and(volatile __cxx_atomic_base_impl<_Tp>* __a,
+                           _Tp __pattern, memory_order __order) {
   return __atomic_fetch_and(&__a->__a_value, __pattern,
-                            __gcc_atomic::__to_gcc_order(__order));
+                            __to_gcc_order(__order));
 }
 
 template <typename _Tp>
-static inline _Tp __c11_atomic_fetch_and(_Atomic(_Tp)* __a,
-                                         _Tp __pattern, memory_order __order) {
+_LIBCPP_INLINE_VISIBILITY
+_Tp __cxx_atomic_fetch_and(__cxx_atomic_base_impl<_Tp>* __a,
+                           _Tp __pattern, memory_order __order) {
   return __atomic_fetch_and(&__a->__a_value, __pattern,
-                            __gcc_atomic::__to_gcc_order(__order));
+                            __to_gcc_order(__order));
 }
 
 template <typename _Tp>
-static inline _Tp __c11_atomic_fetch_or(volatile _Atomic(_Tp)* __a,
-                                        _Tp __pattern, memory_order __order) {
+_LIBCPP_INLINE_VISIBILITY
+_Tp __cxx_atomic_fetch_or(volatile __cxx_atomic_base_impl<_Tp>* __a,
+                          _Tp __pattern, memory_order __order) {
   return __atomic_fetch_or(&__a->__a_value, __pattern,
-                           __gcc_atomic::__to_gcc_order(__order));
+                           __to_gcc_order(__order));
 }
 
 template <typename _Tp>
-static inline _Tp __c11_atomic_fetch_or(_Atomic(_Tp)* __a, _Tp __pattern,
-                                        memory_order __order) {
+_LIBCPP_INLINE_VISIBILITY
+_Tp __cxx_atomic_fetch_or(__cxx_atomic_base_impl<_Tp>* __a, _Tp __pattern,
+                          memory_order __order) {
   return __atomic_fetch_or(&__a->__a_value, __pattern,
-                           __gcc_atomic::__to_gcc_order(__order));
+                           __to_gcc_order(__order));
 }
 
 template <typename _Tp>
-static inline _Tp __c11_atomic_fetch_xor(volatile _Atomic(_Tp)* __a,
-                                         _Tp __pattern, memory_order __order) {
+_LIBCPP_INLINE_VISIBILITY
+_Tp __cxx_atomic_fetch_xor(volatile __cxx_atomic_base_impl<_Tp>* __a,
+                           _Tp __pattern, memory_order __order) {
   return __atomic_fetch_xor(&__a->__a_value, __pattern,
-                            __gcc_atomic::__to_gcc_order(__order));
+                            __to_gcc_order(__order));
 }
 
 template <typename _Tp>
-static inline _Tp __c11_atomic_fetch_xor(_Atomic(_Tp)* __a, _Tp __pattern,
-                                         memory_order __order) {
+_LIBCPP_INLINE_VISIBILITY
+_Tp __cxx_atomic_fetch_xor(__cxx_atomic_base_impl<_Tp>* __a, _Tp __pattern,
+                           memory_order __order) {
   return __atomic_fetch_xor(&__a->__a_value, __pattern,
-                            __gcc_atomic::__to_gcc_order(__order));
+                            __to_gcc_order(__order));
 }
-#endif // _LIBCPP_HAS_GCC_ATOMIC_IMP
+
+#define __cxx_atomic_is_lock_free(__s) __atomic_is_lock_free(__s, 0)
+
+#elif defined(_LIBCPP_HAS_C_ATOMIC_IMP)
+
+template <typename _Tp>
+struct __cxx_atomic_base_impl {
+
+  _LIBCPP_INLINE_VISIBILITY
+#ifndef _LIBCPP_CXX03_LANG
+    __cxx_atomic_base_impl() _NOEXCEPT = default;
+#else
+    __cxx_atomic_base_impl() _NOEXCEPT : __a_value() {}
+#endif // _LIBCPP_CXX03_LANG
+  _LIBCPP_CONSTEXPR explicit __cxx_atomic_base_impl(_Tp value) _NOEXCEPT
+    : __a_value(value) {}
+  _Atomic(_Tp) __a_value;
+};
+
+#define __cxx_atomic_is_lock_free(__s) __c11_atomic_is_lock_free(__s)
+
+_LIBCPP_INLINE_VISIBILITY inline
+void __cxx_atomic_thread_fence(memory_order __order) _NOEXCEPT {
+    __c11_atomic_thread_fence(static_cast<__memory_order_underlying_t>(__order));
+}
+
+_LIBCPP_INLINE_VISIBILITY inline
+void __cxx_atomic_signal_fence(memory_order __order) _NOEXCEPT {
+    __c11_atomic_signal_fence(static_cast<__memory_order_underlying_t>(__order));
+}
+
+template<class _Tp>
+_LIBCPP_INLINE_VISIBILITY
+void __cxx_atomic_init(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __val) _NOEXCEPT {
+    __c11_atomic_init(&__a->__a_value, __val);
+}
+template<class _Tp>
+_LIBCPP_INLINE_VISIBILITY
+void __cxx_atomic_init(__cxx_atomic_base_impl<_Tp> * __a, _Tp __val) _NOEXCEPT {
+    __c11_atomic_init(&__a->__a_value, __val);
+}
+
+template<class _Tp>
+_LIBCPP_INLINE_VISIBILITY
+void __cxx_atomic_store(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __val, memory_order __order) _NOEXCEPT {
+    __c11_atomic_store(&__a->__a_value, __val, static_cast<__memory_order_underlying_t>(__order));
+}
+template<class _Tp>
+_LIBCPP_INLINE_VISIBILITY
+void __cxx_atomic_store(__cxx_atomic_base_impl<_Tp> * __a, _Tp __val, memory_order __order) _NOEXCEPT {
+    __c11_atomic_store(&__a->__a_value, __val, static_cast<__memory_order_underlying_t>(__order));
+}
+
+template<class _Tp>
+_LIBCPP_INLINE_VISIBILITY
+_Tp __cxx_atomic_load(__cxx_atomic_base_impl<_Tp> const volatile* __a, memory_order __order) _NOEXCEPT {
+    using __ptr_type = typename remove_const<decltype(__a->__a_value)>::type*;
+    return __c11_atomic_load(const_cast<__ptr_type>(&__a->__a_value), static_cast<__memory_order_underlying_t>(__order));
+}
+template<class _Tp>
+_LIBCPP_INLINE_VISIBILITY
+_Tp __cxx_atomic_load(__cxx_atomic_base_impl<_Tp> const* __a, memory_order __order) _NOEXCEPT {
+    using __ptr_type = typename remove_const<decltype(__a->__a_value)>::type*;
+    return __c11_atomic_load(const_cast<__ptr_type>(&__a->__a_value), static_cast<__memory_order_underlying_t>(__order));
+}
+
+template<class _Tp>
+_LIBCPP_INLINE_VISIBILITY
+_Tp __cxx_atomic_exchange(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __value, memory_order __order) _NOEXCEPT {
+    return __c11_atomic_exchange(&__a->__a_value, __value, static_cast<__memory_order_underlying_t>(__order));
+}
+template<class _Tp>
+_LIBCPP_INLINE_VISIBILITY
+_Tp __cxx_atomic_exchange(__cxx_atomic_base_impl<_Tp> * __a, _Tp __value, memory_order __order) _NOEXCEPT {
+    return __c11_atomic_exchange(&__a->__a_value, __value, static_cast<__memory_order_underlying_t>(__order));
+}
+
+template<class _Tp>
+_LIBCPP_INLINE_VISIBILITY
+bool __cxx_atomic_compare_exchange_strong(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp* __expected, _Tp __value, memory_order __success, memory_order __failure) _NOEXCEPT {
+    return __c11_atomic_compare_exchange_strong(&__a->__a_value, __expected, __value, static_cast<__memory_order_underlying_t>(__success), static_cast<__memory_order_underlying_t>(__failure));
+}
+template<class _Tp>
+_LIBCPP_INLINE_VISIBILITY
+bool __cxx_atomic_compare_exchange_strong(__cxx_atomic_base_impl<_Tp> * __a, _Tp* __expected, _Tp __value, memory_order __success, memory_order __failure) _NOEXCEPT {
+    return __c11_atomic_compare_exchange_strong(&__a->__a_value, __expected, __value, static_cast<__memory_order_underlying_t>(__success), static_cast<__memory_order_underlying_t>(__failure));
+}
+
+template<class _Tp>
+_LIBCPP_INLINE_VISIBILITY
+bool __cxx_atomic_compare_exchange_weak(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp* __expected, _Tp __value, memory_order __success, memory_order __failure) _NOEXCEPT {
+    return __c11_atomic_compare_exchange_weak(&__a->__a_value, __expected, __value, static_cast<__memory_order_underlying_t>(__success), static_cast<__memory_order_underlying_t>(__failure));
+}
+template<class _Tp>
+_LIBCPP_INLINE_VISIBILITY
+bool __cxx_atomic_compare_exchange_weak(__cxx_atomic_base_impl<_Tp> * __a, _Tp* __expected, _Tp __value, memory_order __success, memory_order __failure) _NOEXCEPT {
+    return __c11_atomic_compare_exchange_weak(&__a->__a_value, __expected, __value,  static_cast<__memory_order_underlying_t>(__success), static_cast<__memory_order_underlying_t>(__failure));
+}
+
+template<class _Tp>
+_LIBCPP_INLINE_VISIBILITY
+_Tp __cxx_atomic_fetch_add(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __delta, memory_order __order) _NOEXCEPT {
+    return __c11_atomic_fetch_add(&__a->__a_value, __delta, static_cast<__memory_order_underlying_t>(__order));
+}
+template<class _Tp>
+_LIBCPP_INLINE_VISIBILITY
+_Tp __cxx_atomic_fetch_add(__cxx_atomic_base_impl<_Tp> * __a, _Tp __delta, memory_order __order) _NOEXCEPT {
+    return __c11_atomic_fetch_add(&__a->__a_value, __delta, static_cast<__memory_order_underlying_t>(__order));
+}
+
+template<class _Tp>
+_LIBCPP_INLINE_VISIBILITY
+_Tp* __cxx_atomic_fetch_add(__cxx_atomic_base_impl<_Tp*> volatile* __a, ptrdiff_t __delta, memory_order __order) _NOEXCEPT {
+    return __c11_atomic_fetch_add(&__a->__a_value, __delta, static_cast<__memory_order_underlying_t>(__order));
+}
+template<class _Tp>
+_LIBCPP_INLINE_VISIBILITY
+_Tp* __cxx_atomic_fetch_add(__cxx_atomic_base_impl<_Tp*> * __a, ptrdiff_t __delta, memory_order __order) _NOEXCEPT {
+    return __c11_atomic_fetch_add(&__a->__a_value, __delta, static_cast<__memory_order_underlying_t>(__order));
+}
+
+template<class _Tp>
+_LIBCPP_INLINE_VISIBILITY
+_Tp __cxx_atomic_fetch_sub(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __delta, memory_order __order) _NOEXCEPT {
+    return __c11_atomic_fetch_sub(&__a->__a_value, __delta, static_cast<__memory_order_underlying_t>(__order));
+}
+template<class _Tp>
+_LIBCPP_INLINE_VISIBILITY
+_Tp __cxx_atomic_fetch_sub(__cxx_atomic_base_impl<_Tp> * __a, _Tp __delta, memory_order __order) _NOEXCEPT {
+    return __c11_atomic_fetch_sub(&__a->__a_value, __delta, static_cast<__memory_order_underlying_t>(__order));
+}
+template<class _Tp>
+_LIBCPP_INLINE_VISIBILITY
+_Tp* __cxx_atomic_fetch_sub(__cxx_atomic_base_impl<_Tp*> volatile* __a, ptrdiff_t __delta, memory_order __order) _NOEXCEPT {
+    return __c11_atomic_fetch_sub(&__a->__a_value, __delta, static_cast<__memory_order_underlying_t>(__order));
+}
+template<class _Tp>
+_LIBCPP_INLINE_VISIBILITY
+_Tp* __cxx_atomic_fetch_sub(__cxx_atomic_base_impl<_Tp*> * __a, ptrdiff_t __delta, memory_order __order) _NOEXCEPT {
+    return __c11_atomic_fetch_sub(&__a->__a_value, __delta, static_cast<__memory_order_underlying_t>(__order));
+}
+
+template<class _Tp>
+_LIBCPP_INLINE_VISIBILITY
+_Tp __cxx_atomic_fetch_and(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __pattern, memory_order __order) _NOEXCEPT {
+    return __c11_atomic_fetch_and(&__a->__a_value, __pattern, static_cast<__memory_order_underlying_t>(__order));
+}
+template<class _Tp>
+_LIBCPP_INLINE_VISIBILITY
+_Tp __cxx_atomic_fetch_and(__cxx_atomic_base_impl<_Tp> * __a, _Tp __pattern, memory_order __order) _NOEXCEPT {
+    return __c11_atomic_fetch_and(&__a->__a_value, __pattern, static_cast<__memory_order_underlying_t>(__order));
+}
+
+template<class _Tp>
+_LIBCPP_INLINE_VISIBILITY
+_Tp __cxx_atomic_fetch_or(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __pattern, memory_order __order) _NOEXCEPT {
+    return __c11_atomic_fetch_or(&__a->__a_value, __pattern, static_cast<__memory_order_underlying_t>(__order));
+}
+template<class _Tp>
+_LIBCPP_INLINE_VISIBILITY
+_Tp __cxx_atomic_fetch_or(__cxx_atomic_base_impl<_Tp> * __a, _Tp __pattern, memory_order __order) _NOEXCEPT {
+    return __c11_atomic_fetch_or(&__a->__a_value, __pattern, static_cast<__memory_order_underlying_t>(__order));
+}
+
+template<class _Tp>
+_LIBCPP_INLINE_VISIBILITY
+_Tp __cxx_atomic_fetch_xor(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __pattern, memory_order __order) _NOEXCEPT {
+    return __c11_atomic_fetch_xor(&__a->__a_value, __pattern, static_cast<__memory_order_underlying_t>(__order));
+}
+template<class _Tp>
+_LIBCPP_INLINE_VISIBILITY
+_Tp __cxx_atomic_fetch_xor(__cxx_atomic_base_impl<_Tp> * __a, _Tp __pattern, memory_order __order) _NOEXCEPT {
+    return __c11_atomic_fetch_xor(&__a->__a_value, __pattern, static_cast<__memory_order_underlying_t>(__order));
+}
+
+#endif // _LIBCPP_HAS_GCC_ATOMIC_IMP, _LIBCPP_HAS_C_ATOMIC_IMP
 
 template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-_Tp
-kill_dependency(_Tp __y) _NOEXCEPT
+_LIBCPP_INLINE_VISIBILITY
+_Tp kill_dependency(_Tp __y) _NOEXCEPT
 {
     return __y;
 }
@@ -871,7 +1099,7 @@
 # define ATOMIC_LONG_LOCK_FREE      __CLANG_ATOMIC_LONG_LOCK_FREE
 # define ATOMIC_LLONG_LOCK_FREE     __CLANG_ATOMIC_LLONG_LOCK_FREE
 # define ATOMIC_POINTER_LOCK_FREE   __CLANG_ATOMIC_POINTER_LOCK_FREE
-#else
+#elif defined(__GCC_ATOMIC_BOOL_LOCK_FREE)
 # define ATOMIC_BOOL_LOCK_FREE      __GCC_ATOMIC_BOOL_LOCK_FREE
 # define ATOMIC_CHAR_LOCK_FREE      __GCC_ATOMIC_CHAR_LOCK_FREE
 # define ATOMIC_CHAR16_T_LOCK_FREE  __GCC_ATOMIC_CHAR16_T_LOCK_FREE
@@ -884,12 +1112,352 @@
 # define ATOMIC_POINTER_LOCK_FREE   __GCC_ATOMIC_POINTER_LOCK_FREE
 #endif
 
+#ifdef _LIBCPP_ATOMIC_ONLY_USE_BUILTINS
+
+template<typename _Tp>
+struct __cxx_atomic_lock_impl {
+
+  _LIBCPP_INLINE_VISIBILITY
+  __cxx_atomic_lock_impl() _NOEXCEPT
+    : __a_value(), __a_lock(0) {}
+  _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR explicit
+  __cxx_atomic_lock_impl(_Tp value) _NOEXCEPT
+    : __a_value(value), __a_lock(0) {}
+
+  _Tp __a_value;
+  mutable __cxx_atomic_base_impl<_LIBCPP_ATOMIC_FLAG_TYPE> __a_lock;
+
+  _LIBCPP_INLINE_VISIBILITY void __lock() const volatile {
+    while(1 == __cxx_atomic_exchange(&__a_lock, _LIBCPP_ATOMIC_FLAG_TYPE(true), memory_order_acquire))
+        /*spin*/;
+  }
+  _LIBCPP_INLINE_VISIBILITY void __lock() const {
+    while(1 == __cxx_atomic_exchange(&__a_lock, _LIBCPP_ATOMIC_FLAG_TYPE(true), memory_order_acquire))
+        /*spin*/;
+  }
+  _LIBCPP_INLINE_VISIBILITY void __unlock() const volatile {
+    __cxx_atomic_store(&__a_lock, _LIBCPP_ATOMIC_FLAG_TYPE(false), memory_order_release);
+  }
+  _LIBCPP_INLINE_VISIBILITY void __unlock() const {
+    __cxx_atomic_store(&__a_lock, _LIBCPP_ATOMIC_FLAG_TYPE(false), memory_order_release);
+  }
+  _LIBCPP_INLINE_VISIBILITY _Tp __read() const volatile {
+    __lock();
+    _Tp __old;
+    __cxx_atomic_assign_volatile(__old, __a_value);
+    __unlock();
+    return __old;
+  }
+  _LIBCPP_INLINE_VISIBILITY _Tp __read() const {
+    __lock();
+    _Tp __old = __a_value;
+    __unlock();
+    return __old;
+  }
+};
+
+template <typename _Tp>
+_LIBCPP_INLINE_VISIBILITY
+void __cxx_atomic_init(volatile __cxx_atomic_lock_impl<_Tp>* __a,  _Tp __val) {
+  __cxx_atomic_assign_volatile(__a->__a_value, __val);
+}
+template <typename _Tp>
+_LIBCPP_INLINE_VISIBILITY
+void __cxx_atomic_init(__cxx_atomic_lock_impl<_Tp>* __a,  _Tp __val) {
+  __a->__a_value = __val;
+}
+
+template <typename _Tp>
+_LIBCPP_INLINE_VISIBILITY
+void __cxx_atomic_store(volatile __cxx_atomic_lock_impl<_Tp>* __a,  _Tp __val, memory_order) {
+  __a->__lock();
+  __cxx_atomic_assign_volatile(__a->__a_value, __val);
+  __a->__unlock();
+}
+template <typename _Tp>
+_LIBCPP_INLINE_VISIBILITY
+void __cxx_atomic_store(__cxx_atomic_lock_impl<_Tp>* __a,  _Tp __val, memory_order) {
+  __a->__lock();
+  __a->__a_value = __val;
+  __a->__unlock();
+}
+
+template <typename _Tp>
+_LIBCPP_INLINE_VISIBILITY
+_Tp __cxx_atomic_load(const volatile __cxx_atomic_lock_impl<_Tp>* __a, memory_order) {
+  return __a->__read();
+}
+template <typename _Tp>
+_LIBCPP_INLINE_VISIBILITY
+_Tp __cxx_atomic_load(const __cxx_atomic_lock_impl<_Tp>* __a, memory_order) {
+  return __a->__read();
+}
+
+template <typename _Tp>
+_LIBCPP_INLINE_VISIBILITY
+_Tp __cxx_atomic_exchange(volatile __cxx_atomic_lock_impl<_Tp>* __a, _Tp __value, memory_order) {
+  __a->__lock();
+  _Tp __old;
+  __cxx_atomic_assign_volatile(__old, __a->__a_value);
+  __cxx_atomic_assign_volatile(__a->__a_value, __value);
+  __a->__unlock();
+  return __old;
+}
+template <typename _Tp>
+_LIBCPP_INLINE_VISIBILITY
+_Tp __cxx_atomic_exchange(__cxx_atomic_lock_impl<_Tp>* __a, _Tp __value, memory_order) {
+  __a->__lock();
+  _Tp __old = __a->__a_value;
+  __a->__a_value = __value;
+  __a->__unlock();
+  return __old;
+}
+
+template <typename _Tp>
+_LIBCPP_INLINE_VISIBILITY
+bool __cxx_atomic_compare_exchange_strong(volatile __cxx_atomic_lock_impl<_Tp>* __a,
+                                          _Tp* __expected, _Tp __value, memory_order, memory_order) {
+  __a->__lock();
+  _Tp temp;
+  __cxx_atomic_assign_volatile(temp, __a->__a_value);
+  bool __ret = temp == *__expected;
+  if(__ret)
+    __cxx_atomic_assign_volatile(__a->__a_value, __value);
+  else
+    __cxx_atomic_assign_volatile(*__expected, __a->__a_value);
+  __a->__unlock();
+  return __ret;
+}
+template <typename _Tp>
+_LIBCPP_INLINE_VISIBILITY
+bool __cxx_atomic_compare_exchange_strong(__cxx_atomic_lock_impl<_Tp>* __a,
+                                          _Tp* __expected, _Tp __value, memory_order, memory_order) {
+  __a->__lock();
+  bool __ret = __a->__a_value == *__expected;
+  if(__ret)
+    __a->__a_value = __value;
+  else
+    *__expected = __a->__a_value;
+  __a->__unlock();
+  return __ret;
+}
+
+template <typename _Tp>
+_LIBCPP_INLINE_VISIBILITY
+bool __cxx_atomic_compare_exchange_weak(volatile __cxx_atomic_lock_impl<_Tp>* __a,
+                                        _Tp* __expected, _Tp __value, memory_order, memory_order) {
+  __a->__lock();
+  _Tp temp;
+  __cxx_atomic_assign_volatile(temp, __a->__a_value);
+  bool __ret = temp == *__expected;
+  if(__ret)
+    __cxx_atomic_assign_volatile(__a->__a_value, __value);
+  else
+    __cxx_atomic_assign_volatile(*__expected, __a->__a_value);
+  __a->__unlock();
+  return __ret;
+}
+template <typename _Tp>
+_LIBCPP_INLINE_VISIBILITY
+bool __cxx_atomic_compare_exchange_weak(__cxx_atomic_lock_impl<_Tp>* __a,
+                                        _Tp* __expected, _Tp __value, memory_order, memory_order) {
+  __a->__lock();
+  bool __ret = __a->__a_value == *__expected;
+  if(__ret)
+    __a->__a_value = __value;
+  else
+    *__expected = __a->__a_value;
+  __a->__unlock();
+  return __ret;
+}
+
+template <typename _Tp, typename _Td>
+_LIBCPP_INLINE_VISIBILITY
+_Tp __cxx_atomic_fetch_add(volatile __cxx_atomic_lock_impl<_Tp>* __a,
+                           _Td __delta, memory_order) {
+  __a->__lock();
+  _Tp __old;
+  __cxx_atomic_assign_volatile(__old, __a->__a_value);
+  __cxx_atomic_assign_volatile(__a->__a_value, _Tp(__old + __delta));
+  __a->__unlock();
+  return __old;
+}
+template <typename _Tp, typename _Td>
+_LIBCPP_INLINE_VISIBILITY
+_Tp __cxx_atomic_fetch_add(__cxx_atomic_lock_impl<_Tp>* __a,
+                           _Td __delta, memory_order) {
+  __a->__lock();
+  _Tp __old = __a->__a_value;
+  __a->__a_value += __delta;
+  __a->__unlock();
+  return __old;
+}
+
+template <typename _Tp, typename _Td>
+_LIBCPP_INLINE_VISIBILITY
+_Tp* __cxx_atomic_fetch_add(volatile __cxx_atomic_lock_impl<_Tp*>* __a,
+                           ptrdiff_t __delta, memory_order) {
+  __a->__lock();
+  _Tp* __old;
+  __cxx_atomic_assign_volatile(__old, __a->__a_value);
+  __cxx_atomic_assign_volatile(__a->__a_value, __old + __delta);
+  __a->__unlock();
+  return __old;
+}
+template <typename _Tp, typename _Td>
+_LIBCPP_INLINE_VISIBILITY
+_Tp* __cxx_atomic_fetch_add(__cxx_atomic_lock_impl<_Tp*>* __a,
+                           ptrdiff_t __delta, memory_order) {
+  __a->__lock();
+  _Tp* __old = __a->__a_value;
+  __a->__a_value += __delta;
+  __a->__unlock();
+  return __old;
+}
+
+template <typename _Tp, typename _Td>
+_LIBCPP_INLINE_VISIBILITY
+_Tp __cxx_atomic_fetch_sub(volatile __cxx_atomic_lock_impl<_Tp>* __a,
+                           _Td __delta, memory_order) {
+  __a->__lock();
+  _Tp __old;
+  __cxx_atomic_assign_volatile(__old, __a->__a_value);
+  __cxx_atomic_assign_volatile(__a->__a_value, _Tp(__old - __delta));
+  __a->__unlock();
+  return __old;
+}
+template <typename _Tp, typename _Td>
+_LIBCPP_INLINE_VISIBILITY
+_Tp __cxx_atomic_fetch_sub(__cxx_atomic_lock_impl<_Tp>* __a,
+                           _Td __delta, memory_order) {
+  __a->__lock();
+  _Tp __old = __a->__a_value;
+  __a->__a_value -= __delta;
+  __a->__unlock();
+  return __old;
+}
+
+template <typename _Tp>
+_LIBCPP_INLINE_VISIBILITY
+_Tp __cxx_atomic_fetch_and(volatile __cxx_atomic_lock_impl<_Tp>* __a,
+                           _Tp __pattern, memory_order) {
+  __a->__lock();
+  _Tp __old;
+  __cxx_atomic_assign_volatile(__old, __a->__a_value);
+  __cxx_atomic_assign_volatile(__a->__a_value, _Tp(__old & __pattern));
+  __a->__unlock();
+  return __old;
+}
+template <typename _Tp>
+_LIBCPP_INLINE_VISIBILITY
+_Tp __cxx_atomic_fetch_and(__cxx_atomic_lock_impl<_Tp>* __a,
+                           _Tp __pattern, memory_order) {
+  __a->__lock();
+  _Tp __old = __a->__a_value;
+  __a->__a_value &= __pattern;
+  __a->__unlock();
+  return __old;
+}
+
+template <typename _Tp>
+_LIBCPP_INLINE_VISIBILITY
+_Tp __cxx_atomic_fetch_or(volatile __cxx_atomic_lock_impl<_Tp>* __a,
+                          _Tp __pattern, memory_order) {
+  __a->__lock();
+  _Tp __old;
+  __cxx_atomic_assign_volatile(__old, __a->__a_value);
+  __cxx_atomic_assign_volatile(__a->__a_value, _Tp(__old | __pattern));
+  __a->__unlock();
+  return __old;
+}
+template <typename _Tp>
+_LIBCPP_INLINE_VISIBILITY
+_Tp __cxx_atomic_fetch_or(__cxx_atomic_lock_impl<_Tp>* __a,
+                          _Tp __pattern, memory_order) {
+  __a->__lock();
+  _Tp __old = __a->__a_value;
+  __a->__a_value |= __pattern;
+  __a->__unlock();
+  return __old;
+}
+
+template <typename _Tp>
+_LIBCPP_INLINE_VISIBILITY
+_Tp __cxx_atomic_fetch_xor(volatile __cxx_atomic_lock_impl<_Tp>* __a,
+                           _Tp __pattern, memory_order) {
+  __a->__lock();
+  _Tp __old;
+  __cxx_atomic_assign_volatile(__old, __a->__a_value);
+  __cxx_atomic_assign_volatile(__a->__a_value, _Tp(__old ^ __pattern));
+  __a->__unlock();
+  return __old;
+}
+template <typename _Tp>
+_LIBCPP_INLINE_VISIBILITY
+_Tp __cxx_atomic_fetch_xor(__cxx_atomic_lock_impl<_Tp>* __a,
+                           _Tp __pattern, memory_order) {
+  __a->__lock();
+  _Tp __old = __a->__a_value;
+  __a->__a_value ^= __pattern;
+  __a->__unlock();
+  return __old;
+}
+
+#ifdef __cpp_lib_atomic_is_always_lock_free
+
+template<typename _Tp> struct __cxx_is_always_lock_free {
+    enum { __value = __atomic_always_lock_free(sizeof(_Tp), 0) }; };
+
+#else
+
+template<typename _Tp> struct __cxx_is_always_lock_free { enum { __value = false }; };
+// Implementations must match the C ATOMIC_*_LOCK_FREE macro values.
+template<> struct __cxx_is_always_lock_free<bool> { enum { __value = 2 == ATOMIC_BOOL_LOCK_FREE }; };
+template<> struct __cxx_is_always_lock_free<char> { enum { __value = 2 == ATOMIC_CHAR_LOCK_FREE }; };
+template<> struct __cxx_is_always_lock_free<signed char> { enum { __value = 2 == ATOMIC_CHAR_LOCK_FREE }; };
+template<> struct __cxx_is_always_lock_free<unsigned char> { enum { __value = 2 == ATOMIC_CHAR_LOCK_FREE }; };
+template<> struct __cxx_is_always_lock_free<char16_t> { enum { __value = 2 == ATOMIC_CHAR16_T_LOCK_FREE }; };
+template<> struct __cxx_is_always_lock_free<char32_t> { enum { __value = 2 == ATOMIC_CHAR32_T_LOCK_FREE }; };
+template<> struct __cxx_is_always_lock_free<wchar_t> { enum { __value = 2 == ATOMIC_WCHAR_T_LOCK_FREE }; };
+template<> struct __cxx_is_always_lock_free<short> { enum { __value = 2 == ATOMIC_SHORT_LOCK_FREE }; };
+template<> struct __cxx_is_always_lock_free<unsigned short> { enum { __value = 2 == ATOMIC_SHORT_LOCK_FREE }; };
+template<> struct __cxx_is_always_lock_free<int> { enum { __value = 2 == ATOMIC_INT_LOCK_FREE }; };
+template<> struct __cxx_is_always_lock_free<unsigned int> { enum { __value = 2 == ATOMIC_INT_LOCK_FREE }; };
+template<> struct __cxx_is_always_lock_free<long> { enum { __value = 2 == ATOMIC_LONG_LOCK_FREE }; };
+template<> struct __cxx_is_always_lock_free<unsigned long> { enum { __value = 2 == ATOMIC_LONG_LOCK_FREE }; };
+template<> struct __cxx_is_always_lock_free<long long> { enum { __value = 2 == ATOMIC_LLONG_LOCK_FREE }; };
+template<> struct __cxx_is_always_lock_free<unsigned long long> { enum { __value = 2 == ATOMIC_LLONG_LOCK_FREE }; };
+template<typename _Tp> struct __cxx_is_always_lock_free<_Tp*> { enum { __value = 2 == ATOMIC_POINTER_LOCK_FREE }; };
+template<> struct __cxx_is_always_lock_free<std::nullptr_t> { enum { __value = 2 == ATOMIC_POINTER_LOCK_FREE }; };
+
+#endif //__cpp_lib_atomic_is_always_lock_free
+
+template <typename _Tp,
+          typename _Base = typename conditional<__cxx_is_always_lock_free<_Tp>::__value,
+                                                __cxx_atomic_base_impl<_Tp>,
+                                                __cxx_atomic_lock_impl<_Tp> >::type>
+#else
+template <typename _Tp,
+          typename _Base = __cxx_atomic_base_impl<_Tp> >
+#endif //_LIBCPP_ATOMIC_ONLY_USE_BUILTINS
+struct __cxx_atomic_impl : public _Base {
+
+#if _GNUC_VER >= 501
+    static_assert(is_trivially_copyable<_Tp>::value,
+      "std::atomic<Tp> requires that 'Tp' be a trivially copyable type");
+#endif
+
+  _LIBCPP_INLINE_VISIBILITY __cxx_atomic_impl() _NOEXCEPT _LIBCPP_DEFAULT
+  _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR explicit __cxx_atomic_impl(_Tp value) _NOEXCEPT
+    : _Base(value) {}
+};
+
 // general atomic<T>
 
 template <class _Tp, bool = is_integral<_Tp>::value && !is_same<_Tp, bool>::value>
 struct __atomic_base  // false
 {
-    mutable _Atomic(_Tp) __a_;
+    mutable __cxx_atomic_impl<_Tp> __a_;
 
 #if defined(__cpp_lib_atomic_is_always_lock_free)
   static _LIBCPP_CONSTEXPR bool is_always_lock_free = __atomic_always_lock_free(sizeof(__a_), 0);
@@ -897,88 +1465,79 @@
 
     _LIBCPP_INLINE_VISIBILITY
     bool is_lock_free() const volatile _NOEXCEPT
-    {
-#if defined(_LIBCPP_HAS_C_ATOMIC_IMP)
-    return __c11_atomic_is_lock_free(sizeof(_Tp));
-#else
-    return __atomic_is_lock_free(sizeof(_Tp), 0);
-#endif
-    }
+        {return __cxx_atomic_is_lock_free(sizeof(_Tp));}
     _LIBCPP_INLINE_VISIBILITY
     bool is_lock_free() const _NOEXCEPT
         {return static_cast<__atomic_base const volatile*>(this)->is_lock_free();}
     _LIBCPP_INLINE_VISIBILITY
     void store(_Tp __d, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT
       _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m)
-        {__c11_atomic_store(&__a_, __d, __m);}
+        {__cxx_atomic_store(&__a_, __d, __m);}
     _LIBCPP_INLINE_VISIBILITY
     void store(_Tp __d, memory_order __m = memory_order_seq_cst) _NOEXCEPT
       _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m)
-        {__c11_atomic_store(&__a_, __d, __m);}
+        {__cxx_atomic_store(&__a_, __d, __m);}
     _LIBCPP_INLINE_VISIBILITY
     _Tp load(memory_order __m = memory_order_seq_cst) const volatile _NOEXCEPT
       _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m)
-        {return __c11_atomic_load(&__a_, __m);}
+        {return __cxx_atomic_load(&__a_, __m);}
     _LIBCPP_INLINE_VISIBILITY
     _Tp load(memory_order __m = memory_order_seq_cst) const _NOEXCEPT
       _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m)
-        {return __c11_atomic_load(&__a_, __m);}
+        {return __cxx_atomic_load(&__a_, __m);}
     _LIBCPP_INLINE_VISIBILITY
     operator _Tp() const volatile _NOEXCEPT {return load();}
     _LIBCPP_INLINE_VISIBILITY
     operator _Tp() const _NOEXCEPT          {return load();}
     _LIBCPP_INLINE_VISIBILITY
     _Tp exchange(_Tp __d, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT
-        {return __c11_atomic_exchange(&__a_, __d, __m);}
+        {return __cxx_atomic_exchange(&__a_, __d, __m);}
     _LIBCPP_INLINE_VISIBILITY
     _Tp exchange(_Tp __d, memory_order __m = memory_order_seq_cst) _NOEXCEPT
-        {return __c11_atomic_exchange(&__a_, __d, __m);}
+        {return __cxx_atomic_exchange(&__a_, __d, __m);}
     _LIBCPP_INLINE_VISIBILITY
     bool compare_exchange_weak(_Tp& __e, _Tp __d,
                                memory_order __s, memory_order __f) volatile _NOEXCEPT
       _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f)
-        {return __c11_atomic_compare_exchange_weak(&__a_, &__e, __d, __s, __f);}
+        {return __cxx_atomic_compare_exchange_weak(&__a_, &__e, __d, __s, __f);}
     _LIBCPP_INLINE_VISIBILITY
     bool compare_exchange_weak(_Tp& __e, _Tp __d,
                                memory_order __s, memory_order __f) _NOEXCEPT
       _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f)
-        {return __c11_atomic_compare_exchange_weak(&__a_, &__e, __d, __s, __f);}
+        {return __cxx_atomic_compare_exchange_weak(&__a_, &__e, __d, __s, __f);}
     _LIBCPP_INLINE_VISIBILITY
     bool compare_exchange_strong(_Tp& __e, _Tp __d,
                                  memory_order __s, memory_order __f) volatile _NOEXCEPT
       _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f)
-        {return __c11_atomic_compare_exchange_strong(&__a_, &__e, __d, __s, __f);}
+        {return __cxx_atomic_compare_exchange_strong(&__a_, &__e, __d, __s, __f);}
     _LIBCPP_INLINE_VISIBILITY
     bool compare_exchange_strong(_Tp& __e, _Tp __d,
                                  memory_order __s, memory_order __f) _NOEXCEPT
       _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f)
-        {return __c11_atomic_compare_exchange_strong(&__a_, &__e, __d, __s, __f);}
+        {return __cxx_atomic_compare_exchange_strong(&__a_, &__e, __d, __s, __f);}
     _LIBCPP_INLINE_VISIBILITY
     bool compare_exchange_weak(_Tp& __e, _Tp __d,
                               memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT
-        {return __c11_atomic_compare_exchange_weak(&__a_, &__e, __d, __m, __m);}
+        {return __cxx_atomic_compare_exchange_weak(&__a_, &__e, __d, __m, __m);}
     _LIBCPP_INLINE_VISIBILITY
     bool compare_exchange_weak(_Tp& __e, _Tp __d,
                                memory_order __m = memory_order_seq_cst) _NOEXCEPT
-        {return __c11_atomic_compare_exchange_weak(&__a_, &__e, __d, __m, __m);}
+        {return __cxx_atomic_compare_exchange_weak(&__a_, &__e, __d, __m, __m);}
     _LIBCPP_INLINE_VISIBILITY
     bool compare_exchange_strong(_Tp& __e, _Tp __d,
                               memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT
-        {return __c11_atomic_compare_exchange_strong(&__a_, &__e, __d, __m, __m);}
+        {return __cxx_atomic_compare_exchange_strong(&__a_, &__e, __d, __m, __m);}
     _LIBCPP_INLINE_VISIBILITY
     bool compare_exchange_strong(_Tp& __e, _Tp __d,
                                  memory_order __m = memory_order_seq_cst) _NOEXCEPT
-        {return __c11_atomic_compare_exchange_strong(&__a_, &__e, __d, __m, __m);}
+        {return __cxx_atomic_compare_exchange_strong(&__a_, &__e, __d, __m, __m);}
 
     _LIBCPP_INLINE_VISIBILITY
-#ifndef _LIBCPP_CXX03_LANG
-    __atomic_base() _NOEXCEPT = default;
-#else
-    __atomic_base() _NOEXCEPT : __a_() {}
-#endif // _LIBCPP_CXX03_LANG
+    __atomic_base() _NOEXCEPT _LIBCPP_DEFAULT
 
-    _LIBCPP_INLINE_VISIBILITY
-    _LIBCPP_CONSTEXPR __atomic_base(_Tp __d) _NOEXCEPT : __a_(__d) {}
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+    __atomic_base(_Tp __d) _NOEXCEPT : __a_(__d) {}
+
 #ifndef _LIBCPP_CXX03_LANG
     __atomic_base(const __atomic_base&) = delete;
     __atomic_base& operator=(const __atomic_base&) = delete;
@@ -1010,34 +1569,34 @@
 
     _LIBCPP_INLINE_VISIBILITY
     _Tp fetch_add(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT
-        {return __c11_atomic_fetch_add(&this->__a_, __op, __m);}
+        {return __cxx_atomic_fetch_add(&this->__a_, __op, __m);}
     _LIBCPP_INLINE_VISIBILITY
     _Tp fetch_add(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT
-        {return __c11_atomic_fetch_add(&this->__a_, __op, __m);}
+        {return __cxx_atomic_fetch_add(&this->__a_, __op, __m);}
     _LIBCPP_INLINE_VISIBILITY
     _Tp fetch_sub(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT
-        {return __c11_atomic_fetch_sub(&this->__a_, __op, __m);}
+        {return __cxx_atomic_fetch_sub(&this->__a_, __op, __m);}
     _LIBCPP_INLINE_VISIBILITY
     _Tp fetch_sub(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT
-        {return __c11_atomic_fetch_sub(&this->__a_, __op, __m);}
+        {return __cxx_atomic_fetch_sub(&this->__a_, __op, __m);}
     _LIBCPP_INLINE_VISIBILITY
     _Tp fetch_and(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT
-        {return __c11_atomic_fetch_and(&this->__a_, __op, __m);}
+        {return __cxx_atomic_fetch_and(&this->__a_, __op, __m);}
     _LIBCPP_INLINE_VISIBILITY
     _Tp fetch_and(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT
-        {return __c11_atomic_fetch_and(&this->__a_, __op, __m);}
+        {return __cxx_atomic_fetch_and(&this->__a_, __op, __m);}
     _LIBCPP_INLINE_VISIBILITY
     _Tp fetch_or(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT
-        {return __c11_atomic_fetch_or(&this->__a_, __op, __m);}
+        {return __cxx_atomic_fetch_or(&this->__a_, __op, __m);}
     _LIBCPP_INLINE_VISIBILITY
     _Tp fetch_or(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT
-        {return __c11_atomic_fetch_or(&this->__a_, __op, __m);}
+        {return __cxx_atomic_fetch_or(&this->__a_, __op, __m);}
     _LIBCPP_INLINE_VISIBILITY
     _Tp fetch_xor(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT
-        {return __c11_atomic_fetch_xor(&this->__a_, __op, __m);}
+        {return __cxx_atomic_fetch_xor(&this->__a_, __op, __m);}
     _LIBCPP_INLINE_VISIBILITY
     _Tp fetch_xor(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT
-        {return __c11_atomic_fetch_xor(&this->__a_, __op, __m);}
+        {return __cxx_atomic_fetch_xor(&this->__a_, __op, __m);}
 
     _LIBCPP_INLINE_VISIBILITY
     _Tp operator++(int) volatile _NOEXCEPT      {return fetch_add(_Tp(1));}
@@ -1119,17 +1678,17 @@
     _LIBCPP_INLINE_VISIBILITY
     _Tp* fetch_add(ptrdiff_t __op, memory_order __m = memory_order_seq_cst)
                                                                         volatile _NOEXCEPT
-        {return __c11_atomic_fetch_add(&this->__a_, __op, __m);}
+        {return __cxx_atomic_fetch_add(&this->__a_, __op, __m);}
     _LIBCPP_INLINE_VISIBILITY
     _Tp* fetch_add(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT
-        {return __c11_atomic_fetch_add(&this->__a_, __op, __m);}
+        {return __cxx_atomic_fetch_add(&this->__a_, __op, __m);}
     _LIBCPP_INLINE_VISIBILITY
     _Tp* fetch_sub(ptrdiff_t __op, memory_order __m = memory_order_seq_cst)
                                                                         volatile _NOEXCEPT
-        {return __c11_atomic_fetch_sub(&this->__a_, __op, __m);}
+        {return __cxx_atomic_fetch_sub(&this->__a_, __op, __m);}
     _LIBCPP_INLINE_VISIBILITY
     _Tp* fetch_sub(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT
-        {return __c11_atomic_fetch_sub(&this->__a_, __op, __m);}
+        {return __cxx_atomic_fetch_sub(&this->__a_, __op, __m);}
 
     _LIBCPP_INLINE_VISIBILITY
     _Tp* operator++(int) volatile _NOEXCEPT            {return fetch_add(1);}
@@ -1160,7 +1719,7 @@
 // atomic_is_lock_free
 
 template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY
 bool
 atomic_is_lock_free(const volatile atomic<_Tp>* __o) _NOEXCEPT
 {
@@ -1168,7 +1727,7 @@
 }
 
 template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY
 bool
 atomic_is_lock_free(const atomic<_Tp>* __o) _NOEXCEPT
 {
@@ -1178,25 +1737,25 @@
 // atomic_init
 
 template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY
 void
 atomic_init(volatile atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
 {
-    __c11_atomic_init(&__o->__a_, __d);
+    __cxx_atomic_init(&__o->__a_, __d);
 }
 
 template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY
 void
 atomic_init(atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
 {
-    __c11_atomic_init(&__o->__a_, __d);
+    __cxx_atomic_init(&__o->__a_, __d);
 }
 
 // atomic_store
 
 template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY
 void
 atomic_store(volatile atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
 {
@@ -1204,7 +1763,7 @@
 }
 
 template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY
 void
 atomic_store(atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
 {
@@ -1214,7 +1773,7 @@
 // atomic_store_explicit
 
 template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY
 void
 atomic_store_explicit(volatile atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOEXCEPT
   _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m)
@@ -1223,7 +1782,7 @@
 }
 
 template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY
 void
 atomic_store_explicit(atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOEXCEPT
   _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m)
@@ -1234,7 +1793,7 @@
 // atomic_load
 
 template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY
 _Tp
 atomic_load(const volatile atomic<_Tp>* __o) _NOEXCEPT
 {
@@ -1242,7 +1801,7 @@
 }
 
 template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY
 _Tp
 atomic_load(const atomic<_Tp>* __o) _NOEXCEPT
 {
@@ -1252,7 +1811,7 @@
 // atomic_load_explicit
 
 template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY
 _Tp
 atomic_load_explicit(const volatile atomic<_Tp>* __o, memory_order __m) _NOEXCEPT
   _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m)
@@ -1261,7 +1820,7 @@
 }
 
 template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY
 _Tp
 atomic_load_explicit(const atomic<_Tp>* __o, memory_order __m) _NOEXCEPT
   _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m)
@@ -1272,7 +1831,7 @@
 // atomic_exchange
 
 template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY
 _Tp
 atomic_exchange(volatile atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
 {
@@ -1280,7 +1839,7 @@
 }
 
 template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY
 _Tp
 atomic_exchange(atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
 {
@@ -1290,7 +1849,7 @@
 // atomic_exchange_explicit
 
 template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY
 _Tp
 atomic_exchange_explicit(volatile atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOEXCEPT
 {
@@ -1298,7 +1857,7 @@
 }
 
 template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY
 _Tp
 atomic_exchange_explicit(atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOEXCEPT
 {
@@ -1308,7 +1867,7 @@
 // atomic_compare_exchange_weak
 
 template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY
 bool
 atomic_compare_exchange_weak(volatile atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NOEXCEPT
 {
@@ -1316,7 +1875,7 @@
 }
 
 template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY
 bool
 atomic_compare_exchange_weak(atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NOEXCEPT
 {
@@ -1326,7 +1885,7 @@
 // atomic_compare_exchange_strong
 
 template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY
 bool
 atomic_compare_exchange_strong(volatile atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NOEXCEPT
 {
@@ -1334,7 +1893,7 @@
 }
 
 template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY
 bool
 atomic_compare_exchange_strong(atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NOEXCEPT
 {
@@ -1344,7 +1903,7 @@
 // atomic_compare_exchange_weak_explicit
 
 template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY
 bool
 atomic_compare_exchange_weak_explicit(volatile atomic<_Tp>* __o, _Tp* __e,
                                       _Tp __d,
@@ -1355,7 +1914,7 @@
 }
 
 template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY
 bool
 atomic_compare_exchange_weak_explicit(atomic<_Tp>* __o, _Tp* __e, _Tp __d,
                                       memory_order __s, memory_order __f) _NOEXCEPT
@@ -1367,7 +1926,7 @@
 // atomic_compare_exchange_strong_explicit
 
 template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY
 bool
 atomic_compare_exchange_strong_explicit(volatile atomic<_Tp>* __o,
                                         _Tp* __e, _Tp __d,
@@ -1378,7 +1937,7 @@
 }
 
 template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY
 bool
 atomic_compare_exchange_strong_explicit(atomic<_Tp>* __o, _Tp* __e,
                                         _Tp __d,
@@ -1391,7 +1950,7 @@
 // atomic_fetch_add
 
 template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY
 typename enable_if
 <
     is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
@@ -1403,7 +1962,7 @@
 }
 
 template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY
 typename enable_if
 <
     is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
@@ -1415,7 +1974,7 @@
 }
 
 template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY
 _Tp*
 atomic_fetch_add(volatile atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT
 {
@@ -1423,7 +1982,7 @@
 }
 
 template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY
 _Tp*
 atomic_fetch_add(atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT
 {
@@ -1433,7 +1992,7 @@
 // atomic_fetch_add_explicit
 
 template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY
 typename enable_if
 <
     is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
@@ -1445,7 +2004,7 @@
 }
 
 template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY
 typename enable_if
 <
     is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
@@ -1457,7 +2016,7 @@
 }
 
 template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY
 _Tp*
 atomic_fetch_add_explicit(volatile atomic<_Tp*>* __o, ptrdiff_t __op,
                           memory_order __m) _NOEXCEPT
@@ -1466,7 +2025,7 @@
 }
 
 template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY
 _Tp*
 atomic_fetch_add_explicit(atomic<_Tp*>* __o, ptrdiff_t __op, memory_order __m) _NOEXCEPT
 {
@@ -1476,7 +2035,7 @@
 // atomic_fetch_sub
 
 template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY
 typename enable_if
 <
     is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
@@ -1488,7 +2047,7 @@
 }
 
 template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY
 typename enable_if
 <
     is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
@@ -1500,7 +2059,7 @@
 }
 
 template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY
 _Tp*
 atomic_fetch_sub(volatile atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT
 {
@@ -1508,7 +2067,7 @@
 }
 
 template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY
 _Tp*
 atomic_fetch_sub(atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT
 {
@@ -1518,7 +2077,7 @@
 // atomic_fetch_sub_explicit
 
 template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY
 typename enable_if
 <
     is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
@@ -1530,7 +2089,7 @@
 }
 
 template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY
 typename enable_if
 <
     is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
@@ -1542,7 +2101,7 @@
 }
 
 template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY
 _Tp*
 atomic_fetch_sub_explicit(volatile atomic<_Tp*>* __o, ptrdiff_t __op,
                           memory_order __m) _NOEXCEPT
@@ -1551,7 +2110,7 @@
 }
 
 template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY
 _Tp*
 atomic_fetch_sub_explicit(atomic<_Tp*>* __o, ptrdiff_t __op, memory_order __m) _NOEXCEPT
 {
@@ -1561,7 +2120,7 @@
 // atomic_fetch_and
 
 template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY
 typename enable_if
 <
     is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
@@ -1573,7 +2132,7 @@
 }
 
 template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY
 typename enable_if
 <
     is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
@@ -1587,7 +2146,7 @@
 // atomic_fetch_and_explicit
 
 template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY
 typename enable_if
 <
     is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
@@ -1599,7 +2158,7 @@
 }
 
 template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY
 typename enable_if
 <
     is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
@@ -1613,7 +2172,7 @@
 // atomic_fetch_or
 
 template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY
 typename enable_if
 <
     is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
@@ -1625,7 +2184,7 @@
 }
 
 template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY
 typename enable_if
 <
     is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
@@ -1639,7 +2198,7 @@
 // atomic_fetch_or_explicit
 
 template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY
 typename enable_if
 <
     is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
@@ -1651,7 +2210,7 @@
 }
 
 template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY
 typename enable_if
 <
     is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
@@ -1665,7 +2224,7 @@
 // atomic_fetch_xor
 
 template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY
 typename enable_if
 <
     is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
@@ -1677,7 +2236,7 @@
 }
 
 template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY
 typename enable_if
 <
     is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
@@ -1691,7 +2250,7 @@
 // atomic_fetch_xor_explicit
 
 template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY
 typename enable_if
 <
     is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
@@ -1703,7 +2262,7 @@
 }
 
 template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY
 typename enable_if
 <
     is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
@@ -1718,27 +2277,23 @@
 
 typedef struct atomic_flag
 {
-    _Atomic(bool) __a_;
+    __cxx_atomic_impl<_LIBCPP_ATOMIC_FLAG_TYPE> __a_;
 
     _LIBCPP_INLINE_VISIBILITY
     bool test_and_set(memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT
-        {return __c11_atomic_exchange(&__a_, true, __m);}
+        {return __cxx_atomic_exchange(&__a_, _LIBCPP_ATOMIC_FLAG_TYPE(true), __m);}
     _LIBCPP_INLINE_VISIBILITY
     bool test_and_set(memory_order __m = memory_order_seq_cst) _NOEXCEPT
-        {return __c11_atomic_exchange(&__a_, true, __m);}
+        {return __cxx_atomic_exchange(&__a_, _LIBCPP_ATOMIC_FLAG_TYPE(true), __m);}
     _LIBCPP_INLINE_VISIBILITY
     void clear(memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT
-        {__c11_atomic_store(&__a_, false, __m);}
+        {__cxx_atomic_store(&__a_, _LIBCPP_ATOMIC_FLAG_TYPE(false), __m);}
     _LIBCPP_INLINE_VISIBILITY
     void clear(memory_order __m = memory_order_seq_cst) _NOEXCEPT
-        {__c11_atomic_store(&__a_, false, __m);}
+        {__cxx_atomic_store(&__a_, _LIBCPP_ATOMIC_FLAG_TYPE(false), __m);}
 
     _LIBCPP_INLINE_VISIBILITY
-#ifndef _LIBCPP_CXX03_LANG
-    atomic_flag() _NOEXCEPT = default;
-#else
-    atomic_flag() _NOEXCEPT : __a_() {}
-#endif // _LIBCPP_CXX03_LANG
+    atomic_flag() _NOEXCEPT _LIBCPP_DEFAULT
 
     _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
     atomic_flag(bool __b) _NOEXCEPT : __a_(__b) {} // EXTENSION
@@ -1817,14 +2372,14 @@
 void
 atomic_thread_fence(memory_order __m) _NOEXCEPT
 {
-    __c11_atomic_thread_fence(__m);
+    __cxx_atomic_thread_fence(__m);
 }
 
 inline _LIBCPP_INLINE_VISIBILITY
 void
 atomic_signal_fence(memory_order __m) _NOEXCEPT
 {
-    __c11_atomic_signal_fence(__m);
+    __cxx_atomic_signal_fence(__m);
 }
 
 // Atomics for standard typedef types
diff --git a/linux-x64/clang/include/c++/v1/bit b/linux-x64/clang/include/c++/v1/bit
index a2ca3bc..dbf7f8a 100644
--- a/linux-x64/clang/include/c++/v1/bit
+++ b/linux-x64/clang/include/c++/v1/bit
@@ -15,12 +15,42 @@
 
 namespace std {
 
+  template <class T>
+    constexpr bool ispow2(T x) noexcept; // C++20
+  template <class T>
+    constexpr T ceil2(T x);              // C++20
+  template <class T>
+    constexpr T floor2(T x) noexcept;    // C++20
+  template <class T>
+    constexpr T log2p1(T x) noexcept;    // C++20
+
+  // 23.20.2, rotating
+  template<class T>
+    constexpr T rotl(T x, unsigned int s) noexcept; // C++20
+  template<class T>
+    constexpr T rotr(T x, unsigned int s) noexcept; // C++20
+
+  // 23.20.3, counting
+  template<class T>
+    constexpr int countl_zero(T x) noexcept;  // C++20
+  template<class T>
+    constexpr int countl_one(T x) noexcept;   // C++20
+  template<class T>
+    constexpr int countr_zero(T x) noexcept;  // C++20
+  template<class T>
+    constexpr int countr_one(T x) noexcept;   // C++20
+  template<class T>
+    constexpr int popcount(T x) noexcept;     // C++20
+
 } // namespace std
 
 */
 
 #include <__config>
+#include <limits>
+#include <type_traits>
 #include <version>
+#include <__debug>
 
 #if defined(__IBMCPP__)
 #include "support/ibm/support.h"
@@ -33,38 +63,41 @@
 #pragma GCC system_header
 #endif
 
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
 _LIBCPP_BEGIN_NAMESPACE_STD
 
 #ifndef _LIBCPP_COMPILER_MSVC
 
-inline _LIBCPP_INLINE_VISIBILITY
-int __ctz(unsigned __x)           { return __builtin_ctz(__x); }
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+int __ctz(unsigned __x)           _NOEXCEPT { return __builtin_ctz(__x); }
 
-inline _LIBCPP_INLINE_VISIBILITY
-int __ctz(unsigned long __x)      { return __builtin_ctzl(__x); }
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+int __ctz(unsigned long __x)      _NOEXCEPT { return __builtin_ctzl(__x); }
 
-inline _LIBCPP_INLINE_VISIBILITY
-int __ctz(unsigned long long __x) { return __builtin_ctzll(__x); }
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+int __ctz(unsigned long long __x) _NOEXCEPT { return __builtin_ctzll(__x); }
 
 
-inline _LIBCPP_INLINE_VISIBILITY
-int __clz(unsigned __x)           { return __builtin_clz(__x); }
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+int __clz(unsigned __x)           _NOEXCEPT { return __builtin_clz(__x); }
 
-inline _LIBCPP_INLINE_VISIBILITY
-int __clz(unsigned long __x)      { return __builtin_clzl(__x); }
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+int __clz(unsigned long __x)      _NOEXCEPT { return __builtin_clzl(__x); }
 
-inline _LIBCPP_INLINE_VISIBILITY
-int __clz(unsigned long long __x) { return __builtin_clzll(__x); }
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+int __clz(unsigned long long __x) _NOEXCEPT { return __builtin_clzll(__x); }
 
 
-inline _LIBCPP_INLINE_VISIBILITY
-int __popcount(unsigned __x)           { return __builtin_popcount(__x); }
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+int __popcount(unsigned __x)           _NOEXCEPT { return __builtin_popcount(__x); }
 
-inline _LIBCPP_INLINE_VISIBILITY
-int __popcount(unsigned long __x)      { return __builtin_popcountl(__x); }
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+int __popcount(unsigned long __x)      _NOEXCEPT { return __builtin_popcountl(__x); }
 
-inline _LIBCPP_INLINE_VISIBILITY
-int __popcount(unsigned long long __x) { return __builtin_popcountll(__x); }
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+int __popcount(unsigned long long __x) _NOEXCEPT { return __builtin_popcountll(__x); }
 
 #else  // _LIBCPP_COMPILER_MSVC
 
@@ -152,6 +185,205 @@
 
 #endif // _LIBCPP_COMPILER_MSVC
 
+#if _LIBCPP_STD_VER > 17
+
+template <class _Tp>
+using __bitop_unsigned_integer _LIBCPP_NODEBUG_TYPE = integral_constant<bool,
+         is_integral_v<_Tp> &&
+         is_unsigned_v<_Tp> &&
+        _IsNotSame<remove_cv_t<_Tp>, bool>::value &&
+        _IsNotSame<remove_cv_t<_Tp>, signed char>::value &&
+        _IsNotSame<remove_cv_t<_Tp>, wchar_t>::value &&
+        _IsNotSame<remove_cv_t<_Tp>, char16_t>::value &&
+        _IsNotSame<remove_cv_t<_Tp>, char32_t>::value
+    >;
+
+
+// rotl
+template<class _Tp>
+_LIBCPP_INLINE_VISIBILITY constexpr
+enable_if_t<__bitop_unsigned_integer<_Tp>::value, _Tp>
+rotl(_Tp __t, unsigned int __cnt) noexcept
+{
+    const unsigned int __dig = numeric_limits<_Tp>::digits;
+    if ((__cnt % __dig) == 0)
+        return __t;
+    return (__t << (__cnt % __dig)) | (__t >> (__dig - (__cnt % __dig)));
+}
+
+
+// rotr
+template<class _Tp>
+_LIBCPP_INLINE_VISIBILITY constexpr
+enable_if_t<__bitop_unsigned_integer<_Tp>::value, _Tp>
+rotr(_Tp __t, unsigned int __cnt) noexcept
+{
+    const unsigned int __dig = numeric_limits<_Tp>::digits;
+    if ((__cnt % __dig) == 0)
+        return __t;
+    return (__t >> (__cnt % __dig)) | (__t << (__dig - (__cnt % __dig)));
+}
+
+
+// countl_zero
+template<class _Tp>
+_LIBCPP_INLINE_VISIBILITY constexpr
+enable_if_t<__bitop_unsigned_integer<_Tp>::value, int>
+countl_zero(_Tp __t) noexcept
+{
+    if (__t == 0)
+        return numeric_limits<_Tp>::digits;
+
+    if      constexpr (sizeof(_Tp) <= sizeof(unsigned int))
+        return __clz(static_cast<unsigned int>(__t))
+              - (numeric_limits<unsigned int>::digits - numeric_limits<_Tp>::digits);
+    else if constexpr (sizeof(_Tp) <= sizeof(unsigned long))
+        return __clz(static_cast<unsigned long>(__t))
+              - (numeric_limits<unsigned long>::digits - numeric_limits<_Tp>::digits);
+    else if constexpr (sizeof(_Tp) <= sizeof(unsigned long long))
+        return __clz(static_cast<unsigned long long>(__t))
+              - (numeric_limits<unsigned long long>::digits - numeric_limits<_Tp>::digits);
+    else
+    {
+        int __ret = 0;
+        int __iter = 0;
+        const unsigned int __ulldigits = numeric_limits<unsigned long long>::digits;
+        while (true) {
+            __t = rotr(__t, __ulldigits);
+            if ((__iter = countl_zero(static_cast<unsigned long long>(__t))) != __ulldigits)
+                break;
+            __ret += __iter;
+            }
+        return __ret + __iter;
+    }
+}
+
+
+// countl_one
+template<class _Tp>
+_LIBCPP_INLINE_VISIBILITY constexpr
+enable_if_t<__bitop_unsigned_integer<_Tp>::value, int>
+countl_one(_Tp __t) noexcept
+{
+    return __t != numeric_limits<_Tp>::max()
+        ? countl_zero(static_cast<_Tp>(~__t))
+        : numeric_limits<_Tp>::digits;
+}
+
+
+// countr_zero
+template<class _Tp>
+_LIBCPP_INLINE_VISIBILITY constexpr
+enable_if_t<__bitop_unsigned_integer<_Tp>::value, int>
+countr_zero(_Tp __t) noexcept
+{
+    if (__t == 0)
+        return numeric_limits<_Tp>::digits;
+
+    if      constexpr (sizeof(_Tp) <= sizeof(unsigned int))
+        return __ctz(static_cast<unsigned int>(__t));
+    else if constexpr (sizeof(_Tp) <= sizeof(unsigned long))
+        return __ctz(static_cast<unsigned long>(__t));
+    else if constexpr (sizeof(_Tp) <= sizeof(unsigned long long))
+        return __ctz(static_cast<unsigned long long>(__t));
+    else
+    {
+        int __ret = 0;
+        int __iter = 0;
+        const unsigned int __ulldigits = numeric_limits<unsigned long long>::digits;
+        while ((__iter = countr_zero(static_cast<unsigned long long>(__t))) == __ulldigits)
+        {
+            __ret += __iter;
+            __t >>= __ulldigits;
+        }
+        return __ret + __iter;
+    }
+}
+
+
+// countr_one
+template<class _Tp>
+_LIBCPP_INLINE_VISIBILITY constexpr
+enable_if_t<__bitop_unsigned_integer<_Tp>::value, int>
+countr_one(_Tp __t) noexcept
+{
+    return __t != numeric_limits<_Tp>::max()
+        ? countr_zero(static_cast<_Tp>(~__t))
+        : numeric_limits<_Tp>::digits;
+}
+
+
+// popcount
+template<class _Tp>
+_LIBCPP_INLINE_VISIBILITY constexpr
+enable_if_t<__bitop_unsigned_integer<_Tp>::value, int>
+popcount(_Tp __t) noexcept
+{
+    if      constexpr (sizeof(_Tp) <= sizeof(unsigned int))
+        return __popcount(static_cast<unsigned int>(__t));
+    else if constexpr (sizeof(_Tp) <= sizeof(unsigned long))
+        return __popcount(static_cast<unsigned long>(__t));
+    else if constexpr (sizeof(_Tp) <= sizeof(unsigned long long))
+        return __popcount(static_cast<unsigned long long>(__t));
+    else
+    {
+        int __ret = 0;
+        while (__t != 0)
+        {
+            __ret += __popcount(static_cast<unsigned long long>(__t));
+            __t >>= numeric_limits<unsigned long long>::digits;
+        }
+        return __ret;
+    }
+}
+
+
+// integral log base 2
+template<class _Tp>
+_LIBCPP_INLINE_VISIBILITY constexpr
+unsigned __bit_log2(_Tp __t) noexcept
+{ return std::numeric_limits<_Tp>::digits - 1 - countl_zero(__t); }
+
+
+template <class _Tp>
+_LIBCPP_INLINE_VISIBILITY constexpr
+enable_if_t<__bitop_unsigned_integer<_Tp>::value, bool>
+ispow2(_Tp __t) noexcept { return popcount(__t) == 1; }
+
+template <class _Tp>
+_LIBCPP_INLINE_VISIBILITY constexpr
+enable_if_t<__bitop_unsigned_integer<_Tp>::value, _Tp>
+floor2(_Tp __t) noexcept { return __t == 0 ? 0 : _Tp{1} << __bit_log2(__t); }
+
+template <class _Tp>
+_LIBCPP_INLINE_VISIBILITY constexpr
+enable_if_t<__bitop_unsigned_integer<_Tp>::value, _Tp>
+ceil2(_Tp __t) noexcept
+{
+    if (__t < 2) return 1;
+    const unsigned __n = numeric_limits<_Tp>::digits - countl_zero((_Tp)(__t - 1u));
+    _LIBCPP_DEBUG_ASSERT(__libcpp_is_constant_evaluated() || __n != numeric_limits<_Tp>::digits, "Bad input to ceil2");
+
+    if constexpr (sizeof(_Tp) >= sizeof(unsigned))
+        return _Tp{1} << __n;
+    else
+    {
+        const unsigned __extra = numeric_limits<unsigned>::digits  - numeric_limits<_Tp>::digits;
+        const unsigned __retVal = 1u << (__n + __extra);
+        return (_Tp) (__retVal >> __extra);
+    }
+}
+
+template <class _Tp>
+_LIBCPP_INLINE_VISIBILITY constexpr
+enable_if_t<__bitop_unsigned_integer<_Tp>::value, _Tp>
+log2p1(_Tp __t) noexcept
+{ return __t == 0 ? 0 : __bit_log2(__t) + 1; }
+
+#endif // _LIBCPP_STD_VER > 17
+
 _LIBCPP_END_NAMESPACE_STD
 
+_LIBCPP_POP_MACROS
+
 #endif // _LIBCPP_BIT
diff --git a/linux-x64/clang/include/c++/v1/bitset b/linux-x64/clang/include/c++/v1/bitset
index 9fb91e9..4755fbe 100644
--- a/linux-x64/clang/include/c++/v1/bitset
+++ b/linux-x64/clang/include/c++/v1/bitset
@@ -679,7 +679,7 @@
     _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR bitset() _NOEXCEPT {}
     _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
         bitset(unsigned long long __v) _NOEXCEPT : base(__v) {}
-    template<class _CharT>
+    template<class _CharT, class = _EnableIf<_IsCharLikeType<_CharT>::value> >
         explicit bitset(const _CharT* __str,
                         typename basic_string<_CharT>::size_type __n = basic_string<_CharT>::npos,
                         _CharT __zero = _CharT('0'), _CharT __one = _CharT('1'));
@@ -760,7 +760,7 @@
 };
 
 template <size_t _Size>
-template<class _CharT>
+template<class _CharT, class>
 bitset<_Size>::bitset(const _CharT* __str,
                       typename basic_string<_CharT>::size_type __n,
                       _CharT __zero, _CharT __one)
diff --git a/linux-x64/clang/include/c++/v1/charconv b/linux-x64/clang/include/c++/v1/charconv
index ec9baa8..a644fe0 100644
--- a/linux-x64/clang/include/c++/v1/charconv
+++ b/linux-x64/clang/include/c++/v1/charconv
@@ -96,7 +96,7 @@
 _LIBCPP_FUNC_VIS char* __u32toa(uint32_t __value, char* __buffer);
 }
 
-#if _LIBCPP_STD_VER > 11
+#ifndef _LIBCPP_CXX03_LANG
 
 enum class _LIBCPP_ENUM_VIS chars_format
 {
@@ -124,7 +124,7 @@
 namespace __itoa
 {
 
-static constexpr uint64_t __pow10_64[] = {
+static _LIBCPP_CONSTEXPR uint64_t __pow10_64[] = {
     UINT64_C(0),
     UINT64_C(10),
     UINT64_C(100),
@@ -147,7 +147,7 @@
     UINT64_C(10000000000000000000),
 };
 
-static constexpr uint32_t __pow10_32[] = {
+static _LIBCPP_CONSTEXPR uint32_t __pow10_32[] = {
     UINT32_C(0),          UINT32_C(10),       UINT32_C(100),
     UINT32_C(1000),       UINT32_C(10000),    UINT32_C(100000),
     UINT32_C(1000000),    UINT32_C(10000000), UINT32_C(100000000),
@@ -172,7 +172,7 @@
         return __u64toa(__v, __p);
     }
 
-    static _LIBCPP_INLINE_VISIBILITY auto& __pow() { return __pow10_64; }
+    static _LIBCPP_INLINE_VISIBILITY decltype(__pow10_64)& __pow() { return __pow10_64; }
 };
 
 template <typename _Tp>
@@ -194,7 +194,7 @@
         return __u32toa(__v, __p);
     }
 
-    static _LIBCPP_INLINE_VISIBILITY auto& __pow() { return __pow10_32; }
+    static _LIBCPP_INLINE_VISIBILITY decltype(__pow10_32)& __pow() { return __pow10_32; }
 };
 
 template <typename _Tp>
@@ -239,7 +239,7 @@
 template <typename _Tp>
 struct _LIBCPP_HIDDEN __traits : __traits_base<_Tp>
 {
-    static constexpr int digits = numeric_limits<_Tp>::digits10 + 1;
+    static _LIBCPP_CONSTEXPR int digits = numeric_limits<_Tp>::digits10 + 1;
     using __traits_base<_Tp>::__pow;
     using typename __traits_base<_Tp>::type;
 
@@ -285,10 +285,10 @@
 }
 
 template <typename _Tp>
-inline _LIBCPP_INLINE_VISIBILITY auto
+inline _LIBCPP_INLINE_VISIBILITY typename make_unsigned<_Tp>::type
 __to_unsigned(_Tp __x)
 {
-    return static_cast<make_unsigned_t<_Tp>>(__x);
+    return static_cast<typename make_unsigned<_Tp>::type>(__x);
 }
 
 template <typename _Tp>
@@ -314,7 +314,7 @@
 
 #if !defined(_LIBCPP_COMPILER_MSVC)
     if (__tx::digits <= __diff || __tx::__width(__value) <= __diff)
-        return {__tx::__convert(__value, __first), {}};
+        return {__tx::__convert(__value, __first), errc(0)};
     else
         return {__last, errc::value_too_large};
 #else
@@ -379,14 +379,14 @@
     }
 }
 
-template <typename _Tp, enable_if_t<is_integral<_Tp>::value, int> = 0>
+template <typename _Tp, typename enable_if<is_integral<_Tp>::value, int>::type = 0>
 inline _LIBCPP_INLINE_VISIBILITY to_chars_result
 to_chars(char* __first, char* __last, _Tp __value)
 {
     return __to_chars_itoa(__first, __last, __value, is_signed<_Tp>());
 }
 
-template <typename _Tp, enable_if_t<is_integral<_Tp>::value, int> = 0>
+template <typename _Tp, typename enable_if<is_integral<_Tp>::value, int>::type = 0>
 inline _LIBCPP_INLINE_VISIBILITY to_chars_result
 to_chars(char* __first, char* __last, _Tp __value, int __base)
 {
@@ -501,7 +501,7 @@
     return __r;
 }
 
-template <typename _Tp, enable_if_t<is_unsigned<_Tp>::value, int> = 0>
+template <typename _Tp, typename enable_if<is_unsigned<_Tp>::value, int>::type = 0>
 inline _LIBCPP_INLINE_VISIBILITY from_chars_result
 __from_chars_atoi(const char* __first, const char* __last, _Tp& __value)
 {
@@ -527,7 +527,7 @@
         });
 }
 
-template <typename _Tp, enable_if_t<is_signed<_Tp>::value, int> = 0>
+template <typename _Tp, typename enable_if<is_signed<_Tp>::value, int>::type = 0>
 inline _LIBCPP_INLINE_VISIBILITY from_chars_result
 __from_chars_atoi(const char* __first, const char* __last, _Tp& __value)
 {
@@ -535,7 +535,7 @@
     return __sign_combinator(__first, __last, __value, __from_chars_atoi<__t>);
 }
 
-template <typename _Tp, enable_if_t<is_unsigned<_Tp>::value, int> = 0>
+template <typename _Tp, typename enable_if<is_unsigned<_Tp>::value, int>::type = 0>
 inline _LIBCPP_INLINE_VISIBILITY from_chars_result
 __from_chars_integral(const char* __first, const char* __last, _Tp& __value,
                       int __base)
@@ -582,7 +582,7 @@
         __base);
 }
 
-template <typename _Tp, enable_if_t<is_signed<_Tp>::value, int> = 0>
+template <typename _Tp, typename enable_if<is_signed<_Tp>::value, int>::type = 0>
 inline _LIBCPP_INLINE_VISIBILITY from_chars_result
 __from_chars_integral(const char* __first, const char* __last, _Tp& __value,
                       int __base)
@@ -592,14 +592,14 @@
                              __from_chars_integral<__t>, __base);
 }
 
-template <typename _Tp, enable_if_t<is_integral<_Tp>::value, int> = 0>
+template <typename _Tp, typename enable_if<is_integral<_Tp>::value, int>::type = 0>
 inline _LIBCPP_INLINE_VISIBILITY from_chars_result
 from_chars(const char* __first, const char* __last, _Tp& __value)
 {
     return __from_chars_atoi(__first, __last, __value);
 }
 
-template <typename _Tp, enable_if_t<is_integral<_Tp>::value, int> = 0>
+template <typename _Tp, typename enable_if<is_integral<_Tp>::value, int>::type = 0>
 inline _LIBCPP_INLINE_VISIBILITY from_chars_result
 from_chars(const char* __first, const char* __last, _Tp& __value, int __base)
 {
@@ -607,7 +607,7 @@
     return __from_chars_integral(__first, __last, __value, __base);
 }
 
-#endif  // _LIBCPP_STD_VER > 11
+#endif  // _LIBCPP_CXX03_LANG
 
 _LIBCPP_END_NAMESPACE_STD
 
diff --git a/linux-x64/clang/include/c++/v1/chrono b/linux-x64/clang/include/c++/v1/chrono
index a003751..1b90757 100644
--- a/linux-x64/clang/include/c++/v1/chrono
+++ b/linux-x64/clang/include/c++/v1/chrono
@@ -1262,34 +1262,15 @@
 
 // Duration /
 
-template <class _Duration, class _Rep, bool = __is_duration<_Rep>::value>
-struct __duration_divide_result
-{
-};
-
-template <class _Duration, class _Rep2,
-    bool = is_convertible<_Rep2,
-                          typename common_type<typename _Duration::rep, _Rep2>::type>::value>
-struct __duration_divide_imp
-{
-};
-
-template <class _Rep1, class _Period, class _Rep2>
-struct __duration_divide_imp<duration<_Rep1, _Period>, _Rep2, true>
-{
-    typedef duration<typename common_type<_Rep1, _Rep2>::type, _Period> type;
-};
-
-template <class _Rep1, class _Period, class _Rep2>
-struct __duration_divide_result<duration<_Rep1, _Period>, _Rep2, false>
-    : __duration_divide_imp<duration<_Rep1, _Period>, _Rep2>
-{
-};
-
 template <class _Rep1, class _Period, class _Rep2>
 inline _LIBCPP_INLINE_VISIBILITY
 _LIBCPP_CONSTEXPR
-typename __duration_divide_result<duration<_Rep1, _Period>, _Rep2>::type
+typename enable_if
+<
+    !__is_duration<_Rep2>::value &&
+      is_convertible<_Rep2, typename common_type<_Rep1, _Rep2>::type>::value,
+    duration<typename common_type<_Rep1, _Rep2>::type, _Period>
+>::type
 operator/(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
 {
     typedef typename common_type<_Rep1, _Rep2>::type _Cr;
@@ -1312,7 +1293,12 @@
 template <class _Rep1, class _Period, class _Rep2>
 inline _LIBCPP_INLINE_VISIBILITY
 _LIBCPP_CONSTEXPR
-typename __duration_divide_result<duration<_Rep1, _Period>, _Rep2>::type
+typename enable_if
+<
+    !__is_duration<_Rep2>::value &&
+      is_convertible<_Rep2, typename common_type<_Rep1, _Rep2>::type>::value,
+    duration<typename common_type<_Rep1, _Rep2>::type, _Period>
+>::type
 operator%(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
 {
     typedef typename common_type<_Rep1, _Rep2>::type _Cr;
@@ -1604,9 +1590,9 @@
 using local_days    = local_time<days>;
 
 
-struct _LIBCPP_TYPE_VIS last_spec { explicit last_spec() = default; };
+struct last_spec { explicit last_spec() = default; };
 
-class _LIBCPP_TYPE_VIS day {
+class day {
 private:
     unsigned char __d;
 public:
@@ -1671,7 +1657,7 @@
 { *this = *this - __dd; return *this; }
 
 
-class _LIBCPP_TYPE_VIS month {
+class month {
 private:
     unsigned char __m;
 public:
@@ -1742,7 +1728,7 @@
 { *this = *this - __dm; return *this; }
 
 
-class _LIBCPP_TYPE_VIS year {
+class year {
 private:
     short __y;
 public:
@@ -1816,10 +1802,10 @@
 inline constexpr bool year::ok() const noexcept
 { return static_cast<int>(min()) <= __y && __y <= static_cast<int>(max()); }
 
-class _LIBCPP_TYPE_VIS weekday_indexed;
-class _LIBCPP_TYPE_VIS weekday_last;
+class weekday_indexed;
+class weekday_last;
 
-class _LIBCPP_TYPE_VIS weekday {
+class weekday {
 private:
     unsigned char __wd;
 public:
@@ -1905,7 +1891,7 @@
 { *this = *this - __dd; return *this; }
 
 
-class _LIBCPP_TYPE_VIS weekday_indexed {
+class weekday_indexed {
 private:
     _VSTD::chrono::weekday __wd;
     unsigned char          __idx;
@@ -1927,7 +1913,7 @@
 { return !(__lhs == __rhs); }
 
 
-class _LIBCPP_TYPE_VIS weekday_last {
+class weekday_last {
 private:
     _VSTD::chrono::weekday __wd;
 public:
@@ -1948,7 +1934,7 @@
 inline constexpr
 weekday_indexed weekday::operator[](unsigned __index) const noexcept { return weekday_indexed{*this, __index}; }
 
-inline constexpr 
+inline constexpr
 weekday_last    weekday::operator[](last_spec) const noexcept { return weekday_last{*this}; }
 
 
@@ -1975,7 +1961,7 @@
 inline constexpr month December{12};
 
 
-class _LIBCPP_TYPE_VIS month_day {
+class month_day {
 private:
    chrono::month __m;
    chrono::day   __d;
@@ -2050,7 +2036,7 @@
 
 
 
-class _LIBCPP_TYPE_VIS month_day_last {
+class month_day_last {
 private:
     chrono::month __m;
 public:
@@ -2101,7 +2087,7 @@
 { return month_day_last{month(__rhs)}; }
 
 
-class _LIBCPP_TYPE_VIS month_weekday {
+class month_weekday {
 private:
     chrono::month __m;
     chrono::weekday_indexed __wdi;
@@ -2139,7 +2125,7 @@
 { return month_weekday{month(__rhs), __lhs}; }
 
 
-class _LIBCPP_TYPE_VIS month_weekday_last {
+class month_weekday_last {
     chrono::month        __m;
     chrono::weekday_last __wdl;
   public:
@@ -2176,7 +2162,7 @@
 { return month_weekday_last{month(__rhs), __lhs}; }
 
 
-class _LIBCPP_TYPE_VIS year_month {
+class year_month {
     chrono::year  __y;
     chrono::month __m;
 public:
@@ -2250,7 +2236,7 @@
 
 class year_month_day_last;
 
-class _LIBCPP_TYPE_VIS year_month_day {
+class year_month_day {
 private:
     chrono::year  __y;
     chrono::month __m;
@@ -2259,7 +2245,7 @@
      year_month_day() = default;
      inline constexpr year_month_day(
             const chrono::year& __yval, const chrono::month& __mval, const chrono::day& __dval) noexcept
-            : __y{__yval}, __m{__mval}, __d{__dval} {}  
+            : __y{__yval}, __m{__mval}, __d{__dval} {}
             constexpr year_month_day(const year_month_day_last& __ymdl) noexcept;
      inline constexpr year_month_day(const sys_days& __sysd) noexcept
             : year_month_day(__from_days(__sysd.time_since_epoch())) {}
@@ -2404,7 +2390,7 @@
 inline constexpr year_month_day& year_month_day::operator+=(const years& __dy)  noexcept { *this = *this + __dy; return *this; }
 inline constexpr year_month_day& year_month_day::operator-=(const years& __dy)  noexcept { *this = *this - __dy; return *this; }
 
-class _LIBCPP_TYPE_VIS year_month_day_last {
+class year_month_day_last {
 private:
     chrono::year           __y;
     chrono::month_day_last __mdl;
@@ -2514,7 +2500,7 @@
 inline constexpr year_month_day_last& year_month_day_last::operator-=(const years& __dy)  noexcept { *this = *this - __dy; return *this; }
 
 inline constexpr year_month_day::year_month_day(const year_month_day_last& __ymdl) noexcept
-    : __y{__ymdl.year()}, __m{__ymdl.month()}, __d{__ymdl.day()} {}  
+    : __y{__ymdl.year()}, __m{__ymdl.month()}, __d{__ymdl.day()} {}
 
 inline constexpr bool year_month_day::ok() const noexcept
 {
@@ -2522,7 +2508,7 @@
     return chrono::day{1} <= __d && __d <= (__y / __m / last).day();
 }
 
-class _LIBCPP_TYPE_VIS year_month_weekday {
+class year_month_weekday {
     chrono::year            __y;
     chrono::month           __m;
     chrono::weekday_indexed __wdi;
@@ -2565,7 +2551,7 @@
     const sys_days      __sysd{__d};
     const chrono::weekday __wd = chrono::weekday(__sysd);
     const year_month_day __ymd = year_month_day(__sysd);
-    return year_month_weekday{__ymd.year(), __ymd.month(), 
+    return year_month_weekday{__ymd.year(), __ymd.month(),
                               __wd[(static_cast<unsigned>(__ymd.day())-1)/7+1]};
 }
 
@@ -2636,7 +2622,7 @@
 inline constexpr year_month_weekday& year_month_weekday::operator+=(const years& __dy)  noexcept { *this = *this + __dy; return *this; }
 inline constexpr year_month_weekday& year_month_weekday::operator-=(const years& __dy)  noexcept { *this = *this - __dy; return *this; }
 
-class _LIBCPP_TYPE_VIS year_month_weekday_last {
+class year_month_weekday_last {
 private:
     chrono::year         __y;
     chrono::month        __m;
@@ -2657,9 +2643,9 @@
     inline constexpr operator                 sys_days() const noexcept { return   sys_days{__to_days()}; }
     inline explicit constexpr operator      local_days() const noexcept { return local_days{__to_days()}; }
     inline constexpr bool ok() const noexcept { return __y.ok() && __m.ok() && __wdl.ok(); }
-    
+
     constexpr days __to_days() const noexcept;
-    
+
 };
 
 inline constexpr
@@ -2697,7 +2683,7 @@
 
 inline constexpr
 year_month_weekday_last operator/(const month_weekday_last& __lhs, int __rhs) noexcept
-{ return year(__rhs) / __lhs; }  
+{ return year(__rhs) / __lhs; }
 
 
 inline constexpr
@@ -2809,7 +2795,7 @@
     {
         return chrono::day(static_cast<unsigned>(__d));
     }
- 
+
     constexpr chrono::year operator ""y(unsigned long long __y) noexcept
     {
         return chrono::year(static_cast<int>(__y));
@@ -2841,7 +2827,7 @@
 
   static _LIBCPP_CONSTEXPR_AFTER_CXX11 const bool is_steady = false;
 
-  _LIBCPP_FUNC_VIS static time_point now() noexcept;
+  _LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_FUNC_VIS static time_point now() noexcept;
 
   _LIBCPP_INLINE_VISIBILITY
   static time_t to_time_t(const time_point& __t) noexcept {
diff --git a/linux-x64/clang/include/c++/v1/cmath b/linux-x64/clang/include/c++/v1/cmath
index 3af9f54..f5864be 100644
--- a/linux-x64/clang/include/c++/v1/cmath
+++ b/linux-x64/clang/include/c++/v1/cmath
@@ -529,7 +529,7 @@
 
 template <class _A1, class _A2, class _A3>
 inline _LIBCPP_INLINE_VISIBILITY
-typename __lazy_enable_if
+typename _EnableIf
 <
     is_arithmetic<_A1>::value &&
     is_arithmetic<_A2>::value &&
@@ -606,6 +606,32 @@
     return isfinite(__lcpp_x);
 }
 
+#if _LIBCPP_STD_VER > 17
+template <typename _Fp>
+constexpr
+_Fp __lerp(_Fp __a, _Fp __b, _Fp __t) noexcept {
+    if ((__a <= 0 && __b >= 0) || (__a >= 0 && __b <= 0))
+        return __t * __b + (1 - __t) * __a;
+
+    if (__t == 1) return __b;
+    const _Fp __x = __a + __t * (__b - __a);
+    if (__t > 1 == __b > __a)
+    	return __b < __x ? __x : __b;
+    else
+    	return __x < __b ? __x : __b;
+}
+
+constexpr float
+lerp(float __a, float __b, float __t)                   _NOEXCEPT { return __lerp(__a, __b, __t); }
+
+constexpr double
+lerp(double __a, double __b, double __t)                _NOEXCEPT { return __lerp(__a, __b, __t); }
+
+constexpr long double
+lerp(long double __a, long double __b, long double __t) _NOEXCEPT { return __lerp(__a, __b, __t); }
+
+#endif // _LIBCPP_STD_VER > 17
+
 _LIBCPP_END_NAMESPACE_STD
 
 #endif  // _LIBCPP_CMATH
diff --git a/linux-x64/clang/include/c++/v1/complex b/linux-x64/clang/include/c++/v1/complex
index ff702b4..c168406 100644
--- a/linux-x64/clang/include/c++/v1/complex
+++ b/linux-x64/clang/include/c++/v1/complex
@@ -1449,10 +1449,10 @@
     return __os << __s.str();
 }
 
-#if _LIBCPP_STD_VER > 11 
+#if _LIBCPP_STD_VER > 11
 // Literal suffix for complex number literals [complex.literals]
 inline namespace literals
-{ 
+{
   inline namespace complex_literals
   {
     constexpr complex<long double> operator""il(long double __im)
diff --git a/linux-x64/clang/include/c++/v1/cxxabi.h b/linux-x64/clang/include/c++/v1/cxxabi.h
index 2c2d073..c1271fd 100644
--- a/linux-x64/clang/include/c++/v1/cxxabi.h
+++ b/linux-x64/clang/include/c++/v1/cxxabi.h
@@ -77,7 +77,7 @@
 extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_deleted_virtual(void);
 
 // 3.3.2 One-time Construction API
-#ifdef __arm__
+#if defined(_LIBCXXABI_GUARD_ABI_ARM)
 extern _LIBCXXABI_FUNC_VIS int __cxa_guard_acquire(uint32_t *);
 extern _LIBCXXABI_FUNC_VIS void __cxa_guard_release(uint32_t *);
 extern _LIBCXXABI_FUNC_VIS void __cxa_guard_abort(uint32_t *);
diff --git a/linux-x64/clang/include/c++/v1/deque b/linux-x64/clang/include/c++/v1/deque
index 60a1130..d3ccf2e 100644
--- a/linux-x64/clang/include/c++/v1/deque
+++ b/linux-x64/clang/include/c++/v1/deque
@@ -1330,21 +1330,21 @@
 
     // element access:
     _LIBCPP_INLINE_VISIBILITY
-    reference operator[](size_type __i);
+    reference operator[](size_type __i) _NOEXCEPT;
     _LIBCPP_INLINE_VISIBILITY
-    const_reference operator[](size_type __i) const;
+    const_reference operator[](size_type __i) const _NOEXCEPT;
     _LIBCPP_INLINE_VISIBILITY
     reference at(size_type __i);
     _LIBCPP_INLINE_VISIBILITY
     const_reference at(size_type __i) const;
     _LIBCPP_INLINE_VISIBILITY
-    reference front();
+    reference front() _NOEXCEPT;
     _LIBCPP_INLINE_VISIBILITY
-    const_reference front() const;
+    const_reference front() const _NOEXCEPT;
     _LIBCPP_INLINE_VISIBILITY
-    reference back();
+    reference back() _NOEXCEPT;
     _LIBCPP_INLINE_VISIBILITY
-    const_reference back() const;
+    const_reference back() const _NOEXCEPT;
 
     // 23.2.2.3 modifiers:
     void push_front(const value_type& __v);
@@ -1745,7 +1745,7 @@
 template <class _Tp, class _Allocator>
 inline
 typename deque<_Tp, _Allocator>::reference
-deque<_Tp, _Allocator>::operator[](size_type __i)
+deque<_Tp, _Allocator>::operator[](size_type __i) _NOEXCEPT
 {
     size_type __p = __base::__start_ + __i;
     return *(*(__base::__map_.begin() + __p / __base::__block_size) + __p % __base::__block_size);
@@ -1754,7 +1754,7 @@
 template <class _Tp, class _Allocator>
 inline
 typename deque<_Tp, _Allocator>::const_reference
-deque<_Tp, _Allocator>::operator[](size_type __i) const
+deque<_Tp, _Allocator>::operator[](size_type __i) const _NOEXCEPT
 {
     size_type __p = __base::__start_ + __i;
     return *(*(__base::__map_.begin() + __p / __base::__block_size) + __p % __base::__block_size);
@@ -1785,7 +1785,7 @@
 template <class _Tp, class _Allocator>
 inline
 typename deque<_Tp, _Allocator>::reference
-deque<_Tp, _Allocator>::front()
+deque<_Tp, _Allocator>::front() _NOEXCEPT
 {
     return *(*(__base::__map_.begin() + __base::__start_ / __base::__block_size)
                                       + __base::__start_ % __base::__block_size);
@@ -1794,7 +1794,7 @@
 template <class _Tp, class _Allocator>
 inline
 typename deque<_Tp, _Allocator>::const_reference
-deque<_Tp, _Allocator>::front() const
+deque<_Tp, _Allocator>::front() const _NOEXCEPT
 {
     return *(*(__base::__map_.begin() + __base::__start_ / __base::__block_size)
                                       + __base::__start_ % __base::__block_size);
@@ -1803,7 +1803,7 @@
 template <class _Tp, class _Allocator>
 inline
 typename deque<_Tp, _Allocator>::reference
-deque<_Tp, _Allocator>::back()
+deque<_Tp, _Allocator>::back() _NOEXCEPT
 {
     size_type __p = __base::size() + __base::__start_ - 1;
     return *(*(__base::__map_.begin() + __p / __base::__block_size) + __p % __base::__block_size);
@@ -1812,7 +1812,7 @@
 template <class _Tp, class _Allocator>
 inline
 typename deque<_Tp, _Allocator>::const_reference
-deque<_Tp, _Allocator>::back() const
+deque<_Tp, _Allocator>::back() const _NOEXCEPT
 {
     size_type __p = __base::size() + __base::__start_ - 1;
     return *(*(__base::__map_.begin() + __p / __base::__block_size) + __p % __base::__block_size);
diff --git a/linux-x64/clang/include/c++/v1/exception b/linux-x64/clang/include/c++/v1/exception
index 63d8ad2..c7dcac2 100644
--- a/linux-x64/clang/include/c++/v1/exception
+++ b/linux-x64/clang/include/c++/v1/exception
@@ -82,7 +82,7 @@
 #include <type_traits>
 #include <version>
 
-#if defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_NO_VCRUNTIME)
+#if defined(_LIBCPP_ABI_VCRUNTIME)
 #include <vcruntime_exception.h>
 #endif
 
@@ -93,7 +93,7 @@
 namespace std  // purposefully not using versioning namespace
 {
 
-#if !defined(_LIBCPP_ABI_MICROSOFT) || defined(_LIBCPP_NO_VCRUNTIME)
+#if !defined(_LIBCPP_ABI_VCRUNTIME)
 class _LIBCPP_EXCEPTION_ABI exception
 {
 public:
@@ -110,7 +110,7 @@
     virtual ~bad_exception() _NOEXCEPT;
     virtual const char* what() const _NOEXCEPT;
 };
-#endif // !_LIBCPP_ABI_MICROSOFT || _LIBCPP_NO_VCRUNTIME
+#endif // !_LIBCPP_ABI_VCRUNTIME
 
 #if _LIBCPP_STD_VER <= 14 \
     || defined(_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS) \
@@ -260,11 +260,7 @@
 template <class _Tp, class _Up>
 struct __throw_with_nested<_Tp, _Up, true> {
     _LIBCPP_NORETURN static inline _LIBCPP_INLINE_VISIBILITY void
-#ifndef _LIBCPP_CXX03_LANG
     __do_throw(_Tp&& __t)
-#else
-    __do_throw (_Tp& __t)
-#endif  // _LIBCPP_CXX03_LANG
     {
         throw __nested<_Up>(_VSTD::forward<_Tp>(__t));
     }
@@ -287,11 +283,7 @@
 template <class _Tp>
 _LIBCPP_NORETURN
 void
-#ifndef _LIBCPP_CXX03_LANG
 throw_with_nested(_Tp&& __t)
-#else
-throw_with_nested (_Tp& __t)
-#endif // _LIBCPP_CXX03_LANG
 {
 #ifndef _LIBCPP_NO_EXCEPTIONS
     typedef typename decay<_Tp>::type _Up;
diff --git a/linux-x64/clang/include/c++/v1/experimental/__config b/linux-x64/clang/include/c++/v1/experimental/__config
index d3667b5..375dc37 100644
--- a/linux-x64/clang/include/c++/v1/experimental/__config
+++ b/linux-x64/clang/include/c++/v1/experimental/__config
@@ -36,8 +36,14 @@
   namespace chrono { namespace experimental { inline namespace fundamentals_v1 {
 #define _LIBCPP_END_NAMESPACE_CHRONO_LFTS _LIBCPP_END_NAMESPACE_STD } } }
 
+#if defined(_LIBCPP_NO_EXPERIMENTAL_DEPRECATION_WARNING_FILESYSTEM)
+#   define _LIBCPP_DEPRECATED_EXPERIMENTAL_FILESYSTEM /* nothing */
+#else
+#   define _LIBCPP_DEPRECATED_EXPERIMENTAL_FILESYSTEM __attribute__((deprecated("std::experimental::filesystem has now been deprecated in favor of C++17's std::filesystem. Please stop using it and start using std::filesystem. This experimental version will be removed in LLVM 11. You can remove this warning by defining the _LIBCPP_NO_EXPERIMENTAL_DEPRECATION_WARNING_FILESYSTEM macro.")))
+#endif
+
 #define _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL_FILESYSTEM \
-    _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL namespace filesystem { \
+    _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL namespace filesystem _LIBCPP_DEPRECATED_EXPERIMENTAL_FILESYSTEM { \
     inline namespace v1 {
 
 #define _LIBCPP_END_NAMESPACE_EXPERIMENTAL_FILESYSTEM \
diff --git a/linux-x64/clang/include/c++/v1/experimental/any b/linux-x64/clang/include/c++/v1/experimental/any
deleted file mode 100644
index c8050e3..0000000
--- a/linux-x64/clang/include/c++/v1/experimental/any
+++ /dev/null
@@ -1,20 +0,0 @@
-// -*- C++ -*-
-//===------------------------------- any ----------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-#ifndef _LIBCPP_EXPERIMENTAL_ANY
-#define _LIBCPP_EXPERIMENTAL_ANY
-
-#include <__config>
-
-#ifdef _LIBCPP_WARNING
-_LIBCPP_WARNING("<experimental/any> has been removed. Use <any> instead.")
-#else
-# warning "<experimental/any> has been removed. Use <any> instead."
-#endif
-
-#endif // _LIBCPP_EXPERIMENTAL_ANY
diff --git a/linux-x64/clang/include/c++/v1/experimental/chrono b/linux-x64/clang/include/c++/v1/experimental/chrono
deleted file mode 100644
index f3ceaae..0000000
--- a/linux-x64/clang/include/c++/v1/experimental/chrono
+++ /dev/null
@@ -1,20 +0,0 @@
-// -*- C++ -*-
-//===---------------------------- chrono ----------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-#ifndef _LIBCPP_EXPERIMENTAL_CHRONO
-#define _LIBCPP_EXPERIMENTAL_CHRONO
-
-#include <__config>
-
-#ifdef _LIBCPP_WARNING
-_LIBCPP_WARNING("<experimental/chrono> has been removed. Use <chrono> instead.")
-#else
-# warning "<experimental/chrono> has been removed. Use <chrono> instead."
-#endif
-
-#endif // _LIBCPP_EXPERIMENTAL_CHRONO
diff --git a/linux-x64/clang/include/c++/v1/experimental/coroutine b/linux-x64/clang/include/c++/v1/experimental/coroutine
index 13e3262..e2f0a25 100644
--- a/linux-x64/clang/include/c++/v1/experimental/coroutine
+++ b/linux-x64/clang/include/c++/v1/experimental/coroutine
@@ -81,7 +81,7 @@
 };
 
 template <typename _Ret, typename... _Args>
-struct _LIBCPP_TEMPLATE_VIS coroutine_traits
+struct coroutine_traits
     : public __coroutine_traits_sfinae<_Ret>
 {
 };
@@ -298,7 +298,7 @@
 }
 #endif // __has_builtin(__builtin_coro_noop)
 
-struct _LIBCPP_TYPE_VIS suspend_never {
+struct suspend_never {
   _LIBCPP_INLINE_VISIBILITY
   bool await_ready() const _NOEXCEPT { return true; }
   _LIBCPP_INLINE_VISIBILITY
@@ -307,7 +307,7 @@
   void await_resume() const _NOEXCEPT {}
 };
 
-struct _LIBCPP_TYPE_VIS suspend_always {
+struct suspend_always {
   _LIBCPP_INLINE_VISIBILITY
   bool await_ready() const _NOEXCEPT { return false; }
   _LIBCPP_INLINE_VISIBILITY
diff --git a/linux-x64/clang/include/c++/v1/experimental/functional b/linux-x64/clang/include/c++/v1/experimental/functional
index 8c55f4f..755eda6 100644
--- a/linux-x64/clang/include/c++/v1/experimental/functional
+++ b/linux-x64/clang/include/c++/v1/experimental/functional
@@ -109,8 +109,7 @@
 #if _LIBCPP_STD_VER > 11
 // default searcher
 template<class _ForwardIterator, class _BinaryPredicate = equal_to<>>
-_LIBCPP_TYPE_VIS
-class default_searcher {
+class _LIBCPP_TYPE_VIS default_searcher {
 public:
     _LIBCPP_INLINE_VISIBILITY
     default_searcher(_ForwardIterator __f, _ForwardIterator __l, 
@@ -208,8 +207,7 @@
 template <class _RandomAccessIterator1, 
           class _Hash = hash<typename iterator_traits<_RandomAccessIterator1>::value_type>, 
           class _BinaryPredicate = equal_to<>>
-_LIBCPP_TYPE_VIS
-class boyer_moore_searcher {
+class _LIBCPP_TYPE_VIS boyer_moore_searcher {
 private:
     typedef typename std::iterator_traits<_RandomAccessIterator1>::difference_type difference_type;
     typedef typename std::iterator_traits<_RandomAccessIterator1>::value_type      value_type;
@@ -360,8 +358,7 @@
 template <class _RandomAccessIterator1, 
           class _Hash = hash<typename iterator_traits<_RandomAccessIterator1>::value_type>, 
           class _BinaryPredicate = equal_to<>>
-_LIBCPP_TYPE_VIS
-class boyer_moore_horspool_searcher {
+class _LIBCPP_TYPE_VIS boyer_moore_horspool_searcher {
 private:
     typedef typename std::iterator_traits<_RandomAccessIterator1>::difference_type difference_type;
     typedef typename std::iterator_traits<_RandomAccessIterator1>::value_type      value_type;
diff --git a/linux-x64/clang/include/c++/v1/experimental/numeric b/linux-x64/clang/include/c++/v1/experimental/numeric
deleted file mode 100644
index 4ea1306..0000000
--- a/linux-x64/clang/include/c++/v1/experimental/numeric
+++ /dev/null
@@ -1,20 +0,0 @@
-// -*- C++ -*-
-//===--------------------------- numeric ----------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-#ifndef _LIBCPP_EXPERIMENTAL_NUMERIC
-#define _LIBCPP_EXPERIMENTAL_NUMERIC
-
-#include <__config>
-
-#ifdef _LIBCPP_WARNING
-_LIBCPP_WARNING("<experimental/numeric> has been removed. Use <numeric> instead.")
-#else
-# warning "<experimental/numeric> has been removed. Use <numeric> instead."
-#endif
-
-#endif // _LIBCPP_EXPERIMENTAL_NUMERIC
diff --git a/linux-x64/clang/include/c++/v1/experimental/optional b/linux-x64/clang/include/c++/v1/experimental/optional
deleted file mode 100644
index 1749cd6..0000000
--- a/linux-x64/clang/include/c++/v1/experimental/optional
+++ /dev/null
@@ -1,20 +0,0 @@
-// -*- C++ -*-
-//===-------------------------- optional ----------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-#ifndef _LIBCPP_EXPERIMENTAL_OPTIONAL
-#define _LIBCPP_EXPERIMENTAL_OPTIONAL
-
-#include <__config>
-
-#ifdef _LIBCPP_WARNING
-_LIBCPP_WARNING("<experimental/optional> has been removed. Use <optional> instead.")
-#else
-# warning "<experimental/optional> has been removed. Use <optional> instead."
-#endif
-
-#endif // _LIBCPP_EXPERIMENTAL_OPTIONAL
diff --git a/linux-x64/clang/include/c++/v1/experimental/ratio b/linux-x64/clang/include/c++/v1/experimental/ratio
deleted file mode 100644
index 4cd4fa0..0000000
--- a/linux-x64/clang/include/c++/v1/experimental/ratio
+++ /dev/null
@@ -1,20 +0,0 @@
-// -*- C++ -*-
-//===----------------------------- ratio ----------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-#ifndef _LIBCPP_EXPERIMENTAL_RATIO
-#define _LIBCPP_EXPERIMENTAL_RATIO
-
-#include <__config>
-
-#ifdef _LIBCPP_WARNING
-_LIBCPP_WARNING("<experimental/ratio> has been removed. Use <ratio> instead.")
-#else
-# warning "<experimental/ratio> has been removed. Use <ratio> instead."
-#endif
-
-#endif // _LIBCPP_EXPERIMENTAL_RATIO
diff --git a/linux-x64/clang/include/c++/v1/experimental/string_view b/linux-x64/clang/include/c++/v1/experimental/string_view
deleted file mode 100644
index 4b59e6d..0000000
--- a/linux-x64/clang/include/c++/v1/experimental/string_view
+++ /dev/null
@@ -1,20 +0,0 @@
-// -*- C++ -*-
-//===------------------------ string_view ---------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-#ifndef _LIBCPP_EXPERIMENTAL_STRING_VIEW
-#define _LIBCPP_EXPERIMENTAL_STRING_VIEW
-
-#include <__config>
-
-#ifdef _LIBCPP_WARNING
-_LIBCPP_WARNING("<experimental/string_view> has been removed. Use <string_view> instead.")
-#else
-# warning "<experimental/string_view> has been removed. Use <string_view> instead."
-#endif
-
-#endif // _LIBCPP_EXPERIMENTAL_STRING_VIEW
diff --git a/linux-x64/clang/include/c++/v1/experimental/system_error b/linux-x64/clang/include/c++/v1/experimental/system_error
deleted file mode 100644
index 094e6d3..0000000
--- a/linux-x64/clang/include/c++/v1/experimental/system_error
+++ /dev/null
@@ -1,20 +0,0 @@
-// -*- C++ -*-
-//===-------------------------- system_error ------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-#ifndef _LIBCPP_EXPERIMENTAL_SYSTEM_ERROR
-#define _LIBCPP_EXPERIMENTAL_SYSTEM_ERROR
-
-#include <__config>
-
-#ifdef _LIBCPP_WARNING
-_LIBCPP_WARNING("<experimental/system_error> has been removed. Use <system_error> instead.")
-#else
-# warning "<experimental/system_error> has been removed. Use <system_error> instead."
-#endif
-
-#endif // _LIBCPP_EXPERIMENTAL_SYSTEM_ERROR
diff --git a/linux-x64/clang/include/c++/v1/experimental/tuple b/linux-x64/clang/include/c++/v1/experimental/tuple
deleted file mode 100644
index 827ef37..0000000
--- a/linux-x64/clang/include/c++/v1/experimental/tuple
+++ /dev/null
@@ -1,20 +0,0 @@
-// -*- C++ -*-
-//===----------------------------- tuple ----------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-#ifndef _LIBCPP_EXPERIMENTAL_TUPLE
-#define _LIBCPP_EXPERIMENTAL_TUPLE
-
-#include <__config>
-
-#ifdef _LIBCPP_WARNING
-_LIBCPP_WARNING("<experimental/tuple> has been removed. Use <tuple> instead.")
-#else
-# warning "<experimental/tuple> has been removed. Use <tuple> instead."
-#endif
-
-#endif // _LIBCPP_EXPERIMENTAL_TUPLE
diff --git a/linux-x64/clang/include/c++/v1/experimental/type_traits b/linux-x64/clang/include/c++/v1/experimental/type_traits
index 3127c0e..19466e9 100644
--- a/linux-x64/clang/include/c++/v1/experimental/type_traits
+++ b/linux-x64/clang/include/c++/v1/experimental/type_traits
@@ -72,6 +72,7 @@
 
 #if _LIBCPP_STD_VER > 11
 
+#include <initializer_list>
 #include <type_traits>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -104,11 +105,10 @@
 // 3.3.4, Detection idiom
 template <class...> using void_t = void;
 
-struct nonesuch {
-    nonesuch()  = delete;
-    ~nonesuch() = delete;
-    nonesuch      (nonesuch const&) = delete;
-    void operator=(nonesuch const&) = delete;
+struct nonesuch : private _VSTD::__nat { // make nonesuch "not an aggregate"
+  ~nonesuch() = delete;
+  nonesuch      (nonesuch const&) = delete;
+  void operator=(nonesuch const&) = delete;
   };
 
 template <class _Default, class _AlwaysVoid, template <class...> class _Op, class... _Args>
diff --git a/linux-x64/clang/include/c++/v1/ext/__hash b/linux-x64/clang/include/c++/v1/ext/__hash
index 98a9544..d03f101 100644
--- a/linux-x64/clang/include/c++/v1/ext/__hash
+++ b/linux-x64/clang/include/c++/v1/ext/__hash
@@ -16,32 +16,31 @@
 #include <cstring>
 
 namespace __gnu_cxx {
-using namespace std;
 
 template <typename _Tp> struct _LIBCPP_TEMPLATE_VIS hash { };
 
 template <> struct _LIBCPP_TEMPLATE_VIS hash<const char*>
-    : public unary_function<const char*, size_t>
+ : public std::unary_function<const char*, size_t>
 {
     _LIBCPP_INLINE_VISIBILITY
     size_t operator()(const char *__c) const _NOEXCEPT
     {
-        return __do_string_hash(__c, __c + strlen(__c));
+        return std::__do_string_hash(__c, __c + strlen(__c));
     }
 };
 
 template <> struct _LIBCPP_TEMPLATE_VIS hash<char *>
-    : public unary_function<char*, size_t>
+ : public std::unary_function<char*, size_t>
 {
     _LIBCPP_INLINE_VISIBILITY
     size_t operator()(char *__c) const _NOEXCEPT
     {
-        return __do_string_hash<const char *>(__c, __c + strlen(__c));
+        return std::__do_string_hash<const char *>(__c, __c + strlen(__c));
     }
 };
 
 template <> struct _LIBCPP_TEMPLATE_VIS hash<char>
-    : public unary_function<char, size_t>
+ : public std::unary_function<char, size_t>
 {
     _LIBCPP_INLINE_VISIBILITY
     size_t operator()(char __c) const _NOEXCEPT
@@ -51,7 +50,7 @@
 };
 
 template <> struct _LIBCPP_TEMPLATE_VIS hash<signed char>
-    : public unary_function<signed char, size_t>
+ : public std::unary_function<signed char, size_t>
 {
     _LIBCPP_INLINE_VISIBILITY
     size_t operator()(signed char __c) const _NOEXCEPT
@@ -61,7 +60,7 @@
 };
 
 template <> struct _LIBCPP_TEMPLATE_VIS hash<unsigned char>
-    : public unary_function<unsigned char, size_t>
+ : public std::unary_function<unsigned char, size_t>
 {
     _LIBCPP_INLINE_VISIBILITY
     size_t operator()(unsigned char __c) const _NOEXCEPT
@@ -71,7 +70,7 @@
 };
 
 template <> struct _LIBCPP_TEMPLATE_VIS hash<short>
-    : public unary_function<short, size_t>
+ : public std::unary_function<short, size_t>
 {
     _LIBCPP_INLINE_VISIBILITY
     size_t operator()(short __c) const _NOEXCEPT
@@ -81,7 +80,7 @@
 };
 
 template <> struct _LIBCPP_TEMPLATE_VIS hash<unsigned short>
-    : public unary_function<unsigned short, size_t>
+ : public std::unary_function<unsigned short, size_t>
 {
     _LIBCPP_INLINE_VISIBILITY
     size_t operator()(unsigned short __c) const _NOEXCEPT
@@ -91,7 +90,7 @@
 };
 
 template <> struct _LIBCPP_TEMPLATE_VIS hash<int>
-    : public unary_function<int, size_t>
+    : public std::unary_function<int, size_t>
 {
     _LIBCPP_INLINE_VISIBILITY
     size_t operator()(int __c) const _NOEXCEPT
@@ -101,7 +100,7 @@
 };
 
 template <> struct _LIBCPP_TEMPLATE_VIS hash<unsigned int>
-    : public unary_function<unsigned int, size_t>
+    : public std::unary_function<unsigned int, size_t>
 {
     _LIBCPP_INLINE_VISIBILITY
     size_t operator()(unsigned int __c) const _NOEXCEPT
@@ -111,7 +110,7 @@
 };
 
 template <> struct _LIBCPP_TEMPLATE_VIS hash<long>
-    : public unary_function<long, size_t>
+    : public std::unary_function<long, size_t>
 {
     _LIBCPP_INLINE_VISIBILITY
     size_t operator()(long __c) const _NOEXCEPT
@@ -121,7 +120,7 @@
 };
 
 template <> struct _LIBCPP_TEMPLATE_VIS hash<unsigned long>
-    : public unary_function<unsigned long, size_t>
+    : public std::unary_function<unsigned long, size_t>
 {
     _LIBCPP_INLINE_VISIBILITY
     size_t operator()(unsigned long __c) const _NOEXCEPT
diff --git a/linux-x64/clang/include/c++/v1/ext/hash_map b/linux-x64/clang/include/c++/v1/ext/hash_map
index d06a9e3..24823c6 100644
--- a/linux-x64/clang/include/c++/v1/ext/hash_map
+++ b/linux-x64/clang/include/c++/v1/ext/hash_map
@@ -219,10 +219,8 @@
 
 namespace __gnu_cxx {
 
-using namespace std;
-
 template <class _Tp, class _Hash,
-          bool = is_empty<_Hash>::value && !__libcpp_is_final<_Hash>::value
+          bool = std::is_empty<_Hash>::value && !std::__libcpp_is_final<_Hash>::value
         >
 class __hash_map_hasher
     : private _Hash
@@ -256,7 +254,7 @@
 };
 
 template <class _Tp, class _Pred,
-          bool = is_empty<_Pred>::value && !__libcpp_is_final<_Pred>::value
+          bool = std::is_empty<_Pred>::value && !std::__libcpp_is_final<_Pred>::value
          >
 class __hash_map_equal
     : private _Pred
@@ -307,7 +305,7 @@
 class __hash_map_node_destructor
 {
     typedef _Alloc                              allocator_type;
-    typedef allocator_traits<allocator_type>    __alloc_traits;
+    typedef std::allocator_traits<allocator_type>    __alloc_traits;
     typedef typename __alloc_traits::value_type::__node_value_type value_type;
 public:
     typedef typename __alloc_traits::pointer    pointer;
@@ -332,7 +330,7 @@
 
 #ifndef _LIBCPP_CXX03_LANG
     _LIBCPP_INLINE_VISIBILITY
-    __hash_map_node_destructor(__hash_node_destructor<allocator_type>&& __x)
+    __hash_map_node_destructor(std::__hash_node_destructor<allocator_type>&& __x)
         : __na_(__x.__na_),
           __first_constructed(__x.__value_constructed),
           __second_constructed(__x.__value_constructed)
@@ -341,7 +339,7 @@
         }
 #else  // _LIBCPP_CXX03_LANG
     _LIBCPP_INLINE_VISIBILITY
-    __hash_map_node_destructor(const __hash_node_destructor<allocator_type>& __x)
+    __hash_map_node_destructor(const std::__hash_node_destructor<allocator_type>& __x)
         : __na_(__x.__na_),
           __first_constructed(__x.__value_constructed),
           __second_constructed(__x.__value_constructed)
@@ -370,11 +368,11 @@
     typedef const typename _HashIterator::value_type::first_type key_type;
     typedef typename _HashIterator::value_type::second_type      mapped_type;
 public:
-    typedef forward_iterator_tag                                 iterator_category;
-    typedef pair<key_type, mapped_type>                          value_type;
+    typedef std::forward_iterator_tag                            iterator_category;
+    typedef std::pair<key_type, mapped_type>                     value_type;
     typedef typename _HashIterator::difference_type              difference_type;
     typedef value_type&                                          reference;
-    typedef typename __rebind_pointer<typename _HashIterator::pointer, value_type>::type
+    typedef typename std::__rebind_pointer<typename _HashIterator::pointer, value_type>::type
         pointer;
 
     _LIBCPP_INLINE_VISIBILITY __hash_map_iterator() {}
@@ -415,11 +413,11 @@
     typedef const typename _HashIterator::value_type::first_type key_type;
     typedef typename _HashIterator::value_type::second_type      mapped_type;
 public:
-    typedef forward_iterator_tag                                 iterator_category;
-    typedef pair<key_type, mapped_type>                          value_type;
+    typedef std::forward_iterator_tag                            iterator_category;
+    typedef std::pair<key_type, mapped_type>                     value_type;
     typedef typename _HashIterator::difference_type              difference_type;
     typedef const value_type&                                    reference;
-    typedef typename __rebind_pointer<typename _HashIterator::pointer, const value_type>::type
+    typedef typename std::__rebind_pointer<typename _HashIterator::pointer, const value_type>::type
         pointer;
 
     _LIBCPP_INLINE_VISIBILITY __hash_map_const_iterator() {}
@@ -459,8 +457,8 @@
     template <class> friend class _LIBCPP_TEMPLATE_VIS __hash_const_local_iterator;
 };
 
-template <class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = equal_to<_Key>,
-          class _Alloc = allocator<pair<const _Key, _Tp> > >
+template <class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = std::equal_to<_Key>,
+          class _Alloc = std::allocator<std::pair<const _Key, _Tp> > >
 class _LIBCPP_TEMPLATE_VIS hash_map
 {
 public:
@@ -471,17 +469,18 @@
     typedef _Hash                                          hasher;
     typedef _Pred                                          key_equal;
     typedef _Alloc                                         allocator_type;
-    typedef pair<const key_type, mapped_type>              value_type;
+    typedef std::pair<const key_type, mapped_type>         value_type;
     typedef value_type&                                    reference;
     typedef const value_type&                              const_reference;
 
 private:
-    typedef pair<key_type, mapped_type>                    __value_type;
+    typedef std::pair<key_type, mapped_type>                    __value_type;
     typedef __hash_map_hasher<__value_type, hasher>   __hasher;
     typedef __hash_map_equal<__value_type, key_equal> __key_equal;
-    typedef typename __rebind_alloc_helper<allocator_traits<allocator_type>, __value_type>::type __allocator_type;
+    typedef typename std::__rebind_alloc_helper<
+        std::allocator_traits<allocator_type>, __value_type>::type __allocator_type;
 
-    typedef __hash_table<__value_type, __hasher,
+    typedef std::__hash_table<__value_type, __hasher,
                          __key_equal,  __allocator_type>   __table;
 
     __table __table_;
@@ -492,8 +491,8 @@
     typedef typename __table::__node_allocator             __node_allocator;
     typedef typename __table::__node                       __node;
     typedef __hash_map_node_destructor<__node_allocator>   _Dp;
-    typedef unique_ptr<__node, _Dp>                         __node_holder;
-    typedef allocator_traits<allocator_type>               __alloc_traits;
+    typedef std::unique_ptr<__node, _Dp>                   __node_holder;
+    typedef std::allocator_traits<allocator_type>          __alloc_traits;
 public:
     typedef typename __alloc_traits::pointer         pointer;
     typedef typename __alloc_traits::const_pointer   const_pointer;
@@ -543,7 +542,7 @@
     const_iterator end()    const {return __table_.end();}
 
     _LIBCPP_INLINE_VISIBILITY
-    pair<iterator, bool> insert(const value_type& __x)
+    std::pair<iterator, bool> insert(const value_type& __x)
         {return __table_.__insert_unique(__x);}
     _LIBCPP_INLINE_VISIBILITY
     iterator insert(const_iterator, const value_type& __x) {return insert(__x).first;}
@@ -578,10 +577,10 @@
     _LIBCPP_INLINE_VISIBILITY
     size_type count(const key_type& __k) const {return __table_.__count_unique(__k);}
     _LIBCPP_INLINE_VISIBILITY
-    pair<iterator, iterator>             equal_range(const key_type& __k)
+    std::pair<iterator, iterator>             equal_range(const key_type& __k)
         {return __table_.__equal_range_unique(__k);}
     _LIBCPP_INLINE_VISIBILITY
-    pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
+    std::pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
         {return __table_.__equal_range_unique(__k);}
 
     mapped_type& operator[](const key_type& __k);
@@ -691,7 +690,7 @@
     if (__i != end())
         return __i->second;
     __node_holder __h = __construct_node(__k);
-    pair<iterator, bool> __r = __table_.__node_insert_unique(__h.get());
+    std::pair<iterator, bool> __r = __table_.__node_insert_unique(__h.get());
     __h.release();
     return __r.first->second;
 }
@@ -733,8 +732,8 @@
     return !(__x == __y);
 }
 
-template <class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = equal_to<_Key>,
-          class _Alloc = allocator<pair<const _Key, _Tp> > >
+template <class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = std::equal_to<_Key>,
+          class _Alloc = std::allocator<std::pair<const _Key, _Tp> > >
 class _LIBCPP_TEMPLATE_VIS hash_multimap
 {
 public:
@@ -745,17 +744,17 @@
     typedef _Hash                                          hasher;
     typedef _Pred                                          key_equal;
     typedef _Alloc                                         allocator_type;
-    typedef pair<const key_type, mapped_type>              value_type;
+    typedef std::pair<const key_type, mapped_type>         value_type;
     typedef value_type&                                    reference;
     typedef const value_type&                              const_reference;
 
 private:
-    typedef pair<key_type, mapped_type>                    __value_type;
+    typedef std::pair<key_type, mapped_type>               __value_type;
     typedef __hash_map_hasher<__value_type, hasher>   __hasher;
     typedef __hash_map_equal<__value_type, key_equal> __key_equal;
-    typedef typename __rebind_alloc_helper<allocator_traits<allocator_type>, __value_type>::type __allocator_type;
+    typedef typename std::__rebind_alloc_helper<std::allocator_traits<allocator_type>, __value_type>::type __allocator_type;
 
-    typedef __hash_table<__value_type, __hasher,
+    typedef std::__hash_table<__value_type, __hasher,
                          __key_equal,  __allocator_type>   __table;
 
     __table __table_;
@@ -764,8 +763,8 @@
     typedef typename __table::__node_allocator             __node_allocator;
     typedef typename __table::__node                       __node;
     typedef __hash_map_node_destructor<__node_allocator>   _Dp;
-    typedef unique_ptr<__node, _Dp>                         __node_holder;
-    typedef allocator_traits<allocator_type>               __alloc_traits;
+    typedef std::unique_ptr<__node, _Dp>                         __node_holder;
+    typedef std::allocator_traits<allocator_type>               __alloc_traits;
 public:
     typedef typename __alloc_traits::pointer         pointer;
     typedef typename __alloc_traits::const_pointer   const_pointer;
@@ -850,10 +849,10 @@
     _LIBCPP_INLINE_VISIBILITY
     size_type count(const key_type& __k) const {return __table_.__count_multi(__k);}
     _LIBCPP_INLINE_VISIBILITY
-    pair<iterator, iterator>             equal_range(const key_type& __k)
+    std::pair<iterator, iterator>             equal_range(const key_type& __k)
         {return __table_.__equal_range_multi(__k);}
     _LIBCPP_INLINE_VISIBILITY
-    pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
+    std::pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
         {return __table_.__equal_range_multi(__k);}
 
     _LIBCPP_INLINE_VISIBILITY
@@ -955,7 +954,7 @@
         return false;
     typedef typename hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::const_iterator
                                                                  const_iterator;
-    typedef pair<const_iterator, const_iterator> _EqRng;
+    typedef std::pair<const_iterator, const_iterator> _EqRng;
     for (const_iterator __i = __x.begin(), __ex = __x.end(); __i != __ex;)
     {
         _EqRng __xeq = __x.equal_range(__i->first);
diff --git a/linux-x64/clang/include/c++/v1/ext/hash_set b/linux-x64/clang/include/c++/v1/ext/hash_set
index 21e6687..e514182 100644
--- a/linux-x64/clang/include/c++/v1/ext/hash_set
+++ b/linux-x64/clang/include/c++/v1/ext/hash_set
@@ -207,10 +207,9 @@
 
 namespace __gnu_cxx {
 
-using namespace std;
 
-template <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>,
-          class _Alloc = allocator<_Value> >
+template <class _Value, class _Hash = hash<_Value>, class _Pred = std::equal_to<_Value>,
+          class _Alloc = std::allocator<_Value> >
 class _LIBCPP_TEMPLATE_VIS hash_set
 {
 public:
@@ -224,7 +223,7 @@
     typedef const value_type&                                          const_reference;
 
 private:
-    typedef __hash_table<value_type, hasher, key_equal, allocator_type> __table;
+    typedef std::__hash_table<value_type, hasher, key_equal, allocator_type> __table;
 
     __table __table_;
 
@@ -276,7 +275,7 @@
     const_iterator end()    const {return __table_.end();}
 
     _LIBCPP_INLINE_VISIBILITY
-    pair<iterator, bool> insert(const value_type& __x)
+    std::pair<iterator, bool> insert(const value_type& __x)
         {return __table_.__insert_unique(__x);}
     _LIBCPP_INLINE_VISIBILITY
     iterator insert(const_iterator, const value_type& __x) {return insert(__x).first;}
@@ -309,10 +308,10 @@
     _LIBCPP_INLINE_VISIBILITY
     size_type count(const key_type& __k) const {return __table_.__count_unique(__k);}
     _LIBCPP_INLINE_VISIBILITY
-    pair<iterator, iterator>             equal_range(const key_type& __k)
+    std::pair<iterator, iterator>             equal_range(const key_type& __k)
         {return __table_.__equal_range_unique(__k);}
     _LIBCPP_INLINE_VISIBILITY
-    pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
+    std::pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
         {return __table_.__equal_range_unique(__k);}
 
     _LIBCPP_INLINE_VISIBILITY
@@ -431,8 +430,8 @@
     return !(__x == __y);
 }
 
-template <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>,
-          class _Alloc = allocator<_Value> >
+template <class _Value, class _Hash = hash<_Value>, class _Pred = std::equal_to<_Value>,
+          class _Alloc = std::allocator<_Value> >
 class _LIBCPP_TEMPLATE_VIS hash_multiset
 {
 public:
@@ -446,7 +445,7 @@
     typedef const value_type&                                          const_reference;
 
 private:
-    typedef __hash_table<value_type, hasher, key_equal, allocator_type> __table;
+    typedef std::__hash_table<value_type, hasher, key_equal, allocator_type> __table;
 
     __table __table_;
 
@@ -530,10 +529,10 @@
     _LIBCPP_INLINE_VISIBILITY
     size_type count(const key_type& __k) const {return __table_.__count_multi(__k);}
     _LIBCPP_INLINE_VISIBILITY
-    pair<iterator, iterator>             equal_range(const key_type& __k)
+    std::pair<iterator, iterator>             equal_range(const key_type& __k)
         {return __table_.__equal_range_multi(__k);}
     _LIBCPP_INLINE_VISIBILITY
-    pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
+    std::pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
         {return __table_.__equal_range_multi(__k);}
 
     _LIBCPP_INLINE_VISIBILITY
@@ -610,7 +609,7 @@
 inline
 void
 hash_multiset<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
-                                                         _InputIterator __last)
+                                                    _InputIterator __last)
 {
     for (; __first != __last; ++__first)
         __table_.__insert_multi(*__first);
@@ -634,7 +633,7 @@
         return false;
     typedef typename hash_multiset<_Value, _Hash, _Pred, _Alloc>::const_iterator
                                                                  const_iterator;
-    typedef pair<const_iterator, const_iterator> _EqRng;
+    typedef std::pair<const_iterator, const_iterator> _EqRng;
     for (const_iterator __i = __x.begin(), __ex = __x.end(); __i != __ex;)
     {
         _EqRng __xeq = __x.equal_range(*__i);
diff --git a/linux-x64/clang/include/c++/v1/fenv.h b/linux-x64/clang/include/c++/v1/fenv.h
index 7cede4b..988cd9b 100644
--- a/linux-x64/clang/include/c++/v1/fenv.h
+++ b/linux-x64/clang/include/c++/v1/fenv.h
@@ -51,12 +51,13 @@
 */
 
 #include <__config>
-#include_next <fenv.h>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header
 #endif
 
+#include_next <fenv.h>
+
 #ifdef __cplusplus
 
 extern "C++" {
diff --git a/linux-x64/clang/include/c++/v1/filesystem b/linux-x64/clang/include/c++/v1/filesystem
index 7a151d9..3aaa798 100644
--- a/linux-x64/clang/include/c++/v1/filesystem
+++ b/linux-x64/clang/include/c++/v1/filesystem
@@ -258,6 +258,8 @@
 
 _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
 
+_LIBCPP_AVAILABILITY_FILESYSTEM_PUSH
+
 typedef chrono::time_point<_FilesystemClock> file_time_type;
 
 struct _LIBCPP_TYPE_VIS space_info {
@@ -1310,7 +1312,11 @@
   return !(__lhs == __rhs);
 }
 
-class _LIBCPP_EXCEPTION_ABI filesystem_error : public system_error {
+// TODO(ldionne): We need to pop the pragma and push it again after
+//                filesystem_error to work around PR41078.
+_LIBCPP_AVAILABILITY_FILESYSTEM_POP
+
+class _LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_EXCEPTION_ABI filesystem_error : public system_error {
 public:
   _LIBCPP_INLINE_VISIBILITY
   filesystem_error(const string& __what, error_code __ec)
@@ -1350,7 +1356,7 @@
   void __create_what(int __num_paths);
 
 private:
-  struct _Storage {
+  struct _LIBCPP_HIDDEN _Storage {
     _LIBCPP_INLINE_VISIBILITY
     _Storage(const path& __p1, const path& __p2) : __p1_(__p1), __p2_(__p2) {}
 
@@ -1361,6 +1367,8 @@
   shared_ptr<_Storage> __storage_;
 };
 
+_LIBCPP_AVAILABILITY_FILESYSTEM_PUSH
+
 template <class... _Args>
 _LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY
 #ifndef _LIBCPP_NO_EXCEPTIONS
@@ -1934,7 +1942,7 @@
 
 class directory_iterator;
 class recursive_directory_iterator;
-class __dir_stream;
+class _LIBCPP_HIDDEN __dir_stream;
 
 class directory_entry {
   typedef _VSTD_FS::path _Path;
@@ -2597,7 +2605,7 @@
   operator==(const recursive_directory_iterator&,
              const recursive_directory_iterator&) noexcept;
 
-  struct __shared_imp;
+  struct _LIBCPP_HIDDEN __shared_imp;
   shared_ptr<__shared_imp> __imp_;
   bool __rec_;
 }; // class recursive_directory_iterator
@@ -2624,6 +2632,8 @@
   return recursive_directory_iterator();
 }
 
+_LIBCPP_AVAILABILITY_FILESYSTEM_POP
+
 _LIBCPP_END_NAMESPACE_FILESYSTEM
 
 #endif // !_LIBCPP_CXX03_LANG
diff --git a/linux-x64/clang/include/c++/v1/forward_list b/linux-x64/clang/include/c++/v1/forward_list
index bbea71e..d59ddd4 100644
--- a/linux-x64/clang/include/c++/v1/forward_list
+++ b/linux-x64/clang/include/c++/v1/forward_list
@@ -120,10 +120,12 @@
                       const_iterator first, const_iterator last);
     void splice_after(const_iterator p, forward_list&& x,
                       const_iterator first, const_iterator last);
-    void remove(const value_type& v);
-    template <class Predicate> void remove_if(Predicate pred);
-    void unique();
-    template <class BinaryPredicate> void unique(BinaryPredicate binary_pred);
+    size_type remove(const value_type& v);           // void before C++20
+    template <class Predicate>
+      size_type remove_if(Predicate pred);           // void before C++20
+    size_type unique();                              // void before C++20
+    template <class BinaryPredicate>
+      size_type unique(BinaryPredicate binary_pred); // void before C++20
     void merge(forward_list& x);
     void merge(forward_list&& x);
     template <class Compare> void merge(forward_list& x, Compare comp);
@@ -530,7 +532,7 @@
 #if _LIBCPP_STD_VER >= 14
         _NOEXCEPT;
 #else
-        _NOEXCEPT_(!__node_traits::propagate_on_container_move_assignment::value || 
+        _NOEXCEPT_(!__node_traits::propagate_on_container_move_assignment::value ||
                     __is_nothrow_swappable<__node_allocator>::value);
 #endif
 protected:
@@ -595,11 +597,11 @@
 #if _LIBCPP_STD_VER >= 14
         _NOEXCEPT
 #else
-        _NOEXCEPT_(!__node_traits::propagate_on_container_move_assignment::value || 
+        _NOEXCEPT_(!__node_traits::propagate_on_container_move_assignment::value ||
                     __is_nothrow_swappable<__node_allocator>::value)
 #endif
 {
-    __swap_allocator(__alloc(), __x.__alloc(), 
+    __swap_allocator(__alloc(), __x.__alloc(),
             integral_constant<bool, __node_traits::propagate_on_container_swap::value>());
     using _VSTD::swap;
     swap(__before_begin()->__next_, __x.__before_begin()->__next_);
@@ -647,6 +649,11 @@
 
     typedef typename base::iterator       iterator;
     typedef typename base::const_iterator const_iterator;
+#if _LIBCPP_STD_VER > 17
+    typedef size_type                                __remove_return_type;
+#else
+    typedef void                                     __remove_return_type;
+#endif
 
     _LIBCPP_INLINE_VISIBILITY
     forward_list()
@@ -808,7 +815,6 @@
     _LIBCPP_INLINE_VISIBILITY
     void clear() _NOEXCEPT {base::clear();}
 
-#ifndef _LIBCPP_CXX03_LANG
     _LIBCPP_INLINE_VISIBILITY
     void splice_after(const_iterator __p, forward_list&& __x);
     _LIBCPP_INLINE_VISIBILITY
@@ -816,16 +822,15 @@
     _LIBCPP_INLINE_VISIBILITY
     void splice_after(const_iterator __p, forward_list&& __x,
                       const_iterator __f, const_iterator __l);
-#endif  // _LIBCPP_CXX03_LANG
     void splice_after(const_iterator __p, forward_list& __x);
     void splice_after(const_iterator __p, forward_list& __x, const_iterator __i);
     void splice_after(const_iterator __p, forward_list& __x,
                       const_iterator __f, const_iterator __l);
-    void remove(const value_type& __v);
-    template <class _Predicate> void remove_if(_Predicate __pred);
+    __remove_return_type remove(const value_type& __v);
+    template <class _Predicate> __remove_return_type remove_if(_Predicate __pred);
     _LIBCPP_INLINE_VISIBILITY
-    void unique() {unique(__equal_to<value_type>());}
-    template <class _BinaryPredicate> void unique(_BinaryPredicate __binary_pred);
+    __remove_return_type unique() {return unique(__equal_to<value_type>());}
+    template <class _BinaryPredicate> __remove_return_type unique(_BinaryPredicate __binary_pred);
 #ifndef _LIBCPP_CXX03_LANG
     _LIBCPP_INLINE_VISIBILITY
     void merge(forward_list&& __x) {merge(__x, __less<value_type>());}
@@ -1468,8 +1473,6 @@
     }
 }
 
-#ifndef _LIBCPP_CXX03_LANG
-
 template <class _Tp, class _Alloc>
 inline _LIBCPP_INLINE_VISIBILITY
 void
@@ -1499,21 +1502,21 @@
     splice_after(__p, __x, __f, __l);
 }
 
-#endif  // _LIBCPP_CXX03_LANG
-
 template <class _Tp, class _Alloc>
-void
+typename forward_list<_Tp, _Alloc>::__remove_return_type
 forward_list<_Tp, _Alloc>::remove(const value_type& __v)
 {
-    forward_list<_Tp, _Alloc> __deleted_nodes; // collect the nodes we're removing
-    iterator __e = end();
+    forward_list<_Tp, _Alloc> __deleted_nodes(get_allocator()); // collect the nodes we're removing
+    typename forward_list<_Tp, _Alloc>::size_type __count_removed = 0;
+    const iterator __e = end();
     for (iterator __i = before_begin(); __i.__get_begin()->__next_ != nullptr;)
     {
         if (__i.__get_begin()->__next_->__value_ == __v)
         {
+            ++__count_removed;
             iterator __j = _VSTD::next(__i, 2);
             for (; __j != __e && *__j == __v; ++__j)
-                ;
+                ++__count_removed;
             __deleted_nodes.splice_after(__deleted_nodes.before_begin(), *this, __i, __j);
             if (__j == __e)
                 break;
@@ -1522,22 +1525,27 @@
         else
             ++__i;
     }
+    
+    return (__remove_return_type) __count_removed;
 }
 
 template <class _Tp, class _Alloc>
 template <class _Predicate>
-void
+typename forward_list<_Tp, _Alloc>::__remove_return_type
 forward_list<_Tp, _Alloc>::remove_if(_Predicate __pred)
 {
-    iterator __e = end();
+    forward_list<_Tp, _Alloc> __deleted_nodes(get_allocator()); // collect the nodes we're removing
+    typename forward_list<_Tp, _Alloc>::size_type __count_removed = 0;
+    const iterator __e = end();
     for (iterator __i = before_begin(); __i.__get_begin()->__next_ != nullptr;)
     {
         if (__pred(__i.__get_begin()->__next_->__value_))
         {
+            ++__count_removed;
             iterator __j = _VSTD::next(__i, 2);
             for (; __j != __e && __pred(*__j); ++__j)
-                ;
-            erase_after(__i, __j);
+                ++__count_removed;
+            __deleted_nodes.splice_after(__deleted_nodes.before_begin(), *this, __i, __j);
             if (__j == __e)
                 break;
             __i = __j;
@@ -1545,22 +1553,28 @@
         else
             ++__i;
     }
+    
+    return (__remove_return_type) __count_removed;
 }
 
 template <class _Tp, class _Alloc>
 template <class _BinaryPredicate>
-void
+typename forward_list<_Tp, _Alloc>::__remove_return_type
 forward_list<_Tp, _Alloc>::unique(_BinaryPredicate __binary_pred)
 {
+    forward_list<_Tp, _Alloc> __deleted_nodes(get_allocator()); // collect the nodes we're removing
+    typename forward_list<_Tp, _Alloc>::size_type __count_removed = 0;
     for (iterator __i = begin(), __e = end(); __i != __e;)
     {
         iterator __j = _VSTD::next(__i);
         for (; __j != __e && __binary_pred(*__i, *__j); ++__j)
-            ;
+            ++__count_removed;
         if (__i.__get_begin()->__next_ != __j.__get_unsafe_node_pointer())
-            erase_after(__i, __j);
+            __deleted_nodes.splice_after(__deleted_nodes.before_begin(), *this, __i, __j);
         __i = __j;
     }
+    
+    return (__remove_return_type) __count_removed;
 }
 
 template <class _Tp, class _Alloc>
diff --git a/linux-x64/clang/include/c++/v1/fstream b/linux-x64/clang/include/c++/v1/fstream
index 1902ce9..60a05b0 100644
--- a/linux-x64/clang/include/c++/v1/fstream
+++ b/linux-x64/clang/include/c++/v1/fstream
@@ -235,7 +235,7 @@
     basic_filebuf* open(const string& __s, ios_base::openmode __mode);
 
 #if _LIBCPP_STD_VER >= 17
-    _LIBCPP_INLINE_VISIBILITY
+    _LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_INLINE_VISIBILITY
     basic_filebuf* open(const _VSTD_FS::path& __p, ios_base::openmode __mode) {
       return open(__p.c_str(), __mode);
     }
@@ -757,7 +757,7 @@
                                        this->eback() + __ibs_, __inext);
                 if (__r == codecvt_base::noconv)
                 {
-                    this->setg((char_type*)__extbuf_, (char_type*)__extbuf_, 
+                    this->setg((char_type*)__extbuf_, (char_type*)__extbuf_,
                                           (char_type*)const_cast<char *>(__extbufend_));
                     __c = traits_type::to_int_type(*this->gptr());
                 }
@@ -1151,7 +1151,7 @@
     _LIBCPP_INLINE_VISIBILITY
     explicit basic_ifstream(const string& __s, ios_base::openmode __mode = ios_base::in);
 #if _LIBCPP_STD_VER >= 17
-    _LIBCPP_INLINE_VISIBILITY
+    _LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_INLINE_VISIBILITY
     explicit basic_ifstream(const filesystem::path& __p, ios_base::openmode __mode = ios_base::in)
       : basic_ifstream(__p.c_str(), __mode) {}
 #endif // _LIBCPP_STD_VER >= 17
@@ -1177,7 +1177,7 @@
 #endif
     void open(const string& __s, ios_base::openmode __mode = ios_base::in);
 #if _LIBCPP_STD_VER >= 17
-    _LIBCPP_INLINE_VISIBILITY
+    _LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_INLINE_VISIBILITY
     void open(const filesystem::path& __p,
               ios_base::openmode __mode = ios_base::in) {
       return open(__p.c_str(), __mode);
@@ -1365,7 +1365,7 @@
     explicit basic_ofstream(const string& __s, ios_base::openmode __mode = ios_base::out);
 
 #if _LIBCPP_STD_VER >= 17
-    _LIBCPP_INLINE_VISIBILITY
+    _LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_INLINE_VISIBILITY
     explicit basic_ofstream(const filesystem::path& __p, ios_base::openmode __mode = ios_base::out)
       : basic_ofstream(__p.c_str(), __mode) {}
 #endif // _LIBCPP_STD_VER >= 17
@@ -1392,7 +1392,7 @@
     void open(const string& __s, ios_base::openmode __mode = ios_base::out);
 
 #if _LIBCPP_STD_VER >= 17
-    _LIBCPP_INLINE_VISIBILITY
+    _LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_INLINE_VISIBILITY
     void open(const filesystem::path& __p, ios_base::openmode __mode = ios_base::out)
     { return open(__p.c_str(), __mode); }
 #endif // _LIBCPP_STD_VER >= 17
@@ -1579,7 +1579,7 @@
     explicit basic_fstream(const string& __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
 
 #if _LIBCPP_STD_VER >= 17
-    _LIBCPP_INLINE_VISIBILITY
+    _LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_INLINE_VISIBILITY
     explicit basic_fstream(const filesystem::path& __p, ios_base::openmode __mode = ios_base::in | ios_base::out)
       : basic_fstream(__p.c_str(), __mode) {}
 #endif // _LIBCPP_STD_VER >= 17
@@ -1607,7 +1607,7 @@
     void open(const string& __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
 
 #if _LIBCPP_STD_VER >= 17
-    _LIBCPP_INLINE_VISIBILITY
+    _LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_INLINE_VISIBILITY
     void open(const filesystem::path& __p, ios_base::openmode __mode = ios_base::in|ios_base::out)
     { return open(__p.c_str(), __mode); }
 #endif // _LIBCPP_STD_VER >= 17
diff --git a/linux-x64/clang/include/c++/v1/functional b/linux-x64/clang/include/c++/v1/functional
index def8a75..bcd74a9 100644
--- a/linux-x64/clang/include/c++/v1/functional
+++ b/linux-x64/clang/include/c++/v1/functional
@@ -230,6 +230,10 @@
 template<class R, class Fn, class... BoundArgs>
   unspecified bind(Fn&&, BoundArgs&&...);
 
+template<class F, class... Args>
+ invoke_result_t<F, Args...> invoke(F&& f, Args&&... args) // C++17
+    noexcept(is_nothrow_invocable_v<F, Args...>);
+
 namespace placeholders {
   // M is the implementation-defined number of placeholders
   extern unspecified _1;
@@ -1475,6 +1479,8 @@
 // __alloc_func holds a functor and an allocator.
 
 template <class _Fp, class _Ap, class _FB> class __alloc_func;
+template <class _Fp, class _FB>
+class __default_alloc_func;
 
 template <class _Fp, class _Ap, class _Rp, class... _ArgTypes>
 class __alloc_func<_Fp, _Ap, _Rp(_ArgTypes...)>
@@ -1482,8 +1488,8 @@
     __compressed_pair<_Fp, _Ap> __f_;
 
   public:
-    typedef _Fp _Target;
-    typedef _Ap _Alloc;
+    typedef _LIBCPP_NODEBUG_TYPE _Fp _Target;
+    typedef _LIBCPP_NODEBUG_TYPE _Ap _Alloc;
 
     _LIBCPP_INLINE_VISIBILITY
     const _Target& __target() const { return __f_.first(); }
@@ -1544,6 +1550,56 @@
 
     _LIBCPP_INLINE_VISIBILITY
     void destroy() _NOEXCEPT { __f_.~__compressed_pair<_Target, _Alloc>(); }
+
+    static void __destroy_and_delete(__alloc_func* __f) {
+      typedef allocator_traits<_Alloc> __alloc_traits;
+      typedef typename __rebind_alloc_helper<__alloc_traits, __alloc_func>::type
+          _FunAlloc;
+      _FunAlloc __a(__f->__get_allocator());
+      __f->destroy();
+      __a.deallocate(__f, 1);
+    }
+};
+
+template <class _Fp, class _Rp, class... _ArgTypes>
+class __default_alloc_func<_Fp, _Rp(_ArgTypes...)> {
+  _Fp __f_;
+
+public:
+  typedef _LIBCPP_NODEBUG_TYPE _Fp _Target;
+
+  _LIBCPP_INLINE_VISIBILITY
+  const _Target& __target() const { return __f_; }
+
+  _LIBCPP_INLINE_VISIBILITY
+  explicit __default_alloc_func(_Target&& __f) : __f_(std::move(__f)) {}
+
+  _LIBCPP_INLINE_VISIBILITY
+  explicit __default_alloc_func(const _Target& __f) : __f_(__f) {}
+
+  _LIBCPP_INLINE_VISIBILITY
+  _Rp operator()(_ArgTypes&&... __arg) {
+    typedef __invoke_void_return_wrapper<_Rp> _Invoker;
+    return _Invoker::__call(__f_, _VSTD::forward<_ArgTypes>(__arg)...);
+  }
+
+  _LIBCPP_INLINE_VISIBILITY
+  __default_alloc_func* __clone() const {
+      __builtin_new_allocator::__holder_t __hold =
+        __builtin_new_allocator::__allocate_type<__default_alloc_func>(1);
+    __default_alloc_func* __res =
+        ::new (__hold.get()) __default_alloc_func(__f_);
+    (void)__hold.release();
+    return __res;
+  }
+
+  _LIBCPP_INLINE_VISIBILITY
+  void destroy() _NOEXCEPT { __f_.~_Target(); }
+
+  static void __destroy_and_delete(__default_alloc_func* __f) {
+    __f->destroy();
+      __builtin_new_allocator::__deallocate_type<__default_alloc_func>(__f, 1);
+  }
 };
 
 // __base provides an abstract interface for copyable functors.
@@ -1692,7 +1748,7 @@
     __value_func() _NOEXCEPT : __f_(0) {}
 
     template <class _Fp, class _Alloc>
-    _LIBCPP_INLINE_VISIBILITY __value_func(_Fp&& __f, const _Alloc __a)
+    _LIBCPP_INLINE_VISIBILITY __value_func(_Fp&& __f, const _Alloc& __a)
         : __f_(0)
     {
         typedef allocator_traits<_Alloc> __alloc_traits;
@@ -1720,6 +1776,11 @@
         }
     }
 
+    template <class _Fp,
+        class = typename enable_if<!is_same<typename decay<_Fp>::type, __value_func>::value>::type>
+    _LIBCPP_INLINE_VISIBILITY explicit __value_func(_Fp&& __f)
+        : __value_func(std::forward<_Fp>(__f), allocator<_Fp>()) {}
+
     _LIBCPP_INLINE_VISIBILITY
     __value_func(const __value_func& __f)
     {
@@ -1919,29 +1980,22 @@
         return __f->__clone();
     }
 
-    template <typename _Fun> static void __large_destroy(void* __s)
-    {
-        typedef allocator_traits<typename _Fun::_Alloc> __alloc_traits;
-        typedef typename __rebind_alloc_helper<__alloc_traits, _Fun>::type
-            _FunAlloc;
-        _Fun* __f = static_cast<_Fun*>(__s);
-        _FunAlloc __a(__f->__get_allocator());
-        __f->destroy();
-        __a.deallocate(__f, 1);
+    template <typename _Fun>
+    static void __large_destroy(void* __s) {
+      _Fun::__destroy_and_delete(static_cast<_Fun*>(__s));
     }
 
     template <typename _Fun>
     _LIBCPP_INLINE_VISIBILITY static const __policy*
-        __choose_policy(/* is_small = */ false_type)
-    {
-        static const _LIBCPP_CONSTEXPR __policy __policy_ = {
-            &__large_clone<_Fun>, &__large_destroy<_Fun>, false,
+    __choose_policy(/* is_small = */ false_type) {
+      static const _LIBCPP_CONSTEXPR __policy __policy_ = {
+          &__large_clone<_Fun>, &__large_destroy<_Fun>, false,
 #ifndef _LIBCPP_NO_RTTI
-            &typeid(typename _Fun::_Target)
+          &typeid(typename _Fun::_Target)
 #else
-            nullptr
+          nullptr
 #endif
-        };
+      };
         return &__policy_;
     }
 
@@ -2066,6 +2120,25 @@
         }
     }
 
+    template <class _Fp, class = typename enable_if<!is_same<typename decay<_Fp>::type, __policy_func>::value>::type>
+    _LIBCPP_INLINE_VISIBILITY explicit __policy_func(_Fp&& __f)
+        : __policy_(__policy::__create_empty()) {
+      typedef __default_alloc_func<_Fp, _Rp(_ArgTypes...)> _Fun;
+
+      if (__function::__not_null(__f)) {
+        __invoker_ = __invoker::template __create<_Fun>();
+        __policy_ = __policy::__create<_Fun>();
+        if (__use_small_storage<_Fun>()) {
+          ::new ((void*)&__buf_.__small) _Fun(_VSTD::move(__f));
+        } else {
+          __builtin_new_allocator::__holder_t __hold =
+              __builtin_new_allocator::__allocate_type<_Fun>(1);
+          __buf_.__large = ::new (__hold.get()) _Fun(_VSTD::move(__f));
+          (void)__hold.release();
+        }
+      }
+    }
+
     _LIBCPP_INLINE_VISIBILITY
     __policy_func(const __policy_func& __f)
         : __buf_(__f.__buf_), __invoker_(__f.__invoker_),
@@ -2173,8 +2246,8 @@
 
     __func __f_;
 
-    template <class _Fp, bool = __lazy_and<
-        integral_constant<bool, !is_same<__uncvref_t<_Fp>, function>::value>,
+    template <class _Fp, bool = _And<
+        _IsNotSame<__uncvref_t<_Fp>, function>,
         __invokable<_Fp&, _ArgTypes...>
     >::value>
     struct __callable;
@@ -2286,8 +2359,7 @@
 
 template <class _Rp, class... _ArgTypes>
 template <class _Fp, class>
-function<_Rp(_ArgTypes...)>::function(_Fp __f)
-    : __f_(_VSTD::move(__f), allocator<_Fp>()) {}
+function<_Rp(_ArgTypes...)>::function(_Fp __f) : __f_(_VSTD::move(__f)) {}
 
 #if _LIBCPP_STD_VER <= 14
 template <class _Rp, class... _ArgTypes>
@@ -2484,7 +2556,7 @@
 
 template <class _Ti, class ..._Uj>
 inline _LIBCPP_INLINE_VISIBILITY
-typename __lazy_enable_if
+typename _EnableIf
 <
     is_bind_expression<_Ti>::value,
     __invoke_of<_Ti&, _Uj...>
@@ -2769,9 +2841,9 @@
 #if _LIBCPP_STD_VER > 14
 
 template <class _Fn, class ..._Args>
-result_of_t<_Fn&&(_Args&&...)>
+invoke_result_t<_Fn, _Args...>
 invoke(_Fn&& __f, _Args&&... __args)
-    noexcept(noexcept(_VSTD::__invoke(_VSTD::forward<_Fn>(__f), _VSTD::forward<_Args>(__args)...)))
+    noexcept(is_nothrow_invocable_v<_Fn, _Args...>)
 {
     return _VSTD::__invoke(_VSTD::forward<_Fn>(__f), _VSTD::forward<_Args>(__args)...);
 }
diff --git a/linux-x64/clang/include/c++/v1/future b/linux-x64/clang/include/c++/v1/future
index 50bdd2d..6da88c6 100644
--- a/linux-x64/clang/include/c++/v1/future
+++ b/linux-x64/clang/include/c++/v1/future
@@ -408,11 +408,7 @@
 
 #ifndef _LIBCPP_HAS_NO_STRONG_ENUMS
 
-#ifdef _LIBCPP_UNDERLYING_TYPE
 typedef underlying_type<launch>::type __launch_underlying_type;
-#else
-typedef int __launch_underlying_type;
-#endif
 
 inline _LIBCPP_INLINE_VISIBILITY
 _LIBCPP_CONSTEXPR
@@ -2015,7 +2011,7 @@
               class = typename enable_if
               <
                   !is_same<
-                      typename __uncvref<_Fp>::type, 
+                      typename __uncvref<_Fp>::type,
                       packaged_task
                       >::value
                   >::type
@@ -2026,7 +2022,7 @@
               class = typename enable_if
               <
                   !is_same<
-                      typename __uncvref<_Fp>::type, 
+                      typename __uncvref<_Fp>::type,
                       packaged_task
                       >::value
                   >::type
@@ -2144,7 +2140,7 @@
               class = typename enable_if
               <
                   !is_same<
-                      typename __uncvref<_Fp>::type, 
+                      typename __uncvref<_Fp>::type,
                       packaged_task
                       >::value
                   >::type
@@ -2155,11 +2151,11 @@
               class = typename enable_if
               <
                   !is_same<
-                      typename __uncvref<_Fp>::type, 
+                      typename __uncvref<_Fp>::type,
                       packaged_task
                       >::value
                   >::type
-              >    
+              >
         _LIBCPP_INLINE_VISIBILITY
         packaged_task(allocator_arg_t, const _Allocator& __a, _Fp&& __f)
              : __f_(allocator_arg, __a, _VSTD::forward<_Fp>(__f)),
diff --git a/linux-x64/clang/include/c++/v1/initializer_list b/linux-x64/clang/include/c++/v1/initializer_list
index 6c4493b..893736f 100644
--- a/linux-x64/clang/include/c++/v1/initializer_list
+++ b/linux-x64/clang/include/c++/v1/initializer_list
@@ -82,7 +82,7 @@
     _LIBCPP_INLINE_VISIBILITY
     _LIBCPP_CONSTEXPR_AFTER_CXX11
     size_t    size()  const _NOEXCEPT {return __size_;}
-    
+
     _LIBCPP_INLINE_VISIBILITY
     _LIBCPP_CONSTEXPR_AFTER_CXX11
     const _Ep* begin() const _NOEXCEPT {return __begin_;}
diff --git a/linux-x64/clang/include/c++/v1/inttypes.h b/linux-x64/clang/include/c++/v1/inttypes.h
index 0f1d4f4..e136b23 100644
--- a/linux-x64/clang/include/c++/v1/inttypes.h
+++ b/linux-x64/clang/include/c++/v1/inttypes.h
@@ -8,7 +8,12 @@
 //===----------------------------------------------------------------------===//
 
 #ifndef _LIBCPP_INTTYPES_H
+// AIX system headers need inttypes.h to be re-enterable while _STD_TYPES_T
+// is defined until an inclusion of it without _STD_TYPES_T occurs, in which
+// case the header guard macro is defined.
+#if !defined(_AIX) || !defined(_STD_TYPES_T)
 #define _LIBCPP_INTTYPES_H
+#endif // _STD_TYPES_T
 
 /*
     inttypes.h synopsis
diff --git a/linux-x64/clang/include/c++/v1/iomanip b/linux-x64/clang/include/c++/v1/iomanip
index 82b7603..3f78f4d 100644
--- a/linux-x64/clang/include/c++/v1/iomanip
+++ b/linux-x64/clang/include/c++/v1/iomanip
@@ -515,7 +515,7 @@
 
 template <class _CharT, class _Traits, class _ForwardIterator>
 std::basic_ostream<_CharT, _Traits> &
-__quoted_output ( basic_ostream<_CharT, _Traits> &__os, 
+__quoted_output ( basic_ostream<_CharT, _Traits> &__os,
         _ForwardIterator __first, _ForwardIterator __last, _CharT __delim, _CharT __escape )
 {
     _VSTD::basic_string<_CharT, _Traits> __str;
@@ -570,7 +570,7 @@
 
 template <class _CharT, class _Traits, class _Iter>
 basic_ostream<_CharT, _Traits>& operator<<(
-         basic_ostream<_CharT, _Traits>& __os, 
+         basic_ostream<_CharT, _Traits>& __os,
          const __quoted_output_proxy<_CharT, _Iter, _Traits> & __proxy)
 {
     return __quoted_output (__os, __proxy.__first, __proxy.__last, __proxy.__delim, __proxy.__escape);
@@ -590,7 +590,7 @@
 template <class _CharT, class _Traits, class _Allocator>
 _LIBCPP_INLINE_VISIBILITY
 basic_ostream<_CharT, _Traits>& operator<<(
-        basic_ostream<_CharT, _Traits>& __os, 
+        basic_ostream<_CharT, _Traits>& __os,
         const __quoted_proxy<_CharT, _Traits, _Allocator> & __proxy)
 {
     return __quoted_output (__os, __proxy.__string.cbegin (), __proxy.__string.cend (), __proxy.__delim, __proxy.__escape);
@@ -600,7 +600,7 @@
 template <class _CharT, class _Traits, class _Allocator>
 _LIBCPP_INLINE_VISIBILITY
 basic_istream<_CharT, _Traits>& operator>>(
-        basic_istream<_CharT, _Traits>& __is, 
+        basic_istream<_CharT, _Traits>& __is,
         const __quoted_proxy<_CharT, _Traits, _Allocator> & __proxy)
 {
     return __quoted_input ( __is, __proxy.__string, __proxy.__delim, __proxy.__escape );
@@ -660,7 +660,7 @@
 quoted (basic_string_view <_CharT, _Traits> __sv,
              _CharT __delim = _CharT('"'), _CharT __escape=_CharT('\\'))
 {
-    return __quoted_output_proxy<_CharT, const _CharT *, _Traits> 
+    return __quoted_output_proxy<_CharT, const _CharT *, _Traits>
          ( __sv.data(), __sv.data() + __sv.size(), __delim, __escape );
 }
 #endif
diff --git a/linux-x64/clang/include/c++/v1/ios b/linux-x64/clang/include/c++/v1/ios
index 96e84eb..88efefb 100644
--- a/linux-x64/clang/include/c++/v1/ios
+++ b/linux-x64/clang/include/c++/v1/ios
@@ -202,8 +202,8 @@
 };
 
 concept_map ErrorCodeEnum<io_errc> { };
-error_code make_error_code(io_errc e) noexcept; 
-error_condition make_error_condition(io_errc e) noexcept; 
+error_code make_error_code(io_errc e) noexcept;
+error_condition make_error_condition(io_errc e) noexcept;
 storage-class-specifier const error_category& iostream_category() noexcept;
 
 }  // std
@@ -330,6 +330,15 @@
     void __set_badbit_and_consider_rethrow();
     void __set_failbit_and_consider_rethrow();
 
+    _LIBCPP_INLINE_VISIBILITY
+    void __setstate_nothrow(iostate __state)
+    {
+        if (__rdbuf_)
+            __rdstate_ |= __state;
+        else
+            __rdstate_ |= __state | ios_base::badbit;
+    }
+
 protected:
     _LIBCPP_INLINE_VISIBILITY
     ios_base() {// purposefully does no initialization
@@ -635,47 +644,47 @@
     virtual ~basic_ios();
 
     // 27.5.4.2 Members:
-    _LIBCPP_INLINE_VISIBILITY 
+    _LIBCPP_INLINE_VISIBILITY
     basic_ostream<char_type, traits_type>* tie() const;
-    _LIBCPP_INLINE_VISIBILITY 
+    _LIBCPP_INLINE_VISIBILITY
     basic_ostream<char_type, traits_type>* tie(basic_ostream<char_type, traits_type>* __tiestr);
 
-    _LIBCPP_INLINE_VISIBILITY 
+    _LIBCPP_INLINE_VISIBILITY
     basic_streambuf<char_type, traits_type>* rdbuf() const;
-    _LIBCPP_INLINE_VISIBILITY 
+    _LIBCPP_INLINE_VISIBILITY
     basic_streambuf<char_type, traits_type>* rdbuf(basic_streambuf<char_type, traits_type>* __sb);
 
     basic_ios& copyfmt(const basic_ios& __rhs);
 
-    _LIBCPP_INLINE_VISIBILITY 
+    _LIBCPP_INLINE_VISIBILITY
     char_type fill() const;
-    _LIBCPP_INLINE_VISIBILITY 
+    _LIBCPP_INLINE_VISIBILITY
     char_type fill(char_type __ch);
 
-    _LIBCPP_INLINE_VISIBILITY 
+    _LIBCPP_INLINE_VISIBILITY
     locale imbue(const locale& __loc);
 
-    _LIBCPP_INLINE_VISIBILITY 
+    _LIBCPP_INLINE_VISIBILITY
     char narrow(char_type __c, char __dfault) const;
-    _LIBCPP_INLINE_VISIBILITY 
+    _LIBCPP_INLINE_VISIBILITY
     char_type widen(char __c) const;
 
 protected:
     _LIBCPP_INLINE_VISIBILITY
     basic_ios() {// purposefully does no initialization
                 }
-    _LIBCPP_INLINE_VISIBILITY 
+    _LIBCPP_INLINE_VISIBILITY
     void init(basic_streambuf<char_type, traits_type>* __sb);
 
-    _LIBCPP_INLINE_VISIBILITY 
+    _LIBCPP_INLINE_VISIBILITY
     void move(basic_ios& __rhs);
 #ifndef _LIBCPP_CXX03_LANG
     _LIBCPP_INLINE_VISIBILITY
     void move(basic_ios&& __rhs) {move(__rhs);}
 #endif
-    _LIBCPP_INLINE_VISIBILITY 
+    _LIBCPP_INLINE_VISIBILITY
     void swap(basic_ios& __rhs) _NOEXCEPT;
-    _LIBCPP_INLINE_VISIBILITY 
+    _LIBCPP_INLINE_VISIBILITY
     void set_rdbuf(basic_streambuf<char_type, traits_type>* __sb);
 private:
     basic_ostream<char_type, traits_type>* __tie_;
diff --git a/linux-x64/clang/include/c++/v1/istream b/linux-x64/clang/include/c++/v1/istream
index bedd738..d6217bb 100644
--- a/linux-x64/clang/include/c++/v1/istream
+++ b/linux-x64/clang/include/c++/v1/istream
@@ -362,26 +362,31 @@
 _LIBCPP_INLINE_VISIBILITY
 basic_istream<_CharT, _Traits>&
 __input_arithmetic(basic_istream<_CharT, _Traits>& __is, _Tp& __n) {
-#ifndef _LIBCPP_NO_EXCEPTIONS
-    try
+    ios_base::iostate __state = ios_base::goodbit;
+    typename basic_istream<_CharT, _Traits>::sentry __s(__is);
+    if (__s)
     {
-#endif  // _LIBCPP_NO_EXCEPTIONS
-        typename basic_istream<_CharT, _Traits>::sentry __s(__is);
-        if (__s)
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        try
         {
+#endif  // _LIBCPP_NO_EXCEPTIONS
             typedef istreambuf_iterator<_CharT, _Traits> _Ip;
             typedef num_get<_CharT, _Ip> _Fp;
-            ios_base::iostate __err = ios_base::goodbit;
-            use_facet<_Fp>(__is.getloc()).get(_Ip(__is), _Ip(), __is, __err, __n);
-            __is.setstate(__err);
-        }
+            use_facet<_Fp>(__is.getloc()).get(_Ip(__is), _Ip(), __is, __state, __n);
 #ifndef _LIBCPP_NO_EXCEPTIONS
+        }
+        catch (...)
+        {
+            __state |= ios_base::badbit;
+            __is.__setstate_nothrow(__state);
+            if (__is.exceptions() & ios_base::badbit)
+            {
+                throw;
+            }
+        }
+#endif
+        __is.setstate(__state);
     }
-    catch (...)
-    {
-        __is.__set_badbit_and_consider_rethrow();
-    }
-#endif  // _LIBCPP_NO_EXCEPTIONS
     return __is;
 }
 
@@ -466,39 +471,46 @@
 _LIBCPP_INLINE_VISIBILITY
 basic_istream<_CharT, _Traits>&
 __input_arithmetic_with_numeric_limits(basic_istream<_CharT, _Traits>& __is, _Tp& __n) {
-#ifndef _LIBCPP_NO_EXCEPTIONS
-    try
+    ios_base::iostate __state = ios_base::goodbit;
+    typename basic_istream<_CharT, _Traits>::sentry __s(__is);
+    if (__s)
     {
-#endif  // _LIBCPP_NO_EXCEPTIONS
-        typename basic_istream<_CharT, _Traits>::sentry __s(__is);
-        if (__s)
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        try
         {
+#endif  // _LIBCPP_NO_EXCEPTIONS
             typedef istreambuf_iterator<_CharT, _Traits> _Ip;
             typedef num_get<_CharT, _Ip> _Fp;
-            ios_base::iostate __err = ios_base::goodbit;
             long __temp;
-            use_facet<_Fp>(__is.getloc()).get(_Ip(__is), _Ip(), __is, __err, __temp);
+            use_facet<_Fp>(__is.getloc()).get(_Ip(__is), _Ip(), __is, __state, __temp);
             if (__temp < numeric_limits<_Tp>::min())
             {
-                __err |= ios_base::failbit;
+                __state |= ios_base::failbit;
                 __n = numeric_limits<_Tp>::min();
             }
             else if (__temp > numeric_limits<_Tp>::max())
             {
-                __err |= ios_base::failbit;
+                __state |= ios_base::failbit;
                 __n = numeric_limits<_Tp>::max();
             }
             else
+            {
                 __n = static_cast<_Tp>(__temp);
-            __is.setstate(__err);
-        }
+            }
 #ifndef _LIBCPP_NO_EXCEPTIONS
-    }
-    catch (...)
-    {
-        __is.__set_badbit_and_consider_rethrow();
-    }
+        }
+        catch (...)
+        {
+            __state |= ios_base::badbit;
+            __is.__setstate_nothrow(__state);
+            if (__is.exceptions() & ios_base::badbit)
+            {
+                throw;
+            }
+        }
 #endif  // _LIBCPP_NO_EXCEPTIONS
+        __is.setstate(__state);
+    }
     return __is;
 }
 
@@ -521,22 +533,22 @@
 basic_istream<_CharT, _Traits>&
 __input_c_string(basic_istream<_CharT, _Traits>& __is, _CharT* __p, size_t __n)
 {
-#ifndef _LIBCPP_NO_EXCEPTIONS
-    try
+    ios_base::iostate __state = ios_base::goodbit;
+    typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
+    if (__sen)
     {
-#endif  // _LIBCPP_NO_EXCEPTIONS
-        typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
-        if (__sen)
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        try
         {
-            auto __s = __p;
+#endif
+            _CharT* __s = __p;
             const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc());
-            ios_base::iostate __err = ios_base::goodbit;
             while (__s != __p + (__n-1))
             {
                 typename _Traits::int_type __i = __is.rdbuf()->sgetc();
                 if (_Traits::eq_int_type(__i, _Traits::eof()))
                 {
-                   __err |= ios_base::eofbit;
+                   __state |= ios_base::eofbit;
                    break;
                 }
                 _CharT __ch = _Traits::to_char_type(__i);
@@ -548,16 +560,21 @@
             *__s = _CharT();
             __is.width(0);
             if (__s == __p)
-               __err |= ios_base::failbit;
-            __is.setstate(__err);
-        }
+               __state |= ios_base::failbit;
 #ifndef _LIBCPP_NO_EXCEPTIONS
+        }
+        catch (...)
+        {
+            __state |= ios_base::badbit;
+            __is.__setstate_nothrow(__state);
+            if (__is.exceptions() & ios_base::badbit)
+            {
+                throw;
+            }
+        }
+#endif
+        __is.setstate(__state);
     }
-    catch (...)
-    {
-        __is.__set_badbit_and_consider_rethrow();
-    }
-#endif  // _LIBCPP_NO_EXCEPTIONS
     return __is;
 }
 
@@ -568,7 +585,7 @@
 basic_istream<_CharT, _Traits>&
 operator>>(basic_istream<_CharT, _Traits>& __is, _CharT (&__buf)[_Np])
 {
-    auto __n = _Np;
+    size_t __n = _Np;
     if (__is.width() > 0)
         __n = _VSTD::min(size_t(__is.width()), _Np);
     return _VSTD::__input_c_string(__is, __buf, __n);
@@ -625,26 +642,33 @@
 basic_istream<_CharT, _Traits>&
 operator>>(basic_istream<_CharT, _Traits>& __is, _CharT& __c)
 {
-#ifndef _LIBCPP_NO_EXCEPTIONS
-    try
+    ios_base::iostate __state = ios_base::goodbit;
+    typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
+    if (__sen)
     {
-#endif  // _LIBCPP_NO_EXCEPTIONS
-        typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
-        if (__sen)
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        try
         {
+#endif
             typename _Traits::int_type __i = __is.rdbuf()->sbumpc();
             if (_Traits::eq_int_type(__i, _Traits::eof()))
-                __is.setstate(ios_base::eofbit | ios_base::failbit);
+                __state |= ios_base::eofbit | ios_base::failbit;
             else
                 __c = _Traits::to_char_type(__i);
-        }
 #ifndef _LIBCPP_NO_EXCEPTIONS
+        }
+        catch (...)
+        {
+            __state |= ios_base::badbit;
+            __is.__setstate_nothrow(__state);
+            if (__is.exceptions() & ios_base::badbit)
+            {
+                throw;
+            }
+        }
+#endif
+        __is.setstate(__state);
     }
-    catch (...)
-    {
-        __is.__set_badbit_and_consider_rethrow();
-    }
-#endif  // _LIBCPP_NO_EXCEPTIONS
     return __is;
 }
 
@@ -668,58 +692,56 @@
 basic_istream<_CharT, _Traits>&
 basic_istream<_CharT, _Traits>::operator>>(basic_streambuf<char_type, traits_type>* __sb)
 {
+    ios_base::iostate __state = ios_base::goodbit;
     __gc_ = 0;
-#ifndef _LIBCPP_NO_EXCEPTIONS
-    try
+    sentry __s(*this, true);
+    if (__s)
     {
-#endif  // _LIBCPP_NO_EXCEPTIONS
-        sentry __s(*this, true);
-        if (__s)
+        if (__sb)
         {
-            if (__sb)
+#ifndef _LIBCPP_NO_EXCEPTIONS
+            try
             {
-#ifndef _LIBCPP_NO_EXCEPTIONS
-                try
+#endif // _LIBCPP_NO_EXCEPTIONS
+                while (true)
                 {
-#endif  // _LIBCPP_NO_EXCEPTIONS
-                    ios_base::iostate __err = ios_base::goodbit;
-                    while (true)
+                    typename traits_type::int_type __i = this->rdbuf()->sgetc();
+                    if (traits_type::eq_int_type(__i, _Traits::eof()))
                     {
-                        typename traits_type::int_type __i = this->rdbuf()->sgetc();
-                        if (traits_type::eq_int_type(__i, _Traits::eof()))
-                        {
-                           __err |= ios_base::eofbit;
-                           break;
-                        }
-                        if (traits_type::eq_int_type(
-                                __sb->sputc(traits_type::to_char_type(__i)),
-                                traits_type::eof()))
-                            break;
-                        ++__gc_;
-                        this->rdbuf()->sbumpc();
+                       __state |= ios_base::eofbit;
+                       break;
                     }
-                    if (__gc_ == 0)
-                       __err |= ios_base::failbit;
-                    this->setstate(__err);
+                    if (traits_type::eq_int_type(
+                            __sb->sputc(traits_type::to_char_type(__i)),
+                            traits_type::eof()))
+                        break;
+                    ++__gc_;
+                    this->rdbuf()->sbumpc();
+                }
+                if (__gc_ == 0)
+                   __state |= ios_base::failbit;
 #ifndef _LIBCPP_NO_EXCEPTIONS
-                }
-                catch (...)
-                {
-                    if (__gc_ == 0)
-                        this->__set_failbit_and_consider_rethrow();
-                }
-#endif  // _LIBCPP_NO_EXCEPTIONS
             }
-            else
-                this->setstate(ios_base::failbit);
-        }
-#ifndef _LIBCPP_NO_EXCEPTIONS
-    }
-    catch (...)
-    {
-        this->__set_badbit_and_consider_rethrow();
-    }
+            catch (...)
+            {
+                __state |= ios_base::badbit;
+                if (__gc_ == 0)
+                    __state |= ios_base::failbit;
+
+                this->__setstate_nothrow(__state);
+                if (this->exceptions() & ios_base::failbit || this->exceptions() & ios_base::badbit)
+                {
+                    throw;
+                }
+            }
 #endif  // _LIBCPP_NO_EXCEPTIONS
+        }
+        else
+        {
+            __state |= ios_base::failbit;
+        }
+        this->setstate(__state);
+    }
     return *this;
 }
 
@@ -727,28 +749,34 @@
 typename basic_istream<_CharT, _Traits>::int_type
 basic_istream<_CharT, _Traits>::get()
 {
+    ios_base::iostate __state = ios_base::goodbit;
     __gc_ = 0;
     int_type __r = traits_type::eof();
-#ifndef _LIBCPP_NO_EXCEPTIONS
-    try
+    sentry __s(*this, true);
+    if (__s)
     {
-#endif  // _LIBCPP_NO_EXCEPTIONS
-        sentry __s(*this, true);
-        if (__s)
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        try
         {
+#endif
             __r = this->rdbuf()->sbumpc();
             if (traits_type::eq_int_type(__r, traits_type::eof()))
-               this->setstate(ios_base::failbit | ios_base::eofbit);
+               __state |= ios_base::failbit | ios_base::eofbit;
             else
                 __gc_ = 1;
-        }
 #ifndef _LIBCPP_NO_EXCEPTIONS
+        }
+        catch (...)
+        {
+            this->__setstate_nothrow(this->rdstate() | ios_base::badbit);
+            if (this->exceptions() & ios_base::badbit)
+            {
+                throw;
+            }
+        }
+#endif
+        this->setstate(__state);
     }
-    catch (...)
-    {
-        this->__set_badbit_and_consider_rethrow();
-    }
-#endif  // _LIBCPP_NO_EXCEPTIONS
     return __r;
 }
 
@@ -756,23 +784,23 @@
 basic_istream<_CharT, _Traits>&
 basic_istream<_CharT, _Traits>::get(char_type* __s, streamsize __n, char_type __dlm)
 {
+    ios_base::iostate __state = ios_base::goodbit;
     __gc_ = 0;
-#ifndef _LIBCPP_NO_EXCEPTIONS
-    try
+    sentry __sen(*this, true);
+    if (__sen)
     {
-#endif  // _LIBCPP_NO_EXCEPTIONS
-        sentry __sen(*this, true);
-        if (__sen)
+        if (__n > 0)
         {
-            if (__n > 0)
+#ifndef _LIBCPP_NO_EXCEPTIONS
+            try
             {
-                ios_base::iostate __err = ios_base::goodbit;
+#endif
                 while (__gc_ < __n-1)
                 {
                     int_type __i = this->rdbuf()->sgetc();
                     if (traits_type::eq_int_type(__i, traits_type::eof()))
                     {
-                       __err |= ios_base::eofbit;
+                       __state |= ios_base::eofbit;
                        break;
                     }
                     char_type __ch = traits_type::to_char_type(__i);
@@ -783,23 +811,33 @@
                      this->rdbuf()->sbumpc();
                 }
                 if (__gc_ == 0)
-                   __err |= ios_base::failbit;
-                this->setstate(__err);
-            }
-            else
-                this->setstate(ios_base::failbit);
-        }
-        if (__n > 0)
-            *__s = char_type();
+                   __state |= ios_base::failbit;
 #ifndef _LIBCPP_NO_EXCEPTIONS
-    }
-    catch (...)
-    {
+            }
+            catch (...)
+            {
+                __state |= ios_base::badbit;
+                this->__setstate_nothrow(__state);
+                if (this->exceptions() & ios_base::badbit)
+                {
+                    if (__n > 0)
+                        *__s = char_type();
+                    throw;
+                }
+            }
+#endif
+        }
+        else
+        {
+            __state |= ios_base::failbit;
+        }
+
         if (__n > 0)
             *__s = char_type();
-        this->__set_badbit_and_consider_rethrow();
+        this->setstate(__state);
     }
-#endif  // _LIBCPP_NO_EXCEPTIONS
+    if (__n > 0)
+        *__s = char_type();
     return *this;
 }
 
@@ -808,52 +846,43 @@
 basic_istream<_CharT, _Traits>::get(basic_streambuf<char_type, traits_type>& __sb,
                                     char_type __dlm)
 {
+    ios_base::iostate __state = ios_base::goodbit;
     __gc_ = 0;
-#ifndef _LIBCPP_NO_EXCEPTIONS
-    try
+    sentry __sen(*this, true);
+    if (__sen)
     {
-#endif  // _LIBCPP_NO_EXCEPTIONS
-        sentry __sen(*this, true);
-        if (__sen)
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        try
         {
-            ios_base::iostate __err = ios_base::goodbit;
-#ifndef _LIBCPP_NO_EXCEPTIONS
-            try
-            {
 #endif  // _LIBCPP_NO_EXCEPTIONS
-                while (true)
+            while (true)
+            {
+                typename traits_type::int_type __i = this->rdbuf()->sgetc();
+                if (traits_type::eq_int_type(__i, traits_type::eof()))
                 {
-                    typename traits_type::int_type __i = this->rdbuf()->sgetc();
-                    if (traits_type::eq_int_type(__i, traits_type::eof()))
-                    {
-                       __err |= ios_base::eofbit;
-                       break;
-                    }
-                    char_type __ch = traits_type::to_char_type(__i);
-                    if (traits_type::eq(__ch, __dlm))
-                        break;
-                    if (traits_type::eq_int_type(__sb.sputc(__ch), traits_type::eof()))
-                        break;
-                    ++__gc_;
-                    this->rdbuf()->sbumpc();
+                   __state |= ios_base::eofbit;
+                   break;
                 }
+                char_type __ch = traits_type::to_char_type(__i);
+                if (traits_type::eq(__ch, __dlm))
+                    break;
+                if (traits_type::eq_int_type(__sb.sputc(__ch), traits_type::eof()))
+                    break;
+                ++__gc_;
+                this->rdbuf()->sbumpc();
+            }
 #ifndef _LIBCPP_NO_EXCEPTIONS
-            }
-            catch (...)
-            {
-            }
-#endif  // _LIBCPP_NO_EXCEPTIONS
-            if (__gc_ == 0)
-               __err |= ios_base::failbit;
-            this->setstate(__err);
         }
-#ifndef _LIBCPP_NO_EXCEPTIONS
-    }
-    catch (...)
-    {
-        this->__set_badbit_and_consider_rethrow();
-    }
+        catch (...)
+        {
+            __state |= ios_base::badbit;
+            // according to the spec, exceptions here are caught but not rethrown
+        }
 #endif  // _LIBCPP_NO_EXCEPTIONS
+        if (__gc_ == 0)
+           __state |= ios_base::failbit;
+        this->setstate(__state);
+    }
     return *this;
 }
 
@@ -861,21 +890,21 @@
 basic_istream<_CharT, _Traits>&
 basic_istream<_CharT, _Traits>::getline(char_type* __s, streamsize __n, char_type __dlm)
 {
+    ios_base::iostate __state = ios_base::goodbit;
     __gc_ = 0;
-#ifndef _LIBCPP_NO_EXCEPTIONS
-    try
+    sentry __sen(*this, true);
+    if (__sen)
     {
-#endif  // _LIBCPP_NO_EXCEPTIONS
-        sentry __sen(*this, true);
-        if (__sen)
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        try
         {
-            ios_base::iostate __err = ios_base::goodbit;
+#endif  // _LIBCPP_NO_EXCEPTIONS
             while (true)
             {
                 typename traits_type::int_type __i = this->rdbuf()->sgetc();
                 if (traits_type::eq_int_type(__i, traits_type::eof()))
                 {
-                   __err |= ios_base::eofbit;
+                   __state |= ios_base::eofbit;
                    break;
                 }
                 char_type __ch = traits_type::to_char_type(__i);
@@ -887,28 +916,35 @@
                 }
                 if (__gc_ >= __n-1)
                 {
-                    __err |= ios_base::failbit;
+                    __state |= ios_base::failbit;
                     break;
                 }
                 *__s++ = __ch;
                 this->rdbuf()->sbumpc();
                 ++__gc_;
             }
-            if (__gc_ == 0)
-               __err |= ios_base::failbit;
-            this->setstate(__err);
-        }
-        if (__n > 0)
-            *__s = char_type();
 #ifndef _LIBCPP_NO_EXCEPTIONS
-    }
-    catch (...)
-    {
-        if (__n > 0)
-            *__s = char_type();
-        this->__set_badbit_and_consider_rethrow();
-    }
+        }
+        catch (...)
+        {
+            __state |= ios_base::badbit;
+            this->__setstate_nothrow(__state);
+            if (this->exceptions() & ios_base::badbit)
+            {
+                if (__n > 0)
+                    *__s = char_type();
+                if (__gc_ == 0)
+                    __state |= ios_base::failbit;
+                throw;
+            }
+        }
 #endif  // _LIBCPP_NO_EXCEPTIONS
+    }
+    if (__n > 0)
+        *__s = char_type();
+    if (__gc_ == 0)
+        __state |= ios_base::failbit;
+    this->setstate(__state);
     return *this;
 }
 
@@ -916,15 +952,15 @@
 basic_istream<_CharT, _Traits>&
 basic_istream<_CharT, _Traits>::ignore(streamsize __n, int_type __dlm)
 {
+    ios_base::iostate __state = ios_base::goodbit;
     __gc_ = 0;
-#ifndef _LIBCPP_NO_EXCEPTIONS
-    try
+    sentry __sen(*this, true);
+    if (__sen)
     {
-#endif  // _LIBCPP_NO_EXCEPTIONS
-        sentry __sen(*this, true);
-        if (__sen)
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        try
         {
-            ios_base::iostate __err = ios_base::goodbit;
+#endif  // _LIBCPP_NO_EXCEPTIONS
             if (__n == numeric_limits<streamsize>::max())
             {
                 while (true)
@@ -932,7 +968,7 @@
                     typename traits_type::int_type __i = this->rdbuf()->sbumpc();
                     if (traits_type::eq_int_type(__i, traits_type::eof()))
                     {
-                       __err |= ios_base::eofbit;
+                       __state |= ios_base::eofbit;
                        break;
                     }
                     ++__gc_;
@@ -947,7 +983,7 @@
                     typename traits_type::int_type __i = this->rdbuf()->sbumpc();
                     if (traits_type::eq_int_type(__i, traits_type::eof()))
                     {
-                       __err |= ios_base::eofbit;
+                       __state |= ios_base::eofbit;
                        break;
                     }
                     ++__gc_;
@@ -955,15 +991,20 @@
                         break;
                 }
             }
-            this->setstate(__err);
-        }
 #ifndef _LIBCPP_NO_EXCEPTIONS
-    }
-    catch (...)
-    {
-        this->__set_badbit_and_consider_rethrow();
-    }
+        }
+        catch (...)
+        {
+            __state |= ios_base::badbit;
+            this->__setstate_nothrow(__state);
+            if (this->exceptions() & ios_base::badbit)
+            {
+                throw;
+            }
+        }
 #endif  // _LIBCPP_NO_EXCEPTIONS
+        this->setstate(__state);
+    }
     return *this;
 }
 
@@ -971,26 +1012,33 @@
 typename basic_istream<_CharT, _Traits>::int_type
 basic_istream<_CharT, _Traits>::peek()
 {
+    ios_base::iostate __state = ios_base::goodbit;
     __gc_ = 0;
     int_type __r = traits_type::eof();
-#ifndef _LIBCPP_NO_EXCEPTIONS
-    try
+    sentry __sen(*this, true);
+    if (__sen)
     {
-#endif  // _LIBCPP_NO_EXCEPTIONS
-        sentry __sen(*this, true);
-        if (__sen)
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        try
         {
+#endif  // _LIBCPP_NO_EXCEPTIONS
             __r = this->rdbuf()->sgetc();
             if (traits_type::eq_int_type(__r, traits_type::eof()))
-                this->setstate(ios_base::eofbit);
-        }
+                __state |= ios_base::eofbit;
 #ifndef _LIBCPP_NO_EXCEPTIONS
-    }
-    catch (...)
-    {
-        this->__set_badbit_and_consider_rethrow();
-    }
+        }
+        catch (...)
+        {
+            __state |= ios_base::badbit;
+            this->__setstate_nothrow(__state);
+            if (this->exceptions() & ios_base::badbit)
+            {
+                throw;
+            }
+        }
 #endif  // _LIBCPP_NO_EXCEPTIONS
+        this->setstate(__state);
+    }
     return __r;
 }
 
@@ -998,27 +1046,36 @@
 basic_istream<_CharT, _Traits>&
 basic_istream<_CharT, _Traits>::read(char_type* __s, streamsize __n)
 {
+    ios_base::iostate __state = ios_base::goodbit;
     __gc_ = 0;
-#ifndef _LIBCPP_NO_EXCEPTIONS
-    try
+    sentry __sen(*this, true);
+    if (__sen)
     {
-#endif  // _LIBCPP_NO_EXCEPTIONS
-        sentry __sen(*this, true);
-        if (__sen)
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        try
         {
+#endif  // _LIBCPP_NO_EXCEPTIONS
             __gc_ = this->rdbuf()->sgetn(__s, __n);
             if (__gc_ != __n)
-                this->setstate(ios_base::failbit | ios_base::eofbit);
-        }
-        else
-            this->setstate(ios_base::failbit);
+                __state |= ios_base::failbit | ios_base::eofbit;
 #ifndef _LIBCPP_NO_EXCEPTIONS
-    }
-    catch (...)
-    {
-        this->__set_badbit_and_consider_rethrow();
-    }
+        }
+        catch (...)
+        {
+            __state |= ios_base::badbit;
+            this->__setstate_nothrow(__state);
+            if (this->exceptions() & ios_base::badbit)
+            {
+                throw;
+            }
+        }
 #endif  // _LIBCPP_NO_EXCEPTIONS
+    }
+    else
+    {
+        __state |= ios_base::failbit;
+    }
+    this->setstate(__state);
     return *this;
 }
 
@@ -1026,36 +1083,48 @@
 streamsize
 basic_istream<_CharT, _Traits>::readsome(char_type* __s, streamsize __n)
 {
+    ios_base::iostate __state = ios_base::goodbit;
     __gc_ = 0;
-#ifndef _LIBCPP_NO_EXCEPTIONS
-    try
+    sentry __sen(*this, true);
+    if (__sen)
     {
-#endif  // _LIBCPP_NO_EXCEPTIONS
-        sentry __sen(*this, true);
-        if (__sen)
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        try
         {
+#endif  // _LIBCPP_NO_EXCEPTIONS
             streamsize __c = this->rdbuf()->in_avail();
             switch (__c)
             {
             case -1:
-                this->setstate(ios_base::eofbit);
+                __state |= ios_base::eofbit;
                 break;
             case 0:
                 break;
             default:
-                read(__s, _VSTD::min(__c, __n));
+                __n = _VSTD::min(__c, __n);
+                __gc_ = this->rdbuf()->sgetn(__s, __n);
+                if (__gc_ != __n)
+                    __state |= ios_base::failbit | ios_base::eofbit;
                 break;
             }
-        }
-        else
-            this->setstate(ios_base::failbit);
 #ifndef _LIBCPP_NO_EXCEPTIONS
-    }
-    catch (...)
-    {
-        this->__set_badbit_and_consider_rethrow();
-    }
+        }
+        catch (...)
+        {
+            __state |= ios_base::badbit;
+            this->__setstate_nothrow(__state);
+            if (this->exceptions() & ios_base::badbit)
+            {
+                throw;
+            }
+        }
 #endif  // _LIBCPP_NO_EXCEPTIONS
+    }
+    else
+    {
+        __state |= ios_base::failbit;
+    }
+    this->setstate(__state);
     return __gc_;
 }
 
@@ -1063,27 +1132,36 @@
 basic_istream<_CharT, _Traits>&
 basic_istream<_CharT, _Traits>::putback(char_type __c)
 {
+    ios_base::iostate __state = this->rdstate() & ~ios_base::eofbit;
     __gc_ = 0;
-#ifndef _LIBCPP_NO_EXCEPTIONS
-    try
+    this->clear(__state);
+    sentry __sen(*this, true);
+    if (__sen)
     {
-#endif  // _LIBCPP_NO_EXCEPTIONS
-        this->clear(this->rdstate() & ~ios_base::eofbit);
-        sentry __sen(*this, true);
-        if (__sen)
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        try
         {
-            if (this->rdbuf() == 0 || this->rdbuf()->sputbackc(__c) == traits_type::eof())
-                this->setstate(ios_base::badbit);
-        }
-        else
-            this->setstate(ios_base::failbit);
-#ifndef _LIBCPP_NO_EXCEPTIONS
-    }
-    catch (...)
-    {
-        this->__set_badbit_and_consider_rethrow();
-    }
 #endif  // _LIBCPP_NO_EXCEPTIONS
+            if (this->rdbuf() == 0 || this->rdbuf()->sputbackc(__c) == traits_type::eof())
+                __state |= ios_base::badbit;
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        }
+        catch (...)
+        {
+            __state |= ios_base::badbit;
+            this->__setstate_nothrow(__state);
+            if (this->exceptions() & ios_base::badbit)
+            {
+                throw;
+            }
+        }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    }
+    else
+    {
+        __state |= ios_base::failbit;
+    }
+    this->setstate(__state);
     return *this;
 }
 
@@ -1091,27 +1169,36 @@
 basic_istream<_CharT, _Traits>&
 basic_istream<_CharT, _Traits>::unget()
 {
+    ios_base::iostate __state = this->rdstate() & ~ios_base::eofbit;
     __gc_ = 0;
-#ifndef _LIBCPP_NO_EXCEPTIONS
-    try
+    this->clear(__state);
+    sentry __sen(*this, true);
+    if (__sen)
     {
-#endif  // _LIBCPP_NO_EXCEPTIONS
-        this->clear(this->rdstate() & ~ios_base::eofbit);
-        sentry __sen(*this, true);
-        if (__sen)
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        try
         {
-            if (this->rdbuf() == 0 || this->rdbuf()->sungetc() == traits_type::eof())
-                this->setstate(ios_base::badbit);
-        }
-        else
-            this->setstate(ios_base::failbit);
-#ifndef _LIBCPP_NO_EXCEPTIONS
-    }
-    catch (...)
-    {
-        this->__set_badbit_and_consider_rethrow();
-    }
 #endif  // _LIBCPP_NO_EXCEPTIONS
+            if (this->rdbuf() == 0 || this->rdbuf()->sungetc() == traits_type::eof())
+                __state |= ios_base::badbit;
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        }
+        catch (...)
+        {
+            __state |= ios_base::badbit;
+            this->__setstate_nothrow(__state);
+            if (this->exceptions() & ios_base::badbit)
+            {
+                throw;
+            }
+        }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    }
+    else
+    {
+        __state |= ios_base::failbit;
+    }
+    this->setstate(__state);
     return *this;
 }
 
@@ -1119,29 +1206,36 @@
 int
 basic_istream<_CharT, _Traits>::sync()
 {
+    ios_base::iostate __state = ios_base::goodbit;
     int __r = 0;
-#ifndef _LIBCPP_NO_EXCEPTIONS
-    try
+    sentry __sen(*this, true);
+    if (__sen)
     {
-#endif  // _LIBCPP_NO_EXCEPTIONS
-        sentry __sen(*this, true);
-        if (__sen)
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        try
         {
+#endif  // _LIBCPP_NO_EXCEPTIONS
             if (this->rdbuf() == 0)
                 return -1;
             if (this->rdbuf()->pubsync() == -1)
             {
-                this->setstate(ios_base::badbit);
+                __state |= ios_base::badbit;
                 return -1;
             }
-        }
 #ifndef _LIBCPP_NO_EXCEPTIONS
-    }
-    catch (...)
-    {
-        this->__set_badbit_and_consider_rethrow();
-    }
+        }
+        catch (...)
+        {
+            __state |= ios_base::badbit;
+            this->__setstate_nothrow(__state);
+            if (this->exceptions() & ios_base::badbit)
+            {
+                throw;
+            }
+        }
 #endif  // _LIBCPP_NO_EXCEPTIONS
+        this->setstate(__state);
+    }
     return __r;
 }
 
@@ -1149,21 +1243,30 @@
 typename basic_istream<_CharT, _Traits>::pos_type
 basic_istream<_CharT, _Traits>::tellg()
 {
+    ios_base::iostate __state = ios_base::goodbit;
     pos_type __r(-1);
-#ifndef _LIBCPP_NO_EXCEPTIONS
-    try
+    sentry __sen(*this, true);
+    if (__sen)
     {
-#endif  // _LIBCPP_NO_EXCEPTIONS
-        sentry __sen(*this, true);
-        if (__sen)
-            __r = this->rdbuf()->pubseekoff(0, ios_base::cur, ios_base::in);
 #ifndef _LIBCPP_NO_EXCEPTIONS
-    }
-    catch (...)
-    {
-        this->__set_badbit_and_consider_rethrow();
-    }
+        try
+        {
 #endif  // _LIBCPP_NO_EXCEPTIONS
+        __r = this->rdbuf()->pubseekoff(0, ios_base::cur, ios_base::in);
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        }
+        catch (...)
+        {
+            __state |= ios_base::badbit;
+            this->__setstate_nothrow(__state);
+            if (this->exceptions() & ios_base::badbit)
+            {
+                throw;
+            }
+        }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        this->setstate(__state);
+    }
     return __r;
 }
 
@@ -1171,24 +1274,31 @@
 basic_istream<_CharT, _Traits>&
 basic_istream<_CharT, _Traits>::seekg(pos_type __pos)
 {
-#ifndef _LIBCPP_NO_EXCEPTIONS
-    try
+    ios_base::iostate __state = this->rdstate() & ~ios_base::eofbit;
+    this->clear(__state);
+    sentry __sen(*this, true);
+    if (__sen)
     {
-#endif  // _LIBCPP_NO_EXCEPTIONS
-        this->clear(this->rdstate() & ~ios_base::eofbit);
-        sentry __sen(*this, true);
-        if (__sen)
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        try
         {
-            if (this->rdbuf()->pubseekpos(__pos, ios_base::in) == pos_type(-1))
-                this->setstate(ios_base::failbit);
-        }
-#ifndef _LIBCPP_NO_EXCEPTIONS
-    }
-    catch (...)
-    {
-        this->__set_badbit_and_consider_rethrow();
-    }
 #endif  // _LIBCPP_NO_EXCEPTIONS
+            if (this->rdbuf()->pubseekpos(__pos, ios_base::in) == pos_type(-1))
+                __state |= ios_base::failbit;
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        }
+        catch (...)
+        {
+            __state |= ios_base::badbit;
+            this->__setstate_nothrow(__state);
+            if (this->exceptions() & ios_base::badbit)
+            {
+                throw;
+            }
+        }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        this->setstate(__state);
+    }
     return *this;
 }
 
@@ -1196,24 +1306,31 @@
 basic_istream<_CharT, _Traits>&
 basic_istream<_CharT, _Traits>::seekg(off_type __off, ios_base::seekdir __dir)
 {
-#ifndef _LIBCPP_NO_EXCEPTIONS
-    try
+    ios_base::iostate __state = this->rdstate() & ~ios_base::eofbit;
+    this->clear(__state);
+    sentry __sen(*this, true);
+    if (__sen)
     {
-#endif  // _LIBCPP_NO_EXCEPTIONS
-        this->clear(this->rdstate() & ~ios_base::eofbit);
-        sentry __sen(*this, true);
-        if (__sen)
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        try
         {
-            if (this->rdbuf()->pubseekoff(__off, __dir, ios_base::in) == pos_type(-1))
-                this->setstate(ios_base::failbit);
-        }
-#ifndef _LIBCPP_NO_EXCEPTIONS
-    }
-    catch (...)
-    {
-        this->__set_badbit_and_consider_rethrow();
-    }
 #endif  // _LIBCPP_NO_EXCEPTIONS
+            if (this->rdbuf()->pubseekoff(__off, __dir, ios_base::in) == pos_type(-1))
+                __state |= ios_base::failbit;
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        }
+        catch (...)
+        {
+            __state |= ios_base::badbit;
+            this->__setstate_nothrow(__state);
+            if (this->exceptions() & ios_base::badbit)
+            {
+                throw;
+            }
+        }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        this->setstate(__state);
+    }
     return *this;
 }
 
@@ -1221,34 +1338,41 @@
 basic_istream<_CharT, _Traits>&
 ws(basic_istream<_CharT, _Traits>& __is)
 {
-#ifndef _LIBCPP_NO_EXCEPTIONS
-    try
+    ios_base::iostate __state = ios_base::goodbit;
+    typename basic_istream<_CharT, _Traits>::sentry __sen(__is, true);
+    if (__sen)
     {
-#endif  // _LIBCPP_NO_EXCEPTIONS
-        typename basic_istream<_CharT, _Traits>::sentry __sen(__is, true);
-        if (__sen)
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        try
         {
+#endif  // _LIBCPP_NO_EXCEPTIONS
             const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc());
             while (true)
             {
                 typename _Traits::int_type __i = __is.rdbuf()->sgetc();
                 if (_Traits::eq_int_type(__i, _Traits::eof()))
                 {
-                   __is.setstate(ios_base::eofbit);
+                   __state |= ios_base::eofbit;
                    break;
                 }
                 if (!__ct.is(__ct.space, _Traits::to_char_type(__i)))
                     break;
                 __is.rdbuf()->sbumpc();
             }
-        }
 #ifndef _LIBCPP_NO_EXCEPTIONS
-    }
-    catch (...)
-    {
-        __is.__set_badbit_and_consider_rethrow();
-    }
+        }
+        catch (...)
+        {
+            __state |= ios_base::badbit;
+            __is.__setstate_nothrow(__state);
+            if (__is.exceptions() & ios_base::badbit)
+            {
+                throw;
+            }
+        }
 #endif  // _LIBCPP_NO_EXCEPTIONS
+        __is.setstate(__state);
+    }
     return __is;
 }
 
@@ -1297,7 +1421,6 @@
     inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
     void swap(basic_iostream& __rhs)
     { basic_istream<char_type, traits_type>::swap(__rhs); }
-public:
 };
 
 #ifndef _LIBCPP_CXX03_LANG
@@ -1328,13 +1451,14 @@
 operator>>(basic_istream<_CharT, _Traits>& __is,
            basic_string<_CharT, _Traits, _Allocator>& __str)
 {
-#ifndef _LIBCPP_NO_EXCEPTIONS
-    try
+    ios_base::iostate __state = ios_base::goodbit;
+    typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
+    if (__sen)
     {
-#endif  // _LIBCPP_NO_EXCEPTIONS
-        typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
-        if (__sen)
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        try
         {
+#endif
             __str.clear();
             streamsize __n = __is.width();
             if (__n <= 0)
@@ -1343,13 +1467,12 @@
                 __n = numeric_limits<streamsize>::max();
             streamsize __c = 0;
             const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc());
-            ios_base::iostate __err = ios_base::goodbit;
             while (__c < __n)
             {
                 typename _Traits::int_type __i = __is.rdbuf()->sgetc();
                 if (_Traits::eq_int_type(__i, _Traits::eof()))
                 {
-                   __err |= ios_base::eofbit;
+                   __state |= ios_base::eofbit;
                    break;
                 }
                 _CharT __ch = _Traits::to_char_type(__i);
@@ -1361,18 +1484,21 @@
             }
             __is.width(0);
             if (__c == 0)
-               __err |= ios_base::failbit;
-            __is.setstate(__err);
-        }
-        else
-            __is.setstate(ios_base::failbit);
+               __state |= ios_base::failbit;
 #ifndef _LIBCPP_NO_EXCEPTIONS
+        }
+        catch (...)
+        {
+            __state |= ios_base::badbit;
+            __is.__setstate_nothrow(__state);
+            if (__is.exceptions() & ios_base::badbit)
+            {
+                throw;
+            }
+        }
+#endif
+        __is.setstate(__state);
     }
-    catch (...)
-    {
-        __is.__set_badbit_and_consider_rethrow();
-    }
-#endif  // _LIBCPP_NO_EXCEPTIONS
     return __is;
 }
 
@@ -1381,22 +1507,22 @@
 getline(basic_istream<_CharT, _Traits>& __is,
         basic_string<_CharT, _Traits, _Allocator>& __str, _CharT __dlm)
 {
-#ifndef _LIBCPP_NO_EXCEPTIONS
-    try
+    ios_base::iostate __state = ios_base::goodbit;
+    typename basic_istream<_CharT, _Traits>::sentry __sen(__is, true);
+    if (__sen)
     {
-#endif  // _LIBCPP_NO_EXCEPTIONS
-        typename basic_istream<_CharT, _Traits>::sentry __sen(__is, true);
-        if (__sen)
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        try
         {
+#endif
             __str.clear();
-            ios_base::iostate __err = ios_base::goodbit;
             streamsize __extr = 0;
             while (true)
             {
                 typename _Traits::int_type __i = __is.rdbuf()->sbumpc();
                 if (_Traits::eq_int_type(__i, _Traits::eof()))
                 {
-                   __err |= ios_base::eofbit;
+                   __state |= ios_base::eofbit;
                    break;
                 }
                 ++__extr;
@@ -1406,21 +1532,26 @@
                 __str.push_back(__ch);
                 if (__str.size() == __str.max_size())
                 {
-                    __err |= ios_base::failbit;
+                    __state |= ios_base::failbit;
                     break;
                 }
             }
             if (__extr == 0)
-               __err |= ios_base::failbit;
-            __is.setstate(__err);
-        }
+               __state |= ios_base::failbit;
 #ifndef _LIBCPP_NO_EXCEPTIONS
+        }
+        catch (...)
+        {
+            __state |= ios_base::badbit;
+            __is.__setstate_nothrow(__state);
+            if (__is.exceptions() & ios_base::badbit)
+            {
+                throw;
+            }
+        }
+#endif
+        __is.setstate(__state);
     }
-    catch (...)
-    {
-        __is.__set_badbit_and_consider_rethrow();
-    }
-#endif  // _LIBCPP_NO_EXCEPTIONS
     return __is;
 }
 
@@ -1459,17 +1590,17 @@
 basic_istream<_CharT, _Traits>&
 operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x)
 {
-#ifndef _LIBCPP_NO_EXCEPTIONS
-    try
+    ios_base::iostate __state = ios_base::goodbit;
+    typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
+    if (__sen)
     {
-#endif  // _LIBCPP_NO_EXCEPTIONS
-        typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
-        if (__sen)
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        try
         {
+#endif
             basic_string<_CharT, _Traits> __str;
             const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc());
             size_t __c = 0;
-            ios_base::iostate __err = ios_base::goodbit;
             _CharT __zero = __ct.widen('0');
             _CharT __one = __ct.widen('1');
             while (__c < _Size)
@@ -1477,7 +1608,7 @@
                 typename _Traits::int_type __i = __is.rdbuf()->sgetc();
                 if (_Traits::eq_int_type(__i, _Traits::eof()))
                 {
-                   __err |= ios_base::eofbit;
+                   __state |= ios_base::eofbit;
                    break;
                 }
                 _CharT __ch = _Traits::to_char_type(__i);
@@ -1489,18 +1620,21 @@
             }
             __x = bitset<_Size>(__str);
             if (__c == 0)
-               __err |= ios_base::failbit;
-            __is.setstate(__err);
-        }
-        else
-            __is.setstate(ios_base::failbit);
+               __state |= ios_base::failbit;
 #ifndef _LIBCPP_NO_EXCEPTIONS
+        }
+        catch (...)
+        {
+            __state |= ios_base::badbit;
+            __is.__setstate_nothrow(__state);
+            if (__is.exceptions() & ios_base::badbit)
+            {
+                throw;
+            }
+        }
+#endif
+        __is.setstate(__state);
     }
-    catch (...)
-    {
-        __is.__set_badbit_and_consider_rethrow();
-    }
-#endif  // _LIBCPP_NO_EXCEPTIONS
     return __is;
 }
 
diff --git a/linux-x64/clang/include/c++/v1/iterator b/linux-x64/clang/include/c++/v1/iterator
index 242f188..30801ea 100644
--- a/linux-x64/clang/include/c++/v1/iterator
+++ b/linux-x64/clang/include/c++/v1/iterator
@@ -69,7 +69,7 @@
 
 template <class BidirectionalIterator>  // constexpr in C++17
   constexpr BidirectionalIterator prev(BidirectionalIterator x,
-    typename iterator_traits<BidirectionalIterator>::difference_type n = 1);    
+    typename iterator_traits<BidirectionalIterator>::difference_type n = 1);
 
 template <class Iterator>
 class reverse_iterator
@@ -136,7 +136,7 @@
 
 template <class Iterator>
 constexpr reverse_iterator<Iterator>
-operator+(typename reverse_iterator<Iterator>::difference_type n, 
+operator+(typename reverse_iterator<Iterator>::difference_type n,
           const reverse_iterator<Iterator>& x);   // constexpr in C++17
 
 template <class Iterator>
@@ -216,7 +216,7 @@
     typedef typename iterator_traits<Iterator>::value_type        value_type;
     typedef typename iterator_traits<Iterator>::iterator_category iterator_category;
     typedef value_type&&                                          reference;
- 
+
     constexpr move_iterator();  // all the constexprs are in C++17
     constexpr explicit move_iterator(Iterator i);
     template <class U>
@@ -230,10 +230,10 @@
     constexpr move_iterator operator++(int);
     constexpr move_iterator& operator--();
     constexpr move_iterator operator--(int);
-    constexpr move_iterator operator+(difference_type n) const; 
-    constexpr move_iterator& operator+=(difference_type n); 
-    constexpr move_iterator operator-(difference_type n) const; 
-    constexpr move_iterator& operator-=(difference_type n); 
+    constexpr move_iterator operator+(difference_type n) const;
+    constexpr move_iterator& operator+=(difference_type n);
+    constexpr move_iterator operator-(difference_type n) const;
+    constexpr move_iterator& operator-=(difference_type n);
     constexpr unspecified operator[](difference_type n) const;
 private:
     Iterator current; // exposition only
@@ -270,7 +270,7 @@
 
 template <class Iterator>
 constexpr move_iterator<Iterator> operator+(   // constexpr in C++17
-            typename move_iterator<Iterator>::difference_type n, 
+            typename move_iterator<Iterator>::difference_type n,
             const move_iterator<Iterator>& x);
 
 template <class Iterator>   // constexpr in C++17
@@ -399,6 +399,11 @@
 // 24.8, container access:
 template <class C> constexpr auto size(const C& c) -> decltype(c.size());         // C++17
 template <class T, size_t N> constexpr size_t size(const T (&array)[N]) noexcept; // C++17
+
+template <class C> constexpr auto ssize(const C& c)
+    -> common_type_t<ptrdiff_t, make_signed_t<decltype(c.size())>>;				       // C++20
+template <class T, ptrdiff_t> constexpr ptrdiff_t ssize(const T (&array)[N]) noexcept; // C++20
+
 template <class C> constexpr auto empty(const C& c) -> decltype(c.empty());       // C++17
 template <class T, size_t N> constexpr bool empty(const T (&array)[N]) noexcept;  // C++17
 template <class E> constexpr bool empty(initializer_list<E> il) noexcept;         // C++17
@@ -529,10 +534,26 @@
 
 template <class _Tp>
 struct __is_exactly_input_iterator
-    : public integral_constant<bool, 
-         __has_iterator_category_convertible_to<_Tp, input_iterator_tag>::value && 
+    : public integral_constant<bool,
+         __has_iterator_category_convertible_to<_Tp, input_iterator_tag>::value &&
         !__has_iterator_category_convertible_to<_Tp, forward_iterator_tag>::value> {};
 
+#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
+template<class _InputIterator>
+using __iter_value_type = typename iterator_traits<_InputIterator>::value_type;
+
+template<class _InputIterator>
+using __iter_key_type = remove_const_t<typename iterator_traits<_InputIterator>::value_type::first_type>;
+
+template<class _InputIterator>
+using __iter_mapped_type = typename iterator_traits<_InputIterator>::value_type::second_type;
+
+template<class _InputIterator>
+using __iter_to_alloc_type = pair<
+    add_const_t<typename iterator_traits<_InputIterator>::value_type::first_type>,
+    typename iterator_traits<_InputIterator>::value_type::second_type>;
+#endif
+
 template<class _Category, class _Tp, class _Distance = ptrdiff_t,
          class _Pointer = _Tp*, class _Reference = _Tp&>
 struct _LIBCPP_TEMPLATE_VIS iterator
@@ -579,6 +600,8 @@
 void advance(_InputIter& __i,
              typename iterator_traits<_InputIter>::difference_type __n)
 {
+    _LIBCPP_ASSERT(__n >= 0 || __is_bidirectional_iterator<_InputIter>::value,
+                       "Attempt to advance(it, -n) on a non-bidi iterator");
     __advance(__i, __n, typename iterator_traits<_InputIter>::iterator_category());
 }
 
@@ -613,26 +636,31 @@
 inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
 typename enable_if
 <
-    __is_input_iterator<_InputIter>::value, 
+    __is_input_iterator<_InputIter>::value,
     _InputIter
 >::type
 next(_InputIter __x,
      typename iterator_traits<_InputIter>::difference_type __n = 1)
 {
+    _LIBCPP_ASSERT(__n >= 0 || __is_bidirectional_iterator<_InputIter>::value,
+                       "Attempt to next(it, -n) on a non-bidi iterator");
+
     _VSTD::advance(__x, __n);
     return __x;
 }
 
-template <class _BidirectionalIter>
+template <class _InputIter>
 inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
 typename enable_if
 <
-    __is_bidirectional_iterator<_BidirectionalIter>::value, 
-    _BidirectionalIter
+    __is_input_iterator<_InputIter>::value,
+    _InputIter
 >::type
-prev(_BidirectionalIter __x,
-     typename iterator_traits<_BidirectionalIter>::difference_type __n = 1)
+prev(_InputIter __x,
+     typename iterator_traits<_InputIter>::difference_type __n = 1)
 {
+    _LIBCPP_ASSERT(__n <= 0 || __is_bidirectional_iterator<_InputIter>::value,
+                       "Attempt to prev(it, +n) on a non-bidi iterator");
     _VSTD::advance(__x, -__n);
     return __x;
 }
@@ -1078,10 +1106,6 @@
     _LIBCPP_INLINE_VISIBILITY ostreambuf_iterator& operator++(int) {return *this;}
     _LIBCPP_INLINE_VISIBILITY bool failed() const _NOEXCEPT {return __sbuf_ == 0;}
 
-#if !defined(__APPLE__) || \
-    (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED > __MAC_10_8) || \
-    (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED > __IPHONE_6_0)
-
     template <class _Ch, class _Tr>
     friend
     _LIBCPP_HIDDEN
@@ -1089,7 +1113,6 @@
     __pad_and_output(ostreambuf_iterator<_Ch, _Tr> __s,
                      const _Ch* __ob, const _Ch* __op, const _Ch* __oe,
                      ios_base& __iob, _Ch __fl);
-#endif
 };
 
 template <class _Iter>
@@ -1122,7 +1145,7 @@
       _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
       move_iterator(const move_iterator<_Up>& __u) : __i(__u.base()) {}
     _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 _Iter base() const {return __i;}
-    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
     reference operator*() const { return static_cast<reference>(*__i); }
     _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
     pointer  operator->() const { return __i;}
@@ -1236,50 +1259,50 @@
 template <class _Iter1, class _Iter2>
 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
 bool
-operator==(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG;
+operator==(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
 
 template <class _Iter1, class _Iter2>
 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
 bool
-operator<(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG;
+operator<(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
 
 template <class _Iter1, class _Iter2>
 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
 bool
-operator!=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG;
+operator!=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
 
 template <class _Iter1, class _Iter2>
 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
 bool
-operator>(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG;
+operator>(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
 
 template <class _Iter1, class _Iter2>
 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
 bool
-operator>=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG;
+operator>=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
 
 template <class _Iter1, class _Iter2>
 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
 bool
-operator<=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG;
+operator<=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
 
 #ifndef _LIBCPP_CXX03_LANG
 template <class _Iter1, class _Iter2>
 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
 auto
-operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT_DEBUG
+operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
 -> decltype(__x.base() - __y.base());
 #else
 template <class _Iter1, class _Iter2>
 _LIBCPP_INLINE_VISIBILITY
 typename __wrap_iter<_Iter1>::difference_type
-operator-(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG;
+operator-(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
 #endif
 
 template <class _Iter>
 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
 __wrap_iter<_Iter>
-operator+(typename __wrap_iter<_Iter>::difference_type, __wrap_iter<_Iter>) _NOEXCEPT_DEBUG;
+operator+(typename __wrap_iter<_Iter>::difference_type, __wrap_iter<_Iter>) _NOEXCEPT;
 
 template <class _Ip, class _Op> _Op _LIBCPP_INLINE_VISIBILITY copy(_Ip, _Ip, _Op);
 template <class _B1, class _B2> _B2 _LIBCPP_INLINE_VISIBILITY copy_backward(_B1, _B1, _B2);
@@ -1323,7 +1346,7 @@
 private:
     iterator_type __i;
 public:
-    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter() _NOEXCEPT_DEBUG
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter() _NOEXCEPT
 #if _LIBCPP_STD_VER > 11
                 : __i{}
 #endif
@@ -1334,7 +1357,7 @@
     }
     template <class _Up> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
         __wrap_iter(const __wrap_iter<_Up>& __u,
-            typename enable_if<is_convertible<_Up, iterator_type>::value>::type* = 0) _NOEXCEPT_DEBUG
+            typename enable_if<is_convertible<_Up, iterator_type>::value>::type* = 0) _NOEXCEPT
             : __i(__u.base())
     {
 #if _LIBCPP_DEBUG_LEVEL >= 2
@@ -1364,7 +1387,7 @@
         __get_db()->__erase_i(this);
     }
 #endif
-    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG reference operator*() const _NOEXCEPT_DEBUG
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG reference operator*() const _NOEXCEPT
     {
 #if _LIBCPP_DEBUG_LEVEL >= 2
         _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
@@ -1372,7 +1395,7 @@
 #endif
         return *__i;
     }
-    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG pointer  operator->() const _NOEXCEPT_DEBUG
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG pointer  operator->() const _NOEXCEPT
     {
 #if _LIBCPP_DEBUG_LEVEL >= 2
         _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
@@ -1380,7 +1403,7 @@
 #endif
         return (pointer)_VSTD::addressof(*__i);
     }
-    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter& operator++() _NOEXCEPT_DEBUG
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter& operator++() _NOEXCEPT
     {
 #if _LIBCPP_DEBUG_LEVEL >= 2
         _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
@@ -1389,10 +1412,10 @@
         ++__i;
         return *this;
     }
-    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter  operator++(int) _NOEXCEPT_DEBUG
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter  operator++(int) _NOEXCEPT
         {__wrap_iter __tmp(*this); ++(*this); return __tmp;}
 
-    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter& operator--() _NOEXCEPT_DEBUG
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter& operator--() _NOEXCEPT
     {
 #if _LIBCPP_DEBUG_LEVEL >= 2
         _LIBCPP_ASSERT(__get_const_db()->__decrementable(this),
@@ -1401,11 +1424,11 @@
         --__i;
         return *this;
     }
-    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter  operator--(int) _NOEXCEPT_DEBUG
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter  operator--(int) _NOEXCEPT
         {__wrap_iter __tmp(*this); --(*this); return __tmp;}
-    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter  operator+ (difference_type __n) const _NOEXCEPT_DEBUG
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter  operator+ (difference_type __n) const _NOEXCEPT
         {__wrap_iter __w(*this); __w += __n; return __w;}
-    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter& operator+=(difference_type __n) _NOEXCEPT_DEBUG
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter& operator+=(difference_type __n) _NOEXCEPT
     {
 #if _LIBCPP_DEBUG_LEVEL >= 2
         _LIBCPP_ASSERT(__get_const_db()->__addable(this, __n),
@@ -1414,11 +1437,11 @@
         __i += __n;
         return *this;
     }
-    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter  operator- (difference_type __n) const _NOEXCEPT_DEBUG
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter  operator- (difference_type __n) const _NOEXCEPT
         {return *this + (-__n);}
-    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter& operator-=(difference_type __n) _NOEXCEPT_DEBUG
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter& operator-=(difference_type __n) _NOEXCEPT
         {*this += -__n; return *this;}
-    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG reference    operator[](difference_type __n) const _NOEXCEPT_DEBUG
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG reference    operator[](difference_type __n) const _NOEXCEPT
     {
 #if _LIBCPP_DEBUG_LEVEL >= 2
         _LIBCPP_ASSERT(__get_const_db()->__subscriptable(this, __n),
@@ -1427,7 +1450,7 @@
         return __i[__n];
     }
 
-    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG iterator_type base() const _NOEXCEPT_DEBUG {return __i;}
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG iterator_type base() const _NOEXCEPT {return __i;}
 
 private:
 #if _LIBCPP_DEBUG_LEVEL >= 2
@@ -1436,61 +1459,61 @@
         __get_db()->__insert_ic(this, __p);
     }
 #else
-    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter(iterator_type __x) _NOEXCEPT_DEBUG : __i(__x) {}
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter(iterator_type __x) _NOEXCEPT : __i(__x) {}
 #endif
 
     template <class _Up> friend class __wrap_iter;
     template <class _CharT, class _Traits, class _Alloc> friend class basic_string;
     template <class _Tp, class _Alloc> friend class _LIBCPP_TEMPLATE_VIS vector;
-    template <class _Tp, ptrdiff_t> friend class _LIBCPP_TEMPLATE_VIS span;
+    template <class _Tp, size_t> friend class _LIBCPP_TEMPLATE_VIS span;
 
     template <class _Iter1, class _Iter2>
     _LIBCPP_CONSTEXPR_IF_NODEBUG friend
     bool
-    operator==(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG;
+    operator==(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
 
     template <class _Iter1, class _Iter2>
     _LIBCPP_CONSTEXPR_IF_NODEBUG friend
     bool
-    operator<(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG;
+    operator<(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
 
     template <class _Iter1, class _Iter2>
     _LIBCPP_CONSTEXPR_IF_NODEBUG friend
     bool
-    operator!=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG;
+    operator!=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
 
     template <class _Iter1, class _Iter2>
     _LIBCPP_CONSTEXPR_IF_NODEBUG friend
     bool
-    operator>(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG;
+    operator>(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
 
     template <class _Iter1, class _Iter2>
     _LIBCPP_CONSTEXPR_IF_NODEBUG friend
     bool
-    operator>=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG;
+    operator>=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
 
     template <class _Iter1, class _Iter2>
     _LIBCPP_CONSTEXPR_IF_NODEBUG friend
     bool
-    operator<=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG;
+    operator<=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
 
 #ifndef _LIBCPP_CXX03_LANG
     template <class _Iter1, class _Iter2>
     _LIBCPP_CONSTEXPR_IF_NODEBUG friend
     auto
-    operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT_DEBUG
+    operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
     -> decltype(__x.base() - __y.base());
 #else
     template <class _Iter1, class _Iter2>
     _LIBCPP_CONSTEXPR_IF_NODEBUG friend
     typename __wrap_iter<_Iter1>::difference_type
-    operator-(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG;
+    operator-(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
 #endif
 
     template <class _Iter1>
     _LIBCPP_CONSTEXPR_IF_NODEBUG friend
     __wrap_iter<_Iter1>
-    operator+(typename __wrap_iter<_Iter1>::difference_type, __wrap_iter<_Iter1>) _NOEXCEPT_DEBUG;
+    operator+(typename __wrap_iter<_Iter1>::difference_type, __wrap_iter<_Iter1>) _NOEXCEPT;
 
     template <class _Ip, class _Op> friend _Op copy(_Ip, _Ip, _Op);
     template <class _B1, class _B2> friend _B2 copy_backward(_B1, _B1, _B2);
@@ -1521,7 +1544,7 @@
 template <class _Iter1, class _Iter2>
 inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
 bool
-operator==(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT_DEBUG
+operator==(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
 {
     return __x.base() == __y.base();
 }
@@ -1529,7 +1552,7 @@
 template <class _Iter1, class _Iter2>
 inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
 bool
-operator<(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT_DEBUG
+operator<(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
 {
 #if _LIBCPP_DEBUG_LEVEL >= 2
     _LIBCPP_ASSERT(__get_const_db()->__less_than_comparable(&__x, &__y),
@@ -1541,7 +1564,7 @@
 template <class _Iter1, class _Iter2>
 inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
 bool
-operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT_DEBUG
+operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
 {
     return !(__x == __y);
 }
@@ -1549,7 +1572,7 @@
 template <class _Iter1, class _Iter2>
 inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
 bool
-operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT_DEBUG
+operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
 {
     return __y < __x;
 }
@@ -1557,7 +1580,7 @@
 template <class _Iter1, class _Iter2>
 inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
 bool
-operator>=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT_DEBUG
+operator>=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
 {
     return !(__x < __y);
 }
@@ -1565,7 +1588,7 @@
 template <class _Iter1, class _Iter2>
 inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
 bool
-operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT_DEBUG
+operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
 {
     return !(__y < __x);
 }
@@ -1573,7 +1596,7 @@
 template <class _Iter1>
 inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
 bool
-operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT_DEBUG
+operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT
 {
     return !(__x == __y);
 }
@@ -1581,7 +1604,7 @@
 template <class _Iter1>
 inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
 bool
-operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT_DEBUG
+operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT
 {
     return __y < __x;
 }
@@ -1589,7 +1612,7 @@
 template <class _Iter1>
 inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
 bool
-operator>=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT_DEBUG
+operator>=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT
 {
     return !(__x < __y);
 }
@@ -1597,7 +1620,7 @@
 template <class _Iter1>
 inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
 bool
-operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT_DEBUG
+operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT
 {
     return !(__y < __x);
 }
@@ -1606,7 +1629,7 @@
 template <class _Iter1, class _Iter2>
 inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
 auto
-operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT_DEBUG
+operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
 -> decltype(__x.base() - __y.base())
 {
 #if _LIBCPP_DEBUG_LEVEL >= 2
@@ -1619,7 +1642,7 @@
 template <class _Iter1, class _Iter2>
 inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
 typename __wrap_iter<_Iter1>::difference_type
-operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT_DEBUG
+operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
 {
 #if _LIBCPP_DEBUG_LEVEL >= 2
     _LIBCPP_ASSERT(__get_const_db()->__less_than_comparable(&__x, &__y),
@@ -1633,7 +1656,7 @@
 inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
 __wrap_iter<_Iter>
 operator+(typename __wrap_iter<_Iter>::difference_type __n,
-          __wrap_iter<_Iter> __x) _NOEXCEPT_DEBUG
+          __wrap_iter<_Iter> __x) _NOEXCEPT
 {
     __x += __n;
     return __x;
@@ -1642,7 +1665,7 @@
 template <class _Iter>
 struct __libcpp_is_trivial_iterator
     : public _LIBCPP_BOOL_CONSTANT(is_pointer<_Iter>::value) {};
-    
+
 template <class _Iter>
 struct __libcpp_is_trivial_iterator<move_iterator<_Iter> >
     : public _LIBCPP_BOOL_CONSTANT(__libcpp_is_trivial_iterator<_Iter>::value) {};
@@ -1657,7 +1680,7 @@
 
 
 template <class _Tp, size_t _Np>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
 _Tp*
 begin(_Tp (&__array)[_Np])
 {
@@ -1665,7 +1688,7 @@
 }
 
 template <class _Tp, size_t _Np>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
 _Tp*
 end(_Tp (&__array)[_Np])
 {
@@ -1675,7 +1698,7 @@
 #if !defined(_LIBCPP_CXX03_LANG)
 
 template <class _Cp>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
 auto
 begin(_Cp& __c) -> decltype(__c.begin())
 {
@@ -1683,7 +1706,7 @@
 }
 
 template <class _Cp>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
 auto
 begin(const _Cp& __c) -> decltype(__c.begin())
 {
@@ -1691,7 +1714,7 @@
 }
 
 template <class _Cp>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
 auto
 end(_Cp& __c) -> decltype(__c.end())
 {
@@ -1699,7 +1722,7 @@
 }
 
 template <class _Cp>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
 auto
 end(const _Cp& __c) -> decltype(__c.end())
 {
@@ -1709,84 +1732,84 @@
 #if _LIBCPP_STD_VER > 11
 
 template <class _Tp, size_t _Np>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
 reverse_iterator<_Tp*> rbegin(_Tp (&__array)[_Np])
 {
     return reverse_iterator<_Tp*>(__array + _Np);
 }
 
 template <class _Tp, size_t _Np>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
 reverse_iterator<_Tp*> rend(_Tp (&__array)[_Np])
 {
     return reverse_iterator<_Tp*>(__array);
 }
 
 template <class _Ep>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
 reverse_iterator<const _Ep*> rbegin(initializer_list<_Ep> __il)
 {
     return reverse_iterator<const _Ep*>(__il.end());
 }
 
 template <class _Ep>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
 reverse_iterator<const _Ep*> rend(initializer_list<_Ep> __il)
 {
     return reverse_iterator<const _Ep*>(__il.begin());
 }
 
 template <class _Cp>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
 auto cbegin(const _Cp& __c) -> decltype(_VSTD::begin(__c))
 {
     return _VSTD::begin(__c);
 }
 
 template <class _Cp>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
 auto cend(const _Cp& __c) -> decltype(_VSTD::end(__c))
 {
     return _VSTD::end(__c);
 }
 
 template <class _Cp>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
 auto rbegin(_Cp& __c) -> decltype(__c.rbegin())
 {
     return __c.rbegin();
 }
 
 template <class _Cp>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
 auto rbegin(const _Cp& __c) -> decltype(__c.rbegin())
 {
     return __c.rbegin();
 }
 
 template <class _Cp>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
 auto rend(_Cp& __c) -> decltype(__c.rend())
 {
     return __c.rend();
 }
 
 template <class _Cp>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
 auto rend(const _Cp& __c) -> decltype(__c.rend())
 {
     return __c.rend();
 }
 
 template <class _Cp>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
 auto crbegin(const _Cp& __c) -> decltype(_VSTD::rbegin(__c))
 {
     return _VSTD::rbegin(__c);
 }
 
 template <class _Cp>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
 auto crend(const _Cp& __c) -> decltype(_VSTD::rend(__c))
 {
     return _VSTD::rend(__c);
@@ -1798,7 +1821,7 @@
 #else  // defined(_LIBCPP_CXX03_LANG)
 
 template <class _Cp>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY
 typename _Cp::iterator
 begin(_Cp& __c)
 {
@@ -1806,7 +1829,7 @@
 }
 
 template <class _Cp>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY
 typename _Cp::const_iterator
 begin(const _Cp& __c)
 {
@@ -1814,7 +1837,7 @@
 }
 
 template <class _Cp>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY
 typename _Cp::iterator
 end(_Cp& __c)
 {
@@ -1822,7 +1845,7 @@
 }
 
 template <class _Cp>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY
 typename _Cp::const_iterator
 end(const _Cp& __c)
 {
@@ -1848,51 +1871,64 @@
 // #endif
 
 template <class _Cont>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY
 constexpr auto size(const _Cont& __c)
 _NOEXCEPT_(noexcept(__c.size()))
 -> decltype        (__c.size())
 { return            __c.size(); }
 
 template <class _Tp, size_t _Sz>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY
 constexpr size_t size(const _Tp (&)[_Sz]) noexcept { return _Sz; }
 
+#if _LIBCPP_STD_VER > 17
 template <class _Cont>
-_LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY
+constexpr auto ssize(const _Cont& __c)
+_NOEXCEPT_(noexcept(static_cast<common_type_t<ptrdiff_t, make_signed_t<decltype(__c.size())>>>(__c.size())))
+->                              common_type_t<ptrdiff_t, make_signed_t<decltype(__c.size())>>
+{ return            static_cast<common_type_t<ptrdiff_t, make_signed_t<decltype(__c.size())>>>(__c.size()); }
+
+template <class _Tp, ptrdiff_t _Sz>
+_LIBCPP_INLINE_VISIBILITY
+constexpr ptrdiff_t ssize(const _Tp (&)[_Sz]) noexcept { return _Sz; }
+#endif
+
+template <class _Cont>
+_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY
 constexpr auto empty(const _Cont& __c)
 _NOEXCEPT_(noexcept(__c.empty()))
 -> decltype        (__c.empty())
 { return            __c.empty(); }
 
 template <class _Tp, size_t _Sz>
-_LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY
 constexpr bool empty(const _Tp (&)[_Sz]) noexcept { return false; }
 
 template <class _Ep>
-_LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY
 constexpr bool empty(initializer_list<_Ep> __il) noexcept { return __il.size() == 0; }
 
 template <class _Cont> constexpr
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY
 auto data(_Cont& __c)
 _NOEXCEPT_(noexcept(__c.data()))
 -> decltype        (__c.data())
 { return            __c.data(); }
 
 template <class _Cont> constexpr
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY
 auto data(const _Cont& __c)
 _NOEXCEPT_(noexcept(__c.data()))
--> decltype        (__c.data()) 
+-> decltype        (__c.data())
 { return            __c.data(); }
 
 template <class _Tp, size_t _Sz>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY
 constexpr _Tp* data(_Tp (&__array)[_Sz]) noexcept { return __array; }
 
 template <class _Ep>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY
 constexpr const _Ep* data(initializer_list<_Ep> __il) noexcept { return __il.begin(); }
 #endif
 
diff --git a/linux-x64/clang/include/c++/v1/limits b/linux-x64/clang/include/c++/v1/limits
index 82c1ea1..6d5d1e1 100644
--- a/linux-x64/clang/include/c++/v1/limits
+++ b/linux-x64/clang/include/c++/v1/limits
@@ -409,7 +409,7 @@
     static _LIBCPP_CONSTEXPR const bool is_exact = false;
     static _LIBCPP_CONSTEXPR const int  radix = __FLT_RADIX__;
     _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return __LDBL_EPSILON__;}
-    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return 0.5;}
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return 0.5L;}
 
     static _LIBCPP_CONSTEXPR const int  min_exponent = __LDBL_MIN_EXP__;
     static _LIBCPP_CONSTEXPR const int  min_exponent10 = __LDBL_MIN_10_EXP__;
diff --git a/linux-x64/clang/include/c++/v1/list b/linux-x64/clang/include/c++/v1/list
index 2afe2a2..c92ef79 100644
--- a/linux-x64/clang/include/c++/v1/list
+++ b/linux-x64/clang/include/c++/v1/list
@@ -129,11 +129,12 @@
     void splice(const_iterator position, list&& x, const_iterator first,
                                                   const_iterator last);
 
-    void remove(const value_type& value);
-    template <class Pred> void remove_if(Pred pred);
-    void unique();
+    size_type remove(const value_type& value);       // void before C++20
+    template <class Pred>
+      size_type remove_if(Pred pred);                // void before C++20
+    size_type unique();                              // void before C++20
     template <class BinaryPredicate>
-        void unique(BinaryPredicate binary_pred);
+      size_type unique(BinaryPredicate binary_pred); // void before C++20
     void merge(list& x);
     void merge(list&& x);
     template <class Compare>
@@ -647,9 +648,9 @@
 
     void swap(__list_imp& __c)
 #if _LIBCPP_STD_VER >= 14
-        _NOEXCEPT_DEBUG;
+        _NOEXCEPT;
 #else
-        _NOEXCEPT_DEBUG_(!__alloc_traits::propagate_on_container_swap::value ||
+        _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
                     __is_nothrow_swappable<allocator_type>::value);
 #endif
 
@@ -769,9 +770,9 @@
 void
 __list_imp<_Tp, _Alloc>::swap(__list_imp& __c)
 #if _LIBCPP_STD_VER >= 14
-        _NOEXCEPT_DEBUG
+        _NOEXCEPT
 #else
-        _NOEXCEPT_DEBUG_(!__alloc_traits::propagate_on_container_swap::value ||
+        _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
                     __is_nothrow_swappable<allocator_type>::value)
 #endif
 {
@@ -857,6 +858,11 @@
     typedef typename base::const_iterator            const_iterator;
     typedef _VSTD::reverse_iterator<iterator>         reverse_iterator;
     typedef _VSTD::reverse_iterator<const_iterator>   const_reverse_iterator;
+#if _LIBCPP_STD_VER > 17
+    typedef size_type                                __remove_return_type;
+#else
+    typedef void                                     __remove_return_type;
+#endif
 
     _LIBCPP_INLINE_VISIBILITY
     list()
@@ -1038,9 +1044,9 @@
     _LIBCPP_INLINE_VISIBILITY
     void swap(list& __c)
 #if _LIBCPP_STD_VER >= 14
-        _NOEXCEPT_DEBUG
+        _NOEXCEPT
 #else
-        _NOEXCEPT_DEBUG_(!__node_alloc_traits::propagate_on_container_swap::value ||
+        _NOEXCEPT_(!__node_alloc_traits::propagate_on_container_swap::value ||
                    __is_nothrow_swappable<__node_allocator>::value)
 #endif
         {base::swap(__c);}
@@ -1070,12 +1076,12 @@
     void splice(const_iterator __p, list& __c, const_iterator __i);
     void splice(const_iterator __p, list& __c, const_iterator __f, const_iterator __l);
 
-    void remove(const value_type& __x);
-    template <class _Pred> void remove_if(_Pred __pred);
+    __remove_return_type remove(const value_type& __x);
+    template <class _Pred> __remove_return_type remove_if(_Pred __pred);
     _LIBCPP_INLINE_VISIBILITY
-    void unique();
+    __remove_return_type unique() { return unique(__equal_to<value_type>()); }
     template <class _BinaryPred>
-        void unique(_BinaryPred __binary_pred);
+        __remove_return_type unique(_BinaryPred __binary_pred);
     _LIBCPP_INLINE_VISIBILITY
     void merge(list& __c);
 #ifndef _LIBCPP_CXX03_LANG
@@ -2013,22 +2019,24 @@
         base::__sz() += __c.__sz();
         __c.__sz() = 0;
 #if _LIBCPP_DEBUG_LEVEL >= 2
-        __libcpp_db* __db = __get_db();
-        __c_node* __cn1 = __db->__find_c_and_lock(this);
-        __c_node* __cn2 = __db->__find_c(&__c);
-        for (__i_node** __ip = __cn2->end_; __ip != __cn2->beg_;)
-        {
-            --__ip;
-            iterator* __i = static_cast<iterator*>((*__ip)->__i_);
-            if (__i->__ptr_ != __c.__end_as_link())
+        if (&__c != this) {
+            __libcpp_db* __db = __get_db();
+            __c_node* __cn1 = __db->__find_c_and_lock(this);
+            __c_node* __cn2 = __db->__find_c(&__c);
+            for (__i_node** __ip = __cn2->end_; __ip != __cn2->beg_;)
             {
-                __cn1->__add(*__ip);
-                (*__ip)->__c_ = __cn1;
-                if (--__cn2->end_ != __ip)
-                    memmove(__ip, __ip+1, (__cn2->end_ - __ip)*sizeof(__i_node*));
+                --__ip;
+                iterator* __i = static_cast<iterator*>((*__ip)->__i_);
+                if (__i->__ptr_ != __c.__end_as_link())
+                {
+                    __cn1->__add(*__ip);
+                    (*__ip)->__c_ = __cn1;
+                    if (--__cn2->end_ != __ip)
+                        memmove(__ip, __ip+1, (__cn2->end_ - __ip)*sizeof(__i_node*));
+                }
             }
+            __db->unlock();
         }
-        __db->unlock();
 #endif
     }
 }
@@ -2056,22 +2064,24 @@
         --__c.__sz();
         ++base::__sz();
 #if _LIBCPP_DEBUG_LEVEL >= 2
-        __libcpp_db* __db = __get_db();
-        __c_node* __cn1 = __db->__find_c_and_lock(this);
-        __c_node* __cn2 = __db->__find_c(&__c);
-        for (__i_node** __ip = __cn2->end_; __ip != __cn2->beg_;)
-        {
-            --__ip;
-            iterator* __j = static_cast<iterator*>((*__ip)->__i_);
-            if (__j->__ptr_ == __f)
+        if (&__c != this) {
+            __libcpp_db* __db = __get_db();
+            __c_node* __cn1 = __db->__find_c_and_lock(this);
+            __c_node* __cn2 = __db->__find_c(&__c);
+            for (__i_node** __ip = __cn2->end_; __ip != __cn2->beg_;)
             {
-                __cn1->__add(*__ip);
-                (*__ip)->__c_ = __cn1;
-                if (--__cn2->end_ != __ip)
-                    memmove(__ip, __ip+1, (__cn2->end_ - __ip)*sizeof(__i_node*));
+                --__ip;
+                iterator* __j = static_cast<iterator*>((*__ip)->__i_);
+                if (__j->__ptr_ == __f)
+                {
+                    __cn1->__add(*__ip);
+                    (*__ip)->__c_ = __cn1;
+                    if (--__cn2->end_ != __ip)
+                        memmove(__ip, __ip+1, (__cn2->end_ - __ip)*sizeof(__i_node*));
+                }
             }
+            __db->unlock();
         }
-        __db->unlock();
 #endif
     }
 }
@@ -2110,32 +2120,34 @@
         base::__unlink_nodes(__first, __last);
         __link_nodes(__p.__ptr_, __first, __last);
 #if _LIBCPP_DEBUG_LEVEL >= 2
-        __libcpp_db* __db = __get_db();
-        __c_node* __cn1 = __db->__find_c_and_lock(this);
-        __c_node* __cn2 = __db->__find_c(&__c);
-        for (__i_node** __ip = __cn2->end_; __ip != __cn2->beg_;)
-        {
-            --__ip;
-            iterator* __j = static_cast<iterator*>((*__ip)->__i_);
-            for (__link_pointer __k = __f.__ptr_;
-                                          __k != __l.__ptr_; __k = __k->__next_)
+        if (&__c != this) {
+            __libcpp_db* __db = __get_db();
+            __c_node* __cn1 = __db->__find_c_and_lock(this);
+            __c_node* __cn2 = __db->__find_c(&__c);
+            for (__i_node** __ip = __cn2->end_; __ip != __cn2->beg_;)
             {
-                if (__j->__ptr_ == __k)
+                --__ip;
+                iterator* __j = static_cast<iterator*>((*__ip)->__i_);
+                for (__link_pointer __k = __f.__ptr_;
+                                              __k != __l.__ptr_; __k = __k->__next_)
                 {
-                    __cn1->__add(*__ip);
-                    (*__ip)->__c_ = __cn1;
-                    if (--__cn2->end_ != __ip)
-                        memmove(__ip, __ip+1, (__cn2->end_ - __ip)*sizeof(__i_node*));
+                    if (__j->__ptr_ == __k)
+                    {
+                        __cn1->__add(*__ip);
+                        (*__ip)->__c_ = __cn1;
+                        if (--__cn2->end_ != __ip)
+                            memmove(__ip, __ip+1, (__cn2->end_ - __ip)*sizeof(__i_node*));
+                    }
                 }
             }
+            __db->unlock();
         }
-        __db->unlock();
 #endif
     }
 }
 
 template <class _Tp, class _Alloc>
-void
+typename list<_Tp, _Alloc>::__remove_return_type
 list<_Tp, _Alloc>::remove(const value_type& __x)
 {
     list<_Tp, _Alloc> __deleted_nodes(get_allocator()); // collect the nodes we're removing
@@ -2154,13 +2166,16 @@
         else
             ++__i;
     }
+
+    return (__remove_return_type) __deleted_nodes.size();
 }
 
 template <class _Tp, class _Alloc>
 template <class _Pred>
-void
+typename list<_Tp, _Alloc>::__remove_return_type
 list<_Tp, _Alloc>::remove_if(_Pred __pred)
 {
+    list<_Tp, _Alloc> __deleted_nodes(get_allocator()); // collect the nodes we're removing
     for (iterator __i = begin(), __e = end(); __i != __e;)
     {
         if (__pred(*__i))
@@ -2168,36 +2183,36 @@
             iterator __j = _VSTD::next(__i);
             for (; __j != __e && __pred(*__j); ++__j)
                 ;
-            __i = erase(__i, __j);
+            __deleted_nodes.splice(__deleted_nodes.end(), *this, __i, __j);
+            __i = __j;
             if (__i != __e)
                 ++__i;
         }
         else
             ++__i;
     }
-}
 
-template <class _Tp, class _Alloc>
-inline
-void
-list<_Tp, _Alloc>::unique()
-{
-    unique(__equal_to<value_type>());
+    return (__remove_return_type) __deleted_nodes.size();
 }
 
 template <class _Tp, class _Alloc>
 template <class _BinaryPred>
-void
+typename list<_Tp, _Alloc>::__remove_return_type
 list<_Tp, _Alloc>::unique(_BinaryPred __binary_pred)
 {
+    list<_Tp, _Alloc> __deleted_nodes(get_allocator()); // collect the nodes we're removing
     for (iterator __i = begin(), __e = end(); __i != __e;)
     {
         iterator __j = _VSTD::next(__i);
         for (; __j != __e && __binary_pred(*__i, *__j); ++__j)
             ;
-        if (++__i != __j)
-            __i = erase(__i, __j);
+        if (++__i != __j) {
+            __deleted_nodes.splice(__deleted_nodes.end(), *this, __i, __j);
+            __i = __j;
+            }
     }
+    
+    return (__remove_return_type) __deleted_nodes.size();
 }
 
 template <class _Tp, class _Alloc>
diff --git a/linux-x64/clang/include/c++/v1/locale b/linux-x64/clang/include/c++/v1/locale
index c3c05eb..3fe4430 100644
--- a/linux-x64/clang/include/c++/v1/locale
+++ b/linux-x64/clang/include/c++/v1/locale
@@ -126,7 +126,7 @@
     wbuffer_convert(const wbuffer_convert&) = delete;               // C++14
     wbuffer_convert & operator=(const wbuffer_convert &) = delete;  // C++14
     ~wbuffer_convert();                                             // C++14
-    
+
     streambuf* rdbuf() const;
     streambuf* rdbuf(streambuf* bytebuf);
 
@@ -1372,10 +1372,6 @@
     return __s;
 }
 
-#if !defined(__APPLE__) || \
-    (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED > __MAC_10_8) || \
-    (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED > __IPHONE_6_0)
-
 template <class _CharT, class _Traits>
 _LIBCPP_HIDDEN
 ostreambuf_iterator<_CharT, _Traits>
@@ -1422,8 +1418,6 @@
     return __s;
 }
 
-#endif
-
 template <class _CharT, class _OutputIterator>
 _OutputIterator
 num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
@@ -3929,7 +3923,7 @@
     wbuffer_convert(const wbuffer_convert&);
     wbuffer_convert& operator=(const wbuffer_convert&);
 public:
-    _LIBCPP_EXPLICIT_AFTER_CXX11 wbuffer_convert(streambuf* __bytebuf = 0, 
+    _LIBCPP_EXPLICIT_AFTER_CXX11 wbuffer_convert(streambuf* __bytebuf = 0,
             _Codecvt* __pcvt = new _Codecvt, state_type __state = state_type());
     ~wbuffer_convert();
 
@@ -4044,7 +4038,7 @@
                                        this->egptr(), __inext);
                 if (__r == codecvt_base::noconv)
                 {
-                    this->setg((char_type*)__extbuf_, (char_type*)__extbuf_, 
+                    this->setg((char_type*)__extbuf_, (char_type*)__extbuf_,
                                (char_type*) const_cast<char *>(__extbufend_));
                     __c = *this->gptr();
                 }
diff --git a/linux-x64/clang/include/c++/v1/map b/linux-x64/clang/include/c++/v1/map
index e21dd5a..6805a51 100644
--- a/linux-x64/clang/include/c++/v1/map
+++ b/linux-x64/clang/include/c++/v1/map
@@ -902,12 +902,11 @@
     typedef _Key                                     key_type;
     typedef _Tp                                      mapped_type;
     typedef pair<const key_type, mapped_type>        value_type;
-    typedef _Compare                                 key_compare;
-    typedef _Allocator                               allocator_type;
+    typedef typename __identity<_Compare>::type      key_compare;
+    typedef typename __identity<_Allocator>::type    allocator_type;
     typedef value_type&                              reference;
     typedef const value_type&                        const_reference;
 
-    static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), "");
     static_assert((is_same<typename allocator_type::value_type, value_type>::value),
                   "Allocator::value_type must be same type as value_type");
 
@@ -1086,6 +1085,11 @@
         }
 
     _LIBCPP_INLINE_VISIBILITY
+    ~map() {
+        static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), "");
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
           iterator begin() _NOEXCEPT {return __tree_.begin();}
     _LIBCPP_INLINE_VISIBILITY
     const_iterator begin() const _NOEXCEPT {return __tree_.begin();}
@@ -1461,6 +1465,32 @@
 #endif
 };
 
+#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
+template<class _InputIterator, class _Compare = less<__iter_key_type<_InputIterator>>,
+         class _Allocator = allocator<__iter_to_alloc_type<_InputIterator>>,
+         class = enable_if_t<!__is_allocator<_Compare>::value, void>,
+         class = enable_if_t<__is_allocator<_Allocator>::value, void>>
+map(_InputIterator, _InputIterator, _Compare = _Compare(), _Allocator = _Allocator())
+  -> map<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, _Compare, _Allocator>;
+
+template<class _Key, class _Tp, class _Compare = less<remove_const_t<_Key>>,
+         class _Allocator = allocator<pair<const _Key, _Tp>>,
+         class = enable_if_t<!__is_allocator<_Compare>::value, void>,
+         class = enable_if_t<__is_allocator<_Allocator>::value, void>>
+map(initializer_list<pair<_Key, _Tp>>, _Compare = _Compare(), _Allocator = _Allocator())
+  -> map<remove_const_t<_Key>, _Tp, _Compare, _Allocator>;
+
+template<class _InputIterator, class _Allocator,
+         class = enable_if_t<__is_allocator<_Allocator>::value, void>>
+map(_InputIterator, _InputIterator, _Allocator)
+  -> map<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>,
+         less<__iter_key_type<_InputIterator>>, _Allocator>;
+
+template<class _Key, class _Tp, class _Allocator,
+         class = enable_if_t<__is_allocator<_Allocator>::value, void>>
+map(initializer_list<pair<_Key, _Tp>>, _Allocator)
+  -> map<remove_const_t<_Key>, _Tp, less<remove_const_t<_Key>>, _Allocator>;
+#endif
 
 #ifndef _LIBCPP_CXX03_LANG
 template <class _Key, class _Tp, class _Compare, class _Allocator>
@@ -1633,12 +1663,11 @@
     typedef _Key                                     key_type;
     typedef _Tp                                      mapped_type;
     typedef pair<const key_type, mapped_type>        value_type;
-    typedef _Compare                                 key_compare;
-    typedef _Allocator                               allocator_type;
+    typedef typename __identity<_Compare>::type      key_compare;
+    typedef typename __identity<_Allocator>::type    allocator_type;
     typedef value_type&                              reference;
     typedef const value_type&                        const_reference;
 
-    static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), "");
     static_assert((is_same<typename allocator_type::value_type, value_type>::value),
                   "Allocator::value_type must be same type as value_type");
 
@@ -1818,6 +1847,11 @@
         }
 
     _LIBCPP_INLINE_VISIBILITY
+    ~multimap() {
+        static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), "");
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
           iterator begin() _NOEXCEPT {return __tree_.begin();}
     _LIBCPP_INLINE_VISIBILITY
     const_iterator begin() const _NOEXCEPT {return __tree_.begin();}
@@ -2082,6 +2116,33 @@
     typedef unique_ptr<__node, _Dp> __node_holder;
 };
 
+#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
+template<class _InputIterator, class _Compare = less<__iter_key_type<_InputIterator>>,
+         class _Allocator = allocator<__iter_to_alloc_type<_InputIterator>>,
+         class = enable_if_t<!__is_allocator<_Compare>::value, void>,
+         class = enable_if_t<__is_allocator<_Allocator>::value, void>>
+multimap(_InputIterator, _InputIterator, _Compare = _Compare(), _Allocator = _Allocator())
+  -> multimap<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, _Compare, _Allocator>;
+
+template<class _Key, class _Tp, class _Compare = less<remove_const_t<_Key>>,
+         class _Allocator = allocator<pair<const _Key, _Tp>>,
+         class = enable_if_t<!__is_allocator<_Compare>::value, void>,
+         class = enable_if_t<__is_allocator<_Allocator>::value, void>>
+multimap(initializer_list<pair<_Key, _Tp>>, _Compare = _Compare(), _Allocator = _Allocator())
+  -> multimap<remove_const_t<_Key>, _Tp, _Compare, _Allocator>;
+
+template<class _InputIterator, class _Allocator,
+         class = enable_if_t<__is_allocator<_Allocator>::value, void>>
+multimap(_InputIterator, _InputIterator, _Allocator)
+  -> multimap<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>,
+         less<__iter_key_type<_InputIterator>>, _Allocator>;
+
+template<class _Key, class _Tp, class _Allocator,
+         class = enable_if_t<__is_allocator<_Allocator>::value, void>>
+multimap(initializer_list<pair<_Key, _Tp>>, _Allocator)
+  -> multimap<remove_const_t<_Key>, _Tp, less<remove_const_t<_Key>>, _Allocator>;
+#endif
+
 #ifndef _LIBCPP_CXX03_LANG
 template <class _Key, class _Tp, class _Compare, class _Allocator>
 multimap<_Key, _Tp, _Compare, _Allocator>::multimap(multimap&& __m, const allocator_type& __a)
diff --git a/linux-x64/clang/include/c++/v1/math.h b/linux-x64/clang/include/c++/v1/math.h
index 6f9a76b..194df20 100644
--- a/linux-x64/clang/include/c++/v1/math.h
+++ b/linux-x64/clang/include/c++/v1/math.h
@@ -297,6 +297,9 @@
 #pragma GCC system_header
 #endif
 
+#define _LIBCPP_STDLIB_INCLUDE_NEXT
+#include <stdlib.h>
+
 #include_next <math.h>
 
 #ifdef __cplusplus
@@ -754,20 +757,61 @@
 
 // abs
 
+#undef abs
+#undef labs
+#ifndef _LIBCPP_HAS_NO_LONG_LONG
+#undef llabs
+#endif
+
+// MSVCRT already has the correct prototype in <stdlib.h> if __cplusplus is defined
+#if !defined(_LIBCPP_MSVCRT) && !defined(__sun__) && !defined(_AIX)
+inline _LIBCPP_INLINE_VISIBILITY long abs(long __x) _NOEXCEPT {
+  return ::labs(__x);
+}
+#ifndef _LIBCPP_HAS_NO_LONG_LONG
+inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT {
+  return ::llabs(__x);
+}
+#endif // _LIBCPP_HAS_NO_LONG_LONG
+#endif // !defined(_LIBCPP_MSVCRT) && !defined(__sun__) && !defined(_AIX)
+
+
 #if !(defined(_AIX) || defined(__sun__))
-inline _LIBCPP_INLINE_VISIBILITY
-float
-abs(float __lcpp_x) _NOEXCEPT {return ::fabsf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY float abs(float __lcpp_x) _NOEXCEPT {
+  return ::fabsf(__lcpp_x);
+}
 
-inline _LIBCPP_INLINE_VISIBILITY
-double
-abs(double __lcpp_x) _NOEXCEPT {return ::fabs(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY double abs(double __lcpp_x) _NOEXCEPT {
+  return ::fabs(__lcpp_x);
+}
 
-inline _LIBCPP_INLINE_VISIBILITY
-long double
-abs(long double __lcpp_x) _NOEXCEPT {return ::fabsl(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double
+abs(long double __lcpp_x) _NOEXCEPT {
+  return ::fabsl(__lcpp_x);
+}
 #endif // !(defined(_AIX) || defined(__sun__))
 
+// div
+
+#undef div
+#undef ldiv
+#ifndef _LIBCPP_HAS_NO_LONG_LONG
+#undef lldiv
+#endif
+
+// MSVCRT already has the correct prototype in <stdlib.h> if __cplusplus is defined
+#if !defined(_LIBCPP_MSVCRT) && !defined(__sun__) && !defined(_AIX)
+inline _LIBCPP_INLINE_VISIBILITY ldiv_t div(long __x, long __y) _NOEXCEPT {
+  return ::ldiv(__x, __y);
+}
+#ifndef _LIBCPP_HAS_NO_LONG_LONG
+inline _LIBCPP_INLINE_VISIBILITY lldiv_t div(long long __x,
+                                             long long __y) _NOEXCEPT {
+  return ::lldiv(__x, __y);
+}
+#endif // _LIBCPP_HAS_NO_LONG_LONG
+#endif // _LIBCPP_MSVCRT / __sun__ / _AIX
+
 // acos
 
 #if !(defined(_AIX) || defined(__sun__))
@@ -813,7 +857,7 @@
 
 template <class _A1, class _A2>
 inline _LIBCPP_INLINE_VISIBILITY
-typename std::__lazy_enable_if
+typename std::_EnableIf
 <
     std::is_arithmetic<_A1>::value &&
     std::is_arithmetic<_A2>::value,
@@ -822,8 +866,8 @@
 atan2(_A1 __lcpp_y, _A2 __lcpp_x) _NOEXCEPT
 {
     typedef typename std::__promote<_A1, _A2>::type __result_type;
-    static_assert((!(std::is_same<_A1, __result_type>::value &&
-                     std::is_same<_A2, __result_type>::value)), "");
+    static_assert((!(std::_IsSame<_A1, __result_type>::value &&
+                     std::_IsSame<_A2, __result_type>::value)), "");
     return ::atan2((__result_type)__lcpp_y, (__result_type)__lcpp_x);
 }
 
@@ -908,7 +952,7 @@
 
 template <class _A1, class _A2>
 inline _LIBCPP_INLINE_VISIBILITY
-typename std::__lazy_enable_if
+typename std::_EnableIf
 <
     std::is_arithmetic<_A1>::value &&
     std::is_arithmetic<_A2>::value,
@@ -917,8 +961,8 @@
 fmod(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
 {
     typedef typename std::__promote<_A1, _A2>::type __result_type;
-    static_assert((!(std::is_same<_A1, __result_type>::value &&
-                     std::is_same<_A2, __result_type>::value)), "");
+    static_assert((!(std::_IsSame<_A1, __result_type>::value &&
+                     std::_IsSame<_A2, __result_type>::value)), "");
     return ::fmod((__result_type)__lcpp_x, (__result_type)__lcpp_y);
 }
 
@@ -986,7 +1030,7 @@
 
 template <class _A1, class _A2>
 inline _LIBCPP_INLINE_VISIBILITY
-typename std::__lazy_enable_if
+typename std::_EnableIf
 <
     std::is_arithmetic<_A1>::value &&
     std::is_arithmetic<_A2>::value,
@@ -995,8 +1039,8 @@
 pow(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
 {
     typedef typename std::__promote<_A1, _A2>::type __result_type;
-    static_assert((!(std::is_same<_A1, __result_type>::value &&
-                     std::is_same<_A2, __result_type>::value)), "");
+    static_assert((!(std::_IsSame<_A1, __result_type>::value &&
+                     std::_IsSame<_A2, __result_type>::value)), "");
     return ::pow((__result_type)__lcpp_x, (__result_type)__lcpp_y);
 }
 
@@ -1113,7 +1157,7 @@
 
 template <class _A1, class _A2>
 inline _LIBCPP_INLINE_VISIBILITY
-typename std::__lazy_enable_if
+typename std::_EnableIf
 <
     std::is_arithmetic<_A1>::value &&
     std::is_arithmetic<_A2>::value,
@@ -1122,8 +1166,8 @@
 copysign(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
 {
     typedef typename std::__promote<_A1, _A2>::type __result_type;
-    static_assert((!(std::is_same<_A1, __result_type>::value &&
-                     std::is_same<_A2, __result_type>::value)), "");
+    static_assert((!(std::_IsSame<_A1, __result_type>::value &&
+                     std::_IsSame<_A2, __result_type>::value)), "");
     return ::copysign((__result_type)__lcpp_x, (__result_type)__lcpp_y);
 }
 
@@ -1174,7 +1218,7 @@
 
 template <class _A1, class _A2>
 inline _LIBCPP_INLINE_VISIBILITY
-typename std::__lazy_enable_if
+typename std::_EnableIf
 <
     std::is_arithmetic<_A1>::value &&
     std::is_arithmetic<_A2>::value,
@@ -1183,8 +1227,8 @@
 fdim(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
 {
     typedef typename std::__promote<_A1, _A2>::type __result_type;
-    static_assert((!(std::is_same<_A1, __result_type>::value &&
-                     std::is_same<_A2, __result_type>::value)), "");
+    static_assert((!(std::_IsSame<_A1, __result_type>::value &&
+                     std::_IsSame<_A2, __result_type>::value)), "");
     return ::fdim((__result_type)__lcpp_x, (__result_type)__lcpp_y);
 }
 
@@ -1195,7 +1239,7 @@
 
 template <class _A1, class _A2, class _A3>
 inline _LIBCPP_INLINE_VISIBILITY
-typename std::__lazy_enable_if
+typename std::_EnableIf
 <
     std::is_arithmetic<_A1>::value &&
     std::is_arithmetic<_A2>::value &&
@@ -1205,9 +1249,9 @@
 fma(_A1 __lcpp_x, _A2 __lcpp_y, _A3 __lcpp_z) _NOEXCEPT
 {
     typedef typename std::__promote<_A1, _A2, _A3>::type __result_type;
-    static_assert((!(std::is_same<_A1, __result_type>::value &&
-                     std::is_same<_A2, __result_type>::value &&
-                     std::is_same<_A3, __result_type>::value)), "");
+    static_assert((!(std::_IsSame<_A1, __result_type>::value &&
+                     std::_IsSame<_A2, __result_type>::value &&
+                     std::_IsSame<_A3, __result_type>::value)), "");
     return ::fma((__result_type)__lcpp_x, (__result_type)__lcpp_y, (__result_type)__lcpp_z);
 }
 
@@ -1218,7 +1262,7 @@
 
 template <class _A1, class _A2>
 inline _LIBCPP_INLINE_VISIBILITY
-typename std::__lazy_enable_if
+typename std::_EnableIf
 <
     std::is_arithmetic<_A1>::value &&
     std::is_arithmetic<_A2>::value,
@@ -1227,8 +1271,8 @@
 fmax(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
 {
     typedef typename std::__promote<_A1, _A2>::type __result_type;
-    static_assert((!(std::is_same<_A1, __result_type>::value &&
-                     std::is_same<_A2, __result_type>::value)), "");
+    static_assert((!(std::_IsSame<_A1, __result_type>::value &&
+                     std::_IsSame<_A2, __result_type>::value)), "");
     return ::fmax((__result_type)__lcpp_x, (__result_type)__lcpp_y);
 }
 
@@ -1239,7 +1283,7 @@
 
 template <class _A1, class _A2>
 inline _LIBCPP_INLINE_VISIBILITY
-typename std::__lazy_enable_if
+typename std::_EnableIf
 <
     std::is_arithmetic<_A1>::value &&
     std::is_arithmetic<_A2>::value,
@@ -1248,8 +1292,8 @@
 fmin(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
 {
     typedef typename std::__promote<_A1, _A2>::type __result_type;
-    static_assert((!(std::is_same<_A1, __result_type>::value &&
-                     std::is_same<_A2, __result_type>::value)), "");
+    static_assert((!(std::_IsSame<_A1, __result_type>::value &&
+                     std::_IsSame<_A2, __result_type>::value)), "");
     return ::fmin((__result_type)__lcpp_x, (__result_type)__lcpp_y);
 }
 
@@ -1260,7 +1304,7 @@
 
 template <class _A1, class _A2>
 inline _LIBCPP_INLINE_VISIBILITY
-typename std::__lazy_enable_if
+typename std::_EnableIf
 <
     std::is_arithmetic<_A1>::value &&
     std::is_arithmetic<_A2>::value,
@@ -1269,8 +1313,8 @@
 hypot(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
 {
     typedef typename std::__promote<_A1, _A2>::type __result_type;
-    static_assert((!(std::is_same<_A1, __result_type>::value &&
-                     std::is_same<_A2, __result_type>::value)), "");
+    static_assert((!(std::_IsSame<_A1, __result_type>::value &&
+                     std::_IsSame<_A2, __result_type>::value)), "");
     return ::hypot((__result_type)__lcpp_x, (__result_type)__lcpp_y);
 }
 
@@ -1383,7 +1427,7 @@
 
 template <class _A1, class _A2>
 inline _LIBCPP_INLINE_VISIBILITY
-typename std::__lazy_enable_if
+typename std::_EnableIf
 <
     std::is_arithmetic<_A1>::value &&
     std::is_arithmetic<_A2>::value,
@@ -1392,8 +1436,8 @@
 nextafter(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
 {
     typedef typename std::__promote<_A1, _A2>::type __result_type;
-    static_assert((!(std::is_same<_A1, __result_type>::value &&
-                     std::is_same<_A2, __result_type>::value)), "");
+    static_assert((!(std::_IsSame<_A1, __result_type>::value &&
+                     std::_IsSame<_A2, __result_type>::value)), "");
     return ::nextafter((__result_type)__lcpp_x, (__result_type)__lcpp_y);
 }
 
@@ -1414,7 +1458,7 @@
 
 template <class _A1, class _A2>
 inline _LIBCPP_INLINE_VISIBILITY
-typename std::__lazy_enable_if
+typename std::_EnableIf
 <
     std::is_arithmetic<_A1>::value &&
     std::is_arithmetic<_A2>::value,
@@ -1423,8 +1467,8 @@
 remainder(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
 {
     typedef typename std::__promote<_A1, _A2>::type __result_type;
-    static_assert((!(std::is_same<_A1, __result_type>::value &&
-                     std::is_same<_A2, __result_type>::value)), "");
+    static_assert((!(std::_IsSame<_A1, __result_type>::value &&
+                     std::_IsSame<_A2, __result_type>::value)), "");
     return ::remainder((__result_type)__lcpp_x, (__result_type)__lcpp_y);
 }
 
@@ -1435,7 +1479,7 @@
 
 template <class _A1, class _A2>
 inline _LIBCPP_INLINE_VISIBILITY
-typename std::__lazy_enable_if
+typename std::_EnableIf
 <
     std::is_arithmetic<_A1>::value &&
     std::is_arithmetic<_A2>::value,
@@ -1444,8 +1488,8 @@
 remquo(_A1 __lcpp_x, _A2 __lcpp_y, int* __lcpp_z) _NOEXCEPT
 {
     typedef typename std::__promote<_A1, _A2>::type __result_type;
-    static_assert((!(std::is_same<_A1, __result_type>::value &&
-                     std::is_same<_A2, __result_type>::value)), "");
+    static_assert((!(std::_IsSame<_A1, __result_type>::value &&
+                     std::_IsSame<_A2, __result_type>::value)), "");
     return ::remquo((__result_type)__lcpp_x, (__result_type)__lcpp_y, __lcpp_z);
 }
 
diff --git a/linux-x64/clang/include/c++/v1/memory b/linux-x64/clang/include/c++/v1/memory
index 3398629..d9222b3 100644
--- a/linux-x64/clang/include/c++/v1/memory
+++ b/linux-x64/clang/include/c++/v1/memory
@@ -548,7 +548,7 @@
 template<class T> struct owner_less;
 
 template<class T>
-struct owner_less<shared_ptr<T>>
+struct owner_less<shared_ptr<T> >
     : binary_function<shared_ptr<T>, shared_ptr<T>, bool>
 {
     typedef bool result_type;
@@ -558,7 +558,7 @@
 };
 
 template<class T>
-struct owner_less<weak_ptr<T>>
+struct owner_less<weak_ptr<T> >
     : binary_function<weak_ptr<T>, weak_ptr<T>, bool>
 {
     typedef bool result_type;
@@ -683,7 +683,7 @@
 _ValueType __libcpp_relaxed_load(_ValueType const* __value) {
 #if !defined(_LIBCPP_HAS_NO_THREADS) && \
     defined(__ATOMIC_RELAXED) &&        \
-    (__has_builtin(__atomic_load_n) || _GNUC_VER >= 407)
+    (__has_builtin(__atomic_load_n) || defined(_LIBCPP_COMPILER_GCC))
     return __atomic_load_n(__value, __ATOMIC_RELAXED);
 #else
     return *__value;
@@ -695,7 +695,7 @@
 _ValueType __libcpp_acquire_load(_ValueType const* __value) {
 #if !defined(_LIBCPP_HAS_NO_THREADS) && \
     defined(__ATOMIC_ACQUIRE) &&        \
-    (__has_builtin(__atomic_load_n) || _GNUC_VER >= 407)
+    (__has_builtin(__atomic_load_n) || defined(_LIBCPP_COMPILER_GCC))
     return __atomic_load_n(__value, __ATOMIC_ACQUIRE);
 #else
     return *__value;
@@ -743,7 +743,7 @@
 template <class _Ptr>
 struct __pointer_traits_element_type<_Ptr, true>
 {
-    typedef typename _Ptr::element_type type;
+    typedef _LIBCPP_NODEBUG_TYPE typename _Ptr::element_type type;
 };
 
 #ifndef _LIBCPP_HAS_NO_VARIADICS
@@ -751,13 +751,13 @@
 template <template <class, class...> class _Sp, class _Tp, class ..._Args>
 struct __pointer_traits_element_type<_Sp<_Tp, _Args...>, true>
 {
-    typedef typename _Sp<_Tp, _Args...>::element_type type;
+    typedef _LIBCPP_NODEBUG_TYPE typename _Sp<_Tp, _Args...>::element_type type;
 };
 
 template <template <class, class...> class _Sp, class _Tp, class ..._Args>
 struct __pointer_traits_element_type<_Sp<_Tp, _Args...>, false>
 {
-    typedef _Tp type;
+    typedef _LIBCPP_NODEBUG_TYPE _Tp type;
 };
 
 #else  // _LIBCPP_HAS_NO_VARIADICS
@@ -824,13 +824,13 @@
 template <class _Ptr, bool = __has_difference_type<_Ptr>::value>
 struct __pointer_traits_difference_type
 {
-    typedef ptrdiff_t type;
+    typedef _LIBCPP_NODEBUG_TYPE ptrdiff_t type;
 };
 
 template <class _Ptr>
 struct __pointer_traits_difference_type<_Ptr, true>
 {
-    typedef typename _Ptr::difference_type type;
+    typedef _LIBCPP_NODEBUG_TYPE typename _Ptr::difference_type type;
 };
 
 template <class _Tp, class _Up>
@@ -848,9 +848,9 @@
 struct __pointer_traits_rebind
 {
 #ifndef _LIBCPP_CXX03_LANG
-    typedef typename _Tp::template rebind<_Up> type;
+    typedef _LIBCPP_NODEBUG_TYPE typename _Tp::template rebind<_Up> type;
 #else
-    typedef typename _Tp::template rebind<_Up>::other type;
+    typedef _LIBCPP_NODEBUG_TYPE typename _Tp::template rebind<_Up>::other type;
 #endif
 };
 
@@ -860,9 +860,9 @@
 struct __pointer_traits_rebind<_Sp<_Tp, _Args...>, _Up, true>
 {
 #ifndef _LIBCPP_CXX03_LANG
-    typedef typename _Sp<_Tp, _Args...>::template rebind<_Up> type;
+    typedef _LIBCPP_NODEBUG_TYPE typename _Sp<_Tp, _Args...>::template rebind<_Up> type;
 #else
-    typedef typename _Sp<_Tp, _Args...>::template rebind<_Up>::other type;
+    typedef _LIBCPP_NODEBUG_TYPE typename _Sp<_Tp, _Args...>::template rebind<_Up>::other type;
 #endif
 };
 
@@ -1013,13 +1013,13 @@
 template <class _Tp, class _Dp, bool = __has_pointer_type<_Dp>::value>
 struct __pointer_type
 {
-    typedef typename _Dp::pointer type;
+    typedef _LIBCPP_NODEBUG_TYPE typename _Dp::pointer type;
 };
 
 template <class _Tp, class _Dp>
 struct __pointer_type<_Tp, _Dp, false>
 {
-    typedef _Tp* type;
+    typedef _LIBCPP_NODEBUG_TYPE _Tp* type;
 };
 
 }  // __pointer_type_imp
@@ -1027,7 +1027,7 @@
 template <class _Tp, class _Dp>
 struct __pointer_type
 {
-    typedef typename __pointer_type_imp::__pointer_type<_Tp, typename remove_reference<_Dp>::type>::type type;
+    typedef _LIBCPP_NODEBUG_TYPE typename __pointer_type_imp::__pointer_type<_Tp, typename remove_reference<_Dp>::type>::type type;
 };
 
 template <class _Tp, class = void>
@@ -1040,14 +1040,14 @@
 template <class _Tp, class _Ptr, class _Alloc, bool = __has_const_pointer<_Alloc>::value>
 struct __const_pointer
 {
-    typedef typename _Alloc::const_pointer type;
+    typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::const_pointer type;
 };
 
 template <class _Tp, class _Ptr, class _Alloc>
 struct __const_pointer<_Tp, _Ptr, _Alloc, false>
 {
 #ifndef _LIBCPP_CXX03_LANG
-    typedef typename pointer_traits<_Ptr>::template rebind<const _Tp> type;
+    typedef _LIBCPP_NODEBUG_TYPE typename pointer_traits<_Ptr>::template rebind<const _Tp> type;
 #else
     typedef typename pointer_traits<_Ptr>::template rebind<const _Tp>::other type;
 #endif
@@ -1063,16 +1063,16 @@
 template <class _Ptr, class _Alloc, bool = __has_void_pointer<_Alloc>::value>
 struct __void_pointer
 {
-    typedef typename _Alloc::void_pointer type;
+    typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::void_pointer type;
 };
 
 template <class _Ptr, class _Alloc>
 struct __void_pointer<_Ptr, _Alloc, false>
 {
 #ifndef _LIBCPP_CXX03_LANG
-    typedef typename pointer_traits<_Ptr>::template rebind<void> type;
+    typedef _LIBCPP_NODEBUG_TYPE typename pointer_traits<_Ptr>::template rebind<void> type;
 #else
-    typedef typename pointer_traits<_Ptr>::template rebind<void>::other type;
+    typedef _LIBCPP_NODEBUG_TYPE typename pointer_traits<_Ptr>::template rebind<void>::other type;
 #endif
 };
 
@@ -1086,16 +1086,16 @@
 template <class _Ptr, class _Alloc, bool = __has_const_void_pointer<_Alloc>::value>
 struct __const_void_pointer
 {
-    typedef typename _Alloc::const_void_pointer type;
+    typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::const_void_pointer type;
 };
 
 template <class _Ptr, class _Alloc>
 struct __const_void_pointer<_Ptr, _Alloc, false>
 {
 #ifndef _LIBCPP_CXX03_LANG
-    typedef typename pointer_traits<_Ptr>::template rebind<const void> type;
+    typedef _LIBCPP_NODEBUG_TYPE typename pointer_traits<_Ptr>::template rebind<const void> type;
 #else
-    typedef typename pointer_traits<_Ptr>::template rebind<const void>::other type;
+    typedef _LIBCPP_NODEBUG_TYPE typename pointer_traits<_Ptr>::template rebind<const void>::other type;
 #endif
 };
 
@@ -1161,13 +1161,13 @@
 template <class _Alloc, class _DiffType, bool = __has_size_type<_Alloc>::value>
 struct __size_type
 {
-    typedef typename make_unsigned<_DiffType>::type type;
+    typedef _LIBCPP_NODEBUG_TYPE typename make_unsigned<_DiffType>::type type;
 };
 
 template <class _Alloc, class _DiffType>
 struct __size_type<_Alloc, _DiffType, true>
 {
-    typedef typename _Alloc::size_type type;
+    typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::size_type type;
 };
 
 template <class _Tp, class = void>
@@ -1181,13 +1181,13 @@
 template <class _Alloc, bool = __has_propagate_on_container_copy_assignment<_Alloc>::value>
 struct __propagate_on_container_copy_assignment
 {
-    typedef false_type type;
+    typedef _LIBCPP_NODEBUG_TYPE false_type type;
 };
 
 template <class _Alloc>
 struct __propagate_on_container_copy_assignment<_Alloc, true>
 {
-    typedef typename _Alloc::propagate_on_container_copy_assignment type;
+    typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::propagate_on_container_copy_assignment type;
 };
 
 template <class _Tp, class = void>
@@ -1207,7 +1207,7 @@
 template <class _Alloc>
 struct __propagate_on_container_move_assignment<_Alloc, true>
 {
-    typedef typename _Alloc::propagate_on_container_move_assignment type;
+    typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::propagate_on_container_move_assignment type;
 };
 
 template <class _Tp, class = void>
@@ -1227,7 +1227,7 @@
 template <class _Alloc>
 struct __propagate_on_container_swap<_Alloc, true>
 {
-    typedef typename _Alloc::propagate_on_container_swap type;
+    typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::propagate_on_container_swap type;
 };
 
 template <class _Tp, class = void>
@@ -1241,13 +1241,13 @@
 template <class _Alloc, bool = __has_is_always_equal<_Alloc>::value>
 struct __is_always_equal
 {
-    typedef typename _VSTD::is_empty<_Alloc>::type type;
+    typedef _LIBCPP_NODEBUG_TYPE typename _VSTD::is_empty<_Alloc>::type type;
 };
 
 template <class _Alloc>
 struct __is_always_equal<_Alloc, true>
 {
-    typedef typename _Alloc::is_always_equal type;
+    typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::is_always_equal type;
 };
 
 template <class _Tp, class _Up, bool = __has_rebind<_Tp, _Up>::value>
@@ -1270,7 +1270,7 @@
 template <class _Tp, class _Up, bool = __has_rebind_other<_Tp, _Up>::value>
 struct __allocator_traits_rebind
 {
-    typedef typename _Tp::template rebind<_Up>::other type;
+    typedef _LIBCPP_NODEBUG_TYPE typename _Tp::template rebind<_Up>::other type;
 };
 
 #ifndef _LIBCPP_HAS_NO_VARIADICS
@@ -1278,13 +1278,13 @@
 template <template <class, class...> class _Alloc, class _Tp, class ..._Args, class _Up>
 struct __allocator_traits_rebind<_Alloc<_Tp, _Args...>, _Up, true>
 {
-    typedef typename _Alloc<_Tp, _Args...>::template rebind<_Up>::other type;
+    typedef _LIBCPP_NODEBUG_TYPE typename _Alloc<_Tp, _Args...>::template rebind<_Up>::other type;
 };
 
 template <template <class, class...> class _Alloc, class _Tp, class ..._Args, class _Up>
 struct __allocator_traits_rebind<_Alloc<_Tp, _Args...>, _Up, false>
 {
-    typedef _Alloc<_Up, _Args...> type;
+    typedef _LIBCPP_NODEBUG_TYPE _Alloc<_Up, _Args...> type;
 };
 
 #else  // _LIBCPP_HAS_NO_VARIADICS
@@ -1492,13 +1492,13 @@
 template <class _Alloc, class _Ptr, bool = __has_difference_type<_Alloc>::value>
 struct __alloc_traits_difference_type
 {
-    typedef typename pointer_traits<_Ptr>::difference_type type;
+    typedef _LIBCPP_NODEBUG_TYPE typename pointer_traits<_Ptr>::difference_type type;
 };
 
 template <class _Alloc, class _Ptr>
 struct __alloc_traits_difference_type<_Alloc, _Ptr, true>
 {
-    typedef typename _Alloc::difference_type type;
+    typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::difference_type type;
 };
 
 template <class _Tp>
@@ -1533,7 +1533,7 @@
 #ifndef _LIBCPP_CXX03_LANG
     template <class _Tp> using rebind_alloc =
                   typename __allocator_traits_rebind<allocator_type, _Tp>::type;
-    template <class _Tp> using rebind_traits = allocator_traits<rebind_alloc<_Tp>>;
+    template <class _Tp> using rebind_traits = allocator_traits<rebind_alloc<_Tp> >;
 #else  // _LIBCPP_CXX03_LANG
     template <class _Tp> struct rebind_alloc
         {typedef typename __allocator_traits_rebind<allocator_type, _Tp>::type other;};
@@ -1768,7 +1768,7 @@
 struct __rebind_alloc_helper
 {
 #ifndef _LIBCPP_CXX03_LANG
-    typedef typename _Traits::template rebind_alloc<_Tp>        type;
+    typedef _LIBCPP_NODEBUG_TYPE typename _Traits::template rebind_alloc<_Tp>        type;
 #else
     typedef typename _Traits::template rebind_alloc<_Tp>::other type;
 #endif
@@ -2209,8 +2209,8 @@
 template <class _T1, class _T2>
 class __compressed_pair : private __compressed_pair_elem<_T1, 0>,
                           private __compressed_pair_elem<_T2, 1> {
-  typedef __compressed_pair_elem<_T1, 0> _Base1;
-  typedef __compressed_pair_elem<_T2, 1> _Base2;
+  typedef _LIBCPP_NODEBUG_TYPE __compressed_pair_elem<_T1, 0> _Base1;
+  typedef _LIBCPP_NODEBUG_TYPE __compressed_pair_elem<_T2, 1> _Base2;
 
   // NOTE: This static assert should never fire because __compressed_pair
   // is *almost never* used in a scenario where it's possible for T1 == T2.
@@ -2320,7 +2320,7 @@
     static_assert(!is_function<_Tp>::value,
                   "default_delete cannot be instantiated for function types");
 #ifndef _LIBCPP_CXX03_LANG
-  _LIBCPP_INLINE_VISIBILITY constexpr default_delete() noexcept = default;
+  _LIBCPP_INLINE_VISIBILITY constexpr default_delete() _NOEXCEPT = default;
 #else
   _LIBCPP_INLINE_VISIBILITY default_delete() {}
 #endif
@@ -2348,7 +2348,7 @@
 
 public:
 #ifndef _LIBCPP_CXX03_LANG
-  _LIBCPP_INLINE_VISIBILITY constexpr default_delete() noexcept = default;
+  _LIBCPP_INLINE_VISIBILITY constexpr default_delete() _NOEXCEPT = default;
 #else
   _LIBCPP_INLINE_VISIBILITY default_delete() {}
 #endif
@@ -2370,9 +2370,6 @@
   }
 };
 
-
-
-#ifndef _LIBCPP_CXX03_LANG
 template <class _Deleter>
 struct __unique_ptr_deleter_sfinae {
   static_assert(!is_reference<_Deleter>::value, "incorrect specialization");
@@ -2394,14 +2391,13 @@
   typedef _Deleter&& __bad_rval_ref_type;
   typedef false_type __enable_rval_overload;
 };
-#endif // !defined(_LIBCPP_CXX03_LANG)
 
 template <class _Tp, class _Dp = default_delete<_Tp> >
 class _LIBCPP_TEMPLATE_VIS unique_ptr {
 public:
   typedef _Tp element_type;
   typedef _Dp deleter_type;
-  typedef typename __pointer_type<_Tp, deleter_type>::type pointer;
+  typedef _LIBCPP_NODEBUG_TYPE typename __pointer_type<_Tp, deleter_type>::type pointer;
 
   static_assert(!is_rvalue_reference<deleter_type>::value,
                 "the specified deleter type cannot be an rvalue reference");
@@ -2411,39 +2407,38 @@
 
   struct __nat { int __for_bool_; };
 
-#ifndef _LIBCPP_CXX03_LANG
-  typedef __unique_ptr_deleter_sfinae<_Dp> _DeleterSFINAE;
+  typedef _LIBCPP_NODEBUG_TYPE __unique_ptr_deleter_sfinae<_Dp> _DeleterSFINAE;
 
   template <bool _Dummy>
-  using _LValRefType =
+  using _LValRefType _LIBCPP_NODEBUG_TYPE =
       typename __dependent_type<_DeleterSFINAE, _Dummy>::__lval_ref_type;
 
   template <bool _Dummy>
-  using _GoodRValRefType =
+  using _GoodRValRefType _LIBCPP_NODEBUG_TYPE =
       typename __dependent_type<_DeleterSFINAE, _Dummy>::__good_rval_ref_type;
 
   template <bool _Dummy>
-  using _BadRValRefType =
+  using _BadRValRefType _LIBCPP_NODEBUG_TYPE  =
       typename __dependent_type<_DeleterSFINAE, _Dummy>::__bad_rval_ref_type;
 
   template <bool _Dummy, class _Deleter = typename __dependent_type<
                              __identity<deleter_type>, _Dummy>::type>
-  using _EnableIfDeleterDefaultConstructible =
+  using _EnableIfDeleterDefaultConstructible _LIBCPP_NODEBUG_TYPE =
       typename enable_if<is_default_constructible<_Deleter>::value &&
                          !is_pointer<_Deleter>::value>::type;
 
   template <class _ArgType>
-  using _EnableIfDeleterConstructible =
+  using _EnableIfDeleterConstructible _LIBCPP_NODEBUG_TYPE  =
       typename enable_if<is_constructible<deleter_type, _ArgType>::value>::type;
 
   template <class _UPtr, class _Up>
-  using _EnableIfMoveConvertible = typename enable_if<
+  using _EnableIfMoveConvertible _LIBCPP_NODEBUG_TYPE  = typename enable_if<
       is_convertible<typename _UPtr::pointer, pointer>::value &&
       !is_array<_Up>::value
   >::type;
 
   template <class _UDel>
-  using _EnableIfDeleterConvertible = typename enable_if<
+  using _EnableIfDeleterConvertible _LIBCPP_NODEBUG_TYPE  = typename enable_if<
       (is_reference<_Dp>::value && is_same<_Dp, _UDel>::value) ||
       (!is_reference<_Dp>::value && is_convertible<_UDel, _Dp>::value)
     >::type;
@@ -2455,42 +2450,42 @@
 
 public:
   template <bool _Dummy = true,
-            class = _EnableIfDeleterDefaultConstructible<_Dummy>>
+            class = _EnableIfDeleterDefaultConstructible<_Dummy> >
   _LIBCPP_INLINE_VISIBILITY
-  constexpr unique_ptr() noexcept : __ptr_(pointer()) {}
+  _LIBCPP_CONSTEXPR unique_ptr() _NOEXCEPT : __ptr_(pointer()) {}
 
   template <bool _Dummy = true,
-            class = _EnableIfDeleterDefaultConstructible<_Dummy>>
+            class = _EnableIfDeleterDefaultConstructible<_Dummy> >
   _LIBCPP_INLINE_VISIBILITY
-  constexpr unique_ptr(nullptr_t) noexcept : __ptr_(pointer()) {}
+  _LIBCPP_CONSTEXPR unique_ptr(nullptr_t) _NOEXCEPT : __ptr_(pointer()) {}
 
   template <bool _Dummy = true,
-            class = _EnableIfDeleterDefaultConstructible<_Dummy>>
+            class = _EnableIfDeleterDefaultConstructible<_Dummy> >
   _LIBCPP_INLINE_VISIBILITY
-  explicit unique_ptr(pointer __p) noexcept : __ptr_(__p) {}
+  explicit unique_ptr(pointer __p) _NOEXCEPT : __ptr_(__p) {}
 
   template <bool _Dummy = true,
-            class = _EnableIfDeleterConstructible<_LValRefType<_Dummy>>>
+            class = _EnableIfDeleterConstructible<_LValRefType<_Dummy> > >
   _LIBCPP_INLINE_VISIBILITY
-  unique_ptr(pointer __p, _LValRefType<_Dummy> __d) noexcept
+  unique_ptr(pointer __p, _LValRefType<_Dummy> __d) _NOEXCEPT
       : __ptr_(__p, __d) {}
 
   template <bool _Dummy = true,
-            class = _EnableIfDeleterConstructible<_GoodRValRefType<_Dummy>>>
+            class = _EnableIfDeleterConstructible<_GoodRValRefType<_Dummy> > >
   _LIBCPP_INLINE_VISIBILITY
-  unique_ptr(pointer __p, _GoodRValRefType<_Dummy> __d) noexcept
+  unique_ptr(pointer __p, _GoodRValRefType<_Dummy> __d) _NOEXCEPT
       : __ptr_(__p, _VSTD::move(__d)) {
     static_assert(!is_reference<deleter_type>::value,
                   "rvalue deleter bound to reference");
   }
 
   template <bool _Dummy = true,
-            class = _EnableIfDeleterConstructible<_BadRValRefType<_Dummy>>>
+            class = _EnableIfDeleterConstructible<_BadRValRefType<_Dummy> > >
   _LIBCPP_INLINE_VISIBILITY
   unique_ptr(pointer __p, _BadRValRefType<_Dummy> __d) = delete;
 
   _LIBCPP_INLINE_VISIBILITY
-  unique_ptr(unique_ptr&& __u) noexcept
+  unique_ptr(unique_ptr&& __u) _NOEXCEPT
       : __ptr_(__u.release(), _VSTD::forward<deleter_type>(__u.get_deleter())) {
   }
 
@@ -2507,7 +2502,7 @@
   _LIBCPP_INLINE_VISIBILITY
   unique_ptr(auto_ptr<_Up>&& __p,
              typename enable_if<is_convertible<_Up*, _Tp*>::value &&
-                                    is_same<_Dp, default_delete<_Tp>>::value,
+                                    is_same<_Dp, default_delete<_Tp> >::value,
                                 __nat>::type = __nat()) _NOEXCEPT
       : __ptr_(__p.release()) {}
 #endif
@@ -2530,65 +2525,6 @@
     return *this;
   }
 
-#else  // _LIBCPP_CXX03_LANG
-private:
-  unique_ptr(unique_ptr&);
-  template <class _Up, class _Ep> unique_ptr(unique_ptr<_Up, _Ep>&);
-
-  unique_ptr& operator=(unique_ptr&);
-  template <class _Up, class _Ep> unique_ptr& operator=(unique_ptr<_Up, _Ep>&);
-
-public:
-  _LIBCPP_INLINE_VISIBILITY
-  unique_ptr() : __ptr_(pointer())
-  {
-    static_assert(!is_pointer<deleter_type>::value,
-                  "unique_ptr constructed with null function pointer deleter");
-    static_assert(is_default_constructible<deleter_type>::value,
-                  "unique_ptr::deleter_type is not default constructible");
-  }
-  _LIBCPP_INLINE_VISIBILITY
-  unique_ptr(nullptr_t) : __ptr_(pointer())
-  {
-    static_assert(!is_pointer<deleter_type>::value,
-                  "unique_ptr constructed with null function pointer deleter");
-  }
-  _LIBCPP_INLINE_VISIBILITY
-  explicit unique_ptr(pointer __p)
-      : __ptr_(_VSTD::move(__p)) {
-    static_assert(!is_pointer<deleter_type>::value,
-                  "unique_ptr constructed with null function pointer deleter");
-  }
-
-  _LIBCPP_INLINE_VISIBILITY
-  operator __rv<unique_ptr>() {
-    return __rv<unique_ptr>(*this);
-  }
-
-  _LIBCPP_INLINE_VISIBILITY
-  unique_ptr(__rv<unique_ptr> __u)
-      : __ptr_(__u->release(),
-               _VSTD::forward<deleter_type>(__u->get_deleter())) {}
-
-  template <class _Up, class _Ep>
-  _LIBCPP_INLINE_VISIBILITY
-  typename enable_if<
-      !is_array<_Up>::value &&
-          is_convertible<typename unique_ptr<_Up, _Ep>::pointer,
-                         pointer>::value &&
-          is_assignable<deleter_type&, _Ep&>::value,
-      unique_ptr&>::type
-  operator=(unique_ptr<_Up, _Ep> __u) {
-    reset(__u.release());
-    __ptr_.second() = _VSTD::forward<_Ep>(__u.get_deleter());
-    return *this;
-  }
-
-  _LIBCPP_INLINE_VISIBILITY
-  unique_ptr(pointer __p, deleter_type __d)
-      : __ptr_(_VSTD::move(__p), _VSTD::move(__d)) {}
-#endif // _LIBCPP_CXX03_LANG
-
 #if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR)
   template <class _Up>
   _LIBCPP_INLINE_VISIBILITY
@@ -2601,6 +2537,12 @@
   }
 #endif
 
+#ifdef _LIBCPP_CXX03_LANG
+  unique_ptr(unique_ptr const&) = delete;
+  unique_ptr& operator=(unique_ptr const&) = delete;
+#endif
+
+
   _LIBCPP_INLINE_VISIBILITY
   ~unique_ptr() { reset(); }
 
@@ -2680,39 +2622,38 @@
       >
   {};
 
-#ifndef _LIBCPP_CXX03_LANG
   typedef __unique_ptr_deleter_sfinae<_Dp> _DeleterSFINAE;
 
   template <bool _Dummy>
-  using _LValRefType =
+  using _LValRefType _LIBCPP_NODEBUG_TYPE =
       typename __dependent_type<_DeleterSFINAE, _Dummy>::__lval_ref_type;
 
   template <bool _Dummy>
-  using _GoodRValRefType =
+  using _GoodRValRefType _LIBCPP_NODEBUG_TYPE =
       typename __dependent_type<_DeleterSFINAE, _Dummy>::__good_rval_ref_type;
 
   template <bool _Dummy>
-  using _BadRValRefType =
+  using _BadRValRefType _LIBCPP_NODEBUG_TYPE =
       typename __dependent_type<_DeleterSFINAE, _Dummy>::__bad_rval_ref_type;
 
   template <bool _Dummy, class _Deleter = typename __dependent_type<
                              __identity<deleter_type>, _Dummy>::type>
-  using _EnableIfDeleterDefaultConstructible =
+  using _EnableIfDeleterDefaultConstructible _LIBCPP_NODEBUG_TYPE  =
       typename enable_if<is_default_constructible<_Deleter>::value &&
                          !is_pointer<_Deleter>::value>::type;
 
   template <class _ArgType>
-  using _EnableIfDeleterConstructible =
+  using _EnableIfDeleterConstructible _LIBCPP_NODEBUG_TYPE  =
       typename enable_if<is_constructible<deleter_type, _ArgType>::value>::type;
 
   template <class _Pp>
-  using _EnableIfPointerConvertible = typename enable_if<
+  using _EnableIfPointerConvertible _LIBCPP_NODEBUG_TYPE  = typename enable_if<
       _CheckArrayPointerConversion<_Pp>::value
   >::type;
 
   template <class _UPtr, class _Up,
         class _ElemT = typename _UPtr::element_type>
-  using _EnableIfMoveConvertible = typename enable_if<
+  using _EnableIfMoveConvertible _LIBCPP_NODEBUG_TYPE  = typename enable_if<
       is_array<_Up>::value &&
       is_same<pointer, element_type*>::value &&
       is_same<typename _UPtr::pointer, _ElemT*>::value &&
@@ -2720,79 +2661,79 @@
     >::type;
 
   template <class _UDel>
-  using _EnableIfDeleterConvertible = typename enable_if<
+  using _EnableIfDeleterConvertible _LIBCPP_NODEBUG_TYPE  = typename enable_if<
       (is_reference<_Dp>::value && is_same<_Dp, _UDel>::value) ||
       (!is_reference<_Dp>::value && is_convertible<_UDel, _Dp>::value)
     >::type;
 
   template <class _UDel>
-  using _EnableIfDeleterAssignable = typename enable_if<
+  using _EnableIfDeleterAssignable _LIBCPP_NODEBUG_TYPE  = typename enable_if<
       is_assignable<_Dp&, _UDel&&>::value
     >::type;
 
 public:
   template <bool _Dummy = true,
-            class = _EnableIfDeleterDefaultConstructible<_Dummy>>
+            class = _EnableIfDeleterDefaultConstructible<_Dummy> >
   _LIBCPP_INLINE_VISIBILITY
-  constexpr unique_ptr() noexcept : __ptr_(pointer()) {}
+  _LIBCPP_CONSTEXPR unique_ptr() _NOEXCEPT : __ptr_(pointer()) {}
 
   template <bool _Dummy = true,
-            class = _EnableIfDeleterDefaultConstructible<_Dummy>>
+            class = _EnableIfDeleterDefaultConstructible<_Dummy> >
   _LIBCPP_INLINE_VISIBILITY
-  constexpr unique_ptr(nullptr_t) noexcept : __ptr_(pointer()) {}
+  _LIBCPP_CONSTEXPR unique_ptr(nullptr_t) _NOEXCEPT : __ptr_(pointer()) {}
 
   template <class _Pp, bool _Dummy = true,
             class = _EnableIfDeleterDefaultConstructible<_Dummy>,
-            class = _EnableIfPointerConvertible<_Pp>>
+            class = _EnableIfPointerConvertible<_Pp> >
   _LIBCPP_INLINE_VISIBILITY
-  explicit unique_ptr(_Pp __p) noexcept
+  explicit unique_ptr(_Pp __p) _NOEXCEPT
       : __ptr_(__p) {}
 
   template <class _Pp, bool _Dummy = true,
-            class = _EnableIfDeleterConstructible<_LValRefType<_Dummy>>,
-            class = _EnableIfPointerConvertible<_Pp>>
+            class = _EnableIfDeleterConstructible<_LValRefType<_Dummy> >,
+            class = _EnableIfPointerConvertible<_Pp> >
   _LIBCPP_INLINE_VISIBILITY
-  unique_ptr(_Pp __p, _LValRefType<_Dummy> __d) noexcept
+  unique_ptr(_Pp __p, _LValRefType<_Dummy> __d) _NOEXCEPT
       : __ptr_(__p, __d) {}
 
   template <bool _Dummy = true,
-            class = _EnableIfDeleterConstructible<_LValRefType<_Dummy>>>
+            class = _EnableIfDeleterConstructible<_LValRefType<_Dummy> > >
   _LIBCPP_INLINE_VISIBILITY
-  unique_ptr(nullptr_t, _LValRefType<_Dummy> __d) noexcept
+  unique_ptr(nullptr_t, _LValRefType<_Dummy> __d) _NOEXCEPT
       : __ptr_(nullptr, __d) {}
 
   template <class _Pp, bool _Dummy = true,
-            class = _EnableIfDeleterConstructible<_GoodRValRefType<_Dummy>>,
-            class = _EnableIfPointerConvertible<_Pp>>
+            class = _EnableIfDeleterConstructible<_GoodRValRefType<_Dummy> >,
+            class = _EnableIfPointerConvertible<_Pp> >
   _LIBCPP_INLINE_VISIBILITY
-  unique_ptr(_Pp __p, _GoodRValRefType<_Dummy> __d) noexcept
+  unique_ptr(_Pp __p, _GoodRValRefType<_Dummy> __d) _NOEXCEPT
       : __ptr_(__p, _VSTD::move(__d)) {
     static_assert(!is_reference<deleter_type>::value,
                   "rvalue deleter bound to reference");
   }
 
   template <bool _Dummy = true,
-            class = _EnableIfDeleterConstructible<_GoodRValRefType<_Dummy>>>
+            class = _EnableIfDeleterConstructible<_GoodRValRefType<_Dummy> > >
   _LIBCPP_INLINE_VISIBILITY
-  unique_ptr(nullptr_t, _GoodRValRefType<_Dummy> __d) noexcept
+  unique_ptr(nullptr_t, _GoodRValRefType<_Dummy> __d) _NOEXCEPT
       : __ptr_(nullptr, _VSTD::move(__d)) {
     static_assert(!is_reference<deleter_type>::value,
                   "rvalue deleter bound to reference");
   }
 
   template <class _Pp, bool _Dummy = true,
-            class = _EnableIfDeleterConstructible<_BadRValRefType<_Dummy>>,
-            class = _EnableIfPointerConvertible<_Pp>>
+            class = _EnableIfDeleterConstructible<_BadRValRefType<_Dummy> >,
+            class = _EnableIfPointerConvertible<_Pp> >
   _LIBCPP_INLINE_VISIBILITY
   unique_ptr(_Pp __p, _BadRValRefType<_Dummy> __d) = delete;
 
   _LIBCPP_INLINE_VISIBILITY
-  unique_ptr(unique_ptr&& __u) noexcept
+  unique_ptr(unique_ptr&& __u) _NOEXCEPT
       : __ptr_(__u.release(), _VSTD::forward<deleter_type>(__u.get_deleter())) {
   }
 
   _LIBCPP_INLINE_VISIBILITY
-  unique_ptr& operator=(unique_ptr&& __u) noexcept {
+  unique_ptr& operator=(unique_ptr&& __u) _NOEXCEPT {
     reset(__u.release());
     __ptr_.second() = _VSTD::forward<deleter_type>(__u.get_deleter());
     return *this;
@@ -2803,7 +2744,7 @@
       class = _EnableIfDeleterConvertible<_Ep>
   >
   _LIBCPP_INLINE_VISIBILITY
-  unique_ptr(unique_ptr<_Up, _Ep>&& __u) noexcept
+  unique_ptr(unique_ptr<_Up, _Ep>&& __u) _NOEXCEPT
       : __ptr_(__u.release(), _VSTD::forward<_Ep>(__u.get_deleter())) {
   }
 
@@ -2813,73 +2754,16 @@
   >
   _LIBCPP_INLINE_VISIBILITY
   unique_ptr&
-  operator=(unique_ptr<_Up, _Ep>&& __u) noexcept {
+  operator=(unique_ptr<_Up, _Ep>&& __u) _NOEXCEPT {
     reset(__u.release());
     __ptr_.second() = _VSTD::forward<_Ep>(__u.get_deleter());
     return *this;
   }
 
-#else // _LIBCPP_CXX03_LANG
-private:
-  template <class _Up> explicit unique_ptr(_Up);
-
-  unique_ptr(unique_ptr&);
-  template <class _Up> unique_ptr(unique_ptr<_Up>&);
-
-  unique_ptr& operator=(unique_ptr&);
-  template <class _Up> unique_ptr& operator=(unique_ptr<_Up>&);
-
-  template <class _Up>
-  unique_ptr(_Up __u,
-             typename conditional<
-                 is_reference<deleter_type>::value, deleter_type,
-                 typename add_lvalue_reference<const deleter_type>::type>::type,
-             typename enable_if<is_convertible<_Up, pointer>::value,
-                                __nat>::type = __nat());
-public:
-  _LIBCPP_INLINE_VISIBILITY
-  unique_ptr() : __ptr_(pointer()) {
-    static_assert(!is_pointer<deleter_type>::value,
-                  "unique_ptr constructed with null function pointer deleter");
-  }
-  _LIBCPP_INLINE_VISIBILITY
-  unique_ptr(nullptr_t) : __ptr_(pointer()) {
-    static_assert(!is_pointer<deleter_type>::value,
-                  "unique_ptr constructed with null function pointer deleter");
-  }
-
-  _LIBCPP_INLINE_VISIBILITY
-  explicit unique_ptr(pointer __p) : __ptr_(__p) {
-    static_assert(!is_pointer<deleter_type>::value,
-                  "unique_ptr constructed with null function pointer deleter");
-  }
-
-  _LIBCPP_INLINE_VISIBILITY
-  unique_ptr(pointer __p, deleter_type __d)
-      : __ptr_(__p, _VSTD::forward<deleter_type>(__d)) {}
-
-  _LIBCPP_INLINE_VISIBILITY
-  unique_ptr(nullptr_t, deleter_type __d)
-      : __ptr_(pointer(), _VSTD::forward<deleter_type>(__d)) {}
-
-  _LIBCPP_INLINE_VISIBILITY
-  operator __rv<unique_ptr>() {
-    return __rv<unique_ptr>(*this);
-  }
-
-  _LIBCPP_INLINE_VISIBILITY
-  unique_ptr(__rv<unique_ptr> __u)
-      : __ptr_(__u->release(),
-               _VSTD::forward<deleter_type>(__u->get_deleter())) {}
-
-  _LIBCPP_INLINE_VISIBILITY
-  unique_ptr& operator=(__rv<unique_ptr> __u) {
-    reset(__u->release());
-    __ptr_.second() = _VSTD::forward<deleter_type>(__u->get_deleter());
-    return *this;
-  }
-
-#endif // _LIBCPP_CXX03_LANG
+#ifdef _LIBCPP_CXX03_LANG
+  unique_ptr(unique_ptr const&) = delete;
+  unique_ptr& operator=(unique_ptr const&) = delete;
+#endif
 
 public:
   _LIBCPP_INLINE_VISIBILITY
@@ -3091,18 +2975,6 @@
     return !(nullptr < __x);
 }
 
-#ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
-template <class _Tp, class _Dp>
-inline _LIBCPP_INLINE_VISIBILITY
-unique_ptr<_Tp, _Dp>
-move(unique_ptr<_Tp, _Dp>& __t)
-{
-    return unique_ptr<_Tp, _Dp>(__rv<unique_ptr<_Tp, _Dp> >(__t));
-}
-
-#endif
-
 #if _LIBCPP_STD_VER > 11
 
 template<class _Tp>
@@ -3151,7 +3023,7 @@
 struct _LIBCPP_TEMPLATE_VIS hash<unique_ptr<_Tp, _Dp> >
 #else
 struct _LIBCPP_TEMPLATE_VIS hash<__enable_hash_helper<
-    unique_ptr<_Tp, _Dp>, typename unique_ptr<_Tp, _Dp>::pointer>>
+    unique_ptr<_Tp, _Dp>, typename unique_ptr<_Tp, _Dp>::pointer> >
 #endif
 {
     typedef unique_ptr<_Tp, _Dp> argument_type;
@@ -3206,10 +3078,10 @@
 template <class _Alloc>
 class __allocator_destructor
 {
-    typedef allocator_traits<_Alloc> __alloc_traits;
+    typedef _LIBCPP_NODEBUG_TYPE allocator_traits<_Alloc> __alloc_traits;
 public:
-    typedef typename __alloc_traits::pointer pointer;
-    typedef typename __alloc_traits::size_type size_type;
+    typedef _LIBCPP_NODEBUG_TYPE typename __alloc_traits::pointer pointer;
+    typedef _LIBCPP_NODEBUG_TYPE typename __alloc_traits::size_type size_type;
 private:
     _Alloc& __alloc_;
     size_type __s_;
@@ -3466,7 +3338,7 @@
                        && defined(__ATOMIC_RELAXED)                  \
                        && defined(__ATOMIC_ACQ_REL)
 #   define _LIBCPP_HAS_BUILTIN_ATOMIC_SUPPORT
-#elif !defined(__clang__) && defined(_GNUC_VER) && _GNUC_VER >= 407
+#elif defined(_LIBCPP_COMPILER_GCC)
 #   define _LIBCPP_HAS_BUILTIN_ATOMIC_SUPPORT
 #endif
 
@@ -5668,6 +5540,52 @@
      >
    : true_type {};
 
+// __builtin_new_allocator -- A non-templated helper for allocating and
+// deallocating memory using __builtin_operator_new and
+// __builtin_operator_delete. It should be used in preference to
+// `std::allocator<T>` to avoid additional instantiations.
+struct __builtin_new_allocator {
+  struct __builtin_new_deleter {
+    typedef void* pointer_type;
+
+    _LIBCPP_CONSTEXPR explicit __builtin_new_deleter(size_t __size, size_t __align)
+        : __size_(__size), __align_(__align) {}
+
+    void operator()(void* p) const _NOEXCEPT {
+        std::__libcpp_deallocate(p, __size_, __align_);
+    }
+
+   private:
+    size_t __size_;
+    size_t __align_;
+  };
+
+  typedef unique_ptr<void, __builtin_new_deleter> __holder_t;
+
+  static __holder_t __allocate_bytes(size_t __s, size_t __align) {
+      return __holder_t(std::__libcpp_allocate(__s, __align),
+                     __builtin_new_deleter(__s, __align));
+  }
+
+  static void __deallocate_bytes(void* __p, size_t __s,
+                                 size_t __align) _NOEXCEPT {
+      std::__libcpp_deallocate(__p, __s, __align);
+  }
+
+  template <class _Tp>
+  _LIBCPP_NODEBUG _LIBCPP_ALWAYS_INLINE
+  static __holder_t __allocate_type(size_t __n) {
+      return __allocate_bytes(__n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp));
+  }
+
+  template <class _Tp>
+  _LIBCPP_NODEBUG _LIBCPP_ALWAYS_INLINE
+  static void __deallocate_type(void* __p, size_t __n) _NOEXCEPT {
+      __deallocate_bytes(__p, __n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp));
+  }
+};
+
+
 _LIBCPP_END_NAMESPACE_STD
 
 _LIBCPP_POP_MACROS
diff --git a/linux-x64/clang/include/c++/v1/mutex b/linux-x64/clang/include/c++/v1/mutex
index 98bd581..20c3ffc 100644
--- a/linux-x64/clang/include/c++/v1/mutex
+++ b/linux-x64/clang/include/c++/v1/mutex
@@ -188,6 +188,7 @@
 
 #include <__config>
 #include <__mutex_base>
+#include <cstdint>
 #include <functional>
 #include <memory>
 #ifndef _LIBCPP_CXX03_LANG
@@ -575,11 +576,18 @@
     _LIBCPP_CONSTEXPR
         once_flag() _NOEXCEPT : __state_(0) {}
 
+#if defined(_LIBCPP_ABI_MICROSOFT)
+   typedef uintptr_t _State_type;
+#else
+   typedef unsigned long _State_type;
+#endif
+
+
 private:
     once_flag(const once_flag&); // = delete;
     once_flag& operator=(const once_flag&); // = delete;
 
-    unsigned long __state_;
+    _State_type __state_;
 
 #ifndef _LIBCPP_CXX03_LANG
     template<class _Callable, class... _Args>
@@ -649,7 +657,8 @@
     (*__p)();
 }
 
-_LIBCPP_FUNC_VIS void __call_once(volatile unsigned long&, void*, void(*)(void*));
+_LIBCPP_FUNC_VIS void __call_once(volatile once_flag::_State_type&, void*,
+                                  void (*)(void*));
 
 #ifndef _LIBCPP_CXX03_LANG
 
@@ -658,7 +667,7 @@
 void
 call_once(once_flag& __flag, _Callable&& __func, _Args&&... __args)
 {
-    if (__libcpp_acquire_load(&__flag.__state_) != ~0ul)
+    if (__libcpp_acquire_load(&__flag.__state_) != ~once_flag::_State_type(0))
     {
         typedef tuple<_Callable&&, _Args&&...> _Gp;
         _Gp __f(_VSTD::forward<_Callable>(__func), _VSTD::forward<_Args>(__args)...);
@@ -674,7 +683,7 @@
 void
 call_once(once_flag& __flag, _Callable& __func)
 {
-    if (__libcpp_acquire_load(&__flag.__state_) != ~0ul)
+    if (__libcpp_acquire_load(&__flag.__state_) != ~once_flag::_State_type(0))
     {
         __call_once_param<_Callable> __p(__func);
         __call_once(__flag.__state_, &__p, &__call_once_proxy<_Callable>);
@@ -686,7 +695,7 @@
 void
 call_once(once_flag& __flag, const _Callable& __func)
 {
-    if (__libcpp_acquire_load(&__flag.__state_) != ~0ul)
+    if (__libcpp_acquire_load(&__flag.__state_) != ~once_flag::_State_type(0))
     {
         __call_once_param<const _Callable> __p(__func);
         __call_once(__flag.__state_, &__p, &__call_once_proxy<const _Callable>);
diff --git a/linux-x64/clang/include/c++/v1/new b/linux-x64/clang/include/c++/v1/new
index b5e8fb4..85e4c4b 100644
--- a/linux-x64/clang/include/c++/v1/new
+++ b/linux-x64/clang/include/c++/v1/new
@@ -33,6 +33,12 @@
 };
 
 enum class align_val_t : size_t {}; // C++17
+
+struct destroying_delete_t { // C++20
+  explicit destroying_delete_t() = default;
+};
+inline constexpr destroying_delete_t destroying_delete{}; // C++20
+
 struct nothrow_t {};
 extern const nothrow_t nothrow;
 typedef void (*new_handler)();
@@ -89,7 +95,7 @@
 #include <cstdlib>
 #endif
 
-#if defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_NO_VCRUNTIME)
+#if defined(_LIBCPP_ABI_VCRUNTIME)
 #include <new.h>
 #endif
 
@@ -119,7 +125,7 @@
 namespace std  // purposefully not using versioning namespace
 {
 
-#if !defined(_LIBCPP_ABI_MICROSOFT) || defined(_LIBCPP_NO_VCRUNTIME)
+#if !defined(_LIBCPP_ABI_VCRUNTIME)
 struct _LIBCPP_TYPE_VIS nothrow_t {};
 extern _LIBCPP_FUNC_VIS const nothrow_t nothrow;
 
@@ -145,12 +151,12 @@
 _LIBCPP_FUNC_VIS new_handler set_new_handler(new_handler) _NOEXCEPT;
 _LIBCPP_FUNC_VIS new_handler get_new_handler() _NOEXCEPT;
 
-#endif // !_LIBCPP_ABI_MICROSOFT || _LIBCPP_NO_VCRUNTIME
+#endif // !_LIBCPP_ABI_VCRUNTIME
 
 _LIBCPP_NORETURN _LIBCPP_FUNC_VIS void __throw_bad_alloc();  // not in C++ spec
 
 #if !defined(_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION) && \
-    !defined(_LIBCPP_DEFER_NEW_TO_VCRUNTIME)
+    !defined(_LIBCPP_ABI_VCRUNTIME)
 #ifndef _LIBCPP_CXX03_LANG
 enum class _LIBCPP_ENUM_VIS align_val_t : size_t { };
 #else
@@ -158,6 +164,15 @@
 #endif
 #endif
 
+#if _LIBCPP_STD_VER > 17
+// Enable the declaration even if the compiler doesn't support the language
+// feature.
+struct destroying_delete_t {
+  explicit destroying_delete_t() = default;
+};
+_LIBCPP_INLINE_VAR constexpr destroying_delete_t destroying_delete{};
+#endif // _LIBCPP_STD_VER > 17
+
 }  // std
 
 #if defined(_LIBCPP_CXX03_LANG)
@@ -166,10 +181,10 @@
 #define _THROW_BAD_ALLOC
 #endif
 
-#if !defined(_LIBCPP_DEFER_NEW_TO_VCRUNTIME)
+#if !defined(_LIBCPP_ABI_VCRUNTIME)
 
 _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz) _THROW_BAD_ALLOC;
-_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _NOALIAS;
+_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _LIBCPP_NOALIAS;
 _LIBCPP_OVERRIDABLE_FUNC_VIS void  operator delete(void* __p) _NOEXCEPT;
 _LIBCPP_OVERRIDABLE_FUNC_VIS void  operator delete(void* __p, const std::nothrow_t&) _NOEXCEPT;
 #ifndef _LIBCPP_HAS_NO_LIBRARY_SIZED_DEALLOCATION
@@ -177,7 +192,7 @@
 #endif
 
 _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz) _THROW_BAD_ALLOC;
-_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _NOALIAS;
+_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _LIBCPP_NOALIAS;
 _LIBCPP_OVERRIDABLE_FUNC_VIS void  operator delete[](void* __p) _NOEXCEPT;
 _LIBCPP_OVERRIDABLE_FUNC_VIS void  operator delete[](void* __p, const std::nothrow_t&) _NOEXCEPT;
 #ifndef _LIBCPP_HAS_NO_LIBRARY_SIZED_DEALLOCATION
@@ -186,7 +201,7 @@
 
 #ifndef _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION
 _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz, std::align_val_t) _THROW_BAD_ALLOC;
-_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz, std::align_val_t, const std::nothrow_t&) _NOEXCEPT _NOALIAS;
+_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz, std::align_val_t, const std::nothrow_t&) _NOEXCEPT _LIBCPP_NOALIAS;
 _LIBCPP_OVERRIDABLE_FUNC_VIS void  operator delete(void* __p, std::align_val_t) _NOEXCEPT;
 _LIBCPP_OVERRIDABLE_FUNC_VIS void  operator delete(void* __p, std::align_val_t, const std::nothrow_t&) _NOEXCEPT;
 #ifndef _LIBCPP_HAS_NO_LIBRARY_SIZED_DEALLOCATION
@@ -194,7 +209,7 @@
 #endif
 
 _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz, std::align_val_t) _THROW_BAD_ALLOC;
-_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz, std::align_val_t, const std::nothrow_t&) _NOEXCEPT _NOALIAS;
+_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz, std::align_val_t, const std::nothrow_t&) _NOEXCEPT _LIBCPP_NOALIAS;
 _LIBCPP_OVERRIDABLE_FUNC_VIS void  operator delete[](void* __p, std::align_val_t) _NOEXCEPT;
 _LIBCPP_OVERRIDABLE_FUNC_VIS void  operator delete[](void* __p, std::align_val_t, const std::nothrow_t&) _NOEXCEPT;
 #ifndef _LIBCPP_HAS_NO_LIBRARY_SIZED_DEALLOCATION
@@ -207,7 +222,7 @@
 inline _LIBCPP_INLINE_VISIBILITY void  operator delete  (void*, void*) _NOEXCEPT {}
 inline _LIBCPP_INLINE_VISIBILITY void  operator delete[](void*, void*) _NOEXCEPT {}
 
-#endif // !_LIBCPP_DEFER_NEW_TO_VCRUNTIME
+#endif // !_LIBCPP_ABI_VCRUNTIME
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
diff --git a/linux-x64/clang/include/c++/v1/numeric b/linux-x64/clang/include/c++/v1/numeric
index 9941770..2118704 100644
--- a/linux-x64/clang/include/c++/v1/numeric
+++ b/linux-x64/clang/include/c++/v1/numeric
@@ -133,6 +133,10 @@
 template <class M, class N>
     constexpr common_type_t<M,N> lcm(M m, N n);    // C++17
 
+integer         midpoint(integer a, integer b);                  // C++20
+pointer         midpoint(pointer a, pointer b);                  // C++20
+floating_point  midpoint(floating_point a, floating_point b);    // C++20
+
 }  // std
 
 */
@@ -141,6 +145,7 @@
 #include <iterator>
 #include <limits> // for numeric_limits
 #include <functional>
+#include <cmath> // for isnormal
 #include <version>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -455,10 +460,10 @@
 
 
 #if _LIBCPP_STD_VER > 14
-template <typename _Result, typename _Source, bool _IsSigned = is_signed<_Source>::value> struct __abs;
+template <typename _Result, typename _Source, bool _IsSigned = is_signed<_Source>::value> struct __ct_abs;
 
 template <typename _Result, typename _Source>
-struct __abs<_Result, _Source, true> {
+struct __ct_abs<_Result, _Source, true> {
     _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
     _Result operator()(_Source __t) const noexcept
     {
@@ -469,7 +474,7 @@
 };
 
 template <typename _Result, typename _Source>
-struct __abs<_Result, _Source, false> {
+struct __ct_abs<_Result, _Source, false> {
     _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
     _Result operator()(_Source __t) const noexcept { return __t; }
 };
@@ -495,8 +500,8 @@
     using _Rp = common_type_t<_Tp,_Up>;
     using _Wp = make_unsigned_t<_Rp>;
     return static_cast<_Rp>(_VSTD::__gcd(
-        static_cast<_Wp>(__abs<_Rp, _Tp>()(__m)),
-        static_cast<_Wp>(__abs<_Rp, _Up>()(__n))));
+        static_cast<_Wp>(__ct_abs<_Rp, _Tp>()(__m)),
+        static_cast<_Wp>(__ct_abs<_Rp, _Up>()(__n))));
 }
 
 template<class _Tp, class _Up>
@@ -511,14 +516,72 @@
         return 0;
 
     using _Rp = common_type_t<_Tp,_Up>;
-    _Rp __val1 = __abs<_Rp, _Tp>()(__m) / _VSTD::gcd(__m, __n);
-    _Rp __val2 = __abs<_Rp, _Up>()(__n);
+    _Rp __val1 = __ct_abs<_Rp, _Tp>()(__m) / _VSTD::gcd(__m, __n);
+    _Rp __val2 = __ct_abs<_Rp, _Up>()(__n);
     _LIBCPP_ASSERT((numeric_limits<_Rp>::max() / __val1 > __val2), "Overflow in lcm");
     return __val1 * __val2;
 }
 
 #endif /* _LIBCPP_STD_VER > 14 */
 
+#if _LIBCPP_STD_VER > 17
+template <class _Tp>
+_LIBCPP_INLINE_VISIBILITY constexpr
+enable_if_t<is_integral_v<_Tp> && !is_same_v<bool, _Tp> && !is_null_pointer_v<_Tp>, _Tp>
+midpoint(_Tp __a, _Tp __b) noexcept
+_LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
+{
+    using _Up = std::make_unsigned_t<_Tp>;
+
+    int __sign = 1;
+    _Up __m = __a;
+    _Up __M = __b;
+    if (__a > __b)
+    {
+        __sign = -1;
+        __m = __b;
+        __M = __a;
+    }
+     return __a + __sign * _Tp(_Up(__M-__m) >> 1);
+}
+
+
+template <class _TPtr>
+_LIBCPP_INLINE_VISIBILITY constexpr
+enable_if_t<is_pointer_v<_TPtr>
+             && is_object_v<remove_pointer_t<_TPtr>>
+             && ! is_void_v<remove_pointer_t<_TPtr>>
+             && (sizeof(remove_pointer_t<_TPtr>) > 0), _TPtr>
+midpoint(_TPtr __a, _TPtr __b) noexcept
+{
+    return __a + _VSTD::midpoint(ptrdiff_t(0), __b - __a);
+}
+
+
+template <typename _Tp>
+constexpr int __sign(_Tp __val) {
+    return (_Tp(0) < __val) - (__val < _Tp(0));
+}
+
+template <typename _Fp>
+constexpr _Fp __fp_abs(_Fp __f) { return __f >= 0 ? __f : -__f; }
+
+template <class _Fp>
+_LIBCPP_INLINE_VISIBILITY constexpr
+enable_if_t<is_floating_point_v<_Fp>, _Fp>
+midpoint(_Fp __a, _Fp __b) noexcept
+{
+	constexpr _Fp __lo = numeric_limits<_Fp>::min()*2;
+	constexpr _Fp __hi = numeric_limits<_Fp>::max()/2;
+    return __fp_abs(__a) <= __hi && __fp_abs(__b) <= __hi ?  // typical case: overflow is impossible
+      (__a + __b)/2 :                                        // always correctly rounded
+      __fp_abs(__a) < __lo ? __a + __b/2 :                   // not safe to halve a
+      __fp_abs(__a) < __lo ? __a/2 + __b :                   // not safe to halve b
+      __a/2 + __b/2;                                         // otherwise correctly rounded
+}
+
+#endif // _LIBCPP_STD_VER > 17
+
 _LIBCPP_END_NAMESPACE_STD
 
 _LIBCPP_POP_MACROS
diff --git a/linux-x64/clang/include/c++/v1/optional b/linux-x64/clang/include/c++/v1/optional
index be584b3..a147d69 100644
--- a/linux-x64/clang/include/c++/v1/optional
+++ b/linux-x64/clang/include/c++/v1/optional
@@ -592,7 +592,7 @@
 
 private:
      // Disable the reference extension using this static assert.
-    static_assert(!is_same_v<value_type, in_place_t>,
+    static_assert(!is_same_v<__uncvref_t<value_type>, in_place_t>,
         "instantiation of optional with in_place_t is ill-formed");
     static_assert(!is_same_v<__uncvref_t<value_type>, nullopt_t>,
         "instantiation of optional with nullopt_t is ill-formed");
@@ -600,6 +600,8 @@
         "instantiation of optional with a reference type is ill-formed");
     static_assert(is_destructible_v<value_type>,
         "instantiation of optional with a non-destructible type is ill-formed");
+    static_assert(!is_array_v<value_type>,
+        "instantiation of optional with an array type is ill-formed");
 
     // LWG2756: conditionally explicit conversion from _Up
     struct _CheckOptionalArgsConstructor {
@@ -616,16 +618,16 @@
       }
     };
     template <class _Up>
-    using _CheckOptionalArgsCtor = conditional_t<
-        !is_same_v<__uncvref_t<_Up>, in_place_t> &&
-        !is_same_v<__uncvref_t<_Up>, optional>,
+    using _CheckOptionalArgsCtor = _If<
+        _IsNotSame<__uncvref_t<_Up>, in_place_t>::value &&
+        _IsNotSame<__uncvref_t<_Up>, optional>::value,
         _CheckOptionalArgsConstructor,
         __check_tuple_constructor_fail
     >;
     template <class _QualUp>
     struct _CheckOptionalLikeConstructor {
       template <class _Up, class _Opt = optional<_Up>>
-      using __check_constructible_from_opt = __lazy_or<
+      using __check_constructible_from_opt = _Or<
           is_constructible<_Tp, _Opt&>,
           is_constructible<_Tp, _Opt const&>,
           is_constructible<_Tp, _Opt&&>,
@@ -636,7 +638,7 @@
           is_convertible<_Opt const&&, _Tp>
       >;
       template <class _Up, class _Opt = optional<_Up>>
-      using __check_assignable_from_opt = __lazy_or<
+      using __check_assignable_from_opt = _Or<
           is_assignable<_Tp&, _Opt&>,
           is_assignable<_Tp&, _Opt const&>,
           is_assignable<_Tp&, _Opt&&>,
@@ -662,18 +664,18 @@
     };
 
     template <class _Up, class _QualUp>
-    using _CheckOptionalLikeCtor = conditional_t<
-      __lazy_and<
-          __lazy_not<is_same<_Up, _Tp>>,
+    using _CheckOptionalLikeCtor = _If<
+      _And<
+         _IsNotSame<_Up, _Tp>,
           is_constructible<_Tp, _QualUp>
       >::value,
       _CheckOptionalLikeConstructor<_QualUp>,
       __check_tuple_constructor_fail
     >;
     template <class _Up, class _QualUp>
-    using _CheckOptionalLikeAssign = conditional_t<
-      __lazy_and<
-          __lazy_not<is_same<_Up, _Tp>>,
+    using _CheckOptionalLikeAssign = _If<
+      _And<
+          _IsNotSame<_Up, _Tp>,
           is_constructible<_Tp, _QualUp>,
           is_assignable<_Tp&, _QualUp>
       >::value,
@@ -687,28 +689,32 @@
     _LIBCPP_INLINE_VISIBILITY constexpr optional(optional&&) = default;
     _LIBCPP_INLINE_VISIBILITY constexpr optional(nullopt_t) noexcept {}
 
-    template <class... _Args, class = enable_if_t<
-        is_constructible_v<value_type, _Args...>>
+    template <class _InPlaceT, class... _Args, class = _EnableIf<
+          _And<
+              _IsSame<_InPlaceT, in_place_t>,
+              is_constructible<value_type, _Args...>
+            >::value
+        >
     >
     _LIBCPP_INLINE_VISIBILITY
-    constexpr explicit optional(in_place_t, _Args&&... __args)
+    constexpr explicit optional(_InPlaceT, _Args&&... __args)
         : __base(in_place, _VSTD::forward<_Args>(__args)...) {}
 
-    template <class _Up, class... _Args, class = enable_if_t<
+    template <class _Up, class... _Args, class = _EnableIf<
         is_constructible_v<value_type, initializer_list<_Up>&, _Args...>>
     >
     _LIBCPP_INLINE_VISIBILITY
     constexpr explicit optional(in_place_t, initializer_list<_Up> __il, _Args&&... __args)
         : __base(in_place, __il, _VSTD::forward<_Args>(__args)...) {}
 
-    template <class _Up = value_type, enable_if_t<
+    template <class _Up = value_type, _EnableIf<
         _CheckOptionalArgsCtor<_Up>::template __enable_implicit<_Up>()
     , int> = 0>
     _LIBCPP_INLINE_VISIBILITY
     constexpr optional(_Up&& __v)
         : __base(in_place, _VSTD::forward<_Up>(__v)) {}
 
-    template <class _Up, enable_if_t<
+    template <class _Up, _EnableIf<
         _CheckOptionalArgsCtor<_Up>::template __enable_explicit<_Up>()
     , int> = 0>
     _LIBCPP_INLINE_VISIBILITY
@@ -716,7 +722,7 @@
         : __base(in_place, _VSTD::forward<_Up>(__v)) {}
 
     // LWG2756: conditionally explicit conversion from const optional<_Up>&
-    template <class _Up, enable_if_t<
+    template <class _Up, _EnableIf<
         _CheckOptionalLikeCtor<_Up, _Up const&>::template __enable_implicit<_Up>()
     , int> = 0>
     _LIBCPP_INLINE_VISIBILITY
@@ -724,7 +730,7 @@
     {
         this->__construct_from(__v);
     }
-    template <class _Up, enable_if_t<
+    template <class _Up, _EnableIf<
         _CheckOptionalLikeCtor<_Up, _Up const&>::template __enable_explicit<_Up>()
     , int> = 0>
     _LIBCPP_INLINE_VISIBILITY
@@ -734,7 +740,7 @@
     }
 
     // LWG2756: conditionally explicit conversion from optional<_Up>&&
-    template <class _Up, enable_if_t<
+    template <class _Up, _EnableIf<
         _CheckOptionalLikeCtor<_Up, _Up &&>::template __enable_implicit<_Up>()
     , int> = 0>
     _LIBCPP_INLINE_VISIBILITY
@@ -742,7 +748,7 @@
     {
         this->__construct_from(_VSTD::move(__v));
     }
-    template <class _Up, enable_if_t<
+    template <class _Up, _EnableIf<
         _CheckOptionalLikeCtor<_Up, _Up &&>::template __enable_explicit<_Up>()
     , int> = 0>
     _LIBCPP_INLINE_VISIBILITY
@@ -763,11 +769,12 @@
 
     // LWG2756
     template <class _Up = value_type,
-              class = enable_if_t
-                      <__lazy_and<
-                          integral_constant<bool,
-                              !is_same_v<__uncvref_t<_Up>, optional> &&
-                              !(is_same_v<_Up, value_type> && is_scalar_v<value_type>)
+              class = _EnableIf<
+                      _And<
+                          _IsNotSame<__uncvref_t<_Up>, optional>,
+                          _Or<
+                              _IsNotSame<__uncvref_t<_Up>, value_type>,
+                              _Not<is_scalar<value_type>>
                           >,
                           is_constructible<value_type, _Up>,
                           is_assignable<value_type&, _Up>
@@ -785,7 +792,7 @@
     }
 
     // LWG2756
-    template <class _Up, enable_if_t<
+    template <class _Up, _EnableIf<
         _CheckOptionalLikeAssign<_Up, _Up const&>::template __enable_assign<_Up>()
     , int> = 0>
     _LIBCPP_INLINE_VISIBILITY
@@ -797,7 +804,7 @@
     }
 
     // LWG2756
-    template <class _Up, enable_if_t<
+    template <class _Up, _EnableIf<
         _CheckOptionalLikeCtor<_Up, _Up &&>::template __enable_assign<_Up>()
     , int> = 0>
     _LIBCPP_INLINE_VISIBILITY
@@ -809,7 +816,7 @@
     }
 
     template <class... _Args,
-              class = enable_if_t
+              class = _EnableIf
                       <
                           is_constructible_v<value_type, _Args...>
                       >
@@ -824,7 +831,7 @@
     }
 
     template <class _Up, class... _Args,
-              class = enable_if_t
+              class = _EnableIf
                       <
                           is_constructible_v<value_type, initializer_list<_Up>&, _Args...>
                       >
@@ -1020,7 +1027,7 @@
 // Comparisons between optionals
 template <class _Tp, class _Up>
 _LIBCPP_INLINE_VISIBILITY constexpr
-enable_if_t<
+_EnableIf<
     is_convertible_v<decltype(_VSTD::declval<const _Tp&>() ==
         _VSTD::declval<const _Up&>()), bool>,
     bool
@@ -1036,7 +1043,7 @@
 
 template <class _Tp, class _Up>
 _LIBCPP_INLINE_VISIBILITY constexpr
-enable_if_t<
+_EnableIf<
     is_convertible_v<decltype(_VSTD::declval<const _Tp&>() !=
         _VSTD::declval<const _Up&>()), bool>,
     bool
@@ -1052,7 +1059,7 @@
 
 template <class _Tp, class _Up>
 _LIBCPP_INLINE_VISIBILITY constexpr
-enable_if_t<
+_EnableIf<
     is_convertible_v<decltype(_VSTD::declval<const _Tp&>() <
         _VSTD::declval<const _Up&>()), bool>,
     bool
@@ -1068,7 +1075,7 @@
 
 template <class _Tp, class _Up>
 _LIBCPP_INLINE_VISIBILITY constexpr
-enable_if_t<
+_EnableIf<
     is_convertible_v<decltype(_VSTD::declval<const _Tp&>() >
         _VSTD::declval<const _Up&>()), bool>,
     bool
@@ -1084,7 +1091,7 @@
 
 template <class _Tp, class _Up>
 _LIBCPP_INLINE_VISIBILITY constexpr
-enable_if_t<
+_EnableIf<
     is_convertible_v<decltype(_VSTD::declval<const _Tp&>() <=
         _VSTD::declval<const _Up&>()), bool>,
     bool
@@ -1100,7 +1107,7 @@
 
 template <class _Tp, class _Up>
 _LIBCPP_INLINE_VISIBILITY constexpr
-enable_if_t<
+_EnableIf<
     is_convertible_v<decltype(_VSTD::declval<const _Tp&>() >=
         _VSTD::declval<const _Up&>()), bool>,
     bool
@@ -1214,7 +1221,7 @@
 // Comparisons with T
 template <class _Tp, class _Up>
 _LIBCPP_INLINE_VISIBILITY constexpr
-enable_if_t<
+_EnableIf<
     is_convertible_v<decltype(_VSTD::declval<const _Tp&>() ==
         _VSTD::declval<const _Up&>()), bool>,
     bool
@@ -1226,7 +1233,7 @@
 
 template <class _Tp, class _Up>
 _LIBCPP_INLINE_VISIBILITY constexpr
-enable_if_t<
+_EnableIf<
     is_convertible_v<decltype(_VSTD::declval<const _Tp&>() ==
         _VSTD::declval<const _Up&>()), bool>,
     bool
@@ -1238,7 +1245,7 @@
 
 template <class _Tp, class _Up>
 _LIBCPP_INLINE_VISIBILITY constexpr
-enable_if_t<
+_EnableIf<
     is_convertible_v<decltype(_VSTD::declval<const _Tp&>() !=
         _VSTD::declval<const _Up&>()), bool>,
     bool
@@ -1250,7 +1257,7 @@
 
 template <class _Tp, class _Up>
 _LIBCPP_INLINE_VISIBILITY constexpr
-enable_if_t<
+_EnableIf<
     is_convertible_v<decltype(_VSTD::declval<const _Tp&>() !=
         _VSTD::declval<const _Up&>()), bool>,
     bool
@@ -1262,7 +1269,7 @@
 
 template <class _Tp, class _Up>
 _LIBCPP_INLINE_VISIBILITY constexpr
-enable_if_t<
+_EnableIf<
     is_convertible_v<decltype(_VSTD::declval<const _Tp&>() <
         _VSTD::declval<const _Up&>()), bool>,
     bool
@@ -1274,7 +1281,7 @@
 
 template <class _Tp, class _Up>
 _LIBCPP_INLINE_VISIBILITY constexpr
-enable_if_t<
+_EnableIf<
     is_convertible_v<decltype(_VSTD::declval<const _Tp&>() <
         _VSTD::declval<const _Up&>()), bool>,
     bool
@@ -1286,7 +1293,7 @@
 
 template <class _Tp, class _Up>
 _LIBCPP_INLINE_VISIBILITY constexpr
-enable_if_t<
+_EnableIf<
     is_convertible_v<decltype(_VSTD::declval<const _Tp&>() <=
         _VSTD::declval<const _Up&>()), bool>,
     bool
@@ -1298,7 +1305,7 @@
 
 template <class _Tp, class _Up>
 _LIBCPP_INLINE_VISIBILITY constexpr
-enable_if_t<
+_EnableIf<
     is_convertible_v<decltype(_VSTD::declval<const _Tp&>() <=
         _VSTD::declval<const _Up&>()), bool>,
     bool
@@ -1310,7 +1317,7 @@
 
 template <class _Tp, class _Up>
 _LIBCPP_INLINE_VISIBILITY constexpr
-enable_if_t<
+_EnableIf<
     is_convertible_v<decltype(_VSTD::declval<const _Tp&>() >
         _VSTD::declval<const _Up&>()), bool>,
     bool
@@ -1322,7 +1329,7 @@
 
 template <class _Tp, class _Up>
 _LIBCPP_INLINE_VISIBILITY constexpr
-enable_if_t<
+_EnableIf<
     is_convertible_v<decltype(_VSTD::declval<const _Tp&>() >
         _VSTD::declval<const _Up&>()), bool>,
     bool
@@ -1334,7 +1341,7 @@
 
 template <class _Tp, class _Up>
 _LIBCPP_INLINE_VISIBILITY constexpr
-enable_if_t<
+_EnableIf<
     is_convertible_v<decltype(_VSTD::declval<const _Tp&>() >=
         _VSTD::declval<const _Up&>()), bool>,
     bool
@@ -1346,7 +1353,7 @@
 
 template <class _Tp, class _Up>
 _LIBCPP_INLINE_VISIBILITY constexpr
-enable_if_t<
+_EnableIf<
     is_convertible_v<decltype(_VSTD::declval<const _Tp&>() >=
         _VSTD::declval<const _Up&>()), bool>,
     bool
@@ -1359,7 +1366,7 @@
 
 template <class _Tp>
 inline _LIBCPP_INLINE_VISIBILITY
-enable_if_t<
+_EnableIf<
     is_move_constructible_v<_Tp> && is_swappable_v<_Tp>,
     void
 >
diff --git a/linux-x64/clang/include/c++/v1/ostream b/linux-x64/clang/include/c++/v1/ostream
index b20ac34..e6cf9c9 100644
--- a/linux-x64/clang/include/c++/v1/ostream
+++ b/linux-x64/clang/include/c++/v1/ostream
@@ -56,6 +56,7 @@
     basic_ostream& operator<<(long double f);
     basic_ostream& operator<<(const void* p);
     basic_ostream& operator<<(basic_streambuf<char_type,traits>* sb);
+    basic_ostream& operator<<(nullptr_t);
 
     // 27.7.2.7 Unformatted output:
     basic_ostream& put(char_type c);
@@ -218,6 +219,10 @@
     basic_ostream& operator<<(const void* __p);
     basic_ostream& operator<<(basic_streambuf<char_type, traits_type>* __sb);
 
+    _LIBCPP_INLINE_VISIBILITY
+    basic_ostream& operator<<(nullptr_t)
+    { return *this << "nullptr"; }
+
     // 27.7.2.7 Unformatted output:
     basic_ostream& put(char_type __c);
     basic_ostream& write(const char_type* __s, streamsize __n);
diff --git a/linux-x64/clang/include/c++/v1/queue b/linux-x64/clang/include/c++/v1/queue
index 55be800..97ec6f6 100644
--- a/linux-x64/clang/include/c++/v1/queue
+++ b/linux-x64/clang/include/c++/v1/queue
@@ -70,8 +70,8 @@
 
 template<class Container>
   queue(Container) -> queue<typename Container::value_type, Container>; // C++17
-  
-template<class Container, class Allocator> 
+
+template<class Container, class Allocator>
   queue(Container, Allocator) -> queue<typename Container::value_type, Container>; // C++17
 
 template <class T, class Container>
@@ -165,13 +165,13 @@
 template <class Compare, class Container>
 priority_queue(Compare, Container)
     -> priority_queue<typename Container::value_type, Container, Compare>; // C++17
-  
-template<class InputIterator, 
+
+template<class InputIterator,
          class Compare = less<typename iterator_traits<InputIterator>::value_type>,
          class Container = vector<typename iterator_traits<InputIterator>::value_type>>
 priority_queue(InputIterator, InputIterator, Compare = Compare(), Container = Container())
     -> priority_queue<typename iterator_traits<InputIterator>::value_type, Container, Compare>; // C++17
-  
+
 template<class Compare, class Container, class Allocator>
 priority_queue(Compare, Container, Allocator)
     -> priority_queue<typename Container::value_type, Container, Compare>; // C++17
@@ -346,7 +346,7 @@
 >
 queue(_Container)
     -> queue<typename _Container::value_type, _Container>;
-  
+
 template<class _Container,
          class _Alloc,
          class = typename enable_if<!__is_allocator<_Container>::value, nullptr_t>::type,
@@ -558,8 +558,8 @@
 >
 priority_queue(_Compare, _Container)
     -> priority_queue<typename _Container::value_type, _Container, _Compare>;
-  
-template<class _InputIterator, 
+
+template<class _InputIterator,
          class _Compare   = less<typename iterator_traits<_InputIterator>::value_type>,
          class _Container = vector<typename iterator_traits<_InputIterator>::value_type>,
          class = typename enable_if< __is_input_iterator<_InputIterator>::value, nullptr_t>::type,
@@ -568,8 +568,8 @@
 >
 priority_queue(_InputIterator, _InputIterator, _Compare = _Compare(), _Container = _Container())
     -> priority_queue<typename iterator_traits<_InputIterator>::value_type, _Container, _Compare>;
-  
-template<class _Compare, 
+
+template<class _Compare,
          class _Container,
          class _Alloc,
          class = typename enable_if<!__is_allocator<_Compare>::value, nullptr_t>::type,
diff --git a/linux-x64/clang/include/c++/v1/random b/linux-x64/clang/include/c++/v1/random
index a732395..9fefee0 100644
--- a/linux-x64/clang/include/c++/v1/random
+++ b/linux-x64/clang/include/c++/v1/random
@@ -2226,19 +2226,19 @@
 template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
           _UIntType __a, size_t __u, _UIntType __d, size_t __s,
           _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
-    _LIBCPP_CONSTEXPR const size_t 
+    _LIBCPP_CONSTEXPR const size_t
     mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::state_size;
 
 template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
           _UIntType __a, size_t __u, _UIntType __d, size_t __s,
           _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
-    _LIBCPP_CONSTEXPR const size_t 
+    _LIBCPP_CONSTEXPR const size_t
     mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::shift_size;
 
 template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
           _UIntType __a, size_t __u, _UIntType __d, size_t __s,
           _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
-    _LIBCPP_CONSTEXPR const size_t 
+    _LIBCPP_CONSTEXPR const size_t
     mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::mask_bits;
 
 template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
@@ -2250,7 +2250,7 @@
 template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
           _UIntType __a, size_t __u, _UIntType __d, size_t __s,
           _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
-    _LIBCPP_CONSTEXPR const size_t 
+    _LIBCPP_CONSTEXPR const size_t
     mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::tempering_u;
 
 template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
@@ -2262,7 +2262,7 @@
 template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
           _UIntType __a, size_t __u, _UIntType __d, size_t __s,
           _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
-    _LIBCPP_CONSTEXPR const size_t 
+    _LIBCPP_CONSTEXPR const size_t
     mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::tempering_s;
 
 template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
@@ -2274,7 +2274,7 @@
 template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
           _UIntType __a, size_t __u, _UIntType __d, size_t __s,
           _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
-    _LIBCPP_CONSTEXPR const size_t 
+    _LIBCPP_CONSTEXPR const size_t
     mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::tempering_t;
 
 template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
@@ -2286,7 +2286,7 @@
 template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
           _UIntType __a, size_t __u, _UIntType __d, size_t __s,
           _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
-    _LIBCPP_CONSTEXPR const size_t 
+    _LIBCPP_CONSTEXPR const size_t
     mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::tempering_l;
 
 template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
@@ -6426,7 +6426,7 @@
             param_type(size_t __nw, result_type __xmin, result_type __xmax,
                        _UnaryOperation __fw);
         param_type & operator=(const param_type& __rhs);
-        
+
         _LIBCPP_INLINE_VISIBILITY
         vector<result_type> intervals() const {return __b_;}
         _LIBCPP_INLINE_VISIBILITY
diff --git a/linux-x64/clang/include/c++/v1/regex b/linux-x64/clang/include/c++/v1/regex
index c381b51..26efac1 100644
--- a/linux-x64/clang/include/c++/v1/regex
+++ b/linux-x64/clang/include/c++/v1/regex
@@ -677,7 +677,7 @@
                    regex_constants::match_flag_type m = regex_constants::match_default);
     regex_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b,
                    const regex_type&& __re,
-                   regex_constants::match_flag_type __m 
+                   regex_constants::match_flag_type __m
                                      = regex_constants::match_default) = delete; // C++14
     regex_iterator(const regex_iterator&);
     regex_iterator& operator=(const regex_iterator&);
@@ -793,7 +793,11 @@
     nosubs     = 1 << 1,
     optimize   = 1 << 2,
     collate    = 1 << 3,
+#ifdef _LIBCPP_ABI_REGEX_CONSTANTS_NONZERO
+    ECMAScript = 1 << 9,
+#else
     ECMAScript = 0,
+#endif
     basic      = 1 << 4,
     extended   = 1 << 5,
     awk        = 1 << 6,
@@ -801,6 +805,16 @@
     egrep      = 1 << 8
 };
 
+inline _LIBCPP_CONSTEXPR
+syntax_option_type __get_grammar(syntax_option_type __g)
+{
+#ifdef _LIBCPP_ABI_REGEX_CONSTANTS_NONZERO
+    return static_cast<syntax_option_type>(__g & 0x3F0);
+#else
+    return static_cast<syntax_option_type>(__g & 0x1F0);
+#endif
+}
+
 inline _LIBCPP_INLINE_VISIBILITY
 _LIBCPP_CONSTEXPR
 syntax_option_type
@@ -987,16 +1001,7 @@
     typedef locale                  locale_type;
     typedef ctype_base::mask        char_class_type;
 
-#if defined(__mips__) && defined(__GLIBC__)
-    static const char_class_type __regex_word = static_cast<char_class_type>(_ISbit(15));
-#elif defined(__NetBSD__)
-    // NetBSD defines classes up to 0x2000
-    // see sys/ctype_bits.h, _CTYPE_Q
-    static const char_class_type __regex_word = 0x8000;
-#else
-    static const char_class_type __regex_word = 0x80;
-#endif
-
+    static const char_class_type __regex_word = ctype_base::__regex_word;
 private:
     locale __loc_;
     const ctype<char_type>* __ct_;
@@ -2292,7 +2297,7 @@
             else
             {
                 if (__b.size() != 1 || __e.size() != 1)
-                    __throw_regex_error<regex_constants::error_collate>();
+                    __throw_regex_error<regex_constants::error_range>();
                 if (__icase_)
                 {
                     __b[0] = __traits_.translate_nocase(__b[0]);
@@ -2526,19 +2531,27 @@
     // construct/copy/destroy:
     _LIBCPP_INLINE_VISIBILITY
     basic_regex()
-        : __flags_(), __marked_count_(0), __loop_count_(0), __open_count_(0),
+        : __flags_(regex_constants::ECMAScript), __marked_count_(0), __loop_count_(0), __open_count_(0),
           __end_(0)
         {}
     _LIBCPP_INLINE_VISIBILITY
     explicit basic_regex(const value_type* __p, flag_type __f = regex_constants::ECMAScript)
         : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
           __end_(0)
-        {__parse(__p, __p + __traits_.length(__p));}
+        {
+        if (__get_grammar(__flags_) == 0) __flags_ |= regex_constants::ECMAScript;
+        __parse(__p, __p + __traits_.length(__p));
+        }
+
     _LIBCPP_INLINE_VISIBILITY
     basic_regex(const value_type* __p, size_t __len, flag_type __f = regex_constants::ECMAScript)
         : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
           __end_(0)
-        {__parse(__p, __p + __len);}
+        {
+        if (__get_grammar(__flags_) == 0) __flags_ |= regex_constants::ECMAScript;
+        __parse(__p, __p + __len);
+        }
+
 //     basic_regex(const basic_regex&) = default;
 //     basic_regex(basic_regex&&) = default;
     template <class _ST, class _SA>
@@ -2547,21 +2560,31 @@
                              flag_type __f = regex_constants::ECMAScript)
         : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
           __end_(0)
-        {__parse(__p.begin(), __p.end());}
+        {
+        if (__get_grammar(__flags_) == 0) __flags_ |= regex_constants::ECMAScript;
+        __parse(__p.begin(), __p.end());
+        }
+
     template <class _ForwardIterator>
         _LIBCPP_INLINE_VISIBILITY
         basic_regex(_ForwardIterator __first, _ForwardIterator __last,
                     flag_type __f = regex_constants::ECMAScript)
         : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
           __end_(0)
-        {__parse(__first, __last);}
+        {
+        if (__get_grammar(__flags_) == 0) __flags_ |= regex_constants::ECMAScript;
+        __parse(__first, __last);
+        }
 #ifndef _LIBCPP_CXX03_LANG
     _LIBCPP_INLINE_VISIBILITY
     basic_regex(initializer_list<value_type> __il,
                 flag_type __f = regex_constants::ECMAScript)
         : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
           __end_(0)
-        {__parse(__il.begin(), __il.end());}
+        {
+        if (__get_grammar(__flags_) == 0) __flags_ |= regex_constants::ECMAScript;
+        __parse(__il.begin(), __il.end());
+        }
 #endif  // _LIBCPP_CXX03_LANG
 
 //    ~basic_regex() = default;
@@ -3043,7 +3066,7 @@
         __h.release();
         __end_ = __start_.get();
     }
-    switch (__flags_ & 0x1F0)
+    switch (__get_grammar(__flags_))
     {
     case ECMAScript:
         __first = __parse_ecma_exp(__first, __last);
@@ -3378,7 +3401,7 @@
         if (__temp != __last)
         {
             if (*__first == '\\')
-            { 
+            {
                 int __val = __traits_.value(*__temp, 10);
                 if (__val >= 1 && __val <= 9)
                 {
@@ -3512,7 +3535,7 @@
                     __first = ++__temp;
                     break;
                 default:
-                    if ((__flags_ & 0x1F0) == awk)
+                    if (__get_grammar(__flags_) == awk)
                         __first = __parse_awk_escape(++__first, __last);
                     break;
                 }
@@ -3596,7 +3619,7 @@
 {
     if (__first != __last)
     {
-        unsigned __grammar = __flags_ & 0x1F0;
+        unsigned __grammar = __get_grammar(__flags_);
         switch (*__first)
         {
         case '*':
@@ -3717,7 +3740,7 @@
         // __ml owned by *this
         if (__first == __last)
             __throw_regex_error<regex_constants::error_brack>();
-        if ((__flags_ & 0x1F0) != ECMAScript && *__first == ']')
+        if (__get_grammar(__flags_) != ECMAScript && *__first == ']')
         {
             __ml->__add_char(']');
             ++__first;
@@ -3778,7 +3801,7 @@
             else if (*__temp == '.')
                 __first = __parse_collating_symbol(++__temp, __last, __start_range);
         }
-        unsigned __grammar = __flags_ & 0x1F0;
+        unsigned __grammar = __get_grammar(__flags_);
         if (__start_range.empty())
         {
             if ((__grammar == ECMAScript || __grammar == awk) && *__first == '\\')
@@ -4075,7 +4098,7 @@
         if ( __val != -1 )
         {
             __c = __val;
-            for (++__first; 
+            for (++__first;
                  __first != __last && ( __val = __traits_.value(*__first, 10)) != -1;
                  ++__first)
             {
@@ -4455,7 +4478,7 @@
         case 'c':
             if ((__t = _VSTD::next(__first)) != __last)
             {
-                if (('A' <= *__t && *__t <= 'Z') || 
+                if (('A' <= *__t && *__t <= 'Z') ||
                     ('a' <= *__t && *__t <= 'z'))
                 {
                     if (__str)
@@ -4464,7 +4487,7 @@
                         __push_char(_CharT(*__t % 32));
                     __first = ++__t;
                 }
-                else 
+                else
                     __throw_regex_error<regex_constants::error_escape>();
             }
             else
@@ -5264,21 +5287,41 @@
     // element access:
     _LIBCPP_INLINE_VISIBILITY
     difference_type length(size_type __sub = 0) const
-        {return (*this)[__sub].length();}
+        {
+        _LIBCPP_ASSERT(ready(), "match_results::length() called when not ready");
+        return (*this)[__sub].length();
+        }
     _LIBCPP_INLINE_VISIBILITY
     difference_type position(size_type __sub = 0) const
-        {return _VSTD::distance(__position_start_, (*this)[__sub].first);}
+        {
+        _LIBCPP_ASSERT(ready(), "match_results::position() called when not ready");
+        return _VSTD::distance(__position_start_, (*this)[__sub].first);
+        }
     _LIBCPP_INLINE_VISIBILITY
     string_type str(size_type __sub = 0) const
-        {return (*this)[__sub].str();}
+        {
+        _LIBCPP_ASSERT(ready(), "match_results::str() called when not ready");
+        return (*this)[__sub].str();
+        }
     _LIBCPP_INLINE_VISIBILITY
     const_reference operator[](size_type __n) const
-        {return __n < __matches_.size() ? __matches_[__n] : __unmatched_;}
+        {
+        _LIBCPP_ASSERT(ready(), "match_results::operator[]() called when not ready");
+        return __n < __matches_.size() ? __matches_[__n] : __unmatched_;
+        }
 
     _LIBCPP_INLINE_VISIBILITY
-    const_reference prefix() const {return __prefix_;}
+    const_reference prefix() const
+        {
+        _LIBCPP_ASSERT(ready(), "match_results::prefix() called when not ready");
+        return __prefix_;
+        }
     _LIBCPP_INLINE_VISIBILITY
-    const_reference suffix() const {return __suffix_;}
+    const_reference suffix() const
+        {
+        _LIBCPP_ASSERT(ready(), "match_results::suffix() called when not ready");
+        return __suffix_;
+        }
 
     _LIBCPP_INLINE_VISIBILITY
     const_iterator begin() const {return empty() ? __matches_.end() : __matches_.begin();}
@@ -5416,6 +5459,7 @@
         const char_type* __fmt_first, const char_type* __fmt_last,
         regex_constants::match_flag_type __flags) const
 {
+    _LIBCPP_ASSERT(ready(), "match_results::format() called when not ready");
     if (__flags & regex_constants::format_sed)
     {
         for (; __fmt_first != __fmt_last; ++__fmt_first)
@@ -5848,7 +5892,7 @@
         match_results<const _CharT*, _Allocator>& __m,
         regex_constants::match_flag_type __flags, bool __at_first) const
 {
-    if ((__flags_ & 0x1F0) == ECMAScript)
+    if (__get_grammar(__flags_) == ECMAScript)
         return __match_at_start_ecma(__first, __last, __m, __flags, __at_first);
     if (mark_count() == 0)
         return __match_at_start_posix_nosubs(__first, __last, __m, __flags, __at_first);
@@ -5865,7 +5909,7 @@
 {
     __m.__init(1 + mark_count(), __first, __last,
                                     __flags & regex_constants::__no_update_pos);
-    if (__match_at_start(__first, __last, __m, __flags, 
+    if (__match_at_start(__first, __last, __m, __flags,
                                     !(__flags & regex_constants::__no_update_pos)))
     {
         __m.__prefix_.second = __m[0].first;
@@ -6011,7 +6055,7 @@
 regex_search(const basic_string<_Cp, _ST, _SA>&& __s,
              match_results<typename basic_string<_Cp, _ST, _SA>::const_iterator, _Ap>&,
              const basic_regex<_Cp, _Tp>& __e,
-             regex_constants::match_flag_type __flags = regex_constants::match_default) = delete; 
+             regex_constants::match_flag_type __flags = regex_constants::match_default) = delete;
 #endif
 
 // regex_match
@@ -6075,7 +6119,7 @@
 regex_match(const basic_string<_CharT, _ST, _SA>&& __s,
             match_results<typename basic_string<_CharT, _ST, _SA>::const_iterator, _Allocator>& __m,
             const basic_regex<_CharT, _Traits>& __e,
-            regex_constants::match_flag_type __flags = regex_constants::match_default) = delete; 
+            regex_constants::match_flag_type __flags = regex_constants::match_default) = delete;
 #endif
 
 template <class _CharT, class _Traits>
@@ -6128,7 +6172,7 @@
 #if _LIBCPP_STD_VER > 11
     regex_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b,
                    const regex_type&& __re,
-                   regex_constants::match_flag_type __m 
+                   regex_constants::match_flag_type __m
                                      = regex_constants::match_default) = delete;
 #endif
 
@@ -6324,7 +6368,7 @@
             __result_ = &__position_->prefix();
         else
             __result_ = &(*__position_)[__subs_[__n_]];
-        }       
+        }
 };
 
 template <class _BidirectionalIterator, class _CharT, class _Traits>
diff --git a/linux-x64/clang/include/c++/v1/set b/linux-x64/clang/include/c++/v1/set
index 1783722..79e8f29 100644
--- a/linux-x64/clang/include/c++/v1/set
+++ b/linux-x64/clang/include/c++/v1/set
@@ -446,11 +446,10 @@
     typedef key_type                                 value_type;
     typedef _Compare                                 key_compare;
     typedef key_compare                              value_compare;
-    typedef _Allocator                               allocator_type;
+    typedef typename __identity<_Allocator>::type    allocator_type;
     typedef value_type&                              reference;
     typedef const value_type&                        const_reference;
 
-    static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), "");
     static_assert((is_same<typename allocator_type::value_type, value_type>::value),
                   "Allocator::value_type must be same type as value_type");
 
@@ -597,6 +596,11 @@
 #endif  // _LIBCPP_CXX03_LANG
 
     _LIBCPP_INLINE_VISIBILITY
+    ~set() {
+        static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), "");
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
           iterator begin() _NOEXCEPT       {return __tree_.begin();}
     _LIBCPP_INLINE_VISIBILITY
     const_iterator begin() const _NOEXCEPT {return __tree_.begin();}
@@ -836,6 +840,34 @@
 #endif
 };
 
+#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
+template<class _InputIterator,
+         class _Compare = less<typename iterator_traits<_InputIterator>::value_type>,
+         class _Allocator = allocator<typename iterator_traits<_InputIterator>::value_type>,
+         class = typename enable_if<__is_allocator<_Allocator>::value, void>::type,
+         class = typename enable_if<!__is_allocator<_Compare>::value, void>::type>
+set(_InputIterator, _InputIterator, _Compare = _Compare(), _Allocator = _Allocator())
+  -> set<typename iterator_traits<_InputIterator>::value_type, _Compare, _Allocator>;
+
+template<class _Key, class _Compare = less<_Key>,
+         class _Allocator = allocator<_Key>,
+         class = typename enable_if<__is_allocator<_Allocator>::value, void>::type,
+         class = typename enable_if<!__is_allocator<_Compare>::value, void>::type>
+set(initializer_list<_Key>, _Compare = _Compare(), _Allocator = _Allocator())
+  -> set<_Key, _Compare, _Allocator>;
+
+template<class _InputIterator, class _Allocator,
+         class = typename enable_if<__is_allocator<_Allocator>::value, void>::type>
+set(_InputIterator, _InputIterator, _Allocator)
+  -> set<typename iterator_traits<_InputIterator>::value_type,
+         less<typename iterator_traits<_InputIterator>::value_type>, _Allocator>;
+
+template<class _Key, class _Allocator,
+         class = typename enable_if<__is_allocator<_Allocator>::value, void>::type>
+set(initializer_list<_Key>, _Allocator)
+  -> set<_Key, less<_Key>, _Allocator>;
+#endif
+
 #ifndef _LIBCPP_CXX03_LANG
 
 template <class _Key, class _Compare, class _Allocator>
@@ -934,11 +966,10 @@
     typedef key_type                                 value_type;
     typedef _Compare                                  key_compare;
     typedef key_compare                              value_compare;
-    typedef _Allocator                                allocator_type;
+    typedef typename __identity<_Allocator>::type    allocator_type;
     typedef value_type&                              reference;
     typedef const value_type&                        const_reference;
 
-    static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), "");
     static_assert((is_same<typename allocator_type::value_type, value_type>::value),
                   "Allocator::value_type must be same type as value_type");
 
@@ -1084,6 +1115,11 @@
 #endif  // _LIBCPP_CXX03_LANG
 
     _LIBCPP_INLINE_VISIBILITY
+    ~multiset() {
+        static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), "");
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
           iterator begin() _NOEXCEPT       {return __tree_.begin();}
     _LIBCPP_INLINE_VISIBILITY
     const_iterator begin() const _NOEXCEPT {return __tree_.begin();}
@@ -1324,6 +1360,34 @@
 #endif
 };
 
+#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
+template<class _InputIterator,
+         class _Compare = less<typename iterator_traits<_InputIterator>::value_type>,
+         class _Allocator = allocator<typename iterator_traits<_InputIterator>::value_type>,
+         class = typename enable_if<__is_allocator<_Allocator>::value, void>::type,
+         class = typename enable_if<!__is_allocator<_Compare>::value, void>::type>
+multiset(_InputIterator, _InputIterator, _Compare = _Compare(), _Allocator = _Allocator())
+  -> multiset<typename iterator_traits<_InputIterator>::value_type, _Compare, _Allocator>;
+
+template<class _Key, class _Compare = less<_Key>,
+         class _Allocator = allocator<_Key>,
+         class = typename enable_if<__is_allocator<_Allocator>::value, void>::type,
+         class = typename enable_if<!__is_allocator<_Compare>::value, void>::type>
+multiset(initializer_list<_Key>, _Compare = _Compare(), _Allocator = _Allocator())
+  -> multiset<_Key, _Compare, _Allocator>;
+
+template<class _InputIterator, class _Allocator,
+         class = typename enable_if<__is_allocator<_Allocator>::value, void>::type>
+multiset(_InputIterator, _InputIterator, _Allocator)
+  -> multiset<typename iterator_traits<_InputIterator>::value_type,
+         less<typename iterator_traits<_InputIterator>::value_type>, _Allocator>;
+
+template<class _Key, class _Allocator,
+         class = typename enable_if<__is_allocator<_Allocator>::value, void>::type>
+multiset(initializer_list<_Key>, _Allocator)
+  -> multiset<_Key, less<_Key>, _Allocator>;
+#endif
+
 #ifndef _LIBCPP_CXX03_LANG
 
 template <class _Key, class _Compare, class _Allocator>
diff --git a/linux-x64/clang/include/c++/v1/span b/linux-x64/clang/include/c++/v1/span
index 774f698..0694f51 100644
--- a/linux-x64/clang/include/c++/v1/span
+++ b/linux-x64/clang/include/c++/v1/span
@@ -16,33 +16,35 @@
 namespace std {
 
 // constants
-inline constexpr ptrdiff_t dynamic_extent = -1;
+inline constexpr size_t dynamic_extent = numeric_limits<size_t>::max();
 
 // [views.span], class template span
-template <class ElementType, ptrdiff_t Extent = dynamic_extent>
+template <class ElementType, size_t Extent = dynamic_extent>
     class span;
 
 // [span.objectrep], views of object representation
-template <class ElementType, ptrdiff_t Extent>
+template <class ElementType, size_t Extent>
     span<const byte, ((Extent == dynamic_extent) ? dynamic_extent :
-        (static_cast<ptrdiff_t>(sizeof(ElementType)) * Extent))> as_bytes(span<ElementType, Extent> s) noexcept;
+        (sizeof(ElementType) * Extent))> as_bytes(span<ElementType, Extent> s) noexcept;
 
-template <class ElementType, ptrdiff_t Extent>
+template <class ElementType, size_t Extent>
     span<      byte, ((Extent == dynamic_extent) ? dynamic_extent :
-        (static_cast<ptrdiff_t>(sizeof(ElementType)) * Extent))> as_writable_bytes(span<ElementType, Extent> s) noexcept;
+        (sizeof(ElementType) * Extent))> as_writable_bytes(span<ElementType, Extent> s) noexcept;
 
 
 namespace std {
-template <class ElementType, ptrdiff_t Extent = dynamic_extent>
+template <class ElementType, size_t Extent = dynamic_extent>
 class span {
 public:
     // constants and types
     using element_type = ElementType;
     using value_type = remove_cv_t<ElementType>;
-    using index_type = ptrdiff_t;
+    using index_type = size_t;
     using difference_type = ptrdiff_t;
     using pointer = element_type*;
+    using const_pointer = const element_type*;
     using reference = element_type&;
+    using const_reference = const element_type&;
     using iterator = implementation-defined;
     using const_iterator = implementation-defined;
     using reverse_iterator = std::reverse_iterator<iterator>;
@@ -64,17 +66,17 @@
     template <class Container>
         constexpr span(const Container& cont);
     constexpr span(const span& other) noexcept = default;
-    template <class OtherElementType, ptrdiff_t OtherExtent>
+    template <class OtherElementType, size_t OtherExtent>
         constexpr span(const span<OtherElementType, OtherExtent>& s) noexcept;
     ~span() noexcept = default;
     constexpr span& operator=(const span& other) noexcept = default;
 
     // [span.sub], span subviews
-    template <ptrdiff_t Count>
+    template <size_t Count>
         constexpr span<element_type, Count> first() const;
-    template <ptrdiff_t Count>
+    template <size_t Count>
         constexpr span<element_type, Count> last() const;
-    template <ptrdiff_t Offset, ptrdiff_t Count = dynamic_extent>
+    template <size_t Offset, size_t Count = dynamic_extent>
         constexpr span<element_type, see below> subspan() const;
 
     constexpr span<element_type, dynamic_extent> first(index_type count) const;
@@ -88,7 +90,8 @@
 
     // [span.elem], span element access
     constexpr reference operator[](index_type idx) const;
-    constexpr reference operator()(index_type idx) const;
+    constexpr reference front() const;
+    constexpr reference back() const;
     constexpr pointer data() const noexcept;
 
     // [span.iterators], span iterator support
@@ -140,14 +143,14 @@
 
 #if _LIBCPP_STD_VER > 17
 
-inline constexpr ptrdiff_t dynamic_extent = -1;
-template <typename _Tp, ptrdiff_t _Extent = dynamic_extent> class span;
+inline constexpr size_t dynamic_extent = numeric_limits<size_t>::max();
+template <typename _Tp, size_t _Extent = dynamic_extent> class span;
 
 
 template <class _Tp>
 struct __is_span_impl : public false_type {};
 
-template <class _Tp, ptrdiff_t _Extent>
+template <class _Tp, size_t _Extent>
 struct __is_span_impl<span<_Tp, _Extent>> : public true_type {};
 
 template <class _Tp>
@@ -186,25 +189,24 @@
     : public true_type {};
 
 
-template <typename _Tp, ptrdiff_t _Extent>
+template <typename _Tp, size_t _Extent>
 class _LIBCPP_TEMPLATE_VIS span {
 public:
 //  constants and types
     using element_type           = _Tp;
     using value_type             = remove_cv_t<_Tp>;
-    using index_type             = ptrdiff_t;
+    using index_type             = size_t;
     using difference_type        = ptrdiff_t;
     using pointer                = _Tp *;
-    using const_pointer          = const _Tp *; // not in standard
+    using const_pointer          = const _Tp *;
     using reference              = _Tp &;
-    using const_reference        = const _Tp &; // not in standard
+    using const_reference        = const _Tp &;
     using iterator               =  __wrap_iter<pointer>;
     using const_iterator         =  __wrap_iter<const_pointer>;
     using reverse_iterator       = _VSTD::reverse_iterator<iterator>;
     using const_reverse_iterator = _VSTD::reverse_iterator<const_iterator>;
 
     static constexpr index_type extent = _Extent;
-    static_assert (_Extent >= 0, "Can't have a span with an extent < 0");
 
 // [span.cons], span constructors, copy, assignment, and destructor
     _LIBCPP_INLINE_VISIBILITY constexpr span() noexcept : __data{nullptr}
@@ -222,22 +224,8 @@
     _LIBCPP_INLINE_VISIBILITY constexpr span(      array<value_type, _Extent>& __arr) noexcept : __data{__arr.data()} {}
     _LIBCPP_INLINE_VISIBILITY constexpr span(const array<value_type, _Extent>& __arr) noexcept : __data{__arr.data()} {}
 
-    template <class _Container>
-    inline _LIBCPP_INLINE_VISIBILITY
-        constexpr span(      _Container& __c,
-            enable_if_t<__is_span_compatible_container<_Container, _Tp>::value, nullptr_t> = nullptr)
-        : __data{_VSTD::data(__c)}
-        { _LIBCPP_ASSERT(_Extent == _VSTD::size(__c), "size mismatch in span's constructor (container)"); }
-
-    template <class _Container>
-    inline _LIBCPP_INLINE_VISIBILITY
-        constexpr span(const _Container& __c,
-            enable_if_t<__is_span_compatible_container<const _Container, _Tp>::value, nullptr_t> = nullptr)
-        : __data{_VSTD::data(__c)}
-        { _LIBCPP_ASSERT(_Extent == _VSTD::size(__c), "size mismatch in span's constructor (const container)"); }
-
     template <class _OtherElementType>
-    inline _LIBCPP_INLINE_VISIBILITY
+    _LIBCPP_INLINE_VISIBILITY
         constexpr span(const span<_OtherElementType, _Extent>& __other,
                        enable_if_t<
                           is_convertible_v<_OtherElementType(*)[], element_type (*)[]>,
@@ -245,7 +233,7 @@
         : __data{__other.data()} {}
 
     template <class _OtherElementType>
-    inline _LIBCPP_INLINE_VISIBILITY
+    _LIBCPP_INLINE_VISIBILITY
         constexpr span(const span<_OtherElementType, dynamic_extent>& __other,
                        enable_if_t<
                           is_convertible_v<_OtherElementType(*)[], element_type (*)[]>,
@@ -255,20 +243,18 @@
 
 //  ~span() noexcept = default;
 
-    template <ptrdiff_t _Count>
-    inline _LIBCPP_INLINE_VISIBILITY
-        constexpr span<element_type, _Count> first() const noexcept
+    template <size_t _Count>
+    _LIBCPP_INLINE_VISIBILITY
+    constexpr span<element_type, _Count> first() const noexcept
     {
-        static_assert(_Count >= 0, "Count must be >= 0 in span::first()");
         static_assert(_Count <= _Extent, "Count out of range in span::first()");
         return {data(), _Count};
     }
 
-    template <ptrdiff_t _Count>
-    inline _LIBCPP_INLINE_VISIBILITY
-        constexpr span<element_type, _Count> last() const noexcept
+    template <size_t _Count>
+    _LIBCPP_INLINE_VISIBILITY
+    constexpr span<element_type, _Count> last() const noexcept
     {
-        static_assert(_Count >= 0, "Count must be >= 0 in span::last()");
         static_assert(_Count <= _Extent, "Count out of range in span::last()");
         return {data() + size() - _Count, _Count};
     }
@@ -276,36 +262,36 @@
     _LIBCPP_INLINE_VISIBILITY
     constexpr span<element_type, dynamic_extent> first(index_type __count) const noexcept
     {
-        _LIBCPP_ASSERT(__count >= 0 && __count <= size(), "Count out of range in span::first(count)");
+        _LIBCPP_ASSERT(__count <= size(), "Count out of range in span::first(count)");
         return {data(), __count};
     }
 
     _LIBCPP_INLINE_VISIBILITY
     constexpr span<element_type, dynamic_extent> last(index_type __count) const noexcept
     {
-        _LIBCPP_ASSERT(__count >= 0 && __count <= size(), "Count out of range in span::last(count)");
+        _LIBCPP_ASSERT(__count <= size(), "Count out of range in span::last(count)");
         return {data() + size() - __count, __count};
     }
 
-    template <ptrdiff_t _Offset, ptrdiff_t _Count = dynamic_extent>
-    inline _LIBCPP_INLINE_VISIBILITY
-        constexpr auto subspan() const noexcept
+    template <size_t _Offset, size_t _Count = dynamic_extent>
+    _LIBCPP_INLINE_VISIBILITY
+    constexpr auto subspan() const noexcept
         -> span<element_type, _Count != dynamic_extent ? _Count : _Extent - _Offset>
     {
-        _LIBCPP_ASSERT(_Offset >= 0 && _Offset <= size(), "Offset out of range in span::subspan()");
+        static_assert(_Offset <= _Extent, "Offset out of range in span::subspan()");
         return {data() + _Offset, _Count == dynamic_extent ? size() - _Offset : _Count};
     }
 
 
-    inline _LIBCPP_INLINE_VISIBILITY
+    _LIBCPP_INLINE_VISIBILITY
     constexpr span<element_type, dynamic_extent>
        subspan(index_type __offset, index_type __count = dynamic_extent) const noexcept
     {
-        _LIBCPP_ASSERT( __offset >= 0 && __offset <= size(), "Offset out of range in span::subspan(offset, count)");
-        _LIBCPP_ASSERT((__count  >= 0 && __count  <= size()) || __count == dynamic_extent, "Count out of range in span::subspan(offset, count)");
+        _LIBCPP_ASSERT(__offset <= size(), "Offset out of range in span::subspan(offset, count)");
+        _LIBCPP_ASSERT(__count  <= size() || __count == dynamic_extent, "Count out of range in span::subspan(offset, count)");
         if (__count == dynamic_extent)
             return {data() + __offset, size() - __offset};
-        _LIBCPP_ASSERT(__offset + __count <= size(), "count + offset out of range in span::subspan(offset, count)");
+        _LIBCPP_ASSERT(__offset <= size() - __count, "count + offset out of range in span::subspan(offset, count)");
         return {data() + __offset, __count};
     }
 
@@ -319,10 +305,16 @@
         return __data[__idx];
     }
 
-    _LIBCPP_INLINE_VISIBILITY constexpr reference operator()(index_type __idx) const noexcept
+    _LIBCPP_INLINE_VISIBILITY constexpr reference front() const noexcept
     {
-        _LIBCPP_ASSERT(__idx >= 0 && __idx < size(), "span<T,N>() index out of bounds");
-        return __data[__idx];
+        static_assert(_Extent > 0, "span<T,N>[].front() on empty span");
+        return __data[0];
+    }
+
+    _LIBCPP_INLINE_VISIBILITY constexpr reference back() const noexcept
+    {
+        static_assert(_Extent > 0, "span<T,N>[].back() on empty span");
+        return __data[size()-1];
     }
 
     _LIBCPP_INLINE_VISIBILITY constexpr pointer data()                         const noexcept { return __data; }
@@ -347,7 +339,7 @@
     _LIBCPP_INLINE_VISIBILITY span<const byte, _Extent * sizeof(element_type)> __as_bytes() const noexcept
     { return {reinterpret_cast<const byte *>(data()), size_bytes()}; }
 
-    _LIBCPP_INLINE_VISIBILITY span<byte, _Extent * sizeof(element_type)> __as_writeable_bytes() const noexcept
+    _LIBCPP_INLINE_VISIBILITY span<byte, _Extent * sizeof(element_type)> __as_writable_bytes() const noexcept
     { return {reinterpret_cast<byte *>(data()), size_bytes()}; }
 
 private:
@@ -364,12 +356,12 @@
 //  constants and types
     using element_type           = _Tp;
     using value_type             = remove_cv_t<_Tp>;
-    using index_type             = ptrdiff_t;
+    using index_type             = size_t;
     using difference_type        = ptrdiff_t;
     using pointer                = _Tp *;
-    using const_pointer          = const _Tp *; // not in standard
+    using const_pointer          = const _Tp *;
     using reference              = _Tp &;
-    using const_reference        = const _Tp &; // not in standard
+    using const_reference        = const _Tp &;
     using iterator               =  __wrap_iter<pointer>;
     using const_iterator         =  __wrap_iter<const_pointer>;
     using reverse_iterator       = _VSTD::reverse_iterator<iterator>;
@@ -384,35 +376,35 @@
     constexpr span& operator=(const span&) noexcept = default;
 
     _LIBCPP_INLINE_VISIBILITY constexpr span(pointer __ptr, index_type __count) : __data{__ptr}, __size{__count} {}
-    _LIBCPP_INLINE_VISIBILITY constexpr span(pointer __f, pointer __l) : __data{__f}, __size{distance(__f, __l)} {}
+    _LIBCPP_INLINE_VISIBILITY constexpr span(pointer __f, pointer __l) : __data{__f}, __size{static_cast<size_t>(distance(__f, __l))} {}
 
     template <size_t _Sz>
-    inline _LIBCPP_INLINE_VISIBILITY
-        constexpr span(element_type (&__arr)[_Sz]) noexcept : __data{__arr}, __size{_Sz} {}
+    _LIBCPP_INLINE_VISIBILITY
+    constexpr span(element_type (&__arr)[_Sz])          noexcept : __data{__arr}, __size{_Sz} {}
 
     template <size_t _Sz>
-    inline _LIBCPP_INLINE_VISIBILITY
-        constexpr span(array<value_type, _Sz>& __arr)       noexcept : __data{__arr.data()}, __size{_Sz} {}
+    _LIBCPP_INLINE_VISIBILITY
+    constexpr span(array<value_type, _Sz>& __arr)       noexcept : __data{__arr.data()}, __size{_Sz} {}
 
     template <size_t _Sz>
-    inline _LIBCPP_INLINE_VISIBILITY
-        constexpr span(const array<value_type, _Sz>& __arr) noexcept : __data{__arr.data()}, __size{_Sz} {}
+    _LIBCPP_INLINE_VISIBILITY
+    constexpr span(const array<value_type, _Sz>& __arr) noexcept : __data{__arr.data()}, __size{_Sz} {}
 
     template <class _Container>
-    inline _LIBCPP_INLINE_VISIBILITY
+    _LIBCPP_INLINE_VISIBILITY
         constexpr span(      _Container& __c,
             enable_if_t<__is_span_compatible_container<_Container, _Tp>::value, nullptr_t> = nullptr)
         : __data{_VSTD::data(__c)}, __size{(index_type) _VSTD::size(__c)} {}
 
     template <class _Container>
-    inline _LIBCPP_INLINE_VISIBILITY
+    _LIBCPP_INLINE_VISIBILITY
         constexpr span(const _Container& __c,
             enable_if_t<__is_span_compatible_container<const _Container, _Tp>::value, nullptr_t> = nullptr)
         : __data{_VSTD::data(__c)}, __size{(index_type) _VSTD::size(__c)} {}
 
 
-    template <class _OtherElementType, ptrdiff_t _OtherExtent>
-    inline _LIBCPP_INLINE_VISIBILITY
+    template <class _OtherElementType, size_t _OtherExtent>
+    _LIBCPP_INLINE_VISIBILITY
         constexpr span(const span<_OtherElementType, _OtherExtent>& __other,
                        enable_if_t<
                           is_convertible_v<_OtherElementType(*)[], element_type (*)[]>,
@@ -421,20 +413,18 @@
 
 //    ~span() noexcept = default;
 
-    template <ptrdiff_t _Count>
-    inline _LIBCPP_INLINE_VISIBILITY
-        constexpr span<element_type, _Count> first() const noexcept
+    template <size_t _Count>
+    _LIBCPP_INLINE_VISIBILITY
+    constexpr span<element_type, _Count> first() const noexcept
     {
-        static_assert(_Count >= 0, "Count must be >= 0 in span::first()");
         _LIBCPP_ASSERT(_Count <= size(), "Count out of range in span::first()");
         return {data(), _Count};
     }
 
-    template <ptrdiff_t _Count>
-    inline _LIBCPP_INLINE_VISIBILITY
-        constexpr span<element_type, _Count> last() const noexcept
+    template <size_t _Count>
+    _LIBCPP_INLINE_VISIBILITY
+    constexpr span<element_type, _Count> last() const noexcept
     {
-        static_assert(_Count >= 0, "Count must be >= 0 in span::last()");
         _LIBCPP_ASSERT(_Count <= size(), "Count out of range in span::last()");
         return {data() + size() - _Count, _Count};
     }
@@ -442,35 +432,35 @@
     _LIBCPP_INLINE_VISIBILITY
     constexpr span<element_type, dynamic_extent> first(index_type __count) const noexcept
     {
-        _LIBCPP_ASSERT(__count >= 0 && __count <= size(), "Count out of range in span::first(count)");
+        _LIBCPP_ASSERT(__count <= size(), "Count out of range in span::first(count)");
         return {data(), __count};
     }
 
     _LIBCPP_INLINE_VISIBILITY
     constexpr span<element_type, dynamic_extent> last (index_type __count) const noexcept
     {
-        _LIBCPP_ASSERT(__count >= 0 && __count <= size(), "Count out of range in span::last(count)");
+        _LIBCPP_ASSERT(__count <= size(), "Count out of range in span::last(count)");
         return {data() + size() - __count, __count};
     }
 
-    template <ptrdiff_t _Offset, ptrdiff_t _Count = dynamic_extent>
-    inline _LIBCPP_INLINE_VISIBILITY
-        constexpr span<_Tp, dynamic_extent> subspan() const noexcept
+    template <size_t _Offset, size_t _Count = dynamic_extent>
+    _LIBCPP_INLINE_VISIBILITY
+    constexpr span<_Tp, dynamic_extent> subspan() const noexcept
     {
-        _LIBCPP_ASSERT(_Offset >= 0 && _Offset <= size(), "Offset out of range in span::subspan()");
+        _LIBCPP_ASSERT(_Offset <= size(), "Offset out of range in span::subspan()");
         _LIBCPP_ASSERT(_Count == dynamic_extent || _Offset + _Count <= size(), "Count out of range in span::subspan()");
         return {data() + _Offset, _Count == dynamic_extent ? size() - _Offset : _Count};
     }
 
     constexpr span<element_type, dynamic_extent>
-    inline _LIBCPP_INLINE_VISIBILITY
-       subspan(index_type __offset, index_type __count = dynamic_extent) const noexcept
+    _LIBCPP_INLINE_VISIBILITY
+    subspan(index_type __offset, index_type __count = dynamic_extent) const noexcept
     {
-        _LIBCPP_ASSERT( __offset >= 0 && __offset <= size(), "Offset out of range in span::subspan(offset, count)");
-        _LIBCPP_ASSERT((__count  >= 0 && __count  <= size()) || __count == dynamic_extent, "count out of range in span::subspan(offset, count)");
+        _LIBCPP_ASSERT(__offset <= size(), "Offset out of range in span::subspan(offset, count)");
+        _LIBCPP_ASSERT(__count  <= size() || __count == dynamic_extent, "count out of range in span::subspan(offset, count)");
         if (__count == dynamic_extent)
             return {data() + __offset, size() - __offset};
-        _LIBCPP_ASSERT(__offset + __count <= size(), "Offset + count out of range in span::subspan(offset, count)");
+        _LIBCPP_ASSERT(__offset <= size() - __count, "Offset + count out of range in span::subspan(offset, count)");
         return {data() + __offset, __count};
     }
 
@@ -484,12 +474,19 @@
         return __data[__idx];
     }
 
-    _LIBCPP_INLINE_VISIBILITY constexpr reference operator()(index_type __idx) const noexcept
+    _LIBCPP_INLINE_VISIBILITY constexpr reference front() const noexcept
     {
-        _LIBCPP_ASSERT(__idx >= 0 && __idx < size(), "span<T>() index out of bounds");
-        return __data[__idx];
+        _LIBCPP_ASSERT(!empty(), "span<T>[].front() on empty span");
+        return __data[0];
     }
 
+    _LIBCPP_INLINE_VISIBILITY constexpr reference back() const noexcept
+    {
+        _LIBCPP_ASSERT(!empty(), "span<T>[].back() on empty span");
+        return __data[size()-1];
+    }
+
+
     _LIBCPP_INLINE_VISIBILITY constexpr pointer data()                         const noexcept { return __data; }
 
 // [span.iter], span iterator support
@@ -516,7 +513,7 @@
     _LIBCPP_INLINE_VISIBILITY span<const byte, dynamic_extent> __as_bytes() const noexcept
     { return {reinterpret_cast<const byte *>(data()), size_bytes()}; }
 
-    _LIBCPP_INLINE_VISIBILITY span<byte, dynamic_extent> __as_writeable_bytes() const noexcept
+    _LIBCPP_INLINE_VISIBILITY span<byte, dynamic_extent> __as_writable_bytes() const noexcept
     { return {reinterpret_cast<byte *>(data()), size_bytes()}; }
 
 private:
@@ -524,20 +521,51 @@
     index_type __size;
 };
 
-//  as_bytes & as_writeable_bytes
-template <class _Tp, ptrdiff_t _Extent>
-    auto as_bytes(span<_Tp, _Extent> __s) noexcept
-    -> decltype(__s.__as_bytes())
-    { return __s.__as_bytes(); }
+//  tuple interface
+template <class _Tp, size_t _Size>
+struct _LIBCPP_TEMPLATE_VIS tuple_size<span<_Tp, _Size>>
+    : public integral_constant<size_t, _Size> {};
 
-template <class _Tp, ptrdiff_t _Extent>
-    auto as_writeable_bytes(span<_Tp, _Extent> __s) noexcept
-    -> typename enable_if<!is_const_v<_Tp>, decltype(__s.__as_writeable_bytes())>::type
-    { return __s.__as_writeable_bytes(); }
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS tuple_size<span<_Tp, dynamic_extent>>; // declared but not defined
 
-template <class _Tp, ptrdiff_t _Extent>
-    constexpr void swap(span<_Tp, _Extent> &__lhs, span<_Tp, _Extent> &__rhs) noexcept
-    { __lhs.swap(__rhs); }
+
+template <size_t _Ip, class _Tp, size_t _Size>
+struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, span<_Tp, _Size>>
+{
+    static_assert( dynamic_extent != _Size, "std::tuple_element<> not supported for std::span<T, dynamic_extent>");
+    static_assert(_Ip < _Size, "Index out of bounds in std::tuple_element<> (std::span)");
+    typedef _Tp type;
+};
+
+template <size_t _Ip, class _Tp, size_t _Size>
+_LIBCPP_INLINE_VISIBILITY constexpr
+_Tp&
+get(span<_Tp, _Size> __s) noexcept
+{
+    static_assert( dynamic_extent != _Size, "std::get<> not supported for std::span<T, dynamic_extent>");
+    static_assert(_Ip < _Size, "Index out of bounds in std::get<> (std::span)");
+    return __s[_Ip];
+}
+
+
+//  as_bytes & as_writable_bytes
+template <class _Tp, size_t _Extent>
+_LIBCPP_INLINE_VISIBILITY
+auto as_bytes(span<_Tp, _Extent> __s) noexcept
+-> decltype(__s.__as_bytes())
+{ return    __s.__as_bytes(); }
+
+template <class _Tp, size_t _Extent>
+_LIBCPP_INLINE_VISIBILITY
+auto as_writable_bytes(span<_Tp, _Extent> __s) noexcept
+-> enable_if_t<!is_const_v<_Tp>, decltype(__s.__as_writable_bytes())>
+{ return __s.__as_writable_bytes(); }
+
+template <class _Tp, size_t _Extent>
+_LIBCPP_INLINE_VISIBILITY
+constexpr void swap(span<_Tp, _Extent> &__lhs, span<_Tp, _Extent> &__rhs) noexcept
+{ __lhs.swap(__rhs); }
 
 
 //  Deduction guides
diff --git a/linux-x64/clang/include/c++/v1/stack b/linux-x64/clang/include/c++/v1/stack
index b50ca5c..2a2b350 100644
--- a/linux-x64/clang/include/c++/v1/stack
+++ b/linux-x64/clang/include/c++/v1/stack
@@ -62,8 +62,8 @@
 
 template<class Container>
   stack(Container) -> stack<typename Container::value_type, Container>;  // C++17
-  
-template<class Container, class Allocator> 
+
+template<class Container, class Allocator>
   stack(Container, Allocator) -> stack<typename Container::value_type, Container>; // C++17
 
 template <class T, class Container>
@@ -118,7 +118,7 @@
     typedef typename container_type::const_reference const_reference;
     typedef typename container_type::size_type       size_type;
     static_assert((is_same<_Tp, value_type>::value), "" );
-    
+
 protected:
     container_type c;
 
@@ -240,12 +240,12 @@
 >
 stack(_Container)
     -> stack<typename _Container::value_type, _Container>;
-  
+
 template<class _Container,
          class _Alloc,
          class = typename enable_if<!__is_allocator<_Container>::value, nullptr_t>::type,
          class = typename enable_if< __is_allocator<_Alloc>::value, nullptr_t>::type
-         > 
+         >
 stack(_Container, _Alloc)
     -> stack<typename _Container::value_type, _Container>;
 #endif
diff --git a/linux-x64/clang/include/c++/v1/stdexcept b/linux-x64/clang/include/c++/v1/stdexcept
index 6eda619..481f904 100644
--- a/linux-x64/clang/include/c++/v1/stdexcept
+++ b/linux-x64/clang/include/c++/v1/stdexcept
@@ -54,6 +54,7 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
+#ifndef _LIBCPP_ABI_VCRUNTIME
 class _LIBCPP_HIDDEN __libcpp_refstring
 {
     const char* __imp_;
@@ -67,6 +68,7 @@
 
     const char* c_str() const _NOEXCEPT {return __imp_;}
 };
+#endif // !_LIBCPP_ABI_VCRUNTIME
 
 _LIBCPP_END_NAMESPACE_STD
 
@@ -76,6 +78,7 @@
 class _LIBCPP_EXCEPTION_ABI logic_error
     : public exception
 {
+#ifndef _LIBCPP_ABI_VCRUNTIME
 private:
     _VSTD::__libcpp_refstring __imp_;
 public:
@@ -88,11 +91,17 @@
     virtual ~logic_error() _NOEXCEPT;
 
     virtual const char* what() const _NOEXCEPT;
+#else
+public:
+    explicit logic_error(const _VSTD::string&); // Symbol uses versioned std::string
+    _LIBCPP_INLINE_VISIBILITY explicit logic_error(const char* __s) : exception(__s) {}
+#endif
 };
 
 class _LIBCPP_EXCEPTION_ABI runtime_error
     : public exception
 {
+#ifndef _LIBCPP_ABI_VCRUNTIME
 private:
     _VSTD::__libcpp_refstring __imp_;
 public:
@@ -105,6 +114,11 @@
     virtual ~runtime_error() _NOEXCEPT;
 
     virtual const char* what() const _NOEXCEPT;
+#else
+public:
+   explicit runtime_error(const _VSTD::string&); // Symbol uses versioned std::string
+   _LIBCPP_INLINE_VISIBILITY explicit runtime_error(const char* __s) : exception(__s) {}
+#endif // _LIBCPP_ABI_VCRUNTIME
 };
 
 class _LIBCPP_EXCEPTION_ABI domain_error
@@ -114,7 +128,9 @@
     _LIBCPP_INLINE_VISIBILITY explicit domain_error(const string& __s) : logic_error(__s) {}
     _LIBCPP_INLINE_VISIBILITY explicit domain_error(const char* __s)   : logic_error(__s) {}
 
+#ifndef _LIBCPP_ABI_VCRUNTIME
     virtual ~domain_error() _NOEXCEPT;
+#endif
 };
 
 class _LIBCPP_EXCEPTION_ABI invalid_argument
@@ -124,7 +140,9 @@
     _LIBCPP_INLINE_VISIBILITY explicit invalid_argument(const string& __s) : logic_error(__s) {}
     _LIBCPP_INLINE_VISIBILITY explicit invalid_argument(const char* __s)   : logic_error(__s) {}
 
+#ifndef _LIBCPP_ABI_VCRUNTIME
     virtual ~invalid_argument() _NOEXCEPT;
+#endif
 };
 
 class _LIBCPP_EXCEPTION_ABI length_error
@@ -133,8 +151,9 @@
 public:
     _LIBCPP_INLINE_VISIBILITY explicit length_error(const string& __s) : logic_error(__s) {}
     _LIBCPP_INLINE_VISIBILITY explicit length_error(const char* __s)   : logic_error(__s) {}
-
+#ifndef _LIBCPP_ABI_VCRUNTIME
     virtual ~length_error() _NOEXCEPT;
+#endif
 };
 
 class _LIBCPP_EXCEPTION_ABI out_of_range
@@ -144,7 +163,9 @@
     _LIBCPP_INLINE_VISIBILITY explicit out_of_range(const string& __s) : logic_error(__s) {}
     _LIBCPP_INLINE_VISIBILITY explicit out_of_range(const char* __s)   : logic_error(__s) {}
 
+#ifndef _LIBCPP_ABI_VCRUNTIME
     virtual ~out_of_range() _NOEXCEPT;
+#endif
 };
 
 class _LIBCPP_EXCEPTION_ABI range_error
@@ -154,7 +175,9 @@
     _LIBCPP_INLINE_VISIBILITY explicit range_error(const string& __s) : runtime_error(__s) {}
     _LIBCPP_INLINE_VISIBILITY explicit range_error(const char* __s)   : runtime_error(__s) {}
 
+#ifndef _LIBCPP_ABI_VCRUNTIME
     virtual ~range_error() _NOEXCEPT;
+#endif
 };
 
 class _LIBCPP_EXCEPTION_ABI overflow_error
@@ -164,7 +187,9 @@
     _LIBCPP_INLINE_VISIBILITY explicit overflow_error(const string& __s) : runtime_error(__s) {}
     _LIBCPP_INLINE_VISIBILITY explicit overflow_error(const char* __s)   : runtime_error(__s) {}
 
+#ifndef _LIBCPP_ABI_VCRUNTIME
     virtual ~overflow_error() _NOEXCEPT;
+#endif
 };
 
 class _LIBCPP_EXCEPTION_ABI underflow_error
@@ -174,7 +199,9 @@
     _LIBCPP_INLINE_VISIBILITY explicit underflow_error(const string& __s) : runtime_error(__s) {}
     _LIBCPP_INLINE_VISIBILITY explicit underflow_error(const char* __s)   : runtime_error(__s) {}
 
+#ifndef _LIBCPP_ABI_VCRUNTIME
     virtual ~underflow_error() _NOEXCEPT;
+#endif
 };
 
 }  // std
diff --git a/linux-x64/clang/include/c++/v1/stdint.h b/linux-x64/clang/include/c++/v1/stdint.h
index c892298..d7b6902 100644
--- a/linux-x64/clang/include/c++/v1/stdint.h
+++ b/linux-x64/clang/include/c++/v1/stdint.h
@@ -8,7 +8,12 @@
 //===----------------------------------------------------------------------===//
 
 #ifndef _LIBCPP_STDINT_H
+// AIX system headers need stdint.h to be re-enterable while _STD_TYPES_T
+// is defined until an inclusion of it without _STD_TYPES_T occurs, in which
+// case the header guard macro is defined.
+#if !defined(_AIX) || !defined(_STD_TYPES_T)
 #define _LIBCPP_STDINT_H
+#endif // _STD_TYPES_T
 
 /*
     stdint.h synopsis
diff --git a/linux-x64/clang/include/c++/v1/stdlib.h b/linux-x64/clang/include/c++/v1/stdlib.h
index 2087544..1d68275 100644
--- a/linux-x64/clang/include/c++/v1/stdlib.h
+++ b/linux-x64/clang/include/c++/v1/stdlib.h
@@ -7,12 +7,16 @@
 //
 //===----------------------------------------------------------------------===//
 
-#if defined(__need_malloc_and_calloc)
+#if defined(__need_malloc_and_calloc) || defined(_LIBCPP_STDLIB_INCLUDE_NEXT)
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header
 #endif
 
+#if defined(_LIBCPP_STDLIB_INCLUDE_NEXT)
+#undef _LIBCPP_STDLIB_INCLUDE_NEXT
+#endif
+
 #include_next <stdlib.h>
 
 #elif !defined(_LIBCPP_STDLIB_H)
@@ -93,33 +97,7 @@
 #include_next <stdlib.h>
 
 #ifdef __cplusplus
-
-extern "C++" {
-
-#undef abs
-#undef div
-#undef labs
-#undef ldiv
-#ifndef _LIBCPP_HAS_NO_LONG_LONG
-#undef llabs
-#undef lldiv
-#endif
-
-// MSVCRT already has the correct prototype in <stdlib.h> if __cplusplus is defined
-#if !defined(_LIBCPP_MSVCRT) && !defined(__sun__) && !defined(_AIX)
-inline _LIBCPP_INLINE_VISIBILITY long      abs(     long __x) _NOEXCEPT {return  labs(__x);}
-#ifndef _LIBCPP_HAS_NO_LONG_LONG
-inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT {return llabs(__x);}
-#endif // _LIBCPP_HAS_NO_LONG_LONG
-
-inline _LIBCPP_INLINE_VISIBILITY  ldiv_t div(     long __x,      long __y) _NOEXCEPT {return  ldiv(__x, __y);}
-#ifndef _LIBCPP_HAS_NO_LONG_LONG
-inline _LIBCPP_INLINE_VISIBILITY lldiv_t div(long long __x, long long __y) _NOEXCEPT {return lldiv(__x, __y);}
-#endif // _LIBCPP_HAS_NO_LONG_LONG
-#endif // _LIBCPP_MSVCRT / __sun__ / _AIX
-
-}  // extern "C++"
-
+#include <math.h>
 #endif  // __cplusplus
 
 #endif  // _LIBCPP_STDLIB_H
diff --git a/linux-x64/clang/include/c++/v1/string b/linux-x64/clang/include/c++/v1/string
index e6d1614..1e5b098 100644
--- a/linux-x64/clang/include/c++/v1/string
+++ b/linux-x64/clang/include/c++/v1/string
@@ -627,13 +627,13 @@
 #else
 template <class _Iter, bool = __is_forward_iterator<_Iter>::value>
 struct __libcpp_string_gets_noexcept_iterator_impl : public _LIBCPP_BOOL_CONSTANT((
-    noexcept(++(declval<_Iter&>())) && 
-    is_nothrow_assignable<_Iter&, _Iter>::value && 
-    noexcept(declval<_Iter>() == declval<_Iter>()) && 
+    noexcept(++(declval<_Iter&>())) &&
+    is_nothrow_assignable<_Iter&, _Iter>::value &&
+    noexcept(declval<_Iter>() == declval<_Iter>()) &&
     noexcept(*declval<_Iter>())
 )) {};
 
-template <class _Iter> 
+template <class _Iter>
 struct __libcpp_string_gets_noexcept_iterator_impl<_Iter, false> : public false_type {};
 #endif
 
@@ -862,10 +862,10 @@
         _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
         explicit basic_string(const _Tp& __t, const allocator_type& __a);
 
-    template<class _InputIterator>
+    template<class _InputIterator, class = typename enable_if<__is_input_iterator<_InputIterator>::value>::type>
         _LIBCPP_INLINE_VISIBILITY
         basic_string(_InputIterator __first, _InputIterator __last);
-    template<class _InputIterator>
+    template<class _InputIterator, class = typename enable_if<__is_input_iterator<_InputIterator>::value>::type>
         _LIBCPP_INLINE_VISIBILITY
         basic_string(_InputIterator __first, _InputIterator __last, const allocator_type& __a);
 #ifndef _LIBCPP_CXX03_LANG
@@ -1060,10 +1060,10 @@
     void push_back(value_type __c);
     _LIBCPP_INLINE_VISIBILITY
     void pop_back();
-    _LIBCPP_INLINE_VISIBILITY reference       front();
-    _LIBCPP_INLINE_VISIBILITY const_reference front() const;
-    _LIBCPP_INLINE_VISIBILITY reference       back();
-    _LIBCPP_INLINE_VISIBILITY const_reference back() const;
+    _LIBCPP_INLINE_VISIBILITY reference       front() _NOEXCEPT;
+    _LIBCPP_INLINE_VISIBILITY const_reference front() const _NOEXCEPT;
+    _LIBCPP_INLINE_VISIBILITY reference       back() _NOEXCEPT;
+    _LIBCPP_INLINE_VISIBILITY const_reference back() const _NOEXCEPT;
 
     template <class _Tp>
     _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
@@ -1236,9 +1236,9 @@
     _LIBCPP_INLINE_VISIBILITY
     void swap(basic_string& __str)
 #if _LIBCPP_STD_VER >= 14
-        _NOEXCEPT_DEBUG;
+        _NOEXCEPT;
 #else
-        _NOEXCEPT_DEBUG_(!__alloc_traits::propagate_on_container_swap::value ||
+        _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
                     __is_nothrow_swappable<allocator_type>::value);
 #endif
 
@@ -1420,7 +1420,7 @@
     _LIBCPP_INLINE_VISIBILITY bool __invariants() const;
 
     _LIBCPP_INLINE_VISIBILITY void __clear_and_shrink() _NOEXCEPT;
-    
+
     _LIBCPP_INLINE_VISIBILITY
     bool __is_long() const _NOEXCEPT
         {return bool(__r_.first().__s.__size_ & __short_mask);}
@@ -1682,7 +1682,7 @@
   -> basic_string<_CharT, _Traits, _Allocator>;
 #endif
 
-                  
+
 template <class _CharT, class _Traits, class _Allocator>
 inline
 void
@@ -2077,7 +2077,7 @@
 }
 
 template <class _CharT, class _Traits, class _Allocator>
-template<class _InputIterator>
+template<class _InputIterator, class>
 inline
 basic_string<_CharT, _Traits, _Allocator>::basic_string(_InputIterator __first, _InputIterator __last)
 {
@@ -2088,7 +2088,7 @@
 }
 
 template <class _CharT, class _Traits, class _Allocator>
-template<class _InputIterator>
+template<class _InputIterator, class>
 inline
 basic_string<_CharT, _Traits, _Allocator>::basic_string(_InputIterator __first, _InputIterator __last,
                                                         const allocator_type& __a)
@@ -2525,7 +2525,7 @@
             const basic_string __temp (__first, __last, __alloc());
             append(__temp.data(), __temp.size());
         }
-        else 
+        else
         {
             if (__cap - __sz < __n)
                 __grow_by(__cap, __sz + __n - __cap, __sz, __sz, 0);
@@ -3237,7 +3237,7 @@
 template <class _CharT, class _Traits, class _Allocator>
 inline
 typename basic_string<_CharT, _Traits, _Allocator>::reference
-basic_string<_CharT, _Traits, _Allocator>::front()
+basic_string<_CharT, _Traits, _Allocator>::front() _NOEXCEPT
 {
     _LIBCPP_ASSERT(!empty(), "string::front(): string is empty");
     return *__get_pointer();
@@ -3246,7 +3246,7 @@
 template <class _CharT, class _Traits, class _Allocator>
 inline
 typename basic_string<_CharT, _Traits, _Allocator>::const_reference
-basic_string<_CharT, _Traits, _Allocator>::front() const
+basic_string<_CharT, _Traits, _Allocator>::front() const _NOEXCEPT
 {
     _LIBCPP_ASSERT(!empty(), "string::front(): string is empty");
     return *data();
@@ -3255,7 +3255,7 @@
 template <class _CharT, class _Traits, class _Allocator>
 inline
 typename basic_string<_CharT, _Traits, _Allocator>::reference
-basic_string<_CharT, _Traits, _Allocator>::back()
+basic_string<_CharT, _Traits, _Allocator>::back() _NOEXCEPT
 {
     _LIBCPP_ASSERT(!empty(), "string::back(): string is empty");
     return *(__get_pointer() + size() - 1);
@@ -3264,7 +3264,7 @@
 template <class _CharT, class _Traits, class _Allocator>
 inline
 typename basic_string<_CharT, _Traits, _Allocator>::const_reference
-basic_string<_CharT, _Traits, _Allocator>::back() const
+basic_string<_CharT, _Traits, _Allocator>::back() const _NOEXCEPT
 {
     _LIBCPP_ASSERT(!empty(), "string::back(): string is empty");
     return *(data() + size() - 1);
@@ -3295,9 +3295,9 @@
 void
 basic_string<_CharT, _Traits, _Allocator>::swap(basic_string& __str)
 #if _LIBCPP_STD_VER >= 14
-        _NOEXCEPT_DEBUG
+        _NOEXCEPT
 #else
-        _NOEXCEPT_DEBUG_(!__alloc_traits::propagate_on_container_swap::value ||
+        _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
                     __is_nothrow_swappable<allocator_type>::value)
 #endif
 {
@@ -3824,7 +3824,7 @@
 
 template<class _CharT, class _Traits, class _Allocator>
 inline
-void 
+void
 basic_string<_CharT, _Traits, _Allocator>::__clear_and_shrink() _NOEXCEPT
 {
     clear();
@@ -3834,7 +3834,7 @@
         __set_long_cap(0);
         __set_short_size(0);
     }
-} 
+}
 
 // operator==
 
@@ -4227,21 +4227,17 @@
     const typename basic_string<_CharT, _Traits, _Allocator>::size_type
                    basic_string<_CharT, _Traits, _Allocator>::npos;
 
-template<class _CharT, class _Traits, class _Allocator>
-struct _LIBCPP_TEMPLATE_VIS hash<basic_string<_CharT, _Traits, _Allocator> >
-    : public unary_function<basic_string<_CharT, _Traits, _Allocator>, size_t>
+template <class _CharT, class _Allocator>
+struct _LIBCPP_TEMPLATE_VIS
+    hash<basic_string<_CharT, char_traits<_CharT>, _Allocator> >
+    : public unary_function<
+          basic_string<_CharT, char_traits<_CharT>, _Allocator>, size_t>
 {
     size_t
-        operator()(const basic_string<_CharT, _Traits, _Allocator>& __val) const _NOEXCEPT;
+    operator()(const basic_string<_CharT, char_traits<_CharT>, _Allocator>& __val) const _NOEXCEPT
+    { return __do_string_hash(__val.data(), __val.data() + __val.size()); }
 };
 
-template<class _CharT, class _Traits, class _Allocator>
-size_t
-hash<basic_string<_CharT, _Traits, _Allocator> >::operator()(
-        const basic_string<_CharT, _Traits, _Allocator>& __val) const _NOEXCEPT
-{
-    return __do_string_hash(__val.data(), __val.data() + __val.size());
-}
 
 template<class _CharT, class _Traits, class _Allocator>
 basic_ostream<_CharT, _Traits>&
@@ -4331,7 +4327,7 @@
 _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_string<char>)
 _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_string<wchar_t>)
 
-#if _LIBCPP_STD_VER > 11 
+#if _LIBCPP_STD_VER > 11
 // Literal suffixes for basic_string [basic.string.literals]
 inline namespace literals
 {
diff --git a/linux-x64/clang/include/c++/v1/string_view b/linux-x64/clang/include/c++/v1/string_view
index 79565c2..0444831 100644
--- a/linux-x64/clang/include/c++/v1/string_view
+++ b/linux-x64/clang/include/c++/v1/string_view
@@ -228,9 +228,9 @@
     basic_string_view(const _CharT* __s, size_type __len) _NOEXCEPT
         : __data(__s), __size(__len)
     {
-// #if _LIBCPP_STD_VER > 11
-//         _LIBCPP_ASSERT(__len == 0 || __s != nullptr, "string_view::string_view(_CharT *, size_t): received nullptr");
-// #endif
+#if _LIBCPP_STD_VER > 11
+    _LIBCPP_ASSERT(__len == 0 || __s != nullptr, "string_view::string_view(_CharT *, size_t): received nullptr");
+#endif
     }
 
     _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
@@ -288,13 +288,13 @@
     }
 
     _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
-    const_reference front() const
+    const_reference front() const _NOEXCEPT
     {
         return _LIBCPP_ASSERT(!empty(), "string_view::front(): string is empty"), __data[0];
     }
 
     _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
-    const_reference back() const
+    const_reference back() const _NOEXCEPT
     {
         return _LIBCPP_ASSERT(!empty(), "string_view::back(): string is empty"), __data[__size-1];
     }
@@ -364,7 +364,7 @@
     }
 
     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
-    int compare(                       size_type __pos1, size_type __n1, 
+    int compare(                       size_type __pos1, size_type __n1,
                 basic_string_view __sv, size_type __pos2, size_type __n2) const
     {
         return substr(__pos1, __n1).compare(__sv.substr(__pos2, __n2));
@@ -628,7 +628,7 @@
 
 template<class _CharT, class _Traits>
 _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
-bool operator==(typename common_type<basic_string_view<_CharT, _Traits> >::type __lhs, 
+bool operator==(typename common_type<basic_string_view<_CharT, _Traits> >::type __lhs,
                 basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
 {
     if ( __lhs.size() != __rhs.size()) return false;
@@ -658,7 +658,7 @@
 
 template<class _CharT, class _Traits>
 _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
-bool operator!=(typename common_type<basic_string_view<_CharT, _Traits> >::type __lhs, 
+bool operator!=(typename common_type<basic_string_view<_CharT, _Traits> >::type __lhs,
                 basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
 {
     if ( __lhs.size() != __rhs.size())
@@ -685,7 +685,7 @@
 
 template<class _CharT, class _Traits>
 _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
-bool operator<(typename common_type<basic_string_view<_CharT, _Traits> >::type __lhs, 
+bool operator<(typename common_type<basic_string_view<_CharT, _Traits> >::type __lhs,
                 basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
 {
     return __lhs.compare(__rhs) < 0;
@@ -710,7 +710,7 @@
 
 template<class _CharT, class _Traits>
 _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
-bool operator>(typename common_type<basic_string_view<_CharT, _Traits> >::type __lhs, 
+bool operator>(typename common_type<basic_string_view<_CharT, _Traits> >::type __lhs,
                 basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
 {
     return __lhs.compare(__rhs) > 0;
@@ -735,7 +735,7 @@
 
 template<class _CharT, class _Traits>
 _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
-bool operator<=(typename common_type<basic_string_view<_CharT, _Traits> >::type __lhs, 
+bool operator<=(typename common_type<basic_string_view<_CharT, _Traits> >::type __lhs,
                 basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
 {
     return __lhs.compare(__rhs) <= 0;
@@ -761,7 +761,7 @@
 
 template<class _CharT, class _Traits>
 _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
-bool operator>=(typename common_type<basic_string_view<_CharT, _Traits> >::type __lhs, 
+bool operator>=(typename common_type<basic_string_view<_CharT, _Traits> >::type __lhs,
                 basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
 {
     return __lhs.compare(__rhs) >= 0;
@@ -776,18 +776,18 @@
 typedef basic_string_view<wchar_t>  wstring_view;
 
 // [string.view.hash]
-template<class _CharT, class _Traits>
-struct _LIBCPP_TEMPLATE_VIS hash<basic_string_view<_CharT, _Traits> >
-    : public unary_function<basic_string_view<_CharT, _Traits>, size_t>
+template<class _CharT>
+struct _LIBCPP_TEMPLATE_VIS hash<basic_string_view<_CharT, char_traits<_CharT> > >
+    : public unary_function<basic_string_view<_CharT, char_traits<_CharT> >, size_t>
 {
     _LIBCPP_INLINE_VISIBILITY
-    size_t operator()(const basic_string_view<_CharT, _Traits> __val) const _NOEXCEPT {
+    size_t operator()(const basic_string_view<_CharT, char_traits<_CharT> > __val) const _NOEXCEPT {
         return __do_string_hash(__val.data(), __val.data() + __val.size());
     }
 };
 
 
-#if _LIBCPP_STD_VER > 11 
+#if _LIBCPP_STD_VER > 11
 inline namespace literals
 {
   inline namespace string_view_literals
diff --git a/linux-x64/clang/include/c++/v1/support/xlocale/xlocale.h b/linux-x64/clang/include/c++/v1/support/xlocale/xlocale.h
deleted file mode 100644
index e69de29..0000000
--- a/linux-x64/clang/include/c++/v1/support/xlocale/xlocale.h
+++ /dev/null
diff --git a/linux-x64/clang/include/c++/v1/thread b/linux-x64/clang/include/c++/v1/thread
index df06ff7..3d8d2ac 100644
--- a/linux-x64/clang/include/c++/v1/thread
+++ b/linux-x64/clang/include/c++/v1/thread
@@ -434,7 +434,12 @@
     using namespace chrono;
     if (__d > duration<_Rep, _Period>::zero())
     {
+#if defined(_LIBCPP_COMPILER_GCC) && (__powerpc__ || __POWERPC__)
+    //  GCC's long double const folding is incomplete for IBM128 long doubles.
         _LIBCPP_CONSTEXPR duration<long double> _Max = nanoseconds::max();
+#else
+        _LIBCPP_CONSTEXPR duration<long double> _Max = duration<long double>(ULLONG_MAX/1000000000ULL) ;
+#endif
         nanoseconds __ns;
         if (__d < _Max)
         {
diff --git a/linux-x64/clang/include/c++/v1/tuple b/linux-x64/clang/include/c++/v1/tuple
index f7e7ee1..de30e86 100644
--- a/linux-x64/clang/include/c++/v1/tuple
+++ b/linux-x64/clang/include/c++/v1/tuple
@@ -87,8 +87,8 @@
 template <class... T> struct tuple_size<tuple<T...>>;
 template <class T>
  inline constexpr size_t tuple_size_v = tuple_size<T>::value; // C++17
-template <size_t I, class T> class tuple_element; // undefined
-template <size_t I, class... T> class tuple_element<I, tuple<T...>>;
+template <size_t I, class T> struct tuple_element; // undefined
+template <size_t I, class... T> struct tuple_element<I, tuple<T...>>;
 template <size_t I, class T>
   using tuple_element_t = typename tuple_element <I, T>::type; // C++14
 
@@ -209,12 +209,12 @@
               "Attempted to default construct a reference element in a tuple");}
 
     template <class _Tp,
-              class = typename enable_if<
-                  __lazy_and<
-                      __lazy_not<is_same<typename __uncvref<_Tp>::type, __tuple_leaf>>
-                    , is_constructible<_Hp, _Tp>
+              class = _EnableIf<
+                  _And<
+                      _IsNotSame<__uncvref_t<_Tp>, __tuple_leaf>,
+                      is_constructible<_Hp, _Tp>
                     >::value
-                >::type
+                >
             >
         _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
         explicit __tuple_leaf(_Tp&& __t) _NOEXCEPT_((is_nothrow_constructible<_Hp, _Tp>::value))
@@ -291,12 +291,12 @@
             : _Hp(__a) {}
 
     template <class _Tp,
-              class = typename enable_if<
-                  __lazy_and<
-                        __lazy_not<is_same<typename __uncvref<_Tp>::type, __tuple_leaf>>
-                      , is_constructible<_Hp, _Tp>
-                    >::value
-                >::type
+              class = _EnableIf<
+                  _And<
+                    _IsNotSame<__uncvref_t<_Tp>, __tuple_leaf>,
+                    is_constructible<_Hp, _Tp>
+                  >::value
+                >
             >
         _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
         explicit __tuple_leaf(_Tp&& __t) _NOEXCEPT_((is_nothrow_constructible<_Hp, _Tp>::value))
@@ -345,9 +345,6 @@
 _LIBCPP_INLINE_VISIBILITY
 void __swallow(_Tp&&...) _NOEXCEPT {}
 
-template <class ..._Tp>
-struct __lazy_all : __all<_Tp::value...> {};
-
 template <class _Tp>
 struct __all_default_constructible;
 
@@ -524,6 +521,13 @@
         template <class ..._Args>
         static constexpr bool __enable_implicit() {
             return
+               __tuple_constructible<
+                    tuple<_Args...>,
+                    typename __make_tuple_types<tuple,
+                             sizeof...(_Args) < sizeof...(_Tp) ?
+                                 sizeof...(_Args) :
+                                 sizeof...(_Tp)>::type
+                >::value &&
                 __tuple_convertible<
                     tuple<_Args...>,
                     typename __make_tuple_types<tuple,
@@ -550,7 +554,8 @@
     {
         template <class _Tuple>
         static constexpr bool __enable_implicit() {
-            return __tuple_convertible<_Tuple, tuple>::value;
+            return __tuple_constructible<_Tuple, tuple>::value
+                && __tuple_convertible<_Tuple, tuple>::value;
         }
 
         template <class _Tuple>
@@ -567,19 +572,20 @@
         // the UTypes... constructor should be selected instead.
         // See LWG issue #2549.
         template <class _Tuple>
-        using _PreferTupleLikeConstructor = __lazy_or<
+        using _PreferTupleLikeConstructor = _Or<
             // Don't attempt the two checks below if the tuple we are given
             // has the same type as this tuple.
-            is_same<typename __uncvref<_Tuple>::type, tuple>,
-            __lazy_and<
-                __lazy_not<is_constructible<_Tp..., _Tuple>>,
-                __lazy_not<is_convertible<_Tuple, _Tp...>>
+            _IsSame<__uncvref_t<_Tuple>, tuple>,
+            _Lazy<_And,
+                _Not<is_constructible<_Tp..., _Tuple>>,
+                _Not<is_convertible<_Tuple, _Tp...>>
             >
         >;
 
         template <class _Tuple>
         static constexpr bool __enable_implicit() {
-            return __lazy_and<
+            return _And<
+                __tuple_constructible<_Tuple, tuple>,
                 __tuple_convertible<_Tuple, tuple>,
                 _PreferTupleLikeConstructor<_Tuple>
             >::value;
@@ -587,10 +593,10 @@
 
         template <class _Tuple>
         static constexpr bool __enable_explicit() {
-            return __lazy_and<
+            return _And<
                 __tuple_constructible<_Tuple, tuple>,
                 _PreferTupleLikeConstructor<_Tuple>,
-                __lazy_not<__tuple_convertible<_Tuple, tuple>>
+                _Not<__tuple_convertible<_Tuple, tuple>>
             >::value;
         }
     };
@@ -615,12 +621,13 @@
     tuple(tuple const&) = default;
     tuple(tuple&&) = default;
 
-    template <class _AllocArgT, class _Alloc, bool _Dummy = true, class = typename enable_if<
-        __lazy_and<
-            is_same<allocator_arg_t, _AllocArgT>,
-            __lazy_all<__dependent_type<is_default_constructible<_Tp>, _Dummy>...>
+    template <class _AllocArgT, class _Alloc, bool _Dummy = true, class = _EnableIf<
+        _And<
+            _IsSame<allocator_arg_t, _AllocArgT>,
+           __dependent_type<is_default_constructible<_Tp>, _Dummy>...
        >::value
-    >::type>
+      >
+    >
     _LIBCPP_INLINE_VISIBILITY
     tuple(_AllocArgT, _Alloc const& __a)
       : __base_(allocator_arg_t(), __a,
@@ -907,7 +914,7 @@
 {
 public:
     _LIBCPP_INLINE_VISIBILITY
-    _LIBCPP_CONSTEXPR tuple() _NOEXCEPT {}
+    _LIBCPP_CONSTEXPR tuple() _NOEXCEPT = default;
     template <class _Alloc>
     _LIBCPP_INLINE_VISIBILITY
         tuple(allocator_arg_t, const _Alloc&) _NOEXCEPT {}
@@ -952,7 +959,7 @@
 typename tuple_element<_Ip, tuple<_Tp...> >::type&
 get(tuple<_Tp...>& __t) _NOEXCEPT
 {
-    typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type;
+    typedef _LIBCPP_NODEBUG_TYPE typename tuple_element<_Ip, tuple<_Tp...> >::type type;
     return static_cast<__tuple_leaf<_Ip, type>&>(__t.__base_).get();
 }
 
@@ -961,7 +968,7 @@
 const typename tuple_element<_Ip, tuple<_Tp...> >::type&
 get(const tuple<_Tp...>& __t) _NOEXCEPT
 {
-    typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type;
+    typedef _LIBCPP_NODEBUG_TYPE typename tuple_element<_Ip, tuple<_Tp...> >::type type;
     return static_cast<const __tuple_leaf<_Ip, type>&>(__t.__base_).get();
 }
 
@@ -970,7 +977,7 @@
 typename tuple_element<_Ip, tuple<_Tp...> >::type&&
 get(tuple<_Tp...>&& __t) _NOEXCEPT
 {
-    typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type;
+    typedef _LIBCPP_NODEBUG_TYPE typename tuple_element<_Ip, tuple<_Tp...> >::type type;
     return static_cast<type&&>(
              static_cast<__tuple_leaf<_Ip, type>&&>(__t.__base_).get());
 }
@@ -980,7 +987,7 @@
 const typename tuple_element<_Ip, tuple<_Tp...> >::type&&
 get(const tuple<_Tp...>&& __t) _NOEXCEPT
 {
-    typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type;
+    typedef _LIBCPP_NODEBUG_TYPE typename tuple_element<_Ip, tuple<_Tp...> >::type type;
     return static_cast<const type&&>(
              static_cast<const __tuple_leaf<_Ip, type>&&>(__t.__base_).get());
 }
@@ -1199,7 +1206,7 @@
 template <class ..._Ttypes, class ..._Utypes>
 struct __tuple_cat_type<tuple<_Ttypes...>, __tuple_types<_Utypes...> >
 {
-    typedef tuple<_Ttypes..., _Utypes...> type;
+    typedef _LIBCPP_NODEBUG_TYPE tuple<_Ttypes..., _Utypes...> type;
 };
 
 template <class _ResultTuple, bool _Is_Tuple0TupleLike, class ..._Tuples>
@@ -1210,8 +1217,8 @@
 template <class ..._Types, class _Tuple0>
 struct __tuple_cat_return_1<tuple<_Types...>, true, _Tuple0>
 {
-    typedef typename __tuple_cat_type<tuple<_Types...>,
-            typename __make_tuple_types<typename remove_reference<_Tuple0>::type>::type>::type
+    typedef _LIBCPP_NODEBUG_TYPE typename __tuple_cat_type<tuple<_Types...>,
+            typename __make_tuple_types<typename __uncvref<_Tuple0>::type>::type>::type
                                                                            type;
 };
 
@@ -1220,7 +1227,7 @@
     : public __tuple_cat_return_1<
                  typename __tuple_cat_type<
                      tuple<_Types...>,
-                     typename __make_tuple_types<typename remove_reference<_Tuple0>::type>::type
+                     typename __make_tuple_types<typename __uncvref<_Tuple0>::type>::type
                  >::type,
                  __tuple_like<typename remove_reference<_Tuple1>::type>::value,
                  _Tuple1, _Tuples...>
@@ -1240,7 +1247,7 @@
 template <>
 struct __tuple_cat_return<>
 {
-    typedef tuple<> type;
+    typedef _LIBCPP_NODEBUG_TYPE tuple<> type;
 };
 
 inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
@@ -1256,7 +1263,7 @@
 template <class ..._Types, size_t ..._I0, class _Tuple0>
 struct __tuple_cat_return_ref_imp<tuple<_Types...>, __tuple_indices<_I0...>, _Tuple0>
 {
-    typedef typename remove_reference<_Tuple0>::type _T0;
+    typedef _LIBCPP_NODEBUG_TYPE typename remove_reference<_Tuple0>::type _T0;
     typedef tuple<_Types..., typename __apply_cv<_Tuple0,
                           typename tuple_element<_I0, _T0>::type>::type&&...> type;
 };
@@ -1303,8 +1310,8 @@
     typename __tuple_cat_return_ref<tuple<_Types...>&&, _Tuple0&&, _Tuple1&&, _Tuples&&...>::type
     operator()(tuple<_Types...> __t, _Tuple0&& __t0, _Tuple1&& __t1, _Tuples&& ...__tpls)
     {
-        typedef typename remove_reference<_Tuple0>::type _T0;
-        typedef typename remove_reference<_Tuple1>::type _T1;
+        typedef _LIBCPP_NODEBUG_TYPE typename remove_reference<_Tuple0>::type _T0;
+        typedef _LIBCPP_NODEBUG_TYPE typename remove_reference<_Tuple1>::type _T1;
         return __tuple_cat<
            tuple<_Types..., typename __apply_cv<_Tuple0, typename tuple_element<_J0, _T0>::type>::type&&...>,
            typename __make_tuple_indices<sizeof ...(_Types) + tuple_size<_T0>::value>::type,
@@ -1323,7 +1330,7 @@
 typename __tuple_cat_return<_Tuple0, _Tuples...>::type
 tuple_cat(_Tuple0&& __t0, _Tuples&&... __tpls)
 {
-    typedef typename remove_reference<_Tuple0>::type _T0;
+    typedef _LIBCPP_NODEBUG_TYPE typename remove_reference<_Tuple0>::type _T0;
     return __tuple_cat<tuple<>, __tuple_indices<>,
                   typename __make_tuple_indices<tuple_size<_T0>::value>::type>()
                   (tuple<>(), _VSTD::forward<_Tuple0>(__t0),
diff --git a/linux-x64/clang/include/c++/v1/type_traits b/linux-x64/clang/include/c++/v1/type_traits
index 37b7ca1..5ccafec 100644
--- a/linux-x64/clang/include/c++/v1/type_traits
+++ b/linux-x64/clang/include/c++/v1/type_traits
@@ -90,6 +90,9 @@
     template <class T> struct remove_extent;
     template <class T> struct remove_all_extents;
 
+    template <class T> struct is_bounded_array;                 // C++20
+    template <class T> struct is_unbounded_array;               // C++20
+
     // Member introspection:
     template <class T> struct is_pod;
     template <class T> struct is_trivial;
@@ -140,7 +143,10 @@
     // Relationships between types:
     template <class T, class U> struct is_same;
     template <class Base, class Derived> struct is_base_of;
+
     template <class From, class To> struct is_convertible;
+    template <typename From, typename To> struct is_nothrow_convertible;                  // C++20
+    template <typename From, typename To> inline constexpr bool is_nothrow_convertible_v; // C++20
 
     template <class Fn, class... ArgTypes> struct is_invocable;
     template <class R, class Fn, class... ArgTypes> struct is_invocable_r;
@@ -196,6 +202,12 @@
     template <class T>
       using remove_all_extents_t = typename remove_all_extents<T>::type;  // C++14
 
+    template <class T>
+      inline constexpr bool is_bounded_array_v
+        = is_bounded_array<T>::value;                                     // C++20
+      inline constexpr bool is_unbounded_array_v
+        = is_unbounded_array<T>::value;                                   // C++20
+
     // pointer modifications:
     template <class T>
       using remove_pointer_t = typename remove_pointer<T>::type;  // C++14
@@ -415,6 +427,96 @@
 template <class _Tp> class _LIBCPP_TEMPLATE_VIS reference_wrapper;
 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS hash;
 
+
+template <class _Tp, _Tp __v>
+struct _LIBCPP_TEMPLATE_VIS integral_constant
+{
+  static _LIBCPP_CONSTEXPR const _Tp      value = __v;
+  typedef _Tp               value_type;
+  typedef integral_constant type;
+  _LIBCPP_INLINE_VISIBILITY
+  _LIBCPP_CONSTEXPR operator value_type() const _NOEXCEPT {return value;}
+#if _LIBCPP_STD_VER > 11
+  _LIBCPP_INLINE_VISIBILITY
+  constexpr value_type operator ()() const _NOEXCEPT {return value;}
+#endif
+};
+
+template <class _Tp, _Tp __v>
+_LIBCPP_CONSTEXPR const _Tp integral_constant<_Tp, __v>::value;
+
+#if _LIBCPP_STD_VER > 14
+template <bool __b>
+using bool_constant = integral_constant<bool, __b>;
+#define _LIBCPP_BOOL_CONSTANT(__b) bool_constant<(__b)>
+#else
+#define _LIBCPP_BOOL_CONSTANT(__b) integral_constant<bool,(__b)>
+#endif
+
+typedef _LIBCPP_BOOL_CONSTANT(true)  true_type;
+typedef _LIBCPP_BOOL_CONSTANT(false) false_type;
+
+template <bool _Val>
+using _BoolConstant _LIBCPP_NODEBUG_TYPE = integral_constant<bool, _Val>;
+
+template <bool> struct _MetaBase;
+template <>
+struct _MetaBase<true> {
+  template <class _Tp, class _Up>
+  using _SelectImpl _LIBCPP_NODEBUG_TYPE = _Tp;
+  template <template <class...> class _FirstFn, template <class...> class, class ..._Args>
+  using _SelectApplyImpl _LIBCPP_NODEBUG_TYPE = _FirstFn<_Args...>;
+  template <class _First, class...>
+  using _FirstImpl _LIBCPP_NODEBUG_TYPE = _First;
+  template <class, class _Second, class...>
+  using _SecondImpl _LIBCPP_NODEBUG_TYPE = _Second;
+  template <class _Tp = void>
+  using _EnableIfImpl _LIBCPP_NODEBUG_TYPE = _Tp;
+  template <class _Result, class _First, class ..._Rest>
+  using _OrImpl _LIBCPP_NODEBUG_TYPE = typename _MetaBase<_First::value != true && sizeof...(_Rest) != 0>::template _OrImpl<_First, _Rest...>;
+  template <class _Result, class _First, class ..._Rest>
+  using _AndImpl _LIBCPP_NODEBUG_TYPE = typename _MetaBase<_First::value == true && sizeof...(_Rest) != 0>::template _AndImpl<_First, _Rest...>;
+};
+
+template <>
+struct _MetaBase<false> {
+  template <class _Tp, class _Up>
+  using _SelectImpl _LIBCPP_NODEBUG_TYPE = _Up;
+  template <template <class...> class, template <class...> class _SecondFn, class ..._Args>
+  using _SelectApplyImpl _LIBCPP_NODEBUG_TYPE = _SecondFn<_Args...>;
+  template <class _Result, class ...>
+  using _OrImpl _LIBCPP_NODEBUG_TYPE = _Result;
+  template <class _Result, class ...>
+  using _AndImpl _LIBCPP_NODEBUG_TYPE = _Result;
+};
+template <bool _Cond, class _Ret = void>
+using _EnableIf _LIBCPP_NODEBUG_TYPE = typename _MetaBase<_Cond>::template _EnableIfImpl<_Ret>;
+template <bool _Cond, class _IfRes, class _ElseRes>
+using _If _LIBCPP_NODEBUG_TYPE = typename _MetaBase<_Cond>::template _SelectImpl<_IfRes, _ElseRes>;
+template <class ..._Rest>
+using _Or _LIBCPP_NODEBUG_TYPE = typename _MetaBase< sizeof...(_Rest) != 0 >::template _OrImpl<false_type, _Rest...>;
+template <class ..._Rest>
+using _And _LIBCPP_NODEBUG_TYPE = typename _MetaBase< sizeof...(_Rest) != 0 >::template _AndImpl<true_type, _Rest...>;
+template <class _Pred>
+struct _Not : _BoolConstant<!_Pred::value> {};
+template <class ..._Args>
+using _FirstType _LIBCPP_NODEBUG_TYPE = typename _MetaBase<(sizeof...(_Args) >= 1)>::template _FirstImpl<_Args...>;
+template <class ..._Args>
+using _SecondType _LIBCPP_NODEBUG_TYPE = typename _MetaBase<(sizeof...(_Args) >= 2)>::template _SecondImpl<_Args...>;
+
+template <template <class...> class _Func, class ..._Args>
+struct _Lazy : _Func<_Args...> {};
+
+// Member detector base
+
+template <template <class...> class _Templ, class ..._Args>
+true_type __sfinae_test_impl(_FirstType<int, _Templ<_Args...> >);
+template <template <class...> class, class ...>
+false_type __sfinae_test_impl(...);
+
+template <template <class ...> class _Templ, class ..._Args>
+using _IsValidExpansion _LIBCPP_NODEBUG_TYPE = decltype(std::__sfinae_test_impl<_Templ, _Args...>(0));
+
 template <class>
 struct __void_t { typedef void type; };
 
@@ -433,9 +535,6 @@
 template <bool _Bp, class _If, class _Then> using conditional_t = typename conditional<_Bp, _If, _Then>::type;
 #endif
 
-template <bool, class _Tp> struct _LIBCPP_TEMPLATE_VIS __lazy_enable_if {};
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS __lazy_enable_if<true, _Tp> {typedef typename _Tp::type type;};
-
 template <bool, class _Tp = void> struct _LIBCPP_TEMPLATE_VIS enable_if {};
 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS enable_if<true, _Tp> {typedef _Tp type;};
 
@@ -443,6 +542,34 @@
 template <bool _Bp, class _Tp = void> using enable_if_t = typename enable_if<_Bp, _Tp>::type;
 #endif
 
+// is_same
+
+template <class _Tp, class _Up> struct _LIBCPP_TEMPLATE_VIS is_same           : public false_type {};
+template <class _Tp>            struct _LIBCPP_TEMPLATE_VIS is_same<_Tp, _Tp> : public true_type {};
+
+#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
+template <class _Tp, class _Up>
+_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_same_v
+    = is_same<_Tp, _Up>::value;
+#endif
+
+template <class _Tp, class _Up>
+using _IsSame = _BoolConstant<
+#ifdef __clang__
+    __is_same(_Tp, _Up)
+#else
+    _VSTD::is_same<_Tp, _Up>::value
+#endif
+>;
+
+template <class _Tp, class _Up>
+using _IsNotSame = _BoolConstant<
+#ifdef __clang__
+    !__is_same(_Tp, _Up)
+#else
+    !_VSTD::is_same<_Tp, _Up>::value
+#endif
+>;
 // addressof
 #ifndef _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF
 
@@ -516,111 +643,6 @@
 
 // helper class:
 
-template <class _Tp, _Tp __v>
-struct _LIBCPP_TEMPLATE_VIS integral_constant
-{
-    static _LIBCPP_CONSTEXPR const _Tp      value = __v;
-    typedef _Tp               value_type;
-    typedef integral_constant type;
-    _LIBCPP_INLINE_VISIBILITY
-        _LIBCPP_CONSTEXPR operator value_type() const _NOEXCEPT {return value;}
-#if _LIBCPP_STD_VER > 11
-    _LIBCPP_INLINE_VISIBILITY
-         constexpr value_type operator ()() const _NOEXCEPT {return value;}
-#endif
-};
-
-template <class _Tp, _Tp __v>
-_LIBCPP_CONSTEXPR const _Tp integral_constant<_Tp, __v>::value;
-
-#if _LIBCPP_STD_VER > 14
-template <bool __b>
-using bool_constant = integral_constant<bool, __b>;
-#define _LIBCPP_BOOL_CONSTANT(__b) bool_constant<(__b)>
-#else
-#define _LIBCPP_BOOL_CONSTANT(__b) integral_constant<bool,(__b)>
-#endif
-
-typedef _LIBCPP_BOOL_CONSTANT(true)  true_type;
-typedef _LIBCPP_BOOL_CONSTANT(false) false_type;
-
-#if !defined(_LIBCPP_CXX03_LANG)
-
-// __lazy_and
-
-template <bool _Last, class ..._Preds>
-struct __lazy_and_impl;
-
-template <class ..._Preds>
-struct __lazy_and_impl<false, _Preds...> : false_type {};
-
-template <>
-struct __lazy_and_impl<true> : true_type {};
-
-template <class _Pred>
-struct __lazy_and_impl<true, _Pred> : integral_constant<bool, _Pred::type::value> {};
-
-template <class _Hp, class ..._Tp>
-struct __lazy_and_impl<true, _Hp, _Tp...> : __lazy_and_impl<_Hp::type::value, _Tp...> {};
-
-template <class _P1, class ..._Pr>
-struct __lazy_and : __lazy_and_impl<_P1::type::value, _Pr...> {};
-
-// __lazy_or
-
-template <bool _List, class ..._Preds>
-struct __lazy_or_impl;
-
-template <class ..._Preds>
-struct __lazy_or_impl<true, _Preds...> : true_type {};
-
-template <>
-struct __lazy_or_impl<false> : false_type {};
-
-template <class _Hp, class ..._Tp>
-struct __lazy_or_impl<false, _Hp, _Tp...>
-        : __lazy_or_impl<_Hp::type::value, _Tp...> {};
-
-template <class _P1, class ..._Pr>
-struct __lazy_or : __lazy_or_impl<_P1::type::value, _Pr...> {};
-
-// __lazy_not
-
-template <class _Pred>
-struct __lazy_not : integral_constant<bool, !_Pred::type::value> {};
-
-// __and_
-template<class...> struct __and_;
-template<> struct __and_<> : true_type {};
-
-template<class _B0> struct __and_<_B0> : _B0 {};
-
-template<class _B0, class _B1>
-struct __and_<_B0, _B1> : conditional<_B0::value, _B1, _B0>::type {};
-
-template<class _B0, class _B1, class _B2, class... _Bn>
-struct __and_<_B0, _B1, _B2, _Bn...>
-        : conditional<_B0::value, __and_<_B1, _B2, _Bn...>, _B0>::type {};
-
-// __or_
-template<class...> struct __or_;
-template<> struct __or_<> : false_type {};
-
-template<class _B0> struct __or_<_B0> : _B0 {};
-
-template<class _B0, class _B1>
-struct __or_<_B0, _B1> : conditional<_B0::value, _B0, _B1>::type {};
-
-template<class _B0, class _B1, class _B2, class... _Bn>
-struct __or_<_B0, _B1, _B2, _Bn...>
-        : conditional<_B0::value, _B0, __or_<_B1, _B2, _Bn...> >::type {};
-
-// __not_
-template<class _Tp>
-struct __not_ : conditional<_Tp::value, false_type, true_type>::type {};
-
-#endif // !defined(_LIBCPP_CXX03_LANG)
-
 // is_const
 
 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_const            : public false_type {};
@@ -773,8 +795,16 @@
 template <class _Tp> struct __libcpp_is_pointer       : public false_type {};
 template <class _Tp> struct __libcpp_is_pointer<_Tp*> : public true_type {};
 
+template <class _Tp> struct __libcpp_remove_objc_qualifiers { typedef _Tp type; };
+#if defined(_LIBCPP_HAS_OBJC_ARC)
+template <class _Tp> struct __libcpp_remove_objc_qualifiers<_Tp __strong> { typedef _Tp type; };
+template <class _Tp> struct __libcpp_remove_objc_qualifiers<_Tp __weak> { typedef _Tp type; };
+template <class _Tp> struct __libcpp_remove_objc_qualifiers<_Tp __autoreleasing> { typedef _Tp type; };
+template <class _Tp> struct __libcpp_remove_objc_qualifiers<_Tp __unsafe_unretained> { typedef _Tp type; };
+#endif
+
 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_pointer
-    : public __libcpp_is_pointer<typename remove_cv<_Tp>::type> {};
+    : public __libcpp_is_pointer<typename __libcpp_remove_objc_qualifiers<typename remove_cv<_Tp>::type>::type> {};
 
 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
 template <class _Tp>
@@ -788,15 +818,11 @@
 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_lvalue_reference<_Tp&> : public true_type {};
 
 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_rvalue_reference        : public false_type {};
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_rvalue_reference<_Tp&&> : public true_type {};
-#endif
 
 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_reference        : public false_type {};
 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_reference<_Tp&>  : public true_type {};
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_reference<_Tp&&> : public true_type {};
-#endif
 
 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
 template <class _Tp>
@@ -813,7 +839,7 @@
 #endif
 // is_union
 
-#if __has_feature(is_union) || (_GNUC_VER >= 403)
+#if __has_feature(is_union) || defined(_LIBCPP_COMPILER_GCC)
 
 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_union
     : public integral_constant<bool, __is_union(_Tp)> {};
@@ -834,7 +860,7 @@
 
 // is_class
 
-#if __has_feature(is_class) || (_GNUC_VER >= 403)
+#if __has_feature(is_class) || defined(_LIBCPP_COMPILER_GCC)
 
 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_class
     : public integral_constant<bool, __is_class(_Tp)> {};
@@ -858,17 +884,6 @@
     = is_class<_Tp>::value;
 #endif
 
-// is_same
-
-template <class _Tp, class _Up> struct _LIBCPP_TEMPLATE_VIS is_same           : public false_type {};
-template <class _Tp>            struct _LIBCPP_TEMPLATE_VIS is_same<_Tp, _Tp> : public true_type {};
-
-#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
-template <class _Tp, class _Up>
-_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_same_v
-    = is_same<_Tp, _Up>::value;
-#endif
-
 // is_function
 
 namespace __libcpp_is_function_imp
@@ -956,7 +971,7 @@
 
 // is_enum
 
-#if __has_feature(is_enum) || (_GNUC_VER >= 403)
+#if __has_feature(is_enum) || defined(_LIBCPP_COMPILER_GCC)
 
 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_enum
     : public integral_constant<bool, __is_enum(_Tp)> {};
@@ -1060,7 +1075,7 @@
 
 template <class _Tp>
 struct __is_referenceable : integral_constant<bool,
-    !is_same<decltype(__is_referenceable_impl::__test<_Tp>(0)), __two>::value> {};
+    _IsNotSame<decltype(__is_referenceable_impl::__test<_Tp>(0)), __two>::value> {};
 
 
 // add_const
@@ -1068,13 +1083,13 @@
 template <class _Tp, bool = is_reference<_Tp>::value ||
                             is_function<_Tp>::value  ||
                             is_const<_Tp>::value     >
-struct __add_const             {typedef _Tp type;};
+struct __add_const             {typedef _LIBCPP_NODEBUG_TYPE  _Tp type;};
 
 template <class _Tp>
-struct __add_const<_Tp, false> {typedef const _Tp type;};
+struct __add_const<_Tp, false> {typedef _LIBCPP_NODEBUG_TYPE  const _Tp type;};
 
 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_const
-    {typedef typename __add_const<_Tp>::type type;};
+    {typedef _LIBCPP_NODEBUG_TYPE  typename __add_const<_Tp>::type type;};
 
 #if _LIBCPP_STD_VER > 11
 template <class _Tp> using add_const_t = typename add_const<_Tp>::type;
@@ -1091,7 +1106,7 @@
 struct __add_volatile<_Tp, false> {typedef volatile _Tp type;};
 
 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_volatile
-    {typedef typename __add_volatile<_Tp>::type type;};
+    {typedef _LIBCPP_NODEBUG_TYPE typename __add_volatile<_Tp>::type type;};
 
 #if _LIBCPP_STD_VER > 11
 template <class _Tp> using add_volatile_t = typename add_volatile<_Tp>::type;
@@ -1100,7 +1115,7 @@
 // add_cv
 
 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_cv
-    {typedef typename add_const<typename add_volatile<_Tp>::type>::type type;};
+    {typedef _LIBCPP_NODEBUG_TYPE typename add_const<typename add_volatile<_Tp>::type>::type type;};
 
 #if _LIBCPP_STD_VER > 11
 template <class _Tp> using add_cv_t = typename add_cv<_Tp>::type;
@@ -1108,11 +1123,9 @@
 
 // remove_reference
 
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference        {typedef _Tp type;};
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference<_Tp&>  {typedef _Tp type;};
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference<_Tp&&> {typedef _Tp type;};
-#endif
+template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference        {typedef _LIBCPP_NODEBUG_TYPE _Tp type;};
+template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference<_Tp&>  {typedef _LIBCPP_NODEBUG_TYPE _Tp type;};
+template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference<_Tp&&> {typedef _LIBCPP_NODEBUG_TYPE _Tp type;};
 
 #if _LIBCPP_STD_VER > 11
 template <class _Tp> using remove_reference_t = typename remove_reference<_Tp>::type;
@@ -1120,32 +1133,26 @@
 
 // add_lvalue_reference
 
-template <class _Tp, bool = __is_referenceable<_Tp>::value> struct __add_lvalue_reference_impl            { typedef _Tp  type; };
-template <class _Tp                                       > struct __add_lvalue_reference_impl<_Tp, true> { typedef _Tp& type; };
+template <class _Tp, bool = __is_referenceable<_Tp>::value> struct __add_lvalue_reference_impl            { typedef _LIBCPP_NODEBUG_TYPE _Tp  type; };
+template <class _Tp                                       > struct __add_lvalue_reference_impl<_Tp, true> { typedef _LIBCPP_NODEBUG_TYPE _Tp& type; };
 
 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_lvalue_reference
-{typedef typename __add_lvalue_reference_impl<_Tp>::type type;};
+{typedef _LIBCPP_NODEBUG_TYPE typename  __add_lvalue_reference_impl<_Tp>::type type;};
 
 #if _LIBCPP_STD_VER > 11
 template <class _Tp> using add_lvalue_reference_t = typename add_lvalue_reference<_Tp>::type;
 #endif
 
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
-template <class _Tp, bool = __is_referenceable<_Tp>::value> struct __add_rvalue_reference_impl            { typedef _Tp   type; };
-template <class _Tp                                       > struct __add_rvalue_reference_impl<_Tp, true> { typedef _Tp&& type; };
+template <class _Tp, bool = __is_referenceable<_Tp>::value> struct __add_rvalue_reference_impl            { typedef _LIBCPP_NODEBUG_TYPE  _Tp   type; };
+template <class _Tp                                       > struct __add_rvalue_reference_impl<_Tp, true> { typedef _LIBCPP_NODEBUG_TYPE  _Tp&& type; };
 
 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_rvalue_reference
-{typedef typename __add_rvalue_reference_impl<_Tp>::type type;};
+{typedef _LIBCPP_NO