[clang] [libcxx] [clang][WIP] std::embed and #depend implementation (PR #190578)

The Phantom Derpstorm via cfe-commits cfe-commits at lists.llvm.org
Sun Apr 19 10:02:34 PDT 2026


https://github.com/ThePhD updated https://github.com/llvm/llvm-project/pull/190578

>From 991961c8380786ab95c17f42dfd959b9838e8ed1 Mon Sep 17 00:00:00 2001
From: ThePhD <phdofthehouse at gmail.com>
Date: Wed, 1 Apr 2026 19:06:16 +0200
Subject: [PATCH 1/7] =?UTF-8?q?[Clang][Lex][Sema]=20=E2=9C=A8=20Full=20std?=
 =?UTF-8?q?::embed=20and=20#depend=20implementation?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 clang/include/clang/AST/ASTContext.h          |  15 ++
 clang/include/clang/Basic/Builtins.td         |   7 +
 clang/include/clang/Basic/DiagnosticGroups.td |   2 +-
 .../include/clang/Basic/DiagnosticLexKinds.td |   4 +
 .../clang/Basic/InputDependencyCollection.h   |  66 +++++
 clang/include/clang/Basic/ResourceSearch.h    |  37 +++
 clang/include/clang/Basic/TokenKinds.def      |   2 +
 clang/include/clang/Lex/PPCallbacks.h         |  16 ++
 clang/include/clang/Lex/Preprocessor.h        |   9 +-
 clang/include/clang/Sema/Sema.h               |   1 +
 clang/lib/AST/ASTContext.cpp                  |  12 +
 clang/lib/AST/ExprConstant.cpp                | 234 +++++++++++++++++-
 clang/lib/Basic/CMakeLists.txt                |   2 +
 clang/lib/Basic/IdentifierTable.cpp           |   1 +
 clang/lib/Basic/InputDependencyCollection.cpp | 181 ++++++++++++++
 clang/lib/Basic/ResourceSearch.cpp            | 107 ++++++++
 clang/lib/Frontend/ASTUnit.cpp                |   8 +-
 clang/lib/Frontend/CompilerInstance.cpp       |   2 +
 clang/lib/Frontend/DependencyFile.cpp         |  91 ++++++-
 clang/lib/Lex/PPDirectives.cpp                | 128 +++++-----
 clang/lib/Lex/Preprocessor.cpp                |  22 +-
 clang/lib/Sema/SemaChecking.cpp               | 151 +++++++++++
 .../clang-import-test/clang-import-test.cpp   |   2 +
 clang/unittests/Lex/PPCallbacksTest.cpp       |   1 +
 libcxx/include/CMakeLists.txt                 |   1 +
 libcxx/include/embed                          | 113 +++++++++
 libcxx/include/version                        |   7 +
 27 files changed, 1135 insertions(+), 87 deletions(-)
 create mode 100644 clang/include/clang/Basic/InputDependencyCollection.h
 create mode 100644 clang/include/clang/Basic/ResourceSearch.h
 create mode 100644 clang/lib/Basic/InputDependencyCollection.cpp
 create mode 100644 clang/lib/Basic/ResourceSearch.cpp
 create mode 100644 libcxx/include/embed

diff --git a/clang/include/clang/AST/ASTContext.h b/clang/include/clang/AST/ASTContext.h
index ba1b58489c327..56cf139cad791 100644
--- a/clang/include/clang/AST/ASTContext.h
+++ b/clang/include/clang/AST/ASTContext.h
@@ -28,6 +28,7 @@
 #include "clang/AST/Type.h"
 #include "clang/AST/TypeOrdering.h"
 #include "clang/Basic/LLVM.h"
+#include "clang/Basic/InputDependencyCollection.h"
 #include "clang/Basic/PartialDiagnostic.h"
 #include "clang/Basic/SourceLocation.h"
 #include "llvm/ADT/DenseMap.h"
@@ -131,6 +132,7 @@ class OMPTraitInfo;
 class ParentMapContext;
 struct ParsedTargetAttr;
 class Preprocessor;
+class PreprocessorOptions;
 class ProfileList;
 class StoredDeclsMap;
 class TargetAttr;
@@ -567,6 +569,11 @@ class ASTContext : public RefCountedBase<ASTContext> {
   // A mapping from Scalable Vector Type keys to their corresponding QualType.
   mutable llvm::DenseMap<llvm::ScalableVecTyKey, QualType> ScalableVecTyMap;
 
+  // Same preprocessor options from other lexers, so we can look up
+  // embedded files
+  PreprocessorOptions const *PPOpts = nullptr;
+
+
   ASTContext &this_() { return *this; }
 
 public:
@@ -802,6 +809,7 @@ class ASTContext : public RefCountedBase<ASTContext> {
   mutable DeclarationNameTable DeclarationNames;
   IntrusiveRefCntPtr<ExternalASTSource> ExternalSource;
   ASTMutationListener *Listener = nullptr;
+  std::shared_ptr<InputDependencyCollection> InputDependencyPatterns = std::make_shared<InputDependencyCollection>();
 
   /// Returns the clang bytecode interpreter context.
   interp::Context &getInterpContext() const;
@@ -1396,6 +1404,13 @@ class ASTContext : public RefCountedBase<ASTContext> {
   ASTContext &operator=(const ASTContext &) = delete;
   ~ASTContext();
 
+  /// Set the preprocessor options to use right now
+  void setCurrentPreprocessorOptions(PreprocessorOptions const *NewPPOpts);
+  void setCurrentPreprocessorOptions(const PreprocessorOptions &NewPPOpts);
+
+  /// Get the preprocessor options we are using. Can be null!
+  PreprocessorOptions const* getCurrentPreprocessorOptions() const;
+
   /// Attach an external AST source to the AST context.
   ///
   /// The external AST source provides the ability to load parts of
diff --git a/clang/include/clang/Basic/Builtins.td b/clang/include/clang/Basic/Builtins.td
index b8bbc544595e2..d33dc0fe32233 100644
--- a/clang/include/clang/Basic/Builtins.td
+++ b/clang/include/clang/Basic/Builtins.td
@@ -1006,6 +1006,13 @@ def GetVtablePointer : LangBuiltin<"CXX_LANG"> {
   let Prototype = "void*(void*)";
 }
 
+// p1040 std::embed
+def StdEmbed : Builtin {
+  let Spellings = ["__builtin_std_embed"];
+  let Attributes = [NoThrow, Const, Consteval];
+  let Prototype = "void const*(size_t&, ...)";
+}
+
 // GCC exception builtins
 def EHReturn : Builtin {
   let Spellings = ["__builtin_eh_return"];
diff --git a/clang/include/clang/Basic/DiagnosticGroups.td b/clang/include/clang/Basic/DiagnosticGroups.td
index 3136d109e795b..cd924b26012c0 100644
--- a/clang/include/clang/Basic/DiagnosticGroups.td
+++ b/clang/include/clang/Basic/DiagnosticGroups.td
@@ -1524,7 +1524,7 @@ def : DiagGroup<"c++1y-extensions", [CXX14]>;
 def : DiagGroup<"c++1z-extensions", [CXX17]>;
 def : DiagGroup<"c++2a-extensions", [CXX20]>;
 def : DiagGroup<"c++2b-extensions", [CXX23]>;
-def : DiagGroup<"c++2c-extensions", [CXX26]>;
+def CXX2C : DiagGroup<"c++2c-extensions", [CXX26]>;
 
 def DelegatingCtorCycles :
   DiagGroup<"delegating-ctor-cycles">;
diff --git a/clang/include/clang/Basic/DiagnosticLexKinds.td b/clang/include/clang/Basic/DiagnosticLexKinds.td
index 30efb0d90c124..747140457f5a6 100644
--- a/clang/include/clang/Basic/DiagnosticLexKinds.td
+++ b/clang/include/clang/Basic/DiagnosticLexKinds.td
@@ -467,6 +467,9 @@ def warn_c23_compat_warning_directive : Warning<
 def ext_pp_embed_directive : ExtWarn<
   "#embed is a %select{C23|Clang}0 extension">,
   InGroup<C23>;
+def ext_pp_depend_directive : ExtWarn<
+  "#depend is a %select{C++2c|Clang}0 extension">,
+  InGroup<CXX2C>, DefaultIgnore;
 def warn_compat_pp_embed_directive : Warning<
   "#embed is incompatible with C standards before C23">,
   InGroup<CPre23Compat>, DefaultIgnore;
@@ -582,6 +585,7 @@ def err_pp_including_mainfile_in_preamble : Error<
 def err_pp_empty_filename : Error<"empty filename">;
 def err_pp_include_too_deep : Error<"#include nested too deeply">;
 def err_pp_expects_filename : Error<"expected \"FILENAME\" or <FILENAME>">;
+def err_pp_expects_pattern : Error<"expected \"PATTERN\" or <PATTERN>">;
 def err_pp_macro_not_identifier : Error<"macro name must be an identifier">;
 def err_pp_missing_macro_name : Error<"macro name missing">;
 def err_pp_missing_rparen_in_macro_def : Error<
diff --git a/clang/include/clang/Basic/InputDependencyCollection.h b/clang/include/clang/Basic/InputDependencyCollection.h
new file mode 100644
index 0000000000000..d29a9e4192f37
--- /dev/null
+++ b/clang/include/clang/Basic/InputDependencyCollection.h
@@ -0,0 +1,66 @@
+//===--- InputDependencyCollection.h - Searching for Resources --*- C++ -*-===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+//
+// User-provided filters include/exclude profile instrumentation in certain
+// functions.
+//
+//===----------------------------------------------------------------------===//
+#ifndef LLVM_CLANG_BASIC_INPUTDEPENDENCYCOLLECTION_H
+#define LLVM_CLANG_BASIC_INPUTDEPENDENCYCOLLECTION_H
+
+#include "clang/Basic/FileEntry.h"
+#include "llvm/ADT/ArrayRef.h"
+#include "llvm/Support/Regex.h"
+#include <string>
+#include <vector>
+
+namespace clang {
+
+class FileManager;
+
+/// How to handle various forms of input dependency root patterns for search
+/// purposes.
+enum class RootPatternScanType {
+  None = 0b00,
+  Directory = 0b01,
+  RecursiveDirectory = 0b10,
+  DirectoryAndRecursiveDirectory = 0b11
+};
+
+struct PatternFilter {
+  std::string Input;
+  std::string SearchRoot;
+  std::string PatternRoot;
+  std::string Pattern;
+  llvm::Regex PatternRegex;
+  RootPatternScanType RootHandling;
+  bool Exported;
+
+  PatternFilter(std::string Input);
+
+  bool Check(StringRef Filename) const;
+};
+
+class InputDependencyCollection {
+private:
+  std::vector<PatternFilter> PatternFilters;
+
+  static PatternFilter ComputeFilter(std::string Pattern, bool Exported);
+
+public:
+  InputDependencyCollection() = default;
+
+  PatternFilter &Add(std::string Pattern, bool IsAngled, bool Exported,
+                     FileManager &FM,
+                     const std::vector<std::string> &SearchEntries,
+                     OptionalFileEntryRef LookupFrom);
+  bool Check(llvm::StringRef Filename) const;
+};
+} // namespace clang
+
+#endif
diff --git a/clang/include/clang/Basic/ResourceSearch.h b/clang/include/clang/Basic/ResourceSearch.h
new file mode 100644
index 0000000000000..da163b9698841
--- /dev/null
+++ b/clang/include/clang/Basic/ResourceSearch.h
@@ -0,0 +1,37 @@
+//===--- ResourceSearch.h - Searching for Resources -------------*- C++ -*-===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+//
+// User-provided filters include/exclude profile instrumentation in certain
+// functions.
+//
+//===----------------------------------------------------------------------===//
+#ifndef LLVM_CLANG_BASIC_RESOURCESEARCH_H
+#define LLVM_CLANG_BASIC_RESOURCESEARCH_H
+
+#include "clang/Basic/FileEntry.h"
+#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/StringRef.h"
+#include <memory>
+#include <optional>
+
+namespace clang {
+
+class FileManager;
+
+OptionalFileEntryRef
+LookupFileWithStdVec(StringRef Filename, bool isAngled, bool OpenFile,
+                     FileManager &FM,
+                     const std::vector<std::string> &SearchEntries,
+                     OptionalFileEntryRef LookupFromFile);
+OptionalFileEntryRef LookupFileWith(StringRef Filename, bool isAngled,
+                                    bool OpenFile, FileManager &FM,
+                                    ArrayRef<StringRef> SearchEntries,
+                                    OptionalFileEntryRef LookupFromFile);
+} // namespace clang
+
+#endif
diff --git a/clang/include/clang/Basic/TokenKinds.def b/clang/include/clang/Basic/TokenKinds.def
index 8b9f613037718..28f706ce87f70 100644
--- a/clang/include/clang/Basic/TokenKinds.def
+++ b/clang/include/clang/Basic/TokenKinds.def
@@ -132,6 +132,8 @@ PPKEYWORD(pragma)
 
 // C23 & C++26 #embed
 PPKEYWORD(embed)
+// C++29 #depend
+PPKEYWORD(depend)
 
 // C++20 Module Directive
 PPKEYWORD(module)
diff --git a/clang/include/clang/Lex/PPCallbacks.h b/clang/include/clang/Lex/PPCallbacks.h
index 51c6a31e143b8..fbe31e7cf649b 100644
--- a/clang/include/clang/Lex/PPCallbacks.h
+++ b/clang/include/clang/Lex/PPCallbacks.h
@@ -29,6 +29,7 @@ class MacroDefinition;
 class MacroDirective;
 class MacroArgs;
 struct LexEmbedParametersResult;
+struct PatternFilter;
 
 /// This interface provides a way to observe the actions of the
 /// preprocessor as it does its thing.
@@ -175,6 +176,12 @@ class PPCallbacks {
                                   bool ModuleImported,
                                   SrcMgr::CharacteristicKind FileType) {}
 
+  /// Hook called when a 'depend' directive is read.
+  virtual void DependDirective(SourceLocation HashLoc, const Token &DependTok,
+                               StringRef FileName, bool IsAngled,
+                               const PatternFilter& Filter,
+                               OptionalFileEntryRef CurrentFile) {}
+
   /// Callback invoked whenever a submodule was entered.
   ///
   /// \param M The submodule we have entered.
@@ -543,6 +550,15 @@ class PPChainedCallbacks : public PPCallbacks {
                                SuggestedModule, ModuleImported, FileType);
   }
 
+  /// Hook called whenever an \#depend is seen.
+  void DependDirective(SourceLocation HashLoc, const Token &DependTok,
+                               StringRef Pattern, bool IsAngled,
+                               const PatternFilter& Filter,
+                               OptionalFileEntryRef CurrentFile) override {
+    First->DependDirective(HashLoc, DependTok, Pattern, IsAngled, Filter, CurrentFile);
+    Second->DependDirective(HashLoc, DependTok, Pattern, IsAngled, Filter, CurrentFile);
+  }
+
   void EnteredSubmodule(Module *M, SourceLocation ImportLoc,
                         bool ForPragma) override {
     First->EnteredSubmodule(M, ImportLoc, ForPragma);
diff --git a/clang/include/clang/Lex/Preprocessor.h b/clang/include/clang/Lex/Preprocessor.h
index c7e152a75f51f..33e0984cd7d80 100644
--- a/clang/include/clang/Lex/Preprocessor.h
+++ b/clang/include/clang/Lex/Preprocessor.h
@@ -17,6 +17,7 @@
 #include "clang/Basic/Diagnostic.h"
 #include "clang/Basic/DiagnosticIDs.h"
 #include "clang/Basic/IdentifierTable.h"
+#include "clang/Basic/InputDependencyCollection.h"
 #include "clang/Basic/LLVM.h"
 #include "clang/Basic/LangOptions.h"
 #include "clang/Basic/Module.h"
@@ -343,6 +344,9 @@ class Preprocessor {
   /// The kind of translation unit we are processing.
   const TranslationUnitKind TUKind;
 
+  /// The #depend dependency patterns seen in this translation unit
+  std::shared_ptr<InputDependencyCollection> InputDependencyPatterns = std::make_shared<InputDependencyCollection>();
+
   /// Returns a pointer into the given file's buffer that's guaranteed
   /// to be between tokens. The returned pointer is always before \p Start.
   /// The maximum distance betweenthe returned pointer and \p Start is
@@ -1812,7 +1816,8 @@ class Preprocessor {
   void LexTokensUntilEOF(std::vector<Token> *Tokens = nullptr);
 
   /// Lex a token, forming a header-name token if possible.
-  bool LexHeaderName(Token &Result, bool AllowMacroExpansion = true);
+  bool LexHeaderName(Token &Result, bool AllowMacroExpansion = true,
+                     bool SkipFirst = false);
 
   /// Lex the parameters for an #embed directive, returns nullopt on error.
   std::optional<LexEmbedParametersResult> LexEmbedParameters(Token &Current,
@@ -2895,6 +2900,8 @@ class Preprocessor {
       const FileEntry *LookupFromFile, StringRef &LookupFilename,
       SmallVectorImpl<char> &RelativePath, SmallVectorImpl<char> &SearchPath,
       ModuleMap::KnownHeader &SuggestedModule, bool isAngled);
+  // Input dependency caching
+  void HandleDependDirective(SourceLocation HashLoc, Token &Tok);
   // Binary data inclusion
   void HandleEmbedDirective(SourceLocation HashLoc, Token &Tok);
   void HandleEmbedDirectiveImpl(SourceLocation HashLoc,
diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index 760555d9c8b9b..da491f1f4a04a 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -3053,6 +3053,7 @@ class Sema final : public SemaBase {
   bool CheckInvalidBuiltinCountedByRef(const Expr *E,
                                        BuiltinCountedByRefKind K);
   bool BuiltinCountedByRef(CallExpr *TheCall);
+  bool BuiltinStdEmbed(CallExpr *TheCall);
 
   // Matrix builtin handling.
   ExprResult BuiltinMatrixTranspose(CallExpr *TheCall, ExprResult CallResult);
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index ee7f823b014b2..d0cde5397663b 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -903,6 +903,18 @@ ASTContext::ASTContext(LangOptions &LOpts, SourceManager &SM,
   addTranslationUnitDecl();
 }
 
+void ASTContext::setCurrentPreprocessorOptions(const PreprocessorOptions &NewOpts) {
+  PPOpts = &NewOpts;
+}
+
+void ASTContext::setCurrentPreprocessorOptions(PreprocessorOptions const *NewOpts) {
+  PPOpts = NewOpts;
+}
+
+PreprocessorOptions const *ASTContext::getCurrentPreprocessorOptions() const {
+  return PPOpts;
+}
+
 void ASTContext::cleanup() {
   // Release the DenseMaps associated with DeclContext objects.
   // FIXME: Is this the ideal solution?
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index 4f45fa728c605..084fe16bf04f2 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -53,13 +53,18 @@
 #include "clang/AST/TypeLoc.h"
 #include "clang/Basic/Builtins.h"
 #include "clang/Basic/DiagnosticSema.h"
+#include "clang/Basic/FileManager.h"
+#include "clang/Basic/ResourceSearch.h"
+#include "clang/Basic/SourceManager.h"
 #include "clang/Basic/TargetBuiltins.h"
 #include "clang/Basic/TargetInfo.h"
+#include "clang/Lex/PreprocessorOptions.h"
 #include "llvm/ADT/APFixedPoint.h"
 #include "llvm/ADT/Sequence.h"
 #include "llvm/ADT/SmallBitVector.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/Support/Casting.h"
+#include "llvm/Support/ConvertUTF.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/SaveAndRestore.h"
 #include "llvm/Support/SipHash.h"
@@ -3544,13 +3549,16 @@ static APSInt extractStringLiteralCharacter(EvalInfo &Info, const Expr *Lit,
   if (auto PE = dyn_cast<PredefinedExpr>(Lit))
     Lit = PE->getFunctionName();
   const StringLiteral *S = cast<StringLiteral>(Lit);
+  const StringLiteralKind SLK = S->getKind();
   const ConstantArrayType *CAT =
       Info.Ctx.getAsConstantArrayType(S->getType());
   assert(CAT && "string literal isn't an array");
   QualType CharType = CAT->getElementType();
-  assert(CharType->isIntegerType() && "unexpected character type");
+  assert(((SLK == StringLiteralKind::Binary && CharType->isIntegralOrEnumerationType())
+      || (SLK != StringLiteralKind::Binary && CharType->isIntegerType()))
+    && "unexpected character type");
   APSInt Value(Info.Ctx.getTypeSize(CharType),
-               CharType->isUnsignedIntegerType());
+               CharType->isUnsignedIntegerOrEnumerationType());
   if (Index < S->getLength())
     Value = S->getCodeUnit(Index);
   return Value;
@@ -10688,7 +10696,223 @@ bool PointerExprEvaluator::VisitBuiltinCallExpr(const CallExpr *E,
         return false;
     }
   }
+  case Builtin::BI__builtin_std_embed: {
+    const Expr *SizeOutArg = E->getArg(0);
+    const Expr *PtrSpecifierArg = E->getArg(1);
+    const Expr *ResourceNameSizeArg = E->getArg(2);
+    const Expr *ResourceNamePtrArg = E->getArg(3);
+    const Expr *OffsetArg = E->getArg(4);
+    const Expr *LimitArg = E->getNumArgs() == 6 ? E->getArg(5) : nullptr;
+
+    QualType ArrElementTy = PtrSpecifierArg->getType()->getPointeeType();
+
+    LValue ResourceNamePtrLVal;
+    if (!evaluatePointer(ResourceNamePtrArg, ResourceNamePtrLVal)) {
+      return Error(ResourceNamePtrArg);
+    }
+
+    APSInt ResourceNameSizeVal;
+    if (!EvaluateInteger(ResourceNameSizeArg, ResourceNameSizeVal, Info)) {
+      return Error(ResourceNameSizeArg);
+    }
+    if (ResourceNameSizeVal.getBitWidth() > 64) {
+      Info.FFDiag(ResourceNameSizeArg->getBeginLoc(), diag::err_ice_too_large) << OffsetArg << 64 << 1;
+      return false;
+    }
+    APValue ResourceNamePtrVal;
+    ResourceNamePtrLVal.moveInto(ResourceNamePtrVal);
+    uint64_t ResourceNameSize = ResourceNameSizeVal.getZExtValue();
+
+    std::string ResourceName;
+    const QualType SizeTy = Info.Ctx.getSizeType();
+    const QualType WCharTy = Info.Ctx.getWideCharType();
+    const size_t SizeTySize = Info.Ctx.getTypeSize(SizeTy);
+    const size_t WCharTySize = Info.Ctx.getTypeSize(WCharTy);
+    const QualType ResourceNameCharTy(ResourceNamePtrArg->getType()->getPointeeOrArrayElementType(), 0);
+    if (ResourceNameCharTy->isChar8Type() || ResourceNameCharTy->isCharType() || (ResourceNameCharTy->isWideCharType() && WCharTySize == 8)) {
+      // Assume the ResourceName is directly usable as an 8-bit transmuation
+      for (size_t Index = 0; Index < ResourceNameSize; ++Index) {
+        APValue Char;
+        if (!handleLValueToRValueConversion(Info, ResourceNamePtrArg,
+              ResourceNameCharTy, ResourceNamePtrLVal, Char)) {
+          return Error(ResourceNamePtrArg);
+        }
+        ResourceName.push_back(static_cast<char>(static_cast<unsigned char>(Char.getInt().getExtValue())));
+        
+        if (!HandleLValueArrayAdjustment(Info, ResourceNamePtrArg,
+            ResourceNamePtrLVal, ResourceNameCharTy, 1)) {
+          return Error(ResourceNamePtrArg);
+        }
+      }
+    }
+    else if (ResourceNameCharTy->isWideCharType()) {
+      // we assume either UTF-16, or UTF-32 based on the size of the string
+      // transmute accordingly
+      if (WCharTySize == 16) {
+        llvm::SmallVector<llvm::UTF16, 64> ResourceNameU16;
+        for (size_t Index = 0; Index < ResourceNameSize; ++Index) {
+          APValue Char;
+          if (!handleLValueToRValueConversion(Info, ResourceNamePtrArg,
+                ResourceNameCharTy, ResourceNamePtrLVal, Char)) {
+            return Error(ResourceNamePtrArg);
+          }
+          ResourceName.push_back(static_cast<llvm::UTF16>(Char.getInt().getExtValue()));
+          
+          if (!HandleLValueArrayAdjustment(Info, ResourceNamePtrArg,
+              ResourceNamePtrLVal, ResourceNameCharTy, 1)) {
+            return Error(ResourceNamePtrArg);
+          }
+        }
+        if (!llvm::convertUTF16ToUTF8String(ResourceNameU16, ResourceName)){
+          // error: bad name conversion
+          return Error(ResourceNamePtrArg);
+        }
+      }
+      else if (WCharTySize == 32) {
+        llvm::SmallVector<llvm::UTF32, 64> ResourceNameU32;
+        for (size_t Index = 0; Index < ResourceNameSize; ++Index) {
+          APValue Char;
+          if (!handleLValueToRValueConversion(Info, ResourceNamePtrArg,
+                ResourceNameCharTy, ResourceNamePtrLVal, Char)) {
+            return false;
+          }
+          ResourceName.push_back(static_cast<llvm::UTF32>(Char.getInt().getExtValue()));
+          
+          if (!HandleLValueArrayAdjustment(Info, ResourceNamePtrArg,
+              ResourceNamePtrLVal, ResourceNameCharTy, 1)) {
+                return false;
+          }
+        }
+        if (!llvm::convertUTF32ToUTF8String(ResourceNameU32, ResourceName)) {
+          // error: bad name conversion
+          return Error(ResourceNamePtrArg);
+        }
+      }
+      else {
+        llvm::report_fatal_error("The filename has a wide character type that cannot be converted to a UTF-8/multibyte string");
+      }
+    }
+    else {
+      llvm::report_fatal_error("The filename has an unusuable or unrecognizable character type");
+    }
+
+    uint64_t DataSize = 0;
+    uint64_t DataOffset = 0;
+    std::optional<int64_t> MaybeLimit = std::nullopt;
+    
+    APSInt OffsetVal;
+    if (!EvaluateInteger(OffsetArg, OffsetVal, Info)) {
+      return Error(OffsetArg);
+    }
+    if (OffsetVal.getBitWidth() > 64) {
+      Info.FFDiag(OffsetArg->getBeginLoc(), diag::err_ice_too_large) << OffsetArg << 64 << 0;
+      return false;
+    }
+    DataOffset = OffsetVal.getZExtValue();
 
+    if (LimitArg) {
+      APSInt LimitVal;
+      if (!EvaluateInteger(LimitArg, LimitVal, Info)) {
+        return Error(OffsetArg);
+      }
+      if (LimitVal.getBitWidth() > 64) {
+        Info.FFDiag(LimitArg->getBeginLoc(), diag::err_ice_too_large) << LimitArg << 64 << 0;
+        return false;
+      }
+      uint64_t FullLimit = LimitVal.getZExtValue();
+      if (FullLimit > static_cast<uint64_t>(std::numeric_limits<int64_t>::max())) {
+        // error: implementation limit here since we can only
+        // have a 63-bit unsigned number, not a 64-bit one
+        Info.FFDiag(LimitArg->getBeginLoc(), diag::err_ice_too_large) << FullLimit << 64 << 0;
+        return false;
+      }
+      MaybeLimit = static_cast<int64_t>(FullLimit);
+    }
+
+    SourceManager &SM = Info.Ctx.getSourceManager();
+    FileManager &FM = SM.getFileManager();
+    PreprocessorOptions const* MaybePPOpts = Info.Ctx.getCurrentPreprocessorOptions();
+    const std::vector<std::string>* MaybeSearchEntries = nullptr;
+    const std::vector<std::string> EmptySearchEntries(0);
+    FileID ThisFileID = SM.getFileID(Info.CurrentCall->CallRange.getBegin());
+    OptionalFileEntryRef ThisFile = std::nullopt;
+    if (ThisFileID.isValid()) {
+      ThisFile = SM.getFileEntryRefForID(ThisFileID);
+    }
+    if (MaybePPOpts) {
+      MaybeSearchEntries = &MaybePPOpts->EmbedEntries;
+    }
+    else {
+      MaybeSearchEntries = &EmptySearchEntries;
+    }
+    OptionalFileEntryRef ResourceFile =
+      LookupFileWithStdVec(ResourceName, false, true, FM, *MaybeSearchEntries, ThisFile);
+    if (!ResourceFile) {
+      Info.FFDiag(ResourceNamePtrArg->getBeginLoc(), diag::err_cannot_open_file) << ResourceName << "cannot find a matching resource to open";
+      return false;
+    }
+    if (Info.Ctx.InputDependencyPatterns) {
+      StringRef ResourceSearchName = ResourceFile->getFileEntry().tryGetRealPathName();
+      if (ResourceSearchName.empty()) {
+        ResourceSearchName = ResourceName;
+      }
+      if (!Info.Ctx.InputDependencyPatterns->Check(ResourceSearchName)) {
+        Info.FFDiag(ResourceNamePtrArg->getBeginLoc(), diag::err_cannot_open_file) << ResourceName << "no '#depend' directive matches the found resource";
+        return false;
+      }
+    }
+    llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> MaybeBinaryData =
+      FM.getBufferForFile(*ResourceFile, true, false, MaybeLimit, false);
+    if (auto Err = MaybeBinaryData.getError()) {
+      std::string ExtraMessage = Err.message();
+      std::string ErrorMessage = "could not open the resource";
+      if (!ExtraMessage.empty()) {
+        ErrorMessage += ", ";
+        ErrorMessage += ExtraMessage;
+      }
+      Info.FFDiag(ResourceNamePtrArg->getBeginLoc(), diag::err_cannot_open_file) << ResourceName << ErrorMessage;
+      return false;
+    }
+    llvm::MemoryBuffer *BinaryData = MaybeBinaryData->get();
+    if (!BinaryData) {
+      Info.FFDiag(ResourceNamePtrArg->getBeginLoc(), diag::err_cannot_open_file) << ResourceName << "found the resource but unable to read the binary data";
+      return false;
+    }
+    size_t FullDataSize = BinaryData->getBufferSize();
+    DataSize = std::max<size_t>(0, std::min<size_t>(
+      DataOffset > FullDataSize
+      ? 0 : FullDataSize - DataOffset,
+      MaybeLimit ? *MaybeLimit : std::numeric_limits<size_t>::max()));
+
+    // Write out size
+    LValue SizeOutLVal;
+    if (!EvaluateLValue(SizeOutArg, SizeOutLVal, Info)) {
+      return Error(SizeOutArg);
+    }
+    APSInt BackingArraySizeVal(llvm::APInt(SizeTySize, DataSize, false), true);
+    APValue SizeOutResult(BackingArraySizeVal);
+    if (!handleAssignment(Info, SizeOutArg, SizeOutLVal, SizeOutArg->getType(), SizeOutResult)) {
+      return Error(SizeOutArg);
+    }
+
+    // return data literal pointer to string
+    SourceLocation BuiltinLoc = E->getBeginLoc();
+    // TODO: perhaps there may be smarter ways to load this data up;
+    // right now, this is not doing too much on the face with caching or smart
+    // deduplication in the compiler.
+    StringRef TargetData(BinaryData->getBufferStart() + DataOffset, DataSize);
+    QualType BackingArrayTy = Info.Ctx.getConstantArrayType(
+        ArrElementTy, BackingArraySizeVal, nullptr, ArraySizeModifier::Normal, 0);
+    const ConstantArrayType *BackingArrayConstantArrayTy = cast<ConstantArrayType>(BackingArrayTy);
+    StringLiteral *DataLiteral = StringLiteral::Create(Info.Ctx, TargetData,
+      StringLiteralKind::Binary, false, BackingArrayTy, ArrayRef<SourceLocation>(&BuiltinLoc, 1));
+    if (!EvaluateLValue(DataLiteral, Result, Info)) {
+      return Error(E);
+    }
+    // inform the result we have put a string literal in there
+    Result.addArray(Info, E, BackingArrayConstantArrayTy); 
+    return true;
+  }
   default:
     return false;
   }
@@ -15284,8 +15508,10 @@ class IntExprEvaluator
   bool Success(const llvm::APSInt &SI, const Expr *E, APValue &Result) {
     assert(E->getType()->isIntegralOrEnumerationType() &&
            "Invalid evaluation result.");
-    assert(SI.isSigned() == E->getType()->isSignedIntegerOrEnumerationType() &&
-           "Invalid evaluation result.");
+    auto Ty = E->getType();
+    if (SI.isSigned() != Ty->isSignedIntegerOrEnumerationType()) {
+      assert(false && "Invalid evaluation result.");
+    }
     assert(SI.getBitWidth() == Info.Ctx.getIntWidth(E->getType()) &&
            "Invalid evaluation result.");
     Result = APValue(SI);
diff --git a/clang/lib/Basic/CMakeLists.txt b/clang/lib/Basic/CMakeLists.txt
index adfc6ee326b5a..936e2798e65d7 100644
--- a/clang/lib/Basic/CMakeLists.txt
+++ b/clang/lib/Basic/CMakeLists.txt
@@ -71,6 +71,7 @@ add_clang_library(clangBasic
   FileManager.cpp
   FileSystemStatCache.cpp
   IdentifierTable.cpp
+  InputDependencyCollection.cpp
   LangOptions.cpp
   LangStandards.cpp
   MakeSupport.cpp
@@ -83,6 +84,7 @@ add_clang_library(clangBasic
   ParsedAttrInfo.cpp
   ProfileList.cpp
   NoSanitizeList.cpp
+  ResourceSearch.cpp
   SanitizerSpecialCaseList.cpp
   Sanitizers.cpp
   Sarif.cpp
diff --git a/clang/lib/Basic/IdentifierTable.cpp b/clang/lib/Basic/IdentifierTable.cpp
index 7f96777fbd4cb..aa1a4cac6ec17 100644
--- a/clang/lib/Basic/IdentifierTable.cpp
+++ b/clang/lib/Basic/IdentifierTable.cpp
@@ -439,6 +439,7 @@ tok::PPKeywordKind IdentifierInfo::getPPKeywordID() const {
 
   CASE( 6, 'a', 's', assert);
   CASE( 6, 'd', 'f', define);
+  CASE( 6, 'd', 'p', depend);
   CASE( 6, 'i', 'n', ifndef);
   CASE( 6, 'i', 'p', import);
   CASE( 6, 'm', 'd', module);
diff --git a/clang/lib/Basic/InputDependencyCollection.cpp b/clang/lib/Basic/InputDependencyCollection.cpp
new file mode 100644
index 0000000000000..844b3694b10f5
--- /dev/null
+++ b/clang/lib/Basic/InputDependencyCollection.cpp
@@ -0,0 +1,181 @@
+//===--- InputDependencyCollection.h - Searching for Resource----*- C++ -*-===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+//
+// User-provided filters include/exclude profile instrumentation in certain
+// functions or files.
+//
+//===----------------------------------------------------------------------===//
+
+#include "clang/Basic/InputDependencyCollection.h"
+#include "clang/Basic/FileManager.h"
+#include "llvm/Support/Path.h"
+#include <filesystem>
+
+using namespace llvm;
+
+namespace clang {
+
+PatternFilter::PatternFilter(std::string Pattern)
+    : Input(std::move(Pattern)), SearchRoot(""), PatternRoot(""), Pattern(""),
+      RootHandling(RootPatternScanType::None), Exported(false) {}
+
+bool PatternFilter::Check(StringRef Filename) const {
+  if (!PatternRoot.empty()) {
+    // if the pattern root is not empty, first check if the filename is anchored
+    // in the pattern's root exit early if it's not
+    if (!Filename.contains(PatternRoot)) {
+      return false;
+    }
+  }
+  // otherwise, commit to doing a regex search
+  if (PatternRegex.match(Filename)) {
+    // it matches, we can find it
+    return true;
+  }
+  return false;
+}
+
+PatternFilter InputDependencyCollection::ComputeFilter(std::string Pattern,
+                                                       bool Exported) {
+  static constexpr const char *RecursiveReplacement = ".*";
+  static constexpr const std::size_t RecursiveReplacementSize = 2;
+  static constexpr const char *Replacement = "[^/\\]*";
+  static constexpr const std::size_t ReplacementSize = 6;
+  PatternFilter Computed(std::move(Pattern));
+  // Technically, this is a very conservative estimate, since this is only in
+  // the most harmless of cases.
+  Computed.Pattern.reserve(Computed.Input.size());
+  const std::size_t InputSize = Computed.Input.size();
+  std::optional<std::size_t> LastRootSeparator = std::nullopt;
+  std::optional<std::size_t> LastStar = std::nullopt;
+  std::optional<std::size_t> LastStarStar = std::nullopt;
+  for (std::size_t I = 0; I < InputSize; ++I) {
+    const char CharVal = Computed.Input[I];
+    switch (CharVal) {
+    case '*':
+      if (I < InputSize && Computed.Input[I + 1] == '*') {
+        // completely unrestricted: replace with `.*`
+        ++I;
+        Computed.RootHandling = static_cast<RootPatternScanType>(
+            static_cast<unsigned int>(RootPatternScanType::RecursiveDirectory) |
+            static_cast<unsigned int>(Computed.RootHandling));
+        Computed.Pattern.append(RecursiveReplacement, RecursiveReplacementSize);
+        LastStarStar = I;
+      } else {
+        // regular non-path-delimited changers: `[^\\/]*
+        Computed.RootHandling = static_cast<RootPatternScanType>(
+            static_cast<unsigned int>(
+                LastStar
+                    ? (*LastStar < LastRootSeparator
+                           ? RootPatternScanType::DirectoryAndRecursiveDirectory
+                           : RootPatternScanType::Directory)
+                    : RootPatternScanType::Directory) |
+            static_cast<unsigned int>(Computed.RootHandling));
+        Computed.Pattern.append(Replacement, ReplacementSize);
+        LastStar = I;
+      }
+      break;
+    case ')':
+    case '(':
+    case '[':
+    case ']':
+    case '{':
+    case '}':
+    case '^':
+    case '$':
+    case '.':
+    case '+':
+    case '?':
+    case '|':
+      // cases where the character must be escaped
+      Computed.Pattern.push_back('\\');
+      Computed.Pattern.push_back(CharVal);
+      break;
+    case '/':
+      if (Computed.RootHandling == RootPatternScanType::None)
+        LastRootSeparator = I;
+      Computed.Pattern.append("[/\\]", 4);
+      break;
+    case '\\':
+      if (Computed.RootHandling == RootPatternScanType::None)
+        LastRootSeparator = I;
+      Computed.Pattern.append("[/\\]", 4);
+      break;
+    default:
+      Computed.Pattern.push_back(CharVal);
+      break;
+    }
+  }
+  Computed.Pattern.push_back('$');
+  Computed.PatternRoot.append(
+      Computed.Input.cbegin(),
+      Computed.Input.cbegin() +
+          LastRootSeparator.value_or(static_cast<std::size_t>(0)));
+  // If LastSeperator == 0 and the Input's size is Non-Zero Could be a directory
+  // OR a file we're relying on... could be a bit strange to work with!
+  // nevertheless, we'll treat it as a file, no reason to use `stat` and other
+  // temporary checks to try and determine whether or not something is a file
+  // versus a directory here.
+  Computed.PatternRegex = Regex(Computed.Pattern, Regex::NoFlags);
+  return Computed;
+}
+
+PatternFilter &
+InputDependencyCollection::Add(std::string Pattern, bool IsAngled,
+                               bool Exported, FileManager &FM,
+                               const std::vector<std::string> &SearchEntries,
+                               OptionalFileEntryRef LookupFrom) {
+  PatternFilters.push_back(ComputeFilter(std::move(Pattern), Exported));
+  PatternFilter &Filter = PatternFilters.back();
+  if (Filter.PatternRoot.empty() ||
+      llvm::sys::path::is_absolute(Filter.PatternRoot)) {
+    // nothing else to do since it's absolute
+    // or the PatternRoot is empty, so we can't do any
+    // pre-culling.
+    return Filter;
+  }
+  // Find a plausible search root among the entries, if possible, to anchor this
+  // to a given entry
+  auto TryDetermineSearchRoot = [&](StringRef SearchEntry) -> bool {
+    if (SearchEntry.contains(Filter.PatternRoot)) {
+      // the entry is contained within: approve the search entry as the search
+      // root
+      Filter.SearchRoot.assign(SearchEntry.begin(), SearchEntry.end());
+      return true;
+    }
+    return false;
+  };
+  if (!IsAngled && LookupFrom) {
+    // quote search; including the optional file entry as a root search location
+    // too
+    StringRef LookupDirName = LookupFrom->getDir().getName();
+    if (TryDetermineSearchRoot(LookupDirName)) {
+      return Filter;
+    }
+  }
+  for (StringRef SearchEntry : SearchEntries) {
+    if (TryDetermineSearchRoot(SearchEntry)) {
+      return Filter;
+    }
+  }
+  // if we're here, then we just need to make the SearchRoot identical to the
+  // Pattern's root.
+  Filter.SearchRoot = Filter.PatternRoot;
+  return Filter;
+}
+
+bool InputDependencyCollection::Check(StringRef Filename) const {
+  for (const auto &Filter : PatternFilters) {
+    if (Filter.Check(Filename)) {
+      return true;
+    }
+  }
+  return false;
+}
+
+} // namespace clang
diff --git a/clang/lib/Basic/ResourceSearch.cpp b/clang/lib/Basic/ResourceSearch.cpp
new file mode 100644
index 0000000000000..b9278d9b7f298
--- /dev/null
+++ b/clang/lib/Basic/ResourceSearch.cpp
@@ -0,0 +1,107 @@
+//===--- ResourceSearch.h - Searching for Resources -------------*- C++ -*-===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+//
+// User-provided filters include/exclude profile instrumentation in certain
+// functions or files.
+//
+//===----------------------------------------------------------------------===//
+
+#include "clang/Basic/ResourceSearch.h"
+#include "clang/Basic/FileManager.h"
+
+namespace clang {
+
+template <typename Strings>
+OptionalFileEntryRef LookupFileWithImpl(StringRef Filename, bool isAngled,
+                                        bool OpenFile, FileManager &FM,
+                                        const Strings &SearchEntries,
+                                        OptionalFileEntryRef LookupFromFile) {
+  if (llvm::sys::path::is_absolute(Filename)) {
+    // lookup path or immediately fail
+    llvm::Expected<FileEntryRef> ShouldBeEntry = FM.getFileRef(
+        Filename, OpenFile, /*CacheFailure=*/true, /*IsText=*/false);
+    return llvm::expectedToOptional(std::move(ShouldBeEntry));
+  }
+
+  auto SeparateComponents = [](SmallVectorImpl<char> &LookupPath,
+                               StringRef StartingFrom, StringRef FileName,
+                               bool RemoveInitialFileComponentFromLookupPath) {
+    llvm::sys::path::native(StartingFrom, LookupPath);
+    if (RemoveInitialFileComponentFromLookupPath)
+      llvm::sys::path::remove_filename(LookupPath);
+    if (!LookupPath.empty() &&
+        !llvm::sys::path::is_separator(LookupPath.back())) {
+      LookupPath.push_back(llvm::sys::path::get_separator().front());
+    }
+    LookupPath.append(FileName.begin(), FileName.end());
+  };
+
+  // Otherwise, it's search time!
+  SmallString<512> LookupPath;
+  // Non-angled lookup
+  if (!isAngled) {
+    // Use file-based lookup.
+    if (LookupFromFile) {
+      SmallString<1024> TmpDir;
+      TmpDir = LookupFromFile->getDir().getName();
+      llvm::sys::path::append(TmpDir, Filename);
+      if (!TmpDir.empty()) {
+        llvm::Expected<FileEntryRef> ShouldBeEntry = FM.getFileRef(
+            TmpDir, OpenFile, /*CacheFailure=*/true, /*IsText=*/false);
+        if (ShouldBeEntry)
+          return llvm::expectedToOptional(std::move(ShouldBeEntry));
+        llvm::consumeError(ShouldBeEntry.takeError());
+      }
+    }
+
+    // Otherwise, do working directory lookup.
+    LookupPath.clear();
+    auto MaybeWorkingDirEntry = FM.getDirectoryRef(".");
+    if (MaybeWorkingDirEntry) {
+      DirectoryEntryRef WorkingDirEntry = *MaybeWorkingDirEntry;
+      StringRef WorkingDir = WorkingDirEntry.getName();
+      if (!WorkingDir.empty()) {
+        SeparateComponents(LookupPath, WorkingDir, Filename, false);
+        llvm::Expected<FileEntryRef> ShouldBeEntry = FM.getFileRef(
+            LookupPath, OpenFile, /*CacheFailure=*/true, /*IsText=*/false);
+        if (ShouldBeEntry)
+          return llvm::expectedToOptional(std::move(ShouldBeEntry));
+        llvm::consumeError(ShouldBeEntry.takeError());
+      }
+    }
+  }
+
+  for (const auto &Entry : SearchEntries) {
+    LookupPath.clear();
+    SeparateComponents(LookupPath, Entry, Filename, false);
+    llvm::Expected<FileEntryRef> ShouldBeEntry = FM.getFileRef(
+        LookupPath, OpenFile, /*CacheFailure=*/true, /*IsText=*/false);
+    if (ShouldBeEntry)
+      return llvm::expectedToOptional(std::move(ShouldBeEntry));
+    llvm::consumeError(ShouldBeEntry.takeError());
+  }
+  return std::nullopt;
+}
+
+OptionalFileEntryRef
+LookupFileWithStdVec(StringRef Filename, bool isAngled, bool OpenFile,
+                     FileManager &FM,
+                     const std::vector<std::string> &SearchEntries,
+                     OptionalFileEntryRef LookupFromFile) {
+  return LookupFileWithImpl(Filename, isAngled, OpenFile, FM, SearchEntries,
+                            LookupFromFile);
+}
+
+OptionalFileEntryRef LookupFileWith(StringRef Filename, bool isAngled,
+                                    bool OpenFile, FileManager &FM,
+                                    ArrayRef<StringRef> SearchEntries,
+                                    OptionalFileEntryRef LookupFromFile) {
+  return LookupFileWithImpl(Filename, isAngled, OpenFile, FM, SearchEntries,
+                            LookupFromFile);
+}
+} // namespace clang
diff --git a/clang/lib/Frontend/ASTUnit.cpp b/clang/lib/Frontend/ASTUnit.cpp
index 05ae1f348f920..450e44796cd6d 100644
--- a/clang/lib/Frontend/ASTUnit.cpp
+++ b/clang/lib/Frontend/ASTUnit.cpp
@@ -770,12 +770,13 @@ std::unique_ptr<ASTUnit> ASTUnit::LoadFromASTFile(
       /*IILookup=*/nullptr,
       /*OwnsHeaderSearch=*/false);
 
-  if (ToLoad >= LoadASTOnly)
+  if (ToLoad >= LoadASTOnly) {
     AST->Ctx = llvm::makeIntrusiveRefCnt<ASTContext>(
         *AST->LangOpts, AST->getSourceManager(), AST->PP->getIdentifierTable(),
         AST->PP->getSelectorTable(), AST->PP->getBuiltinInfo(),
         AST->getTranslationUnitKind());
-
+    AST->Ctx->InputDependencyPatterns = AST->PP->InputDependencyPatterns;
+  }
   DisableValidationForModuleKind disableValid =
       DisableValidationForModuleKind::None;
   if (::getenv("LIBCLANG_DISABLE_PCH_VALIDATION"))
@@ -811,6 +812,9 @@ std::unique_ptr<ASTUnit> ASTUnit::LoadFromASTFile(
     // Initialize the ASTContext
     AST->Ctx->InitBuiltinTypes(*AST->Target);
 
+    // Set preprocessor options
+    AST->Ctx->setCurrentPreprocessorOptions(AST->PP->getPreprocessorOpts());
+
     // Adjust printing policy based on language options.
     AST->Ctx->setPrintingPolicy(PrintingPolicy(*AST->LangOpts));
 
diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp
index 0b00ad7128c00..e86c7e18e0172 100644
--- a/clang/lib/Frontend/CompilerInstance.cpp
+++ b/clang/lib/Frontend/CompilerInstance.cpp
@@ -556,6 +556,8 @@ void CompilerInstance::createASTContext() {
       getLangOpts(), PP.getSourceManager(), PP.getIdentifierTable(),
       PP.getSelectorTable(), PP.getBuiltinInfo(), PP.TUKind);
   Context->InitBuiltinTypes(getTarget(), getAuxTarget());
+  Context->setCurrentPreprocessorOptions(PP.getPreprocessorOpts());
+  Context->InputDependencyPatterns = PP.InputDependencyPatterns;
   setASTContext(std::move(Context));
 }
 
diff --git a/clang/lib/Frontend/DependencyFile.cpp b/clang/lib/Frontend/DependencyFile.cpp
index d56e17f14e9bc..5c2d5b794ed49 100644
--- a/clang/lib/Frontend/DependencyFile.cpp
+++ b/clang/lib/Frontend/DependencyFile.cpp
@@ -12,6 +12,7 @@
 
 #include "clang/Basic/DiagnosticFrontend.h"
 #include "clang/Basic/FileManager.h"
+#include "clang/Basic/InputDependencyCollection.h"
 #include "clang/Basic/SourceManager.h"
 #include "clang/Frontend/DependencyOutputOptions.h"
 #include "clang/Frontend/Utils.h"
@@ -105,6 +106,90 @@ struct DepCollectorPPCallbacks : public PPCallbacks {
     // Files that actually exist are handled by FileChanged.
   }
 
+  enum IsRecursive : bool {
+    Flat = false,
+    Recursive = true
+  };
+
+  static inline void DoSearch(FileManager& FM, const PatternFilter& Filter, DependencyCollector& DepCollector, StringRef Dir, IsRecursive Recurse) {
+    std::error_code EC;
+    for (llvm::vfs::directory_iterator FileIt = FM.getVirtualFileSystem().dir_begin(Dir, EC), FileEnd = {};
+          FileIt != FileEnd && !EC; FileIt.increment(EC)) {
+      const auto &File = *FileIt;
+      switch (File.type()) {
+      case llvm::sys::fs::file_type::directory_file: {
+        if (Recurse) {
+          DoSearch(FM, Filter, DepCollector, File.path(), Recurse);
+        }
+        break;
+      }
+      case llvm::sys::fs::file_type::regular_file: {
+        StringRef Filename = File.path();
+        if (Filter.Check(Filename)) {
+          DepCollector.maybeAddDependency(Filename,
+                                          /*FromModule*/ false,
+                                          /*IsSystem*/ false,
+                                          /*IsModuleFile*/ false,
+                                          /*IsMissing*/ false);
+        }
+        break;
+      }
+      default:
+        // do nothing
+        break;
+      }
+    }
+  }
+
+  void DependDirective(SourceLocation HashLoc, const Token &DependTok,
+                       StringRef Pattern, bool IsAngled,
+                       const PatternFilter &Filter,
+                       OptionalFileEntryRef CurrentFile) override {
+    if (Pattern.empty())
+      return;
+    FileManager& FM = PP.getFileManager();
+    llvm::vfs::FileSystem& VFS = FM.getVirtualFileSystem();
+    if (Filter.SearchRoot.empty()) {
+      // nothing we can do for ourselves here, just check the file directly and
+      // leave
+      if (Filter.RootHandling == RootPatternScanType::None) {
+        // it's either a directory or a file; add the dependency as-is
+        DepCollector.maybeAddDependency(Filter.Input,
+                                        /*FromModule*/ false,
+                                        /*IsSystem*/ false,
+                                        /*IsModuleFile*/ false,
+                                        /*IsMissing*/ !VFS.exists(Filter.Pattern));
+        return;
+      }
+      // if there's no search root, simply search from the current file's
+      // working directory (if it's quoted)
+      if (!IsAngled && CurrentFile) {
+        StringRef CurrentDir = CurrentFile->getDir().getName();
+        DoSearch(FM, Filter, DepCollector, CurrentDir, Filter.RootHandling == RootPatternScanType::Directory ? Flat : Recursive);
+      }
+      return;
+    }
+    // Otherwise, it's not empty. Note that we pre-computed the roots according
+    // to the compiler driver's resource/embed directory arguments previously,
+    // so we just need to do a singular check-if-exists-and-fire here.
+    if (Filter.RootHandling == RootPatternScanType::None) {
+      // treat as a single file, do a lookup and mark it for approval.
+      if (VFS.exists(Filter.Pattern)) {
+        // If it exists, it's what the user meant.
+        DepCollector.maybeAddDependency(Filter.Pattern,
+                                        /*FromModule*/ false,
+                                        /*IsSystem*/ false,
+                                        /*IsModuleFile*/ false,
+                                        /*IsMissing*/ false);
+      }
+    } else {
+      if (VFS.exists(Filter.PatternRoot)) {
+        DoSearch(FM, Filter, DepCollector, Filter.PatternRoot,
+          Filter.RootHandling == RootPatternScanType::Directory ? Flat : Recursive);
+      }
+    }
+  }
+
   void HasEmbed(SourceLocation, StringRef, bool,
                 OptionalFileEntryRef File) override {
     if (!File)
@@ -168,8 +253,8 @@ struct DepCollectorASTListener : public ASTReaderListener {
                                     /*IsDirectModuleImport*/ DirectlyImported,
                                     /*IsMissing*/ false);
   }
-  bool visitInputFile(StringRef Filename, bool IsSystem,
-                      bool IsOverridden, bool IsExplicitModule) override {
+  bool visitInputFile(StringRef Filename, bool IsSystem, bool IsOverridden,
+                      bool IsExplicitModule) override {
     if (IsOverridden || IsExplicitModule)
       return true;
 
@@ -228,7 +313,7 @@ bool DependencyCollector::sawDependency(StringRef Filename, bool FromModule,
          (needSystemDependencies() || !IsSystem);
 }
 
-DependencyCollector::~DependencyCollector() { }
+DependencyCollector::~DependencyCollector() {}
 void DependencyCollector::attachToPreprocessor(Preprocessor &PP) {
   PP.addPPCallbacks(std::make_unique<DepCollectorPPCallbacks>(*this, PP));
   PP.getHeaderSearchInfo().getModuleMap().addModuleMapCallbacks(
diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp
index be2878076510d..f456430cb95bf 100644
--- a/clang/lib/Lex/PPDirectives.cpp
+++ b/clang/lib/Lex/PPDirectives.cpp
@@ -19,6 +19,7 @@
 #include "clang/Basic/IdentifierTable.h"
 #include "clang/Basic/LangOptions.h"
 #include "clang/Basic/Module.h"
+#include "clang/Basic/ResourceSearch.h"
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Basic/SourceManager.h"
 #include "clang/Basic/TargetInfo.h"
@@ -1193,72 +1194,8 @@ OptionalFileEntryRef Preprocessor::LookupEmbedFile(StringRef Filename,
                                                    bool isAngled,
                                                    bool OpenFile) {
   FileManager &FM = this->getFileManager();
-  if (llvm::sys::path::is_absolute(Filename)) {
-    // lookup path or immediately fail
-    llvm::Expected<FileEntryRef> ShouldBeEntry = FM.getFileRef(
-        Filename, OpenFile, /*CacheFailure=*/true, /*IsText=*/false);
-    return llvm::expectedToOptional(std::move(ShouldBeEntry));
-  }
-
-  auto SeparateComponents = [](SmallVectorImpl<char> &LookupPath,
-                               StringRef StartingFrom, StringRef FileName,
-                               bool RemoveInitialFileComponentFromLookupPath) {
-    llvm::sys::path::native(StartingFrom, LookupPath);
-    if (RemoveInitialFileComponentFromLookupPath)
-      llvm::sys::path::remove_filename(LookupPath);
-    if (!LookupPath.empty() &&
-        !llvm::sys::path::is_separator(LookupPath.back())) {
-      LookupPath.push_back(llvm::sys::path::get_separator().front());
-    }
-    LookupPath.append(FileName.begin(), FileName.end());
-  };
-
-  // Otherwise, it's search time!
-  SmallString<512> LookupPath;
-  // Non-angled lookup
-  if (!isAngled) {
-    OptionalFileEntryRef LookupFromFile = getCurrentFileLexer()->getFileEntry();
-    if (LookupFromFile) {
-      // Use file-based lookup.
-      SmallString<1024> TmpDir;
-      TmpDir = LookupFromFile->getDir().getName();
-      llvm::sys::path::append(TmpDir, Filename);
-      if (!TmpDir.empty()) {
-        llvm::Expected<FileEntryRef> ShouldBeEntry = FM.getFileRef(
-            TmpDir, OpenFile, /*CacheFailure=*/true, /*IsText=*/false);
-        if (ShouldBeEntry)
-          return llvm::expectedToOptional(std::move(ShouldBeEntry));
-        llvm::consumeError(ShouldBeEntry.takeError());
-      }
-    }
-
-    // Otherwise, do working directory lookup.
-    LookupPath.clear();
-    auto MaybeWorkingDirEntry = FM.getDirectoryRef(".");
-    if (MaybeWorkingDirEntry) {
-      DirectoryEntryRef WorkingDirEntry = *MaybeWorkingDirEntry;
-      StringRef WorkingDir = WorkingDirEntry.getName();
-      if (!WorkingDir.empty()) {
-        SeparateComponents(LookupPath, WorkingDir, Filename, false);
-        llvm::Expected<FileEntryRef> ShouldBeEntry = FM.getFileRef(
-            LookupPath, OpenFile, /*CacheFailure=*/true, /*IsText=*/false);
-        if (ShouldBeEntry)
-          return llvm::expectedToOptional(std::move(ShouldBeEntry));
-        llvm::consumeError(ShouldBeEntry.takeError());
-      }
-    }
-  }
-
-  for (const auto &Entry : PPOpts.EmbedEntries) {
-    LookupPath.clear();
-    SeparateComponents(LookupPath, Entry, Filename, false);
-    llvm::Expected<FileEntryRef> ShouldBeEntry = FM.getFileRef(
-        LookupPath, OpenFile, /*CacheFailure=*/true, /*IsText=*/false);
-    if (ShouldBeEntry)
-      return llvm::expectedToOptional(std::move(ShouldBeEntry));
-    llvm::consumeError(ShouldBeEntry.takeError());
-  }
-  return std::nullopt;
+  OptionalFileEntryRef LookupFromFileHere = getCurrentFileLexer()->getFileEntry();
+  return LookupFileWithStdVec(Filename, isAngled, OpenFile, FM, PPOpts.EmbedEntries, LookupFromFileHere);
 }
 
 //===----------------------------------------------------------------------===//
@@ -1359,6 +1296,7 @@ void Preprocessor::HandleDirective(Token &Result) {
       case tok::pp___include_macros:
       case tok::pp_pragma:
       case tok::pp_embed:
+      case tok::pp_depend:
       case tok::pp_module:
       case tok::pp___preprocessed_module:
       case tok::pp___preprocessed_import:
@@ -1493,6 +1431,8 @@ void Preprocessor::HandleDirective(Token &Result) {
       return HandleIdentSCCSDirective(Result);
     case tok::pp_embed:
       return HandleEmbedDirective(Introducer.getLocation(), Result);
+    case tok::pp_depend:
+      return HandleDependDirective(Introducer.getLocation(), Result);
     case tok::pp_assert:
       //isExtension = true;  // FIXME: implement #assert
       break;
@@ -4195,6 +4135,62 @@ void Preprocessor::HandleEmbedDirective(SourceLocation HashLoc,
   HandleEmbedDirectiveImpl(HashLoc, *Params, BinaryContents, FilenameToGo);
 }
 
+void Preprocessor::HandleDependDirective(SourceLocation HashLoc,
+                                       Token &DependTok) {
+  // Give the usual extension/compatibility warnings.
+  Diag(DependTok, diag::ext_pp_depend_directive)
+        << /*Clang*/ 1;
+  // It's always a clang extension: it will become a C++2c extension after
+  // more WG21 work later. Remember to come back and tweak this!
+
+  // this unfortunately has no meaning but it's part of the grammar for the future so we should parse it normally
+  bool IsExported = false;
+  Token PatternTok;
+  Lex(PatternTok);
+  if (PatternTok.is(tok::kw_export)) {
+      IsExported = true;
+  }
+
+  // Parse the pattern header-name, with a potential first skip
+  if (LexHeaderName(PatternTok, true, !IsExported)) {
+    return;
+  }
+
+  if (PatternTok.isNot(tok::header_name)) {
+    Diag(PatternTok.getLocation(), diag::err_pp_expects_pattern);
+    if (PatternTok.isNot(tok::eod))
+      DiscardUntilEndOfDirective();
+    return;
+  }
+
+  Token EoDTok;
+  LexNonComment(EoDTok);
+  if (!EoDTok.isNot(tok::eod) && !EoDTok.isNot(tok::eof)) {
+    Diag(PatternTok.getLocation(), diag::err_pp_expected_eol);
+    DiscardUntilEndOfDirective();
+    return;
+  }
+  
+  
+  SmallString<256> PatternBuffer;
+  StringRef Pattern = getSpelling(PatternTok, PatternBuffer);
+  bool IsAngled =
+      GetIncludeFilenameSpelling(PatternTok.getLocation(), Pattern);
+  // Every pattern is local to where it was found, so prepend the current
+  // directory of the file if it's a non-absolute path from the perspective of
+  // this current header file
+  OptionalFileEntryRef CurrentFile = std::nullopt;
+  if (IsFileLexer()) {
+    PreprocessorLexer *ThisFileLexer = getCurrentFileLexer();
+    FileID ThisFID = ThisFileLexer->getFileID();
+    CurrentFile = SourceMgr.getFileEntryRefForID(ThisFID);
+  }
+  const PatternFilter& Filter
+    = InputDependencyPatterns->Add(Pattern.str(), IsAngled, IsExported, getFileManager(), PPOpts.EmbedEntries, CurrentFile);
+  if (Callbacks)
+    Callbacks->DependDirective(HashLoc, DependTok, Pattern, IsAngled, Filter, CurrentFile);
+}
+
 /// HandleCXXImportDirective - Handle the C++ modules import directives
 ///
 /// pp-import:
diff --git a/clang/lib/Lex/Preprocessor.cpp b/clang/lib/Lex/Preprocessor.cpp
index c430da67c1469..8f17af97f551b 100644
--- a/clang/lib/Lex/Preprocessor.cpp
+++ b/clang/lib/Lex/Preprocessor.cpp
@@ -1090,18 +1090,20 @@ void Preprocessor::LexTokensUntilEOF(std::vector<Token> *Tokens) {
 ///        token is a '<').
 /// \return \c true if we reached EOD or EOF while looking for a > token in
 ///         a concatenated header name and diagnosed it. \c false otherwise.
-bool Preprocessor::LexHeaderName(Token &FilenameTok, bool AllowMacroExpansion) {
+bool Preprocessor::LexHeaderName(Token &FilenameTok, bool AllowMacroExpansion, bool SkipFirst) {
   // Lex using header-name tokenization rules if tokens are being lexed from
   // a file. Just grab a token normally if we're in a macro expansion.
-  if (CurPPLexer) {
-    // Avoid nested header-name lexing when macro expansion recurses
-    // __has_include(__has_include))
-    if (CurPPLexer->ParsingFilename)
-      LexUnexpandedToken(FilenameTok);
-    else
-      CurPPLexer->LexIncludeFilename(FilenameTok);
-  } else {
-    Lex(FilenameTok);
+  if (!SkipFirst) {
+    if (CurPPLexer) {
+      // Avoid nested header-name lexing when macro expansion recurses
+      // __has_include(__has_include))
+      if (CurPPLexer->ParsingFilename)
+        LexUnexpandedToken(FilenameTok);
+      else
+        CurPPLexer->LexIncludeFilename(FilenameTok);
+    } else {
+      Lex(FilenameTok);
+    }
   }
 
   // This could be a <foo/bar.h> file coming from a macro expansion.  In this
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index b2288ff9b26d0..7a4f56aaeb40b 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -3852,6 +3852,13 @@ Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, unsigned BuiltinID,
     if (BuiltinCountedByRef(TheCall))
       return ExprError();
     break;
+  case Builtin::BI__builtin_std_embed:
+    // while we do not have Custom Typechecking,
+    // we have a `...` signature, so we do need to
+    // at least gently inspect some of the arguments
+    if (BuiltinStdEmbed(TheCall))
+      return ExprError();
+    break;
   }
 
   if (getLangOpts().HLSL && HLSL().CheckBuiltinFunctionCall(BuiltinID, TheCall))
@@ -6768,6 +6775,150 @@ bool Sema::BuiltinCountedByRef(CallExpr *TheCall) {
   return false;
 }
 
+bool Sema::BuiltinStdEmbed(CallExpr *TheCall) {
+  const bool HasProperArgCount = !checkArgCountAtLeast(TheCall, 5);
+  const bool HasExtraLimitArg = !checkArgCountAtMost(TheCall, 6) && TheCall->getNumArgs() == 6;
+  if (!HasProperArgCount && !HasExtraLimitArg)
+    return true;
+
+  const Expr *SizeRef = TheCall->getArg(0);
+  const Expr *PtrRef = TheCall->getArg(1);
+  const unsigned int ResourceNameSizeIndex = 2;
+  const Expr *ResourceNameSize = TheCall->getArg(ResourceNameSizeIndex);
+  const unsigned int ResourceNamePtrIndex = 3;
+  const Expr *ResourceNamePtr = TheCall->getArg(ResourceNamePtrIndex);
+  const unsigned int OffsetIndex = 4;
+  const Expr *Offset = TheCall->getArg(OffsetIndex);
+  const unsigned int LimitIndex = 5;
+  const Expr *Limit = HasExtraLimitArg ? TheCall->getArg(LimitIndex) : nullptr;
+
+  // Size argument type
+  QualType SizeRefTy = SizeRef->getType();
+  if ((!SizeRefTy->isIntegralOrUnscopedEnumerationType())
+      || SizeRefTy.isConstant(Context)
+      || !SizeRef->isLValue()) {
+    Diag(TheCall->getBeginLoc(), diag::err_invalid_builtin_argument)
+      << SizeRef << "__builtin_std_embed"
+      << SizeRef->getSourceRange();
+    return true;
+  }
+
+  // value pointer, has to be non-constant (but pointer to `const`).
+  // tells us what the type for the builtin return is, serves no other purpose.
+  QualType PtrRefTy = PtrRef->getType();
+  if (!PtrRefTy->isPointerType()) {
+    Diag(TheCall->getBeginLoc(), diag::err_invalid_builtin_argument)
+      << PtrRefTy << "__builtin_std_embed"
+      << PtrRef->getSourceRange();
+    return true;
+  }
+  QualType ArrElementTy = PtrRefTy->getPointeeType();
+  if (!ArrElementTy.isConstant(Context)) {
+    Diag(TheCall->getBeginLoc(), diag::err_invalid_builtin_argument)
+      << PtrRef << "__builtin_std_embed"
+      << PtrRef->getSourceRange();
+    return true;
+  }
+
+  const uint64_t CharSize = Context.getCharWidth();
+  if (!(ArrElementTy->isIntegralOrEnumerationType()
+        && Context.getTypeSize(ArrElementTy) == CharSize
+        && Context.getTypeAlign(ArrElementTy) == CharSize)) {
+    Diag(TheCall->getBeginLoc(), diag::err_invalid_builtin_argument)
+      << PtrRef << "__builtin_std_embed"
+      << PtrRef->getSourceRange();
+    return true;
+  }
+
+  // Next argument is size of the string
+  const QualType SizeType = Context.getSizeType();
+  QualType ResourceNameSizeTy = ResourceNameSize->getType();
+  if (!ResourceNameSizeTy->isIntegralOrEnumerationType()) {
+    Expr *ResourceNameSizeMutable = const_cast<Expr *>(ResourceNameSize);
+    ExprResult ImplicitResourceNameSizeFixupResult = PerformImplicitConversion(ResourceNameSizeMutable, SizeType, AssignmentAction::Passing);
+    if (!ImplicitResourceNameSizeFixupResult.isUsable()) {
+      Diag(TheCall->getBeginLoc(), diag::err_typecheck_converted_constant_expression)
+        << ResourceNameSizeTy << SizeType;
+      return true;
+    }
+    // The implicit conversion worked -- adjust the builtin's argument.
+    TheCall->setArg(ResourceNameSizeIndex, ImplicitResourceNameSizeFixupResult.get());
+  }
+
+  // Pointer to an appropriate string type
+  // (char, wchar_t, or char8_t)
+  QualType ResourceNamePtrTy = ResourceNamePtr->getType();
+  if (!ResourceNamePtrTy->isPointerType()) {
+    const QualType AllowedTypes[3] = {
+      Context.getPointerType(Context.CharTy),
+      Context.getPointerType(Context.WCharTy),
+      Context.getPointerType(Context.Char8Ty)
+    };
+    Expr *ResourceNamePtrMutable =  const_cast<Expr *>(ResourceNamePtr);
+    ExprResult ImplicitResourceNamePtrFixupResult;
+    for (const QualType& DesiredType : AllowedTypes) {
+      ImplicitResourceNamePtrFixupResult = PerformImplicitConversion(ResourceNamePtrMutable, DesiredType, AssignmentAction::Passing);
+      if (ImplicitResourceNamePtrFixupResult.isUsable()) {
+        break;
+      }
+    }
+    if (!ImplicitResourceNamePtrFixupResult.isUsable()) {
+      Diag(ResourceNamePtr->getBeginLoc(), diag::err_typecheck_converted_constant_expression)
+         << ResourceNamePtrTy << "a pointer to char, wchar_t, or char8_t";
+      return true;
+    }
+    TheCall->setArg(ResourceNamePtrIndex, ImplicitResourceNamePtrFixupResult.get());
+    ResourceNamePtr = TheCall->getArg(ResourceNamePtrIndex);
+    ResourceNamePtrTy = ResourceNamePtr->getType();
+  }
+  QualType ResourceNameCharTy(ResourceNamePtrTy->getPointeeOrArrayElementType(), 0);
+  if (!ResourceNameCharTy->isCharType()
+      && !ResourceNameCharTy->isChar8Type()
+      && !ResourceNameCharTy->isWideCharType()) {
+      Diag(ResourceNamePtr->getBeginLoc(), diag::err_typecheck_convert_incompatible_pointer)
+        << 1 << 1 << 1 << 0;
+      return true;
+    
+  }
+
+  // Check the integer-convertible argument is offset
+  QualType OffsetTy = Offset->getType();
+  if (!OffsetTy->isIntegralOrEnumerationType()) {
+    Expr *OffsetMutable =  const_cast<Expr *>(Offset);
+    ExprResult ImplicitOffsetFixupResult = PerformImplicitConversion(OffsetMutable, SizeType, AssignmentAction::Passing);
+    if (!ImplicitOffsetFixupResult.isUsable()) {
+      Diag(TheCall->getBeginLoc(), diag::err_typecheck_converted_constant_expression)
+        << ResourceNameSizeTy << SizeType;
+      return true;
+    }
+    // The implicit conversion worked -- adjust the builtin's argument.
+    TheCall->setArg(OffsetIndex, ImplicitOffsetFixupResult.get());
+  }
+
+  if (HasExtraLimitArg) {
+    // If present, final argument is offset
+    QualType LimitTy = Limit->getType();
+    if (!LimitTy->isIntegralOrEnumerationType()) {
+      Expr *LimitMutable =  const_cast<Expr *>(Limit);
+      ExprResult ImplicitLimitFixupResult = PerformImplicitConversion(LimitMutable, SizeType, AssignmentAction::Passing);
+      if (!ImplicitLimitFixupResult.isUsable()) {
+        Diag(TheCall->getBeginLoc(), diag::err_typecheck_converted_constant_expression)
+        << ResourceNameSizeTy << SizeType;
+        return true;
+      }
+      // The implicit conversion worked -- adjust the builtin's argument.
+      TheCall->setArg(LimitIndex, ImplicitLimitFixupResult.get());
+    }
+  }
+
+  // return the same type as was put in; we don't actually do anything with
+  // the pointer-reference type other than to use it for
+  // proper typesetting.
+  TheCall->setType(PtrRefTy);
+
+  return false;
+}
+
 /// The result of __builtin_counted_by_ref cannot be assigned to a variable.
 /// It allows leaking and modification of bounds safety information.
 bool Sema::CheckInvalidBuiltinCountedByRef(const Expr *E,
diff --git a/clang/tools/clang-import-test/clang-import-test.cpp b/clang/tools/clang-import-test/clang-import-test.cpp
index 8e83687d3e96a..2234f44c0611a 100644
--- a/clang/tools/clang-import-test/clang-import-test.cpp
+++ b/clang/tools/clang-import-test/clang-import-test.cpp
@@ -229,6 +229,8 @@ BuildASTContext(CompilerInstance &CI, SelectorTable &ST, Builtin::Context &BC) {
       CI.getLangOpts(), CI.getSourceManager(),
       PP.getIdentifierTable(), ST, BC, PP.TUKind);
   AST->InitBuiltinTypes(CI.getTarget());
+  AST->setCurrentPreprocessorOptions(PP.getPreprocessorOpts());
+  AST->InputDependencyPatterns = PP.InputDependencyPatterns;
   return AST;
 }
 
diff --git a/clang/unittests/Lex/PPCallbacksTest.cpp b/clang/unittests/Lex/PPCallbacksTest.cpp
index 9533fbc776e6e..f3b89db0be8c1 100644
--- a/clang/unittests/Lex/PPCallbacksTest.cpp
+++ b/clang/unittests/Lex/PPCallbacksTest.cpp
@@ -311,6 +311,7 @@ class PPCallbacksTest : public ::testing::Test {
     ASTContext Context(OpenCLLangOpts, SourceMgr, PP.getIdentifierTable(),
                        PP.getSelectorTable(), PP.getBuiltinInfo(), PP.TUKind);
     Context.InitBuiltinTypes(*Target);
+    Context.setCurrentPreprocessorOptions(PP.getPreprocessorOpts());
 
     ASTConsumer Consumer;
     Sema S(PP, Context, Consumer);
diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt
index 53165f0336b2d..c86b6e5288d7c 100644
--- a/libcxx/include/CMakeLists.txt
+++ b/libcxx/include/CMakeLists.txt
@@ -1007,6 +1007,7 @@ set(files
   cwchar
   cwctype
   deque
+  embed
   errno.h
   exception
   execution
diff --git a/libcxx/include/embed b/libcxx/include/embed
new file mode 100644
index 0000000000000..e434433ff5b11
--- /dev/null
+++ b/libcxx/include/embed
@@ -0,0 +1,113 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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_EMBED
+#define _LIBCPP_EMBED
+
+/*
+    embed synopsis
+
+namespace std {
+
+  template <typename T>
+consteval span<const T> embed(string_view resource_idenfier,
+  size_t offset = 0,
+  optional<size_t> limit = nullopt);
+
+  template <typename T>
+consteval span<const T> embed(wstring_view resource_idenfier,
+  size_t offset = 0,
+  optional<size_t> limit = nullopt);
+
+  template <typename T>
+consteval span<const T> embed(u8string_view resource_idenfier,
+  size_t offset = 0,
+  optional<size_t> limit = nullopt);
+
+} // namespace std
+
+*/
+
+#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
+#  include <__cxx03/__config>
+#else
+#  include <__config>
+#  include <__cstddef/byte.h>
+#  include <__type_traits/is_enum.h>
+#  include <__type_traits/is_integral.h>
+#  include <__type_traits/is_same.h>
+#  include <optional>
+#  include <span>
+#  include <string_view>
+#  include <version>
+
+#  if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#    pragma GCC system_header
+#  endif
+
+_LIBCPP_PUSH_MACROS
+#  include <__undef_macros>
+
+#  if !defined(_LIBCPP_HAS_EMBED)
+#    if __has_builtin(__builtin_std_embed)
+#      define _LIBCPP_HAS_EMBED 1
+#    else
+#      define _LIBCPP_HAS_EMBED 0
+#    endif
+#  endif
+
+#  if _LIBCPP_HAS_EMBED != 0
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+namespace __embed_detail {
+template <typename _Byte, typename _StrView>
+consteval span<const _Byte>
+__embed(const _StrView& __resource_identifier, size_t __offset = 0, optional<size_t> __limit = nullopt) {
+  static_assert(sizeof(_Byte) == 1 && alignof(_Byte) == 1 && (is_integral<_Byte>::value || is_enum<_Byte>::value),
+                "embed data type must be a character type with a size and alignment of 1");
+  size_t __size      = 0;
+  _Byte const* __ptr = nullptr;
+  if (__limit) {
+    __ptr = __builtin_std_embed(
+        __size, __ptr, __resource_identifier.size(), __resource_identifier.data(), __offset, *__limit);
+  } else {
+    __ptr = __builtin_std_embed(__size, __ptr, __resource_identifier.size(), __resource_identifier.data(), __offset);
+  }
+  return span<const _Byte>(__ptr, __size);
+}
+} // namespace __embed_detail
+
+template <typename _Byte>
+consteval span<const _Byte>
+embed(string_view __resource_identifier, size_t __offset = 0, optional<size_t> __limit = nullopt) {
+  return __embed_detail::__embed<_Byte>(__resource_identifier, __offset, __limit);
+}
+
+template <typename _Byte>
+consteval span<const _Byte>
+embed(wstring_view __resource_identifier, size_t __offset = 0, optional<size_t> __limit = nullopt) {
+  return __embed_detail::__embed<_Byte>(__resource_identifier, __offset, __limit);
+}
+
+template <typename _Byte>
+consteval span<const _Byte>
+embed(u8string_view __resource_identifier, size_t __offset = 0, optional<size_t> __limit = nullopt) {
+  return __embed_detail::__embed<_Byte>(__resource_identifier, __offset, __limit);
+}
+
+_LIBCPP_END_NAMESPACE_STD
+
+#  endif
+
+_LIBCPP_POP_MACROS
+
+#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
+
+#endif // _LIBCPP_EMBED
diff --git a/libcxx/include/version b/libcxx/include/version
index 395330df7f237..c217851e9ea6d 100644
--- a/libcxx/include/version
+++ b/libcxx/include/version
@@ -632,6 +632,13 @@ __cpp_lib_void_t                                        201411L <type_traits>
 # define __cpp_lib_variant                              202306L
 #endif
 
+#if _LIBCPP_STD_VER >= 23
+# if __has_builtin(__builtin_std_embed) || (defined(_LIBCPP_HAS_EMBED) && (_LIBCPP_HAS_EMBED != 0))
+#   define __cpp_lib_embed                                 202607L
+# endif
+#endif
+
+
 #endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
 
 // clang-format on

>From 53096a89a39375968a02cf35ae53ca5bdbbfb400 Mon Sep 17 00:00:00 2001
From: ThePhD <phdofthehouse at gmail.com>
Date: Wed, 8 Apr 2026 02:51:04 -0400
Subject: [PATCH 2/7] =?UTF-8?q?[Clang][Lex][Sema]=20=F0=9F=8E=A8=20Change?=
 =?UTF-8?q?=20how=20the=20builtin=20returns=20information=20by=20adding=20?=
 =?UTF-8?q?a=20new=20first=20argument?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

- [libcxx] 🎨 add a proper C++29 / __cplusplus-based version macro (embed is still 1 because even -std=c++2c does not change the value much higher)
---
 clang/docs/LanguageExtensions.rst             |   76 +
 clang/include/clang/Basic/Builtins.td         |    2 +-
 clang/lib/AST/ExprConstant.cpp                |   78 +-
 clang/lib/Sema/SemaChecking.cpp               |   46 +-
 libcxx/docs/FeatureTestMacroTable.rst         |    4 +
 libcxx/include/__configuration/language.h     |    6 +-
 libcxx/include/embed                          |  120 +-
 libcxx/include/version                        |    8 +-
 .../algorithm.version.compile.pass.cpp        |  108 +-
 .../any.version.compile.pass.cpp              |   13 +-
 .../array.version.compile.pass.cpp            |   40 +-
 .../atomic.version.compile.pass.cpp           |   94 +-
 .../barrier.version.compile.pass.cpp          |   19 +-
 .../bit.version.compile.pass.cpp              |   41 +-
 .../bitset.version.compile.pass.cpp           |   20 +-
 .../charconv.version.compile.pass.cpp         |   26 +-
 .../chrono.version.compile.pass.cpp           |   20 +-
 .../cmath.version.compile.pass.cpp            |   46 +-
 .../compare.version.compile.pass.cpp          |   13 +-
 .../complex.version.compile.pass.cpp          |   20 +-
 .../concepts.version.compile.pass.cpp         |   13 +-
 .../coroutine.version.compile.pass.cpp        |   13 +-
 .../cstddef.version.compile.pass.cpp          |   13 +-
 .../cstdlib.version.compile.pass.cpp          |   19 +-
 .../cstring.version.compile.pass.cpp          |   19 +-
 .../deque.version.compile.pass.cpp            |   47 +-
 .../embed.version.compile.pass.cpp            |   68 +
 .../exception.version.compile.pass.cpp        |   13 +-
 .../execution.version.compile.pass.cpp        |   32 +-
 .../expected.version.compile.pass.cpp         |   33 +-
 .../filesystem.version.compile.pass.cpp       |   45 +-
 .../flat_map.version.compile.pass.cpp         |   20 +-
 .../flat_set.version.compile.pass.cpp         |   20 +-
 .../format.version.compile.pass.cpp           |   33 +-
 .../forward_list.version.compile.pass.cpp     |   68 +-
 .../fstream.version.compile.pass.cpp          |   19 +-
 .../functional.version.compile.pass.cpp       |  136 +-
 .../iomanip.version.compile.pass.cpp          |   19 +-
 .../ios.version.compile.pass.cpp              |   13 +-
 .../istream.version.compile.pass.cpp          |   19 +-
 .../iterator.version.compile.pass.cpp         |   62 +-
 .../latch.version.compile.pass.cpp            |   19 +-
 .../limits.version.compile.pass.cpp           |   19 +-
 .../list.version.compile.pass.cpp             |   68 +-
 .../locale.version.compile.pass.cpp           |   19 +-
 .../map.version.compile.pass.cpp              |   94 +-
 .../mdspan.version.compile.pass.cpp           |   46 +-
 .../memory.version.compile.pass.cpp           |  145 +-
 .../memory_resource.version.compile.pass.cpp  |   32 +-
 .../mutex.version.compile.pass.cpp            |   19 +-
 .../new.version.compile.pass.cpp              |   46 +-
 .../numbers.version.compile.pass.cpp          |   13 +-
 .../numeric.version.compile.pass.cpp          |   54 +-
 .../optional.version.compile.pass.cpp         |   46 +-
 .../ostream.version.compile.pass.cpp          |   32 +-
 .../print.version.compile.pass.cpp            |   19 +-
 .../queue.version.compile.pass.cpp            |   27 +-
 .../random.version.compile.pass.cpp           |   32 +-
 .../ranges.version.compile.pass.cpp           |  127 +-
 .../ratio.version.compile.pass.cpp            |   13 +-
 .../regex.version.compile.pass.cpp            |   13 +-
 .../scoped_allocator.version.compile.pass.cpp |   13 +-
 .../semaphore.version.compile.pass.cpp        |   19 +-
 .../set.version.compile.pass.cpp              |   74 +-
 .../shared_mutex.version.compile.pass.cpp     |   32 +-
 .../source_location.version.compile.pass.cpp  |   13 +-
 .../span.version.compile.pass.cpp             |   27 +-
 .../sstream.version.compile.pass.cpp          |   13 +-
 .../stack.version.compile.pass.cpp            |   20 +-
 .../stdatomic.h.version.compile.pass.cpp      |   13 +-
 .../stop_token.version.compile.pass.cpp       |   19 +-
 .../string.version.compile.pass.cpp           |  122 +-
 .../string_view.version.compile.pass.cpp      |   67 +-
 .../syncstream.version.compile.pass.cpp       |   19 +-
 .../thread.version.compile.pass.cpp           |   32 +-
 .../tuple.version.compile.pass.cpp            |   68 +-
 .../type_traits.version.compile.pass.cpp      |  224 +-
 .../typeinfo.version.compile.pass.cpp         |   13 +-
 .../unordered_map.version.compile.pass.cpp    |   94 +-
 .../unordered_set.version.compile.pass.cpp    |   74 +-
 .../utility.version.compile.pass.cpp          |  103 +-
 .../variant.version.compile.pass.cpp          |   33 +-
 .../vector.version.compile.pass.cpp           |   61 +-
 .../version.version.compile.pass.cpp          | 2035 ++++++++++++++++-
 .../generate_feature_test_macro_components.py |    7 +-
 85 files changed, 5358 insertions(+), 244 deletions(-)
 create mode 100644 libcxx/test/std/language.support/support.limits/support.limits.general/embed.version.compile.pass.cpp

diff --git a/clang/docs/LanguageExtensions.rst b/clang/docs/LanguageExtensions.rst
index 8f6826c3891ac..ad6890a48973b 100644
--- a/clang/docs/LanguageExtensions.rst
+++ b/clang/docs/LanguageExtensions.rst
@@ -5417,6 +5417,82 @@ manner as the above four builtins, except that ``_M_function_name`` is populated
 with ``__PRETTY_FUNCTION__`` rather than ``__FUNCTION__``.
 
 
+Data embedding builtin ``__builtin_std_embed``
+----------------------------------------------
+
+For use with `p1040 <https://wg21.link/p1040>`'s ``std::embed`` directive. It
+is conceptually (but not exactly) represented by the following overloads:
+
+.. code-block:: c++
+
+  template <class Byte, class Char>
+  Byte const* __builtin_std_embed(int& status,
+                               size_t& size, T const* type_hint_ptr,
+                               size_t resource_name_size,
+                               Char const* resource_name_ptr,
+                               size_t offset);
+
+  template <class Byte, class Char>
+  Byte const* __builtin_std_embed(int& status,
+                               size_t& size, T const* type_hint_ptr,
+                               size_t resource_name_size,
+                               Char const* resource_name_ptr,
+                               size_t offset, size_t limit);
+
+The first argument is an output parameter status object. It will be
+filled with ``0`` is the file is not found or a suitable ``#depend`` clause
+does not bless the file that is found, ``1`` if the file is found, and ``2``
+if the file is found but it is empty. (These are the same values as the macros
+``__STDC_EMBED_NOT_FOUND__``, ``__STDC_EMBED_FOUND__``, and
+``__STDC_EMBED_EMPTY__``, respectively.)
+
+The second argument is an output parameter for the number of elements pointed
+to by the return type. If ``limit`` is provided, this value will be less than
+or equal to ``limit``.
+
+The third argument is a type hint for the type to return. It must be a pointer
+to a ``const`` type, and ``Byte`` must an integral or enumeration type with an
+alignment and size of ``1`` (e.g. ``char``, ``unsigned char``, ``std::byte``,
+etc.). A future extension can possibly allow for additional types, possibly
+all types which are considered "trivial" types.
+
+The fourth and fifth arguments describe a plain, wide, or ``char8_t`` range as
+as string. ``Char`` can be one of ``char``, ``wchar_t``, or ``char8_t`` to
+represent a string in the literal encoding, wide literal encoding, or UTF-8
+encoding respectively. While they have these stated encodings, the plain,
+wide (when ``sizeof(wchar_t) == 1``), and ``char8_t`` strings are
+passed as-is to internal file handling solutions. ``wchar_t`` string ranges
+where it is 16-bits wide or 32-bits wide assume it is encoded as UTF-16 or
+UTF-32, respectively, and attempt to transcode to UTF-8. This means some
+files may not be representable when using wide strings. This behavior is
+subject to change, for example if the ``-fexec-charset=Encoding-Name`` or
+``-fwide-exec-charset=Encoding-Name`` options are implemented. It is also
+subject to change based on other factors, such as whether it is advantageous
+to produce a hard error on failed conversion or try the search anyway using
+canonical replacement characters (such as ``'\u{FFFD}''`` or ``'?'```).
+
+The sixth argument is the offset in bytes into the file. It can be set to
+``0`` to have no effect. This represents the number of ``Byte`` objects
+that will be discarded from the start of the file stream.
+
+The last argument is optional, and represents a fixed upper limit on the count
+of ``Byte`` objects that the returned value will point to. Less values can be
+pointed to than what ``limit`` describes.
+
+The ``offset`` value is applied before any ``limit`` is taken into
+consideration. The file name represented by the string range is searched in the
+same way as ``#embed`` files, with the caveat that any file not blessed by
+``#depend`` will be treated as a file that is not found. All searches done are
+searches as-if done by a quoted header name for a ``#embed`` directive.
+
+The data returned may not be unique, may prefix into other data, and has no
+guarantee that caching may apply. That is, calling ``__builtin_std_embed`` with
+the exact same arguments twice may return two different pointers or the same
+pointer, and is subject to everything from optimization level, implementation
+effort, and whether or not it is sunny outside right now. Block devices such
+as ``/dev/urandom`` can possibly be supported in the future.
+
+
 Alignment builtins
 ------------------
 Clang provides builtins to support checking and adjusting alignment of
diff --git a/clang/include/clang/Basic/Builtins.td b/clang/include/clang/Basic/Builtins.td
index d33dc0fe32233..c8fa0b2cab9a7 100644
--- a/clang/include/clang/Basic/Builtins.td
+++ b/clang/include/clang/Basic/Builtins.td
@@ -1010,7 +1010,7 @@ def GetVtablePointer : LangBuiltin<"CXX_LANG"> {
 def StdEmbed : Builtin {
   let Spellings = ["__builtin_std_embed"];
   let Attributes = [NoThrow, Const, Consteval];
-  let Prototype = "void const*(size_t&, ...)";
+  let Prototype = "void const*(int&, size_t&, ...)";
 }
 
 // GCC exception builtins
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index 084fe16bf04f2..ed65242ded122 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -10697,17 +10697,22 @@ bool PointerExprEvaluator::VisitBuiltinCallExpr(const CallExpr *E,
     }
   }
   case Builtin::BI__builtin_std_embed: {
-    const Expr *SizeOutArg = E->getArg(0);
-    const Expr *PtrSpecifierArg = E->getArg(1);
-    const Expr *ResourceNameSizeArg = E->getArg(2);
-    const Expr *ResourceNamePtrArg = E->getArg(3);
-    const Expr *OffsetArg = E->getArg(4);
-    const Expr *LimitArg = E->getNumArgs() == 6 ? E->getArg(5) : nullptr;
+    constexpr uint64_t FileNotFound = 0;
+    constexpr uint64_t FileFound = 1;
+    constexpr uint64_t FileFoundAndEmpty = 2;
 
-    QualType ArrElementTy = PtrSpecifierArg->getType()->getPointeeType();
+    const Expr *StatusOutArg = E->getArg(0);
+    const Expr *SizeOutArg = E->getArg(1);
+    const Expr *PtrOutArg = E->getArg(2);
+    const Expr *ResourceNameSizeArg = E->getArg(3);
+    const Expr *ResourceNamePtrArg = E->getArg(4);
+    const Expr *OffsetArg = E->getArg(5);
+    const Expr *LimitArg = E->getNumArgs() == 7 ? E->getArg(6) : nullptr;
+
+    QualType ArrElementTy = PtrOutArg->getType()->getPointeeType();
 
     LValue ResourceNamePtrLVal;
-    if (!evaluatePointer(ResourceNamePtrArg, ResourceNamePtrLVal)) {
+    if (!EvaluatePointer(ResourceNamePtrArg, ResourceNamePtrLVal, Info)) {
       return Error(ResourceNamePtrArg);
     }
 
@@ -10728,6 +10733,7 @@ bool PointerExprEvaluator::VisitBuiltinCallExpr(const CallExpr *E,
     const QualType WCharTy = Info.Ctx.getWideCharType();
     const size_t SizeTySize = Info.Ctx.getTypeSize(SizeTy);
     const size_t WCharTySize = Info.Ctx.getTypeSize(WCharTy);
+    const size_t IntTySize = Info.Ctx.getTypeSize(Info.Ctx.IntTy);
     const QualType ResourceNameCharTy(ResourceNamePtrArg->getType()->getPointeeOrArrayElementType(), 0);
     if (ResourceNameCharTy->isChar8Type() || ResourceNameCharTy->isCharType() || (ResourceNameCharTy->isWideCharType() && WCharTySize == 8)) {
       // Assume the ResourceName is directly usable as an 8-bit transmuation
@@ -10799,7 +10805,19 @@ bool PointerExprEvaluator::VisitBuiltinCallExpr(const CallExpr *E,
     uint64_t DataSize = 0;
     uint64_t DataOffset = 0;
     std::optional<int64_t> MaybeLimit = std::nullopt;
-    
+    auto WriteOutStatus = [&](uint64_t Status) -> bool {
+      LValue StatusOutLVal;
+      if (!EvaluateLValue(StatusOutArg, StatusOutLVal, Info)) {
+        return Error(StatusOutArg);
+      }
+      APSInt StatusVal(llvm::APInt(IntTySize, Status, true), false);
+      APValue StatusOutResult(StatusVal);
+      if (!handleAssignment(Info, StatusOutArg, StatusOutLVal, StatusOutArg->getType(), StatusOutResult)) {
+        return Error(StatusOutArg);
+      }
+      return true;
+    };
+
     APSInt OffsetVal;
     if (!EvaluateInteger(OffsetArg, OffsetVal, Info)) {
       return Error(OffsetArg);
@@ -10848,18 +10866,26 @@ bool PointerExprEvaluator::VisitBuiltinCallExpr(const CallExpr *E,
     OptionalFileEntryRef ResourceFile =
       LookupFileWithStdVec(ResourceName, false, true, FM, *MaybeSearchEntries, ThisFile);
     if (!ResourceFile) {
-      Info.FFDiag(ResourceNamePtrArg->getBeginLoc(), diag::err_cannot_open_file) << ResourceName << "cannot find a matching resource to open";
-      return false;
+      return WriteOutStatus(FileNotFound);
     }
-    if (Info.Ctx.InputDependencyPatterns) {
-      StringRef ResourceSearchName = ResourceFile->getFileEntry().tryGetRealPathName();
-      if (ResourceSearchName.empty()) {
-        ResourceSearchName = ResourceName;
-      }
-      if (!Info.Ctx.InputDependencyPatterns->Check(ResourceSearchName)) {
-        Info.FFDiag(ResourceNamePtrArg->getBeginLoc(), diag::err_cannot_open_file) << ResourceName << "no '#depend' directive matches the found resource";
-        return false;
-      }
+    assert(Info.Ctx.InputDependencyPatterns && "using __builtin_std_embed requires the context to have a usable input dependency patterns");
+    StringRef ResourceSearchName = ResourceFile->getFileEntry().tryGetRealPathName();
+    if (ResourceSearchName.empty()) {
+      ResourceSearchName = ResourceName;
+    }
+    if (!Info.Ctx.InputDependencyPatterns->Check(ResourceSearchName)) {
+      // Not matching a dependency is also simply considered not
+      // finding the file. Consider possibly returnig a different value in the future.
+      return WriteOutStatus(FileNotFound);
+    }
+    size_t FullDataSize = ResourceFile->getSize();
+    DataSize = std::max<size_t>(0, std::min<size_t>(
+      DataOffset > FullDataSize
+      ? 0 : FullDataSize - DataOffset,
+      MaybeLimit ? *MaybeLimit : std::numeric_limits<size_t>::max()));
+
+    if (FullDataSize == 0 || DataSize == 0) {
+      return WriteOutStatus(FileFoundAndEmpty);
     }
     llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> MaybeBinaryData =
       FM.getBufferForFile(*ResourceFile, true, false, MaybeLimit, false);
@@ -10878,11 +10904,7 @@ bool PointerExprEvaluator::VisitBuiltinCallExpr(const CallExpr *E,
       Info.FFDiag(ResourceNamePtrArg->getBeginLoc(), diag::err_cannot_open_file) << ResourceName << "found the resource but unable to read the binary data";
       return false;
     }
-    size_t FullDataSize = BinaryData->getBufferSize();
-    DataSize = std::max<size_t>(0, std::min<size_t>(
-      DataOffset > FullDataSize
-      ? 0 : FullDataSize - DataOffset,
-      MaybeLimit ? *MaybeLimit : std::numeric_limits<size_t>::max()));
+    assert(BinaryData->getBufferSize() == FullDataSize && "The binary data for some reason has a data size that is different from the retrieved file size earlier");
 
     // Write out size
     LValue SizeOutLVal;
@@ -10911,7 +10933,7 @@ bool PointerExprEvaluator::VisitBuiltinCallExpr(const CallExpr *E,
     }
     // inform the result we have put a string literal in there
     Result.addArray(Info, E, BackingArrayConstantArrayTy); 
-    return true;
+    return WriteOutStatus(FileFound);
   }
   default:
     return false;
@@ -15509,9 +15531,7 @@ class IntExprEvaluator
     assert(E->getType()->isIntegralOrEnumerationType() &&
            "Invalid evaluation result.");
     auto Ty = E->getType();
-    if (SI.isSigned() != Ty->isSignedIntegerOrEnumerationType()) {
-      assert(false && "Invalid evaluation result.");
-    }
+    assert(SI.isSigned() == Ty->isSignedIntegerOrEnumerationType() && "Invalid evaluation result.");
     assert(SI.getBitWidth() == Info.Ctx.getIntWidth(E->getType()) &&
            "Invalid evaluation result.");
     Result = APValue(SI);
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 7a4f56aaeb40b..05a2d6bd7bffc 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -6776,22 +6776,36 @@ bool Sema::BuiltinCountedByRef(CallExpr *TheCall) {
 }
 
 bool Sema::BuiltinStdEmbed(CallExpr *TheCall) {
-  const bool HasProperArgCount = !checkArgCountAtLeast(TheCall, 5);
-  const bool HasExtraLimitArg = !checkArgCountAtMost(TheCall, 6) && TheCall->getNumArgs() == 6;
+  const bool HasProperArgCount = !checkArgCountAtLeast(TheCall, 6);
+  const bool HasExtraLimitArg = !checkArgCountAtMost(TheCall, 7) && TheCall->getNumArgs() == 7;
   if (!HasProperArgCount && !HasExtraLimitArg)
     return true;
 
-  const Expr *SizeRef = TheCall->getArg(0);
-  const Expr *PtrRef = TheCall->getArg(1);
-  const unsigned int ResourceNameSizeIndex = 2;
+  const Expr *StatusRef = TheCall->getArg(0);
+  const Expr *SizeRef = TheCall->getArg(1);
+  const unsigned int PtrRefIndex = 2;
+  const Expr *PtrRef = TheCall->getArg(PtrRefIndex);
+  const unsigned int ResourceNameSizeIndex = 3;
   const Expr *ResourceNameSize = TheCall->getArg(ResourceNameSizeIndex);
-  const unsigned int ResourceNamePtrIndex = 3;
+  const unsigned int ResourceNamePtrIndex = 4;
   const Expr *ResourceNamePtr = TheCall->getArg(ResourceNamePtrIndex);
-  const unsigned int OffsetIndex = 4;
+  const unsigned int OffsetIndex = 5;
   const Expr *Offset = TheCall->getArg(OffsetIndex);
-  const unsigned int LimitIndex = 5;
+  const unsigned int LimitIndex = 6;
   const Expr *Limit = HasExtraLimitArg ? TheCall->getArg(LimitIndex) : nullptr;
 
+  const uint64_t CharSize = Context.getCharWidth();
+  // Status argument type
+  QualType StatusRefTy = StatusRef->getType();
+  if ((!StatusRefTy->isIntegralOrUnscopedEnumerationType())
+      || StatusRefTy.isConstant(Context)
+      || !StatusRef->isLValue()) {
+    Diag(TheCall->getBeginLoc(), diag::err_invalid_builtin_argument)
+      << StatusRef << "__builtin_std_embed"
+      << StatusRef->getSourceRange();
+    return true;
+  }
+
   // Size argument type
   QualType SizeRefTy = SizeRef->getType();
   if ((!SizeRefTy->isIntegralOrUnscopedEnumerationType())
@@ -6804,23 +6818,29 @@ bool Sema::BuiltinStdEmbed(CallExpr *TheCall) {
   }
 
   // value pointer, has to be non-constant (but pointer to `const`).
-  // tells us what the type for the builtin return is, serves no other purpose.
+  // tells us what the type for the builtin return is as well.
+  // note we have to strip it because the `...` in the Builtins.td causes
+  // it to be treated as an RValue, and we need to peel that off so it can be
+  // treated as an LValue, if possible.
   QualType PtrRefTy = PtrRef->getType();
-  if (!PtrRefTy->isPointerType()) {
+  if (!PtrRefTy->isPointerType()
+      || PtrRefTy.isConstant(Context)) {
     Diag(TheCall->getBeginLoc(), diag::err_invalid_builtin_argument)
       << PtrRefTy << "__builtin_std_embed"
       << PtrRef->getSourceRange();
     return true;
   }
   QualType ArrElementTy = PtrRefTy->getPointeeType();
-  if (!ArrElementTy.isConstant(Context)) {
+  if (!ArrElementTy.isConstant(Context)
+      || !(Context.getTypeSize(ArrElementTy) == CharSize
+        && Context.getTypeAlign(ArrElementTy) == CharSize
+        && ArrElementTy->isIntegralOrEnumerationType())) {
     Diag(TheCall->getBeginLoc(), diag::err_invalid_builtin_argument)
       << PtrRef << "__builtin_std_embed"
       << PtrRef->getSourceRange();
     return true;
   }
 
-  const uint64_t CharSize = Context.getCharWidth();
   if (!(ArrElementTy->isIntegralOrEnumerationType()
         && Context.getTypeSize(ArrElementTy) == CharSize
         && Context.getTypeAlign(ArrElementTy) == CharSize)) {
@@ -6881,7 +6901,7 @@ bool Sema::BuiltinStdEmbed(CallExpr *TheCall) {
     
   }
 
-  // Check the integer-convertible argument is offset
+  // Check offset is an integer-convertible argument
   QualType OffsetTy = Offset->getType();
   if (!OffsetTy->isIntegralOrEnumerationType()) {
     Expr *OffsetMutable =  const_cast<Expr *>(Offset);
diff --git a/libcxx/docs/FeatureTestMacroTable.rst b/libcxx/docs/FeatureTestMacroTable.rst
index 94342eb4a4f0a..9702d8cfa3ae4 100644
--- a/libcxx/docs/FeatureTestMacroTable.rst
+++ b/libcxx/docs/FeatureTestMacroTable.rst
@@ -535,5 +535,9 @@ Status
     ``__cpp_lib_tuple_like``                                   *unimplemented*
     ---------------------------------------------------------- -----------------
     ``__cpp_lib_variant``                                      ``202306L``
+    ---------------------------------------------------------- -----------------
+    **C++29**
+    ----------------------------------------------------------------------------
+    ``__cpp_lib_embed``                                        ``202606L``
     ========================================================== =================
 
diff --git a/libcxx/include/__configuration/language.h b/libcxx/include/__configuration/language.h
index 3137ba2ea27ef..ebc1975159601 100644
--- a/libcxx/include/__configuration/language.h
+++ b/libcxx/include/__configuration/language.h
@@ -31,9 +31,11 @@
 #    define _LIBCPP_STD_VER 20
 #  elif __cplusplus <= 202302L
 #    define _LIBCPP_STD_VER 23
-#  else
-// Expected release year of the next C++ standard
+#  elif __cplusplus <= 202603L
 #    define _LIBCPP_STD_VER 26
+#  else
+// whatever the __cplusplus macro says it should be
+#    define _LIBCPP_STD_VER ((__cplusplus / 100) - 2000)
 #  endif
 #endif // __cplusplus
 // NOLINTEND(libcpp-cpp-version-check)
diff --git a/libcxx/include/embed b/libcxx/include/embed
index e434433ff5b11..fc5304c6a08d7 100644
--- a/libcxx/include/embed
+++ b/libcxx/include/embed
@@ -30,84 +30,118 @@ consteval span<const T> embed(u8string_view resource_idenfier,
   size_t offset = 0,
   optional<size_t> limit = nullopt);
 
+  template <class T, size_t Limit>
+consteval span<const T, Limit> embed(string_view resource_idenfier,
+  size_t offset = 0);
+
+  template <class T, size_t Limit>
+consteval span<const , Limit> embed(wstring_view resource_idenfier,
+  size_t offset = 0);
+
+  template <class T, size_t Limit>
+consteval span<const T, Limit> embed(u8string_view resource_idenfier,
+  size_t offset = 0);
+
 } // namespace std
 
 */
 
-#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
-#  include <__cxx03/__config>
-#else
-#  include <__config>
-#  include <__cstddef/byte.h>
-#  include <__type_traits/is_enum.h>
-#  include <__type_traits/is_integral.h>
-#  include <__type_traits/is_same.h>
-#  include <optional>
-#  include <span>
-#  include <string_view>
-#  include <version>
-
-#  if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-#    pragma GCC system_header
-#  endif
-
-_LIBCPP_PUSH_MACROS
-#  include <__undef_macros>
-
-#  if !defined(_LIBCPP_HAS_EMBED)
-#    if __has_builtin(__builtin_std_embed)
-#      define _LIBCPP_HAS_EMBED 1
-#    else
-#      define _LIBCPP_HAS_EMBED 0
-#    endif
-#  endif
-
-#  if _LIBCPP_HAS_EMBED != 0
+#include <__assert>
+#include <__config>
+#include <__cstddef/byte.h>
+#include <__type_traits/is_enum.h>
+#include <__type_traits/is_integral.h>
+#include <__type_traits/is_same.h>
+#include <__verbose_abort>
+#include <optional>
+#include <span>
+#include <stdexcept>
+#include <string_view>
+#include <version>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#  pragma GCC system_header
+#endif
+
+// FIXME: the versioning stuff out of Clang is... Not Great! __cplusplus is still like 202400L for -std=c++2c, which is
+// not even in the ballpark of correct.
+#if 1 //_LIBCPP_STD_VER > 26 && __has_builtin(__builtin_std_embed)
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
 namespace __embed_detail {
-template <typename _Byte, typename _StrView>
-consteval span<const _Byte>
-__embed(const _StrView& __resource_identifier, size_t __offset = 0, optional<size_t> __limit = nullopt) {
+template <typename _Byte, size_t _Extent, typename _StrView>
+consteval _LIBCPP_HIDE_FROM_ABI span<const _Byte, _Extent>
+__embed(const _StrView& __resource_identifier, size_t __offset, [[maybe_unused]] optional<size_t> __limit) {
   static_assert(sizeof(_Byte) == 1 && alignof(_Byte) == 1 && (is_integral<_Byte>::value || is_enum<_Byte>::value),
                 "embed data type must be a character type with a size and alignment of 1");
   size_t __size      = 0;
   _Byte const* __ptr = nullptr;
-  if (__limit) {
+  int __status       = -1;
+  if constexpr (_Extent != std::dynamic_extent) {
     __ptr = __builtin_std_embed(
-        __size, __ptr, __resource_identifier.size(), __resource_identifier.data(), __offset, *__limit);
+        __status, __size, __ptr, __resource_identifier.size(), __resource_identifier.data(), __offset, _Extent);
   } else {
-    __ptr = __builtin_std_embed(__size, __ptr, __resource_identifier.size(), __resource_identifier.data(), __offset);
+    if (__limit) {
+      __ptr = __builtin_std_embed(
+          __status, __size, __ptr, __resource_identifier.size(), __resource_identifier.data(), __offset, *__limit);
+    } else {
+      __ptr = __builtin_std_embed(
+          __status, __size, __ptr, __resource_identifier.size(), __resource_identifier.data(), __offset);
+    }
+  }
+  if (__status == __STDC_EMBED_NOT_FOUND__) {
+    throw std::domain_error("file not found");
+  }
+  if constexpr (_Extent != std::dynamic_extent) {
+    if (_Extent > __size) {
+      _LIBCPP_VERBOSE_ABORT("the fixed-size span extent is larger than the resource data size");
+    }
+    __size = _Extent;
+  }
+  if (__status == __STDC_EMBED_EMPTY__) {
+    return span<const _Byte, _Extent>();
   }
-  return span<const _Byte>(__ptr, __size);
+  _LIBCPP_ASSERT(__status == __STDC_EMBED_FOUND__, "return status of embed is the proper __STDC_EMBED_FOUND__ value");
+  return span<const _Byte, _Extent>(__ptr, __size);
 }
 } // namespace __embed_detail
 
 template <typename _Byte>
 consteval span<const _Byte>
 embed(string_view __resource_identifier, size_t __offset = 0, optional<size_t> __limit = nullopt) {
-  return __embed_detail::__embed<_Byte>(__resource_identifier, __offset, __limit);
+  return __embed_detail::__embed<_Byte, dynamic_extent>(__resource_identifier, __offset, __limit);
 }
 
 template <typename _Byte>
 consteval span<const _Byte>
 embed(wstring_view __resource_identifier, size_t __offset = 0, optional<size_t> __limit = nullopt) {
-  return __embed_detail::__embed<_Byte>(__resource_identifier, __offset, __limit);
+  return __embed_detail::__embed<_Byte, dynamic_extent>(__resource_identifier, __offset, __limit);
 }
 
 template <typename _Byte>
 consteval span<const _Byte>
 embed(u8string_view __resource_identifier, size_t __offset = 0, optional<size_t> __limit = nullopt) {
-  return __embed_detail::__embed<_Byte>(__resource_identifier, __offset, __limit);
+  return __embed_detail::__embed<_Byte, dynamic_extent>(__resource_identifier, __offset, __limit);
 }
 
-_LIBCPP_END_NAMESPACE_STD
+template <typename _Byte, size_t _Limit>
+consteval span<const _Byte, _Limit> embed(string_view __resource_identifier, size_t __offset = 0) {
+  return __embed_detail::__embed<_Byte, _Limit>(__resource_identifier, __offset, _Limit);
+}
+
+template <typename _Byte, size_t _Limit>
+consteval span<const _Byte, _Limit> embed(wstring_view __resource_identifier, size_t __offset = 0) {
+  return __embed_detail::__embed<_Byte, _Limit>(__resource_identifier, __offset, _Limit);
+}
 
-#  endif
+template <typename _Byte, size_t _Limit>
+consteval span<const _Byte, _Limit> embed(u8string_view __resource_identifier, size_t __offset = 0) {
+  return __embed_detail::__embed<_Byte, _Limit>(__resource_identifier, __offset, _Limit);
+}
 
-_LIBCPP_POP_MACROS
+_LIBCPP_END_NAMESPACE_STD
 
-#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
+#endif // _LIBCPP_STD_VER > 26 && __has_builtin(__builtin_std_embed)
 
 #endif // _LIBCPP_EMBED
diff --git a/libcxx/include/version b/libcxx/include/version
index c217851e9ea6d..6f3bccab7560e 100644
--- a/libcxx/include/version
+++ b/libcxx/include/version
@@ -101,6 +101,7 @@ __cpp_lib_default_template_type_for_algorithm_values    202403L <algorithm> <deq
                                                                 <list> <ranges> <string>
                                                                 <vector>
 __cpp_lib_destroying_delete                             201806L <new>
+__cpp_lib_embed                                         202606L <embed>
 __cpp_lib_enable_shared_from_this                       201603L <memory>
 __cpp_lib_endian                                        201907L <bit>
 __cpp_lib_erase_if                                      202002L <deque> <forward_list> <list>
@@ -632,13 +633,10 @@ __cpp_lib_void_t                                        201411L <type_traits>
 # define __cpp_lib_variant                              202306L
 #endif
 
-#if _LIBCPP_STD_VER >= 23
-# if __has_builtin(__builtin_std_embed) || (defined(_LIBCPP_HAS_EMBED) && (_LIBCPP_HAS_EMBED != 0))
-#   define __cpp_lib_embed                                 202607L
-# endif
+#if _LIBCPP_STD_VER >= 29
+# define __cpp_lib_embed                                202606L
 #endif
 
-
 #endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/algorithm.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/algorithm.version.compile.pass.cpp
index beecf87cd4aa7..17d50b313591f 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/algorithm.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/algorithm.version.compile.pass.cpp
@@ -352,7 +352,7 @@
 #    error "__cpp_lib_shift should have the value 202202L in c++23"
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  ifndef __cpp_lib_clamp
 #    error "__cpp_lib_clamp should be defined in c++26"
@@ -456,6 +456,110 @@
 #    error "__cpp_lib_shift should have the value 202202L in c++26"
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  ifndef __cpp_lib_clamp
+#    error "__cpp_lib_clamp should be defined in c++29"
+#  endif
+#  if __cpp_lib_clamp != 201603L
+#    error "__cpp_lib_clamp should have the value 201603L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_constexpr_algorithms
+#    error "__cpp_lib_constexpr_algorithms should be defined in c++29"
+#  endif
+#  if __cpp_lib_constexpr_algorithms != 202306L
+#    error "__cpp_lib_constexpr_algorithms should have the value 202306L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_default_template_type_for_algorithm_values
+#      error "__cpp_lib_default_template_type_for_algorithm_values should be defined in c++29"
+#    endif
+#    if __cpp_lib_default_template_type_for_algorithm_values != 202403L
+#      error "__cpp_lib_default_template_type_for_algorithm_values should have the value 202403L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_default_template_type_for_algorithm_values
+#      error "__cpp_lib_default_template_type_for_algorithm_values should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_freestanding_algorithm
+#      error "__cpp_lib_freestanding_algorithm should be defined in c++29"
+#    endif
+#    if __cpp_lib_freestanding_algorithm != 202311L
+#      error "__cpp_lib_freestanding_algorithm should have the value 202311L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_freestanding_algorithm
+#      error "__cpp_lib_freestanding_algorithm should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_parallel_algorithm
+#      error "__cpp_lib_parallel_algorithm should be defined in c++29"
+#    endif
+#    if __cpp_lib_parallel_algorithm != 201603L
+#      error "__cpp_lib_parallel_algorithm should have the value 201603L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_parallel_algorithm
+#      error "__cpp_lib_parallel_algorithm should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_ranges
+#    error "__cpp_lib_ranges should be defined in c++29"
+#  endif
+#  if __cpp_lib_ranges != 202406L
+#    error "__cpp_lib_ranges should have the value 202406L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_ranges_contains
+#    error "__cpp_lib_ranges_contains should be defined in c++29"
+#  endif
+#  if __cpp_lib_ranges_contains != 202207L
+#    error "__cpp_lib_ranges_contains should have the value 202207L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_ranges_find_last
+#    error "__cpp_lib_ranges_find_last should be defined in c++29"
+#  endif
+#  if __cpp_lib_ranges_find_last != 202207L
+#    error "__cpp_lib_ranges_find_last should have the value 202207L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_ranges_starts_ends_with
+#    error "__cpp_lib_ranges_starts_ends_with should be defined in c++29"
+#  endif
+#  if __cpp_lib_ranges_starts_ends_with != 202106L
+#    error "__cpp_lib_ranges_starts_ends_with should have the value 202106L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_robust_nonmodifying_seq_ops
+#    error "__cpp_lib_robust_nonmodifying_seq_ops should be defined in c++29"
+#  endif
+#  if __cpp_lib_robust_nonmodifying_seq_ops != 201304L
+#    error "__cpp_lib_robust_nonmodifying_seq_ops should have the value 201304L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_sample
+#    error "__cpp_lib_sample should be defined in c++29"
+#  endif
+#  if __cpp_lib_sample != 201603L
+#    error "__cpp_lib_sample should have the value 201603L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_shift
+#    error "__cpp_lib_shift should be defined in c++29"
+#  endif
+#  if __cpp_lib_shift != 202202L
+#    error "__cpp_lib_shift should have the value 202202L in c++29"
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/any.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/any.version.compile.pass.cpp
index fe0e6bd17f94d..6c08175a5285f 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/any.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/any.version.compile.pass.cpp
@@ -57,7 +57,7 @@
 #    error "__cpp_lib_any should have the value 201606L in c++23"
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  ifndef __cpp_lib_any
 #    error "__cpp_lib_any should be defined in c++26"
@@ -66,6 +66,15 @@
 #    error "__cpp_lib_any should have the value 201606L in c++26"
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  ifndef __cpp_lib_any
+#    error "__cpp_lib_any should be defined in c++29"
+#  endif
+#  if __cpp_lib_any != 201606L
+#    error "__cpp_lib_any should have the value 201606L in c++29"
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/array.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/array.version.compile.pass.cpp
index 30efb61893a1b..5f5dc28e5ba22 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/array.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/array.version.compile.pass.cpp
@@ -132,7 +132,7 @@
 #    error "__cpp_lib_to_array should have the value 201907L in c++23"
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  ifndef __cpp_lib_array_constexpr
 #    error "__cpp_lib_array_constexpr should be defined in c++26"
@@ -168,6 +168,42 @@
 #    error "__cpp_lib_to_array should have the value 201907L in c++26"
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  ifndef __cpp_lib_array_constexpr
+#    error "__cpp_lib_array_constexpr should be defined in c++29"
+#  endif
+#  if __cpp_lib_array_constexpr != 201811L
+#    error "__cpp_lib_array_constexpr should have the value 201811L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_freestanding_array
+#      error "__cpp_lib_freestanding_array should be defined in c++29"
+#    endif
+#    if __cpp_lib_freestanding_array != 202311L
+#      error "__cpp_lib_freestanding_array should have the value 202311L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_freestanding_array
+#      error "__cpp_lib_freestanding_array should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_nonmember_container_access
+#    error "__cpp_lib_nonmember_container_access should be defined in c++29"
+#  endif
+#  if __cpp_lib_nonmember_container_access != 201411L
+#    error "__cpp_lib_nonmember_container_access should have the value 201411L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_to_array
+#    error "__cpp_lib_to_array should be defined in c++29"
+#  endif
+#  if __cpp_lib_to_array != 201907L
+#    error "__cpp_lib_to_array should have the value 201907L in c++29"
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/atomic.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/atomic.version.compile.pass.cpp
index e62416257a696..16ae82e8b3c59 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/atomic.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/atomic.version.compile.pass.cpp
@@ -309,7 +309,7 @@
 #    endif
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  ifndef __cpp_lib_atomic_flag_test
 #    error "__cpp_lib_atomic_flag_test should be defined in c++26"
@@ -399,6 +399,96 @@
 #    endif
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  ifndef __cpp_lib_atomic_flag_test
+#    error "__cpp_lib_atomic_flag_test should be defined in c++29"
+#  endif
+#  if __cpp_lib_atomic_flag_test != 201907L
+#    error "__cpp_lib_atomic_flag_test should have the value 201907L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_atomic_float
+#    error "__cpp_lib_atomic_float should be defined in c++29"
+#  endif
+#  if __cpp_lib_atomic_float != 201711L
+#    error "__cpp_lib_atomic_float should have the value 201711L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_atomic_is_always_lock_free
+#    error "__cpp_lib_atomic_is_always_lock_free should be defined in c++29"
+#  endif
+#  if __cpp_lib_atomic_is_always_lock_free != 201603L
+#    error "__cpp_lib_atomic_is_always_lock_free should have the value 201603L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_atomic_lock_free_type_aliases
+#    error "__cpp_lib_atomic_lock_free_type_aliases should be defined in c++29"
+#  endif
+#  if __cpp_lib_atomic_lock_free_type_aliases != 201907L
+#    error "__cpp_lib_atomic_lock_free_type_aliases should have the value 201907L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_atomic_min_max
+#      error "__cpp_lib_atomic_min_max should be defined in c++29"
+#    endif
+#    if __cpp_lib_atomic_min_max != 202403L
+#      error "__cpp_lib_atomic_min_max should have the value 202403L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_atomic_min_max
+#      error "__cpp_lib_atomic_min_max should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_atomic_ref
+#    error "__cpp_lib_atomic_ref should be defined in c++29"
+#  endif
+#  if __cpp_lib_atomic_ref != 202411L
+#    error "__cpp_lib_atomic_ref should have the value 202411L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_atomic_shared_ptr
+#      error "__cpp_lib_atomic_shared_ptr should be defined in c++29"
+#    endif
+#    if __cpp_lib_atomic_shared_ptr != 201711L
+#      error "__cpp_lib_atomic_shared_ptr should have the value 201711L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_atomic_shared_ptr
+#      error "__cpp_lib_atomic_shared_ptr should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_atomic_value_initialization
+#    error "__cpp_lib_atomic_value_initialization should be defined in c++29"
+#  endif
+#  if __cpp_lib_atomic_value_initialization != 201911L
+#    error "__cpp_lib_atomic_value_initialization should have the value 201911L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_atomic_wait
+#    error "__cpp_lib_atomic_wait should be defined in c++29"
+#  endif
+#  if __cpp_lib_atomic_wait != 201907L
+#    error "__cpp_lib_atomic_wait should have the value 201907L in c++29"
+#  endif
+
+#  if defined(__cpp_char8_t)
+#    ifndef __cpp_lib_char8_t
+#      error "__cpp_lib_char8_t should be defined in c++29"
+#    endif
+#    if __cpp_lib_char8_t != 201907L
+#      error "__cpp_lib_char8_t should have the value 201907L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_char8_t
+#      error "__cpp_lib_char8_t should not be defined when the requirement 'defined(__cpp_char8_t)' is not met!"
+#    endif
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/barrier.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/barrier.version.compile.pass.cpp
index 01cda62c06a6f..4171deef44c41 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/barrier.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/barrier.version.compile.pass.cpp
@@ -68,7 +68,7 @@
 #    endif
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
 #    ifndef __cpp_lib_barrier
@@ -83,6 +83,21 @@
 #    endif
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
+#    ifndef __cpp_lib_barrier
+#      error "__cpp_lib_barrier should be defined in c++29"
+#    endif
+#    if __cpp_lib_barrier != 201907L
+#      error "__cpp_lib_barrier should have the value 201907L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_barrier
+#      error "__cpp_lib_barrier should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
+#    endif
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/bit.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/bit.version.compile.pass.cpp
index cad025eee3373..39df8f7ed649e 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/bit.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/bit.version.compile.pass.cpp
@@ -155,7 +155,7 @@
 #    error "__cpp_lib_int_pow2 should have the value 202002L in c++23"
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  ifndef __cpp_lib_bit_cast
 #    error "__cpp_lib_bit_cast should be defined in c++26"
@@ -192,6 +192,43 @@
 #    error "__cpp_lib_int_pow2 should have the value 202002L in c++26"
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  ifndef __cpp_lib_bit_cast
+#    error "__cpp_lib_bit_cast should be defined in c++29"
+#  endif
+#  if __cpp_lib_bit_cast != 201806L
+#    error "__cpp_lib_bit_cast should have the value 201806L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_bitops
+#    error "__cpp_lib_bitops should be defined in c++29"
+#  endif
+#  if __cpp_lib_bitops != 201907L
+#    error "__cpp_lib_bitops should have the value 201907L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_byteswap
+#    error "__cpp_lib_byteswap should be defined in c++29"
+#  endif
+#  if __cpp_lib_byteswap != 202110L
+#    error "__cpp_lib_byteswap should have the value 202110L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_endian
+#    error "__cpp_lib_endian should be defined in c++29"
+#  endif
+#  if __cpp_lib_endian != 201907L
+#    error "__cpp_lib_endian should have the value 201907L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_int_pow2
+#    error "__cpp_lib_int_pow2 should be defined in c++29"
+#  endif
+#  if __cpp_lib_int_pow2 != 202002L
+#    error "__cpp_lib_int_pow2 should have the value 202002L in c++29"
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/bitset.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/bitset.version.compile.pass.cpp
index 8799a1f7d14e5..22c4319270521 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/bitset.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/bitset.version.compile.pass.cpp
@@ -71,7 +71,7 @@
 #    error "__cpp_lib_constexpr_bitset should have the value 202207L in c++23"
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  ifndef __cpp_lib_bitset
 #    error "__cpp_lib_bitset should be defined in c++26"
@@ -87,6 +87,22 @@
 #    error "__cpp_lib_constexpr_bitset should have the value 202207L in c++26"
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  ifndef __cpp_lib_bitset
+#    error "__cpp_lib_bitset should be defined in c++29"
+#  endif
+#  if __cpp_lib_bitset != 202306L
+#    error "__cpp_lib_bitset should have the value 202306L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_constexpr_bitset
+#    error "__cpp_lib_constexpr_bitset should be defined in c++29"
+#  endif
+#  if __cpp_lib_constexpr_bitset != 202207L
+#    error "__cpp_lib_constexpr_bitset should have the value 202207L in c++29"
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/charconv.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/charconv.version.compile.pass.cpp
index 6ec3037c9ea45..2d1b411492134 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/charconv.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/charconv.version.compile.pass.cpp
@@ -98,7 +98,7 @@
 #    endif
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  ifndef __cpp_lib_constexpr_charconv
 #    error "__cpp_lib_constexpr_charconv should be defined in c++26"
@@ -120,6 +120,28 @@
 #    endif
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  ifndef __cpp_lib_constexpr_charconv
+#    error "__cpp_lib_constexpr_charconv should be defined in c++29"
+#  endif
+#  if __cpp_lib_constexpr_charconv != 202207L
+#    error "__cpp_lib_constexpr_charconv should have the value 202207L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_to_chars
+#      error "__cpp_lib_to_chars should be defined in c++29"
+#    endif
+#    if __cpp_lib_to_chars != 202306L
+#      error "__cpp_lib_to_chars should have the value 202306L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_to_chars
+#      error "__cpp_lib_to_chars should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/chrono.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/chrono.version.compile.pass.cpp
index d5d7a5da4a64d..cd65a25c408e9 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/chrono.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/chrono.version.compile.pass.cpp
@@ -89,7 +89,7 @@
 #    error "__cpp_lib_chrono_udls should have the value 201304L in c++23"
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  ifndef __cpp_lib_chrono
 #    error "__cpp_lib_chrono should be defined in c++26"
@@ -105,6 +105,22 @@
 #    error "__cpp_lib_chrono_udls should have the value 201304L in c++26"
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  ifndef __cpp_lib_chrono
+#    error "__cpp_lib_chrono should be defined in c++29"
+#  endif
+#  if __cpp_lib_chrono != 201611L
+#    error "__cpp_lib_chrono should have the value 201611L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_chrono_udls
+#    error "__cpp_lib_chrono_udls should be defined in c++29"
+#  endif
+#  if __cpp_lib_chrono_udls != 201304L
+#    error "__cpp_lib_chrono_udls should have the value 201304L in c++29"
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/cmath.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/cmath.version.compile.pass.cpp
index 26ebe1e3ad6b1..c257f561d39ca 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/cmath.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/cmath.version.compile.pass.cpp
@@ -159,7 +159,7 @@
 #    endif
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  if !defined(_LIBCPP_VERSION)
 #    ifndef __cpp_lib_constexpr_cmath
@@ -201,6 +201,48 @@
 #    endif
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_constexpr_cmath
+#      error "__cpp_lib_constexpr_cmath should be defined in c++29"
+#    endif
+#    if __cpp_lib_constexpr_cmath != 202202L
+#      error "__cpp_lib_constexpr_cmath should have the value 202202L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_constexpr_cmath
+#      error "__cpp_lib_constexpr_cmath should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_hypot
+#    error "__cpp_lib_hypot should be defined in c++29"
+#  endif
+#  if __cpp_lib_hypot != 201603L
+#    error "__cpp_lib_hypot should have the value 201603L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_interpolate
+#    error "__cpp_lib_interpolate should be defined in c++29"
+#  endif
+#  if __cpp_lib_interpolate != 201902L
+#    error "__cpp_lib_interpolate should have the value 201902L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_math_special_functions
+#      error "__cpp_lib_math_special_functions should be defined in c++29"
+#    endif
+#    if __cpp_lib_math_special_functions != 201603L
+#      error "__cpp_lib_math_special_functions should have the value 201603L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_math_special_functions
+#      error "__cpp_lib_math_special_functions should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/compare.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/compare.version.compile.pass.cpp
index 907535a087de2..8b0bcbc9e2b3a 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/compare.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/compare.version.compile.pass.cpp
@@ -54,7 +54,7 @@
 #    error "__cpp_lib_three_way_comparison should have the value 201907L in c++23"
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  ifndef __cpp_lib_three_way_comparison
 #    error "__cpp_lib_three_way_comparison should be defined in c++26"
@@ -63,6 +63,15 @@
 #    error "__cpp_lib_three_way_comparison should have the value 201907L in c++26"
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  ifndef __cpp_lib_three_way_comparison
+#    error "__cpp_lib_three_way_comparison should be defined in c++29"
+#  endif
+#  if __cpp_lib_three_way_comparison != 201907L
+#    error "__cpp_lib_three_way_comparison should have the value 201907L in c++29"
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/complex.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/complex.version.compile.pass.cpp
index 9a3a644ca5d64..388ecdd90e5d7 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/complex.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/complex.version.compile.pass.cpp
@@ -86,7 +86,7 @@
 #    error "__cpp_lib_constexpr_complex should have the value 201711L in c++23"
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  ifndef __cpp_lib_complex_udls
 #    error "__cpp_lib_complex_udls should be defined in c++26"
@@ -102,6 +102,22 @@
 #    error "__cpp_lib_constexpr_complex should have the value 201711L in c++26"
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  ifndef __cpp_lib_complex_udls
+#    error "__cpp_lib_complex_udls should be defined in c++29"
+#  endif
+#  if __cpp_lib_complex_udls != 201309L
+#    error "__cpp_lib_complex_udls should have the value 201309L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_constexpr_complex
+#    error "__cpp_lib_constexpr_complex should be defined in c++29"
+#  endif
+#  if __cpp_lib_constexpr_complex != 201711L
+#    error "__cpp_lib_constexpr_complex should have the value 201711L in c++29"
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/concepts.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/concepts.version.compile.pass.cpp
index 15f1d30060ef1..276930078f2e8 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/concepts.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/concepts.version.compile.pass.cpp
@@ -54,7 +54,7 @@
 #    error "__cpp_lib_concepts should have the value 202207L in c++23"
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  ifndef __cpp_lib_concepts
 #    error "__cpp_lib_concepts should be defined in c++26"
@@ -63,6 +63,15 @@
 #    error "__cpp_lib_concepts should have the value 202207L in c++26"
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  ifndef __cpp_lib_concepts
+#    error "__cpp_lib_concepts should be defined in c++29"
+#  endif
+#  if __cpp_lib_concepts != 202207L
+#    error "__cpp_lib_concepts should have the value 202207L in c++29"
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/coroutine.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/coroutine.version.compile.pass.cpp
index 24a9eca1e2346..ee52ac1a24072 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/coroutine.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/coroutine.version.compile.pass.cpp
@@ -54,7 +54,7 @@
 #    error "__cpp_lib_coroutine should have the value 201902L in c++23"
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  ifndef __cpp_lib_coroutine
 #    error "__cpp_lib_coroutine should be defined in c++26"
@@ -63,6 +63,15 @@
 #    error "__cpp_lib_coroutine should have the value 201902L in c++26"
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  ifndef __cpp_lib_coroutine
+#    error "__cpp_lib_coroutine should be defined in c++29"
+#  endif
+#  if __cpp_lib_coroutine != 201902L
+#    error "__cpp_lib_coroutine should have the value 201902L in c++29"
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/cstddef.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/cstddef.version.compile.pass.cpp
index bc65a7f3cae00..4721ab4b20a3d 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/cstddef.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/cstddef.version.compile.pass.cpp
@@ -57,7 +57,7 @@
 #    error "__cpp_lib_byte should have the value 201603L in c++23"
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  ifndef __cpp_lib_byte
 #    error "__cpp_lib_byte should be defined in c++26"
@@ -66,6 +66,15 @@
 #    error "__cpp_lib_byte should have the value 201603L in c++26"
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  ifndef __cpp_lib_byte
+#    error "__cpp_lib_byte should be defined in c++29"
+#  endif
+#  if __cpp_lib_byte != 201603L
+#    error "__cpp_lib_byte should have the value 201603L in c++29"
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/cstdlib.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/cstdlib.version.compile.pass.cpp
index 600fa2eb2e4f5..a0166dc12d59e 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/cstdlib.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/cstdlib.version.compile.pass.cpp
@@ -57,7 +57,7 @@
 #    endif
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  if !defined(_LIBCPP_VERSION)
 #    ifndef __cpp_lib_constexpr_cmath
@@ -72,6 +72,21 @@
 #    endif
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_constexpr_cmath
+#      error "__cpp_lib_constexpr_cmath should be defined in c++29"
+#    endif
+#    if __cpp_lib_constexpr_cmath != 202202L
+#      error "__cpp_lib_constexpr_cmath should have the value 202202L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_constexpr_cmath
+#      error "__cpp_lib_constexpr_cmath should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/cstring.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/cstring.version.compile.pass.cpp
index 8445aa3cf0c48..c6b8d335f5363 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/cstring.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/cstring.version.compile.pass.cpp
@@ -48,7 +48,7 @@
 #    error "__cpp_lib_freestanding_cstring should not be defined before c++26"
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  if !defined(_LIBCPP_VERSION)
 #    ifndef __cpp_lib_freestanding_cstring
@@ -63,6 +63,21 @@
 #    endif
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_freestanding_cstring
+#      error "__cpp_lib_freestanding_cstring should be defined in c++29"
+#    endif
+#    if __cpp_lib_freestanding_cstring != 202306L
+#      error "__cpp_lib_freestanding_cstring should have the value 202306L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_freestanding_cstring
+#      error "__cpp_lib_freestanding_cstring should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/deque.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/deque.version.compile.pass.cpp
index b634f3253093e..e8dde05dd7b07 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/deque.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/deque.version.compile.pass.cpp
@@ -155,7 +155,7 @@
 #    error "__cpp_lib_nonmember_container_access should have the value 201411L in c++23"
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  ifndef __cpp_lib_allocator_traits_is_always_equal
 #    error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++26"
@@ -198,6 +198,49 @@
 #    error "__cpp_lib_nonmember_container_access should have the value 201411L in c++26"
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  ifndef __cpp_lib_allocator_traits_is_always_equal
+#    error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++29"
+#  endif
+#  if __cpp_lib_allocator_traits_is_always_equal != 201411L
+#    error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_containers_ranges
+#    error "__cpp_lib_containers_ranges should be defined in c++29"
+#  endif
+#  if __cpp_lib_containers_ranges != 202202L
+#    error "__cpp_lib_containers_ranges should have the value 202202L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_default_template_type_for_algorithm_values
+#      error "__cpp_lib_default_template_type_for_algorithm_values should be defined in c++29"
+#    endif
+#    if __cpp_lib_default_template_type_for_algorithm_values != 202403L
+#      error "__cpp_lib_default_template_type_for_algorithm_values should have the value 202403L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_default_template_type_for_algorithm_values
+#      error "__cpp_lib_default_template_type_for_algorithm_values should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_erase_if
+#    error "__cpp_lib_erase_if should be defined in c++29"
+#  endif
+#  if __cpp_lib_erase_if != 202002L
+#    error "__cpp_lib_erase_if should have the value 202002L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_nonmember_container_access
+#    error "__cpp_lib_nonmember_container_access should be defined in c++29"
+#  endif
+#  if __cpp_lib_nonmember_container_access != 201411L
+#    error "__cpp_lib_nonmember_container_access should have the value 201411L in c++29"
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/embed.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/embed.version.compile.pass.cpp
new file mode 100644
index 0000000000000..241c29bb41697
--- /dev/null
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/embed.version.compile.pass.cpp
@@ -0,0 +1,68 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// WARNING: This test was generated by generate_feature_test_macro_components.py
+// and should not be edited manually.
+
+// <embed>
+
+// Test the feature test macros defined by <embed>
+
+// clang-format off
+
+#include <embed>
+#include "test_macros.h"
+
+#if TEST_STD_VER < 14
+
+#  ifdef __cpp_lib_embed
+#    error "__cpp_lib_embed should not be defined before c++29"
+#  endif
+
+#elif TEST_STD_VER == 14
+
+#  ifdef __cpp_lib_embed
+#    error "__cpp_lib_embed should not be defined before c++29"
+#  endif
+
+#elif TEST_STD_VER == 17
+
+#  ifdef __cpp_lib_embed
+#    error "__cpp_lib_embed should not be defined before c++29"
+#  endif
+
+#elif TEST_STD_VER == 20
+
+#  ifdef __cpp_lib_embed
+#    error "__cpp_lib_embed should not be defined before c++29"
+#  endif
+
+#elif TEST_STD_VER == 23
+
+#  ifdef __cpp_lib_embed
+#    error "__cpp_lib_embed should not be defined before c++29"
+#  endif
+
+#elif TEST_STD_VER == 26
+
+#  ifdef __cpp_lib_embed
+#    error "__cpp_lib_embed should not be defined before c++29"
+#  endif
+
+#elif TEST_STD_VER > 26
+
+#  ifndef __cpp_lib_embed
+#    error "__cpp_lib_embed should be defined in c++29"
+#  endif
+#  if __cpp_lib_embed != 202606L
+#    error "__cpp_lib_embed should have the value 202606L in c++29"
+#  endif
+
+#endif // TEST_STD_VER > 26
+
+// clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/exception.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/exception.version.compile.pass.cpp
index 11d5735007f5b..8d15c9297f0d4 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/exception.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/exception.version.compile.pass.cpp
@@ -57,7 +57,7 @@
 #    error "__cpp_lib_uncaught_exceptions should have the value 201411L in c++23"
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  ifndef __cpp_lib_uncaught_exceptions
 #    error "__cpp_lib_uncaught_exceptions should be defined in c++26"
@@ -66,6 +66,15 @@
 #    error "__cpp_lib_uncaught_exceptions should have the value 201411L in c++26"
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  ifndef __cpp_lib_uncaught_exceptions
+#    error "__cpp_lib_uncaught_exceptions should be defined in c++29"
+#  endif
+#  if __cpp_lib_uncaught_exceptions != 201411L
+#    error "__cpp_lib_uncaught_exceptions should have the value 201411L in c++29"
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/execution.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/execution.version.compile.pass.cpp
index 77a6455e23302..da849ec6296d4 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/execution.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/execution.version.compile.pass.cpp
@@ -95,7 +95,7 @@
 #    error "__cpp_lib_senders should not be defined before c++26"
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  if !defined(_LIBCPP_VERSION)
 #    ifndef __cpp_lib_execution
@@ -123,6 +123,34 @@
 #    endif
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_execution
+#      error "__cpp_lib_execution should be defined in c++29"
+#    endif
+#    if __cpp_lib_execution != 201902L
+#      error "__cpp_lib_execution should have the value 201902L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_execution
+#      error "__cpp_lib_execution should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_senders
+#      error "__cpp_lib_senders should be defined in c++29"
+#    endif
+#    if __cpp_lib_senders != 202406L
+#      error "__cpp_lib_senders should have the value 202406L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_senders
+#      error "__cpp_lib_senders should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/expected.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/expected.version.compile.pass.cpp
index 4ec6c469dce4c..7c25c805a940e 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/expected.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/expected.version.compile.pass.cpp
@@ -91,7 +91,7 @@
 #    error "__cpp_lib_freestanding_expected should not be defined before c++26"
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  ifndef __cpp_lib_constrained_equality
 #    error "__cpp_lib_constrained_equality should be defined in c++26"
@@ -120,6 +120,35 @@
 #    endif
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  ifndef __cpp_lib_constrained_equality
+#    error "__cpp_lib_constrained_equality should be defined in c++29"
+#  endif
+#  if __cpp_lib_constrained_equality != 202411L
+#    error "__cpp_lib_constrained_equality should have the value 202411L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_expected
+#    error "__cpp_lib_expected should be defined in c++29"
+#  endif
+#  if __cpp_lib_expected != 202211L
+#    error "__cpp_lib_expected should have the value 202211L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_freestanding_expected
+#      error "__cpp_lib_freestanding_expected should be defined in c++29"
+#    endif
+#    if __cpp_lib_freestanding_expected != 202311L
+#      error "__cpp_lib_freestanding_expected should have the value 202311L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_freestanding_expected
+#      error "__cpp_lib_freestanding_expected should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/filesystem.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/filesystem.version.compile.pass.cpp
index 70ba1800f64f1..de5117a28bdbe 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/filesystem.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/filesystem.version.compile.pass.cpp
@@ -135,7 +135,7 @@
 #    error "__cpp_lib_format_path should not be defined before c++26"
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  if defined(__cpp_char8_t)
 #    ifndef __cpp_lib_char8_t
@@ -176,6 +176,47 @@
 #    endif
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  if defined(__cpp_char8_t)
+#    ifndef __cpp_lib_char8_t
+#      error "__cpp_lib_char8_t should be defined in c++29"
+#    endif
+#    if __cpp_lib_char8_t != 201907L
+#      error "__cpp_lib_char8_t should have the value 201907L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_char8_t
+#      error "__cpp_lib_char8_t should not be defined when the requirement 'defined(__cpp_char8_t)' is not met!"
+#    endif
+#  endif
+
+#  if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_FILESYSTEM
+#    ifndef __cpp_lib_filesystem
+#      error "__cpp_lib_filesystem should be defined in c++29"
+#    endif
+#    if __cpp_lib_filesystem != 201703L
+#      error "__cpp_lib_filesystem should have the value 201703L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_filesystem
+#      error "__cpp_lib_filesystem should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_FILESYSTEM' is not met!"
+#    endif
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_format_path
+#      error "__cpp_lib_format_path should be defined in c++29"
+#    endif
+#    if __cpp_lib_format_path != 202403L
+#      error "__cpp_lib_format_path should have the value 202403L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_format_path
+#      error "__cpp_lib_format_path should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/flat_map.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/flat_map.version.compile.pass.cpp
index 34820de6a53aa..d0489eadb2578 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/flat_map.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/flat_map.version.compile.pass.cpp
@@ -71,7 +71,7 @@
 #    error "__cpp_lib_flat_map should have the value 202511L in c++23"
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  ifndef __cpp_lib_constexpr_flat_map
 #    error "__cpp_lib_constexpr_flat_map should be defined in c++26"
@@ -87,6 +87,22 @@
 #    error "__cpp_lib_flat_map should have the value 202511L in c++26"
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  ifndef __cpp_lib_constexpr_flat_map
+#    error "__cpp_lib_constexpr_flat_map should be defined in c++29"
+#  endif
+#  if __cpp_lib_constexpr_flat_map != 202502L
+#    error "__cpp_lib_constexpr_flat_map should have the value 202502L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_flat_map
+#    error "__cpp_lib_flat_map should be defined in c++29"
+#  endif
+#  if __cpp_lib_flat_map != 202511L
+#    error "__cpp_lib_flat_map should have the value 202511L in c++29"
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/flat_set.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/flat_set.version.compile.pass.cpp
index 725e5107c8997..7c1cba1d1d578 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/flat_set.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/flat_set.version.compile.pass.cpp
@@ -71,7 +71,7 @@
 #    error "__cpp_lib_flat_set should have the value 202511L in c++23"
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  ifndef __cpp_lib_constexpr_flat_set
 #    error "__cpp_lib_constexpr_flat_set should be defined in c++26"
@@ -87,6 +87,22 @@
 #    error "__cpp_lib_flat_set should have the value 202511L in c++26"
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  ifndef __cpp_lib_constexpr_flat_set
+#    error "__cpp_lib_constexpr_flat_set should be defined in c++29"
+#  endif
+#  if __cpp_lib_constexpr_flat_set != 202502L
+#    error "__cpp_lib_constexpr_flat_set should have the value 202502L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_flat_set
+#    error "__cpp_lib_flat_set should be defined in c++29"
+#  endif
+#  if __cpp_lib_flat_set != 202511L
+#    error "__cpp_lib_flat_set should have the value 202511L in c++29"
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/format.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/format.version.compile.pass.cpp
index 77730f17fd9c6..af6a25c057c2f 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/format.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/format.version.compile.pass.cpp
@@ -115,7 +115,7 @@
 #    error "__cpp_lib_format_uchar should have the value 202311L in c++23"
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  if !defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_TO_CHARS_FLOATING_POINT
 #    ifndef __cpp_lib_format
@@ -144,6 +144,35 @@
 #    error "__cpp_lib_format_uchar should have the value 202311L in c++26"
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  if !defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_TO_CHARS_FLOATING_POINT
+#    ifndef __cpp_lib_format
+#      error "__cpp_lib_format should be defined in c++29"
+#    endif
+#    if __cpp_lib_format != 202110L
+#      error "__cpp_lib_format should have the value 202110L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_format
+#      error "__cpp_lib_format should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_TO_CHARS_FLOATING_POINT' is not met!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_format_ranges
+#    error "__cpp_lib_format_ranges should be defined in c++29"
+#  endif
+#  if __cpp_lib_format_ranges != 202207L
+#    error "__cpp_lib_format_ranges should have the value 202207L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_format_uchar
+#    error "__cpp_lib_format_uchar should be defined in c++29"
+#  endif
+#  if __cpp_lib_format_uchar != 202311L
+#    error "__cpp_lib_format_uchar should have the value 202311L in c++29"
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/forward_list.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/forward_list.version.compile.pass.cpp
index d2082946597cb..e2e7c750decd2 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/forward_list.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/forward_list.version.compile.pass.cpp
@@ -230,7 +230,7 @@
 #    error "__cpp_lib_nonmember_container_access should have the value 201411L in c++23"
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  ifndef __cpp_lib_allocator_traits_is_always_equal
 #    error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++26"
@@ -294,6 +294,70 @@
 #    error "__cpp_lib_nonmember_container_access should have the value 201411L in c++26"
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  ifndef __cpp_lib_allocator_traits_is_always_equal
+#    error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++29"
+#  endif
+#  if __cpp_lib_allocator_traits_is_always_equal != 201411L
+#    error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_constexpr_forward_list
+#    error "__cpp_lib_constexpr_forward_list should be defined in c++29"
+#  endif
+#  if __cpp_lib_constexpr_forward_list != 202502L
+#    error "__cpp_lib_constexpr_forward_list should have the value 202502L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_containers_ranges
+#    error "__cpp_lib_containers_ranges should be defined in c++29"
+#  endif
+#  if __cpp_lib_containers_ranges != 202202L
+#    error "__cpp_lib_containers_ranges should have the value 202202L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_default_template_type_for_algorithm_values
+#      error "__cpp_lib_default_template_type_for_algorithm_values should be defined in c++29"
+#    endif
+#    if __cpp_lib_default_template_type_for_algorithm_values != 202403L
+#      error "__cpp_lib_default_template_type_for_algorithm_values should have the value 202403L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_default_template_type_for_algorithm_values
+#      error "__cpp_lib_default_template_type_for_algorithm_values should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_erase_if
+#    error "__cpp_lib_erase_if should be defined in c++29"
+#  endif
+#  if __cpp_lib_erase_if != 202002L
+#    error "__cpp_lib_erase_if should have the value 202002L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_incomplete_container_elements
+#    error "__cpp_lib_incomplete_container_elements should be defined in c++29"
+#  endif
+#  if __cpp_lib_incomplete_container_elements != 201505L
+#    error "__cpp_lib_incomplete_container_elements should have the value 201505L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_list_remove_return_type
+#    error "__cpp_lib_list_remove_return_type should be defined in c++29"
+#  endif
+#  if __cpp_lib_list_remove_return_type != 201806L
+#    error "__cpp_lib_list_remove_return_type should have the value 201806L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_nonmember_container_access
+#    error "__cpp_lib_nonmember_container_access should be defined in c++29"
+#  endif
+#  if __cpp_lib_nonmember_container_access != 201411L
+#    error "__cpp_lib_nonmember_container_access should have the value 201411L in c++29"
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/fstream.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/fstream.version.compile.pass.cpp
index f67adb0de1ded..56a41997c2b35 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/fstream.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/fstream.version.compile.pass.cpp
@@ -50,7 +50,7 @@
 #    error "__cpp_lib_fstream_native_handle should not be defined before c++26"
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  if !defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION)
 #    ifndef __cpp_lib_fstream_native_handle
@@ -65,6 +65,21 @@
 #    endif
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  if !defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION)
+#    ifndef __cpp_lib_fstream_native_handle
+#      error "__cpp_lib_fstream_native_handle should be defined in c++29"
+#    endif
+#    if __cpp_lib_fstream_native_handle != 202306L
+#      error "__cpp_lib_fstream_native_handle should have the value 202306L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_fstream_native_handle
+#      error "__cpp_lib_fstream_native_handle should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION)' is not met!"
+#    endif
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/functional.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/functional.version.compile.pass.cpp
index b7b7d0334830a..b6ddfd2c68e82 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/functional.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/functional.version.compile.pass.cpp
@@ -444,7 +444,7 @@
 #    error "__cpp_lib_unwrap_ref should have the value 201811L in c++23"
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  ifndef __cpp_lib_bind_back
 #    error "__cpp_lib_bind_back should be defined in c++26"
@@ -576,6 +576,138 @@
 #    error "__cpp_lib_unwrap_ref should have the value 201811L in c++26"
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  ifndef __cpp_lib_bind_back
+#    error "__cpp_lib_bind_back should be defined in c++29"
+#  endif
+#  if __cpp_lib_bind_back != 202202L
+#    error "__cpp_lib_bind_back should have the value 202202L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_bind_front
+#    error "__cpp_lib_bind_front should be defined in c++29"
+#  endif
+#  if __cpp_lib_bind_front != 202306L
+#    error "__cpp_lib_bind_front should have the value 202306L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_boyer_moore_searcher
+#    error "__cpp_lib_boyer_moore_searcher should be defined in c++29"
+#  endif
+#  if __cpp_lib_boyer_moore_searcher != 201603L
+#    error "__cpp_lib_boyer_moore_searcher should have the value 201603L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_common_reference_wrapper
+#    error "__cpp_lib_common_reference_wrapper should be defined in c++29"
+#  endif
+#  if __cpp_lib_common_reference_wrapper != 202302L
+#    error "__cpp_lib_common_reference_wrapper should have the value 202302L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_constexpr_functional
+#    error "__cpp_lib_constexpr_functional should be defined in c++29"
+#  endif
+#  if __cpp_lib_constexpr_functional != 201907L
+#    error "__cpp_lib_constexpr_functional should have the value 201907L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_copyable_function
+#      error "__cpp_lib_copyable_function should be defined in c++29"
+#    endif
+#    if __cpp_lib_copyable_function != 202306L
+#      error "__cpp_lib_copyable_function should have the value 202306L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_copyable_function
+#      error "__cpp_lib_copyable_function should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_function_ref
+#      error "__cpp_lib_function_ref should be defined in c++29"
+#    endif
+#    if __cpp_lib_function_ref != 202306L
+#      error "__cpp_lib_function_ref should have the value 202306L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_function_ref
+#      error "__cpp_lib_function_ref should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_invoke
+#    error "__cpp_lib_invoke should be defined in c++29"
+#  endif
+#  if __cpp_lib_invoke != 201411L
+#    error "__cpp_lib_invoke should have the value 201411L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_invoke_r
+#    error "__cpp_lib_invoke_r should be defined in c++29"
+#  endif
+#  if __cpp_lib_invoke_r != 202106L
+#    error "__cpp_lib_invoke_r should have the value 202106L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_move_only_function
+#      error "__cpp_lib_move_only_function should be defined in c++29"
+#    endif
+#    if __cpp_lib_move_only_function != 202110L
+#      error "__cpp_lib_move_only_function should have the value 202110L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_move_only_function
+#      error "__cpp_lib_move_only_function should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_not_fn
+#    error "__cpp_lib_not_fn should be defined in c++29"
+#  endif
+#  if __cpp_lib_not_fn != 202306L
+#    error "__cpp_lib_not_fn should have the value 202306L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_ranges
+#    error "__cpp_lib_ranges should be defined in c++29"
+#  endif
+#  if __cpp_lib_ranges != 202406L
+#    error "__cpp_lib_ranges should have the value 202406L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_reference_wrapper
+#    error "__cpp_lib_reference_wrapper should be defined in c++29"
+#  endif
+#  if __cpp_lib_reference_wrapper != 202403L
+#    error "__cpp_lib_reference_wrapper should have the value 202403L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_result_of_sfinae
+#    error "__cpp_lib_result_of_sfinae should be defined in c++29"
+#  endif
+#  if __cpp_lib_result_of_sfinae != 201210L
+#    error "__cpp_lib_result_of_sfinae should have the value 201210L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_transparent_operators
+#    error "__cpp_lib_transparent_operators should be defined in c++29"
+#  endif
+#  if __cpp_lib_transparent_operators != 201510L
+#    error "__cpp_lib_transparent_operators should have the value 201510L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_unwrap_ref
+#    error "__cpp_lib_unwrap_ref should be defined in c++29"
+#  endif
+#  if __cpp_lib_unwrap_ref != 201811L
+#    error "__cpp_lib_unwrap_ref should have the value 201811L in c++29"
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/iomanip.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/iomanip.version.compile.pass.cpp
index 4de327cbfa26b..33e11f3d6afa2 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/iomanip.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/iomanip.version.compile.pass.cpp
@@ -86,7 +86,7 @@
 #    endif
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_LOCALIZATION
 #    ifndef __cpp_lib_quoted_string_io
@@ -101,6 +101,21 @@
 #    endif
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_LOCALIZATION
+#    ifndef __cpp_lib_quoted_string_io
+#      error "__cpp_lib_quoted_string_io should be defined in c++29"
+#    endif
+#    if __cpp_lib_quoted_string_io != 201304L
+#      error "__cpp_lib_quoted_string_io should have the value 201304L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_quoted_string_io
+#      error "__cpp_lib_quoted_string_io should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_LOCALIZATION' is not met!"
+#    endif
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/ios.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/ios.version.compile.pass.cpp
index 68816936c55e9..91c5f7c1f5901 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/ios.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/ios.version.compile.pass.cpp
@@ -53,7 +53,7 @@
 #    error "__cpp_lib_ios_noreplace should have the value 202207L in c++23"
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  ifndef __cpp_lib_ios_noreplace
 #    error "__cpp_lib_ios_noreplace should be defined in c++26"
@@ -62,6 +62,15 @@
 #    error "__cpp_lib_ios_noreplace should have the value 202207L in c++26"
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  ifndef __cpp_lib_ios_noreplace
+#    error "__cpp_lib_ios_noreplace should be defined in c++29"
+#  endif
+#  if __cpp_lib_ios_noreplace != 202207L
+#    error "__cpp_lib_ios_noreplace should have the value 202207L in c++29"
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/istream.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/istream.version.compile.pass.cpp
index a1178b22776f1..42e95edb5d7da 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/istream.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/istream.version.compile.pass.cpp
@@ -68,7 +68,7 @@
 #    endif
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  if defined(__cpp_char8_t)
 #    ifndef __cpp_lib_char8_t
@@ -83,6 +83,21 @@
 #    endif
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  if defined(__cpp_char8_t)
+#    ifndef __cpp_lib_char8_t
+#      error "__cpp_lib_char8_t should be defined in c++29"
+#    endif
+#    if __cpp_lib_char8_t != 201907L
+#      error "__cpp_lib_char8_t should have the value 201907L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_char8_t
+#      error "__cpp_lib_char8_t should not be defined when the requirement 'defined(__cpp_char8_t)' is not met!"
+#    endif
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/iterator.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/iterator.version.compile.pass.cpp
index e9805ed4b1542..bb251f001b42a 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/iterator.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/iterator.version.compile.pass.cpp
@@ -254,7 +254,7 @@
 #    error "__cpp_lib_ssize should have the value 201902L in c++23"
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  ifndef __cpp_lib_array_constexpr
 #    error "__cpp_lib_array_constexpr should be defined in c++26"
@@ -312,6 +312,64 @@
 #    error "__cpp_lib_ssize should have the value 201902L in c++26"
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  ifndef __cpp_lib_array_constexpr
+#    error "__cpp_lib_array_constexpr should be defined in c++29"
+#  endif
+#  if __cpp_lib_array_constexpr != 201811L
+#    error "__cpp_lib_array_constexpr should have the value 201811L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_constexpr_iterator
+#    error "__cpp_lib_constexpr_iterator should be defined in c++29"
+#  endif
+#  if __cpp_lib_constexpr_iterator != 201811L
+#    error "__cpp_lib_constexpr_iterator should have the value 201811L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_make_reverse_iterator
+#    error "__cpp_lib_make_reverse_iterator should be defined in c++29"
+#  endif
+#  if __cpp_lib_make_reverse_iterator != 201402L
+#    error "__cpp_lib_make_reverse_iterator should have the value 201402L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_move_iterator_concept
+#    error "__cpp_lib_move_iterator_concept should be defined in c++29"
+#  endif
+#  if __cpp_lib_move_iterator_concept != 202207L
+#    error "__cpp_lib_move_iterator_concept should have the value 202207L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_nonmember_container_access
+#    error "__cpp_lib_nonmember_container_access should be defined in c++29"
+#  endif
+#  if __cpp_lib_nonmember_container_access != 201411L
+#    error "__cpp_lib_nonmember_container_access should have the value 201411L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_null_iterators
+#    error "__cpp_lib_null_iterators should be defined in c++29"
+#  endif
+#  if __cpp_lib_null_iterators != 201304L
+#    error "__cpp_lib_null_iterators should have the value 201304L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_ranges
+#    error "__cpp_lib_ranges should be defined in c++29"
+#  endif
+#  if __cpp_lib_ranges != 202406L
+#    error "__cpp_lib_ranges should have the value 202406L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_ssize
+#    error "__cpp_lib_ssize should be defined in c++29"
+#  endif
+#  if __cpp_lib_ssize != 201902L
+#    error "__cpp_lib_ssize should have the value 201902L in c++29"
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/latch.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/latch.version.compile.pass.cpp
index 8be3c800c9ba8..f593764cd8c85 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/latch.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/latch.version.compile.pass.cpp
@@ -68,7 +68,7 @@
 #    endif
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
 #    ifndef __cpp_lib_latch
@@ -83,6 +83,21 @@
 #    endif
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
+#    ifndef __cpp_lib_latch
+#      error "__cpp_lib_latch should be defined in c++29"
+#    endif
+#    if __cpp_lib_latch != 201907L
+#      error "__cpp_lib_latch should have the value 201907L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_latch
+#      error "__cpp_lib_latch should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
+#    endif
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/limits.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/limits.version.compile.pass.cpp
index f4cc8db0f54cb..fb18e3a88a693 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/limits.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/limits.version.compile.pass.cpp
@@ -66,7 +66,7 @@
 #    endif
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  if defined(__cpp_char8_t)
 #    ifndef __cpp_lib_char8_t
@@ -81,6 +81,21 @@
 #    endif
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  if defined(__cpp_char8_t)
+#    ifndef __cpp_lib_char8_t
+#      error "__cpp_lib_char8_t should be defined in c++29"
+#    endif
+#    if __cpp_lib_char8_t != 201907L
+#      error "__cpp_lib_char8_t should have the value 201907L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_char8_t
+#      error "__cpp_lib_char8_t should not be defined when the requirement 'defined(__cpp_char8_t)' is not met!"
+#    endif
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/list.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/list.version.compile.pass.cpp
index 1407d74e03aa2..15aa665c0fea0 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/list.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/list.version.compile.pass.cpp
@@ -230,7 +230,7 @@
 #    error "__cpp_lib_nonmember_container_access should have the value 201411L in c++23"
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  ifndef __cpp_lib_allocator_traits_is_always_equal
 #    error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++26"
@@ -294,6 +294,70 @@
 #    error "__cpp_lib_nonmember_container_access should have the value 201411L in c++26"
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  ifndef __cpp_lib_allocator_traits_is_always_equal
+#    error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++29"
+#  endif
+#  if __cpp_lib_allocator_traits_is_always_equal != 201411L
+#    error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_constexpr_list
+#    error "__cpp_lib_constexpr_list should be defined in c++29"
+#  endif
+#  if __cpp_lib_constexpr_list != 202502L
+#    error "__cpp_lib_constexpr_list should have the value 202502L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_containers_ranges
+#    error "__cpp_lib_containers_ranges should be defined in c++29"
+#  endif
+#  if __cpp_lib_containers_ranges != 202202L
+#    error "__cpp_lib_containers_ranges should have the value 202202L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_default_template_type_for_algorithm_values
+#      error "__cpp_lib_default_template_type_for_algorithm_values should be defined in c++29"
+#    endif
+#    if __cpp_lib_default_template_type_for_algorithm_values != 202403L
+#      error "__cpp_lib_default_template_type_for_algorithm_values should have the value 202403L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_default_template_type_for_algorithm_values
+#      error "__cpp_lib_default_template_type_for_algorithm_values should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_erase_if
+#    error "__cpp_lib_erase_if should be defined in c++29"
+#  endif
+#  if __cpp_lib_erase_if != 202002L
+#    error "__cpp_lib_erase_if should have the value 202002L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_incomplete_container_elements
+#    error "__cpp_lib_incomplete_container_elements should be defined in c++29"
+#  endif
+#  if __cpp_lib_incomplete_container_elements != 201505L
+#    error "__cpp_lib_incomplete_container_elements should have the value 201505L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_list_remove_return_type
+#    error "__cpp_lib_list_remove_return_type should be defined in c++29"
+#  endif
+#  if __cpp_lib_list_remove_return_type != 201806L
+#    error "__cpp_lib_list_remove_return_type should have the value 201806L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_nonmember_container_access
+#    error "__cpp_lib_nonmember_container_access should be defined in c++29"
+#  endif
+#  if __cpp_lib_nonmember_container_access != 201411L
+#    error "__cpp_lib_nonmember_container_access should have the value 201411L in c++29"
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/locale.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/locale.version.compile.pass.cpp
index f516881651b23..2b93c27899adc 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/locale.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/locale.version.compile.pass.cpp
@@ -68,7 +68,7 @@
 #    endif
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  if defined(__cpp_char8_t)
 #    ifndef __cpp_lib_char8_t
@@ -83,6 +83,21 @@
 #    endif
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  if defined(__cpp_char8_t)
+#    ifndef __cpp_lib_char8_t
+#      error "__cpp_lib_char8_t should be defined in c++29"
+#    endif
+#    if __cpp_lib_char8_t != 201907L
+#      error "__cpp_lib_char8_t should have the value 201907L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_char8_t
+#      error "__cpp_lib_char8_t should not be defined when the requirement 'defined(__cpp_char8_t)' is not met!"
+#    endif
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/map.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/map.version.compile.pass.cpp
index 3db3861c72b5c..6c5a4a860b7b0 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/map.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/map.version.compile.pass.cpp
@@ -303,7 +303,7 @@
 #    endif
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  ifndef __cpp_lib_allocator_traits_is_always_equal
 #    error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++26"
@@ -393,6 +393,96 @@
 #    endif
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  ifndef __cpp_lib_allocator_traits_is_always_equal
+#    error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++29"
+#  endif
+#  if __cpp_lib_allocator_traits_is_always_equal != 201411L
+#    error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_associative_heterogeneous_erasure
+#      error "__cpp_lib_associative_heterogeneous_erasure should be defined in c++29"
+#    endif
+#    if __cpp_lib_associative_heterogeneous_erasure != 202110L
+#      error "__cpp_lib_associative_heterogeneous_erasure should have the value 202110L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_associative_heterogeneous_erasure
+#      error "__cpp_lib_associative_heterogeneous_erasure should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_associative_heterogeneous_insertion
+#      error "__cpp_lib_associative_heterogeneous_insertion should be defined in c++29"
+#    endif
+#    if __cpp_lib_associative_heterogeneous_insertion != 202306L
+#      error "__cpp_lib_associative_heterogeneous_insertion should have the value 202306L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_associative_heterogeneous_insertion
+#      error "__cpp_lib_associative_heterogeneous_insertion should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_containers_ranges
+#    error "__cpp_lib_containers_ranges should be defined in c++29"
+#  endif
+#  if __cpp_lib_containers_ranges != 202202L
+#    error "__cpp_lib_containers_ranges should have the value 202202L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_erase_if
+#    error "__cpp_lib_erase_if should be defined in c++29"
+#  endif
+#  if __cpp_lib_erase_if != 202002L
+#    error "__cpp_lib_erase_if should have the value 202002L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_generic_associative_lookup
+#    error "__cpp_lib_generic_associative_lookup should be defined in c++29"
+#  endif
+#  if __cpp_lib_generic_associative_lookup != 201304L
+#    error "__cpp_lib_generic_associative_lookup should have the value 201304L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_map_try_emplace
+#    error "__cpp_lib_map_try_emplace should be defined in c++29"
+#  endif
+#  if __cpp_lib_map_try_emplace != 201411L
+#    error "__cpp_lib_map_try_emplace should have the value 201411L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_node_extract
+#    error "__cpp_lib_node_extract should be defined in c++29"
+#  endif
+#  if __cpp_lib_node_extract != 201606L
+#    error "__cpp_lib_node_extract should have the value 201606L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_nonmember_container_access
+#    error "__cpp_lib_nonmember_container_access should be defined in c++29"
+#  endif
+#  if __cpp_lib_nonmember_container_access != 201411L
+#    error "__cpp_lib_nonmember_container_access should have the value 201411L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_tuple_like
+#      error "__cpp_lib_tuple_like should be defined in c++29"
+#    endif
+#    if __cpp_lib_tuple_like != 202311L
+#      error "__cpp_lib_tuple_like should have the value 202311L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_tuple_like
+#      error "__cpp_lib_tuple_like should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/mdspan.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/mdspan.version.compile.pass.cpp
index fad0e5b9777dd..051a307d31890 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/mdspan.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/mdspan.version.compile.pass.cpp
@@ -111,7 +111,7 @@
 #    error "__cpp_lib_submdspan should not be defined before c++26"
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  ifndef __cpp_lib_aligned_accessor
 #    error "__cpp_lib_aligned_accessor should be defined in c++26"
@@ -153,6 +153,48 @@
 #    endif
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  ifndef __cpp_lib_aligned_accessor
+#    error "__cpp_lib_aligned_accessor should be defined in c++29"
+#  endif
+#  if __cpp_lib_aligned_accessor != 202411L
+#    error "__cpp_lib_aligned_accessor should have the value 202411L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_freestanding_mdspan
+#      error "__cpp_lib_freestanding_mdspan should be defined in c++29"
+#    endif
+#    if __cpp_lib_freestanding_mdspan != 202311L
+#      error "__cpp_lib_freestanding_mdspan should have the value 202311L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_freestanding_mdspan
+#      error "__cpp_lib_freestanding_mdspan should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_mdspan
+#    error "__cpp_lib_mdspan should be defined in c++29"
+#  endif
+#  if __cpp_lib_mdspan != 202406L
+#    error "__cpp_lib_mdspan should have the value 202406L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_submdspan
+#      error "__cpp_lib_submdspan should be defined in c++29"
+#    endif
+#    if __cpp_lib_submdspan != 202306L
+#      error "__cpp_lib_submdspan should have the value 202306L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_submdspan
+#      error "__cpp_lib_submdspan should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/memory.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/memory.version.compile.pass.cpp
index f287e1ad9b3ad..db7e309a582c5 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/memory.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/memory.version.compile.pass.cpp
@@ -534,7 +534,7 @@
 #    error "__cpp_lib_transparent_operators should have the value 201510L in c++23"
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  ifndef __cpp_lib_addressof_constexpr
 #    error "__cpp_lib_addressof_constexpr should be defined in c++26"
@@ -675,6 +675,147 @@
 #    error "__cpp_lib_transparent_operators should have the value 201510L in c++26"
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  ifndef __cpp_lib_addressof_constexpr
+#    error "__cpp_lib_addressof_constexpr should be defined in c++29"
+#  endif
+#  if __cpp_lib_addressof_constexpr != 201603L
+#    error "__cpp_lib_addressof_constexpr should have the value 201603L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_allocate_at_least
+#    error "__cpp_lib_allocate_at_least should be defined in c++29"
+#  endif
+#  if __cpp_lib_allocate_at_least != 202302L
+#    error "__cpp_lib_allocate_at_least should have the value 202302L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_allocator_traits_is_always_equal
+#    error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++29"
+#  endif
+#  if __cpp_lib_allocator_traits_is_always_equal != 201411L
+#    error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_assume_aligned
+#    error "__cpp_lib_assume_aligned should be defined in c++29"
+#  endif
+#  if __cpp_lib_assume_aligned != 201811L
+#    error "__cpp_lib_assume_aligned should have the value 201811L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_atomic_value_initialization
+#    error "__cpp_lib_atomic_value_initialization should be defined in c++29"
+#  endif
+#  if __cpp_lib_atomic_value_initialization != 201911L
+#    error "__cpp_lib_atomic_value_initialization should have the value 201911L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_constexpr_dynamic_alloc
+#    error "__cpp_lib_constexpr_dynamic_alloc should be defined in c++29"
+#  endif
+#  if __cpp_lib_constexpr_dynamic_alloc != 201907L
+#    error "__cpp_lib_constexpr_dynamic_alloc should have the value 201907L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_constexpr_memory
+#    error "__cpp_lib_constexpr_memory should be defined in c++29"
+#  endif
+#  if __cpp_lib_constexpr_memory != 202202L
+#    error "__cpp_lib_constexpr_memory should have the value 202202L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_enable_shared_from_this
+#    error "__cpp_lib_enable_shared_from_this should be defined in c++29"
+#  endif
+#  if __cpp_lib_enable_shared_from_this != 201603L
+#    error "__cpp_lib_enable_shared_from_this should have the value 201603L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_is_sufficiently_aligned
+#    error "__cpp_lib_is_sufficiently_aligned should be defined in c++29"
+#  endif
+#  if __cpp_lib_is_sufficiently_aligned != 202411L
+#    error "__cpp_lib_is_sufficiently_aligned should have the value 202411L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_make_unique
+#    error "__cpp_lib_make_unique should be defined in c++29"
+#  endif
+#  if __cpp_lib_make_unique != 201304L
+#    error "__cpp_lib_make_unique should have the value 201304L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_out_ptr
+#    error "__cpp_lib_out_ptr should be defined in c++29"
+#  endif
+#  if __cpp_lib_out_ptr != 202311L
+#    error "__cpp_lib_out_ptr should have the value 202311L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_ranges
+#    error "__cpp_lib_ranges should be defined in c++29"
+#  endif
+#  if __cpp_lib_ranges != 202406L
+#    error "__cpp_lib_ranges should have the value 202406L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_raw_memory_algorithms
+#    error "__cpp_lib_raw_memory_algorithms should be defined in c++29"
+#  endif
+#  if __cpp_lib_raw_memory_algorithms != 201606L
+#    error "__cpp_lib_raw_memory_algorithms should have the value 201606L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_shared_ptr_arrays
+#    error "__cpp_lib_shared_ptr_arrays should be defined in c++29"
+#  endif
+#  if __cpp_lib_shared_ptr_arrays != 201707L
+#    error "__cpp_lib_shared_ptr_arrays should have the value 201707L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_shared_ptr_weak_type
+#    error "__cpp_lib_shared_ptr_weak_type should be defined in c++29"
+#  endif
+#  if __cpp_lib_shared_ptr_weak_type != 201606L
+#    error "__cpp_lib_shared_ptr_weak_type should have the value 201606L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_smart_ptr_for_overwrite
+#    error "__cpp_lib_smart_ptr_for_overwrite should be defined in c++29"
+#  endif
+#  if __cpp_lib_smart_ptr_for_overwrite != 202002L
+#    error "__cpp_lib_smart_ptr_for_overwrite should have the value 202002L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_smart_ptr_owner_equality
+#      error "__cpp_lib_smart_ptr_owner_equality should be defined in c++29"
+#    endif
+#    if __cpp_lib_smart_ptr_owner_equality != 202306L
+#      error "__cpp_lib_smart_ptr_owner_equality should have the value 202306L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_smart_ptr_owner_equality
+#      error "__cpp_lib_smart_ptr_owner_equality should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_to_address
+#    error "__cpp_lib_to_address should be defined in c++29"
+#  endif
+#  if __cpp_lib_to_address != 201711L
+#    error "__cpp_lib_to_address should have the value 201711L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_transparent_operators
+#    error "__cpp_lib_transparent_operators should be defined in c++29"
+#  endif
+#  if __cpp_lib_transparent_operators != 201510L
+#    error "__cpp_lib_transparent_operators should have the value 201510L in c++29"
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/memory_resource.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/memory_resource.version.compile.pass.cpp
index dddf473f86a42..045e7c280e049 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/memory_resource.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/memory_resource.version.compile.pass.cpp
@@ -113,7 +113,7 @@
 #    endif
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  if !defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_PMR
 #    ifndef __cpp_lib_memory_resource
@@ -141,6 +141,34 @@
 #    endif
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  if !defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_PMR
+#    ifndef __cpp_lib_memory_resource
+#      error "__cpp_lib_memory_resource should be defined in c++29"
+#    endif
+#    if __cpp_lib_memory_resource != 201603L
+#      error "__cpp_lib_memory_resource should have the value 201603L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_memory_resource
+#      error "__cpp_lib_memory_resource should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_PMR' is not met!"
+#    endif
+#  endif
+
+#  if !defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_PMR
+#    ifndef __cpp_lib_polymorphic_allocator
+#      error "__cpp_lib_polymorphic_allocator should be defined in c++29"
+#    endif
+#    if __cpp_lib_polymorphic_allocator != 201902L
+#      error "__cpp_lib_polymorphic_allocator should have the value 201902L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_polymorphic_allocator
+#      error "__cpp_lib_polymorphic_allocator should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_PMR' is not met!"
+#    endif
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/mutex.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/mutex.version.compile.pass.cpp
index 5ffa5df8841c9..faa8f5b9fe960 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/mutex.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/mutex.version.compile.pass.cpp
@@ -77,7 +77,7 @@
 #    endif
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
 #    ifndef __cpp_lib_scoped_lock
@@ -92,6 +92,21 @@
 #    endif
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
+#    ifndef __cpp_lib_scoped_lock
+#      error "__cpp_lib_scoped_lock should be defined in c++29"
+#    endif
+#    if __cpp_lib_scoped_lock != 201703L
+#      error "__cpp_lib_scoped_lock should have the value 201703L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_scoped_lock
+#      error "__cpp_lib_scoped_lock should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
+#    endif
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/new.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/new.version.compile.pass.cpp
index fd2332f104f3e..7b6e3b152dd8e 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/new.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/new.version.compile.pass.cpp
@@ -144,7 +144,7 @@
 #    error "__cpp_lib_launder should have the value 201606L in c++23"
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  if !defined(_LIBCPP_ABI_VCRUNTIME)
 #    ifndef __cpp_lib_constexpr_new
@@ -186,6 +186,48 @@
 #    error "__cpp_lib_launder should have the value 201606L in c++26"
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  if !defined(_LIBCPP_ABI_VCRUNTIME)
+#    ifndef __cpp_lib_constexpr_new
+#      error "__cpp_lib_constexpr_new should be defined in c++29"
+#    endif
+#    if __cpp_lib_constexpr_new != 202406L
+#      error "__cpp_lib_constexpr_new should have the value 202406L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_constexpr_new
+#      error "__cpp_lib_constexpr_new should not be defined when the requirement '!defined(_LIBCPP_ABI_VCRUNTIME)' is not met!"
+#    endif
+#  endif
+
+#  if defined(__cpp_impl_destroying_delete) && __cpp_impl_destroying_delete >= 201806L
+#    ifndef __cpp_lib_destroying_delete
+#      error "__cpp_lib_destroying_delete should be defined in c++29"
+#    endif
+#    if __cpp_lib_destroying_delete != 201806L
+#      error "__cpp_lib_destroying_delete should have the value 201806L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_destroying_delete
+#      error "__cpp_lib_destroying_delete should not be defined when the requirement 'defined(__cpp_impl_destroying_delete) && __cpp_impl_destroying_delete >= 201806L' is not met!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_hardware_interference_size
+#    error "__cpp_lib_hardware_interference_size should be defined in c++29"
+#  endif
+#  if __cpp_lib_hardware_interference_size != 201703L
+#    error "__cpp_lib_hardware_interference_size should have the value 201703L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_launder
+#    error "__cpp_lib_launder should be defined in c++29"
+#  endif
+#  if __cpp_lib_launder != 201606L
+#    error "__cpp_lib_launder should have the value 201606L in c++29"
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/numbers.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/numbers.version.compile.pass.cpp
index 27170d1ea0ce7..8e6bed209fd25 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/numbers.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/numbers.version.compile.pass.cpp
@@ -54,7 +54,7 @@
 #    error "__cpp_lib_math_constants should have the value 201907L in c++23"
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  ifndef __cpp_lib_math_constants
 #    error "__cpp_lib_math_constants should be defined in c++26"
@@ -63,6 +63,15 @@
 #    error "__cpp_lib_math_constants should have the value 201907L in c++26"
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  ifndef __cpp_lib_math_constants
+#    error "__cpp_lib_math_constants should be defined in c++29"
+#  endif
+#  if __cpp_lib_math_constants != 201907L
+#    error "__cpp_lib_math_constants should have the value 201907L in c++29"
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/numeric.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/numeric.version.compile.pass.cpp
index d629407c9b645..6dce9ac283318 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/numeric.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/numeric.version.compile.pass.cpp
@@ -199,7 +199,7 @@
 #    error "__cpp_lib_saturation_arithmetic should not be defined before c++26"
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  ifndef __cpp_lib_constexpr_numeric
 #    error "__cpp_lib_constexpr_numeric should be defined in c++26"
@@ -249,6 +249,56 @@
 #    error "__cpp_lib_saturation_arithmetic should have the value 202603L in c++26"
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  ifndef __cpp_lib_constexpr_numeric
+#    error "__cpp_lib_constexpr_numeric should be defined in c++29"
+#  endif
+#  if __cpp_lib_constexpr_numeric != 201911L
+#    error "__cpp_lib_constexpr_numeric should have the value 201911L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_gcd_lcm
+#    error "__cpp_lib_gcd_lcm should be defined in c++29"
+#  endif
+#  if __cpp_lib_gcd_lcm != 201606L
+#    error "__cpp_lib_gcd_lcm should have the value 201606L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_interpolate
+#    error "__cpp_lib_interpolate should be defined in c++29"
+#  endif
+#  if __cpp_lib_interpolate != 201902L
+#    error "__cpp_lib_interpolate should have the value 201902L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_parallel_algorithm
+#      error "__cpp_lib_parallel_algorithm should be defined in c++29"
+#    endif
+#    if __cpp_lib_parallel_algorithm != 201603L
+#      error "__cpp_lib_parallel_algorithm should have the value 201603L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_parallel_algorithm
+#      error "__cpp_lib_parallel_algorithm should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_ranges_iota
+#    error "__cpp_lib_ranges_iota should be defined in c++29"
+#  endif
+#  if __cpp_lib_ranges_iota != 202202L
+#    error "__cpp_lib_ranges_iota should have the value 202202L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_saturation_arithmetic
+#    error "__cpp_lib_saturation_arithmetic should be defined in c++29"
+#  endif
+#  if __cpp_lib_saturation_arithmetic != 202311L
+#    error "__cpp_lib_saturation_arithmetic should have the value 202311L in c++29"
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/optional.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/optional.version.compile.pass.cpp
index 9850c20afec87..63808fd08ed13 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/optional.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/optional.version.compile.pass.cpp
@@ -117,7 +117,7 @@
 #    error "__cpp_lib_optional_range_support should not be defined before c++26"
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  ifndef __cpp_lib_constrained_equality
 #    error "__cpp_lib_constrained_equality should be defined in c++26"
@@ -159,6 +159,48 @@
 #    endif
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  ifndef __cpp_lib_constrained_equality
+#    error "__cpp_lib_constrained_equality should be defined in c++29"
+#  endif
+#  if __cpp_lib_constrained_equality != 202411L
+#    error "__cpp_lib_constrained_equality should have the value 202411L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_freestanding_optional
+#      error "__cpp_lib_freestanding_optional should be defined in c++29"
+#    endif
+#    if __cpp_lib_freestanding_optional != 202311L
+#      error "__cpp_lib_freestanding_optional should have the value 202311L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_freestanding_optional
+#      error "__cpp_lib_freestanding_optional should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_optional
+#    error "__cpp_lib_optional should be defined in c++29"
+#  endif
+#  if __cpp_lib_optional != 202506L
+#    error "__cpp_lib_optional should have the value 202506L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_EXPERIMENTAL_OPTIONAL_ITERATOR
+#    ifndef __cpp_lib_optional_range_support
+#      error "__cpp_lib_optional_range_support should be defined in c++29"
+#    endif
+#    if __cpp_lib_optional_range_support != 202406L
+#      error "__cpp_lib_optional_range_support should have the value 202406L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_optional_range_support
+#      error "__cpp_lib_optional_range_support should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_EXPERIMENTAL_OPTIONAL_ITERATOR' is not met!"
+#    endif
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/ostream.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/ostream.version.compile.pass.cpp
index 163ea5b5514e4..94c4c8c067b75 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/ostream.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/ostream.version.compile.pass.cpp
@@ -97,7 +97,7 @@
 #    endif
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  if defined(__cpp_char8_t)
 #    ifndef __cpp_lib_char8_t
@@ -125,6 +125,34 @@
 #    endif
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  if defined(__cpp_char8_t)
+#    ifndef __cpp_lib_char8_t
+#      error "__cpp_lib_char8_t should be defined in c++29"
+#    endif
+#    if __cpp_lib_char8_t != 201907L
+#      error "__cpp_lib_char8_t should have the value 201907L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_char8_t
+#      error "__cpp_lib_char8_t should not be defined when the requirement 'defined(__cpp_char8_t)' is not met!"
+#    endif
+#  endif
+
+#  if !defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_TO_CHARS_FLOATING_POINT
+#    ifndef __cpp_lib_print
+#      error "__cpp_lib_print should be defined in c++29"
+#    endif
+#    if __cpp_lib_print != 202207L
+#      error "__cpp_lib_print should have the value 202207L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_print
+#      error "__cpp_lib_print should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_TO_CHARS_FLOATING_POINT' is not met!"
+#    endif
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/print.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/print.version.compile.pass.cpp
index 0382d93cb40c9..c0bba4f493557 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/print.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/print.version.compile.pass.cpp
@@ -59,7 +59,7 @@
 #    endif
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  if !defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_TO_CHARS_FLOATING_POINT
 #    ifndef __cpp_lib_print
@@ -74,6 +74,21 @@
 #    endif
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  if !defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_TO_CHARS_FLOATING_POINT
+#    ifndef __cpp_lib_print
+#      error "__cpp_lib_print should be defined in c++29"
+#    endif
+#    if __cpp_lib_print != 202207L
+#      error "__cpp_lib_print should have the value 202207L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_print
+#      error "__cpp_lib_print should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_TO_CHARS_FLOATING_POINT' is not met!"
+#    endif
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/queue.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/queue.version.compile.pass.cpp
index db32433ff518e..8747e421f84c4 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/queue.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/queue.version.compile.pass.cpp
@@ -94,7 +94,7 @@
 #    error "__cpp_lib_containers_ranges should have the value 202202L in c++23"
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  ifndef __cpp_lib_adaptor_iterator_pair_constructor
 #    error "__cpp_lib_adaptor_iterator_pair_constructor should be defined in c++26"
@@ -117,6 +117,29 @@
 #    error "__cpp_lib_containers_ranges should have the value 202202L in c++26"
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  ifndef __cpp_lib_adaptor_iterator_pair_constructor
+#    error "__cpp_lib_adaptor_iterator_pair_constructor should be defined in c++29"
+#  endif
+#  if __cpp_lib_adaptor_iterator_pair_constructor != 202106L
+#    error "__cpp_lib_adaptor_iterator_pair_constructor should have the value 202106L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_constexpr_queue
+#    error "__cpp_lib_constexpr_queue should be defined in c++29"
+#  endif
+#  if __cpp_lib_constexpr_queue != 202502L
+#    error "__cpp_lib_constexpr_queue should have the value 202502L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_containers_ranges
+#    error "__cpp_lib_containers_ranges should be defined in c++29"
+#  endif
+#  if __cpp_lib_containers_ranges != 202202L
+#    error "__cpp_lib_containers_ranges should have the value 202202L in c++29"
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/random.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/random.version.compile.pass.cpp
index d0ede1168dfa1..d80581f227ccd 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/random.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/random.version.compile.pass.cpp
@@ -68,7 +68,7 @@
 #    error "__cpp_lib_philox_engine should not be defined before c++26"
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  if !defined(_LIBCPP_VERSION)
 #    ifndef __cpp_lib_generate_random
@@ -96,6 +96,34 @@
 #    endif
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_generate_random
+#      error "__cpp_lib_generate_random should be defined in c++29"
+#    endif
+#    if __cpp_lib_generate_random != 202403L
+#      error "__cpp_lib_generate_random should have the value 202403L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_generate_random
+#      error "__cpp_lib_generate_random should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_philox_engine
+#      error "__cpp_lib_philox_engine should be defined in c++29"
+#    endif
+#    if __cpp_lib_philox_engine != 202406L
+#      error "__cpp_lib_philox_engine should have the value 202406L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_philox_engine
+#      error "__cpp_lib_philox_engine should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/ranges.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/ranges.version.compile.pass.cpp
index 284b67f7a50ca..581ebbd4f03a7 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/ranges.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/ranges.version.compile.pass.cpp
@@ -339,7 +339,7 @@
 #    error "__cpp_lib_ranges_zip should have the value 202110L in c++23"
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  if !defined(_LIBCPP_VERSION)
 #    ifndef __cpp_lib_default_template_type_for_algorithm_values
@@ -462,6 +462,129 @@
 #    error "__cpp_lib_ranges_zip should have the value 202110L in c++26"
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_default_template_type_for_algorithm_values
+#      error "__cpp_lib_default_template_type_for_algorithm_values should be defined in c++29"
+#    endif
+#    if __cpp_lib_default_template_type_for_algorithm_values != 202403L
+#      error "__cpp_lib_default_template_type_for_algorithm_values should have the value 202403L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_default_template_type_for_algorithm_values
+#      error "__cpp_lib_default_template_type_for_algorithm_values should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_ranges
+#    error "__cpp_lib_ranges should be defined in c++29"
+#  endif
+#  if __cpp_lib_ranges != 202406L
+#    error "__cpp_lib_ranges should have the value 202406L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_ranges_as_const
+#      error "__cpp_lib_ranges_as_const should be defined in c++29"
+#    endif
+#    if __cpp_lib_ranges_as_const != 202207L
+#      error "__cpp_lib_ranges_as_const should have the value 202207L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_ranges_as_const
+#      error "__cpp_lib_ranges_as_const should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_ranges_as_rvalue
+#    error "__cpp_lib_ranges_as_rvalue should be defined in c++29"
+#  endif
+#  if __cpp_lib_ranges_as_rvalue != 202207L
+#    error "__cpp_lib_ranges_as_rvalue should have the value 202207L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_ranges_chunk
+#      error "__cpp_lib_ranges_chunk should be defined in c++29"
+#    endif
+#    if __cpp_lib_ranges_chunk != 202202L
+#      error "__cpp_lib_ranges_chunk should have the value 202202L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_ranges_chunk
+#      error "__cpp_lib_ranges_chunk should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_ranges_chunk_by
+#    error "__cpp_lib_ranges_chunk_by should be defined in c++29"
+#  endif
+#  if __cpp_lib_ranges_chunk_by != 202202L
+#    error "__cpp_lib_ranges_chunk_by should have the value 202202L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_ranges_concat
+#      error "__cpp_lib_ranges_concat should be defined in c++29"
+#    endif
+#    if __cpp_lib_ranges_concat != 202403L
+#      error "__cpp_lib_ranges_concat should have the value 202403L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_ranges_concat
+#      error "__cpp_lib_ranges_concat should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_ranges_indices
+#    error "__cpp_lib_ranges_indices should be defined in c++29"
+#  endif
+#  if __cpp_lib_ranges_indices != 202506L
+#    error "__cpp_lib_ranges_indices should have the value 202506L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_ranges_join_with
+#    error "__cpp_lib_ranges_join_with should be defined in c++29"
+#  endif
+#  if __cpp_lib_ranges_join_with != 202202L
+#    error "__cpp_lib_ranges_join_with should have the value 202202L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_ranges_repeat
+#    error "__cpp_lib_ranges_repeat should be defined in c++29"
+#  endif
+#  if __cpp_lib_ranges_repeat != 202207L
+#    error "__cpp_lib_ranges_repeat should have the value 202207L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_ranges_slide
+#      error "__cpp_lib_ranges_slide should be defined in c++29"
+#    endif
+#    if __cpp_lib_ranges_slide != 202202L
+#      error "__cpp_lib_ranges_slide should have the value 202202L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_ranges_slide
+#      error "__cpp_lib_ranges_slide should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_ranges_to_container
+#    error "__cpp_lib_ranges_to_container should be defined in c++29"
+#  endif
+#  if __cpp_lib_ranges_to_container != 202202L
+#    error "__cpp_lib_ranges_to_container should have the value 202202L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_ranges_zip
+#    error "__cpp_lib_ranges_zip should be defined in c++29"
+#  endif
+#  if __cpp_lib_ranges_zip != 202110L
+#    error "__cpp_lib_ranges_zip should have the value 202110L in c++29"
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/ratio.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/ratio.version.compile.pass.cpp
index b7c08fe0de42c..faf0b608a4a7b 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/ratio.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/ratio.version.compile.pass.cpp
@@ -48,7 +48,7 @@
 #    error "__cpp_lib_ratio should not be defined before c++26"
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  ifndef __cpp_lib_ratio
 #    error "__cpp_lib_ratio should be defined in c++26"
@@ -57,6 +57,15 @@
 #    error "__cpp_lib_ratio should have the value 202306L in c++26"
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  ifndef __cpp_lib_ratio
+#    error "__cpp_lib_ratio should be defined in c++29"
+#  endif
+#  if __cpp_lib_ratio != 202306L
+#    error "__cpp_lib_ratio should have the value 202306L in c++29"
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/regex.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/regex.version.compile.pass.cpp
index dc27dc91851a5..a104ddad5367d 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/regex.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/regex.version.compile.pass.cpp
@@ -59,7 +59,7 @@
 #    error "__cpp_lib_nonmember_container_access should have the value 201411L in c++23"
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  ifndef __cpp_lib_nonmember_container_access
 #    error "__cpp_lib_nonmember_container_access should be defined in c++26"
@@ -68,6 +68,15 @@
 #    error "__cpp_lib_nonmember_container_access should have the value 201411L in c++26"
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  ifndef __cpp_lib_nonmember_container_access
+#    error "__cpp_lib_nonmember_container_access should be defined in c++29"
+#  endif
+#  if __cpp_lib_nonmember_container_access != 201411L
+#    error "__cpp_lib_nonmember_container_access should have the value 201411L in c++29"
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/scoped_allocator.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/scoped_allocator.version.compile.pass.cpp
index 9dc2d8b876640..fd627a2b82e29 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/scoped_allocator.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/scoped_allocator.version.compile.pass.cpp
@@ -57,7 +57,7 @@
 #    error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++23"
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  ifndef __cpp_lib_allocator_traits_is_always_equal
 #    error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++26"
@@ -66,6 +66,15 @@
 #    error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++26"
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  ifndef __cpp_lib_allocator_traits_is_always_equal
+#    error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++29"
+#  endif
+#  if __cpp_lib_allocator_traits_is_always_equal != 201411L
+#    error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++29"
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/semaphore.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/semaphore.version.compile.pass.cpp
index 9912804043c48..97526117370bc 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/semaphore.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/semaphore.version.compile.pass.cpp
@@ -68,7 +68,7 @@
 #    endif
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
 #    ifndef __cpp_lib_semaphore
@@ -83,6 +83,21 @@
 #    endif
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
+#    ifndef __cpp_lib_semaphore
+#      error "__cpp_lib_semaphore should be defined in c++29"
+#    endif
+#    if __cpp_lib_semaphore != 201907L
+#      error "__cpp_lib_semaphore should have the value 201907L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_semaphore
+#      error "__cpp_lib_semaphore should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
+#    endif
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/set.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/set.version.compile.pass.cpp
index 5dc69f29d0ecd..aa7545c008bda 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/set.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/set.version.compile.pass.cpp
@@ -245,7 +245,7 @@
 #    error "__cpp_lib_nonmember_container_access should have the value 201411L in c++23"
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  ifndef __cpp_lib_allocator_traits_is_always_equal
 #    error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++26"
@@ -315,6 +315,76 @@
 #    error "__cpp_lib_nonmember_container_access should have the value 201411L in c++26"
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  ifndef __cpp_lib_allocator_traits_is_always_equal
+#    error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++29"
+#  endif
+#  if __cpp_lib_allocator_traits_is_always_equal != 201411L
+#    error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_associative_heterogeneous_erasure
+#      error "__cpp_lib_associative_heterogeneous_erasure should be defined in c++29"
+#    endif
+#    if __cpp_lib_associative_heterogeneous_erasure != 202110L
+#      error "__cpp_lib_associative_heterogeneous_erasure should have the value 202110L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_associative_heterogeneous_erasure
+#      error "__cpp_lib_associative_heterogeneous_erasure should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_associative_heterogeneous_insertion
+#      error "__cpp_lib_associative_heterogeneous_insertion should be defined in c++29"
+#    endif
+#    if __cpp_lib_associative_heterogeneous_insertion != 202306L
+#      error "__cpp_lib_associative_heterogeneous_insertion should have the value 202306L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_associative_heterogeneous_insertion
+#      error "__cpp_lib_associative_heterogeneous_insertion should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_containers_ranges
+#    error "__cpp_lib_containers_ranges should be defined in c++29"
+#  endif
+#  if __cpp_lib_containers_ranges != 202202L
+#    error "__cpp_lib_containers_ranges should have the value 202202L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_erase_if
+#    error "__cpp_lib_erase_if should be defined in c++29"
+#  endif
+#  if __cpp_lib_erase_if != 202002L
+#    error "__cpp_lib_erase_if should have the value 202002L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_generic_associative_lookup
+#    error "__cpp_lib_generic_associative_lookup should be defined in c++29"
+#  endif
+#  if __cpp_lib_generic_associative_lookup != 201304L
+#    error "__cpp_lib_generic_associative_lookup should have the value 201304L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_node_extract
+#    error "__cpp_lib_node_extract should be defined in c++29"
+#  endif
+#  if __cpp_lib_node_extract != 201606L
+#    error "__cpp_lib_node_extract should have the value 201606L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_nonmember_container_access
+#    error "__cpp_lib_nonmember_container_access should be defined in c++29"
+#  endif
+#  if __cpp_lib_nonmember_container_access != 201411L
+#    error "__cpp_lib_nonmember_container_access should have the value 201411L in c++29"
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/shared_mutex.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/shared_mutex.version.compile.pass.cpp
index 51feff2195c3d..8cd96283ad1ac 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/shared_mutex.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/shared_mutex.version.compile.pass.cpp
@@ -133,7 +133,7 @@
 #    endif
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
 #    ifndef __cpp_lib_shared_mutex
@@ -161,6 +161,34 @@
 #    endif
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
+#    ifndef __cpp_lib_shared_mutex
+#      error "__cpp_lib_shared_mutex should be defined in c++29"
+#    endif
+#    if __cpp_lib_shared_mutex != 201505L
+#      error "__cpp_lib_shared_mutex should have the value 201505L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_shared_mutex
+#      error "__cpp_lib_shared_mutex should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
+#    endif
+#  endif
+
+#  if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
+#    ifndef __cpp_lib_shared_timed_mutex
+#      error "__cpp_lib_shared_timed_mutex should be defined in c++29"
+#    endif
+#    if __cpp_lib_shared_timed_mutex != 201402L
+#      error "__cpp_lib_shared_timed_mutex should have the value 201402L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_shared_timed_mutex
+#      error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
+#    endif
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/source_location.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/source_location.version.compile.pass.cpp
index 9495e319521c1..d89049ce4ad32 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/source_location.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/source_location.version.compile.pass.cpp
@@ -54,7 +54,7 @@
 #    error "__cpp_lib_source_location should have the value 201907L in c++23"
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  ifndef __cpp_lib_source_location
 #    error "__cpp_lib_source_location should be defined in c++26"
@@ -63,6 +63,15 @@
 #    error "__cpp_lib_source_location should have the value 201907L in c++26"
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  ifndef __cpp_lib_source_location
+#    error "__cpp_lib_source_location should be defined in c++29"
+#  endif
+#  if __cpp_lib_source_location != 201907L
+#    error "__cpp_lib_source_location should have the value 201907L in c++29"
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/span.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/span.version.compile.pass.cpp
index 826471a65f691..6b1e0fe9a26c3 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/span.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/span.version.compile.pass.cpp
@@ -94,7 +94,7 @@
 #    error "__cpp_lib_span_initializer_list should not be defined before c++26"
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  ifndef __cpp_lib_span
 #    error "__cpp_lib_span should be defined in c++26"
@@ -117,6 +117,29 @@
 #    error "__cpp_lib_span_initializer_list should have the value 202311L in c++26"
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  ifndef __cpp_lib_span
+#    error "__cpp_lib_span should be defined in c++29"
+#  endif
+#  if __cpp_lib_span != 202002L
+#    error "__cpp_lib_span should have the value 202002L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_span_at
+#    error "__cpp_lib_span_at should be defined in c++29"
+#  endif
+#  if __cpp_lib_span_at != 202311L
+#    error "__cpp_lib_span_at should have the value 202311L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_span_initializer_list
+#    error "__cpp_lib_span_initializer_list should be defined in c++29"
+#  endif
+#  if __cpp_lib_span_initializer_list != 202311L
+#    error "__cpp_lib_span_initializer_list should have the value 202311L in c++29"
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/sstream.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/sstream.version.compile.pass.cpp
index 992e31ed602e3..e07860e349da6 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/sstream.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/sstream.version.compile.pass.cpp
@@ -50,7 +50,7 @@
 #    error "__cpp_lib_sstream_from_string_view should not be defined before c++26"
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  ifndef __cpp_lib_sstream_from_string_view
 #    error "__cpp_lib_sstream_from_string_view should be defined in c++26"
@@ -59,6 +59,15 @@
 #    error "__cpp_lib_sstream_from_string_view should have the value 202306L in c++26"
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  ifndef __cpp_lib_sstream_from_string_view
+#    error "__cpp_lib_sstream_from_string_view should be defined in c++29"
+#  endif
+#  if __cpp_lib_sstream_from_string_view != 202306L
+#    error "__cpp_lib_sstream_from_string_view should have the value 202306L in c++29"
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/stack.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/stack.version.compile.pass.cpp
index 61c5ed476228c..cc06307be967c 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/stack.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/stack.version.compile.pass.cpp
@@ -74,7 +74,7 @@
 #    error "__cpp_lib_containers_ranges should have the value 202202L in c++23"
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  ifndef __cpp_lib_adaptor_iterator_pair_constructor
 #    error "__cpp_lib_adaptor_iterator_pair_constructor should be defined in c++26"
@@ -90,6 +90,22 @@
 #    error "__cpp_lib_containers_ranges should have the value 202202L in c++26"
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  ifndef __cpp_lib_adaptor_iterator_pair_constructor
+#    error "__cpp_lib_adaptor_iterator_pair_constructor should be defined in c++29"
+#  endif
+#  if __cpp_lib_adaptor_iterator_pair_constructor != 202106L
+#    error "__cpp_lib_adaptor_iterator_pair_constructor should have the value 202106L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_containers_ranges
+#    error "__cpp_lib_containers_ranges should be defined in c++29"
+#  endif
+#  if __cpp_lib_containers_ranges != 202202L
+#    error "__cpp_lib_containers_ranges should have the value 202202L in c++29"
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/stdatomic.h.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/stdatomic.h.version.compile.pass.cpp
index c07d935106ea6..15686fdbbeb03 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/stdatomic.h.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/stdatomic.h.version.compile.pass.cpp
@@ -53,7 +53,7 @@
 #    error "__cpp_lib_stdatomic_h should have the value 202011L in c++23"
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  ifndef __cpp_lib_stdatomic_h
 #    error "__cpp_lib_stdatomic_h should be defined in c++26"
@@ -62,6 +62,15 @@
 #    error "__cpp_lib_stdatomic_h should have the value 202011L in c++26"
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  ifndef __cpp_lib_stdatomic_h
+#    error "__cpp_lib_stdatomic_h should be defined in c++29"
+#  endif
+#  if __cpp_lib_stdatomic_h != 202011L
+#    error "__cpp_lib_stdatomic_h should have the value 202011L in c++29"
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/stop_token.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/stop_token.version.compile.pass.cpp
index 1c240cee3bdcf..6ee50693a00ac 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/stop_token.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/stop_token.version.compile.pass.cpp
@@ -68,7 +68,7 @@
 #    endif
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
 #    ifndef __cpp_lib_jthread
@@ -83,6 +83,21 @@
 #    endif
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
+#    ifndef __cpp_lib_jthread
+#      error "__cpp_lib_jthread should be defined in c++29"
+#    endif
+#    if __cpp_lib_jthread != 201911L
+#      error "__cpp_lib_jthread should have the value 201911L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_jthread
+#      error "__cpp_lib_jthread should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
+#    endif
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/string.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/string.version.compile.pass.cpp
index 147854eead2cc..bcc78a9a4143d 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/string.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/string.version.compile.pass.cpp
@@ -392,7 +392,7 @@
 #    error "__cpp_lib_to_string should not be defined before c++26"
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  ifndef __cpp_lib_allocator_traits_is_always_equal
 #    error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++26"
@@ -510,6 +510,124 @@
 #    endif
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  ifndef __cpp_lib_allocator_traits_is_always_equal
+#    error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++29"
+#  endif
+#  if __cpp_lib_allocator_traits_is_always_equal != 201411L
+#    error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++29"
+#  endif
+
+#  if defined(__cpp_char8_t)
+#    ifndef __cpp_lib_char8_t
+#      error "__cpp_lib_char8_t should be defined in c++29"
+#    endif
+#    if __cpp_lib_char8_t != 201907L
+#      error "__cpp_lib_char8_t should have the value 201907L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_char8_t
+#      error "__cpp_lib_char8_t should not be defined when the requirement 'defined(__cpp_char8_t)' is not met!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_constexpr_string
+#    error "__cpp_lib_constexpr_string should be defined in c++29"
+#  endif
+#  if __cpp_lib_constexpr_string != 201907L
+#    error "__cpp_lib_constexpr_string should have the value 201907L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_containers_ranges
+#    error "__cpp_lib_containers_ranges should be defined in c++29"
+#  endif
+#  if __cpp_lib_containers_ranges != 202202L
+#    error "__cpp_lib_containers_ranges should have the value 202202L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_default_template_type_for_algorithm_values
+#      error "__cpp_lib_default_template_type_for_algorithm_values should be defined in c++29"
+#    endif
+#    if __cpp_lib_default_template_type_for_algorithm_values != 202403L
+#      error "__cpp_lib_default_template_type_for_algorithm_values should have the value 202403L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_default_template_type_for_algorithm_values
+#      error "__cpp_lib_default_template_type_for_algorithm_values should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_erase_if
+#    error "__cpp_lib_erase_if should be defined in c++29"
+#  endif
+#  if __cpp_lib_erase_if != 202002L
+#    error "__cpp_lib_erase_if should have the value 202002L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_nonmember_container_access
+#    error "__cpp_lib_nonmember_container_access should be defined in c++29"
+#  endif
+#  if __cpp_lib_nonmember_container_access != 201411L
+#    error "__cpp_lib_nonmember_container_access should have the value 201411L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_starts_ends_with
+#    error "__cpp_lib_starts_ends_with should be defined in c++29"
+#  endif
+#  if __cpp_lib_starts_ends_with != 201711L
+#    error "__cpp_lib_starts_ends_with should have the value 201711L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_string_contains
+#    error "__cpp_lib_string_contains should be defined in c++29"
+#  endif
+#  if __cpp_lib_string_contains != 202011L
+#    error "__cpp_lib_string_contains should have the value 202011L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_string_resize_and_overwrite
+#    error "__cpp_lib_string_resize_and_overwrite should be defined in c++29"
+#  endif
+#  if __cpp_lib_string_resize_and_overwrite != 202110L
+#    error "__cpp_lib_string_resize_and_overwrite should have the value 202110L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_string_subview
+#    error "__cpp_lib_string_subview should be defined in c++29"
+#  endif
+#  if __cpp_lib_string_subview != 202506L
+#    error "__cpp_lib_string_subview should have the value 202506L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_string_udls
+#    error "__cpp_lib_string_udls should be defined in c++29"
+#  endif
+#  if __cpp_lib_string_udls != 201304L
+#    error "__cpp_lib_string_udls should have the value 201304L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_string_view
+#    error "__cpp_lib_string_view should be defined in c++29"
+#  endif
+#  if __cpp_lib_string_view != 202403L
+#    error "__cpp_lib_string_view should have the value 202403L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_to_string
+#      error "__cpp_lib_to_string should be defined in c++29"
+#    endif
+#    if __cpp_lib_to_string != 202306L
+#      error "__cpp_lib_to_string should have the value 202306L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_to_string
+#      error "__cpp_lib_to_string should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/string_view.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/string_view.version.compile.pass.cpp
index 2c3716111102a..5b3f63883d2e8 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/string_view.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/string_view.version.compile.pass.cpp
@@ -210,7 +210,7 @@
 #    error "__cpp_lib_string_view should have the value 201803L in c++23"
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  if defined(__cpp_char8_t)
 #    ifndef __cpp_lib_char8_t
@@ -273,6 +273,69 @@
 #    error "__cpp_lib_string_view should have the value 202403L in c++26"
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  if defined(__cpp_char8_t)
+#    ifndef __cpp_lib_char8_t
+#      error "__cpp_lib_char8_t should be defined in c++29"
+#    endif
+#    if __cpp_lib_char8_t != 201907L
+#      error "__cpp_lib_char8_t should have the value 201907L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_char8_t
+#      error "__cpp_lib_char8_t should not be defined when the requirement 'defined(__cpp_char8_t)' is not met!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_constexpr_string_view
+#    error "__cpp_lib_constexpr_string_view should be defined in c++29"
+#  endif
+#  if __cpp_lib_constexpr_string_view != 201811L
+#    error "__cpp_lib_constexpr_string_view should have the value 201811L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_freestanding_string_view
+#      error "__cpp_lib_freestanding_string_view should be defined in c++29"
+#    endif
+#    if __cpp_lib_freestanding_string_view != 202311L
+#      error "__cpp_lib_freestanding_string_view should have the value 202311L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_freestanding_string_view
+#      error "__cpp_lib_freestanding_string_view should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_starts_ends_with
+#    error "__cpp_lib_starts_ends_with should be defined in c++29"
+#  endif
+#  if __cpp_lib_starts_ends_with != 201711L
+#    error "__cpp_lib_starts_ends_with should have the value 201711L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_string_contains
+#    error "__cpp_lib_string_contains should be defined in c++29"
+#  endif
+#  if __cpp_lib_string_contains != 202011L
+#    error "__cpp_lib_string_contains should have the value 202011L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_string_subview
+#    error "__cpp_lib_string_subview should be defined in c++29"
+#  endif
+#  if __cpp_lib_string_subview != 202506L
+#    error "__cpp_lib_string_subview should have the value 202506L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_string_view
+#    error "__cpp_lib_string_view should be defined in c++29"
+#  endif
+#  if __cpp_lib_string_view != 202403L
+#    error "__cpp_lib_string_view should have the value 202403L in c++29"
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/syncstream.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/syncstream.version.compile.pass.cpp
index 589b9ba5a75df..5b935275fada6 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/syncstream.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/syncstream.version.compile.pass.cpp
@@ -68,7 +68,7 @@
 #    endif
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_EXPERIMENTAL_SYNCSTREAM
 #    ifndef __cpp_lib_syncbuf
@@ -83,6 +83,21 @@
 #    endif
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_EXPERIMENTAL_SYNCSTREAM
+#    ifndef __cpp_lib_syncbuf
+#      error "__cpp_lib_syncbuf should be defined in c++29"
+#    endif
+#    if __cpp_lib_syncbuf != 201803L
+#      error "__cpp_lib_syncbuf should have the value 201803L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_syncbuf
+#      error "__cpp_lib_syncbuf should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_EXPERIMENTAL_SYNCSTREAM' is not met!"
+#    endif
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/thread.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/thread.version.compile.pass.cpp
index 6b422f28dd792..a34afd4f5c65b 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/thread.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/thread.version.compile.pass.cpp
@@ -97,7 +97,7 @@
 #    endif
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  if !defined(_LIBCPP_VERSION)
 #    ifndef __cpp_lib_formatters
@@ -125,6 +125,34 @@
 #    endif
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_formatters
+#      error "__cpp_lib_formatters should be defined in c++29"
+#    endif
+#    if __cpp_lib_formatters != 202302L
+#      error "__cpp_lib_formatters should have the value 202302L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_formatters
+#      error "__cpp_lib_formatters should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
+#    ifndef __cpp_lib_jthread
+#      error "__cpp_lib_jthread should be defined in c++29"
+#    endif
+#    if __cpp_lib_jthread != 201911L
+#      error "__cpp_lib_jthread should have the value 201911L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_jthread
+#      error "__cpp_lib_jthread should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
+#    endif
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/tuple.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/tuple.version.compile.pass.cpp
index c0973c03f3273..9f499f074c30a 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/tuple.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/tuple.version.compile.pass.cpp
@@ -248,7 +248,7 @@
 #    error "__cpp_lib_tuples_by_type should have the value 201304L in c++23"
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  ifndef __cpp_lib_apply
 #    error "__cpp_lib_apply should be defined in c++26"
@@ -312,6 +312,70 @@
 #    error "__cpp_lib_tuples_by_type should have the value 201304L in c++26"
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  ifndef __cpp_lib_apply
+#    error "__cpp_lib_apply should be defined in c++29"
+#  endif
+#  if __cpp_lib_apply != 201603L
+#    error "__cpp_lib_apply should have the value 201603L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_constexpr_tuple
+#    error "__cpp_lib_constexpr_tuple should be defined in c++29"
+#  endif
+#  if __cpp_lib_constexpr_tuple != 201811L
+#    error "__cpp_lib_constexpr_tuple should have the value 201811L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_constrained_equality
+#    error "__cpp_lib_constrained_equality should be defined in c++29"
+#  endif
+#  if __cpp_lib_constrained_equality != 202411L
+#    error "__cpp_lib_constrained_equality should have the value 202411L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_make_from_tuple
+#    error "__cpp_lib_make_from_tuple should be defined in c++29"
+#  endif
+#  if __cpp_lib_make_from_tuple != 201606L
+#    error "__cpp_lib_make_from_tuple should have the value 201606L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_ranges_zip
+#    error "__cpp_lib_ranges_zip should be defined in c++29"
+#  endif
+#  if __cpp_lib_ranges_zip != 202110L
+#    error "__cpp_lib_ranges_zip should have the value 202110L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_tuple_element_t
+#    error "__cpp_lib_tuple_element_t should be defined in c++29"
+#  endif
+#  if __cpp_lib_tuple_element_t != 201402L
+#    error "__cpp_lib_tuple_element_t should have the value 201402L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_tuple_like
+#      error "__cpp_lib_tuple_like should be defined in c++29"
+#    endif
+#    if __cpp_lib_tuple_like != 202311L
+#      error "__cpp_lib_tuple_like should have the value 202311L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_tuple_like
+#      error "__cpp_lib_tuple_like should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_tuples_by_type
+#    error "__cpp_lib_tuples_by_type should be defined in c++29"
+#  endif
+#  if __cpp_lib_tuples_by_type != 201304L
+#    error "__cpp_lib_tuples_by_type should have the value 201304L in c++29"
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/type_traits.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/type_traits.version.compile.pass.cpp
index cb5c008f16bb3..fbceb1410fab8 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/type_traits.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/type_traits.version.compile.pass.cpp
@@ -773,7 +773,7 @@
 #    error "__cpp_lib_void_t should have the value 201411L in c++23"
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  ifndef __cpp_lib_bool_constant
 #    error "__cpp_lib_bool_constant should be defined in c++26"
@@ -993,6 +993,226 @@
 #    error "__cpp_lib_void_t should have the value 201411L in c++26"
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  ifndef __cpp_lib_bool_constant
+#    error "__cpp_lib_bool_constant should be defined in c++29"
+#  endif
+#  if __cpp_lib_bool_constant != 201505L
+#    error "__cpp_lib_bool_constant should have the value 201505L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_bounded_array_traits
+#    error "__cpp_lib_bounded_array_traits should be defined in c++29"
+#  endif
+#  if __cpp_lib_bounded_array_traits != 201902L
+#    error "__cpp_lib_bounded_array_traits should have the value 201902L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_common_reference
+#    error "__cpp_lib_common_reference should be defined in c++29"
+#  endif
+#  if __cpp_lib_common_reference != 202302L
+#    error "__cpp_lib_common_reference should have the value 202302L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_has_unique_object_representations
+#    error "__cpp_lib_has_unique_object_representations should be defined in c++29"
+#  endif
+#  if __cpp_lib_has_unique_object_representations != 201606L
+#    error "__cpp_lib_has_unique_object_representations should have the value 201606L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_integral_constant_callable
+#    error "__cpp_lib_integral_constant_callable should be defined in c++29"
+#  endif
+#  if __cpp_lib_integral_constant_callable != 201304L
+#    error "__cpp_lib_integral_constant_callable should have the value 201304L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_is_aggregate
+#    error "__cpp_lib_is_aggregate should be defined in c++29"
+#  endif
+#  if __cpp_lib_is_aggregate != 201703L
+#    error "__cpp_lib_is_aggregate should have the value 201703L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_is_constant_evaluated
+#    error "__cpp_lib_is_constant_evaluated should be defined in c++29"
+#  endif
+#  if __cpp_lib_is_constant_evaluated != 201811L
+#    error "__cpp_lib_is_constant_evaluated should have the value 201811L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_is_final
+#    error "__cpp_lib_is_final should be defined in c++29"
+#  endif
+#  if __cpp_lib_is_final != 201402L
+#    error "__cpp_lib_is_final should have the value 201402L in c++29"
+#  endif
+
+#  if __has_builtin(__builtin_is_implicit_lifetime)
+#    ifndef __cpp_lib_is_implicit_lifetime
+#      error "__cpp_lib_is_implicit_lifetime should be defined in c++29"
+#    endif
+#    if __cpp_lib_is_implicit_lifetime != 202302L
+#      error "__cpp_lib_is_implicit_lifetime should have the value 202302L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_is_implicit_lifetime
+#      error "__cpp_lib_is_implicit_lifetime should not be defined when the requirement '__has_builtin(__builtin_is_implicit_lifetime)' is not met!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_is_invocable
+#    error "__cpp_lib_is_invocable should be defined in c++29"
+#  endif
+#  if __cpp_lib_is_invocable != 201703L
+#    error "__cpp_lib_is_invocable should have the value 201703L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_is_layout_compatible
+#      error "__cpp_lib_is_layout_compatible should be defined in c++29"
+#    endif
+#    if __cpp_lib_is_layout_compatible != 201907L
+#      error "__cpp_lib_is_layout_compatible should have the value 201907L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_is_layout_compatible
+#      error "__cpp_lib_is_layout_compatible should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_is_nothrow_convertible
+#    error "__cpp_lib_is_nothrow_convertible should be defined in c++29"
+#  endif
+#  if __cpp_lib_is_nothrow_convertible != 201806L
+#    error "__cpp_lib_is_nothrow_convertible should have the value 201806L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_is_null_pointer
+#    error "__cpp_lib_is_null_pointer should be defined in c++29"
+#  endif
+#  if __cpp_lib_is_null_pointer != 201309L
+#    error "__cpp_lib_is_null_pointer should have the value 201309L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_is_pointer_interconvertible
+#      error "__cpp_lib_is_pointer_interconvertible should be defined in c++29"
+#    endif
+#    if __cpp_lib_is_pointer_interconvertible != 201907L
+#      error "__cpp_lib_is_pointer_interconvertible should have the value 201907L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_is_pointer_interconvertible
+#      error "__cpp_lib_is_pointer_interconvertible should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_is_scoped_enum
+#    error "__cpp_lib_is_scoped_enum should be defined in c++29"
+#  endif
+#  if __cpp_lib_is_scoped_enum != 202011L
+#    error "__cpp_lib_is_scoped_enum should have the value 202011L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_is_swappable
+#    error "__cpp_lib_is_swappable should be defined in c++29"
+#  endif
+#  if __cpp_lib_is_swappable != 201603L
+#    error "__cpp_lib_is_swappable should have the value 201603L in c++29"
+#  endif
+
+#  if __has_builtin(__builtin_is_virtual_base_of)
+#    ifndef __cpp_lib_is_virtual_base_of
+#      error "__cpp_lib_is_virtual_base_of should be defined in c++29"
+#    endif
+#    if __cpp_lib_is_virtual_base_of != 202406L
+#      error "__cpp_lib_is_virtual_base_of should have the value 202406L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_is_virtual_base_of
+#      error "__cpp_lib_is_virtual_base_of should not be defined when the requirement '__has_builtin(__builtin_is_virtual_base_of)' is not met!"
+#    endif
+#  endif
+
+#  if __has_builtin(__builtin_is_within_lifetime)
+#    ifndef __cpp_lib_is_within_lifetime
+#      error "__cpp_lib_is_within_lifetime should be defined in c++29"
+#    endif
+#    if __cpp_lib_is_within_lifetime != 202306L
+#      error "__cpp_lib_is_within_lifetime should have the value 202306L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_is_within_lifetime
+#      error "__cpp_lib_is_within_lifetime should not be defined when the requirement '__has_builtin(__builtin_is_within_lifetime)' is not met!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_logical_traits
+#    error "__cpp_lib_logical_traits should be defined in c++29"
+#  endif
+#  if __cpp_lib_logical_traits != 201510L
+#    error "__cpp_lib_logical_traits should have the value 201510L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_reference_from_temporary
+#      error "__cpp_lib_reference_from_temporary should be defined in c++29"
+#    endif
+#    if __cpp_lib_reference_from_temporary != 202202L
+#      error "__cpp_lib_reference_from_temporary should have the value 202202L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_reference_from_temporary
+#      error "__cpp_lib_reference_from_temporary should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_remove_cvref
+#    error "__cpp_lib_remove_cvref should be defined in c++29"
+#  endif
+#  if __cpp_lib_remove_cvref != 201711L
+#    error "__cpp_lib_remove_cvref should have the value 201711L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_result_of_sfinae
+#    error "__cpp_lib_result_of_sfinae should be defined in c++29"
+#  endif
+#  if __cpp_lib_result_of_sfinae != 201210L
+#    error "__cpp_lib_result_of_sfinae should have the value 201210L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_transformation_trait_aliases
+#    error "__cpp_lib_transformation_trait_aliases should be defined in c++29"
+#  endif
+#  if __cpp_lib_transformation_trait_aliases != 201304L
+#    error "__cpp_lib_transformation_trait_aliases should have the value 201304L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_type_identity
+#    error "__cpp_lib_type_identity should be defined in c++29"
+#  endif
+#  if __cpp_lib_type_identity != 201806L
+#    error "__cpp_lib_type_identity should have the value 201806L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_type_trait_variable_templates
+#    error "__cpp_lib_type_trait_variable_templates should be defined in c++29"
+#  endif
+#  if __cpp_lib_type_trait_variable_templates != 201510L
+#    error "__cpp_lib_type_trait_variable_templates should have the value 201510L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_void_t
+#    error "__cpp_lib_void_t should be defined in c++29"
+#  endif
+#  if __cpp_lib_void_t != 201411L
+#    error "__cpp_lib_void_t should have the value 201411L in c++29"
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/typeinfo.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/typeinfo.version.compile.pass.cpp
index cf29080ea75b4..8d2c45c1709f6 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/typeinfo.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/typeinfo.version.compile.pass.cpp
@@ -51,7 +51,7 @@
 #    error "__cpp_lib_constexpr_typeinfo should have the value 202106L in c++23"
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  ifndef __cpp_lib_constexpr_typeinfo
 #    error "__cpp_lib_constexpr_typeinfo should be defined in c++26"
@@ -60,6 +60,15 @@
 #    error "__cpp_lib_constexpr_typeinfo should have the value 202106L in c++26"
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  ifndef __cpp_lib_constexpr_typeinfo
+#    error "__cpp_lib_constexpr_typeinfo should be defined in c++29"
+#  endif
+#  if __cpp_lib_constexpr_typeinfo != 202106L
+#    error "__cpp_lib_constexpr_typeinfo should have the value 202106L in c++29"
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/unordered_map.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/unordered_map.version.compile.pass.cpp
index 221d8aaebc14b..8d438527f1b8b 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/unordered_map.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/unordered_map.version.compile.pass.cpp
@@ -297,7 +297,7 @@
 #    error "__cpp_lib_unordered_map_try_emplace should have the value 201411L in c++23"
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  ifndef __cpp_lib_allocator_traits_is_always_equal
 #    error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++26"
@@ -387,6 +387,96 @@
 #    error "__cpp_lib_unordered_map_try_emplace should have the value 201411L in c++26"
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  ifndef __cpp_lib_allocator_traits_is_always_equal
+#    error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++29"
+#  endif
+#  if __cpp_lib_allocator_traits_is_always_equal != 201411L
+#    error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_associative_heterogeneous_erasure
+#      error "__cpp_lib_associative_heterogeneous_erasure should be defined in c++29"
+#    endif
+#    if __cpp_lib_associative_heterogeneous_erasure != 202110L
+#      error "__cpp_lib_associative_heterogeneous_erasure should have the value 202110L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_associative_heterogeneous_erasure
+#      error "__cpp_lib_associative_heterogeneous_erasure should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_associative_heterogeneous_insertion
+#      error "__cpp_lib_associative_heterogeneous_insertion should be defined in c++29"
+#    endif
+#    if __cpp_lib_associative_heterogeneous_insertion != 202306L
+#      error "__cpp_lib_associative_heterogeneous_insertion should have the value 202306L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_associative_heterogeneous_insertion
+#      error "__cpp_lib_associative_heterogeneous_insertion should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_containers_ranges
+#    error "__cpp_lib_containers_ranges should be defined in c++29"
+#  endif
+#  if __cpp_lib_containers_ranges != 202202L
+#    error "__cpp_lib_containers_ranges should have the value 202202L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_erase_if
+#    error "__cpp_lib_erase_if should be defined in c++29"
+#  endif
+#  if __cpp_lib_erase_if != 202002L
+#    error "__cpp_lib_erase_if should have the value 202002L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_generic_unordered_lookup
+#    error "__cpp_lib_generic_unordered_lookup should be defined in c++29"
+#  endif
+#  if __cpp_lib_generic_unordered_lookup != 201811L
+#    error "__cpp_lib_generic_unordered_lookup should have the value 201811L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_node_extract
+#    error "__cpp_lib_node_extract should be defined in c++29"
+#  endif
+#  if __cpp_lib_node_extract != 201606L
+#    error "__cpp_lib_node_extract should have the value 201606L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_nonmember_container_access
+#    error "__cpp_lib_nonmember_container_access should be defined in c++29"
+#  endif
+#  if __cpp_lib_nonmember_container_access != 201411L
+#    error "__cpp_lib_nonmember_container_access should have the value 201411L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_tuple_like
+#      error "__cpp_lib_tuple_like should be defined in c++29"
+#    endif
+#    if __cpp_lib_tuple_like != 202311L
+#      error "__cpp_lib_tuple_like should have the value 202311L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_tuple_like
+#      error "__cpp_lib_tuple_like should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_unordered_map_try_emplace
+#    error "__cpp_lib_unordered_map_try_emplace should be defined in c++29"
+#  endif
+#  if __cpp_lib_unordered_map_try_emplace != 201411L
+#    error "__cpp_lib_unordered_map_try_emplace should have the value 201411L in c++29"
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/unordered_set.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/unordered_set.version.compile.pass.cpp
index d1c1335df7c80..a4f861ce9ae19 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/unordered_set.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/unordered_set.version.compile.pass.cpp
@@ -239,7 +239,7 @@
 #    error "__cpp_lib_nonmember_container_access should have the value 201411L in c++23"
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  ifndef __cpp_lib_allocator_traits_is_always_equal
 #    error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++26"
@@ -309,6 +309,76 @@
 #    error "__cpp_lib_nonmember_container_access should have the value 201411L in c++26"
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  ifndef __cpp_lib_allocator_traits_is_always_equal
+#    error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++29"
+#  endif
+#  if __cpp_lib_allocator_traits_is_always_equal != 201411L
+#    error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_associative_heterogeneous_erasure
+#      error "__cpp_lib_associative_heterogeneous_erasure should be defined in c++29"
+#    endif
+#    if __cpp_lib_associative_heterogeneous_erasure != 202110L
+#      error "__cpp_lib_associative_heterogeneous_erasure should have the value 202110L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_associative_heterogeneous_erasure
+#      error "__cpp_lib_associative_heterogeneous_erasure should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_associative_heterogeneous_insertion
+#      error "__cpp_lib_associative_heterogeneous_insertion should be defined in c++29"
+#    endif
+#    if __cpp_lib_associative_heterogeneous_insertion != 202306L
+#      error "__cpp_lib_associative_heterogeneous_insertion should have the value 202306L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_associative_heterogeneous_insertion
+#      error "__cpp_lib_associative_heterogeneous_insertion should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_containers_ranges
+#    error "__cpp_lib_containers_ranges should be defined in c++29"
+#  endif
+#  if __cpp_lib_containers_ranges != 202202L
+#    error "__cpp_lib_containers_ranges should have the value 202202L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_erase_if
+#    error "__cpp_lib_erase_if should be defined in c++29"
+#  endif
+#  if __cpp_lib_erase_if != 202002L
+#    error "__cpp_lib_erase_if should have the value 202002L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_generic_unordered_lookup
+#    error "__cpp_lib_generic_unordered_lookup should be defined in c++29"
+#  endif
+#  if __cpp_lib_generic_unordered_lookup != 201811L
+#    error "__cpp_lib_generic_unordered_lookup should have the value 201811L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_node_extract
+#    error "__cpp_lib_node_extract should be defined in c++29"
+#  endif
+#  if __cpp_lib_node_extract != 201606L
+#    error "__cpp_lib_node_extract should have the value 201606L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_nonmember_container_access
+#    error "__cpp_lib_nonmember_container_access should be defined in c++29"
+#  endif
+#  if __cpp_lib_nonmember_container_access != 201411L
+#    error "__cpp_lib_nonmember_container_access should have the value 201411L in c++29"
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/utility.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/utility.version.compile.pass.cpp
index 3f82018a15063..fda0109d12ebb 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/utility.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/utility.version.compile.pass.cpp
@@ -372,7 +372,7 @@
 #    error "__cpp_lib_unreachable should have the value 202202L in c++23"
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  ifndef __cpp_lib_as_const
 #    error "__cpp_lib_as_const should be defined in c++26"
@@ -471,6 +471,105 @@
 #    error "__cpp_lib_unreachable should have the value 202202L in c++26"
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  ifndef __cpp_lib_as_const
+#    error "__cpp_lib_as_const should be defined in c++29"
+#  endif
+#  if __cpp_lib_as_const != 201510L
+#    error "__cpp_lib_as_const should have the value 201510L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_constexpr_algorithms
+#    error "__cpp_lib_constexpr_algorithms should be defined in c++29"
+#  endif
+#  if __cpp_lib_constexpr_algorithms != 202306L
+#    error "__cpp_lib_constexpr_algorithms should have the value 202306L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_constexpr_utility
+#    error "__cpp_lib_constexpr_utility should be defined in c++29"
+#  endif
+#  if __cpp_lib_constexpr_utility != 201811L
+#    error "__cpp_lib_constexpr_utility should have the value 201811L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_constrained_equality
+#    error "__cpp_lib_constrained_equality should be defined in c++29"
+#  endif
+#  if __cpp_lib_constrained_equality != 202411L
+#    error "__cpp_lib_constrained_equality should have the value 202411L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_exchange_function
+#    error "__cpp_lib_exchange_function should be defined in c++29"
+#  endif
+#  if __cpp_lib_exchange_function != 201304L
+#    error "__cpp_lib_exchange_function should have the value 201304L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_forward_like
+#    error "__cpp_lib_forward_like should be defined in c++29"
+#  endif
+#  if __cpp_lib_forward_like != 202207L
+#    error "__cpp_lib_forward_like should have the value 202207L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_integer_comparison_functions
+#    error "__cpp_lib_integer_comparison_functions should be defined in c++29"
+#  endif
+#  if __cpp_lib_integer_comparison_functions != 202002L
+#    error "__cpp_lib_integer_comparison_functions should have the value 202002L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_integer_sequence
+#    error "__cpp_lib_integer_sequence should be defined in c++29"
+#  endif
+#  if __cpp_lib_integer_sequence != 202511L
+#    error "__cpp_lib_integer_sequence should have the value 202511L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_ranges_zip
+#    error "__cpp_lib_ranges_zip should be defined in c++29"
+#  endif
+#  if __cpp_lib_ranges_zip != 202110L
+#    error "__cpp_lib_ranges_zip should have the value 202110L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_to_underlying
+#    error "__cpp_lib_to_underlying should be defined in c++29"
+#  endif
+#  if __cpp_lib_to_underlying != 202102L
+#    error "__cpp_lib_to_underlying should have the value 202102L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_tuple_like
+#      error "__cpp_lib_tuple_like should be defined in c++29"
+#    endif
+#    if __cpp_lib_tuple_like != 202311L
+#      error "__cpp_lib_tuple_like should have the value 202311L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_tuple_like
+#      error "__cpp_lib_tuple_like should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_tuples_by_type
+#    error "__cpp_lib_tuples_by_type should be defined in c++29"
+#  endif
+#  if __cpp_lib_tuples_by_type != 201304L
+#    error "__cpp_lib_tuples_by_type should have the value 201304L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_unreachable
+#    error "__cpp_lib_unreachable should be defined in c++29"
+#  endif
+#  if __cpp_lib_unreachable != 202202L
+#    error "__cpp_lib_unreachable should have the value 202202L in c++29"
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/variant.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/variant.version.compile.pass.cpp
index ed0bb228d7701..1fa89b2a7c3f7 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/variant.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/variant.version.compile.pass.cpp
@@ -97,7 +97,7 @@
 #    error "__cpp_lib_variant should have the value 202106L in c++23"
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  ifndef __cpp_lib_constrained_equality
 #    error "__cpp_lib_constrained_equality should be defined in c++26"
@@ -126,6 +126,35 @@
 #    error "__cpp_lib_variant should have the value 202306L in c++26"
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  ifndef __cpp_lib_constrained_equality
+#    error "__cpp_lib_constrained_equality should be defined in c++29"
+#  endif
+#  if __cpp_lib_constrained_equality != 202411L
+#    error "__cpp_lib_constrained_equality should have the value 202411L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_freestanding_variant
+#      error "__cpp_lib_freestanding_variant should be defined in c++29"
+#    endif
+#    if __cpp_lib_freestanding_variant != 202311L
+#      error "__cpp_lib_freestanding_variant should have the value 202311L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_freestanding_variant
+#      error "__cpp_lib_freestanding_variant should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_variant
+#    error "__cpp_lib_variant should be defined in c++29"
+#  endif
+#  if __cpp_lib_variant != 202306L
+#    error "__cpp_lib_variant should have the value 202306L in c++29"
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/vector.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/vector.version.compile.pass.cpp
index e34800a89c950..354a5b1fdd4db 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/vector.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/vector.version.compile.pass.cpp
@@ -210,7 +210,7 @@
 #    error "__cpp_lib_nonmember_container_access should have the value 201411L in c++23"
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  ifndef __cpp_lib_allocator_traits_is_always_equal
 #    error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++26"
@@ -267,6 +267,63 @@
 #    error "__cpp_lib_nonmember_container_access should have the value 201411L in c++26"
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  ifndef __cpp_lib_allocator_traits_is_always_equal
+#    error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++29"
+#  endif
+#  if __cpp_lib_allocator_traits_is_always_equal != 201411L
+#    error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_constexpr_vector
+#    error "__cpp_lib_constexpr_vector should be defined in c++29"
+#  endif
+#  if __cpp_lib_constexpr_vector != 201907L
+#    error "__cpp_lib_constexpr_vector should have the value 201907L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_containers_ranges
+#    error "__cpp_lib_containers_ranges should be defined in c++29"
+#  endif
+#  if __cpp_lib_containers_ranges != 202202L
+#    error "__cpp_lib_containers_ranges should have the value 202202L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_default_template_type_for_algorithm_values
+#      error "__cpp_lib_default_template_type_for_algorithm_values should be defined in c++29"
+#    endif
+#    if __cpp_lib_default_template_type_for_algorithm_values != 202403L
+#      error "__cpp_lib_default_template_type_for_algorithm_values should have the value 202403L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_default_template_type_for_algorithm_values
+#      error "__cpp_lib_default_template_type_for_algorithm_values should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_erase_if
+#    error "__cpp_lib_erase_if should be defined in c++29"
+#  endif
+#  if __cpp_lib_erase_if != 202002L
+#    error "__cpp_lib_erase_if should have the value 202002L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_incomplete_container_elements
+#    error "__cpp_lib_incomplete_container_elements should be defined in c++29"
+#  endif
+#  if __cpp_lib_incomplete_container_elements != 201505L
+#    error "__cpp_lib_incomplete_container_elements should have the value 201505L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_nonmember_container_access
+#    error "__cpp_lib_nonmember_container_access should be defined in c++29"
+#  endif
+#  if __cpp_lib_nonmember_container_access != 201411L
+#    error "__cpp_lib_nonmember_container_access should have the value 201411L in c++29"
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp
index d1c571a9d1a8c..05fc4757b2d14 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp
@@ -296,6 +296,10 @@
 #    error "__cpp_lib_destroying_delete should not be defined before c++20"
 #  endif
 
+#  ifdef __cpp_lib_embed
+#    error "__cpp_lib_embed should not be defined before c++29"
+#  endif
+
 #  ifdef __cpp_lib_enable_shared_from_this
 #    error "__cpp_lib_enable_shared_from_this should not be defined before c++17"
 #  endif
@@ -1216,6 +1220,10 @@
 #    error "__cpp_lib_destroying_delete should not be defined before c++20"
 #  endif
 
+#  ifdef __cpp_lib_embed
+#    error "__cpp_lib_embed should not be defined before c++29"
+#  endif
+
 #  ifdef __cpp_lib_enable_shared_from_this
 #    error "__cpp_lib_enable_shared_from_this should not be defined before c++17"
 #  endif
@@ -2238,6 +2246,10 @@
 #    error "__cpp_lib_destroying_delete should not be defined before c++20"
 #  endif
 
+#  ifdef __cpp_lib_embed
+#    error "__cpp_lib_embed should not be defined before c++29"
+#  endif
+
 #  ifndef __cpp_lib_enable_shared_from_this
 #    error "__cpp_lib_enable_shared_from_this should be defined in c++17"
 #  endif
@@ -3533,6 +3545,10 @@
 #    endif
 #  endif
 
+#  ifdef __cpp_lib_embed
+#    error "__cpp_lib_embed should not be defined before c++29"
+#  endif
+
 #  ifndef __cpp_lib_enable_shared_from_this
 #    error "__cpp_lib_enable_shared_from_this should be defined in c++20"
 #  endif
@@ -5017,6 +5033,10 @@
 #    endif
 #  endif
 
+#  ifdef __cpp_lib_embed
+#    error "__cpp_lib_embed should not be defined before c++29"
+#  endif
+
 #  ifndef __cpp_lib_enable_shared_from_this
 #    error "__cpp_lib_enable_shared_from_this should be defined in c++23"
 #  endif
@@ -6199,7 +6219,7 @@
 #    error "__cpp_lib_void_t should have the value 201411L in c++23"
 #  endif
 
-#elif TEST_STD_VER > 23
+#elif TEST_STD_VER == 26
 
 #  ifndef __cpp_lib_adaptor_iterator_pair_constructor
 #    error "__cpp_lib_adaptor_iterator_pair_constructor should be defined in c++26"
@@ -6756,6 +6776,10 @@
 #    endif
 #  endif
 
+#  ifdef __cpp_lib_embed
+#    error "__cpp_lib_embed should not be defined before c++29"
+#  endif
+
 #  ifndef __cpp_lib_enable_shared_from_this
 #    error "__cpp_lib_enable_shared_from_this should be defined in c++26"
 #  endif
@@ -8199,6 +8223,2013 @@
 #    error "__cpp_lib_void_t should have the value 201411L in c++26"
 #  endif
 
-#endif // TEST_STD_VER > 23
+#elif TEST_STD_VER > 26
+
+#  ifndef __cpp_lib_adaptor_iterator_pair_constructor
+#    error "__cpp_lib_adaptor_iterator_pair_constructor should be defined in c++29"
+#  endif
+#  if __cpp_lib_adaptor_iterator_pair_constructor != 202106L
+#    error "__cpp_lib_adaptor_iterator_pair_constructor should have the value 202106L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_addressof_constexpr
+#    error "__cpp_lib_addressof_constexpr should be defined in c++29"
+#  endif
+#  if __cpp_lib_addressof_constexpr != 201603L
+#    error "__cpp_lib_addressof_constexpr should have the value 201603L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_aligned_accessor
+#    error "__cpp_lib_aligned_accessor should be defined in c++29"
+#  endif
+#  if __cpp_lib_aligned_accessor != 202411L
+#    error "__cpp_lib_aligned_accessor should have the value 202411L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_allocate_at_least
+#    error "__cpp_lib_allocate_at_least should be defined in c++29"
+#  endif
+#  if __cpp_lib_allocate_at_least != 202302L
+#    error "__cpp_lib_allocate_at_least should have the value 202302L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_allocator_traits_is_always_equal
+#    error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++29"
+#  endif
+#  if __cpp_lib_allocator_traits_is_always_equal != 201411L
+#    error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_any
+#    error "__cpp_lib_any should be defined in c++29"
+#  endif
+#  if __cpp_lib_any != 201606L
+#    error "__cpp_lib_any should have the value 201606L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_apply
+#    error "__cpp_lib_apply should be defined in c++29"
+#  endif
+#  if __cpp_lib_apply != 201603L
+#    error "__cpp_lib_apply should have the value 201603L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_array_constexpr
+#    error "__cpp_lib_array_constexpr should be defined in c++29"
+#  endif
+#  if __cpp_lib_array_constexpr != 201811L
+#    error "__cpp_lib_array_constexpr should have the value 201811L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_as_const
+#    error "__cpp_lib_as_const should be defined in c++29"
+#  endif
+#  if __cpp_lib_as_const != 201510L
+#    error "__cpp_lib_as_const should have the value 201510L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_associative_heterogeneous_erasure
+#      error "__cpp_lib_associative_heterogeneous_erasure should be defined in c++29"
+#    endif
+#    if __cpp_lib_associative_heterogeneous_erasure != 202110L
+#      error "__cpp_lib_associative_heterogeneous_erasure should have the value 202110L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_associative_heterogeneous_erasure
+#      error "__cpp_lib_associative_heterogeneous_erasure should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_associative_heterogeneous_insertion
+#      error "__cpp_lib_associative_heterogeneous_insertion should be defined in c++29"
+#    endif
+#    if __cpp_lib_associative_heterogeneous_insertion != 202306L
+#      error "__cpp_lib_associative_heterogeneous_insertion should have the value 202306L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_associative_heterogeneous_insertion
+#      error "__cpp_lib_associative_heterogeneous_insertion should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_assume_aligned
+#    error "__cpp_lib_assume_aligned should be defined in c++29"
+#  endif
+#  if __cpp_lib_assume_aligned != 201811L
+#    error "__cpp_lib_assume_aligned should have the value 201811L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_atomic_flag_test
+#    error "__cpp_lib_atomic_flag_test should be defined in c++29"
+#  endif
+#  if __cpp_lib_atomic_flag_test != 201907L
+#    error "__cpp_lib_atomic_flag_test should have the value 201907L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_atomic_float
+#    error "__cpp_lib_atomic_float should be defined in c++29"
+#  endif
+#  if __cpp_lib_atomic_float != 201711L
+#    error "__cpp_lib_atomic_float should have the value 201711L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_atomic_is_always_lock_free
+#    error "__cpp_lib_atomic_is_always_lock_free should be defined in c++29"
+#  endif
+#  if __cpp_lib_atomic_is_always_lock_free != 201603L
+#    error "__cpp_lib_atomic_is_always_lock_free should have the value 201603L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_atomic_lock_free_type_aliases
+#    error "__cpp_lib_atomic_lock_free_type_aliases should be defined in c++29"
+#  endif
+#  if __cpp_lib_atomic_lock_free_type_aliases != 201907L
+#    error "__cpp_lib_atomic_lock_free_type_aliases should have the value 201907L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_atomic_min_max
+#      error "__cpp_lib_atomic_min_max should be defined in c++29"
+#    endif
+#    if __cpp_lib_atomic_min_max != 202403L
+#      error "__cpp_lib_atomic_min_max should have the value 202403L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_atomic_min_max
+#      error "__cpp_lib_atomic_min_max should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_atomic_ref
+#    error "__cpp_lib_atomic_ref should be defined in c++29"
+#  endif
+#  if __cpp_lib_atomic_ref != 202411L
+#    error "__cpp_lib_atomic_ref should have the value 202411L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_atomic_shared_ptr
+#      error "__cpp_lib_atomic_shared_ptr should be defined in c++29"
+#    endif
+#    if __cpp_lib_atomic_shared_ptr != 201711L
+#      error "__cpp_lib_atomic_shared_ptr should have the value 201711L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_atomic_shared_ptr
+#      error "__cpp_lib_atomic_shared_ptr should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_atomic_value_initialization
+#    error "__cpp_lib_atomic_value_initialization should be defined in c++29"
+#  endif
+#  if __cpp_lib_atomic_value_initialization != 201911L
+#    error "__cpp_lib_atomic_value_initialization should have the value 201911L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_atomic_wait
+#    error "__cpp_lib_atomic_wait should be defined in c++29"
+#  endif
+#  if __cpp_lib_atomic_wait != 201907L
+#    error "__cpp_lib_atomic_wait should have the value 201907L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
+#    ifndef __cpp_lib_barrier
+#      error "__cpp_lib_barrier should be defined in c++29"
+#    endif
+#    if __cpp_lib_barrier != 201907L
+#      error "__cpp_lib_barrier should have the value 201907L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_barrier
+#      error "__cpp_lib_barrier should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_bind_back
+#    error "__cpp_lib_bind_back should be defined in c++29"
+#  endif
+#  if __cpp_lib_bind_back != 202202L
+#    error "__cpp_lib_bind_back should have the value 202202L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_bind_front
+#    error "__cpp_lib_bind_front should be defined in c++29"
+#  endif
+#  if __cpp_lib_bind_front != 202306L
+#    error "__cpp_lib_bind_front should have the value 202306L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_bit_cast
+#    error "__cpp_lib_bit_cast should be defined in c++29"
+#  endif
+#  if __cpp_lib_bit_cast != 201806L
+#    error "__cpp_lib_bit_cast should have the value 201806L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_bitops
+#    error "__cpp_lib_bitops should be defined in c++29"
+#  endif
+#  if __cpp_lib_bitops != 201907L
+#    error "__cpp_lib_bitops should have the value 201907L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_bitset
+#    error "__cpp_lib_bitset should be defined in c++29"
+#  endif
+#  if __cpp_lib_bitset != 202306L
+#    error "__cpp_lib_bitset should have the value 202306L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_bool_constant
+#    error "__cpp_lib_bool_constant should be defined in c++29"
+#  endif
+#  if __cpp_lib_bool_constant != 201505L
+#    error "__cpp_lib_bool_constant should have the value 201505L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_bounded_array_traits
+#    error "__cpp_lib_bounded_array_traits should be defined in c++29"
+#  endif
+#  if __cpp_lib_bounded_array_traits != 201902L
+#    error "__cpp_lib_bounded_array_traits should have the value 201902L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_boyer_moore_searcher
+#    error "__cpp_lib_boyer_moore_searcher should be defined in c++29"
+#  endif
+#  if __cpp_lib_boyer_moore_searcher != 201603L
+#    error "__cpp_lib_boyer_moore_searcher should have the value 201603L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_byte
+#    error "__cpp_lib_byte should be defined in c++29"
+#  endif
+#  if __cpp_lib_byte != 201603L
+#    error "__cpp_lib_byte should have the value 201603L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_byteswap
+#    error "__cpp_lib_byteswap should be defined in c++29"
+#  endif
+#  if __cpp_lib_byteswap != 202110L
+#    error "__cpp_lib_byteswap should have the value 202110L in c++29"
+#  endif
+
+#  if defined(__cpp_char8_t)
+#    ifndef __cpp_lib_char8_t
+#      error "__cpp_lib_char8_t should be defined in c++29"
+#    endif
+#    if __cpp_lib_char8_t != 201907L
+#      error "__cpp_lib_char8_t should have the value 201907L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_char8_t
+#      error "__cpp_lib_char8_t should not be defined when the requirement 'defined(__cpp_char8_t)' is not met!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_chrono
+#    error "__cpp_lib_chrono should be defined in c++29"
+#  endif
+#  if __cpp_lib_chrono != 201611L
+#    error "__cpp_lib_chrono should have the value 201611L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_chrono_udls
+#    error "__cpp_lib_chrono_udls should be defined in c++29"
+#  endif
+#  if __cpp_lib_chrono_udls != 201304L
+#    error "__cpp_lib_chrono_udls should have the value 201304L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_clamp
+#    error "__cpp_lib_clamp should be defined in c++29"
+#  endif
+#  if __cpp_lib_clamp != 201603L
+#    error "__cpp_lib_clamp should have the value 201603L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_common_reference
+#    error "__cpp_lib_common_reference should be defined in c++29"
+#  endif
+#  if __cpp_lib_common_reference != 202302L
+#    error "__cpp_lib_common_reference should have the value 202302L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_common_reference_wrapper
+#    error "__cpp_lib_common_reference_wrapper should be defined in c++29"
+#  endif
+#  if __cpp_lib_common_reference_wrapper != 202302L
+#    error "__cpp_lib_common_reference_wrapper should have the value 202302L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_complex_udls
+#    error "__cpp_lib_complex_udls should be defined in c++29"
+#  endif
+#  if __cpp_lib_complex_udls != 201309L
+#    error "__cpp_lib_complex_udls should have the value 201309L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_concepts
+#    error "__cpp_lib_concepts should be defined in c++29"
+#  endif
+#  if __cpp_lib_concepts != 202207L
+#    error "__cpp_lib_concepts should have the value 202207L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_constexpr_algorithms
+#    error "__cpp_lib_constexpr_algorithms should be defined in c++29"
+#  endif
+#  if __cpp_lib_constexpr_algorithms != 202306L
+#    error "__cpp_lib_constexpr_algorithms should have the value 202306L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_constexpr_bitset
+#    error "__cpp_lib_constexpr_bitset should be defined in c++29"
+#  endif
+#  if __cpp_lib_constexpr_bitset != 202207L
+#    error "__cpp_lib_constexpr_bitset should have the value 202207L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_constexpr_charconv
+#    error "__cpp_lib_constexpr_charconv should be defined in c++29"
+#  endif
+#  if __cpp_lib_constexpr_charconv != 202207L
+#    error "__cpp_lib_constexpr_charconv should have the value 202207L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_constexpr_cmath
+#      error "__cpp_lib_constexpr_cmath should be defined in c++29"
+#    endif
+#    if __cpp_lib_constexpr_cmath != 202202L
+#      error "__cpp_lib_constexpr_cmath should have the value 202202L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_constexpr_cmath
+#      error "__cpp_lib_constexpr_cmath should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_constexpr_complex
+#    error "__cpp_lib_constexpr_complex should be defined in c++29"
+#  endif
+#  if __cpp_lib_constexpr_complex != 201711L
+#    error "__cpp_lib_constexpr_complex should have the value 201711L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_constexpr_dynamic_alloc
+#    error "__cpp_lib_constexpr_dynamic_alloc should be defined in c++29"
+#  endif
+#  if __cpp_lib_constexpr_dynamic_alloc != 201907L
+#    error "__cpp_lib_constexpr_dynamic_alloc should have the value 201907L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_constexpr_flat_map
+#    error "__cpp_lib_constexpr_flat_map should be defined in c++29"
+#  endif
+#  if __cpp_lib_constexpr_flat_map != 202502L
+#    error "__cpp_lib_constexpr_flat_map should have the value 202502L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_constexpr_flat_set
+#    error "__cpp_lib_constexpr_flat_set should be defined in c++29"
+#  endif
+#  if __cpp_lib_constexpr_flat_set != 202502L
+#    error "__cpp_lib_constexpr_flat_set should have the value 202502L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_constexpr_forward_list
+#    error "__cpp_lib_constexpr_forward_list should be defined in c++29"
+#  endif
+#  if __cpp_lib_constexpr_forward_list != 202502L
+#    error "__cpp_lib_constexpr_forward_list should have the value 202502L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_constexpr_functional
+#    error "__cpp_lib_constexpr_functional should be defined in c++29"
+#  endif
+#  if __cpp_lib_constexpr_functional != 201907L
+#    error "__cpp_lib_constexpr_functional should have the value 201907L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_constexpr_iterator
+#    error "__cpp_lib_constexpr_iterator should be defined in c++29"
+#  endif
+#  if __cpp_lib_constexpr_iterator != 201811L
+#    error "__cpp_lib_constexpr_iterator should have the value 201811L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_constexpr_list
+#    error "__cpp_lib_constexpr_list should be defined in c++29"
+#  endif
+#  if __cpp_lib_constexpr_list != 202502L
+#    error "__cpp_lib_constexpr_list should have the value 202502L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_constexpr_memory
+#    error "__cpp_lib_constexpr_memory should be defined in c++29"
+#  endif
+#  if __cpp_lib_constexpr_memory != 202202L
+#    error "__cpp_lib_constexpr_memory should have the value 202202L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_ABI_VCRUNTIME)
+#    ifndef __cpp_lib_constexpr_new
+#      error "__cpp_lib_constexpr_new should be defined in c++29"
+#    endif
+#    if __cpp_lib_constexpr_new != 202406L
+#      error "__cpp_lib_constexpr_new should have the value 202406L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_constexpr_new
+#      error "__cpp_lib_constexpr_new should not be defined when the requirement '!defined(_LIBCPP_ABI_VCRUNTIME)' is not met!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_constexpr_numeric
+#    error "__cpp_lib_constexpr_numeric should be defined in c++29"
+#  endif
+#  if __cpp_lib_constexpr_numeric != 201911L
+#    error "__cpp_lib_constexpr_numeric should have the value 201911L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_constexpr_queue
+#    error "__cpp_lib_constexpr_queue should be defined in c++29"
+#  endif
+#  if __cpp_lib_constexpr_queue != 202502L
+#    error "__cpp_lib_constexpr_queue should have the value 202502L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_constexpr_string
+#    error "__cpp_lib_constexpr_string should be defined in c++29"
+#  endif
+#  if __cpp_lib_constexpr_string != 201907L
+#    error "__cpp_lib_constexpr_string should have the value 201907L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_constexpr_string_view
+#    error "__cpp_lib_constexpr_string_view should be defined in c++29"
+#  endif
+#  if __cpp_lib_constexpr_string_view != 201811L
+#    error "__cpp_lib_constexpr_string_view should have the value 201811L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_constexpr_tuple
+#    error "__cpp_lib_constexpr_tuple should be defined in c++29"
+#  endif
+#  if __cpp_lib_constexpr_tuple != 201811L
+#    error "__cpp_lib_constexpr_tuple should have the value 201811L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_constexpr_typeinfo
+#    error "__cpp_lib_constexpr_typeinfo should be defined in c++29"
+#  endif
+#  if __cpp_lib_constexpr_typeinfo != 202106L
+#    error "__cpp_lib_constexpr_typeinfo should have the value 202106L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_constexpr_utility
+#    error "__cpp_lib_constexpr_utility should be defined in c++29"
+#  endif
+#  if __cpp_lib_constexpr_utility != 201811L
+#    error "__cpp_lib_constexpr_utility should have the value 201811L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_constexpr_vector
+#    error "__cpp_lib_constexpr_vector should be defined in c++29"
+#  endif
+#  if __cpp_lib_constexpr_vector != 201907L
+#    error "__cpp_lib_constexpr_vector should have the value 201907L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_constrained_equality
+#    error "__cpp_lib_constrained_equality should be defined in c++29"
+#  endif
+#  if __cpp_lib_constrained_equality != 202411L
+#    error "__cpp_lib_constrained_equality should have the value 202411L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_containers_ranges
+#    error "__cpp_lib_containers_ranges should be defined in c++29"
+#  endif
+#  if __cpp_lib_containers_ranges != 202202L
+#    error "__cpp_lib_containers_ranges should have the value 202202L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_copyable_function
+#      error "__cpp_lib_copyable_function should be defined in c++29"
+#    endif
+#    if __cpp_lib_copyable_function != 202306L
+#      error "__cpp_lib_copyable_function should have the value 202306L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_copyable_function
+#      error "__cpp_lib_copyable_function should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_coroutine
+#    error "__cpp_lib_coroutine should be defined in c++29"
+#  endif
+#  if __cpp_lib_coroutine != 201902L
+#    error "__cpp_lib_coroutine should have the value 201902L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_debugging
+#      error "__cpp_lib_debugging should be defined in c++29"
+#    endif
+#    if __cpp_lib_debugging != 202311L
+#      error "__cpp_lib_debugging should have the value 202311L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_debugging
+#      error "__cpp_lib_debugging should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_default_template_type_for_algorithm_values
+#      error "__cpp_lib_default_template_type_for_algorithm_values should be defined in c++29"
+#    endif
+#    if __cpp_lib_default_template_type_for_algorithm_values != 202403L
+#      error "__cpp_lib_default_template_type_for_algorithm_values should have the value 202403L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_default_template_type_for_algorithm_values
+#      error "__cpp_lib_default_template_type_for_algorithm_values should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  if defined(__cpp_impl_destroying_delete) && __cpp_impl_destroying_delete >= 201806L
+#    ifndef __cpp_lib_destroying_delete
+#      error "__cpp_lib_destroying_delete should be defined in c++29"
+#    endif
+#    if __cpp_lib_destroying_delete != 201806L
+#      error "__cpp_lib_destroying_delete should have the value 201806L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_destroying_delete
+#      error "__cpp_lib_destroying_delete should not be defined when the requirement 'defined(__cpp_impl_destroying_delete) && __cpp_impl_destroying_delete >= 201806L' is not met!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_embed
+#    error "__cpp_lib_embed should be defined in c++29"
+#  endif
+#  if __cpp_lib_embed != 202606L
+#    error "__cpp_lib_embed should have the value 202606L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_enable_shared_from_this
+#    error "__cpp_lib_enable_shared_from_this should be defined in c++29"
+#  endif
+#  if __cpp_lib_enable_shared_from_this != 201603L
+#    error "__cpp_lib_enable_shared_from_this should have the value 201603L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_endian
+#    error "__cpp_lib_endian should be defined in c++29"
+#  endif
+#  if __cpp_lib_endian != 201907L
+#    error "__cpp_lib_endian should have the value 201907L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_erase_if
+#    error "__cpp_lib_erase_if should be defined in c++29"
+#  endif
+#  if __cpp_lib_erase_if != 202002L
+#    error "__cpp_lib_erase_if should have the value 202002L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_exchange_function
+#    error "__cpp_lib_exchange_function should be defined in c++29"
+#  endif
+#  if __cpp_lib_exchange_function != 201304L
+#    error "__cpp_lib_exchange_function should have the value 201304L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_execution
+#      error "__cpp_lib_execution should be defined in c++29"
+#    endif
+#    if __cpp_lib_execution != 201902L
+#      error "__cpp_lib_execution should have the value 201902L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_execution
+#      error "__cpp_lib_execution should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_expected
+#    error "__cpp_lib_expected should be defined in c++29"
+#  endif
+#  if __cpp_lib_expected != 202211L
+#    error "__cpp_lib_expected should have the value 202211L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_FILESYSTEM
+#    ifndef __cpp_lib_filesystem
+#      error "__cpp_lib_filesystem should be defined in c++29"
+#    endif
+#    if __cpp_lib_filesystem != 201703L
+#      error "__cpp_lib_filesystem should have the value 201703L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_filesystem
+#      error "__cpp_lib_filesystem should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_FILESYSTEM' is not met!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_flat_map
+#    error "__cpp_lib_flat_map should be defined in c++29"
+#  endif
+#  if __cpp_lib_flat_map != 202511L
+#    error "__cpp_lib_flat_map should have the value 202511L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_flat_set
+#    error "__cpp_lib_flat_set should be defined in c++29"
+#  endif
+#  if __cpp_lib_flat_set != 202511L
+#    error "__cpp_lib_flat_set should have the value 202511L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_TO_CHARS_FLOATING_POINT
+#    ifndef __cpp_lib_format
+#      error "__cpp_lib_format should be defined in c++29"
+#    endif
+#    if __cpp_lib_format != 202110L
+#      error "__cpp_lib_format should have the value 202110L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_format
+#      error "__cpp_lib_format should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_TO_CHARS_FLOATING_POINT' is not met!"
+#    endif
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_format_path
+#      error "__cpp_lib_format_path should be defined in c++29"
+#    endif
+#    if __cpp_lib_format_path != 202403L
+#      error "__cpp_lib_format_path should have the value 202403L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_format_path
+#      error "__cpp_lib_format_path should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_format_ranges
+#    error "__cpp_lib_format_ranges should be defined in c++29"
+#  endif
+#  if __cpp_lib_format_ranges != 202207L
+#    error "__cpp_lib_format_ranges should have the value 202207L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_format_uchar
+#    error "__cpp_lib_format_uchar should be defined in c++29"
+#  endif
+#  if __cpp_lib_format_uchar != 202311L
+#    error "__cpp_lib_format_uchar should have the value 202311L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_formatters
+#      error "__cpp_lib_formatters should be defined in c++29"
+#    endif
+#    if __cpp_lib_formatters != 202302L
+#      error "__cpp_lib_formatters should have the value 202302L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_formatters
+#      error "__cpp_lib_formatters should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_forward_like
+#    error "__cpp_lib_forward_like should be defined in c++29"
+#  endif
+#  if __cpp_lib_forward_like != 202207L
+#    error "__cpp_lib_forward_like should have the value 202207L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_freestanding_algorithm
+#      error "__cpp_lib_freestanding_algorithm should be defined in c++29"
+#    endif
+#    if __cpp_lib_freestanding_algorithm != 202311L
+#      error "__cpp_lib_freestanding_algorithm should have the value 202311L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_freestanding_algorithm
+#      error "__cpp_lib_freestanding_algorithm should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_freestanding_array
+#      error "__cpp_lib_freestanding_array should be defined in c++29"
+#    endif
+#    if __cpp_lib_freestanding_array != 202311L
+#      error "__cpp_lib_freestanding_array should have the value 202311L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_freestanding_array
+#      error "__cpp_lib_freestanding_array should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_freestanding_cstring
+#      error "__cpp_lib_freestanding_cstring should be defined in c++29"
+#    endif
+#    if __cpp_lib_freestanding_cstring != 202306L
+#      error "__cpp_lib_freestanding_cstring should have the value 202306L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_freestanding_cstring
+#      error "__cpp_lib_freestanding_cstring should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_freestanding_expected
+#      error "__cpp_lib_freestanding_expected should be defined in c++29"
+#    endif
+#    if __cpp_lib_freestanding_expected != 202311L
+#      error "__cpp_lib_freestanding_expected should have the value 202311L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_freestanding_expected
+#      error "__cpp_lib_freestanding_expected should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_freestanding_mdspan
+#      error "__cpp_lib_freestanding_mdspan should be defined in c++29"
+#    endif
+#    if __cpp_lib_freestanding_mdspan != 202311L
+#      error "__cpp_lib_freestanding_mdspan should have the value 202311L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_freestanding_mdspan
+#      error "__cpp_lib_freestanding_mdspan should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_freestanding_optional
+#      error "__cpp_lib_freestanding_optional should be defined in c++29"
+#    endif
+#    if __cpp_lib_freestanding_optional != 202311L
+#      error "__cpp_lib_freestanding_optional should have the value 202311L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_freestanding_optional
+#      error "__cpp_lib_freestanding_optional should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_freestanding_string_view
+#      error "__cpp_lib_freestanding_string_view should be defined in c++29"
+#    endif
+#    if __cpp_lib_freestanding_string_view != 202311L
+#      error "__cpp_lib_freestanding_string_view should have the value 202311L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_freestanding_string_view
+#      error "__cpp_lib_freestanding_string_view should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_freestanding_variant
+#      error "__cpp_lib_freestanding_variant should be defined in c++29"
+#    endif
+#    if __cpp_lib_freestanding_variant != 202311L
+#      error "__cpp_lib_freestanding_variant should have the value 202311L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_freestanding_variant
+#      error "__cpp_lib_freestanding_variant should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  if !defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION)
+#    ifndef __cpp_lib_fstream_native_handle
+#      error "__cpp_lib_fstream_native_handle should be defined in c++29"
+#    endif
+#    if __cpp_lib_fstream_native_handle != 202306L
+#      error "__cpp_lib_fstream_native_handle should have the value 202306L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_fstream_native_handle
+#      error "__cpp_lib_fstream_native_handle should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION)' is not met!"
+#    endif
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_function_ref
+#      error "__cpp_lib_function_ref should be defined in c++29"
+#    endif
+#    if __cpp_lib_function_ref != 202306L
+#      error "__cpp_lib_function_ref should have the value 202306L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_function_ref
+#      error "__cpp_lib_function_ref should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_gcd_lcm
+#    error "__cpp_lib_gcd_lcm should be defined in c++29"
+#  endif
+#  if __cpp_lib_gcd_lcm != 201606L
+#    error "__cpp_lib_gcd_lcm should have the value 201606L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_generate_random
+#      error "__cpp_lib_generate_random should be defined in c++29"
+#    endif
+#    if __cpp_lib_generate_random != 202403L
+#      error "__cpp_lib_generate_random should have the value 202403L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_generate_random
+#      error "__cpp_lib_generate_random should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_generic_associative_lookup
+#    error "__cpp_lib_generic_associative_lookup should be defined in c++29"
+#  endif
+#  if __cpp_lib_generic_associative_lookup != 201304L
+#    error "__cpp_lib_generic_associative_lookup should have the value 201304L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_generic_unordered_lookup
+#    error "__cpp_lib_generic_unordered_lookup should be defined in c++29"
+#  endif
+#  if __cpp_lib_generic_unordered_lookup != 201811L
+#    error "__cpp_lib_generic_unordered_lookup should have the value 201811L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_hardware_interference_size
+#    error "__cpp_lib_hardware_interference_size should be defined in c++29"
+#  endif
+#  if __cpp_lib_hardware_interference_size != 201703L
+#    error "__cpp_lib_hardware_interference_size should have the value 201703L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_has_unique_object_representations
+#    error "__cpp_lib_has_unique_object_representations should be defined in c++29"
+#  endif
+#  if __cpp_lib_has_unique_object_representations != 201606L
+#    error "__cpp_lib_has_unique_object_representations should have the value 201606L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_hazard_pointer
+#      error "__cpp_lib_hazard_pointer should be defined in c++29"
+#    endif
+#    if __cpp_lib_hazard_pointer != 202306L
+#      error "__cpp_lib_hazard_pointer should have the value 202306L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_hazard_pointer
+#      error "__cpp_lib_hazard_pointer should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_hypot
+#    error "__cpp_lib_hypot should be defined in c++29"
+#  endif
+#  if __cpp_lib_hypot != 201603L
+#    error "__cpp_lib_hypot should have the value 201603L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_incomplete_container_elements
+#    error "__cpp_lib_incomplete_container_elements should be defined in c++29"
+#  endif
+#  if __cpp_lib_incomplete_container_elements != 201505L
+#    error "__cpp_lib_incomplete_container_elements should have the value 201505L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_inplace_vector
+#      error "__cpp_lib_inplace_vector should be defined in c++29"
+#    endif
+#    if __cpp_lib_inplace_vector != 202406L
+#      error "__cpp_lib_inplace_vector should have the value 202406L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_inplace_vector
+#      error "__cpp_lib_inplace_vector should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_int_pow2
+#    error "__cpp_lib_int_pow2 should be defined in c++29"
+#  endif
+#  if __cpp_lib_int_pow2 != 202002L
+#    error "__cpp_lib_int_pow2 should have the value 202002L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_integer_comparison_functions
+#    error "__cpp_lib_integer_comparison_functions should be defined in c++29"
+#  endif
+#  if __cpp_lib_integer_comparison_functions != 202002L
+#    error "__cpp_lib_integer_comparison_functions should have the value 202002L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_integer_sequence
+#    error "__cpp_lib_integer_sequence should be defined in c++29"
+#  endif
+#  if __cpp_lib_integer_sequence != 202511L
+#    error "__cpp_lib_integer_sequence should have the value 202511L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_integral_constant_callable
+#    error "__cpp_lib_integral_constant_callable should be defined in c++29"
+#  endif
+#  if __cpp_lib_integral_constant_callable != 201304L
+#    error "__cpp_lib_integral_constant_callable should have the value 201304L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_interpolate
+#    error "__cpp_lib_interpolate should be defined in c++29"
+#  endif
+#  if __cpp_lib_interpolate != 201902L
+#    error "__cpp_lib_interpolate should have the value 201902L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_invoke
+#    error "__cpp_lib_invoke should be defined in c++29"
+#  endif
+#  if __cpp_lib_invoke != 201411L
+#    error "__cpp_lib_invoke should have the value 201411L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_invoke_r
+#    error "__cpp_lib_invoke_r should be defined in c++29"
+#  endif
+#  if __cpp_lib_invoke_r != 202106L
+#    error "__cpp_lib_invoke_r should have the value 202106L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_ios_noreplace
+#    error "__cpp_lib_ios_noreplace should be defined in c++29"
+#  endif
+#  if __cpp_lib_ios_noreplace != 202207L
+#    error "__cpp_lib_ios_noreplace should have the value 202207L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_is_aggregate
+#    error "__cpp_lib_is_aggregate should be defined in c++29"
+#  endif
+#  if __cpp_lib_is_aggregate != 201703L
+#    error "__cpp_lib_is_aggregate should have the value 201703L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_is_constant_evaluated
+#    error "__cpp_lib_is_constant_evaluated should be defined in c++29"
+#  endif
+#  if __cpp_lib_is_constant_evaluated != 201811L
+#    error "__cpp_lib_is_constant_evaluated should have the value 201811L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_is_final
+#    error "__cpp_lib_is_final should be defined in c++29"
+#  endif
+#  if __cpp_lib_is_final != 201402L
+#    error "__cpp_lib_is_final should have the value 201402L in c++29"
+#  endif
+
+#  if __has_builtin(__builtin_is_implicit_lifetime)
+#    ifndef __cpp_lib_is_implicit_lifetime
+#      error "__cpp_lib_is_implicit_lifetime should be defined in c++29"
+#    endif
+#    if __cpp_lib_is_implicit_lifetime != 202302L
+#      error "__cpp_lib_is_implicit_lifetime should have the value 202302L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_is_implicit_lifetime
+#      error "__cpp_lib_is_implicit_lifetime should not be defined when the requirement '__has_builtin(__builtin_is_implicit_lifetime)' is not met!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_is_invocable
+#    error "__cpp_lib_is_invocable should be defined in c++29"
+#  endif
+#  if __cpp_lib_is_invocable != 201703L
+#    error "__cpp_lib_is_invocable should have the value 201703L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_is_layout_compatible
+#      error "__cpp_lib_is_layout_compatible should be defined in c++29"
+#    endif
+#    if __cpp_lib_is_layout_compatible != 201907L
+#      error "__cpp_lib_is_layout_compatible should have the value 201907L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_is_layout_compatible
+#      error "__cpp_lib_is_layout_compatible should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_is_nothrow_convertible
+#    error "__cpp_lib_is_nothrow_convertible should be defined in c++29"
+#  endif
+#  if __cpp_lib_is_nothrow_convertible != 201806L
+#    error "__cpp_lib_is_nothrow_convertible should have the value 201806L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_is_null_pointer
+#    error "__cpp_lib_is_null_pointer should be defined in c++29"
+#  endif
+#  if __cpp_lib_is_null_pointer != 201309L
+#    error "__cpp_lib_is_null_pointer should have the value 201309L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_is_pointer_interconvertible
+#      error "__cpp_lib_is_pointer_interconvertible should be defined in c++29"
+#    endif
+#    if __cpp_lib_is_pointer_interconvertible != 201907L
+#      error "__cpp_lib_is_pointer_interconvertible should have the value 201907L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_is_pointer_interconvertible
+#      error "__cpp_lib_is_pointer_interconvertible should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_is_scoped_enum
+#    error "__cpp_lib_is_scoped_enum should be defined in c++29"
+#  endif
+#  if __cpp_lib_is_scoped_enum != 202011L
+#    error "__cpp_lib_is_scoped_enum should have the value 202011L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_is_sufficiently_aligned
+#    error "__cpp_lib_is_sufficiently_aligned should be defined in c++29"
+#  endif
+#  if __cpp_lib_is_sufficiently_aligned != 202411L
+#    error "__cpp_lib_is_sufficiently_aligned should have the value 202411L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_is_swappable
+#    error "__cpp_lib_is_swappable should be defined in c++29"
+#  endif
+#  if __cpp_lib_is_swappable != 201603L
+#    error "__cpp_lib_is_swappable should have the value 201603L in c++29"
+#  endif
+
+#  if __has_builtin(__builtin_is_virtual_base_of)
+#    ifndef __cpp_lib_is_virtual_base_of
+#      error "__cpp_lib_is_virtual_base_of should be defined in c++29"
+#    endif
+#    if __cpp_lib_is_virtual_base_of != 202406L
+#      error "__cpp_lib_is_virtual_base_of should have the value 202406L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_is_virtual_base_of
+#      error "__cpp_lib_is_virtual_base_of should not be defined when the requirement '__has_builtin(__builtin_is_virtual_base_of)' is not met!"
+#    endif
+#  endif
+
+#  if __has_builtin(__builtin_is_within_lifetime)
+#    ifndef __cpp_lib_is_within_lifetime
+#      error "__cpp_lib_is_within_lifetime should be defined in c++29"
+#    endif
+#    if __cpp_lib_is_within_lifetime != 202306L
+#      error "__cpp_lib_is_within_lifetime should have the value 202306L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_is_within_lifetime
+#      error "__cpp_lib_is_within_lifetime should not be defined when the requirement '__has_builtin(__builtin_is_within_lifetime)' is not met!"
+#    endif
+#  endif
+
+#  if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
+#    ifndef __cpp_lib_jthread
+#      error "__cpp_lib_jthread should be defined in c++29"
+#    endif
+#    if __cpp_lib_jthread != 201911L
+#      error "__cpp_lib_jthread should have the value 201911L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_jthread
+#      error "__cpp_lib_jthread should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
+#    endif
+#  endif
+
+#  if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
+#    ifndef __cpp_lib_latch
+#      error "__cpp_lib_latch should be defined in c++29"
+#    endif
+#    if __cpp_lib_latch != 201907L
+#      error "__cpp_lib_latch should have the value 201907L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_latch
+#      error "__cpp_lib_latch should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_launder
+#    error "__cpp_lib_launder should be defined in c++29"
+#  endif
+#  if __cpp_lib_launder != 201606L
+#    error "__cpp_lib_launder should have the value 201606L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_linalg
+#      error "__cpp_lib_linalg should be defined in c++29"
+#    endif
+#    if __cpp_lib_linalg != 202311L
+#      error "__cpp_lib_linalg should have the value 202311L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_linalg
+#      error "__cpp_lib_linalg should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_list_remove_return_type
+#    error "__cpp_lib_list_remove_return_type should be defined in c++29"
+#  endif
+#  if __cpp_lib_list_remove_return_type != 201806L
+#    error "__cpp_lib_list_remove_return_type should have the value 201806L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_logical_traits
+#    error "__cpp_lib_logical_traits should be defined in c++29"
+#  endif
+#  if __cpp_lib_logical_traits != 201510L
+#    error "__cpp_lib_logical_traits should have the value 201510L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_make_from_tuple
+#    error "__cpp_lib_make_from_tuple should be defined in c++29"
+#  endif
+#  if __cpp_lib_make_from_tuple != 201606L
+#    error "__cpp_lib_make_from_tuple should have the value 201606L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_make_reverse_iterator
+#    error "__cpp_lib_make_reverse_iterator should be defined in c++29"
+#  endif
+#  if __cpp_lib_make_reverse_iterator != 201402L
+#    error "__cpp_lib_make_reverse_iterator should have the value 201402L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_make_unique
+#    error "__cpp_lib_make_unique should be defined in c++29"
+#  endif
+#  if __cpp_lib_make_unique != 201304L
+#    error "__cpp_lib_make_unique should have the value 201304L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_map_try_emplace
+#    error "__cpp_lib_map_try_emplace should be defined in c++29"
+#  endif
+#  if __cpp_lib_map_try_emplace != 201411L
+#    error "__cpp_lib_map_try_emplace should have the value 201411L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_math_constants
+#    error "__cpp_lib_math_constants should be defined in c++29"
+#  endif
+#  if __cpp_lib_math_constants != 201907L
+#    error "__cpp_lib_math_constants should have the value 201907L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_math_special_functions
+#      error "__cpp_lib_math_special_functions should be defined in c++29"
+#    endif
+#    if __cpp_lib_math_special_functions != 201603L
+#      error "__cpp_lib_math_special_functions should have the value 201603L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_math_special_functions
+#      error "__cpp_lib_math_special_functions should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_mdspan
+#    error "__cpp_lib_mdspan should be defined in c++29"
+#  endif
+#  if __cpp_lib_mdspan != 202406L
+#    error "__cpp_lib_mdspan should have the value 202406L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_PMR
+#    ifndef __cpp_lib_memory_resource
+#      error "__cpp_lib_memory_resource should be defined in c++29"
+#    endif
+#    if __cpp_lib_memory_resource != 201603L
+#      error "__cpp_lib_memory_resource should have the value 201603L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_memory_resource
+#      error "__cpp_lib_memory_resource should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_PMR' is not met!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_modules
+#    error "__cpp_lib_modules should be defined in c++29"
+#  endif
+#  if __cpp_lib_modules != 202207L
+#    error "__cpp_lib_modules should have the value 202207L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_move_iterator_concept
+#    error "__cpp_lib_move_iterator_concept should be defined in c++29"
+#  endif
+#  if __cpp_lib_move_iterator_concept != 202207L
+#    error "__cpp_lib_move_iterator_concept should have the value 202207L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_move_only_function
+#      error "__cpp_lib_move_only_function should be defined in c++29"
+#    endif
+#    if __cpp_lib_move_only_function != 202110L
+#      error "__cpp_lib_move_only_function should have the value 202110L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_move_only_function
+#      error "__cpp_lib_move_only_function should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_node_extract
+#    error "__cpp_lib_node_extract should be defined in c++29"
+#  endif
+#  if __cpp_lib_node_extract != 201606L
+#    error "__cpp_lib_node_extract should have the value 201606L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_nonmember_container_access
+#    error "__cpp_lib_nonmember_container_access should be defined in c++29"
+#  endif
+#  if __cpp_lib_nonmember_container_access != 201411L
+#    error "__cpp_lib_nonmember_container_access should have the value 201411L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_not_fn
+#    error "__cpp_lib_not_fn should be defined in c++29"
+#  endif
+#  if __cpp_lib_not_fn != 202306L
+#    error "__cpp_lib_not_fn should have the value 202306L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_null_iterators
+#    error "__cpp_lib_null_iterators should be defined in c++29"
+#  endif
+#  if __cpp_lib_null_iterators != 201304L
+#    error "__cpp_lib_null_iterators should have the value 201304L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_optional
+#    error "__cpp_lib_optional should be defined in c++29"
+#  endif
+#  if __cpp_lib_optional != 202506L
+#    error "__cpp_lib_optional should have the value 202506L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_EXPERIMENTAL_OPTIONAL_ITERATOR
+#    ifndef __cpp_lib_optional_range_support
+#      error "__cpp_lib_optional_range_support should be defined in c++29"
+#    endif
+#    if __cpp_lib_optional_range_support != 202406L
+#      error "__cpp_lib_optional_range_support should have the value 202406L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_optional_range_support
+#      error "__cpp_lib_optional_range_support should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_EXPERIMENTAL_OPTIONAL_ITERATOR' is not met!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_out_ptr
+#    error "__cpp_lib_out_ptr should be defined in c++29"
+#  endif
+#  if __cpp_lib_out_ptr != 202311L
+#    error "__cpp_lib_out_ptr should have the value 202311L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_parallel_algorithm
+#      error "__cpp_lib_parallel_algorithm should be defined in c++29"
+#    endif
+#    if __cpp_lib_parallel_algorithm != 201603L
+#      error "__cpp_lib_parallel_algorithm should have the value 201603L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_parallel_algorithm
+#      error "__cpp_lib_parallel_algorithm should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_philox_engine
+#      error "__cpp_lib_philox_engine should be defined in c++29"
+#    endif
+#    if __cpp_lib_philox_engine != 202406L
+#      error "__cpp_lib_philox_engine should have the value 202406L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_philox_engine
+#      error "__cpp_lib_philox_engine should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  if !defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_PMR
+#    ifndef __cpp_lib_polymorphic_allocator
+#      error "__cpp_lib_polymorphic_allocator should be defined in c++29"
+#    endif
+#    if __cpp_lib_polymorphic_allocator != 201902L
+#      error "__cpp_lib_polymorphic_allocator should have the value 201902L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_polymorphic_allocator
+#      error "__cpp_lib_polymorphic_allocator should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_PMR' is not met!"
+#    endif
+#  endif
+
+#  if !defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_TO_CHARS_FLOATING_POINT
+#    ifndef __cpp_lib_print
+#      error "__cpp_lib_print should be defined in c++29"
+#    endif
+#    if __cpp_lib_print != 202207L
+#      error "__cpp_lib_print should have the value 202207L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_print
+#      error "__cpp_lib_print should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_TO_CHARS_FLOATING_POINT' is not met!"
+#    endif
+#  endif
+
+#  if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_LOCALIZATION
+#    ifndef __cpp_lib_quoted_string_io
+#      error "__cpp_lib_quoted_string_io should be defined in c++29"
+#    endif
+#    if __cpp_lib_quoted_string_io != 201304L
+#      error "__cpp_lib_quoted_string_io should have the value 201304L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_quoted_string_io
+#      error "__cpp_lib_quoted_string_io should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_LOCALIZATION' is not met!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_ranges
+#    error "__cpp_lib_ranges should be defined in c++29"
+#  endif
+#  if __cpp_lib_ranges != 202406L
+#    error "__cpp_lib_ranges should have the value 202406L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_ranges_as_const
+#      error "__cpp_lib_ranges_as_const should be defined in c++29"
+#    endif
+#    if __cpp_lib_ranges_as_const != 202207L
+#      error "__cpp_lib_ranges_as_const should have the value 202207L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_ranges_as_const
+#      error "__cpp_lib_ranges_as_const should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_ranges_as_rvalue
+#    error "__cpp_lib_ranges_as_rvalue should be defined in c++29"
+#  endif
+#  if __cpp_lib_ranges_as_rvalue != 202207L
+#    error "__cpp_lib_ranges_as_rvalue should have the value 202207L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_ranges_chunk
+#      error "__cpp_lib_ranges_chunk should be defined in c++29"
+#    endif
+#    if __cpp_lib_ranges_chunk != 202202L
+#      error "__cpp_lib_ranges_chunk should have the value 202202L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_ranges_chunk
+#      error "__cpp_lib_ranges_chunk should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_ranges_chunk_by
+#    error "__cpp_lib_ranges_chunk_by should be defined in c++29"
+#  endif
+#  if __cpp_lib_ranges_chunk_by != 202202L
+#    error "__cpp_lib_ranges_chunk_by should have the value 202202L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_ranges_concat
+#      error "__cpp_lib_ranges_concat should be defined in c++29"
+#    endif
+#    if __cpp_lib_ranges_concat != 202403L
+#      error "__cpp_lib_ranges_concat should have the value 202403L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_ranges_concat
+#      error "__cpp_lib_ranges_concat should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_ranges_contains
+#    error "__cpp_lib_ranges_contains should be defined in c++29"
+#  endif
+#  if __cpp_lib_ranges_contains != 202207L
+#    error "__cpp_lib_ranges_contains should have the value 202207L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_ranges_find_last
+#    error "__cpp_lib_ranges_find_last should be defined in c++29"
+#  endif
+#  if __cpp_lib_ranges_find_last != 202207L
+#    error "__cpp_lib_ranges_find_last should have the value 202207L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_ranges_indices
+#    error "__cpp_lib_ranges_indices should be defined in c++29"
+#  endif
+#  if __cpp_lib_ranges_indices != 202506L
+#    error "__cpp_lib_ranges_indices should have the value 202506L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_ranges_iota
+#    error "__cpp_lib_ranges_iota should be defined in c++29"
+#  endif
+#  if __cpp_lib_ranges_iota != 202202L
+#    error "__cpp_lib_ranges_iota should have the value 202202L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_ranges_join_with
+#    error "__cpp_lib_ranges_join_with should be defined in c++29"
+#  endif
+#  if __cpp_lib_ranges_join_with != 202202L
+#    error "__cpp_lib_ranges_join_with should have the value 202202L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_ranges_repeat
+#    error "__cpp_lib_ranges_repeat should be defined in c++29"
+#  endif
+#  if __cpp_lib_ranges_repeat != 202207L
+#    error "__cpp_lib_ranges_repeat should have the value 202207L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_ranges_slide
+#      error "__cpp_lib_ranges_slide should be defined in c++29"
+#    endif
+#    if __cpp_lib_ranges_slide != 202202L
+#      error "__cpp_lib_ranges_slide should have the value 202202L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_ranges_slide
+#      error "__cpp_lib_ranges_slide should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_ranges_starts_ends_with
+#    error "__cpp_lib_ranges_starts_ends_with should be defined in c++29"
+#  endif
+#  if __cpp_lib_ranges_starts_ends_with != 202106L
+#    error "__cpp_lib_ranges_starts_ends_with should have the value 202106L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_ranges_to_container
+#    error "__cpp_lib_ranges_to_container should be defined in c++29"
+#  endif
+#  if __cpp_lib_ranges_to_container != 202202L
+#    error "__cpp_lib_ranges_to_container should have the value 202202L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_ranges_zip
+#    error "__cpp_lib_ranges_zip should be defined in c++29"
+#  endif
+#  if __cpp_lib_ranges_zip != 202110L
+#    error "__cpp_lib_ranges_zip should have the value 202110L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_ratio
+#    error "__cpp_lib_ratio should be defined in c++29"
+#  endif
+#  if __cpp_lib_ratio != 202306L
+#    error "__cpp_lib_ratio should have the value 202306L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_raw_memory_algorithms
+#    error "__cpp_lib_raw_memory_algorithms should be defined in c++29"
+#  endif
+#  if __cpp_lib_raw_memory_algorithms != 201606L
+#    error "__cpp_lib_raw_memory_algorithms should have the value 201606L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_rcu
+#      error "__cpp_lib_rcu should be defined in c++29"
+#    endif
+#    if __cpp_lib_rcu != 202306L
+#      error "__cpp_lib_rcu should have the value 202306L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_rcu
+#      error "__cpp_lib_rcu should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_reference_from_temporary
+#      error "__cpp_lib_reference_from_temporary should be defined in c++29"
+#    endif
+#    if __cpp_lib_reference_from_temporary != 202202L
+#      error "__cpp_lib_reference_from_temporary should have the value 202202L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_reference_from_temporary
+#      error "__cpp_lib_reference_from_temporary should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_reference_wrapper
+#    error "__cpp_lib_reference_wrapper should be defined in c++29"
+#  endif
+#  if __cpp_lib_reference_wrapper != 202403L
+#    error "__cpp_lib_reference_wrapper should have the value 202403L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_remove_cvref
+#    error "__cpp_lib_remove_cvref should be defined in c++29"
+#  endif
+#  if __cpp_lib_remove_cvref != 201711L
+#    error "__cpp_lib_remove_cvref should have the value 201711L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_result_of_sfinae
+#    error "__cpp_lib_result_of_sfinae should be defined in c++29"
+#  endif
+#  if __cpp_lib_result_of_sfinae != 201210L
+#    error "__cpp_lib_result_of_sfinae should have the value 201210L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_robust_nonmodifying_seq_ops
+#    error "__cpp_lib_robust_nonmodifying_seq_ops should be defined in c++29"
+#  endif
+#  if __cpp_lib_robust_nonmodifying_seq_ops != 201304L
+#    error "__cpp_lib_robust_nonmodifying_seq_ops should have the value 201304L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_sample
+#    error "__cpp_lib_sample should be defined in c++29"
+#  endif
+#  if __cpp_lib_sample != 201603L
+#    error "__cpp_lib_sample should have the value 201603L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_saturation_arithmetic
+#    error "__cpp_lib_saturation_arithmetic should be defined in c++29"
+#  endif
+#  if __cpp_lib_saturation_arithmetic != 202311L
+#    error "__cpp_lib_saturation_arithmetic should have the value 202311L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
+#    ifndef __cpp_lib_scoped_lock
+#      error "__cpp_lib_scoped_lock should be defined in c++29"
+#    endif
+#    if __cpp_lib_scoped_lock != 201703L
+#      error "__cpp_lib_scoped_lock should have the value 201703L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_scoped_lock
+#      error "__cpp_lib_scoped_lock should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
+#    endif
+#  endif
+
+#  if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
+#    ifndef __cpp_lib_semaphore
+#      error "__cpp_lib_semaphore should be defined in c++29"
+#    endif
+#    if __cpp_lib_semaphore != 201907L
+#      error "__cpp_lib_semaphore should have the value 201907L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_semaphore
+#      error "__cpp_lib_semaphore should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
+#    endif
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_senders
+#      error "__cpp_lib_senders should be defined in c++29"
+#    endif
+#    if __cpp_lib_senders != 202406L
+#      error "__cpp_lib_senders should have the value 202406L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_senders
+#      error "__cpp_lib_senders should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
+#    ifndef __cpp_lib_shared_mutex
+#      error "__cpp_lib_shared_mutex should be defined in c++29"
+#    endif
+#    if __cpp_lib_shared_mutex != 201505L
+#      error "__cpp_lib_shared_mutex should have the value 201505L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_shared_mutex
+#      error "__cpp_lib_shared_mutex should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_shared_ptr_arrays
+#    error "__cpp_lib_shared_ptr_arrays should be defined in c++29"
+#  endif
+#  if __cpp_lib_shared_ptr_arrays != 201707L
+#    error "__cpp_lib_shared_ptr_arrays should have the value 201707L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_shared_ptr_weak_type
+#    error "__cpp_lib_shared_ptr_weak_type should be defined in c++29"
+#  endif
+#  if __cpp_lib_shared_ptr_weak_type != 201606L
+#    error "__cpp_lib_shared_ptr_weak_type should have the value 201606L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
+#    ifndef __cpp_lib_shared_timed_mutex
+#      error "__cpp_lib_shared_timed_mutex should be defined in c++29"
+#    endif
+#    if __cpp_lib_shared_timed_mutex != 201402L
+#      error "__cpp_lib_shared_timed_mutex should have the value 201402L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_shared_timed_mutex
+#      error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_shift
+#    error "__cpp_lib_shift should be defined in c++29"
+#  endif
+#  if __cpp_lib_shift != 202202L
+#    error "__cpp_lib_shift should have the value 202202L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_smart_ptr_for_overwrite
+#    error "__cpp_lib_smart_ptr_for_overwrite should be defined in c++29"
+#  endif
+#  if __cpp_lib_smart_ptr_for_overwrite != 202002L
+#    error "__cpp_lib_smart_ptr_for_overwrite should have the value 202002L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_smart_ptr_owner_equality
+#      error "__cpp_lib_smart_ptr_owner_equality should be defined in c++29"
+#    endif
+#    if __cpp_lib_smart_ptr_owner_equality != 202306L
+#      error "__cpp_lib_smart_ptr_owner_equality should have the value 202306L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_smart_ptr_owner_equality
+#      error "__cpp_lib_smart_ptr_owner_equality should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_source_location
+#    error "__cpp_lib_source_location should be defined in c++29"
+#  endif
+#  if __cpp_lib_source_location != 201907L
+#    error "__cpp_lib_source_location should have the value 201907L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_span
+#    error "__cpp_lib_span should be defined in c++29"
+#  endif
+#  if __cpp_lib_span != 202002L
+#    error "__cpp_lib_span should have the value 202002L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_span_at
+#    error "__cpp_lib_span_at should be defined in c++29"
+#  endif
+#  if __cpp_lib_span_at != 202311L
+#    error "__cpp_lib_span_at should have the value 202311L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_span_initializer_list
+#    error "__cpp_lib_span_initializer_list should be defined in c++29"
+#  endif
+#  if __cpp_lib_span_initializer_list != 202311L
+#    error "__cpp_lib_span_initializer_list should have the value 202311L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_spanstream
+#      error "__cpp_lib_spanstream should be defined in c++29"
+#    endif
+#    if __cpp_lib_spanstream != 202106L
+#      error "__cpp_lib_spanstream should have the value 202106L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_spanstream
+#      error "__cpp_lib_spanstream should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_ssize
+#    error "__cpp_lib_ssize should be defined in c++29"
+#  endif
+#  if __cpp_lib_ssize != 201902L
+#    error "__cpp_lib_ssize should have the value 201902L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_sstream_from_string_view
+#    error "__cpp_lib_sstream_from_string_view should be defined in c++29"
+#  endif
+#  if __cpp_lib_sstream_from_string_view != 202306L
+#    error "__cpp_lib_sstream_from_string_view should have the value 202306L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_stacktrace
+#      error "__cpp_lib_stacktrace should be defined in c++29"
+#    endif
+#    if __cpp_lib_stacktrace != 202011L
+#      error "__cpp_lib_stacktrace should have the value 202011L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_stacktrace
+#      error "__cpp_lib_stacktrace should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_starts_ends_with
+#    error "__cpp_lib_starts_ends_with should be defined in c++29"
+#  endif
+#  if __cpp_lib_starts_ends_with != 201711L
+#    error "__cpp_lib_starts_ends_with should have the value 201711L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_stdatomic_h
+#    error "__cpp_lib_stdatomic_h should be defined in c++29"
+#  endif
+#  if __cpp_lib_stdatomic_h != 202011L
+#    error "__cpp_lib_stdatomic_h should have the value 202011L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_string_contains
+#    error "__cpp_lib_string_contains should be defined in c++29"
+#  endif
+#  if __cpp_lib_string_contains != 202011L
+#    error "__cpp_lib_string_contains should have the value 202011L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_string_resize_and_overwrite
+#    error "__cpp_lib_string_resize_and_overwrite should be defined in c++29"
+#  endif
+#  if __cpp_lib_string_resize_and_overwrite != 202110L
+#    error "__cpp_lib_string_resize_and_overwrite should have the value 202110L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_string_subview
+#    error "__cpp_lib_string_subview should be defined in c++29"
+#  endif
+#  if __cpp_lib_string_subview != 202506L
+#    error "__cpp_lib_string_subview should have the value 202506L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_string_udls
+#    error "__cpp_lib_string_udls should be defined in c++29"
+#  endif
+#  if __cpp_lib_string_udls != 201304L
+#    error "__cpp_lib_string_udls should have the value 201304L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_string_view
+#    error "__cpp_lib_string_view should be defined in c++29"
+#  endif
+#  if __cpp_lib_string_view != 202403L
+#    error "__cpp_lib_string_view should have the value 202403L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_submdspan
+#      error "__cpp_lib_submdspan should be defined in c++29"
+#    endif
+#    if __cpp_lib_submdspan != 202306L
+#      error "__cpp_lib_submdspan should have the value 202306L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_submdspan
+#      error "__cpp_lib_submdspan should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_EXPERIMENTAL_SYNCSTREAM
+#    ifndef __cpp_lib_syncbuf
+#      error "__cpp_lib_syncbuf should be defined in c++29"
+#    endif
+#    if __cpp_lib_syncbuf != 201803L
+#      error "__cpp_lib_syncbuf should have the value 201803L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_syncbuf
+#      error "__cpp_lib_syncbuf should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_EXPERIMENTAL_SYNCSTREAM' is not met!"
+#    endif
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_text_encoding
+#      error "__cpp_lib_text_encoding should be defined in c++29"
+#    endif
+#    if __cpp_lib_text_encoding != 202306L
+#      error "__cpp_lib_text_encoding should have the value 202306L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_text_encoding
+#      error "__cpp_lib_text_encoding should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_three_way_comparison
+#    error "__cpp_lib_three_way_comparison should be defined in c++29"
+#  endif
+#  if __cpp_lib_three_way_comparison != 201907L
+#    error "__cpp_lib_three_way_comparison should have the value 201907L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_to_address
+#    error "__cpp_lib_to_address should be defined in c++29"
+#  endif
+#  if __cpp_lib_to_address != 201711L
+#    error "__cpp_lib_to_address should have the value 201711L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_to_array
+#    error "__cpp_lib_to_array should be defined in c++29"
+#  endif
+#  if __cpp_lib_to_array != 201907L
+#    error "__cpp_lib_to_array should have the value 201907L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_to_chars
+#      error "__cpp_lib_to_chars should be defined in c++29"
+#    endif
+#    if __cpp_lib_to_chars != 202306L
+#      error "__cpp_lib_to_chars should have the value 202306L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_to_chars
+#      error "__cpp_lib_to_chars should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_to_string
+#      error "__cpp_lib_to_string should be defined in c++29"
+#    endif
+#    if __cpp_lib_to_string != 202306L
+#      error "__cpp_lib_to_string should have the value 202306L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_to_string
+#      error "__cpp_lib_to_string should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_to_underlying
+#    error "__cpp_lib_to_underlying should be defined in c++29"
+#  endif
+#  if __cpp_lib_to_underlying != 202102L
+#    error "__cpp_lib_to_underlying should have the value 202102L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_transformation_trait_aliases
+#    error "__cpp_lib_transformation_trait_aliases should be defined in c++29"
+#  endif
+#  if __cpp_lib_transformation_trait_aliases != 201304L
+#    error "__cpp_lib_transformation_trait_aliases should have the value 201304L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_transparent_operators
+#    error "__cpp_lib_transparent_operators should be defined in c++29"
+#  endif
+#  if __cpp_lib_transparent_operators != 201510L
+#    error "__cpp_lib_transparent_operators should have the value 201510L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_tuple_element_t
+#    error "__cpp_lib_tuple_element_t should be defined in c++29"
+#  endif
+#  if __cpp_lib_tuple_element_t != 201402L
+#    error "__cpp_lib_tuple_element_t should have the value 201402L in c++29"
+#  endif
+
+#  if !defined(_LIBCPP_VERSION)
+#    ifndef __cpp_lib_tuple_like
+#      error "__cpp_lib_tuple_like should be defined in c++29"
+#    endif
+#    if __cpp_lib_tuple_like != 202311L
+#      error "__cpp_lib_tuple_like should have the value 202311L in c++29"
+#    endif
+#  else
+#    ifdef __cpp_lib_tuple_like
+#      error "__cpp_lib_tuple_like should not be defined because it is unimplemented in libc++!"
+#    endif
+#  endif
+
+#  ifndef __cpp_lib_tuples_by_type
+#    error "__cpp_lib_tuples_by_type should be defined in c++29"
+#  endif
+#  if __cpp_lib_tuples_by_type != 201304L
+#    error "__cpp_lib_tuples_by_type should have the value 201304L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_type_identity
+#    error "__cpp_lib_type_identity should be defined in c++29"
+#  endif
+#  if __cpp_lib_type_identity != 201806L
+#    error "__cpp_lib_type_identity should have the value 201806L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_type_trait_variable_templates
+#    error "__cpp_lib_type_trait_variable_templates should be defined in c++29"
+#  endif
+#  if __cpp_lib_type_trait_variable_templates != 201510L
+#    error "__cpp_lib_type_trait_variable_templates should have the value 201510L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_uncaught_exceptions
+#    error "__cpp_lib_uncaught_exceptions should be defined in c++29"
+#  endif
+#  if __cpp_lib_uncaught_exceptions != 201411L
+#    error "__cpp_lib_uncaught_exceptions should have the value 201411L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_unordered_map_try_emplace
+#    error "__cpp_lib_unordered_map_try_emplace should be defined in c++29"
+#  endif
+#  if __cpp_lib_unordered_map_try_emplace != 201411L
+#    error "__cpp_lib_unordered_map_try_emplace should have the value 201411L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_unreachable
+#    error "__cpp_lib_unreachable should be defined in c++29"
+#  endif
+#  if __cpp_lib_unreachable != 202202L
+#    error "__cpp_lib_unreachable should have the value 202202L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_unwrap_ref
+#    error "__cpp_lib_unwrap_ref should be defined in c++29"
+#  endif
+#  if __cpp_lib_unwrap_ref != 201811L
+#    error "__cpp_lib_unwrap_ref should have the value 201811L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_variant
+#    error "__cpp_lib_variant should be defined in c++29"
+#  endif
+#  if __cpp_lib_variant != 202306L
+#    error "__cpp_lib_variant should have the value 202306L in c++29"
+#  endif
+
+#  ifndef __cpp_lib_void_t
+#    error "__cpp_lib_void_t should be defined in c++29"
+#  endif
+#  if __cpp_lib_void_t != 201411L
+#    error "__cpp_lib_void_t should have the value 201411L in c++29"
+#  endif
+
+#endif // TEST_STD_VER > 26
 
 // clang-format on
diff --git a/libcxx/utils/generate_feature_test_macro_components.py b/libcxx/utils/generate_feature_test_macro_components.py
index 56a1d0c39c9fb..181c12087fc78 100644
--- a/libcxx/utils/generate_feature_test_macro_components.py
+++ b/libcxx/utils/generate_feature_test_macro_components.py
@@ -507,6 +507,11 @@ def add_version_header(tc):
             "test_suite_guard": "defined(__cpp_impl_destroying_delete) && __cpp_impl_destroying_delete >= 201806L",
             "libcxx_guard": "defined(__cpp_impl_destroying_delete) && __cpp_impl_destroying_delete >= 201806L",
         },
+        {
+            "name": "__cpp_lib_embed",
+            "values": {"c++29": 202606},
+            "headers": ["embed"],
+        },
         {
             "name": "__cpp_lib_enable_shared_from_this",
             "values": {"c++17": 201603},
@@ -1547,7 +1552,7 @@ def add_version_header(tc):
 
 
 def get_std_dialects():
-    std_dialects = ["c++14", "c++17", "c++20", "c++23", "c++26"]
+    std_dialects = ["c++14", "c++17", "c++20", "c++23", "c++26", "c++29"]
     return list(std_dialects)
 
 

>From 8460d4fcf4025d4bfb222f2a77d7afdfff969438 Mon Sep 17 00:00:00 2001
From: ThePhD <phdofthehouse at gmail.com>
Date: Wed, 8 Apr 2026 03:26:33 -0400
Subject: [PATCH 3/7] =?UTF-8?q?[Clang][Lex][Sema]=20=F0=9F=8E=A8=20clang-f?=
 =?UTF-8?q?ormat?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 clang/include/clang/AST/ASTContext.h       |   8 +-
 clang/include/clang/Basic/ResourceSearch.h |  74 +++----
 clang/include/clang/Lex/PPCallbacks.h      |  14 +-
 clang/include/clang/Lex/Preprocessor.h     |   3 +-
 clang/lib/AST/ASTContext.cpp               |   6 +-
 clang/lib/AST/ExprConstant.cpp             | 151 +++++++++------
 clang/lib/Basic/ResourceSearch.cpp         | 214 ++++++++++-----------
 clang/lib/Frontend/DependencyFile.cpp      |  39 ++--
 clang/lib/Lex/PPDirectives.cpp             |  30 +--
 clang/lib/Lex/Preprocessor.cpp             |   3 +-
 clang/lib/Sema/SemaChecking.cpp            | 113 +++++------
 11 files changed, 351 insertions(+), 304 deletions(-)

diff --git a/clang/include/clang/AST/ASTContext.h b/clang/include/clang/AST/ASTContext.h
index 56cf139cad791..aa3e6ba18f8b4 100644
--- a/clang/include/clang/AST/ASTContext.h
+++ b/clang/include/clang/AST/ASTContext.h
@@ -27,8 +27,8 @@
 #include "clang/AST/TemplateName.h"
 #include "clang/AST/Type.h"
 #include "clang/AST/TypeOrdering.h"
-#include "clang/Basic/LLVM.h"
 #include "clang/Basic/InputDependencyCollection.h"
+#include "clang/Basic/LLVM.h"
 #include "clang/Basic/PartialDiagnostic.h"
 #include "clang/Basic/SourceLocation.h"
 #include "llvm/ADT/DenseMap.h"
@@ -573,7 +573,6 @@ class ASTContext : public RefCountedBase<ASTContext> {
   // embedded files
   PreprocessorOptions const *PPOpts = nullptr;
 
-
   ASTContext &this_() { return *this; }
 
 public:
@@ -809,7 +808,8 @@ class ASTContext : public RefCountedBase<ASTContext> {
   mutable DeclarationNameTable DeclarationNames;
   IntrusiveRefCntPtr<ExternalASTSource> ExternalSource;
   ASTMutationListener *Listener = nullptr;
-  std::shared_ptr<InputDependencyCollection> InputDependencyPatterns = std::make_shared<InputDependencyCollection>();
+  std::shared_ptr<InputDependencyCollection> InputDependencyPatterns =
+      std::make_shared<InputDependencyCollection>();
 
   /// Returns the clang bytecode interpreter context.
   interp::Context &getInterpContext() const;
@@ -1409,7 +1409,7 @@ class ASTContext : public RefCountedBase<ASTContext> {
   void setCurrentPreprocessorOptions(const PreprocessorOptions &NewPPOpts);
 
   /// Get the preprocessor options we are using. Can be null!
-  PreprocessorOptions const* getCurrentPreprocessorOptions() const;
+  PreprocessorOptions const *getCurrentPreprocessorOptions() const;
 
   /// Attach an external AST source to the AST context.
   ///
diff --git a/clang/include/clang/Basic/ResourceSearch.h b/clang/include/clang/Basic/ResourceSearch.h
index da163b9698841..3db353405b2ce 100644
--- a/clang/include/clang/Basic/ResourceSearch.h
+++ b/clang/include/clang/Basic/ResourceSearch.h
@@ -1,37 +1,37 @@
-//===--- ResourceSearch.h - Searching for Resources -------------*- C++ -*-===//
-//
-// 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
-//
-//===----------------------------------------------------------------------===//
-//
-// User-provided filters include/exclude profile instrumentation in certain
-// functions.
-//
-//===----------------------------------------------------------------------===//
-#ifndef LLVM_CLANG_BASIC_RESOURCESEARCH_H
-#define LLVM_CLANG_BASIC_RESOURCESEARCH_H
-
-#include "clang/Basic/FileEntry.h"
-#include "llvm/ADT/ArrayRef.h"
-#include "llvm/ADT/StringRef.h"
-#include <memory>
-#include <optional>
-
-namespace clang {
-
-class FileManager;
-
-OptionalFileEntryRef
-LookupFileWithStdVec(StringRef Filename, bool isAngled, bool OpenFile,
-                     FileManager &FM,
-                     const std::vector<std::string> &SearchEntries,
-                     OptionalFileEntryRef LookupFromFile);
-OptionalFileEntryRef LookupFileWith(StringRef Filename, bool isAngled,
-                                    bool OpenFile, FileManager &FM,
-                                    ArrayRef<StringRef> SearchEntries,
-                                    OptionalFileEntryRef LookupFromFile);
-} // namespace clang
-
-#endif
+//===--- ResourceSearch.h - Searching for Resources -------------*- C++ -*-===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+//
+// User-provided filters include/exclude profile instrumentation in certain
+// functions.
+//
+//===----------------------------------------------------------------------===//
+#ifndef LLVM_CLANG_BASIC_RESOURCESEARCH_H
+#define LLVM_CLANG_BASIC_RESOURCESEARCH_H
+
+#include "clang/Basic/FileEntry.h"
+#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/StringRef.h"
+#include <memory>
+#include <optional>
+
+namespace clang {
+
+class FileManager;
+
+OptionalFileEntryRef
+LookupFileWithStdVec(StringRef Filename, bool isAngled, bool OpenFile,
+                     FileManager &FM,
+                     const std::vector<std::string> &SearchEntries,
+                     OptionalFileEntryRef LookupFromFile);
+OptionalFileEntryRef LookupFileWith(StringRef Filename, bool isAngled,
+                                    bool OpenFile, FileManager &FM,
+                                    ArrayRef<StringRef> SearchEntries,
+                                    OptionalFileEntryRef LookupFromFile);
+} // namespace clang
+
+#endif
diff --git a/clang/include/clang/Lex/PPCallbacks.h b/clang/include/clang/Lex/PPCallbacks.h
index fbe31e7cf649b..0d8e1375fd2ce 100644
--- a/clang/include/clang/Lex/PPCallbacks.h
+++ b/clang/include/clang/Lex/PPCallbacks.h
@@ -179,7 +179,7 @@ class PPCallbacks {
   /// Hook called when a 'depend' directive is read.
   virtual void DependDirective(SourceLocation HashLoc, const Token &DependTok,
                                StringRef FileName, bool IsAngled,
-                               const PatternFilter& Filter,
+                               const PatternFilter &Filter,
                                OptionalFileEntryRef CurrentFile) {}
 
   /// Callback invoked whenever a submodule was entered.
@@ -552,11 +552,13 @@ class PPChainedCallbacks : public PPCallbacks {
 
   /// Hook called whenever an \#depend is seen.
   void DependDirective(SourceLocation HashLoc, const Token &DependTok,
-                               StringRef Pattern, bool IsAngled,
-                               const PatternFilter& Filter,
-                               OptionalFileEntryRef CurrentFile) override {
-    First->DependDirective(HashLoc, DependTok, Pattern, IsAngled, Filter, CurrentFile);
-    Second->DependDirective(HashLoc, DependTok, Pattern, IsAngled, Filter, CurrentFile);
+                       StringRef Pattern, bool IsAngled,
+                       const PatternFilter &Filter,
+                       OptionalFileEntryRef CurrentFile) override {
+    First->DependDirective(HashLoc, DependTok, Pattern, IsAngled, Filter,
+                           CurrentFile);
+    Second->DependDirective(HashLoc, DependTok, Pattern, IsAngled, Filter,
+                            CurrentFile);
   }
 
   void EnteredSubmodule(Module *M, SourceLocation ImportLoc,
diff --git a/clang/include/clang/Lex/Preprocessor.h b/clang/include/clang/Lex/Preprocessor.h
index 33e0984cd7d80..22059739e7d4b 100644
--- a/clang/include/clang/Lex/Preprocessor.h
+++ b/clang/include/clang/Lex/Preprocessor.h
@@ -345,7 +345,8 @@ class Preprocessor {
   const TranslationUnitKind TUKind;
 
   /// The #depend dependency patterns seen in this translation unit
-  std::shared_ptr<InputDependencyCollection> InputDependencyPatterns = std::make_shared<InputDependencyCollection>();
+  std::shared_ptr<InputDependencyCollection> InputDependencyPatterns =
+      std::make_shared<InputDependencyCollection>();
 
   /// Returns a pointer into the given file's buffer that's guaranteed
   /// to be between tokens. The returned pointer is always before \p Start.
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index d0cde5397663b..46e1bd8cd6bd2 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -903,11 +903,13 @@ ASTContext::ASTContext(LangOptions &LOpts, SourceManager &SM,
   addTranslationUnitDecl();
 }
 
-void ASTContext::setCurrentPreprocessorOptions(const PreprocessorOptions &NewOpts) {
+void ASTContext::setCurrentPreprocessorOptions(
+    const PreprocessorOptions &NewOpts) {
   PPOpts = &NewOpts;
 }
 
-void ASTContext::setCurrentPreprocessorOptions(PreprocessorOptions const *NewOpts) {
+void ASTContext::setCurrentPreprocessorOptions(
+    PreprocessorOptions const *NewOpts) {
   PPOpts = NewOpts;
 }
 
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index ed65242ded122..f7d01bd52a44a 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -3554,9 +3554,10 @@ static APSInt extractStringLiteralCharacter(EvalInfo &Info, const Expr *Lit,
       Info.Ctx.getAsConstantArrayType(S->getType());
   assert(CAT && "string literal isn't an array");
   QualType CharType = CAT->getElementType();
-  assert(((SLK == StringLiteralKind::Binary && CharType->isIntegralOrEnumerationType())
-      || (SLK != StringLiteralKind::Binary && CharType->isIntegerType()))
-    && "unexpected character type");
+  assert(((SLK == StringLiteralKind::Binary &&
+           CharType->isIntegralOrEnumerationType()) ||
+          (SLK != StringLiteralKind::Binary && CharType->isIntegerType())) &&
+         "unexpected character type");
   APSInt Value(Info.Ctx.getTypeSize(CharType),
                CharType->isUnsignedIntegerOrEnumerationType());
   if (Index < S->getLength())
@@ -10721,7 +10722,8 @@ bool PointerExprEvaluator::VisitBuiltinCallExpr(const CallExpr *E,
       return Error(ResourceNameSizeArg);
     }
     if (ResourceNameSizeVal.getBitWidth() > 64) {
-      Info.FFDiag(ResourceNameSizeArg->getBeginLoc(), diag::err_ice_too_large) << OffsetArg << 64 << 1;
+      Info.FFDiag(ResourceNameSizeArg->getBeginLoc(), diag::err_ice_too_large)
+          << OffsetArg << 64 << 1;
       return false;
     }
     APValue ResourceNamePtrVal;
@@ -10734,24 +10736,28 @@ bool PointerExprEvaluator::VisitBuiltinCallExpr(const CallExpr *E,
     const size_t SizeTySize = Info.Ctx.getTypeSize(SizeTy);
     const size_t WCharTySize = Info.Ctx.getTypeSize(WCharTy);
     const size_t IntTySize = Info.Ctx.getTypeSize(Info.Ctx.IntTy);
-    const QualType ResourceNameCharTy(ResourceNamePtrArg->getType()->getPointeeOrArrayElementType(), 0);
-    if (ResourceNameCharTy->isChar8Type() || ResourceNameCharTy->isCharType() || (ResourceNameCharTy->isWideCharType() && WCharTySize == 8)) {
+    const QualType ResourceNameCharTy(
+        ResourceNamePtrArg->getType()->getPointeeOrArrayElementType(), 0);
+    if (ResourceNameCharTy->isChar8Type() || ResourceNameCharTy->isCharType() ||
+        (ResourceNameCharTy->isWideCharType() && WCharTySize == 8)) {
       // Assume the ResourceName is directly usable as an 8-bit transmuation
       for (size_t Index = 0; Index < ResourceNameSize; ++Index) {
         APValue Char;
         if (!handleLValueToRValueConversion(Info, ResourceNamePtrArg,
-              ResourceNameCharTy, ResourceNamePtrLVal, Char)) {
+                                            ResourceNameCharTy,
+                                            ResourceNamePtrLVal, Char)) {
           return Error(ResourceNamePtrArg);
         }
-        ResourceName.push_back(static_cast<char>(static_cast<unsigned char>(Char.getInt().getExtValue())));
-        
+        ResourceName.push_back(static_cast<char>(
+            static_cast<unsigned char>(Char.getInt().getExtValue())));
+
         if (!HandleLValueArrayAdjustment(Info, ResourceNamePtrArg,
-            ResourceNamePtrLVal, ResourceNameCharTy, 1)) {
+                                         ResourceNamePtrLVal,
+                                         ResourceNameCharTy, 1)) {
           return Error(ResourceNamePtrArg);
         }
       }
-    }
-    else if (ResourceNameCharTy->isWideCharType()) {
+    } else if (ResourceNameCharTy->isWideCharType()) {
       // we assume either UTF-16, or UTF-32 based on the size of the string
       // transmute accordingly
       if (WCharTySize == 16) {
@@ -10759,47 +10765,53 @@ bool PointerExprEvaluator::VisitBuiltinCallExpr(const CallExpr *E,
         for (size_t Index = 0; Index < ResourceNameSize; ++Index) {
           APValue Char;
           if (!handleLValueToRValueConversion(Info, ResourceNamePtrArg,
-                ResourceNameCharTy, ResourceNamePtrLVal, Char)) {
+                                              ResourceNameCharTy,
+                                              ResourceNamePtrLVal, Char)) {
             return Error(ResourceNamePtrArg);
           }
-          ResourceName.push_back(static_cast<llvm::UTF16>(Char.getInt().getExtValue()));
-          
+          ResourceName.push_back(
+              static_cast<llvm::UTF16>(Char.getInt().getExtValue()));
+
           if (!HandleLValueArrayAdjustment(Info, ResourceNamePtrArg,
-              ResourceNamePtrLVal, ResourceNameCharTy, 1)) {
+                                           ResourceNamePtrLVal,
+                                           ResourceNameCharTy, 1)) {
             return Error(ResourceNamePtrArg);
           }
         }
-        if (!llvm::convertUTF16ToUTF8String(ResourceNameU16, ResourceName)){
+        if (!llvm::convertUTF16ToUTF8String(ResourceNameU16, ResourceName)) {
           // error: bad name conversion
           return Error(ResourceNamePtrArg);
         }
-      }
-      else if (WCharTySize == 32) {
+      } else if (WCharTySize == 32) {
         llvm::SmallVector<llvm::UTF32, 64> ResourceNameU32;
         for (size_t Index = 0; Index < ResourceNameSize; ++Index) {
           APValue Char;
           if (!handleLValueToRValueConversion(Info, ResourceNamePtrArg,
-                ResourceNameCharTy, ResourceNamePtrLVal, Char)) {
+                                              ResourceNameCharTy,
+                                              ResourceNamePtrLVal, Char)) {
             return false;
           }
-          ResourceName.push_back(static_cast<llvm::UTF32>(Char.getInt().getExtValue()));
-          
+          ResourceName.push_back(
+              static_cast<llvm::UTF32>(Char.getInt().getExtValue()));
+
           if (!HandleLValueArrayAdjustment(Info, ResourceNamePtrArg,
-              ResourceNamePtrLVal, ResourceNameCharTy, 1)) {
-                return false;
+                                           ResourceNamePtrLVal,
+                                           ResourceNameCharTy, 1)) {
+            return false;
           }
         }
         if (!llvm::convertUTF32ToUTF8String(ResourceNameU32, ResourceName)) {
           // error: bad name conversion
           return Error(ResourceNamePtrArg);
         }
+      } else {
+        llvm::report_fatal_error(
+            "The filename has a wide character type that cannot be converted "
+            "to a UTF-8/multibyte string");
       }
-      else {
-        llvm::report_fatal_error("The filename has a wide character type that cannot be converted to a UTF-8/multibyte string");
-      }
-    }
-    else {
-      llvm::report_fatal_error("The filename has an unusuable or unrecognizable character type");
+    } else {
+      llvm::report_fatal_error(
+          "The filename has an unusuable or unrecognizable character type");
     }
 
     uint64_t DataSize = 0;
@@ -10812,7 +10824,8 @@ bool PointerExprEvaluator::VisitBuiltinCallExpr(const CallExpr *E,
       }
       APSInt StatusVal(llvm::APInt(IntTySize, Status, true), false);
       APValue StatusOutResult(StatusVal);
-      if (!handleAssignment(Info, StatusOutArg, StatusOutLVal, StatusOutArg->getType(), StatusOutResult)) {
+      if (!handleAssignment(Info, StatusOutArg, StatusOutLVal,
+                            StatusOutArg->getType(), StatusOutResult)) {
         return Error(StatusOutArg);
       }
       return true;
@@ -10823,7 +10836,8 @@ bool PointerExprEvaluator::VisitBuiltinCallExpr(const CallExpr *E,
       return Error(OffsetArg);
     }
     if (OffsetVal.getBitWidth() > 64) {
-      Info.FFDiag(OffsetArg->getBeginLoc(), diag::err_ice_too_large) << OffsetArg << 64 << 0;
+      Info.FFDiag(OffsetArg->getBeginLoc(), diag::err_ice_too_large)
+          << OffsetArg << 64 << 0;
       return false;
     }
     DataOffset = OffsetVal.getZExtValue();
@@ -10834,14 +10848,17 @@ bool PointerExprEvaluator::VisitBuiltinCallExpr(const CallExpr *E,
         return Error(OffsetArg);
       }
       if (LimitVal.getBitWidth() > 64) {
-        Info.FFDiag(LimitArg->getBeginLoc(), diag::err_ice_too_large) << LimitArg << 64 << 0;
+        Info.FFDiag(LimitArg->getBeginLoc(), diag::err_ice_too_large)
+            << LimitArg << 64 << 0;
         return false;
       }
       uint64_t FullLimit = LimitVal.getZExtValue();
-      if (FullLimit > static_cast<uint64_t>(std::numeric_limits<int64_t>::max())) {
+      if (FullLimit >
+          static_cast<uint64_t>(std::numeric_limits<int64_t>::max())) {
         // error: implementation limit here since we can only
         // have a 63-bit unsigned number, not a 64-bit one
-        Info.FFDiag(LimitArg->getBeginLoc(), diag::err_ice_too_large) << FullLimit << 64 << 0;
+        Info.FFDiag(LimitArg->getBeginLoc(), diag::err_ice_too_large)
+            << FullLimit << 64 << 0;
         return false;
       }
       MaybeLimit = static_cast<int64_t>(FullLimit);
@@ -10849,8 +10866,9 @@ bool PointerExprEvaluator::VisitBuiltinCallExpr(const CallExpr *E,
 
     SourceManager &SM = Info.Ctx.getSourceManager();
     FileManager &FM = SM.getFileManager();
-    PreprocessorOptions const* MaybePPOpts = Info.Ctx.getCurrentPreprocessorOptions();
-    const std::vector<std::string>* MaybeSearchEntries = nullptr;
+    PreprocessorOptions const *MaybePPOpts =
+        Info.Ctx.getCurrentPreprocessorOptions();
+    const std::vector<std::string> *MaybeSearchEntries = nullptr;
     const std::vector<std::string> EmptySearchEntries(0);
     FileID ThisFileID = SM.getFileID(Info.CurrentCall->CallRange.getBegin());
     OptionalFileEntryRef ThisFile = std::nullopt;
@@ -10859,36 +10877,39 @@ bool PointerExprEvaluator::VisitBuiltinCallExpr(const CallExpr *E,
     }
     if (MaybePPOpts) {
       MaybeSearchEntries = &MaybePPOpts->EmbedEntries;
-    }
-    else {
+    } else {
       MaybeSearchEntries = &EmptySearchEntries;
     }
-    OptionalFileEntryRef ResourceFile =
-      LookupFileWithStdVec(ResourceName, false, true, FM, *MaybeSearchEntries, ThisFile);
+    OptionalFileEntryRef ResourceFile = LookupFileWithStdVec(
+        ResourceName, false, true, FM, *MaybeSearchEntries, ThisFile);
     if (!ResourceFile) {
       return WriteOutStatus(FileNotFound);
     }
-    assert(Info.Ctx.InputDependencyPatterns && "using __builtin_std_embed requires the context to have a usable input dependency patterns");
-    StringRef ResourceSearchName = ResourceFile->getFileEntry().tryGetRealPathName();
+    assert(Info.Ctx.InputDependencyPatterns &&
+           "using __builtin_std_embed requires the context to have a usable "
+           "input dependency patterns");
+    StringRef ResourceSearchName =
+        ResourceFile->getFileEntry().tryGetRealPathName();
     if (ResourceSearchName.empty()) {
       ResourceSearchName = ResourceName;
     }
     if (!Info.Ctx.InputDependencyPatterns->Check(ResourceSearchName)) {
       // Not matching a dependency is also simply considered not
-      // finding the file. Consider possibly returnig a different value in the future.
+      // finding the file. Consider possibly returnig a different value in the
+      // future.
       return WriteOutStatus(FileNotFound);
     }
     size_t FullDataSize = ResourceFile->getSize();
-    DataSize = std::max<size_t>(0, std::min<size_t>(
-      DataOffset > FullDataSize
-      ? 0 : FullDataSize - DataOffset,
-      MaybeLimit ? *MaybeLimit : std::numeric_limits<size_t>::max()));
+    DataSize = std::max<size_t>(
+        0, std::min<size_t>(
+               DataOffset > FullDataSize ? 0 : FullDataSize - DataOffset,
+               MaybeLimit ? *MaybeLimit : std::numeric_limits<size_t>::max()));
 
     if (FullDataSize == 0 || DataSize == 0) {
       return WriteOutStatus(FileFoundAndEmpty);
     }
     llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> MaybeBinaryData =
-      FM.getBufferForFile(*ResourceFile, true, false, MaybeLimit, false);
+        FM.getBufferForFile(*ResourceFile, true, false, MaybeLimit, false);
     if (auto Err = MaybeBinaryData.getError()) {
       std::string ExtraMessage = Err.message();
       std::string ErrorMessage = "could not open the resource";
@@ -10896,15 +10917,20 @@ bool PointerExprEvaluator::VisitBuiltinCallExpr(const CallExpr *E,
         ErrorMessage += ", ";
         ErrorMessage += ExtraMessage;
       }
-      Info.FFDiag(ResourceNamePtrArg->getBeginLoc(), diag::err_cannot_open_file) << ResourceName << ErrorMessage;
+      Info.FFDiag(ResourceNamePtrArg->getBeginLoc(), diag::err_cannot_open_file)
+          << ResourceName << ErrorMessage;
       return false;
     }
     llvm::MemoryBuffer *BinaryData = MaybeBinaryData->get();
     if (!BinaryData) {
-      Info.FFDiag(ResourceNamePtrArg->getBeginLoc(), diag::err_cannot_open_file) << ResourceName << "found the resource but unable to read the binary data";
+      Info.FFDiag(ResourceNamePtrArg->getBeginLoc(), diag::err_cannot_open_file)
+          << ResourceName
+          << "found the resource but unable to read the binary data";
       return false;
     }
-    assert(BinaryData->getBufferSize() == FullDataSize && "The binary data for some reason has a data size that is different from the retrieved file size earlier");
+    assert(BinaryData->getBufferSize() == FullDataSize &&
+           "The binary data for some reason has a data size that is different "
+           "from the retrieved file size earlier");
 
     // Write out size
     LValue SizeOutLVal;
@@ -10913,7 +10939,8 @@ bool PointerExprEvaluator::VisitBuiltinCallExpr(const CallExpr *E,
     }
     APSInt BackingArraySizeVal(llvm::APInt(SizeTySize, DataSize, false), true);
     APValue SizeOutResult(BackingArraySizeVal);
-    if (!handleAssignment(Info, SizeOutArg, SizeOutLVal, SizeOutArg->getType(), SizeOutResult)) {
+    if (!handleAssignment(Info, SizeOutArg, SizeOutLVal, SizeOutArg->getType(),
+                          SizeOutResult)) {
       return Error(SizeOutArg);
     }
 
@@ -10923,16 +10950,19 @@ bool PointerExprEvaluator::VisitBuiltinCallExpr(const CallExpr *E,
     // right now, this is not doing too much on the face with caching or smart
     // deduplication in the compiler.
     StringRef TargetData(BinaryData->getBufferStart() + DataOffset, DataSize);
-    QualType BackingArrayTy = Info.Ctx.getConstantArrayType(
-        ArrElementTy, BackingArraySizeVal, nullptr, ArraySizeModifier::Normal, 0);
-    const ConstantArrayType *BackingArrayConstantArrayTy = cast<ConstantArrayType>(BackingArrayTy);
-    StringLiteral *DataLiteral = StringLiteral::Create(Info.Ctx, TargetData,
-      StringLiteralKind::Binary, false, BackingArrayTy, ArrayRef<SourceLocation>(&BuiltinLoc, 1));
+    QualType BackingArrayTy =
+        Info.Ctx.getConstantArrayType(ArrElementTy, BackingArraySizeVal,
+                                      nullptr, ArraySizeModifier::Normal, 0);
+    const ConstantArrayType *BackingArrayConstantArrayTy =
+        cast<ConstantArrayType>(BackingArrayTy);
+    StringLiteral *DataLiteral = StringLiteral::Create(
+        Info.Ctx, TargetData, StringLiteralKind::Binary, false, BackingArrayTy,
+        ArrayRef<SourceLocation>(&BuiltinLoc, 1));
     if (!EvaluateLValue(DataLiteral, Result, Info)) {
       return Error(E);
     }
     // inform the result we have put a string literal in there
-    Result.addArray(Info, E, BackingArrayConstantArrayTy); 
+    Result.addArray(Info, E, BackingArrayConstantArrayTy);
     return WriteOutStatus(FileFound);
   }
   default:
@@ -15531,7 +15561,8 @@ class IntExprEvaluator
     assert(E->getType()->isIntegralOrEnumerationType() &&
            "Invalid evaluation result.");
     auto Ty = E->getType();
-    assert(SI.isSigned() == Ty->isSignedIntegerOrEnumerationType() && "Invalid evaluation result.");
+    assert(SI.isSigned() == Ty->isSignedIntegerOrEnumerationType() &&
+           "Invalid evaluation result.");
     assert(SI.getBitWidth() == Info.Ctx.getIntWidth(E->getType()) &&
            "Invalid evaluation result.");
     Result = APValue(SI);
diff --git a/clang/lib/Basic/ResourceSearch.cpp b/clang/lib/Basic/ResourceSearch.cpp
index b9278d9b7f298..b4d4d367424d2 100644
--- a/clang/lib/Basic/ResourceSearch.cpp
+++ b/clang/lib/Basic/ResourceSearch.cpp
@@ -1,107 +1,107 @@
-//===--- ResourceSearch.h - Searching for Resources -------------*- C++ -*-===//
-//
-// 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
-//
-//===----------------------------------------------------------------------===//
-//
-// User-provided filters include/exclude profile instrumentation in certain
-// functions or files.
-//
-//===----------------------------------------------------------------------===//
-
-#include "clang/Basic/ResourceSearch.h"
-#include "clang/Basic/FileManager.h"
-
-namespace clang {
-
-template <typename Strings>
-OptionalFileEntryRef LookupFileWithImpl(StringRef Filename, bool isAngled,
-                                        bool OpenFile, FileManager &FM,
-                                        const Strings &SearchEntries,
-                                        OptionalFileEntryRef LookupFromFile) {
-  if (llvm::sys::path::is_absolute(Filename)) {
-    // lookup path or immediately fail
-    llvm::Expected<FileEntryRef> ShouldBeEntry = FM.getFileRef(
-        Filename, OpenFile, /*CacheFailure=*/true, /*IsText=*/false);
-    return llvm::expectedToOptional(std::move(ShouldBeEntry));
-  }
-
-  auto SeparateComponents = [](SmallVectorImpl<char> &LookupPath,
-                               StringRef StartingFrom, StringRef FileName,
-                               bool RemoveInitialFileComponentFromLookupPath) {
-    llvm::sys::path::native(StartingFrom, LookupPath);
-    if (RemoveInitialFileComponentFromLookupPath)
-      llvm::sys::path::remove_filename(LookupPath);
-    if (!LookupPath.empty() &&
-        !llvm::sys::path::is_separator(LookupPath.back())) {
-      LookupPath.push_back(llvm::sys::path::get_separator().front());
-    }
-    LookupPath.append(FileName.begin(), FileName.end());
-  };
-
-  // Otherwise, it's search time!
-  SmallString<512> LookupPath;
-  // Non-angled lookup
-  if (!isAngled) {
-    // Use file-based lookup.
-    if (LookupFromFile) {
-      SmallString<1024> TmpDir;
-      TmpDir = LookupFromFile->getDir().getName();
-      llvm::sys::path::append(TmpDir, Filename);
-      if (!TmpDir.empty()) {
-        llvm::Expected<FileEntryRef> ShouldBeEntry = FM.getFileRef(
-            TmpDir, OpenFile, /*CacheFailure=*/true, /*IsText=*/false);
-        if (ShouldBeEntry)
-          return llvm::expectedToOptional(std::move(ShouldBeEntry));
-        llvm::consumeError(ShouldBeEntry.takeError());
-      }
-    }
-
-    // Otherwise, do working directory lookup.
-    LookupPath.clear();
-    auto MaybeWorkingDirEntry = FM.getDirectoryRef(".");
-    if (MaybeWorkingDirEntry) {
-      DirectoryEntryRef WorkingDirEntry = *MaybeWorkingDirEntry;
-      StringRef WorkingDir = WorkingDirEntry.getName();
-      if (!WorkingDir.empty()) {
-        SeparateComponents(LookupPath, WorkingDir, Filename, false);
-        llvm::Expected<FileEntryRef> ShouldBeEntry = FM.getFileRef(
-            LookupPath, OpenFile, /*CacheFailure=*/true, /*IsText=*/false);
-        if (ShouldBeEntry)
-          return llvm::expectedToOptional(std::move(ShouldBeEntry));
-        llvm::consumeError(ShouldBeEntry.takeError());
-      }
-    }
-  }
-
-  for (const auto &Entry : SearchEntries) {
-    LookupPath.clear();
-    SeparateComponents(LookupPath, Entry, Filename, false);
-    llvm::Expected<FileEntryRef> ShouldBeEntry = FM.getFileRef(
-        LookupPath, OpenFile, /*CacheFailure=*/true, /*IsText=*/false);
-    if (ShouldBeEntry)
-      return llvm::expectedToOptional(std::move(ShouldBeEntry));
-    llvm::consumeError(ShouldBeEntry.takeError());
-  }
-  return std::nullopt;
-}
-
-OptionalFileEntryRef
-LookupFileWithStdVec(StringRef Filename, bool isAngled, bool OpenFile,
-                     FileManager &FM,
-                     const std::vector<std::string> &SearchEntries,
-                     OptionalFileEntryRef LookupFromFile) {
-  return LookupFileWithImpl(Filename, isAngled, OpenFile, FM, SearchEntries,
-                            LookupFromFile);
-}
-
-OptionalFileEntryRef LookupFileWith(StringRef Filename, bool isAngled,
-                                    bool OpenFile, FileManager &FM,
-                                    ArrayRef<StringRef> SearchEntries,
-                                    OptionalFileEntryRef LookupFromFile) {
-  return LookupFileWithImpl(Filename, isAngled, OpenFile, FM, SearchEntries,
-                            LookupFromFile);
-}
-} // namespace clang
+//===--- ResourceSearch.h - Searching for Resources -------------*- C++ -*-===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+//
+// User-provided filters include/exclude profile instrumentation in certain
+// functions or files.
+//
+//===----------------------------------------------------------------------===//
+
+#include "clang/Basic/ResourceSearch.h"
+#include "clang/Basic/FileManager.h"
+
+namespace clang {
+
+template <typename Strings>
+OptionalFileEntryRef LookupFileWithImpl(StringRef Filename, bool isAngled,
+                                        bool OpenFile, FileManager &FM,
+                                        const Strings &SearchEntries,
+                                        OptionalFileEntryRef LookupFromFile) {
+  if (llvm::sys::path::is_absolute(Filename)) {
+    // lookup path or immediately fail
+    llvm::Expected<FileEntryRef> ShouldBeEntry = FM.getFileRef(
+        Filename, OpenFile, /*CacheFailure=*/true, /*IsText=*/false);
+    return llvm::expectedToOptional(std::move(ShouldBeEntry));
+  }
+
+  auto SeparateComponents = [](SmallVectorImpl<char> &LookupPath,
+                               StringRef StartingFrom, StringRef FileName,
+                               bool RemoveInitialFileComponentFromLookupPath) {
+    llvm::sys::path::native(StartingFrom, LookupPath);
+    if (RemoveInitialFileComponentFromLookupPath)
+      llvm::sys::path::remove_filename(LookupPath);
+    if (!LookupPath.empty() &&
+        !llvm::sys::path::is_separator(LookupPath.back())) {
+      LookupPath.push_back(llvm::sys::path::get_separator().front());
+    }
+    LookupPath.append(FileName.begin(), FileName.end());
+  };
+
+  // Otherwise, it's search time!
+  SmallString<512> LookupPath;
+  // Non-angled lookup
+  if (!isAngled) {
+    // Use file-based lookup.
+    if (LookupFromFile) {
+      SmallString<1024> TmpDir;
+      TmpDir = LookupFromFile->getDir().getName();
+      llvm::sys::path::append(TmpDir, Filename);
+      if (!TmpDir.empty()) {
+        llvm::Expected<FileEntryRef> ShouldBeEntry = FM.getFileRef(
+            TmpDir, OpenFile, /*CacheFailure=*/true, /*IsText=*/false);
+        if (ShouldBeEntry)
+          return llvm::expectedToOptional(std::move(ShouldBeEntry));
+        llvm::consumeError(ShouldBeEntry.takeError());
+      }
+    }
+
+    // Otherwise, do working directory lookup.
+    LookupPath.clear();
+    auto MaybeWorkingDirEntry = FM.getDirectoryRef(".");
+    if (MaybeWorkingDirEntry) {
+      DirectoryEntryRef WorkingDirEntry = *MaybeWorkingDirEntry;
+      StringRef WorkingDir = WorkingDirEntry.getName();
+      if (!WorkingDir.empty()) {
+        SeparateComponents(LookupPath, WorkingDir, Filename, false);
+        llvm::Expected<FileEntryRef> ShouldBeEntry = FM.getFileRef(
+            LookupPath, OpenFile, /*CacheFailure=*/true, /*IsText=*/false);
+        if (ShouldBeEntry)
+          return llvm::expectedToOptional(std::move(ShouldBeEntry));
+        llvm::consumeError(ShouldBeEntry.takeError());
+      }
+    }
+  }
+
+  for (const auto &Entry : SearchEntries) {
+    LookupPath.clear();
+    SeparateComponents(LookupPath, Entry, Filename, false);
+    llvm::Expected<FileEntryRef> ShouldBeEntry = FM.getFileRef(
+        LookupPath, OpenFile, /*CacheFailure=*/true, /*IsText=*/false);
+    if (ShouldBeEntry)
+      return llvm::expectedToOptional(std::move(ShouldBeEntry));
+    llvm::consumeError(ShouldBeEntry.takeError());
+  }
+  return std::nullopt;
+}
+
+OptionalFileEntryRef
+LookupFileWithStdVec(StringRef Filename, bool isAngled, bool OpenFile,
+                     FileManager &FM,
+                     const std::vector<std::string> &SearchEntries,
+                     OptionalFileEntryRef LookupFromFile) {
+  return LookupFileWithImpl(Filename, isAngled, OpenFile, FM, SearchEntries,
+                            LookupFromFile);
+}
+
+OptionalFileEntryRef LookupFileWith(StringRef Filename, bool isAngled,
+                                    bool OpenFile, FileManager &FM,
+                                    ArrayRef<StringRef> SearchEntries,
+                                    OptionalFileEntryRef LookupFromFile) {
+  return LookupFileWithImpl(Filename, isAngled, OpenFile, FM, SearchEntries,
+                            LookupFromFile);
+}
+} // namespace clang
diff --git a/clang/lib/Frontend/DependencyFile.cpp b/clang/lib/Frontend/DependencyFile.cpp
index 5c2d5b794ed49..8587a4061d78b 100644
--- a/clang/lib/Frontend/DependencyFile.cpp
+++ b/clang/lib/Frontend/DependencyFile.cpp
@@ -106,15 +106,16 @@ struct DepCollectorPPCallbacks : public PPCallbacks {
     // Files that actually exist are handled by FileChanged.
   }
 
-  enum IsRecursive : bool {
-    Flat = false,
-    Recursive = true
-  };
+  enum IsRecursive : bool { Flat = false, Recursive = true };
 
-  static inline void DoSearch(FileManager& FM, const PatternFilter& Filter, DependencyCollector& DepCollector, StringRef Dir, IsRecursive Recurse) {
+  static inline void DoSearch(FileManager &FM, const PatternFilter &Filter,
+                              DependencyCollector &DepCollector, StringRef Dir,
+                              IsRecursive Recurse) {
     std::error_code EC;
-    for (llvm::vfs::directory_iterator FileIt = FM.getVirtualFileSystem().dir_begin(Dir, EC), FileEnd = {};
-          FileIt != FileEnd && !EC; FileIt.increment(EC)) {
+    for (llvm::vfs::directory_iterator
+             FileIt = FM.getVirtualFileSystem().dir_begin(Dir, EC),
+             FileEnd = {};
+         FileIt != FileEnd && !EC; FileIt.increment(EC)) {
       const auto &File = *FileIt;
       switch (File.type()) {
       case llvm::sys::fs::file_type::directory_file: {
@@ -147,25 +148,29 @@ struct DepCollectorPPCallbacks : public PPCallbacks {
                        OptionalFileEntryRef CurrentFile) override {
     if (Pattern.empty())
       return;
-    FileManager& FM = PP.getFileManager();
-    llvm::vfs::FileSystem& VFS = FM.getVirtualFileSystem();
+    FileManager &FM = PP.getFileManager();
+    llvm::vfs::FileSystem &VFS = FM.getVirtualFileSystem();
     if (Filter.SearchRoot.empty()) {
       // nothing we can do for ourselves here, just check the file directly and
       // leave
       if (Filter.RootHandling == RootPatternScanType::None) {
         // it's either a directory or a file; add the dependency as-is
-        DepCollector.maybeAddDependency(Filter.Input,
-                                        /*FromModule*/ false,
-                                        /*IsSystem*/ false,
-                                        /*IsModuleFile*/ false,
-                                        /*IsMissing*/ !VFS.exists(Filter.Pattern));
+        DepCollector.maybeAddDependency(
+            Filter.Input,
+            /*FromModule*/ false,
+            /*IsSystem*/ false,
+            /*IsModuleFile*/ false,
+            /*IsMissing*/ !VFS.exists(Filter.Pattern));
         return;
       }
       // if there's no search root, simply search from the current file's
       // working directory (if it's quoted)
       if (!IsAngled && CurrentFile) {
         StringRef CurrentDir = CurrentFile->getDir().getName();
-        DoSearch(FM, Filter, DepCollector, CurrentDir, Filter.RootHandling == RootPatternScanType::Directory ? Flat : Recursive);
+        DoSearch(FM, Filter, DepCollector, CurrentDir,
+                 Filter.RootHandling == RootPatternScanType::Directory
+                     ? Flat
+                     : Recursive);
       }
       return;
     }
@@ -185,7 +190,9 @@ struct DepCollectorPPCallbacks : public PPCallbacks {
     } else {
       if (VFS.exists(Filter.PatternRoot)) {
         DoSearch(FM, Filter, DepCollector, Filter.PatternRoot,
-          Filter.RootHandling == RootPatternScanType::Directory ? Flat : Recursive);
+                 Filter.RootHandling == RootPatternScanType::Directory
+                     ? Flat
+                     : Recursive);
       }
     }
   }
diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp
index f456430cb95bf..bfd93a6bbd31d 100644
--- a/clang/lib/Lex/PPDirectives.cpp
+++ b/clang/lib/Lex/PPDirectives.cpp
@@ -1194,8 +1194,10 @@ OptionalFileEntryRef Preprocessor::LookupEmbedFile(StringRef Filename,
                                                    bool isAngled,
                                                    bool OpenFile) {
   FileManager &FM = this->getFileManager();
-  OptionalFileEntryRef LookupFromFileHere = getCurrentFileLexer()->getFileEntry();
-  return LookupFileWithStdVec(Filename, isAngled, OpenFile, FM, PPOpts.EmbedEntries, LookupFromFileHere);
+  OptionalFileEntryRef LookupFromFileHere =
+      getCurrentFileLexer()->getFileEntry();
+  return LookupFileWithStdVec(Filename, isAngled, OpenFile, FM,
+                              PPOpts.EmbedEntries, LookupFromFileHere);
 }
 
 //===----------------------------------------------------------------------===//
@@ -4136,19 +4138,19 @@ void Preprocessor::HandleEmbedDirective(SourceLocation HashLoc,
 }
 
 void Preprocessor::HandleDependDirective(SourceLocation HashLoc,
-                                       Token &DependTok) {
+                                         Token &DependTok) {
   // Give the usual extension/compatibility warnings.
-  Diag(DependTok, diag::ext_pp_depend_directive)
-        << /*Clang*/ 1;
+  Diag(DependTok, diag::ext_pp_depend_directive) << /*Clang*/ 1;
   // It's always a clang extension: it will become a C++2c extension after
   // more WG21 work later. Remember to come back and tweak this!
 
-  // this unfortunately has no meaning but it's part of the grammar for the future so we should parse it normally
+  // this unfortunately has no meaning but it's part of the grammar for the
+  // future so we should parse it normally
   bool IsExported = false;
   Token PatternTok;
   Lex(PatternTok);
   if (PatternTok.is(tok::kw_export)) {
-      IsExported = true;
+    IsExported = true;
   }
 
   // Parse the pattern header-name, with a potential first skip
@@ -4170,12 +4172,10 @@ void Preprocessor::HandleDependDirective(SourceLocation HashLoc,
     DiscardUntilEndOfDirective();
     return;
   }
-  
-  
+
   SmallString<256> PatternBuffer;
   StringRef Pattern = getSpelling(PatternTok, PatternBuffer);
-  bool IsAngled =
-      GetIncludeFilenameSpelling(PatternTok.getLocation(), Pattern);
+  bool IsAngled = GetIncludeFilenameSpelling(PatternTok.getLocation(), Pattern);
   // Every pattern is local to where it was found, so prepend the current
   // directory of the file if it's a non-absolute path from the perspective of
   // this current header file
@@ -4185,10 +4185,12 @@ void Preprocessor::HandleDependDirective(SourceLocation HashLoc,
     FileID ThisFID = ThisFileLexer->getFileID();
     CurrentFile = SourceMgr.getFileEntryRefForID(ThisFID);
   }
-  const PatternFilter& Filter
-    = InputDependencyPatterns->Add(Pattern.str(), IsAngled, IsExported, getFileManager(), PPOpts.EmbedEntries, CurrentFile);
+  const PatternFilter &Filter = InputDependencyPatterns->Add(
+      Pattern.str(), IsAngled, IsExported, getFileManager(),
+      PPOpts.EmbedEntries, CurrentFile);
   if (Callbacks)
-    Callbacks->DependDirective(HashLoc, DependTok, Pattern, IsAngled, Filter, CurrentFile);
+    Callbacks->DependDirective(HashLoc, DependTok, Pattern, IsAngled, Filter,
+                               CurrentFile);
 }
 
 /// HandleCXXImportDirective - Handle the C++ modules import directives
diff --git a/clang/lib/Lex/Preprocessor.cpp b/clang/lib/Lex/Preprocessor.cpp
index 8f17af97f551b..7350fceb05706 100644
--- a/clang/lib/Lex/Preprocessor.cpp
+++ b/clang/lib/Lex/Preprocessor.cpp
@@ -1090,7 +1090,8 @@ void Preprocessor::LexTokensUntilEOF(std::vector<Token> *Tokens) {
 ///        token is a '<').
 /// \return \c true if we reached EOD or EOF while looking for a > token in
 ///         a concatenated header name and diagnosed it. \c false otherwise.
-bool Preprocessor::LexHeaderName(Token &FilenameTok, bool AllowMacroExpansion, bool SkipFirst) {
+bool Preprocessor::LexHeaderName(Token &FilenameTok, bool AllowMacroExpansion,
+                                 bool SkipFirst) {
   // Lex using header-name tokenization rules if tokens are being lexed from
   // a file. Just grab a token normally if we're in a macro expansion.
   if (!SkipFirst) {
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 05a2d6bd7bffc..3c5c1e5d52123 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -6777,7 +6777,8 @@ bool Sema::BuiltinCountedByRef(CallExpr *TheCall) {
 
 bool Sema::BuiltinStdEmbed(CallExpr *TheCall) {
   const bool HasProperArgCount = !checkArgCountAtLeast(TheCall, 6);
-  const bool HasExtraLimitArg = !checkArgCountAtMost(TheCall, 7) && TheCall->getNumArgs() == 7;
+  const bool HasExtraLimitArg =
+      !checkArgCountAtMost(TheCall, 7) && TheCall->getNumArgs() == 7;
   if (!HasProperArgCount && !HasExtraLimitArg)
     return true;
 
@@ -6797,23 +6798,19 @@ bool Sema::BuiltinStdEmbed(CallExpr *TheCall) {
   const uint64_t CharSize = Context.getCharWidth();
   // Status argument type
   QualType StatusRefTy = StatusRef->getType();
-  if ((!StatusRefTy->isIntegralOrUnscopedEnumerationType())
-      || StatusRefTy.isConstant(Context)
-      || !StatusRef->isLValue()) {
+  if ((!StatusRefTy->isIntegralOrUnscopedEnumerationType()) ||
+      StatusRefTy.isConstant(Context) || !StatusRef->isLValue()) {
     Diag(TheCall->getBeginLoc(), diag::err_invalid_builtin_argument)
-      << StatusRef << "__builtin_std_embed"
-      << StatusRef->getSourceRange();
+        << StatusRef << "__builtin_std_embed" << StatusRef->getSourceRange();
     return true;
   }
 
   // Size argument type
   QualType SizeRefTy = SizeRef->getType();
-  if ((!SizeRefTy->isIntegralOrUnscopedEnumerationType())
-      || SizeRefTy.isConstant(Context)
-      || !SizeRef->isLValue()) {
+  if ((!SizeRefTy->isIntegralOrUnscopedEnumerationType()) ||
+      SizeRefTy.isConstant(Context) || !SizeRef->isLValue()) {
     Diag(TheCall->getBeginLoc(), diag::err_invalid_builtin_argument)
-      << SizeRef << "__builtin_std_embed"
-      << SizeRef->getSourceRange();
+        << SizeRef << "__builtin_std_embed" << SizeRef->getSourceRange();
     return true;
   }
 
@@ -6823,30 +6820,26 @@ bool Sema::BuiltinStdEmbed(CallExpr *TheCall) {
   // it to be treated as an RValue, and we need to peel that off so it can be
   // treated as an LValue, if possible.
   QualType PtrRefTy = PtrRef->getType();
-  if (!PtrRefTy->isPointerType()
-      || PtrRefTy.isConstant(Context)) {
+  if (!PtrRefTy->isPointerType() || PtrRefTy.isConstant(Context)) {
     Diag(TheCall->getBeginLoc(), diag::err_invalid_builtin_argument)
-      << PtrRefTy << "__builtin_std_embed"
-      << PtrRef->getSourceRange();
+        << PtrRefTy << "__builtin_std_embed" << PtrRef->getSourceRange();
     return true;
   }
   QualType ArrElementTy = PtrRefTy->getPointeeType();
-  if (!ArrElementTy.isConstant(Context)
-      || !(Context.getTypeSize(ArrElementTy) == CharSize
-        && Context.getTypeAlign(ArrElementTy) == CharSize
-        && ArrElementTy->isIntegralOrEnumerationType())) {
+  if (!ArrElementTy.isConstant(Context) ||
+      !(Context.getTypeSize(ArrElementTy) == CharSize &&
+        Context.getTypeAlign(ArrElementTy) == CharSize &&
+        ArrElementTy->isIntegralOrEnumerationType())) {
     Diag(TheCall->getBeginLoc(), diag::err_invalid_builtin_argument)
-      << PtrRef << "__builtin_std_embed"
-      << PtrRef->getSourceRange();
+        << PtrRef << "__builtin_std_embed" << PtrRef->getSourceRange();
     return true;
   }
 
-  if (!(ArrElementTy->isIntegralOrEnumerationType()
-        && Context.getTypeSize(ArrElementTy) == CharSize
-        && Context.getTypeAlign(ArrElementTy) == CharSize)) {
+  if (!(ArrElementTy->isIntegralOrEnumerationType() &&
+        Context.getTypeSize(ArrElementTy) == CharSize &&
+        Context.getTypeAlign(ArrElementTy) == CharSize)) {
     Diag(TheCall->getBeginLoc(), diag::err_invalid_builtin_argument)
-      << PtrRef << "__builtin_std_embed"
-      << PtrRef->getSourceRange();
+        << PtrRef << "__builtin_std_embed" << PtrRef->getSourceRange();
     return true;
   }
 
@@ -6855,60 +6848,66 @@ bool Sema::BuiltinStdEmbed(CallExpr *TheCall) {
   QualType ResourceNameSizeTy = ResourceNameSize->getType();
   if (!ResourceNameSizeTy->isIntegralOrEnumerationType()) {
     Expr *ResourceNameSizeMutable = const_cast<Expr *>(ResourceNameSize);
-    ExprResult ImplicitResourceNameSizeFixupResult = PerformImplicitConversion(ResourceNameSizeMutable, SizeType, AssignmentAction::Passing);
+    ExprResult ImplicitResourceNameSizeFixupResult = PerformImplicitConversion(
+        ResourceNameSizeMutable, SizeType, AssignmentAction::Passing);
     if (!ImplicitResourceNameSizeFixupResult.isUsable()) {
-      Diag(TheCall->getBeginLoc(), diag::err_typecheck_converted_constant_expression)
-        << ResourceNameSizeTy << SizeType;
+      Diag(TheCall->getBeginLoc(),
+           diag::err_typecheck_converted_constant_expression)
+          << ResourceNameSizeTy << SizeType;
       return true;
     }
     // The implicit conversion worked -- adjust the builtin's argument.
-    TheCall->setArg(ResourceNameSizeIndex, ImplicitResourceNameSizeFixupResult.get());
+    TheCall->setArg(ResourceNameSizeIndex,
+                    ImplicitResourceNameSizeFixupResult.get());
   }
 
   // Pointer to an appropriate string type
   // (char, wchar_t, or char8_t)
   QualType ResourceNamePtrTy = ResourceNamePtr->getType();
   if (!ResourceNamePtrTy->isPointerType()) {
-    const QualType AllowedTypes[3] = {
-      Context.getPointerType(Context.CharTy),
-      Context.getPointerType(Context.WCharTy),
-      Context.getPointerType(Context.Char8Ty)
-    };
-    Expr *ResourceNamePtrMutable =  const_cast<Expr *>(ResourceNamePtr);
+    const QualType AllowedTypes[3] = {Context.getPointerType(Context.CharTy),
+                                      Context.getPointerType(Context.WCharTy),
+                                      Context.getPointerType(Context.Char8Ty)};
+    Expr *ResourceNamePtrMutable = const_cast<Expr *>(ResourceNamePtr);
     ExprResult ImplicitResourceNamePtrFixupResult;
-    for (const QualType& DesiredType : AllowedTypes) {
-      ImplicitResourceNamePtrFixupResult = PerformImplicitConversion(ResourceNamePtrMutable, DesiredType, AssignmentAction::Passing);
+    for (const QualType &DesiredType : AllowedTypes) {
+      ImplicitResourceNamePtrFixupResult = PerformImplicitConversion(
+          ResourceNamePtrMutable, DesiredType, AssignmentAction::Passing);
       if (ImplicitResourceNamePtrFixupResult.isUsable()) {
         break;
       }
     }
     if (!ImplicitResourceNamePtrFixupResult.isUsable()) {
-      Diag(ResourceNamePtr->getBeginLoc(), diag::err_typecheck_converted_constant_expression)
-         << ResourceNamePtrTy << "a pointer to char, wchar_t, or char8_t";
+      Diag(ResourceNamePtr->getBeginLoc(),
+           diag::err_typecheck_converted_constant_expression)
+          << ResourceNamePtrTy << "a pointer to char, wchar_t, or char8_t";
       return true;
     }
-    TheCall->setArg(ResourceNamePtrIndex, ImplicitResourceNamePtrFixupResult.get());
+    TheCall->setArg(ResourceNamePtrIndex,
+                    ImplicitResourceNamePtrFixupResult.get());
     ResourceNamePtr = TheCall->getArg(ResourceNamePtrIndex);
     ResourceNamePtrTy = ResourceNamePtr->getType();
   }
-  QualType ResourceNameCharTy(ResourceNamePtrTy->getPointeeOrArrayElementType(), 0);
-  if (!ResourceNameCharTy->isCharType()
-      && !ResourceNameCharTy->isChar8Type()
-      && !ResourceNameCharTy->isWideCharType()) {
-      Diag(ResourceNamePtr->getBeginLoc(), diag::err_typecheck_convert_incompatible_pointer)
+  QualType ResourceNameCharTy(ResourceNamePtrTy->getPointeeOrArrayElementType(),
+                              0);
+  if (!ResourceNameCharTy->isCharType() && !ResourceNameCharTy->isChar8Type() &&
+      !ResourceNameCharTy->isWideCharType()) {
+    Diag(ResourceNamePtr->getBeginLoc(),
+         diag::err_typecheck_convert_incompatible_pointer)
         << 1 << 1 << 1 << 0;
-      return true;
-    
+    return true;
   }
 
   // Check offset is an integer-convertible argument
   QualType OffsetTy = Offset->getType();
   if (!OffsetTy->isIntegralOrEnumerationType()) {
-    Expr *OffsetMutable =  const_cast<Expr *>(Offset);
-    ExprResult ImplicitOffsetFixupResult = PerformImplicitConversion(OffsetMutable, SizeType, AssignmentAction::Passing);
+    Expr *OffsetMutable = const_cast<Expr *>(Offset);
+    ExprResult ImplicitOffsetFixupResult = PerformImplicitConversion(
+        OffsetMutable, SizeType, AssignmentAction::Passing);
     if (!ImplicitOffsetFixupResult.isUsable()) {
-      Diag(TheCall->getBeginLoc(), diag::err_typecheck_converted_constant_expression)
-        << ResourceNameSizeTy << SizeType;
+      Diag(TheCall->getBeginLoc(),
+           diag::err_typecheck_converted_constant_expression)
+          << ResourceNameSizeTy << SizeType;
       return true;
     }
     // The implicit conversion worked -- adjust the builtin's argument.
@@ -6919,11 +6918,13 @@ bool Sema::BuiltinStdEmbed(CallExpr *TheCall) {
     // If present, final argument is offset
     QualType LimitTy = Limit->getType();
     if (!LimitTy->isIntegralOrEnumerationType()) {
-      Expr *LimitMutable =  const_cast<Expr *>(Limit);
-      ExprResult ImplicitLimitFixupResult = PerformImplicitConversion(LimitMutable, SizeType, AssignmentAction::Passing);
+      Expr *LimitMutable = const_cast<Expr *>(Limit);
+      ExprResult ImplicitLimitFixupResult = PerformImplicitConversion(
+          LimitMutable, SizeType, AssignmentAction::Passing);
       if (!ImplicitLimitFixupResult.isUsable()) {
-        Diag(TheCall->getBeginLoc(), diag::err_typecheck_converted_constant_expression)
-        << ResourceNameSizeTy << SizeType;
+        Diag(TheCall->getBeginLoc(),
+             diag::err_typecheck_converted_constant_expression)
+            << ResourceNameSizeTy << SizeType;
         return true;
       }
       // The implicit conversion worked -- adjust the builtin's argument.

>From f850b218ddf5aa456ba5c92bff5942e1d750365d Mon Sep 17 00:00:00 2001
From: ThePhD <phdofthehouse at gmail.com>
Date: Wed, 8 Apr 2026 03:37:12 -0400
Subject: [PATCH 4/7] =?UTF-8?q?[Clang][Frontend]=20=F0=9F=90=9B=20Synchron?=
 =?UTF-8?q?ize=20with=20Dependency=20File=20Collection=20Improvements?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 clang/lib/Frontend/DependencyFile.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/clang/lib/Frontend/DependencyFile.cpp b/clang/lib/Frontend/DependencyFile.cpp
index 8587a4061d78b..2ce01b53f80fb 100644
--- a/clang/lib/Frontend/DependencyFile.cpp
+++ b/clang/lib/Frontend/DependencyFile.cpp
@@ -131,6 +131,7 @@ struct DepCollectorPPCallbacks : public PPCallbacks {
                                           /*FromModule*/ false,
                                           /*IsSystem*/ false,
                                           /*IsModuleFile*/ false,
+                                          /*IsDirectModuleImport*/ false,
                                           /*IsMissing*/ false);
         }
         break;
@@ -160,6 +161,7 @@ struct DepCollectorPPCallbacks : public PPCallbacks {
             /*FromModule*/ false,
             /*IsSystem*/ false,
             /*IsModuleFile*/ false,
+            /*IsDirectModuleImport*/ false,
             /*IsMissing*/ !VFS.exists(Filter.Pattern));
         return;
       }
@@ -185,6 +187,7 @@ struct DepCollectorPPCallbacks : public PPCallbacks {
                                         /*FromModule*/ false,
                                         /*IsSystem*/ false,
                                         /*IsModuleFile*/ false,
+                                        /*IsDirectModuleImport*/ false,
                                         /*IsMissing*/ false);
       }
     } else {

>From 58cb5a5665f3097b8ec5d3dfb9616da9ec84ab7c Mon Sep 17 00:00:00 2001
From: ThePhD <phdofthehouse at gmail.com>
Date: Sun, 12 Apr 2026 08:17:43 +0200
Subject: [PATCH 5/7] =?UTF-8?q?[Clang][AST][Sema]=20=F0=9F=8E=A8=20rename?=
 =?UTF-8?q?=20to=20clang-specific=20builtin=20(no=20real=20agreement=20wit?=
 =?UTF-8?q?h=20GCC=20after=20all)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 clang/docs/LanguageExtensions.rst     |  8 +++---
 clang/include/clang/Basic/Builtins.td |  2 +-
 clang/lib/AST/ExprConstant.cpp        | 19 ++++++++++-----
 clang/lib/Sema/SemaChecking.cpp       | 12 ++++-----
 libcxx/include/embed                  | 35 +++++++++++++++++++--------
 5 files changed, 49 insertions(+), 27 deletions(-)

diff --git a/clang/docs/LanguageExtensions.rst b/clang/docs/LanguageExtensions.rst
index ad6890a48973b..5115da3b00d13 100644
--- a/clang/docs/LanguageExtensions.rst
+++ b/clang/docs/LanguageExtensions.rst
@@ -5417,7 +5417,7 @@ manner as the above four builtins, except that ``_M_function_name`` is populated
 with ``__PRETTY_FUNCTION__`` rather than ``__FUNCTION__``.
 
 
-Data embedding builtin ``__builtin_std_embed``
+Data embedding builtin ``__builtin_clang_embed``
 ----------------------------------------------
 
 For use with `p1040 <https://wg21.link/p1040>`'s ``std::embed`` directive. It
@@ -5426,14 +5426,14 @@ is conceptually (but not exactly) represented by the following overloads:
 .. code-block:: c++
 
   template <class Byte, class Char>
-  Byte const* __builtin_std_embed(int& status,
+  Byte const* __builtin_clang_embed(int& status,
                                size_t& size, T const* type_hint_ptr,
                                size_t resource_name_size,
                                Char const* resource_name_ptr,
                                size_t offset);
 
   template <class Byte, class Char>
-  Byte const* __builtin_std_embed(int& status,
+  Byte const* __builtin_clang_embed(int& status,
                                size_t& size, T const* type_hint_ptr,
                                size_t resource_name_size,
                                Char const* resource_name_ptr,
@@ -5486,7 +5486,7 @@ same way as ``#embed`` files, with the caveat that any file not blessed by
 searches as-if done by a quoted header name for a ``#embed`` directive.
 
 The data returned may not be unique, may prefix into other data, and has no
-guarantee that caching may apply. That is, calling ``__builtin_std_embed`` with
+guarantee that caching may apply. That is, calling ``__builtin_clang_embed`` with
 the exact same arguments twice may return two different pointers or the same
 pointer, and is subject to everything from optimization level, implementation
 effort, and whether or not it is sunny outside right now. Block devices such
diff --git a/clang/include/clang/Basic/Builtins.td b/clang/include/clang/Basic/Builtins.td
index c8fa0b2cab9a7..1cd3b4200d79e 100644
--- a/clang/include/clang/Basic/Builtins.td
+++ b/clang/include/clang/Basic/Builtins.td
@@ -1008,7 +1008,7 @@ def GetVtablePointer : LangBuiltin<"CXX_LANG"> {
 
 // p1040 std::embed
 def StdEmbed : Builtin {
-  let Spellings = ["__builtin_std_embed"];
+  let Spellings = ["__builtin_clang_embed"];
   let Attributes = [NoThrow, Const, Consteval];
   let Prototype = "void const*(int&, size_t&, ...)";
 }
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index f7d01bd52a44a..c750481a28563 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -10697,7 +10697,7 @@ bool PointerExprEvaluator::VisitBuiltinCallExpr(const CallExpr *E,
         return false;
     }
   }
-  case Builtin::BI__builtin_std_embed: {
+  case Builtin::BI__builtin_clang_embed: {
     constexpr uint64_t FileNotFound = 0;
     constexpr uint64_t FileFound = 1;
     constexpr uint64_t FileFoundAndEmpty = 2;
@@ -10710,7 +10710,8 @@ bool PointerExprEvaluator::VisitBuiltinCallExpr(const CallExpr *E,
     const Expr *OffsetArg = E->getArg(5);
     const Expr *LimitArg = E->getNumArgs() == 7 ? E->getArg(6) : nullptr;
 
-    QualType ArrElementTy = PtrOutArg->getType()->getPointeeType();
+    QualType PtrOutTy = PtrOutArg->getType();
+    QualType ArrElementTy = PtrOutTy->getPointeeType();
 
     LValue ResourceNamePtrLVal;
     if (!EvaluatePointer(ResourceNamePtrArg, ResourceNamePtrLVal, Info)) {
@@ -10883,10 +10884,11 @@ bool PointerExprEvaluator::VisitBuiltinCallExpr(const CallExpr *E,
     OptionalFileEntryRef ResourceFile = LookupFileWithStdVec(
         ResourceName, false, true, FM, *MaybeSearchEntries, ThisFile);
     if (!ResourceFile) {
+      Result.setNull(Info.Ctx, PtrOutTy);
       return WriteOutStatus(FileNotFound);
     }
     assert(Info.Ctx.InputDependencyPatterns &&
-           "using __builtin_std_embed requires the context to have a usable "
+           "using __builtin_clang_embed requires the context to have a usable "
            "input dependency patterns");
     StringRef ResourceSearchName =
         ResourceFile->getFileEntry().tryGetRealPathName();
@@ -10897,15 +10899,20 @@ bool PointerExprEvaluator::VisitBuiltinCallExpr(const CallExpr *E,
       // Not matching a dependency is also simply considered not
       // finding the file. Consider possibly returnig a different value in the
       // future.
+      Result.setNull(Info.Ctx, PtrOutTy);
       return WriteOutStatus(FileNotFound);
     }
     size_t FullDataSize = ResourceFile->getSize();
+    if (FullDataSize == 0 || DataOffset > FullDataSize) {
+      Result.setNull(Info.Ctx, PtrOutTy);
+      return WriteOutStatus(FileFoundAndEmpty);
+    }
     DataSize = std::max<size_t>(
         0, std::min<size_t>(
-               DataOffset > FullDataSize ? 0 : FullDataSize - DataOffset,
+               FullDataSize - DataOffset,
                MaybeLimit ? *MaybeLimit : std::numeric_limits<size_t>::max()));
-
-    if (FullDataSize == 0 || DataSize == 0) {
+    if (DataSize == 0) {
+      Result.setNull(Info.Ctx, PtrOutTy);
       return WriteOutStatus(FileFoundAndEmpty);
     }
     llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> MaybeBinaryData =
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 3c5c1e5d52123..fe2660a2ac4ae 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -3852,7 +3852,7 @@ Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, unsigned BuiltinID,
     if (BuiltinCountedByRef(TheCall))
       return ExprError();
     break;
-  case Builtin::BI__builtin_std_embed:
+  case Builtin::BI__builtin_clang_embed:
     // while we do not have Custom Typechecking,
     // we have a `...` signature, so we do need to
     // at least gently inspect some of the arguments
@@ -6801,7 +6801,7 @@ bool Sema::BuiltinStdEmbed(CallExpr *TheCall) {
   if ((!StatusRefTy->isIntegralOrUnscopedEnumerationType()) ||
       StatusRefTy.isConstant(Context) || !StatusRef->isLValue()) {
     Diag(TheCall->getBeginLoc(), diag::err_invalid_builtin_argument)
-        << StatusRef << "__builtin_std_embed" << StatusRef->getSourceRange();
+        << StatusRef << "__builtin_clang_embed" << StatusRef->getSourceRange();
     return true;
   }
 
@@ -6810,7 +6810,7 @@ bool Sema::BuiltinStdEmbed(CallExpr *TheCall) {
   if ((!SizeRefTy->isIntegralOrUnscopedEnumerationType()) ||
       SizeRefTy.isConstant(Context) || !SizeRef->isLValue()) {
     Diag(TheCall->getBeginLoc(), diag::err_invalid_builtin_argument)
-        << SizeRef << "__builtin_std_embed" << SizeRef->getSourceRange();
+        << SizeRef << "__builtin_clang_embed" << SizeRef->getSourceRange();
     return true;
   }
 
@@ -6822,7 +6822,7 @@ bool Sema::BuiltinStdEmbed(CallExpr *TheCall) {
   QualType PtrRefTy = PtrRef->getType();
   if (!PtrRefTy->isPointerType() || PtrRefTy.isConstant(Context)) {
     Diag(TheCall->getBeginLoc(), diag::err_invalid_builtin_argument)
-        << PtrRefTy << "__builtin_std_embed" << PtrRef->getSourceRange();
+        << PtrRefTy << "__builtin_clang_embed" << PtrRef->getSourceRange();
     return true;
   }
   QualType ArrElementTy = PtrRefTy->getPointeeType();
@@ -6831,7 +6831,7 @@ bool Sema::BuiltinStdEmbed(CallExpr *TheCall) {
         Context.getTypeAlign(ArrElementTy) == CharSize &&
         ArrElementTy->isIntegralOrEnumerationType())) {
     Diag(TheCall->getBeginLoc(), diag::err_invalid_builtin_argument)
-        << PtrRef << "__builtin_std_embed" << PtrRef->getSourceRange();
+        << PtrRef << "__builtin_clang_embed" << PtrRef->getSourceRange();
     return true;
   }
 
@@ -6839,7 +6839,7 @@ bool Sema::BuiltinStdEmbed(CallExpr *TheCall) {
         Context.getTypeSize(ArrElementTy) == CharSize &&
         Context.getTypeAlign(ArrElementTy) == CharSize)) {
     Diag(TheCall->getBeginLoc(), diag::err_invalid_builtin_argument)
-        << PtrRef << "__builtin_std_embed" << PtrRef->getSourceRange();
+        << PtrRef << "__builtin_clang_embed" << PtrRef->getSourceRange();
     return true;
   }
 
diff --git a/libcxx/include/embed b/libcxx/include/embed
index fc5304c6a08d7..97217e6c189c4 100644
--- a/libcxx/include/embed
+++ b/libcxx/include/embed
@@ -65,33 +65,48 @@ consteval span<const T, Limit> embed(u8string_view resource_idenfier,
 
 // FIXME: the versioning stuff out of Clang is... Not Great! __cplusplus is still like 202400L for -std=c++2c, which is
 // not even in the ballpark of correct.
-#if 1 //_LIBCPP_STD_VER > 26 && __has_builtin(__builtin_std_embed)
+#if 1 //_LIBCPP_STD_VER > 26 && (__has_builtin(__builtin_clang_embed) || __has_builtin(__builtin_gnu_embed))
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
 namespace __embed_detail {
 template <typename _Byte, size_t _Extent, typename _StrView>
 consteval _LIBCPP_HIDE_FROM_ABI span<const _Byte, _Extent>
-__embed(const _StrView& __resource_identifier, size_t __offset, [[maybe_unused]] optional<size_t> __limit) {
+__embed(const _StrView& __resource_identifier, size_t __offset, [[maybe_unused]] const optional<size_t>& __limit) {
   static_assert(sizeof(_Byte) == 1 && alignof(_Byte) == 1 && (is_integral<_Byte>::value || is_enum<_Byte>::value),
                 "embed data type must be a character type with a size and alignment of 1");
   size_t __size      = 0;
   _Byte const* __ptr = nullptr;
   int __status       = -1;
   if constexpr (_Extent != std::dynamic_extent) {
-    __ptr = __builtin_std_embed(
+#  if __has_builtin(__builtin_gnu_embed)
+    __ptr = __builtin_gnu_embed(
+        _Byte, __status, __size, __resource_identifier.size(), __resource_identifier.data(), __offset, _Extent);
+#  else
+    __ptr = __builtin_clang_embed(
         __status, __size, __ptr, __resource_identifier.size(), __resource_identifier.data(), __offset, _Extent);
+#  endif
   } else {
     if (__limit) {
-      __ptr = __builtin_std_embed(
+#  if __has_builtin(__builtin_gnu_embed)
+      __ptr = __builtin_gnu_embed(
+          _Byte, __status, __size, __resource_identifier.size(), __resource_identifier.data(), __offset, *__limit);
+#  else
+      __ptr = __builtin_clang_embed(
           __status, __size, __ptr, __resource_identifier.size(), __resource_identifier.data(), __offset, *__limit);
+#  endif
     } else {
-      __ptr = __builtin_std_embed(
+#  if __has_builtin(__builtin_gnu_embed)
+      __ptr = __builtin_gnu_embed(
+          _Byte, __status, __size, __resource_identifier.size(), __resource_identifier.data(), __offset);
+#  else
+      __ptr = __builtin_clang_embed(
           __status, __size, __ptr, __resource_identifier.size(), __resource_identifier.data(), __offset);
+#  endif
     }
   }
   if (__status == __STDC_EMBED_NOT_FOUND__) {
-    throw std::domain_error("file not found");
+    _LIBCPP_VERBOSE_ABORT("file not found");
   }
   if constexpr (_Extent != std::dynamic_extent) {
     if (_Extent > __size) {
@@ -127,21 +142,21 @@ embed(u8string_view __resource_identifier, size_t __offset = 0, optional<size_t>
 
 template <typename _Byte, size_t _Limit>
 consteval span<const _Byte, _Limit> embed(string_view __resource_identifier, size_t __offset = 0) {
-  return __embed_detail::__embed<_Byte, _Limit>(__resource_identifier, __offset, _Limit);
+  return __embed_detail::__embed<_Byte, _Limit>(__resource_identifier, __offset, nullopt);
 }
 
 template <typename _Byte, size_t _Limit>
 consteval span<const _Byte, _Limit> embed(wstring_view __resource_identifier, size_t __offset = 0) {
-  return __embed_detail::__embed<_Byte, _Limit>(__resource_identifier, __offset, _Limit);
+  return __embed_detail::__embed<_Byte, _Limit>(__resource_identifier, __offset, nullopt);
 }
 
 template <typename _Byte, size_t _Limit>
 consteval span<const _Byte, _Limit> embed(u8string_view __resource_identifier, size_t __offset = 0) {
-  return __embed_detail::__embed<_Byte, _Limit>(__resource_identifier, __offset, _Limit);
+  return __embed_detail::__embed<_Byte, _Limit>(__resource_identifier, __offset, nullopt);
 }
 
 _LIBCPP_END_NAMESPACE_STD
 
-#endif // _LIBCPP_STD_VER > 26 && __has_builtin(__builtin_std_embed)
+#endif // _LIBCPP_STD_VER > 26 && __has_builtin(__builtin_clang_embed)
 
 #endif // _LIBCPP_EMBED

>From 33d66e30a57042896f4b5250dae7b90fda054acb Mon Sep 17 00:00:00 2001
From: ThePhD <phdofthehouse at gmail.com>
Date: Tue, 14 Apr 2026 16:40:13 -0400
Subject: [PATCH 6/7] =?UTF-8?q?[Clang][Doc][AST][Sema]=20=F0=9F=8E=A8=20ma?=
 =?UTF-8?q?naged=20to=20make=20both=20the=20same=20for=20GCC,=20we=20are?=
 =?UTF-8?q?=20back=20on!?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 clang/docs/LanguageExtensions.rst     | 26 ++++++++--------
 clang/include/clang/Basic/Builtins.td |  2 +-
 clang/lib/AST/ExprConstant.cpp        |  4 +--
 clang/lib/Sema/SemaChecking.cpp       | 12 ++++----
 libcxx/include/embed                  | 43 ++++++++++-----------------
 5 files changed, 39 insertions(+), 48 deletions(-)

diff --git a/clang/docs/LanguageExtensions.rst b/clang/docs/LanguageExtensions.rst
index 5115da3b00d13..dac139cd4e407 100644
--- a/clang/docs/LanguageExtensions.rst
+++ b/clang/docs/LanguageExtensions.rst
@@ -5417,7 +5417,7 @@ manner as the above four builtins, except that ``_M_function_name`` is populated
 with ``__PRETTY_FUNCTION__`` rather than ``__FUNCTION__``.
 
 
-Data embedding builtin ``__builtin_clang_embed``
+Data embedding builtin ``__builtin_std_embed``
 ----------------------------------------------
 
 For use with `p1040 <https://wg21.link/p1040>`'s ``std::embed`` directive. It
@@ -5426,25 +5426,26 @@ is conceptually (but not exactly) represented by the following overloads:
 .. code-block:: c++
 
   template <class Byte, class Char>
-  Byte const* __builtin_clang_embed(int& status,
-                               size_t& size, T const* type_hint_ptr,
+  Byte const* __builtin_std_embed(int& status,
+                               size_t& size, T const* indicator_ptr,
                                size_t resource_name_size,
                                Char const* resource_name_ptr,
                                size_t offset);
 
   template <class Byte, class Char>
-  Byte const* __builtin_clang_embed(int& status,
-                               size_t& size, T const* type_hint_ptr,
+  Byte const* __builtin_std_embed(int& status,
+                               size_t& size, T const* indicator_ptr,
                                size_t resource_name_size,
                                Char const* resource_name_ptr,
                                size_t offset, size_t limit);
 
 The first argument is an output parameter status object. It will be
-filled with ``0`` is the file is not found or a suitable ``#depend`` clause
-does not bless the file that is found, ``1`` if the file is found, and ``2``
-if the file is found but it is empty. (These are the same values as the macros
-``__STDC_EMBED_NOT_FOUND__``, ``__STDC_EMBED_FOUND__``, and
-``__STDC_EMBED_EMPTY__``, respectively.)
+filled with:
+
+- ``0`` is the file is not found,
+- ``1`` if the file is found but not suitably ``#depend``ed on,
+- ``2`` if the file is found, properly ``#depend``ed on, but it was empty,
+- or, ``3`` if the file is found, properly ``#depend``ed on, and not empty.
 
 The second argument is an output parameter for the number of elements pointed
 to by the return type. If ``limit`` is provided, this value will be less than
@@ -5480,13 +5481,14 @@ of ``Byte`` objects that the returned value will point to. Less values can be
 pointed to than what ``limit`` describes.
 
 The ``offset`` value is applied before any ``limit`` is taken into
-consideration. The file name represented by the string range is searched in the
+consideration. Both values can make a file that has binary data be considered
+empty. The file name represented by the string range is searched in the
 same way as ``#embed`` files, with the caveat that any file not blessed by
 ``#depend`` will be treated as a file that is not found. All searches done are
 searches as-if done by a quoted header name for a ``#embed`` directive.
 
 The data returned may not be unique, may prefix into other data, and has no
-guarantee that caching may apply. That is, calling ``__builtin_clang_embed`` with
+guarantee that caching may apply. That is, calling ``__builtin_std_embed`` with
 the exact same arguments twice may return two different pointers or the same
 pointer, and is subject to everything from optimization level, implementation
 effort, and whether or not it is sunny outside right now. Block devices such
diff --git a/clang/include/clang/Basic/Builtins.td b/clang/include/clang/Basic/Builtins.td
index 1cd3b4200d79e..c8fa0b2cab9a7 100644
--- a/clang/include/clang/Basic/Builtins.td
+++ b/clang/include/clang/Basic/Builtins.td
@@ -1008,7 +1008,7 @@ def GetVtablePointer : LangBuiltin<"CXX_LANG"> {
 
 // p1040 std::embed
 def StdEmbed : Builtin {
-  let Spellings = ["__builtin_clang_embed"];
+  let Spellings = ["__builtin_std_embed"];
   let Attributes = [NoThrow, Const, Consteval];
   let Prototype = "void const*(int&, size_t&, ...)";
 }
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index c750481a28563..80eb22bda4f9a 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -10697,7 +10697,7 @@ bool PointerExprEvaluator::VisitBuiltinCallExpr(const CallExpr *E,
         return false;
     }
   }
-  case Builtin::BI__builtin_clang_embed: {
+  case Builtin::BI__builtin_std_embed: {
     constexpr uint64_t FileNotFound = 0;
     constexpr uint64_t FileFound = 1;
     constexpr uint64_t FileFoundAndEmpty = 2;
@@ -10888,7 +10888,7 @@ bool PointerExprEvaluator::VisitBuiltinCallExpr(const CallExpr *E,
       return WriteOutStatus(FileNotFound);
     }
     assert(Info.Ctx.InputDependencyPatterns &&
-           "using __builtin_clang_embed requires the context to have a usable "
+           "using __builtin_std_embed requires the context to have a usable "
            "input dependency patterns");
     StringRef ResourceSearchName =
         ResourceFile->getFileEntry().tryGetRealPathName();
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index fe2660a2ac4ae..3c5c1e5d52123 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -3852,7 +3852,7 @@ Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, unsigned BuiltinID,
     if (BuiltinCountedByRef(TheCall))
       return ExprError();
     break;
-  case Builtin::BI__builtin_clang_embed:
+  case Builtin::BI__builtin_std_embed:
     // while we do not have Custom Typechecking,
     // we have a `...` signature, so we do need to
     // at least gently inspect some of the arguments
@@ -6801,7 +6801,7 @@ bool Sema::BuiltinStdEmbed(CallExpr *TheCall) {
   if ((!StatusRefTy->isIntegralOrUnscopedEnumerationType()) ||
       StatusRefTy.isConstant(Context) || !StatusRef->isLValue()) {
     Diag(TheCall->getBeginLoc(), diag::err_invalid_builtin_argument)
-        << StatusRef << "__builtin_clang_embed" << StatusRef->getSourceRange();
+        << StatusRef << "__builtin_std_embed" << StatusRef->getSourceRange();
     return true;
   }
 
@@ -6810,7 +6810,7 @@ bool Sema::BuiltinStdEmbed(CallExpr *TheCall) {
   if ((!SizeRefTy->isIntegralOrUnscopedEnumerationType()) ||
       SizeRefTy.isConstant(Context) || !SizeRef->isLValue()) {
     Diag(TheCall->getBeginLoc(), diag::err_invalid_builtin_argument)
-        << SizeRef << "__builtin_clang_embed" << SizeRef->getSourceRange();
+        << SizeRef << "__builtin_std_embed" << SizeRef->getSourceRange();
     return true;
   }
 
@@ -6822,7 +6822,7 @@ bool Sema::BuiltinStdEmbed(CallExpr *TheCall) {
   QualType PtrRefTy = PtrRef->getType();
   if (!PtrRefTy->isPointerType() || PtrRefTy.isConstant(Context)) {
     Diag(TheCall->getBeginLoc(), diag::err_invalid_builtin_argument)
-        << PtrRefTy << "__builtin_clang_embed" << PtrRef->getSourceRange();
+        << PtrRefTy << "__builtin_std_embed" << PtrRef->getSourceRange();
     return true;
   }
   QualType ArrElementTy = PtrRefTy->getPointeeType();
@@ -6831,7 +6831,7 @@ bool Sema::BuiltinStdEmbed(CallExpr *TheCall) {
         Context.getTypeAlign(ArrElementTy) == CharSize &&
         ArrElementTy->isIntegralOrEnumerationType())) {
     Diag(TheCall->getBeginLoc(), diag::err_invalid_builtin_argument)
-        << PtrRef << "__builtin_clang_embed" << PtrRef->getSourceRange();
+        << PtrRef << "__builtin_std_embed" << PtrRef->getSourceRange();
     return true;
   }
 
@@ -6839,7 +6839,7 @@ bool Sema::BuiltinStdEmbed(CallExpr *TheCall) {
         Context.getTypeSize(ArrElementTy) == CharSize &&
         Context.getTypeAlign(ArrElementTy) == CharSize)) {
     Diag(TheCall->getBeginLoc(), diag::err_invalid_builtin_argument)
-        << PtrRef << "__builtin_clang_embed" << PtrRef->getSourceRange();
+        << PtrRef << "__builtin_std_embed" << PtrRef->getSourceRange();
     return true;
   }
 
diff --git a/libcxx/include/embed b/libcxx/include/embed
index 97217e6c189c4..add722766f17f 100644
--- a/libcxx/include/embed
+++ b/libcxx/include/embed
@@ -15,17 +15,17 @@
 
 namespace std {
 
-  template <typename T>
+  template <class T>
 consteval span<const T> embed(string_view resource_idenfier,
   size_t offset = 0,
   optional<size_t> limit = nullopt);
 
-  template <typename T>
+  template <class T>
 consteval span<const T> embed(wstring_view resource_idenfier,
   size_t offset = 0,
   optional<size_t> limit = nullopt);
 
-  template <typename T>
+  template <class T>
 consteval span<const T> embed(u8string_view resource_idenfier,
   size_t offset = 0,
   optional<size_t> limit = nullopt);
@@ -65,7 +65,7 @@ consteval span<const T, Limit> embed(u8string_view resource_idenfier,
 
 // FIXME: the versioning stuff out of Clang is... Not Great! __cplusplus is still like 202400L for -std=c++2c, which is
 // not even in the ballpark of correct.
-#if 1 //_LIBCPP_STD_VER > 26 && (__has_builtin(__builtin_clang_embed) || __has_builtin(__builtin_gnu_embed))
+#if 1 //_LIBCPP_STD_VER > 26 && (__has_builtin(__builtin_std_embed) || __has_builtin(__builtin_gnu_embed))
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
@@ -74,39 +74,26 @@ template <typename _Byte, size_t _Extent, typename _StrView>
 consteval _LIBCPP_HIDE_FROM_ABI span<const _Byte, _Extent>
 __embed(const _StrView& __resource_identifier, size_t __offset, [[maybe_unused]] const optional<size_t>& __limit) {
   static_assert(sizeof(_Byte) == 1 && alignof(_Byte) == 1 && (is_integral<_Byte>::value || is_enum<_Byte>::value),
-                "embed data type must be a character type with a size and alignment of 1");
+                "embed _Byte type must be an enumeration or integral type with a size and alignment of 1");
   size_t __size      = 0;
   _Byte const* __ptr = nullptr;
   int __status       = -1;
   if constexpr (_Extent != std::dynamic_extent) {
-#  if __has_builtin(__builtin_gnu_embed)
-    __ptr = __builtin_gnu_embed(
-        _Byte, __status, __size, __resource_identifier.size(), __resource_identifier.data(), __offset, _Extent);
-#  else
-    __ptr = __builtin_clang_embed(
+    __ptr = __builtin_std_embed(
         __status, __size, __ptr, __resource_identifier.size(), __resource_identifier.data(), __offset, _Extent);
-#  endif
   } else {
     if (__limit) {
-#  if __has_builtin(__builtin_gnu_embed)
-      __ptr = __builtin_gnu_embed(
-          _Byte, __status, __size, __resource_identifier.size(), __resource_identifier.data(), __offset, *__limit);
-#  else
-      __ptr = __builtin_clang_embed(
+      __ptr = __builtin_std_embed(
           __status, __size, __ptr, __resource_identifier.size(), __resource_identifier.data(), __offset, *__limit);
-#  endif
     } else {
-#  if __has_builtin(__builtin_gnu_embed)
-      __ptr = __builtin_gnu_embed(
-          _Byte, __status, __size, __resource_identifier.size(), __resource_identifier.data(), __offset);
-#  else
-      __ptr = __builtin_clang_embed(
+      __ptr = __builtin_std_embed(
           __status, __size, __ptr, __resource_identifier.size(), __resource_identifier.data(), __offset);
-#  endif
     }
   }
-  if (__status == __STDC_EMBED_NOT_FOUND__) {
+  if (__status == 0) {
     _LIBCPP_VERBOSE_ABORT("file not found");
+  } else if (__status == 1) {
+    _LIBCPP_VERBOSE_ABORT("file found but not appropriately '#depend <>'-ed");
   }
   if constexpr (_Extent != std::dynamic_extent) {
     if (_Extent > __size) {
@@ -114,10 +101,12 @@ __embed(const _StrView& __resource_identifier, size_t __offset, [[maybe_unused]]
     }
     __size = _Extent;
   }
-  if (__status == __STDC_EMBED_EMPTY__) {
+  if (__status == 2) {
     return span<const _Byte, _Extent>();
   }
-  _LIBCPP_ASSERT(__status == __STDC_EMBED_FOUND__, "return status of embed is the proper __STDC_EMBED_FOUND__ value");
+  _LIBCPP_ASSERT(__status == __STDC_EMBED_FOUND__,
+                 "status value should be `3`, indicating a "
+                 "successful finding of a file with data that has been '#depend <>`-ed on");
   return span<const _Byte, _Extent>(__ptr, __size);
 }
 } // namespace __embed_detail
@@ -157,6 +146,6 @@ consteval span<const _Byte, _Limit> embed(u8string_view __resource_identifier, s
 
 _LIBCPP_END_NAMESPACE_STD
 
-#endif // _LIBCPP_STD_VER > 26 && __has_builtin(__builtin_clang_embed)
+#endif // _LIBCPP_STD_VER > 26 && __has_builtin(__builtin_std_embed)
 
 #endif // _LIBCPP_EMBED

>From 56585ad7a27fe456754bea5924094184dc766c53 Mon Sep 17 00:00:00 2001
From: ThePhD <phdofthehouse at gmail.com>
Date: Sun, 19 Apr 2026 18:54:02 +0200
Subject: [PATCH 7/7] =?UTF-8?q?[libc++][Clang][Doc][AST]=20=F0=9F=8E=A8?=
 =?UTF-8?q?=F0=9F=90=9B=20synchronize=20and=20update=20return=20values?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 clang/docs/LanguageExtensions.rst |  8 ++++----
 clang/lib/AST/ExprConstant.cpp    |  5 +++--
 libcxx/include/embed              | 17 ++++++++++++-----
 3 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/clang/docs/LanguageExtensions.rst b/clang/docs/LanguageExtensions.rst
index dac139cd4e407..360f077d86e53 100644
--- a/clang/docs/LanguageExtensions.rst
+++ b/clang/docs/LanguageExtensions.rst
@@ -5420,7 +5420,7 @@ with ``__PRETTY_FUNCTION__`` rather than ``__FUNCTION__``.
 Data embedding builtin ``__builtin_std_embed``
 ----------------------------------------------
 
-For use with `p1040 <https://wg21.link/p1040>`'s ``std::embed`` directive. It
+For use with `p1040 <https://wg21.link/p1040>`'s ``std::embed`` function. It
 is conceptually (but not exactly) represented by the following overloads:
 
 .. code-block:: c++
@@ -5443,9 +5443,9 @@ The first argument is an output parameter status object. It will be
 filled with:
 
 - ``0`` is the file is not found,
-- ``1`` if the file is found but not suitably ``#depend``ed on,
+- ``1`` if the file is found, properly ``#depend``ed on, and not empty.
 - ``2`` if the file is found, properly ``#depend``ed on, but it was empty,
-- or, ``3`` if the file is found, properly ``#depend``ed on, and not empty.
+- or, ``3`` if the file is found but not suitably ``#depend``ed on,
 
 The second argument is an output parameter for the number of elements pointed
 to by the return type. If ``limit`` is provided, this value will be less than
@@ -5455,7 +5455,7 @@ The third argument is a type hint for the type to return. It must be a pointer
 to a ``const`` type, and ``Byte`` must an integral or enumeration type with an
 alignment and size of ``1`` (e.g. ``char``, ``unsigned char``, ``std::byte``,
 etc.). A future extension can possibly allow for additional types, possibly
-all types which are considered "trivial" types.
+all types which are considered "trivial" types (but without pointers inside).
 
 The fourth and fifth arguments describe a plain, wide, or ``char8_t`` range as
 as string. ``Char`` can be one of ``char``, ``wchar_t``, or ``char8_t`` to
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index 80eb22bda4f9a..4e6647abe8b82 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -10700,7 +10700,8 @@ bool PointerExprEvaluator::VisitBuiltinCallExpr(const CallExpr *E,
   case Builtin::BI__builtin_std_embed: {
     constexpr uint64_t FileNotFound = 0;
     constexpr uint64_t FileFound = 1;
-    constexpr uint64_t FileFoundAndEmpty = 2;
+    constexpr uint64_t FileFoundButNotDependedOn = 2;
+    constexpr uint64_t FileFoundAndEmpty = 3;
 
     const Expr *StatusOutArg = E->getArg(0);
     const Expr *SizeOutArg = E->getArg(1);
@@ -10900,7 +10901,7 @@ bool PointerExprEvaluator::VisitBuiltinCallExpr(const CallExpr *E,
       // finding the file. Consider possibly returnig a different value in the
       // future.
       Result.setNull(Info.Ctx, PtrOutTy);
-      return WriteOutStatus(FileNotFound);
+      return WriteOutStatus(FileFoundButNotDependedOn);
     }
     size_t FullDataSize = ResourceFile->getSize();
     if (FullDataSize == 0 || DataOffset > FullDataSize) {
diff --git a/libcxx/include/embed b/libcxx/include/embed
index add722766f17f..0ef022d56f2de 100644
--- a/libcxx/include/embed
+++ b/libcxx/include/embed
@@ -70,6 +70,13 @@ consteval span<const T, Limit> embed(u8string_view resource_idenfier,
 _LIBCPP_BEGIN_NAMESPACE_STD
 
 namespace __embed_detail {
+enum __builtin_embed_status {
+  __file_not_found        = 0,
+  __file_found            = 1,
+  __file_found_no_depends = 2,
+  __file_found_empty      = 3,
+};
+
 template <typename _Byte, size_t _Extent, typename _StrView>
 consteval _LIBCPP_HIDE_FROM_ABI span<const _Byte, _Extent>
 __embed(const _StrView& __resource_identifier, size_t __offset, [[maybe_unused]] const optional<size_t>& __limit) {
@@ -90,9 +97,9 @@ __embed(const _StrView& __resource_identifier, size_t __offset, [[maybe_unused]]
           __status, __size, __ptr, __resource_identifier.size(), __resource_identifier.data(), __offset);
     }
   }
-  if (__status == 0) {
+  if (__status == __file_not_found) {
     _LIBCPP_VERBOSE_ABORT("file not found");
-  } else if (__status == 1) {
+  } else if (__status == __file_found_no_depends) {
     _LIBCPP_VERBOSE_ABORT("file found but not appropriately '#depend <>'-ed");
   }
   if constexpr (_Extent != std::dynamic_extent) {
@@ -101,11 +108,11 @@ __embed(const _StrView& __resource_identifier, size_t __offset, [[maybe_unused]]
     }
     __size = _Extent;
   }
-  if (__status == 2) {
+  if (__status == __file_found_empty) {
     return span<const _Byte, _Extent>();
   }
-  _LIBCPP_ASSERT(__status == __STDC_EMBED_FOUND__,
-                 "status value should be `3`, indicating a "
+  _LIBCPP_ASSERT(__status == __file_found,
+                 "status value should be `1`, indicating a "
                  "successful finding of a file with data that has been '#depend <>`-ed on");
   return span<const _Byte, _Extent>(__ptr, __size);
 }



More information about the cfe-commits mailing list