21 changes: 10 additions & 11 deletions clang/unittests/StaticAnalyzer/CallDescriptionTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -488,11 +488,10 @@ TEST(CallDescription, NegativeMatchQualifiedNames) {
}

TEST(CallDescription, MatchBuiltins) {
// Test CDF_MaybeBuiltin - a flag that allows matching weird builtins.
// Test CDM::CLibrary - a flag that allows matching weird builtins.
EXPECT_TRUE(tooling::runToolOnCode(
std::unique_ptr<FrontendAction>(new CallDescriptionAction<>(
{{{{"memset"}, 3}, false},
{{CDF_MaybeBuiltin, {"memset"}, 3}, true}})),
{{{{"memset"}, 3}, false}, {{CDM::CLibrary, {"memset"}, 3}, true}})),
"void foo() {"
" int x;"
" __builtin___memset_chk(&x, 0, sizeof(x),"
Expand All @@ -503,8 +502,8 @@ TEST(CallDescription, MatchBuiltins) {
SCOPED_TRACE("multiple similar builtins");
EXPECT_TRUE(tooling::runToolOnCode(
std::unique_ptr<FrontendAction>(new CallDescriptionAction<>(
{{{CDF_MaybeBuiltin, {"memcpy"}, 3}, false},
{{CDF_MaybeBuiltin, {"wmemcpy"}, 3}, true}})),
{{{CDM::CLibrary, {"memcpy"}, 3}, false},
{{CDM::CLibrary, {"wmemcpy"}, 3}, true}})),
R"(void foo(wchar_t *x, wchar_t *y) {
__builtin_wmemcpy(x, y, sizeof(wchar_t));
})"));
Expand All @@ -513,17 +512,17 @@ TEST(CallDescription, MatchBuiltins) {
SCOPED_TRACE("multiple similar builtins reversed order");
EXPECT_TRUE(tooling::runToolOnCode(
std::unique_ptr<FrontendAction>(new CallDescriptionAction<>(
{{{CDF_MaybeBuiltin, {"wmemcpy"}, 3}, true},
{{CDF_MaybeBuiltin, {"memcpy"}, 3}, false}})),
{{{CDM::CLibrary, {"wmemcpy"}, 3}, true},
{{CDM::CLibrary, {"memcpy"}, 3}, false}})),
R"(void foo(wchar_t *x, wchar_t *y) {
__builtin_wmemcpy(x, y, sizeof(wchar_t));
})"));
}
{
SCOPED_TRACE("lookbehind and lookahead mismatches");
EXPECT_TRUE(tooling::runToolOnCode(
std::unique_ptr<FrontendAction>(new CallDescriptionAction<>(
{{{CDF_MaybeBuiltin, {"func"}}, false}})),
std::unique_ptr<FrontendAction>(
new CallDescriptionAction<>({{{CDM::CLibrary, {"func"}}, false}})),
R"(
void funcXXX();
void XXXfunc();
Expand All @@ -537,8 +536,8 @@ TEST(CallDescription, MatchBuiltins) {
{
SCOPED_TRACE("lookbehind and lookahead matches");
EXPECT_TRUE(tooling::runToolOnCode(
std::unique_ptr<FrontendAction>(new CallDescriptionAction<>(
{{{CDF_MaybeBuiltin, {"func"}}, true}})),
std::unique_ptr<FrontendAction>(
new CallDescriptionAction<>({{{CDM::CLibrary, {"func"}}, true}})),
R"(
void func();
void func_XXX();
Expand Down
1 change: 1 addition & 0 deletions compiler-rt/lib/builtins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ set(GENERIC_SOURCES

# We only build BF16 files when "__bf16" is available.
set(BF16_SOURCES
extendbfsf2.c
truncdfbf2.c
truncsfbf2.c
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
//===--- ByteCodeGenError.h - Byte code generation error --------*- C++ -*-===//
//===-- lib/extendbfsf2.c - bfloat -> single conversion -----------*- 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
//
//===----------------------------------------------------------------------===//

#include "ByteCodeGenError.h"
#define SRC_BFLOAT16
#define DST_SINGLE
#include "fp_extend_impl.inc"

using namespace clang;
using namespace clang::interp;

char ByteCodeGenError::ID;
COMPILER_RT_ABI float __extendbfsf2(src_t a) { return __extendXfYf2__(a); }
15 changes: 15 additions & 0 deletions compiler-rt/lib/builtins/fp_extend.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,21 @@ static inline int src_rep_t_clz_impl(src_rep_t a) {

#define src_rep_t_clz src_rep_t_clz_impl

#elif defined SRC_BFLOAT16
#ifdef COMPILER_RT_HAS_BFLOAT16
typedef __bf16 src_t;
#else
typedef uint16_t src_t;
#endif
typedef uint16_t src_rep_t;
#define SRC_REP_C UINT16_C
static const int srcBits = sizeof(src_t) * CHAR_BIT;
static const int srcSigFracBits = 7;
// -1 accounts for the sign bit.
// srcBits - srcSigFracBits - 1
static const int srcExpBits = 8;
#define src_rep_t_clz __builtin_clz

#else
#error Source should be half, single, or double precision!
#endif // end source precision
Expand Down
13 changes: 12 additions & 1 deletion flang/docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,24 @@
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = [
"myst_parser",
"sphinx.ext.todo",
"sphinx.ext.mathjax",
"sphinx.ext.intersphinx",
"sphinx.ext.autodoc",
]

# When building man pages, we do not use the markdown pages,
# So, we can continue without the myst_parser dependencies.
# Doing so reduces dependencies of some packaged llvm distributions.
try:
import myst_parser

extensions.append("myst_parser")
except ImportError:
if not tags.has("builder-man"):
raise


# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]
myst_heading_anchors = 6
Expand Down
7 changes: 7 additions & 0 deletions flang/include/flang/Optimizer/CodeGen/CodeGen.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

namespace fir {

class LLVMTypeConverter;

struct NameUniquer;

#define GEN_PASS_DECL_FIRTOLLVMLOWERING
Expand Down Expand Up @@ -80,6 +82,11 @@ std::unique_ptr<mlir::Pass> createLLVMDialectToLLVMPass(
std::unique_ptr<mlir::Pass> createBoxedProcedurePass();
std::unique_ptr<mlir::Pass> createBoxedProcedurePass(bool useThunks);

/// Populate the given list with patterns that convert from FIR to LLVM.
void populateFIRToLLVMConversionPatterns(fir::LLVMTypeConverter &converter,
mlir::RewritePatternSet &patterns,
fir::FIRToLLVMPassOptions &options);

// declarative passes
#define GEN_PASS_REGISTRATION
#include "flang/Optimizer/CodeGen/CGPasses.h.inc"
Expand Down
54 changes: 30 additions & 24 deletions flang/lib/Optimizer/CodeGen/CodeGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3937,30 +3937,7 @@ class FIRToLLVMLowering
options.applyTBAA || applyTBAA,
options.forceUnifiedTBAATree, *dl};
mlir::RewritePatternSet pattern(context);
pattern.insert<
AbsentOpConversion, AddcOpConversion, AddrOfOpConversion,
AllocaOpConversion, AllocMemOpConversion, BoxAddrOpConversion,
BoxCharLenOpConversion, BoxDimsOpConversion, BoxEleSizeOpConversion,
BoxIsAllocOpConversion, BoxIsArrayOpConversion, BoxIsPtrOpConversion,
BoxOffsetOpConversion, BoxProcHostOpConversion, BoxRankOpConversion,
BoxTypeCodeOpConversion, BoxTypeDescOpConversion, CallOpConversion,
CmpcOpConversion, ConstcOpConversion, ConvertOpConversion,
CoordinateOpConversion, DTEntryOpConversion, DivcOpConversion,
EmboxOpConversion, EmboxCharOpConversion, EmboxProcOpConversion,
ExtractValueOpConversion, FieldIndexOpConversion, FirEndOpConversion,
FreeMemOpConversion, GlobalLenOpConversion, GlobalOpConversion,
HasValueOpConversion, InsertOnRangeOpConversion,
InsertValueOpConversion, IsPresentOpConversion,
LenParamIndexOpConversion, LoadOpConversion, MulcOpConversion,
NegcOpConversion, NoReassocOpConversion, SelectCaseOpConversion,
SelectOpConversion, SelectRankOpConversion, SelectTypeOpConversion,
ShapeOpConversion, ShapeShiftOpConversion, ShiftOpConversion,
SliceOpConversion, StoreOpConversion, StringLitOpConversion,
SubcOpConversion, TypeDescOpConversion, TypeInfoOpConversion,
UnboxCharOpConversion, UnboxProcOpConversion, UndefOpConversion,
UnreachableOpConversion, UnrealizedConversionCastOpConversion,
XArrayCoorOpConversion, XEmboxOpConversion, XReboxOpConversion,
ZeroOpConversion>(typeConverter, options);
fir::populateFIRToLLVMConversionPatterns(typeConverter, pattern, options);
mlir::populateFuncToLLVMConversionPatterns(typeConverter, pattern);
mlir::populateOpenMPToLLVMConversionPatterns(typeConverter, pattern);
mlir::arith::populateArithToLLVMConversionPatterns(typeConverter, pattern);
Expand Down Expand Up @@ -4072,3 +4049,32 @@ fir::createLLVMDialectToLLVMPass(llvm::raw_ostream &output,
fir::LLVMIRLoweringPrinter printer) {
return std::make_unique<LLVMIRLoweringPass>(output, printer);
}

void fir::populateFIRToLLVMConversionPatterns(
fir::LLVMTypeConverter &converter, mlir::RewritePatternSet &patterns,
fir::FIRToLLVMPassOptions &options) {
patterns.insert<
AbsentOpConversion, AddcOpConversion, AddrOfOpConversion,
AllocaOpConversion, AllocMemOpConversion, BoxAddrOpConversion,
BoxCharLenOpConversion, BoxDimsOpConversion, BoxEleSizeOpConversion,
BoxIsAllocOpConversion, BoxIsArrayOpConversion, BoxIsPtrOpConversion,
BoxOffsetOpConversion, BoxProcHostOpConversion, BoxRankOpConversion,
BoxTypeCodeOpConversion, BoxTypeDescOpConversion, CallOpConversion,
CmpcOpConversion, ConstcOpConversion, ConvertOpConversion,
CoordinateOpConversion, DTEntryOpConversion, DivcOpConversion,
EmboxOpConversion, EmboxCharOpConversion, EmboxProcOpConversion,
ExtractValueOpConversion, FieldIndexOpConversion, FirEndOpConversion,
FreeMemOpConversion, GlobalLenOpConversion, GlobalOpConversion,
HasValueOpConversion, InsertOnRangeOpConversion, InsertValueOpConversion,
IsPresentOpConversion, LenParamIndexOpConversion, LoadOpConversion,
MulcOpConversion, NegcOpConversion, NoReassocOpConversion,
SelectCaseOpConversion, SelectOpConversion, SelectRankOpConversion,
SelectTypeOpConversion, ShapeOpConversion, ShapeShiftOpConversion,
ShiftOpConversion, SliceOpConversion, StoreOpConversion,
StringLitOpConversion, SubcOpConversion, TypeDescOpConversion,
TypeInfoOpConversion, UnboxCharOpConversion, UnboxProcOpConversion,
UndefOpConversion, UnreachableOpConversion,
UnrealizedConversionCastOpConversion, XArrayCoorOpConversion,
XEmboxOpConversion, XReboxOpConversion, ZeroOpConversion>(converter,
options);
}
3 changes: 2 additions & 1 deletion flang/lib/Optimizer/Transforms/MemoryAllocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,8 @@ class MemoryAllocationOpt
return keepStackAllocation(alloca, &func.front(), options);
});

patterns.insert<AllocaOpConversion>(context, analysis.getReturns(func));
llvm::SmallVector<mlir::Operation *> returnOps = analysis.getReturns(func);
patterns.insert<AllocaOpConversion>(context, returnOps);
if (mlir::failed(
mlir::applyPartialConversion(func, target, std::move(patterns)))) {
mlir::emitError(func.getLoc(),
Expand Down
2 changes: 2 additions & 0 deletions flang/test/Fir/memory-allocation-opt.fir
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// RUN: fir-opt --memory-allocation-opt="dynamic-array-on-heap=true maximum-array-alloc-size=1024" %s | FileCheck %s
// FIXME: started crashing on windows https://github.com/llvm/llvm-project/issues/83534
// UNSUPPORTED: system-windows

// Test for size of array being too big.

Expand Down
7 changes: 3 additions & 4 deletions libc/include/llvm-libc-types/float128.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,17 @@
// https://github.com/llvm/llvm-project/issues/80195
#if defined(__STDC_IEC_60559_BFP__) && !defined(__clang__) && \
!defined(__cplusplus)
// Use _Float128 C23 type.
#define LIBC_COMPILER_HAS_C23_FLOAT128
#define LIBC_TYPES_HAS_FLOAT128
typedef _Float128 float128;
#elif defined(__FLOAT128__) || defined(__SIZEOF_FLOAT128__)
// Use __float128 type. gcc and clang sometime use __SIZEOF_FLOAT128__ to
// notify the availability of __float128.
// clang also uses __FLOAT128__ macro to notify the availability of __float128
// type: https://reviews.llvm.org/D15120
#define LIBC_COMPILER_HAS_FLOAT128_EXTENSION
#define LIBC_TYPES_HAS_FLOAT128
typedef __float128 float128;
#elif (LDBL_MANT_DIG == 113)
// Use long double.
#define LIBC_TYPES_HAS_FLOAT128
typedef long double float128;
#endif

Expand Down
4 changes: 2 additions & 2 deletions libc/src/__support/FPUtil/ManipulationFunctions.h
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,8 @@ LIBC_INLINE T nextafter(T from, U to) {
} // namespace fputil
} // namespace LIBC_NAMESPACE

#ifdef LIBC_LONG_DOUBLE_IS_X86_FLOAT80
#ifdef LIBC_TYPES_LONG_DOUBLE_IS_X86_FLOAT80
#include "x86_64/NextAfterLongDouble.h"
#endif // LIBC_LONG_DOUBLE_IS_X86_FLOAT80
#endif // LIBC_TYPES_LONG_DOUBLE_IS_X86_FLOAT80

#endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_MANIPULATIONFUNCTIONS_H
4 changes: 2 additions & 2 deletions libc/src/__support/FPUtil/NormalFloat.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ template <typename T> struct NormalFloat {
}
};

#ifdef LIBC_LONG_DOUBLE_IS_X86_FLOAT80
#ifdef LIBC_TYPES_LONG_DOUBLE_IS_X86_FLOAT80
template <>
LIBC_INLINE void
NormalFloat<long double>::init_from_bits(FPBits<long double> bits) {
Expand Down Expand Up @@ -261,7 +261,7 @@ template <> LIBC_INLINE NormalFloat<long double>::operator long double() const {
result.set_implicit_bit(1);
return result.get_val();
}
#endif // LIBC_LONG_DOUBLE_IS_X86_FLOAT80
#endif // LIBC_TYPES_LONG_DOUBLE_IS_X86_FLOAT80

} // namespace fputil
} // namespace LIBC_NAMESPACE
Expand Down
2 changes: 1 addition & 1 deletion libc/src/__support/FPUtil/dyadic_float.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

namespace LIBC_NAMESPACE::fputil {

// A generic class to perform comuptations of high precision floating points.
// A generic class to perform computations of high precision floating points.
// We store the value in dyadic format, including 3 fields:
// sign : boolean value - false means positive, true means negative
// exponent: the exponent value of the least significant bit of the mantissa.
Expand Down
8 changes: 4 additions & 4 deletions libc/src/__support/FPUtil/generic/sqrt.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ template <typename T> struct SpecialLongDouble {
static constexpr bool VALUE = false;
};

#if defined(LIBC_LONG_DOUBLE_IS_X86_FLOAT80)
#if defined(LIBC_TYPES_LONG_DOUBLE_IS_X86_FLOAT80)
template <> struct SpecialLongDouble<long double> {
static constexpr bool VALUE = true;
};
#endif // LIBC_LONG_DOUBLE_IS_X86_FLOAT80
#endif // LIBC_TYPES_LONG_DOUBLE_IS_X86_FLOAT80

template <typename T>
LIBC_INLINE void normalize(int &exponent,
Expand All @@ -43,12 +43,12 @@ LIBC_INLINE void normalize(int &exponent,
mantissa <<= shift;
}

#ifdef LIBC_LONG_DOUBLE_IS_FLOAT64
#ifdef LIBC_TYPES_LONG_DOUBLE_IS_FLOAT64
template <>
LIBC_INLINE void normalize<long double>(int &exponent, uint64_t &mantissa) {
normalize<double>(exponent, mantissa);
}
#elif !defined(LIBC_LONG_DOUBLE_IS_X86_FLOAT80)
#elif !defined(LIBC_TYPES_LONG_DOUBLE_IS_X86_FLOAT80)
template <>
LIBC_INLINE void normalize<long double>(int &exponent, UInt128 &mantissa) {
const uint64_t hi_bits = static_cast<uint64_t>(mantissa >> 64);
Expand Down
4 changes: 2 additions & 2 deletions libc/src/__support/FPUtil/generic/sqrt_80_bit_long_double.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ LIBC_INLINE long double sqrt(long double x);

// Correctly rounded SQRT for all rounding modes.
// Shift-and-add algorithm.
#if defined(LIBC_LONG_DOUBLE_IS_X86_FLOAT80)
#if defined(LIBC_TYPES_LONG_DOUBLE_IS_X86_FLOAT80)
LIBC_INLINE long double sqrt(long double x) {
using LDBits = FPBits<long double>;
using StorageType = typename LDBits::StorageType;
Expand Down Expand Up @@ -130,7 +130,7 @@ LIBC_INLINE long double sqrt(long double x) {
return out.get_val();
}
}
#endif // LIBC_LONG_DOUBLE_IS_X86_FLOAT80
#endif // LIBC_TYPES_LONG_DOUBLE_IS_X86_FLOAT80

} // namespace x86
} // namespace fputil
Expand Down
2 changes: 1 addition & 1 deletion libc/src/__support/FPUtil/x86_64/sqrt.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ template <> LIBC_INLINE double sqrt<double>(double x) {
return result;
}

#ifdef LIBC_LONG_DOUBLE_IS_FLOAT64
#ifdef LIBC_TYPES_LONG_DOUBLE_IS_FLOAT64
template <> LIBC_INLINE long double sqrt<long double>(long double x) {
long double result;
__asm__ __volatile__("sqrtsd %x1, %x0" : "=x"(result) : "x"(x));
Expand Down
4 changes: 2 additions & 2 deletions libc/src/__support/float_to_string.h
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ class FloatToString {
}
};

#if !defined(LIBC_LONG_DOUBLE_IS_FLOAT64) && \
#if !defined(LIBC_TYPES_LONG_DOUBLE_IS_FLOAT64) && \
!defined(LIBC_COPT_FLOAT_TO_STR_NO_SPECIALIZE_LD)
// --------------------------- LONG DOUBLE FUNCTIONS ---------------------------

Expand Down Expand Up @@ -837,7 +837,7 @@ template <> class FloatToString<long double> {
}
};

#endif // !LIBC_LONG_DOUBLE_IS_FLOAT64 &&
#endif // !LIBC_TYPES_LONG_DOUBLE_IS_FLOAT64 &&
// !LIBC_COPT_FLOAT_TO_STR_NO_SPECIALIZE_LD

} // namespace LIBC_NAMESPACE
Expand Down
17 changes: 7 additions & 10 deletions libc/src/__support/macros/properties/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@

// 'long double' properties.
#if (LDBL_MANT_DIG == 53)
#define LIBC_LONG_DOUBLE_IS_FLOAT64
#define LIBC_TYPES_LONG_DOUBLE_IS_FLOAT64
#elif (LDBL_MANT_DIG == 64)
#define LIBC_LONG_DOUBLE_IS_X86_FLOAT80
#define LIBC_TYPES_LONG_DOUBLE_IS_X86_FLOAT80
#elif (LDBL_MANT_DIG == 113)
#define LIBC_LONG_DOUBLE_IS_FLOAT128
#define LIBC_TYPES_LONG_DOUBLE_IS_FLOAT128
#endif

// float16 support.
// -- float16 support ---------------------------------------------------------
// TODO: move this logic to "llvm-libc-types/float16.h"
#if defined(LIBC_TARGET_ARCH_IS_X86_64) && defined(LIBC_TARGET_CPU_HAS_SSE2)
#if (defined(LIBC_COMPILER_CLANG_VER) && (LIBC_COMPILER_CLANG_VER >= 1500)) || \
Expand All @@ -50,11 +50,8 @@ using float16 = _Float16;
#endif
#endif

// float128 support.
#if defined(LIBC_COMPILER_HAS_C23_FLOAT128) || \
defined(LIBC_COMPILER_HAS_FLOAT128_EXTENSION) || \
defined(LIBC_LONG_DOUBLE_IS_FLOAT128)
#define LIBC_TYPES_HAS_FLOAT128
#endif
// -- float128 support --------------------------------------------------------
// LIBC_TYPES_HAS_FLOAT128 and 'float128' type are provided by
// "include/llvm-libc-types/float128.h"

#endif // LLVM_LIBC_SRC___SUPPORT_MACROS_PROPERTIES_TYPES_H
16 changes: 9 additions & 7 deletions libc/src/__support/str_to_float.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ template <class T> LIBC_INLINE void set_implicit_bit(fputil::FPBits<T> &) {
return;
}

#if defined(LIBC_LONG_DOUBLE_IS_X86_FLOAT80)
#if defined(LIBC_TYPES_LONG_DOUBLE_IS_X86_FLOAT80)
template <>
LIBC_INLINE void
set_implicit_bit<long double>(fputil::FPBits<long double> &result) {
result.set_implicit_bit(result.get_biased_exponent() != 0);
}
#endif
#endif // LIBC_TYPES_LONG_DOUBLE_IS_X86_FLOAT80

// This Eisel-Lemire implementation is based on the algorithm described in the
// paper Number Parsing at a Gigabyte per Second, Software: Practice and
Expand Down Expand Up @@ -176,7 +176,7 @@ eisel_lemire(ExpandedFloat<T> init_num,
return output;
}

#if !defined(LIBC_LONG_DOUBLE_IS_FLOAT64)
#if !defined(LIBC_TYPES_LONG_DOUBLE_IS_FLOAT64)
template <>
LIBC_INLINE cpp::optional<ExpandedFloat<long double>>
eisel_lemire<long double>(ExpandedFloat<long double> init_num,
Expand Down Expand Up @@ -297,7 +297,7 @@ eisel_lemire<long double>(ExpandedFloat<long double> init_num,
output.exponent = exp2;
return output;
}
#endif
#endif // !defined(LIBC_TYPES_LONG_DOUBLE_IS_FLOAT64)

// The nth item in POWERS_OF_TWO represents the greatest power of two less than
// 10^n. This tells us how much we can safely shift without overshooting.
Expand Down Expand Up @@ -460,7 +460,7 @@ template <> class ClingerConsts<double> {
static constexpr double MAX_EXACT_INT = 9007199254740991.0;
};

#if defined(LIBC_LONG_DOUBLE_IS_FLOAT64)
#if defined(LIBC_TYPES_LONG_DOUBLE_IS_FLOAT64)
template <> class ClingerConsts<long double> {
public:
static constexpr long double POWERS_OF_TEN_ARRAY[] = {
Expand All @@ -473,7 +473,7 @@ template <> class ClingerConsts<long double> {
static constexpr long double MAX_EXACT_INT =
ClingerConsts<double>::MAX_EXACT_INT;
};
#elif defined(LIBC_LONG_DOUBLE_IS_X86_FLOAT80)
#elif defined(LIBC_TYPES_LONG_DOUBLE_IS_X86_FLOAT80)
template <> class ClingerConsts<long double> {
public:
static constexpr long double POWERS_OF_TEN_ARRAY[] = {
Expand All @@ -484,7 +484,7 @@ template <> class ClingerConsts<long double> {
static constexpr int32_t DIGITS_IN_MANTISSA = 21;
static constexpr long double MAX_EXACT_INT = 18446744073709551615.0L;
};
#else
#elif defined(LIBC_TYPES_LONG_DOUBLE_IS_FLOAT128)
template <> class ClingerConsts<long double> {
public:
static constexpr long double POWERS_OF_TEN_ARRAY[] = {
Expand All @@ -498,6 +498,8 @@ template <> class ClingerConsts<long double> {
static constexpr long double MAX_EXACT_INT =
10384593717069655257060992658440191.0L;
};
#else
#error "Unknown long double type"
#endif

// Take an exact mantissa and exponent and attempt to convert it using only
Expand Down
2 changes: 1 addition & 1 deletion libc/test/src/__support/FPUtil/fpbits_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ TEST(LlvmLibcFPBitsTest, X86LongDoubleType) {
}
#else
TEST(LlvmLibcFPBitsTest, LongDoubleType) {
#if defined(LIBC_LONG_DOUBLE_IS_FLOAT64)
#if defined(LIBC_TYPES_LONG_DOUBLE_IS_FLOAT64)
return; // The tests for the "double" type cover for this case.
#else
using LongDoubleBits = FPBits<long double>;
Expand Down
8 changes: 5 additions & 3 deletions libc/test/src/__support/str_to_long_double_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ namespace LIBC_NAMESPACE {
using LlvmLibcStrToLongDblTest = LlvmLibcStrToFloatTest<long double>;
using LIBC_NAMESPACE::operator""_u128;

#if defined(LIBC_LONG_DOUBLE_IS_FLOAT64)
#if defined(LIBC_TYPES_LONG_DOUBLE_IS_FLOAT64)

TEST_F(LlvmLibcStrToLongDblTest, EiselLemireFloat64AsLongDouble) {
eisel_lemire_test(123, 0, 0x1EC00000000000, 1029);
}

#elif defined(LIBC_LONG_DOUBLE_IS_X86_FLOAT80)
#elif defined(LIBC_TYPES_LONG_DOUBLE_IS_X86_FLOAT80)

TEST_F(LlvmLibcStrToLongDblTest, EiselLemireFloat80Simple) {
eisel_lemire_test(123, 0, 0xf600000000000000, 16389);
Expand Down Expand Up @@ -54,7 +54,7 @@ TEST_F(LlvmLibcStrToLongDblTest, EiselLemireFloat80Fallback) {
ASSERT_FALSE(internal::eisel_lemire<long double>({1, -1000}).has_value());
}

#else // Quad precision long double
#elif defined(LIBC_TYPES_LONG_DOUBLE_IS_FLOAT128)

TEST_F(LlvmLibcStrToLongDblTest, EiselLemireFloat128Simple) {
eisel_lemire_test(123, 0, 0x1ec00'00000000'00000000'00000000_u128, 16389);
Expand All @@ -77,6 +77,8 @@ TEST_F(LlvmLibcStrToLongDblTest, EiselLemireFloat128Fallback) {
.has_value());
}

#else
#error "Unknown long double type"
#endif

} // namespace LIBC_NAMESPACE
8 changes: 5 additions & 3 deletions libc/test/src/math/smoke/nanl_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@
#include "test/UnitTest/Test.h"
#include <signal.h>

#if defined(LIBC_LONG_DOUBLE_IS_FLOAT64)
#if defined(LIBC_TYPES_LONG_DOUBLE_IS_FLOAT64)
#define SELECT_LONG_DOUBLE(val, _, __) val
#elif defined(LIBC_LONG_DOUBLE_IS_X86_FLOAT80)
#elif defined(LIBC_TYPES_LONG_DOUBLE_IS_X86_FLOAT80)
#define SELECT_LONG_DOUBLE(_, val, __) val
#else
#elif defined(LIBC_TYPES_LONG_DOUBLE_IS_FLOAT128)
#define SELECT_LONG_DOUBLE(_, __, val) val
#else
#error "Unknown long double type"
#endif

class LlvmLibcNanlTest : public LIBC_NAMESPACE::testing::Test {
Expand Down
112 changes: 56 additions & 56 deletions libc/test/src/stdio/sprintf_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -775,29 +775,29 @@ TEST_F(LlvmLibcSPrintfTest, FloatHexExpConv) {
// Length Modifier Tests.

written = LIBC_NAMESPACE::sprintf(buff, "%La", 0.1L);
#if defined(LIBC_LONG_DOUBLE_IS_X86_FLOAT80)
#if defined(LIBC_TYPES_LONG_DOUBLE_IS_X86_FLOAT80)
ASSERT_STREQ_LEN(written, buff, "0xc.ccccccccccccccdp-7");
#elif defined(LIBC_LONG_DOUBLE_IS_FLOAT64)
#elif defined(LIBC_TYPES_LONG_DOUBLE_IS_FLOAT64)
ASSERT_STREQ_LEN(written, buff, "0x1.999999999999ap-4");
#else // 128 bit long double
#elif defined(LIBC_TYPES_LONG_DOUBLE_IS_FLOAT128)
ASSERT_STREQ_LEN(written, buff, "0x1.999999999999999999999999999ap-4");
#endif

written = LIBC_NAMESPACE::sprintf(buff, "%La", 1.0e1000L);
#if defined(LIBC_LONG_DOUBLE_IS_X86_FLOAT80)
#if defined(LIBC_TYPES_LONG_DOUBLE_IS_X86_FLOAT80)
ASSERT_STREQ_LEN(written, buff, "0xf.38db1f9dd3dac05p+3318");
#elif defined(LIBC_LONG_DOUBLE_IS_FLOAT64)
#elif defined(LIBC_TYPES_LONG_DOUBLE_IS_FLOAT64)
ASSERT_STREQ_LEN(written, buff, "inf");
#else // 128 bit long double
#elif defined(LIBC_TYPES_LONG_DOUBLE_IS_FLOAT128)
ASSERT_STREQ_LEN(written, buff, "0x1.e71b63f3ba7b580af1a52d2a7379p+3321");
#endif

written = LIBC_NAMESPACE::sprintf(buff, "%La", 1.0e-1000L);
#if defined(LIBC_LONG_DOUBLE_IS_X86_FLOAT80)
#if defined(LIBC_TYPES_LONG_DOUBLE_IS_X86_FLOAT80)
ASSERT_STREQ_LEN(written, buff, "0x8.68a9188a89e1467p-3325");
#elif defined(LIBC_LONG_DOUBLE_IS_FLOAT64)
#elif defined(LIBC_TYPES_LONG_DOUBLE_IS_FLOAT64)
ASSERT_STREQ_LEN(written, buff, "0x0p+0");
#else // 128 bit long double
#elif defined(LIBC_TYPES_LONG_DOUBLE_IS_FLOAT128)
ASSERT_STREQ_LEN(written, buff, "0x1.0d152311513c28ce202627c06ec2p-3322");
#endif

Expand Down Expand Up @@ -899,20 +899,20 @@ TEST_F(LlvmLibcSPrintfTest, FloatHexExpConv) {
ASSERT_STREQ_LEN(written, buff, "0x0p+0");

written = LIBC_NAMESPACE::sprintf(buff, "%.1La", 0.1L);
#if defined(LIBC_LONG_DOUBLE_IS_X86_FLOAT80)
#if defined(LIBC_TYPES_LONG_DOUBLE_IS_X86_FLOAT80)
ASSERT_STREQ_LEN(written, buff, "0xc.dp-7");
#elif defined(LIBC_LONG_DOUBLE_IS_FLOAT64)
#elif defined(LIBC_TYPES_LONG_DOUBLE_IS_FLOAT64)
ASSERT_STREQ_LEN(written, buff, "0x1.ap-4");
#else // 128 bit long double
#elif defined(LIBC_TYPES_LONG_DOUBLE_IS_FLOAT128)
ASSERT_STREQ_LEN(written, buff, "0x1.ap-4");
#endif

written = LIBC_NAMESPACE::sprintf(buff, "%.1La", 0xf.fffffffffffffffp16380L);
#if defined(LIBC_LONG_DOUBLE_IS_X86_FLOAT80)
#if defined(LIBC_TYPES_LONG_DOUBLE_IS_X86_FLOAT80)
ASSERT_STREQ_LEN(written, buff, "0x1.0p+16384");
#elif defined(LIBC_LONG_DOUBLE_IS_FLOAT64)
#elif defined(LIBC_TYPES_LONG_DOUBLE_IS_FLOAT64)
ASSERT_STREQ_LEN(written, buff, "inf");
#else // 128 bit long double
#elif defined(LIBC_TYPES_LONG_DOUBLE_IS_FLOAT128)
ASSERT_STREQ_LEN(written, buff, "0x2.0p+16383");
#endif

Expand Down Expand Up @@ -1158,8 +1158,8 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) {

// Some float128 systems (specifically the ones used for aarch64 buildbots)
// don't respect signs for long double NaNs.
#if defined(LIBC_LONG_DOUBLE_IS_X86_FLOAT80) || \
defined(LIBC_LONG_DOUBLE_IS_FLOAT64)
#if defined(LIBC_TYPES_LONG_DOUBLE_IS_X86_FLOAT80) || \
defined(LIBC_TYPES_LONG_DOUBLE_IS_FLOAT64)
written = LIBC_NAMESPACE::sprintf(buff, "%LF", -ld_nan);
ASSERT_STREQ_LEN(written, buff, "-NAN");
#endif
Expand Down Expand Up @@ -1354,20 +1354,20 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) {

/*
written = LIBC_NAMESPACE::sprintf(buff, "%.1La", 0.1L);
#if defined(LIBC_LONG_DOUBLE_IS_X86_FLOAT80)
#if defined(LIBC_TYPES_LONG_DOUBLE_IS_X86_FLOAT80)
ASSERT_STREQ_LEN(written, buff, "0xc.dp-7");
#elif defined(LIBC_LONG_DOUBLE_IS_FLOAT64)
#elif defined(LIBC_TYPES_LONG_DOUBLE_IS_FLOAT64)
ASSERT_STREQ_LEN(written, buff, "0x1.ap-4");
#else // 128 bit long double
#elif defined(LIBC_TYPES_LONG_DOUBLE_IS_FLOAT128)
ASSERT_STREQ_LEN(written, buff, "0x1.ap-4");
#endif
written = LIBC_NAMESPACE::sprintf(buff, "%.1La",
0xf.fffffffffffffffp16380L); #if defined(LIBC_LONG_DOUBLE_IS_X86_FLOAT80)
ASSERT_STREQ_LEN(written, buff, "0x1.0p+16384");
#elif defined(LIBC_LONG_DOUBLE_IS_FLOAT64)
0xf.fffffffffffffffp16380L); #if
defined(LIBC_TYPES_LONG_DOUBLE_IS_X86_FLOAT80) ASSERT_STREQ_LEN(written, buff,
"0x1.0p+16384"); #elif defined(LIBC_TYPES_LONG_DOUBLE_IS_FLOAT64)
ASSERT_STREQ_LEN(written, buff, "inf");
#else // 128 bit long double
#elif defined(LIBC_TYPES_LONG_DOUBLE_IS_FLOAT128)
ASSERT_STREQ_LEN(written, buff, "0x2.0p+16383");
#endif
*/
Expand Down Expand Up @@ -1603,8 +1603,8 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalLongDoubleConv) {

// Length Modifier Tests.

// TODO(michaelrj): Add tests for LIBC_LONG_DOUBLE_IS_FLOAT64 and 128 bit long
// double systems.
// TODO(michaelrj): Add tests for LIBC_TYPES_LONG_DOUBLE_IS_FLOAT64 and 128
// bit long double systems.
// TODO(michaelrj): Fix the tests to only depend on the digits the long double
// is accurate for.

Expand All @@ -1614,7 +1614,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalLongDoubleConv) {
written = LIBC_NAMESPACE::sprintf(buff, "%.Lf", -2.5L);
ASSERT_STREQ_LEN(written, buff, "-2");

#if defined(LIBC_LONG_DOUBLE_IS_X86_FLOAT80)
#if defined(LIBC_TYPES_LONG_DOUBLE_IS_X86_FLOAT80)

written = LIBC_NAMESPACE::sprintf(buff, "%Lf", 1e100L);
ASSERT_STREQ_LEN(written, buff,
Expand Down Expand Up @@ -1930,7 +1930,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalLongDoubleConv) {
"570449525088342437216896462077260223998756027453411520977536701491759878"
"422771447006016890777855573925295187921971811871399320142563330377888532"
"179817332113");
#endif // LIBC_LONG_DOUBLE_IS_X86_FLOAT80
#endif // LIBC_TYPES_LONG_DOUBLE_IS_X86_FLOAT80
}

TEST_F(LlvmLibcSPrintfTest, FloatExponentConv) {
Expand Down Expand Up @@ -2171,20 +2171,20 @@ TEST_F(LlvmLibcSPrintfTest, FloatExponentConv) {

/*
written = LIBC_NAMESPACE::sprintf(buff, "%.1La", 0.1L);
#if defined(LIBC_LONG_DOUBLE_IS_X86_FLOAT80)
#if defined(LIBC_TYPES_LONG_DOUBLE_IS_X86_FLOAT80)
ASSERT_STREQ_LEN(written, buff, "0xc.dp-7");
#elif defined(LIBC_LONG_DOUBLE_IS_FLOAT64)
#elif defined(LIBC_TYPES_LONG_DOUBLE_IS_FLOAT64)
ASSERT_STREQ_LEN(written, buff, "0x1.ap-4");
#else // 128 bit long double
#elif defined(LIBC_TYPES_LONG_DOUBLE_IS_FLOAT128)
ASSERT_STREQ_LEN(written, buff, "0x1.ap-4");
#endif
written = LIBC_NAMESPACE::sprintf(buff, "%.1La",
0xf.fffffffffffffffp16380L); #if defined(LIBC_LONG_DOUBLE_IS_X86_FLOAT80)
ASSERT_STREQ_LEN(written, buff, "0x1.0p+16384");
#elif defined(LIBC_LONG_DOUBLE_IS_FLOAT64)
0xf.fffffffffffffffp16380L); #if
defined(LIBC_TYPES_LONG_DOUBLE_IS_X86_FLOAT80) ASSERT_STREQ_LEN(written, buff,
"0x1.0p+16384"); #elif defined(LIBC_TYPES_LONG_DOUBLE_IS_FLOAT64)
ASSERT_STREQ_LEN(written, buff, "inf");
#else // 128 bit long double
#elif defined(LIBC_TYPES_LONG_DOUBLE_IS_FLOAT128)
ASSERT_STREQ_LEN(written, buff, "0x2.0p+16383");
#endif
*/
Expand Down Expand Up @@ -2423,7 +2423,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatExponentLongDoubleConv) {
ForceRoundingMode r(RoundingMode::Nearest);
// Length Modifier Tests.

#if defined(LIBC_LONG_DOUBLE_IS_X86_FLOAT80)
#if defined(LIBC_TYPES_LONG_DOUBLE_IS_X86_FLOAT80)
written = LIBC_NAMESPACE::sprintf(buff, "%.9Le", 1000000000500000000.1L);
ASSERT_STREQ_LEN(written, buff, "1.000000001e+18");

Expand Down Expand Up @@ -2783,34 +2783,34 @@ TEST_F(LlvmLibcSPrintfTest, FloatAutoConv) {
written = LIBC_NAMESPACE::sprintf(buff, "%.10g", 0x1.0p-1074);
ASSERT_STREQ_LEN(written, buff, "4.940656458e-324");

#if defined(LIBC_LONG_DOUBLE_IS_X86_FLOAT80)
#if defined(LIBC_TYPES_LONG_DOUBLE_IS_X86_FLOAT80)

written = LIBC_NAMESPACE::sprintf(buff, "%.60Lg", 0xa.aaaaaaaaaaaaaabp-7L);
ASSERT_STREQ_LEN(
written, buff,
"0.0833333333333333333355920878593448009041821933351457118988037");

#endif // LIBC_LONG_DOUBLE_IS_X86_FLOAT80
#endif // LIBC_TYPES_LONG_DOUBLE_IS_X86_FLOAT80

// Long double precision tests.
// These are currently commented out because they require long double support
// that isn't ready yet.
/*
written = LIBC_NAMESPACE::sprintf(buff, "%.1La", 0.1L);
#if defined(LIBC_LONG_DOUBLE_IS_X86_FLOAT80)
#if defined(LIBC_TYPES_LONG_DOUBLE_IS_X86_FLOAT80)
ASSERT_STREQ_LEN(written, buff, "0xc.dp-7");
#elif defined(LIBC_LONG_DOUBLE_IS_FLOAT64)
#elif defined(LIBC_TYPES_LONG_DOUBLE_IS_FLOAT64)
ASSERT_STREQ_LEN(written, buff, "0x1.ap-4");
#else // 128 bit long double
#elif defined(LIBC_TYPES_LONG_DOUBLE_IS_FLOAT128)
ASSERT_STREQ_LEN(written, buff, "0x1.ap-4");
#endif
written = LIBC_NAMESPACE::sprintf(buff, "%.1La",
0xf.fffffffffffffffp16380L); #if defined(LIBC_LONG_DOUBLE_IS_X86_FLOAT80)
ASSERT_STREQ_LEN(written, buff, "0x1.0p+16384");
#elif defined(LIBC_LONG_DOUBLE_IS_FLOAT64)
0xf.fffffffffffffffp16380L); #if
defined(LIBC_TYPES_LONG_DOUBLE_IS_X86_FLOAT80) ASSERT_STREQ_LEN(written, buff,
"0x1.0p+16384"); #elif defined(LIBC_TYPES_LONG_DOUBLE_IS_FLOAT64)
ASSERT_STREQ_LEN(written, buff, "inf");
#else // 128 bit long double
#elif defined(LIBC_TYPES_LONG_DOUBLE_IS_FLOAT128)
ASSERT_STREQ_LEN(written, buff, "0x2.0p+16383");
#endif
*/
Expand Down Expand Up @@ -3053,7 +3053,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatAutoLongDoubleConv) {

// Length Modifier Tests.

#if defined(LIBC_LONG_DOUBLE_IS_X86_FLOAT80)
#if defined(LIBC_TYPES_LONG_DOUBLE_IS_X86_FLOAT80)

written = LIBC_NAMESPACE::sprintf(buff, "%Lg", 0xf.fffffffffffffffp+16380L);
ASSERT_STREQ_LEN(written, buff, "1.18973e+4932");
Expand All @@ -3064,7 +3064,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatAutoLongDoubleConv) {
written = LIBC_NAMESPACE::sprintf(buff, "%Lg", 9.99999999999e-100L);
ASSERT_STREQ_LEN(written, buff, "1e-99");

#endif // LIBC_LONG_DOUBLE_IS_X86_FLOAT80
#endif // LIBC_TYPES_LONG_DOUBLE_IS_X86_FLOAT80

// TODO: Uncomment the below tests after long double support is added
/*
Expand Down Expand Up @@ -3171,29 +3171,29 @@ TEST_F(LlvmLibcSPrintfTest, FloatAutoLongDoubleConv) {
*/
/*
written = LIBC_NAMESPACE::sprintf(buff, "%La", 0.1L);
#if defined(LIBC_LONG_DOUBLE_IS_X86_FLOAT80)
#if defined(LIBC_TYPES_LONG_DOUBLE_IS_X86_FLOAT80)
ASSERT_STREQ_LEN(written, buff, "0xc.ccccccccccccccdp-7");
#elif defined(LIBC_LONG_DOUBLE_IS_FLOAT64)
#elif defined(LIBC_TYPES_LONG_DOUBLE_IS_FLOAT64)
ASSERT_STREQ_LEN(written, buff, "0x1.999999999999ap-4");
#else // 128 bit long double
#elif defined(LIBC_TYPES_LONG_DOUBLE_IS_FLOAT128)
ASSERT_STREQ_LEN(written, buff, "0x1.999999999999999999999999999ap-4");
#endif
written = LIBC_NAMESPACE::sprintf(buff, "%La", 1.0e1000L);
#if defined(LIBC_LONG_DOUBLE_IS_X86_FLOAT80)
#if defined(LIBC_TYPES_LONG_DOUBLE_IS_X86_FLOAT80)
ASSERT_STREQ_LEN(written, buff, "0xf.38db1f9dd3dac05p+3318");
#elif defined(LIBC_LONG_DOUBLE_IS_FLOAT64)
#elif defined(LIBC_TYPES_LONG_DOUBLE_IS_FLOAT64)
ASSERT_STREQ_LEN(written, buff, "inf");
#else // 128 bit long double
#elif defined(LIBC_TYPES_LONG_DOUBLE_IS_FLOAT128)
ASSERT_STREQ_LEN(written, buff, "0x1.e71b63f3ba7b580af1a52d2a7379p+3321");
#endif
written = LIBC_NAMESPACE::sprintf(buff, "%La", 1.0e-1000L);
#if defined(LIBC_LONG_DOUBLE_IS_X86_FLOAT80)
#if defined(LIBC_TYPES_LONG_DOUBLE_IS_X86_FLOAT80)
ASSERT_STREQ_LEN(written, buff, "0x8.68a9188a89e1467p-3325");
#elif defined(LIBC_LONG_DOUBLE_IS_FLOAT64)
#elif defined(LIBC_TYPES_LONG_DOUBLE_IS_FLOAT64)
ASSERT_STREQ_LEN(written, buff, "0x0p+0");
#else // 128 bit long double
#elif defined(LIBC_TYPES_LONG_DOUBLE_IS_FLOAT128)
ASSERT_STREQ_LEN(written, buff, "0x1.0d152311513c28ce202627c06ec2p-3322");
#endif
*/
Expand Down
2 changes: 1 addition & 1 deletion libc/test/src/stdio/sscanf_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ TEST(LlvmLibcSScanfTest, FloatConvLengthModifier) {
EXPECT_EQ(ret_val, 1);
// 1e600 may be larger than the maximum long double (if long double is double).
// In that case both of these should be evaluated as inf.
#ifdef LIBC_LONG_DOUBLE_IS_FLOAT64
#ifdef LIBC_TYPES_LONG_DOUBLE_IS_FLOAT64
EXPECT_FP_EQ(ld_result, d_inf);
#else
EXPECT_FP_EQ(ld_result, 1.0e600L);
Expand Down
10 changes: 6 additions & 4 deletions libc/test/src/stdlib/strtold_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,19 @@

#include <stddef.h>

#if defined(LIBC_LONG_DOUBLE_IS_FLOAT64)
#if defined(LIBC_TYPES_LONG_DOUBLE_IS_FLOAT64)
#define SELECT_CONST(val, _, __) val
#elif defined(LIBC_LONG_DOUBLE_IS_X86_FLOAT80)
#elif defined(LIBC_TYPES_LONG_DOUBLE_IS_X86_FLOAT80)
#define SELECT_CONST(_, val, __) val
#else
#elif defined(LIBC_TYPES_LONG_DOUBLE_IS_FLOAT128)
#define SELECT_CONST(_, __, val) val
#else
#error "Unknown long double type"
#endif

class LlvmLibcStrToLDTest : public LIBC_NAMESPACE::testing::Test {
public:
#if defined(LIBC_LONG_DOUBLE_IS_FLOAT64)
#if defined(LIBC_TYPES_LONG_DOUBLE_IS_FLOAT64)
void run_test(const char *inputString, const ptrdiff_t expectedStrLen,
const uint64_t expectedRawData, const int expectedErrno = 0)
#else
Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ set(files
__fwd/bit_reference.h
__fwd/complex.h
__fwd/fstream.h
__fwd/hash.h
__fwd/functional.h
__fwd/ios.h
__fwd/istream.h
__fwd/mdspan.h
Expand Down
3 changes: 1 addition & 2 deletions libcxx/include/__filesystem/path.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@
#include <__algorithm/replace_copy.h>
#include <__availability>
#include <__config>
#include <__functional/hash.h>
#include <__functional/unary_function.h>
#include <__fwd/hash.h>
#include <__fwd/functional.h>
#include <__iterator/back_insert_iterator.h>
#include <__iterator/iterator_traits.h>
#include <__type_traits/decay.h>
Expand Down
22 changes: 10 additions & 12 deletions libcxx/include/__format/parser_std_format_spec.h
Original file line number Diff line number Diff line change
Expand Up @@ -355,10 +355,10 @@ class _LIBCPP_TEMPLATE_VIS __parser {
_LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator __parse(_ParseContext& __ctx, __fields __fields) {
auto __begin = __ctx.begin();
auto __end = __ctx.end();
if (__begin == __end || *__begin == _CharT('}'))
if (__begin == __end || *__begin == _CharT('}') || (__fields.__use_range_fill_ && *__begin == _CharT(':')))
return __begin;

if (__parse_fill_align(__begin, __end, __fields.__use_range_fill_) && __begin == __end)
if (__parse_fill_align(__begin, __end) && __begin == __end)
return __begin;

if (__fields.__sign_) {
Expand Down Expand Up @@ -574,12 +574,10 @@ class _LIBCPP_TEMPLATE_VIS __parser {
return false;
}

_LIBCPP_HIDE_FROM_ABI constexpr void __validate_fill_character(_CharT __fill, bool __use_range_fill) {
_LIBCPP_HIDE_FROM_ABI constexpr void __validate_fill_character(_CharT __fill) {
// The forbidden fill characters all code points formed from a single code unit, thus the
// check can be omitted when more code units are used.
if (__use_range_fill && (__fill == _CharT('{') || __fill == _CharT(':')))
std::__throw_format_error("The fill option contains an invalid value");
else if (__fill == _CharT('{'))
if (__fill == _CharT('{'))
std::__throw_format_error("The fill option contains an invalid value");
}

Expand All @@ -590,7 +588,7 @@ class _LIBCPP_TEMPLATE_VIS __parser {
# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
|| (same_as<_CharT, wchar_t> && sizeof(wchar_t) == 2)
# endif
_LIBCPP_HIDE_FROM_ABI constexpr bool __parse_fill_align(_Iterator& __begin, _Iterator __end, bool __use_range_fill) {
_LIBCPP_HIDE_FROM_ABI constexpr bool __parse_fill_align(_Iterator& __begin, _Iterator __end) {
_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
__begin != __end,
"when called with an empty input the function will cause "
Expand All @@ -606,7 +604,7 @@ class _LIBCPP_TEMPLATE_VIS __parser {
// The forbidden fill characters all are code points encoded
// in one code unit, thus the check can be omitted when more
// code units are used.
__validate_fill_character(*__begin, __use_range_fill);
__validate_fill_character(*__begin);

std::copy_n(__begin, __code_units, std::addressof(__fill_.__data[0]));
__begin += __code_units + 1;
Expand All @@ -623,7 +621,7 @@ class _LIBCPP_TEMPLATE_VIS __parser {
# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <contiguous_iterator _Iterator>
requires(same_as<_CharT, wchar_t> && sizeof(wchar_t) == 4)
_LIBCPP_HIDE_FROM_ABI constexpr bool __parse_fill_align(_Iterator& __begin, _Iterator __end, bool __use_range_fill) {
_LIBCPP_HIDE_FROM_ABI constexpr bool __parse_fill_align(_Iterator& __begin, _Iterator __end) {
_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
__begin != __end,
"when called with an empty input the function will cause "
Expand All @@ -632,7 +630,7 @@ class _LIBCPP_TEMPLATE_VIS __parser {
if (!__unicode::__is_scalar_value(*__begin))
std::__throw_format_error("The fill option contains an invalid value");

__validate_fill_character(*__begin, __use_range_fill);
__validate_fill_character(*__begin);

__fill_.__data[0] = *__begin;
__begin += 2;
Expand All @@ -651,14 +649,14 @@ class _LIBCPP_TEMPLATE_VIS __parser {
# else // _LIBCPP_HAS_NO_UNICODE
// range-fill and tuple-fill are identical
template <contiguous_iterator _Iterator>
_LIBCPP_HIDE_FROM_ABI constexpr bool __parse_fill_align(_Iterator& __begin, _Iterator __end, bool __use_range_fill) {
_LIBCPP_HIDE_FROM_ABI constexpr bool __parse_fill_align(_Iterator& __begin, _Iterator __end) {
_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
__begin != __end,
"when called with an empty input the function will cause "
"undefined behavior by evaluating data not in the input");
if (__begin + 1 != __end) {
if (__parse_alignment(*(__begin + 1))) {
__validate_fill_character(*__begin, __use_range_fill);
__validate_fill_character(*__begin);

__fill_.__data[0] = *__begin;
__begin += 2;
Expand Down
1 change: 1 addition & 0 deletions libcxx/include/__functional/bind.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <__config>
#include <__functional/invoke.h>
#include <__functional/weak_result_type.h>
#include <__fwd/functional.h>
#include <__type_traits/decay.h>
#include <__type_traits/is_reference_wrapper.h>
#include <__type_traits/is_void.h>
Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/__functional/hash.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <__config>
#include <__functional/invoke.h>
#include <__functional/unary_function.h>
#include <__fwd/hash.h>
#include <__fwd/functional.h>
#include <__tuple/sfinae_helpers.h>
#include <__type_traits/is_copy_constructible.h>
#include <__type_traits/is_default_constructible.h>
Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/__functional/identity.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#define _LIBCPP___FUNCTIONAL_IDENTITY_H

#include <__config>
#include <__functional/reference_wrapper.h>
#include <__fwd/functional.h>
#include <__type_traits/integral_constant.h>
#include <__utility/forward.h>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
//
//===---------------------------------------------------------------------===//

#ifndef _LIBCPP___FWD_HASH_H
#define _LIBCPP___FWD_HASH_H
#ifndef _LIBCPP___FWD_FUNCTIONAL_H
#define _LIBCPP___FWD_FUNCTIONAL_H

#include <__config>

Expand All @@ -20,6 +20,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class>
struct _LIBCPP_TEMPLATE_VIS hash;

template <class>
class _LIBCPP_TEMPLATE_VIS reference_wrapper;

_LIBCPP_END_NAMESPACE_STD

#endif // _LIBCPP___FWD_HASH_H
#endif // _LIBCPP___FWD_FUNCTIONAL_H
2 changes: 1 addition & 1 deletion libcxx/include/__thread/id.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

#include <__compare/ordering.h>
#include <__config>
#include <__fwd/hash.h>
#include <__fwd/functional.h>
#include <__fwd/ostream.h>
#include <__thread/support.h>

Expand Down
1 change: 0 additions & 1 deletion libcxx/include/__thread/support/pthread.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include <__chrono/convert_to_timespec.h>
#include <__chrono/duration.h>
#include <__config>
#include <__fwd/hash.h>
#include <ctime>
#include <errno.h>
#include <pthread.h>
Expand Down
4 changes: 1 addition & 3 deletions libcxx/include/__type_traits/is_reference_wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#define _LIBCPP___TYPE_TRAITS_IS_REFERENCE_WRAPPER_H

#include <__config>
#include <__fwd/functional.h>
#include <__type_traits/integral_constant.h>
#include <__type_traits/remove_cv.h>

Expand All @@ -19,9 +20,6 @@

_LIBCPP_BEGIN_NAMESPACE_STD

template <class _Tp>
class _LIBCPP_TEMPLATE_VIS reference_wrapper;

template <class _Tp>
struct __is_reference_wrapper_impl : public false_type {};
template <class _Tp>
Expand Down
11 changes: 3 additions & 8 deletions libcxx/include/__type_traits/remove_cv.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,17 @@

_LIBCPP_BEGIN_NAMESPACE_STD

#if __has_builtin(__remove_cv) && !defined(_LIBCPP_COMPILER_GCC)
template <class _Tp>
struct remove_cv {
using type _LIBCPP_NODEBUG = __remove_cv(_Tp);
};

#if defined(_LIBCPP_COMPILER_GCC)
template <class _Tp>
using __remove_cv_t = __remove_cv(_Tp);
using __remove_cv_t = typename remove_cv<_Tp>::type;
#else
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS remove_cv {
typedef __remove_volatile_t<__remove_const_t<_Tp> > type;
};

template <class _Tp>
using __remove_cv_t = __remove_volatile_t<__remove_const_t<_Tp> >;
using __remove_cv_t = __remove_cv(_Tp);
#endif // __has_builtin(__remove_cv)

#if _LIBCPP_STD_VER >= 14
Expand Down
15 changes: 10 additions & 5 deletions libcxx/include/__type_traits/remove_cvref.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,26 @@

_LIBCPP_BEGIN_NAMESPACE_STD

#if __has_builtin(__remove_cvref) && !defined(_LIBCPP_COMPILER_GCC)
#if defined(_LIBCPP_COMPILER_GCC)
template <class _Tp>
using __remove_cvref_t _LIBCPP_NODEBUG = __remove_cvref(_Tp);
struct __remove_cvref_gcc {
using type = __remove_cvref(_Tp);
};

template <class _Tp>
using __remove_cvref_t _LIBCPP_NODEBUG = typename __remove_cvref_gcc<_Tp>::type;
#else
template <class _Tp>
using __remove_cvref_t _LIBCPP_NODEBUG = __remove_cv_t<__libcpp_remove_reference_t<_Tp> >;
using __remove_cvref_t _LIBCPP_NODEBUG = __remove_cvref(_Tp);
#endif // __has_builtin(__remove_cvref)

template <class _Tp, class _Up>
struct __is_same_uncvref : _IsSame<__remove_cvref_t<_Tp>, __remove_cvref_t<_Up> > {};
using __is_same_uncvref = _IsSame<__remove_cvref_t<_Tp>, __remove_cvref_t<_Up> >;

#if _LIBCPP_STD_VER >= 20
template <class _Tp>
struct remove_cvref {
using type _LIBCPP_NODEBUG = __remove_cvref_t<_Tp>;
using type _LIBCPP_NODEBUG = __remove_cvref(_Tp);
};

template <class _Tp>
Expand Down
7 changes: 1 addition & 6 deletions libcxx/include/__type_traits/unwrap_ref.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#define _LIBCPP___TYPE_TRAITS_UNWRAP_REF_H

#include <__config>
#include <__fwd/functional.h>
#include <__type_traits/decay.h>

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
Expand All @@ -23,17 +24,11 @@ struct __unwrap_reference {
typedef _LIBCPP_NODEBUG _Tp type;
};

template <class _Tp>
class reference_wrapper;

template <class _Tp>
struct __unwrap_reference<reference_wrapper<_Tp> > {
typedef _LIBCPP_NODEBUG _Tp& type;
};

template <class _Tp>
struct decay;

#if _LIBCPP_STD_VER >= 20
template <class _Tp>
struct unwrap_reference : __unwrap_reference<_Tp> {};
Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/experimental/propagate_const
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
*/

#include <__functional/operations.h>
#include <__fwd/hash.h>
#include <__fwd/functional.h>
#include <__type_traits/conditional.h>
#include <__type_traits/decay.h>
#include <__type_traits/enable_if.h>
Expand Down
1 change: 1 addition & 0 deletions libcxx/include/filesystem
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,7 @@ inline constexpr bool std::ranges::enable_view<std::filesystem::recursive_direct
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <concepts>
# include <cstdlib>
# include <cstring>
# include <iosfwd>
# include <new>
# include <system_error>
Expand Down
218 changes: 97 additions & 121 deletions libcxx/include/fstream
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,9 @@ public:
# endif // _LIBCPP_STD_VER >= 26

_LIBCPP_HIDE_FROM_ABI inline static const char* __make_mdstring(ios_base::openmode __mode) _NOEXCEPT;
# ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
_LIBCPP_HIDE_FROM_ABI inline static const wchar_t* __make_mdwstring(ios_base::openmode __mode) _NOEXCEPT;
# endif

protected:
// 27.9.1.5 Overridden virtual functions:
Expand Down Expand Up @@ -314,6 +317,26 @@ private:
void __write_mode();

_LIBCPP_EXPORTED_FROM_ABI friend FILE* __get_ostream_file(ostream&);

// There are multiple (__)open function, they use different C-API open
// function. After that call these functions behave the same. This function
// does that part and determines the final return value.
_LIBCPP_HIDE_FROM_ABI basic_filebuf* __do_open(FILE* __file, ios_base::openmode __mode) {
__file_ = __file;
if (!__file_)
return nullptr;

__om_ = __mode;
if (__mode & ios_base::ate) {
if (fseek(__file_, 0, SEEK_END)) {
fclose(__file_);
__file_ = nullptr;
return nullptr;
}
}

return this;
}
};

template <class _CharT, class _Traits>
Expand Down Expand Up @@ -548,140 +571,93 @@ const char* basic_filebuf<_CharT, _Traits>::__make_mdstring(ios_base::openmode _
__libcpp_unreachable();
}

# ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
template <class _CharT, class _Traits>
basic_filebuf<_CharT, _Traits>* basic_filebuf<_CharT, _Traits>::open(const char* __s, ios_base::openmode __mode) {
basic_filebuf<_CharT, _Traits>* __rt = nullptr;
if (__file_ == nullptr) {
if (const char* __mdstr = __make_mdstring(__mode)) {
__rt = this;
__file_ = fopen(__s, __mdstr);
if (__file_) {
__om_ = __mode;
if (__mode & ios_base::ate) {
if (fseek(__file_, 0, SEEK_END)) {
fclose(__file_);
__file_ = nullptr;
__rt = nullptr;
}
}
} else
__rt = nullptr;
}
const wchar_t* basic_filebuf<_CharT, _Traits>::__make_mdwstring(ios_base::openmode __mode) _NOEXCEPT {
switch (__mode & ~ios_base::ate) {
case ios_base::out:
case ios_base::out | ios_base::trunc:
return L"w";
case ios_base::out | ios_base::app:
case ios_base::app:
return L"a";
case ios_base::in:
return L"r";
case ios_base::in | ios_base::out:
return L"r+";
case ios_base::in | ios_base::out | ios_base::trunc:
return L"w+";
case ios_base::in | ios_base::out | ios_base::app:
case ios_base::in | ios_base::app:
return L"a+";
case ios_base::out | ios_base::binary:
case ios_base::out | ios_base::trunc | ios_base::binary:
return L"wb";
case ios_base::out | ios_base::app | ios_base::binary:
case ios_base::app | ios_base::binary:
return L"ab";
case ios_base::in | ios_base::binary:
return L"rb";
case ios_base::in | ios_base::out | ios_base::binary:
return L"r+b";
case ios_base::in | ios_base::out | ios_base::trunc | ios_base::binary:
return L"w+b";
case ios_base::in | ios_base::out | ios_base::app | ios_base::binary:
case ios_base::in | ios_base::app | ios_base::binary:
return L"a+b";
# if _LIBCPP_STD_VER >= 23
case ios_base::out | ios_base::noreplace:
case ios_base::out | ios_base::trunc | ios_base::noreplace:
return L"wx";
case ios_base::in | ios_base::out | ios_base::trunc | ios_base::noreplace:
return L"w+x";
case ios_base::out | ios_base::binary | ios_base::noreplace:
case ios_base::out | ios_base::trunc | ios_base::binary | ios_base::noreplace:
return L"wbx";
case ios_base::in | ios_base::out | ios_base::trunc | ios_base::binary | ios_base::noreplace:
return L"w+bx";
# endif // _LIBCPP_STD_VER >= 23
default:
return nullptr;
}
return __rt;
__libcpp_unreachable();
}
# endif

template <class _CharT, class _Traits>
basic_filebuf<_CharT, _Traits>* basic_filebuf<_CharT, _Traits>::open(const char* __s, ios_base::openmode __mode) {
if (__file_)
return nullptr;
const char* __mdstr = __make_mdstring(__mode);
if (!__mdstr)
return nullptr;

return __do_open(fopen(__s, __mdstr), __mode);
}

template <class _CharT, class _Traits>
inline basic_filebuf<_CharT, _Traits>* basic_filebuf<_CharT, _Traits>::__open(int __fd, ios_base::openmode __mode) {
basic_filebuf<_CharT, _Traits>* __rt = nullptr;
if (__file_ == nullptr) {
if (const char* __mdstr = __make_mdstring(__mode)) {
__rt = this;
__file_ = fdopen(__fd, __mdstr);
if (__file_) {
__om_ = __mode;
if (__mode & ios_base::ate) {
if (fseek(__file_, 0, SEEK_END)) {
fclose(__file_);
__file_ = nullptr;
__rt = nullptr;
}
}
} else
__rt = nullptr;
}
}
return __rt;
if (__file_)
return nullptr;
const char* __mdstr = __make_mdstring(__mode);
if (!__mdstr)
return nullptr;

return __do_open(fdopen(__fd, __mdstr), __mode);
}

# ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
// This is basically the same as the char* overload except that it uses _wfopen
// and long mode strings.
template <class _CharT, class _Traits>
basic_filebuf<_CharT, _Traits>* basic_filebuf<_CharT, _Traits>::open(const wchar_t* __s, ios_base::openmode __mode) {
basic_filebuf<_CharT, _Traits>* __rt = nullptr;
if (__file_ == nullptr) {
__rt = this;
const wchar_t* __mdstr;
switch (__mode & ~ios_base::ate) {
case ios_base::out:
case ios_base::out | ios_base::trunc:
__mdstr = L"w";
break;
case ios_base::out | ios_base::app:
case ios_base::app:
__mdstr = L"a";
break;
case ios_base::in:
__mdstr = L"r";
break;
case ios_base::in | ios_base::out:
__mdstr = L"r+";
break;
case ios_base::in | ios_base::out | ios_base::trunc:
__mdstr = L"w+";
break;
case ios_base::in | ios_base::out | ios_base::app:
case ios_base::in | ios_base::app:
__mdstr = L"a+";
break;
case ios_base::out | ios_base::binary:
case ios_base::out | ios_base::trunc | ios_base::binary:
__mdstr = L"wb";
break;
case ios_base::out | ios_base::app | ios_base::binary:
case ios_base::app | ios_base::binary:
__mdstr = L"ab";
break;
case ios_base::in | ios_base::binary:
__mdstr = L"rb";
break;
case ios_base::in | ios_base::out | ios_base::binary:
__mdstr = L"r+b";
break;
case ios_base::in | ios_base::out | ios_base::trunc | ios_base::binary:
__mdstr = L"w+b";
break;
case ios_base::in | ios_base::out | ios_base::app | ios_base::binary:
case ios_base::in | ios_base::app | ios_base::binary:
__mdstr = L"a+b";
break;
# if _LIBCPP_STD_VER >= 23
case ios_base::out | ios_base::noreplace:
case ios_base::out | ios_base::trunc | ios_base::noreplace:
__mdstr = L"wx";
break;
case ios_base::in | ios_base::out | ios_base::trunc | ios_base::noreplace:
__mdstr = L"w+x";
break;
case ios_base::out | ios_base::binary | ios_base::noreplace:
case ios_base::out | ios_base::trunc | ios_base::binary | ios_base::noreplace:
__mdstr = L"wbx";
break;
case ios_base::in | ios_base::out | ios_base::trunc | ios_base::binary | ios_base::noreplace:
__mdstr = L"w+bx";
break;
# endif // _LIBCPP_STD_VER >= 23
default:
__rt = nullptr;
break;
}
if (__rt) {
__file_ = _wfopen(__s, __mdstr);
if (__file_) {
__om_ = __mode;
if (__mode & ios_base::ate) {
if (fseek(__file_, 0, SEEK_END)) {
fclose(__file_);
__file_ = nullptr;
__rt = nullptr;
}
}
} else
__rt = nullptr;
}
}
return __rt;
if (__file_)
return nullptr;
const wchar_t* __mdstr = __make_mdwstring(__mode);
if (!__mdstr)
return nullptr;

return __do_open(_wfopen(__s, __mdstr), __mode);
}
# endif

Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/libcxx.imp
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@
{ include: [ "<__fwd/bit_reference.h>", "private", "<vector>", "public" ] },
{ include: [ "<__fwd/complex.h>", "private", "<complex>", "public" ] },
{ include: [ "<__fwd/fstream.h>", "private", "<iosfwd>", "public" ] },
{ include: [ "<__fwd/hash.h>", "private", "<functional>", "public" ] },
{ include: [ "<__fwd/functional.h>", "private", "<functional>", "public" ] },
{ include: [ "<__fwd/ios.h>", "private", "<iosfwd>", "public" ] },
{ include: [ "<__fwd/istream.h>", "private", "<iosfwd>", "public" ] },
{ include: [ "<__fwd/mdspan.h>", "private", "<mdspan>", "public" ] },
Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/module.modulemap.in
Original file line number Diff line number Diff line change
Expand Up @@ -1365,7 +1365,7 @@ module std_private_functional_hash [system] {
export std_private_type_traits_underlying_type
export std_private_utility_pair
}
module std_private_functional_hash_fwd [system] { header "__fwd/hash.h" }
module std_private_functional_fwd [system] { header "__fwd/functional.h" }
module std_private_functional_identity [system] { header "__functional/identity.h" }
module std_private_functional_invoke [system] {
header "__functional/invoke.h"
Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/optional
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,8 @@ namespace std {
#include <__exception/exception.h>
#include <__functional/hash.h>
#include <__functional/invoke.h>
#include <__functional/reference_wrapper.h>
#include <__functional/unary_function.h>
#include <__fwd/functional.h>
#include <__memory/addressof.h>
#include <__memory/construct_at.h>
#include <__tuple/sfinae_helpers.h>
Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/type_traits
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ namespace std
*/

#include <__config>
#include <__fwd/hash.h> // This is https://llvm.org/PR56938
#include <__fwd/functional.h> // This is https://llvm.org/PR56938
#include <__type_traits/add_const.h>
#include <__type_traits/add_cv.h>
#include <__type_traits/add_lvalue_reference.h>
Expand Down
36 changes: 14 additions & 22 deletions libcxx/src/iostream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,83 +21,75 @@

_LIBCPP_BEGIN_NAMESPACE_STD

_ALIGNAS_TYPE(istream)
_LIBCPP_EXPORTED_FROM_ABI char cin[sizeof(istream)]
alignas(istream) _LIBCPP_EXPORTED_FROM_ABI char cin[sizeof(istream)]
#if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__)
__asm__("?cin@" _LIBCPP_ABI_NAMESPACE_STR "@std@@3V?$basic_istream@DU?$char_traits@D@" _LIBCPP_ABI_NAMESPACE_STR
"@std@@@12@A")
#endif
;
_ALIGNAS_TYPE(__stdinbuf<char>) static char __cin[sizeof(__stdinbuf<char>)];
alignas(__stdinbuf<char>) static char __cin[sizeof(__stdinbuf<char>)];
static mbstate_t mb_cin;

#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
_ALIGNAS_TYPE(wistream)
_LIBCPP_EXPORTED_FROM_ABI char wcin[sizeof(wistream)]
alignas(wistream) _LIBCPP_EXPORTED_FROM_ABI char wcin[sizeof(wistream)]
# if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__)
__asm__("?wcin@" _LIBCPP_ABI_NAMESPACE_STR "@std@@3V?$basic_istream@_WU?$char_traits@_W@" _LIBCPP_ABI_NAMESPACE_STR
"@std@@@12@A")
# endif
;
_ALIGNAS_TYPE(__stdinbuf<wchar_t>) static char __wcin[sizeof(__stdinbuf<wchar_t>)];
alignas(__stdinbuf<wchar_t>) static char __wcin[sizeof(__stdinbuf<wchar_t>)];
static mbstate_t mb_wcin;
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS

_ALIGNAS_TYPE(ostream)
_LIBCPP_EXPORTED_FROM_ABI char cout[sizeof(ostream)]
alignas(ostream) _LIBCPP_EXPORTED_FROM_ABI char cout[sizeof(ostream)]
#if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__)
__asm__("?cout@" _LIBCPP_ABI_NAMESPACE_STR "@std@@3V?$basic_ostream@DU?$char_traits@D@" _LIBCPP_ABI_NAMESPACE_STR
"@std@@@12@A")
#endif
;
_ALIGNAS_TYPE(__stdoutbuf<char>) static char __cout[sizeof(__stdoutbuf<char>)];
alignas(__stdoutbuf<char>) static char __cout[sizeof(__stdoutbuf<char>)];
static mbstate_t mb_cout;

#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
_ALIGNAS_TYPE(wostream)
_LIBCPP_EXPORTED_FROM_ABI char wcout[sizeof(wostream)]
alignas(wostream) _LIBCPP_EXPORTED_FROM_ABI char wcout[sizeof(wostream)]
# if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__)
__asm__("?wcout@" _LIBCPP_ABI_NAMESPACE_STR "@std@@3V?$basic_ostream@_WU?$char_traits@_W@" _LIBCPP_ABI_NAMESPACE_STR
"@std@@@12@A")
# endif
;
_ALIGNAS_TYPE(__stdoutbuf<wchar_t>) static char __wcout[sizeof(__stdoutbuf<wchar_t>)];
alignas(__stdoutbuf<wchar_t>) static char __wcout[sizeof(__stdoutbuf<wchar_t>)];
static mbstate_t mb_wcout;
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS

_ALIGNAS_TYPE(ostream)
_LIBCPP_EXPORTED_FROM_ABI char cerr[sizeof(ostream)]
alignas(ostream) _LIBCPP_EXPORTED_FROM_ABI char cerr[sizeof(ostream)]
#if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__)
__asm__("?cerr@" _LIBCPP_ABI_NAMESPACE_STR "@std@@3V?$basic_ostream@DU?$char_traits@D@" _LIBCPP_ABI_NAMESPACE_STR
"@std@@@12@A")
#endif
;
_ALIGNAS_TYPE(__stdoutbuf<char>) static char __cerr[sizeof(__stdoutbuf<char>)];
alignas(__stdoutbuf<char>) static char __cerr[sizeof(__stdoutbuf<char>)];
static mbstate_t mb_cerr;

#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
_ALIGNAS_TYPE(wostream)
_LIBCPP_EXPORTED_FROM_ABI char wcerr[sizeof(wostream)]
alignas(wostream) _LIBCPP_EXPORTED_FROM_ABI char wcerr[sizeof(wostream)]
# if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__)
__asm__("?wcerr@" _LIBCPP_ABI_NAMESPACE_STR "@std@@3V?$basic_ostream@_WU?$char_traits@_W@" _LIBCPP_ABI_NAMESPACE_STR
"@std@@@12@A")
# endif
;
_ALIGNAS_TYPE(__stdoutbuf<wchar_t>) static char __wcerr[sizeof(__stdoutbuf<wchar_t>)];
alignas(__stdoutbuf<wchar_t>) static char __wcerr[sizeof(__stdoutbuf<wchar_t>)];
static mbstate_t mb_wcerr;
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS

_ALIGNAS_TYPE(ostream)
_LIBCPP_EXPORTED_FROM_ABI char clog[sizeof(ostream)]
alignas(ostream) _LIBCPP_EXPORTED_FROM_ABI char clog[sizeof(ostream)]
#if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__)
__asm__("?clog@" _LIBCPP_ABI_NAMESPACE_STR "@std@@3V?$basic_ostream@DU?$char_traits@D@" _LIBCPP_ABI_NAMESPACE_STR
"@std@@@12@A")
#endif
;

#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
_ALIGNAS_TYPE(wostream)
_LIBCPP_EXPORTED_FROM_ABI char wclog[sizeof(wostream)]
alignas(wostream) _LIBCPP_EXPORTED_FROM_ABI char wclog[sizeof(wostream)]
# if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__)
__asm__("?wclog@" _LIBCPP_ABI_NAMESPACE_STR "@std@@3V?$basic_ostream@_WU?$char_traits@_W@" _LIBCPP_ABI_NAMESPACE_STR
"@std@@@12@A")
Expand Down
1 change: 0 additions & 1 deletion libcxx/test/libcxx/transitive_includes/cxx23.csv
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ experimental/utility utility
filesystem compare
filesystem cstddef
filesystem cstdint
filesystem cstring
filesystem ctime
filesystem iomanip
filesystem limits
Expand Down
1 change: 0 additions & 1 deletion libcxx/test/libcxx/transitive_includes/cxx26.csv
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ experimental/utility utility
filesystem compare
filesystem cstddef
filesystem cstdint
filesystem cstring
filesystem ctime
filesystem iomanip
filesystem limits
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ void test_char_default(TestFunction check, ExceptionTest check_exception, auto&&

// when one is present there is no escaping,
check(SV("[H, e, l, l, o]"), SV("{::}"), input);
check(SV("[H, e, l, l, o]"), SV("{::<}"), input);
// unless forced by the type specifier.
check(SV("['H', 'e', 'l', 'l', 'o']"), SV("{::?}"), input);
check(SV("['H', 'e', 'l', 'l', 'o']"), SV("{::<?}"), input);

// ***** underlying has no format-spec

Expand All @@ -53,7 +55,6 @@ void test_char_default(TestFunction check, ExceptionTest check_exception, auto&&

check_exception("The format string contains an invalid escape sequence", SV("{:}<}"), input);
check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
check_exception("The fill option contains an invalid value", SV("{::<}"), input);

// *** sign ***
check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
Expand Down Expand Up @@ -153,7 +154,6 @@ void test_char_string(TestFunction check, ExceptionTest check_exception, auto&&

check_exception("The format string contains an invalid escape sequence", SV("{:}<s}"), input);
check_exception("The fill option contains an invalid value", SV("{:{<s}"), input);
check_exception("The fill option contains an invalid value", SV("{::<s}"), input);

// *** sign ***
check_exception("The format specifier should consume the input or end with a '}'", SV("{:-s}"), input);
Expand All @@ -177,6 +177,7 @@ void test_char_string(TestFunction check, ExceptionTest check_exception, auto&&

// *** type ***
check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input);
check_exception("The type option contains an invalid value for a character formatting argument", SV("{::<s}"), input);

// ***** Only underlying has a format-spec
check_exception("Type s and an underlying format specification can't be used together", SV("{:s:}"), input);
Expand Down Expand Up @@ -206,7 +207,7 @@ void test_char_escaped_string(TestFunction check, ExceptionTest check_exception,

check_exception("The format string contains an invalid escape sequence", SV("{:}<?s}"), input);
check_exception("The fill option contains an invalid value", SV("{:{<?s}"), input);
check_exception("The fill option contains an invalid value", SV("{::<?s}"), input);
check_exception("The format specifier should consume the input or end with a '}'", SV("{::<?s}"), input);

// *** sign ***
check_exception("The format specifier should consume the input or end with a '}'", SV("{:-?s}"), input);
Expand Down Expand Up @@ -324,7 +325,6 @@ void test_bool(TestFunction check, ExceptionTest check_exception, auto&& input)

check_exception("The format string contains an invalid escape sequence", SV("{:}<}"), input);
check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
check_exception("The fill option contains an invalid value", SV("{::<}"), input);

// *** sign ***
check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
Expand Down Expand Up @@ -440,7 +440,6 @@ void test_int(TestFunction check, ExceptionTest check_exception, auto&& input) {

check_exception("The format string contains an invalid escape sequence", SV("{:}<}"), input);
check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
check_exception("The fill option contains an invalid value", SV("{::<}"), input);

// *** sign ***
check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
Expand Down Expand Up @@ -550,7 +549,6 @@ void test_floating_point(TestFunction check, ExceptionTest check_exception, auto

check_exception("The format string contains an invalid escape sequence", SV("{:}<}"), input);
check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
check_exception("The fill option contains an invalid value", SV("{::<}"), input);

// *** sign ***
check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
Expand Down Expand Up @@ -688,7 +686,6 @@ void test_pointer(TestFunction check, ExceptionTest check_exception, auto&& inpu

check_exception("The format string contains an invalid escape sequence", SV("{:}<}"), input);
check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
check_exception("The fill option contains an invalid value", SV("{::<}"), input);

// *** sign ***
check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
Expand Down Expand Up @@ -798,7 +795,6 @@ void test_string(TestFunction check, ExceptionTest check_exception, auto&& input

check_exception("The format string contains an invalid escape sequence", SV("{:}<}"), input);
check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
check_exception("The fill option contains an invalid value", SV("{::<}"), input);

// *** sign ***
check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
Expand Down Expand Up @@ -910,7 +906,6 @@ void test_status(TestFunction check, ExceptionTest check_exception, auto&& input

check_exception("The format string contains an invalid escape sequence", SV("{:}<}"), input);
check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
check_exception("The fill option contains an invalid value", SV("{::<}"), input);

// *** sign ***
check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ void format_test_vector_bool(TestFunction check, ExceptionTest check_exception,

check_exception("The format string contains an invalid escape sequence", SV("{:}<}"), input);
check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
check_exception("The fill option contains an invalid value", SV("{::<}"), input);

// *** sign ***
check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ void test_char(TestFunction check, ExceptionTest check_exception) {

check_exception("The format string contains an invalid escape sequence", SV("{:}<}"), input);
check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
check_exception("The fill option contains an invalid value", SV("{::<}"), input);

// *** sign ***
check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
Expand Down Expand Up @@ -87,7 +86,6 @@ void test_char(TestFunction check, ExceptionTest check_exception) {
check(SV("{__'a': 'A'___, __'b': 'B'___, __'c': 'C'___}"), SV("{::_^{}}"), input, 13);
check(SV("{#####'a': 'A', #####'b': 'B', #####'c': 'C'}"), SV("{::#>{}}"), input, 13);

check_exception("The fill option contains an invalid value", SV("{:::<}"), input);
check_exception("The format string contains an invalid escape sequence", SV("{::}<}"), input);
check_exception("The fill option contains an invalid value", SV("{::{<}"), input);

Expand Down Expand Up @@ -157,7 +155,6 @@ void test_char_to_wchar(TestFunction check, ExceptionTest check_exception) {

check_exception("The format string contains an invalid escape sequence", SV("{:}<}"), input);
check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
check_exception("The fill option contains an invalid value", SV("{::<}"), input);

// *** sign ***
check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
Expand Down Expand Up @@ -198,7 +195,6 @@ void test_char_to_wchar(TestFunction check, ExceptionTest check_exception) {
check(SV("{__'a': 'A'___, __'b': 'B'___, __'c': 'C'___}"), SV("{::_^{}}"), input, 13);
check(SV("{#####'a': 'A', #####'b': 'B', #####'c': 'C'}"), SV("{::#>{}}"), input, 13);

check_exception("The fill option contains an invalid value", SV("{:::<}"), input);
check_exception("The format string contains an invalid escape sequence", SV("{::}<}"), input);
check_exception("The fill option contains an invalid value", SV("{::{<}"), input);

Expand Down Expand Up @@ -267,7 +263,6 @@ void test_bool(TestFunction check, ExceptionTest check_exception) {

check_exception("The format string contains an invalid escape sequence", SV("{:}<}"), input);
check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
check_exception("The fill option contains an invalid value", SV("{::<}"), input);

// *** sign ***
check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
Expand Down Expand Up @@ -308,7 +303,6 @@ void test_bool(TestFunction check, ExceptionTest check_exception) {
check(SV("{_false: 0_, _true: 42_, _true: 1__}"), SV("{::_^{}}"), input, 10);
check(SV("{##false: 0, ##true: 42, ###true: 1}"), SV("{::#>{}}"), input, 10);

check_exception("The fill option contains an invalid value", SV("{:::<}"), input);
check_exception("The format string contains an invalid escape sequence", SV("{::}<}"), input);
check_exception("The fill option contains an invalid value", SV("{::{<}"), input);

Expand Down Expand Up @@ -369,7 +363,6 @@ void test_int(TestFunction check, ExceptionTest check_exception, auto&& input) {

check_exception("The format string contains an invalid escape sequence", SV("{:}<}"), input);
check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
check_exception("The fill option contains an invalid value", SV("{::<}"), input);

// *** sign ***
check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
Expand Down Expand Up @@ -410,7 +403,6 @@ void test_int(TestFunction check, ExceptionTest check_exception, auto&& input) {
check(SV("{_-42: 42__, __1: -1___, _42: -42__}"), SV("{::_^{}}"), input, 10);
check(SV("{###-42: 42, #####1: -1, ###42: -42}"), SV("{::#>{}}"), input, 10);

check_exception("The fill option contains an invalid value", SV("{:::<}"), input);
check_exception("The format string contains an invalid escape sequence", SV("{::}<}"), input);
check_exception("The fill option contains an invalid value", SV("{::{<}"), input);

Expand Down Expand Up @@ -478,7 +470,6 @@ void test_floating_point(TestFunction check, ExceptionTest check_exception) {

check_exception("The format string contains an invalid escape sequence", SV("{:}<}"), input);
check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
check_exception("The fill option contains an invalid value", SV("{::<}"), input);

// *** sign ***
check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
Expand Down Expand Up @@ -519,7 +510,6 @@ void test_floating_point(TestFunction check, ExceptionTest check_exception) {
check(SV("{_-42: 42__, __1: -1___}"), SV("{::_^{}}"), input, 10);
check(SV("{###-42: 42, #####1: -1}"), SV("{::#>{}}"), input, 10);

check_exception("The fill option contains an invalid value", SV("{:::<}"), input);
check_exception("The format string contains an invalid escape sequence", SV("{::}<}"), input);
check_exception("The fill option contains an invalid value", SV("{::{<}"), input);

Expand Down Expand Up @@ -582,7 +572,6 @@ void test_pointer(TestFunction check, ExceptionTest check_exception) {

check_exception("The format string contains an invalid escape sequence", SV("{:}<}"), input);
check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
check_exception("The fill option contains an invalid value", SV("{::<}"), input);

// *** sign ***
check_exception("The format specifier should consume the input or end with a '}'", SV("{:#}"), input);
Expand Down Expand Up @@ -621,7 +610,6 @@ void test_pointer(TestFunction check, ExceptionTest check_exception) {
check(SV("{__0x0: 0x0___}"), SV("{::_^{}}"), input, 13);
check(SV("{#####0x0: 0x0}"), SV("{::#>{}}"), input, 13);

check_exception("The fill option contains an invalid value", SV("{:::<}"), input);
check_exception("The format string contains an invalid escape sequence", SV("{::}<}"), input);
check_exception("The fill option contains an invalid value", SV("{::{<}"), input);

Expand Down Expand Up @@ -685,7 +673,6 @@ void test_string(TestFunction check, ExceptionTest check_exception) {

check_exception("The format string contains an invalid escape sequence", SV("{:}<}"), input);
check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
check_exception("The fill option contains an invalid value", SV("{::<}"), input);

// *** sign ***
check_exception("The format specifier should consume the input or end with a '}'", SV("{:#}"), input);
Expand Down Expand Up @@ -724,7 +711,6 @@ void test_string(TestFunction check, ExceptionTest check_exception) {
check(SV(R"({__"hello": "HELLO"___, __"world": "WORLD"___})"), SV("{::_^{}}"), input, 21);
check(SV(R"({#####"hello": "HELLO", #####"world": "WORLD"})"), SV("{::#>{}}"), input, 21);

check_exception("The fill option contains an invalid value", SV("{:::<}"), input);
check_exception("The format string contains an invalid escape sequence", SV("{::}<}"), input);
check_exception("The fill option contains an invalid value", SV("{::{<}"), input);

Expand Down Expand Up @@ -788,7 +774,6 @@ void test_status(TestFunction check, ExceptionTest check_exception) {

check_exception("The format string contains an invalid escape sequence", SV("{:}<}"), input);
check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
check_exception("The fill option contains an invalid value", SV("{::<}"), input);

// *** sign ***
check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ void test_char_default(TestFunction check, ExceptionTest check_exception) {
check(SV("{'a', 'b', 'c'}^42"), SV("{:}^42"), input);
// when one is present there is no escaping,
check(SV("{a, b, c}"), SV("{::}"), input);
check(SV("{a, b, c}"), SV("{::<}"), input);
// unless forced by the type specifier.
check(SV("{'a', 'b', 'c'}"), SV("{::?}"), input);
check(SV("{'a', 'b', 'c'}"), SV("{::<?}"), input);

// ***** underlying has no format-spec

Expand All @@ -52,7 +54,6 @@ void test_char_default(TestFunction check, ExceptionTest check_exception) {

check_exception("The format string contains an invalid escape sequence", SV("{:}<}"), input);
check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
check_exception("The fill option contains an invalid value", SV("{::<}"), input);

// *** sign ***
check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
Expand Down Expand Up @@ -156,7 +157,6 @@ void test_char_string(TestFunction check, [[maybe_unused]] ExceptionTest check_e

check_exception("The format string contains an invalid escape sequence", SV("{:}<s}"), input);
check_exception("The fill option contains an invalid value", SV("{:{<s}"), input);
check_exception("The fill option contains an invalid value", SV("{::<s}"), input);

// *** sign ***
check_exception("The format specifier should consume the input or end with a '}'", SV("{:-s}"), input);
Expand All @@ -180,6 +180,7 @@ void test_char_string(TestFunction check, [[maybe_unused]] ExceptionTest check_e

// *** type ***
check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input);
check_exception("The type option contains an invalid value for a character formatting argument", SV("{::<s}"), input);

// ***** Only underlying has a format-spec
check_exception("Type s and an underlying format specification can't be used together", SV("{:s:}"), input);
Expand Down Expand Up @@ -215,7 +216,7 @@ void test_char_escaped_string(TestFunction check, [[maybe_unused]] ExceptionTest

check_exception("The format string contains an invalid escape sequence", SV("{:}<?s}"), input);
check_exception("The fill option contains an invalid value", SV("{:{<?s}"), input);
check_exception("The fill option contains an invalid value", SV("{::<?s}"), input);
check_exception("The format specifier should consume the input or end with a '}'", SV("{::<?s}"), input);

// *** sign ***
check_exception("The format specifier should consume the input or end with a '}'", SV("{:-?s}"), input);
Expand Down Expand Up @@ -271,8 +272,10 @@ void test_char_to_wchar(TestFunction check, ExceptionTest check_exception) {
check(SV("{'a', 'b', 'c'}^42"), SV("{:}^42"), input);
// when one is present there is no escaping,
check(SV("{a, b, c}"), SV("{::}"), input);
check(SV("{a, b, c}"), SV("{::<}"), input);
// unless forced by the type specifier.
check(SV("{'a', 'b', 'c'}"), SV("{::?}"), input);
check(SV("{'a', 'b', 'c'}"), SV("{::<?}"), input);

// ***** underlying has no format-spec

Expand All @@ -289,7 +292,6 @@ void test_char_to_wchar(TestFunction check, ExceptionTest check_exception) {

check_exception("The format string contains an invalid escape sequence", SV("{:}<}"), input);
check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
check_exception("The fill option contains an invalid value", SV("{::<}"), input);

// *** sign ***
check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
Expand Down Expand Up @@ -405,7 +407,6 @@ void test_bool(TestFunction check, ExceptionTest check_exception) {

check_exception("The format string contains an invalid escape sequence", SV("{:}<}"), input);
check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
check_exception("The fill option contains an invalid value", SV("{::<}"), input);

// *** sign ***
check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
Expand Down Expand Up @@ -512,7 +513,6 @@ void test_bool_multiset(TestFunction check, ExceptionTest check_exception) {

check_exception("The format string contains an invalid escape sequence", SV("{:}<}"), input);
check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
check_exception("The fill option contains an invalid value", SV("{::<}"), input);

// *** sign ***
check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
Expand Down Expand Up @@ -621,7 +621,6 @@ void test_int(TestFunction check, ExceptionTest check_exception, auto&& input) {

check_exception("The format string contains an invalid escape sequence", SV("{:}<}"), input);
check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
check_exception("The fill option contains an invalid value", SV("{::<}"), input);

// *** sign ***
check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
Expand Down Expand Up @@ -730,7 +729,6 @@ void test_floating_point(TestFunction check, ExceptionTest check_exception, auto

check_exception("The format string contains an invalid escape sequence", SV("{:}<}"), input);
check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
check_exception("The fill option contains an invalid value", SV("{::<}"), input);

// *** sign ***
check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
Expand Down Expand Up @@ -868,7 +866,6 @@ void test_pointer(TestFunction check, ExceptionTest check_exception, auto&& inpu

check_exception("The format string contains an invalid escape sequence", SV("{:}<}"), input);
check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
check_exception("The fill option contains an invalid value", SV("{::<}"), input);

// *** sign ***
check_exception("The format specifier should consume the input or end with a '}'", SV("{:#}"), input);
Expand Down Expand Up @@ -978,7 +975,6 @@ void test_string(TestFunction check, ExceptionTest check_exception, auto&& input

check_exception("The format string contains an invalid escape sequence", SV("{:}<}"), input);
check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
check_exception("The fill option contains an invalid value", SV("{::<}"), input);

// *** sign ***
check_exception("The format specifier should consume the input or end with a '}'", SV("{:#}"), input);
Expand Down Expand Up @@ -1091,7 +1087,6 @@ void test_status(TestFunction check, ExceptionTest check_exception) {

check_exception("The format string contains an invalid escape sequence", SV("{:}<}"), input);
check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
check_exception("The fill option contains an invalid value", SV("{::<}"), input);

// *** sign ***
check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
Expand Down Expand Up @@ -1160,7 +1155,6 @@ void test_pair_tuple(TestFunction check, ExceptionTest check_exception, auto&& i

check_exception("The format string contains an invalid escape sequence", SV("{:}<}"), input);
check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
check_exception("The fill option contains an invalid value", SV("{::<}"), input);

// *** sign ***
check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
Expand Down Expand Up @@ -1202,7 +1196,6 @@ void test_pair_tuple(TestFunction check, ExceptionTest check_exception, auto&& i
check(SV("{_(1, 'a')__, _(42, '*')_}"), SV("{::_^{}}"), input, 11);
check(SV("{###(1, 'a'), ##(42, '*')}"), SV("{::#>{}}"), input, 11);

check_exception("The fill option contains an invalid value", SV("{:::<}"), input);
check_exception("The format string contains an invalid escape sequence", SV("{::}<}"), input);
check_exception("The fill option contains an invalid value", SV("{::{<}"), input);

Expand Down Expand Up @@ -1284,7 +1277,6 @@ void test_tuple_int(TestFunction check, ExceptionTest check_exception) {

check_exception("The format string contains an invalid escape sequence", SV("{:}<}"), input);
check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
check_exception("The fill option contains an invalid value", SV("{::<}"), input);

// *** sign ***
check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
Expand Down Expand Up @@ -1325,7 +1317,6 @@ void test_tuple_int(TestFunction check, ExceptionTest check_exception) {
check(SV("{_(42)__, _(99)__}"), SV("{::_^{}}"), input, 7);
check(SV("{###(42), ###(99)}"), SV("{::#>{}}"), input, 7);

check_exception("The fill option contains an invalid value", SV("{:::<}"), input);
check_exception("The format string contains an invalid escape sequence", SV("{::}<}"), input);
check_exception("The fill option contains an invalid value", SV("{::{<}"), input);

Expand Down Expand Up @@ -1394,7 +1385,6 @@ void test_tuple_int_int_int(TestFunction check, ExceptionTest check_exception) {

check_exception("The format string contains an invalid escape sequence", SV("{:}<}"), input);
check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
check_exception("The fill option contains an invalid value", SV("{::<}"), input);

// *** sign ***
check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
Expand Down Expand Up @@ -1435,7 +1425,6 @@ void test_tuple_int_int_int(TestFunction check, ExceptionTest check_exception) {
check(SV("{_(1, 10, 100)_, _(42, 99, 0)__}"), SV("{::_^{}}"), input, 14);
check(SV("{##(1, 10, 100), ###(42, 99, 0)}"), SV("{::#>{}}"), input, 14);

check_exception("The fill option contains an invalid value", SV("{:::<}"), input);
check_exception("The format string contains an invalid escape sequence", SV("{::}<}"), input);
check_exception("The fill option contains an invalid value", SV("{::{<}"), input);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ void test_range_string(TestFunction check, ExceptionTest check_exception, auto&&

check_exception("The format string contains an invalid escape sequence", SV("{:}<}"), input);
check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
check_exception("The fill option contains an invalid value", SV("{::<}"), input);

// *** sign ***
check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
Expand Down Expand Up @@ -327,7 +326,6 @@ void test_range_debug_string(TestFunction check, ExceptionTest check_exception,

check_exception("The format string contains an invalid escape sequence", SV("{:}<}"), input);
check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
check_exception("The fill option contains an invalid value", SV("{::<}"), input);

// *** sign ***
check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ void test_char_default(TestFunction check, ExceptionTest check_exception, auto&&

// when one is present there is no escaping,
check(SV("[H, e, l, l, o]"), SV("{::}"), input);
check(SV("[H, e, l, l, o]"), SV("{::<}"), input);
// unless forced by the type specifier.
check(SV("['H', 'e', 'l', 'l', 'o']"), SV("{::?}"), input);
check(SV("['H', 'e', 'l', 'l', 'o']"), SV("{::<?}"), input);

// ***** underlying has no format-spec

Expand All @@ -57,7 +59,6 @@ void test_char_default(TestFunction check, ExceptionTest check_exception, auto&&

check_exception("The format string contains an invalid escape sequence", SV("{:}<}"), input);
check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
check_exception("The fill option contains an invalid value", SV("{::<}"), input);

// *** sign ***
check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
Expand Down Expand Up @@ -157,7 +158,6 @@ void test_char_string(TestFunction check, ExceptionTest check_exception, auto&&

check_exception("The format string contains an invalid escape sequence", SV("{:}<s}"), input);
check_exception("The fill option contains an invalid value", SV("{:{<s}"), input);
check_exception("The fill option contains an invalid value", SV("{::<s}"), input);

// *** sign ***
check_exception("The format specifier should consume the input or end with a '}'", SV("{:-s}"), input);
Expand All @@ -181,6 +181,7 @@ void test_char_string(TestFunction check, ExceptionTest check_exception, auto&&

// *** type ***
check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input);
check_exception("The type option contains an invalid value for a character formatting argument", SV("{::<s}"), input);

// ***** Only underlying has a format-spec
check_exception("Type s and an underlying format specification can't be used together", SV("{:s:}"), input);
Expand Down Expand Up @@ -210,7 +211,7 @@ void test_char_escaped_string(TestFunction check, ExceptionTest check_exception,

check_exception("The format string contains an invalid escape sequence", SV("{:}<?s}"), input);
check_exception("The fill option contains an invalid value", SV("{:{<?s}"), input);
check_exception("The fill option contains an invalid value", SV("{::<?s}"), input);
check_exception("The format specifier should consume the input or end with a '}'", SV("{::<?s}"), input);

// *** sign ***
check_exception("The format specifier should consume the input or end with a '}'", SV("{:-?s}"), input);
Expand Down Expand Up @@ -315,7 +316,6 @@ void test_bool(TestFunction check, ExceptionTest check_exception) {

check_exception("The format string contains an invalid escape sequence", SV("{:}<}"), input);
check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
check_exception("The fill option contains an invalid value", SV("{::<}"), input);

// *** sign ***
check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
Expand Down Expand Up @@ -423,7 +423,6 @@ void test_int(TestFunction check, ExceptionTest check_exception, auto&& input) {

check_exception("The format string contains an invalid escape sequence", SV("{:}<}"), input);
check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
check_exception("The fill option contains an invalid value", SV("{::<}"), input);

// *** sign ***
check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
Expand Down Expand Up @@ -534,7 +533,6 @@ void test_floating_point(TestFunction check, ExceptionTest check_exception, auto

check_exception("The format string contains an invalid escape sequence", SV("{:}<}"), input);
check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
check_exception("The fill option contains an invalid value", SV("{::<}"), input);

// *** sign ***
check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
Expand Down Expand Up @@ -673,7 +671,6 @@ void test_pointer(TestFunction check, ExceptionTest check_exception, auto&& inpu

check_exception("The format string contains an invalid escape sequence", SV("{:}<}"), input);
check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
check_exception("The fill option contains an invalid value", SV("{::<}"), input);

// *** sign ***
check_exception("The format specifier should consume the input or end with a '}'", SV("{:#}"), input);
Expand Down Expand Up @@ -782,7 +779,6 @@ void test_string(TestFunction check, ExceptionTest check_exception, auto&& input

check_exception("The format string contains an invalid escape sequence", SV("{:}<}"), input);
check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
check_exception("The fill option contains an invalid value", SV("{::<}"), input);

// *** sign ***
check_exception("The format specifier should consume the input or end with a '}'", SV("{:#}"), input);
Expand Down Expand Up @@ -895,7 +891,6 @@ void test_status(TestFunction check, ExceptionTest check_exception) {

check_exception("The format string contains an invalid escape sequence", SV("{:}<}"), input);
check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
check_exception("The fill option contains an invalid value", SV("{::<}"), input);

// *** sign ***
check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
Expand Down Expand Up @@ -978,7 +973,6 @@ void test_pair_tuple(TestFunction check, ExceptionTest check_exception, auto&& i

check_exception("The format string contains an invalid escape sequence", SV("{:}<}"), input);
check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
check_exception("The fill option contains an invalid value", SV("{::<}"), input);

// *** sign ***
check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
Expand Down Expand Up @@ -1019,7 +1013,6 @@ void test_pair_tuple(TestFunction check, ExceptionTest check_exception, auto&& i
check(SV("[_(1, 'a')__, _(42, '*')_]"), SV("{::_^{}}"), input, 11);
check(SV("[###(1, 'a'), ##(42, '*')]"), SV("{::#>{}}"), input, 11);

check_exception("The fill option contains an invalid value", SV("{:::<}"), input);
check_exception("The format string contains an invalid escape sequence", SV("{::}<}"), input);
check_exception("The fill option contains an invalid value", SV("{::{<}"), input);

Expand Down Expand Up @@ -1098,7 +1091,6 @@ void test_tuple_int(TestFunction check, ExceptionTest check_exception) {

check_exception("The format string contains an invalid escape sequence", SV("{:}<}"), input);
check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
check_exception("The fill option contains an invalid value", SV("{::<}"), input);

// *** sign ***
check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
Expand Down Expand Up @@ -1138,7 +1130,6 @@ void test_tuple_int(TestFunction check, ExceptionTest check_exception) {
check(SV("[_(42)__, _(99)__]"), SV("{::_^{}}"), input, 7);
check(SV("[###(42), ###(99)]"), SV("{::#>{}}"), input, 7);

check_exception("The fill option contains an invalid value", SV("{:::<}"), input);
check_exception("The format string contains an invalid escape sequence", SV("{::}<}"), input);
check_exception("The fill option contains an invalid value", SV("{::{<}"), input);

Expand Down Expand Up @@ -1203,7 +1194,6 @@ void test_tuple_int_int_int(TestFunction check, ExceptionTest check_exception) {

check_exception("The format string contains an invalid escape sequence", SV("{:}<}"), input);
check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
check_exception("The fill option contains an invalid value", SV("{::<}"), input);

// *** sign ***
check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
Expand Down Expand Up @@ -1243,7 +1233,6 @@ void test_tuple_int_int_int(TestFunction check, ExceptionTest check_exception) {
check(SV("[_(42, 99, 0)__, _(1, 10, 100)_]"), SV("{::_^{}}"), input, 14);
check(SV("[###(42, 99, 0), ##(1, 10, 100)]"), SV("{::#>{}}"), input, 14);

check_exception("The fill option contains an invalid value", SV("{:::<}"), input);
check_exception("The format string contains an invalid escape sequence", SV("{::}<}"), input);
check_exception("The fill option contains an invalid value", SV("{::{<}"), input);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ void test_tuple_or_pair_int_int(TestFunction check, ExceptionTest check_exceptio

check_exception("The format string contains an invalid escape sequence", SV("{:}<}"), input);
check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
check_exception("The fill option contains an invalid value", SV("{::<}"), input);

// *** sign ***
check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
Expand Down Expand Up @@ -95,7 +94,6 @@ void test_tuple_or_pair_int_string(TestFunction check, ExceptionTest check_excep

check_exception("The format string contains an invalid escape sequence", SV("{:}<}"), input);
check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
check_exception("The fill option contains an invalid value", SV("{::<}"), input);

// *** sign ***
check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
Expand Down Expand Up @@ -187,7 +185,6 @@ void test_tuple_int(TestFunction check, ExceptionTest check_exception) {

check_exception("The format string contains an invalid escape sequence", SV("{:}<}"), input);
check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
check_exception("The fill option contains an invalid value", SV("{::<}"), input);

// *** sign ***
check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
Expand Down Expand Up @@ -238,7 +235,6 @@ void test_tuple_int_string_color(TestFunction check, ExceptionTest check_excepti

check_exception("The format string contains an invalid escape sequence", SV("{:}<}"), input);
check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
check_exception("The fill option contains an invalid value", SV("{::<}"), input);

// *** sign ***
check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
Expand Down Expand Up @@ -313,7 +309,6 @@ void test_nested(TestFunction check, ExceptionTest check_exception, Nested&& inp

check_exception("The format string contains an invalid escape sequence", SV("{:}<}"), input);
check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
check_exception("The fill option contains an invalid value", SV("{::<}"), input);

// *** sign ***
check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
Expand Down
2 changes: 0 additions & 2 deletions libcxx/utils/generate_iwyu_mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ def IWYU_mapping(header: str) -> typing.Optional[typing.List[str]]:
return ["atomic", "mutex", "semaphore", "thread"]
elif header == "__tree":
return ["map", "set"]
elif header == "__fwd/hash.h":
return ["functional"]
elif header == "__fwd/pair.h":
return ["utility"]
elif header == "__fwd/subrange.h":
Expand Down
1 change: 0 additions & 1 deletion libcxx/utils/libcxx/test/format.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,6 @@ def getTestsForPath(self, testSuite, pathInSuite, litConfig, localConfig):
"[.]sh[.][^.]+$",
"[.]gen[.][^.]+$",
"[.]verify[.]cpp$",
"[.]fail[.]cpp$",
]

sourcePath = testSuite.getSourcePath(pathInSuite)
Expand Down
9 changes: 4 additions & 5 deletions llvm/docs/Contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,9 @@ in order to update the last commit with all pending changes.
``clang/tools/clang-format/git-clang-format``.

The LLVM project has migrated to GitHub Pull Requests as its review process.
We still have an active :ref:`Phabricator <phabricator-reviews>`
instance for the duration of the migration. If you want to contribute to LLVM
now, please use GitHub. For more information about the workflow of using GitHub
Pull Requests see our :ref:`GitHub <github-reviews>` documentation.
For more information about the workflow of using GitHub Pull Requests see our
:ref:`GitHub <github-reviews>` documentation. We still have an read-only
`LLVM's Phabricator <https://reviews.llvm.org>`_ instance.

To make sure the right people see your patch, please select suitable reviewers
and add them to your patch when requesting a review. Suitable reviewers are the
Expand Down Expand Up @@ -185,5 +184,5 @@ of LLVM's high-level design, as well as its internals:
.. _clang-format-diff.py: https://reviews.llvm.org/source/llvm-github/browse/main/clang/tools/clang-format/clang-format-diff.py
.. _git-clang-format: https://reviews.llvm.org/source/llvm-github/browse/main/clang/tools/clang-format/git-clang-format
.. _LLVM's GitHub: https://github.com/llvm/llvm-project
.. _LLVM's Phabricator (deprecated): https://reviews.llvm.org/
.. _LLVM's Phabricator (read-only): https://reviews.llvm.org/
.. _LLVM's Open Projects page: https://llvm.org/OpenProjects.html#what
4 changes: 2 additions & 2 deletions llvm/docs/DeveloperPolicy.rst
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ awareness of. For such changes, the following should be done:

.. warning::

Phabricator is deprecated and will be switched to read-only mode in October
2023, for new code contributions use :ref:`GitHub Pull Requests <github-reviews>`.
Phabricator is deprecated is available in read-only mode,
for new code contributions use :ref:`GitHub Pull Requests <github-reviews>`.
This section contains old information that needs to be updated.

* When performing the code review for the change, please add any applicable
Expand Down
Loading